@marktiderman/genesis-cli 1.27.0 → 1.28.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.
package/dist/expo.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ConfigPlugin } from '@expo/config-plugins';
2
2
  import { ExpoConfig } from '@expo/config-types';
3
- import { G as GenesisDataUse, a as GenesisPrivacy, b as GenesisLinks } from './config-ARs2YQ60.js';
4
- export { c as GenesisConfigError, P as PRIVACY_DATA_TYPES, d as PRIVACY_PURPOSES, p as privacyDataType, r as readGenesisConfig, v as validateLinks, e as validatePrivacy } from './config-ARs2YQ60.js';
3
+ import { G as GenesisDataUse, a as GenesisPrivacy, b as GenesisLinks } from './config-BmMsEWU-.js';
4
+ export { c as GenesisConfigError, P as PRIVACY_DATA_TYPES, d as PRIVACY_PURPOSES, p as privacyDataType, r as readGenesisConfig, v as validateLinks, e as validatePrivacy } from './config-BmMsEWU-.js';
5
5
  import '@marktiderman/genesis-features';
6
6
 
7
7
  declare const APP_VARIANTS: readonly ["development", "preview", "production"];
package/dist/expo.js CHANGED
@@ -96,6 +96,7 @@ function readGenesisConfig(root) {
96
96
  }
97
97
  if (raw.appFolder !== void 0) out.appFolder = validateAppFolder(raw.appFolder, file);
98
98
  if (raw.environments !== void 0) out.environments = validateEnvironments(raw.environments, file);
99
+ if (raw.client !== void 0) out.client = validateClient(raw.client, file);
99
100
  return out;
100
101
  }
101
102
  var PLAIN_FOLDER = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,59}(?:\/[A-Za-z0-9_][A-Za-z0-9_.-]{0,59}){0,7}$/;
@@ -107,6 +108,16 @@ function validateAppFolder(raw, source = "config") {
107
108
  if (!isPlainFolder(norm)) throw new GenesisConfigError(`${source}: "appFolder" must be the app's folder from the repository root, such as "mobile" or "apps/phone" (got ${JSON.stringify(raw)})`);
108
109
  return norm;
109
110
  }
111
+ function validateClient(raw, source = "config") {
112
+ const fail = (msg) => {
113
+ throw new GenesisConfigError(`${source}: ${msg}`);
114
+ };
115
+ if (!isObject(raw)) return fail(`"client" must be { "dir": "<the client layer's folder, e.g. src/client>" }`);
116
+ for (const key of Object.keys(raw)) if (key !== "dir" && key !== "$comment") fail(`client: unknown setting "${key}" (known: dir)`);
117
+ const dir = typeof raw.dir === "string" ? raw.dir.replace(/^\.\//, "").replace(/\/+$/, "") : "";
118
+ if (!isPlainFolder(dir)) return fail(`client.dir must be a folder inside the app, such as "src/client" (got ${JSON.stringify(raw.dir)})`);
119
+ return { dir };
120
+ }
110
121
  function validateSupabase(raw, source = "config") {
111
122
  const fail = (msg) => {
112
123
  throw new GenesisConfigError(`${source}: ${msg}`);
package/dist/expo.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/doctor/config.ts","../src/expo.ts"],"names":["api","path2","existsSync","readFileSync"],"mappings":";;;;AAcO,IAAM,kBAAA,GAAN,cAAiC,KAAA,CAAM;AAAA,EACnC,IAAA,GAAO,oBAAA;AAClB;AAEO,IAAM,iBAAA,GAAN,cAAgC,kBAAA,CAAmB;AAAA,EAC/C,IAAA,GAAO,mBAAA;AAClB,CAAA;AAoBO,IAAM,kBAAA,GAAuD;AAAA,EAClE,IAAA,EAAM,gCAAA;AAAA,EACN,eAAA,EAAiB,wCAAA;AAAA,EACjB,cAAA,EAAgB,uCAAA;AAAA,EAChB,kBAAA,EAAoB,2CAAA;AAAA,EACpB,yBAAA,EAA2B,gDAAA;AAAA,EAC3B,MAAA,EAAQ,kCAAA;AAAA,EACR,OAAA,EAAS,mCAAA;AAAA,EACT,cAAA,EAAgB,uCAAA;AAAA,EAChB,aAAA,EAAe,sCAAA;AAAA,EACf,sBAAA,EAAwB,8CAAA;AAAA,EACxB,kBAAA,EAAoB,2CAAA;AAAA,EACpB,iBAAA,EAAmB,0CAAA;AAAA,EACnB,gBAAA,EAAkB,yCAAA;AAAA,EAClB,QAAA,EAAU,oCAAA;AAAA,EACV,yBAAA,EAA2B,gDAAA;A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AAO,IAAA,KAAS,QAAA,GAAW,OAAO,EAAC;AAAA,EACpD,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,IAAI,kBAAA,CAAmB,CAAA,EAAG,IAAI,CAAA,oBAAA,EAAwB,GAAA,CAAc,OAAO,CAAA,CAAE,CAAA;AAAA,EACrF;AACF;AAEA,SAAS,KAAA,CAAM,GAAa,CAAA,EAAuB;AACjD,EAAA,OAAO,CAAC,mBAAG,IAAI,GAAA,CAAI,CAAC,GAAG,CAAA,EAAG,GAAG,CAAC,CAAC,CAAC,CAAA;AAClC","file":"expo.js","sourcesContent":["/**\n * Finds and validates the app's genesis.config.json.\n *\n * The doctor's lookup order: `--config <path>`, then `genesis.config.json`\n * in the app root, then the `genesis` key of package.json. Either file holds\n * the settings under `doctor`, beside other blocks: `features` (read by\n * `genesis features`) and `links` (validated here, read by the Expo config\n * plugin).\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { DoctorConfig } from \"./types.js\";\n\n/** A genesis.config.json that can't be read or has a block of the wrong shape. */\nexport class GenesisConfigError extends Error {\n override name = \"GenesisConfigError\";\n}\n\nexport class DoctorConfigError extends GenesisConfigError {\n override name = \"DoctorConfigError\";\n}\n\n/** The `links` block: the web hosts (and optional path prefixes) the app opens as universal / app links. */\nexport interface GenesisLinks {\n /** Bare host names, such as `example.com` or `app.example.com`: no scheme, path or port. */\n hosts: string[];\n /** Path prefixes the app handles, each starting with `/`. Default: every path. */\n paths?: string[];\n /** Also add `webcredentials:` domains (password autofill). Default true. */\n webcredentials?: boolean;\n}\n\n/**\n * Apple's collected data types (`NSPrivacyCollectedDataType`), every one in\n * Apple's reference, keyed by the stores' own words, lower case, as Genesis\n * blocks name them in `privacy.collects`. Look one up with\n * {@link privacyDataType}, which ignores case (blocks write `\"device ID\"`,\n * `\"user ID\"`). The values are Apple's exact strings, `PhotosorVideos`\n * included.\n */\nexport const PRIVACY_DATA_TYPES: Readonly<Record<string, string>> = {\n name: \"NSPrivacyCollectedDataTypeName\",\n \"email address\": \"NSPrivacyCollectedDataTypeEmailAddress\",\n \"phone number\": \"NSPrivacyCollectedDataTypePhoneNumber\",\n \"physical address\": \"NSPrivacyCollectedDataTypePhysicalAddress\",\n \"other user contact info\": \"NSPrivacyCollectedDataTypeOtherUserContactInfo\",\n health: \"NSPrivacyCollectedDataTypeHealth\",\n fitness: \"NSPrivacyCollectedDataTypeFitness\",\n \"payment info\": \"NSPrivacyCollectedDataTypePaymentInfo\",\n \"credit info\": \"NSPrivacyCollectedDataTypeCreditInfo\",\n \"other financial info\": \"NSPrivacyCollectedDataTypeOtherFinancialInfo\",\n \"precise location\": \"NSPrivacyCollectedDataTypePreciseLocation\",\n \"coarse location\": \"NSPrivacyCollectedDataTypeCoarseLocation\",\n \"sensitive info\": \"NSPrivacyCollectedDataTypeSensitiveInfo\",\n contacts: \"NSPrivacyCollectedDataTypeContacts\",\n \"emails or text messages\": \"NSPrivacyCollectedDataTypeEmailsOrTextMessages\",\n \"photos or videos\": \"NSPrivacyCollectedDataTypePhotosorVideos\",\n \"audio data\": \"NSPrivacyCollectedDataTypeAudioData\",\n \"gameplay content\": \"NSPrivacyCollectedDataTypeGameplayContent\",\n \"customer support\": \"NSPrivacyCollectedDataTypeCustomerSupport\",\n \"other user content\": \"NSPrivacyCollectedDataTypeOtherUserContent\",\n \"browsing history\": \"NSPrivacyCollectedDataTypeBrowsingHistory\",\n \"search history\": \"NSPrivacyCollectedDataTypeSearchHistory\",\n \"user id\": \"NSPrivacyCollectedDataTypeUserID\",\n \"device id\": \"NSPrivacyCollectedDataTypeDeviceID\",\n \"purchase history\": \"NSPrivacyCollectedDataTypePurchaseHistory\",\n \"product interaction\": \"NSPrivacyCollectedDataTypeProductInteraction\",\n \"advertising data\": \"NSPrivacyCollectedDataTypeAdvertisingData\",\n \"other usage data\": \"NSPrivacyCollectedDataTypeOtherUsageData\",\n \"crash data\": \"NSPrivacyCollectedDataTypeCrashData\",\n \"performance data\": \"NSPrivacyCollectedDataTypePerformanceData\",\n \"other diagnostic data\": \"NSPrivacyCollectedDataTypeOtherDiagnosticData\",\n \"environment scanning\": \"NSPrivacyCollectedDataTypeEnvironmentScanning\",\n hands: \"NSPrivacyCollectedDataTypeHands\",\n head: \"NSPrivacyCollectedDataTypeHead\",\n \"other data types\": \"NSPrivacyCollectedDataTypeOtherDataTypes\",\n};\n\n/** Apple's string for a data type in the stores' words, whatever its case, or undefined. */\nexport function privacyDataType(type: string): string | undefined {\n return PRIVACY_DATA_TYPES[type.toLowerCase()];\n}\n\n/** Apple's collection purposes (`NSPrivacyCollectedDataTypePurposes`), by the stores' words. */\nexport const PRIVACY_PURPOSES: Readonly<Record<string, string>> = {\n \"app functionality\": \"NSPrivacyCollectedDataTypePurposeAppFunctionality\",\n analytics: \"NSPrivacyCollectedDataTypePurposeAnalytics\",\n \"product personalization\": \"NSPrivacyCollectedDataTypePurposeProductPersonalization\",\n \"developer advertising\": \"NSPrivacyCollectedDataTypePurposeDeveloperAdvertising\",\n \"third-party advertising\": \"NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising\",\n other: \"NSPrivacyCollectedDataTypePurposeOther\",\n};\n\n/** One kind of data the app collects, as a Genesis block's `privacy.collects` entry says it. */\nexport interface GenesisDataUse {\n /** A key of {@link PRIVACY_DATA_TYPES}: `\"email address\"`, `\"user id\"`, `\"crash data\"`… */\n type: string;\n /** Keys of {@link PRIVACY_PURPOSES}: `\"app functionality\"`, `\"analytics\"`… */\n purposes: string[];\n /** Tied to the person's identity. */\n linked: boolean;\n /** Used to track the person across other companies' apps and websites. */\n tracking: boolean;\n}\n\n/**\n * The `privacy` block: what goes in the iOS privacy manifest's collected data\n * types. Left out, the Genesis blocks the app's packages carry decide.\n */\nexport interface GenesisPrivacy {\n /** The Genesis blocks whose data the app sends anywhere (`account`, `observability`, `push`). Default: found from package.json. */\n blocks?: string[];\n /** Every kind of data the app collects. Replaces what the blocks give, so list everything. */\n collects?: GenesisDataUse[];\n /** `NSPrivacyTracking`. Default false; true needs `NSPrivacyTrackingDomains` in app.config. */\n tracking?: boolean;\n}\n\n/**\n * The top-level `supabase` setting: where this app's database files (migrations, pgTAP tests,\n * Edge Functions, config.toml) live. Left out (or `true`), they are this app's own `supabase/`.\n * `false`: this app has none. `{ app }`: another Genesis app's folder, relative to this one\n * (`\"../app\"`), whose `supabase/` holds them; a phone app beside a web app shares its database.\n * Either way `genesis add`, `migrate`, `upgrade` and `init` never write or plan Supabase files\n * here, and the doctor's supabase pack doesn't run.\n */\nexport type GenesisSupabase = false | { app: string };\n\n/** genesis.config.json, parsed, with its shared blocks validated. */\nexport interface GenesisConfigFile {\n /** The whole parsed file, for blocks other readers own (`doctor`, `features`). */\n raw: Record<string, unknown>;\n links?: GenesisLinks;\n privacy?: GenesisPrivacy;\n /** Set only when the database files live elsewhere (see {@link GenesisSupabase}). */\n supabase?: GenesisSupabase;\n /** Where this app sits in its repository (`mobile`), when that isn't the root: see {@link validateAppFolder}. */\n appFolder?: string;\n /** Preview defaults the templates read (templates/vercel/ignore-build.sh): see {@link validateEnvironments}. */\n environments?: GenesisEnvironments;\n}\n\n/** The app's preview defaults. A variable set where the build runs wins over these; these win over Genesis's defaults. */\nexport interface GenesisEnvironments {\n /** on-demand (the default), every-pr or off. */\n previews?: \"on-demand\" | \"every-pr\" | \"off\";\n /** The pull request label that asks for a preview; \"\" turns the label check off. */\n label?: string;\n /** The branch prefix that asks for a preview; \"\" turns the branch check off. */\n branchPrefix?: string;\n}\n\nconst ENVIRONMENT_KEYS = new Set([\"previews\", \"label\", \"branchPrefix\", \"$comment\"]);\n\n/** Check the top-level `environments` block: unknown keys and values fail, so a typo can't silently do nothing. */\nexport function validateEnvironments(raw: unknown, source = \"config\"): GenesisEnvironments {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) return fail(`\"environments\" must be an object`);\n for (const key of Object.keys(raw)) if (!ENVIRONMENT_KEYS.has(key)) fail(`environments: unknown setting \"${key}\" (known: previews, label, branchPrefix)`);\n const out: GenesisEnvironments = {};\n if (raw.previews !== undefined) {\n if (raw.previews !== \"on-demand\" && raw.previews !== \"every-pr\" && raw.previews !== \"off\") fail(`environments.previews must be \"on-demand\", \"every-pr\" or \"off\" (got ${JSON.stringify(raw.previews)})`);\n out.previews = raw.previews as GenesisEnvironments[\"previews\"];\n }\n for (const key of [\"label\", \"branchPrefix\"] as const) {\n if (raw[key] === undefined) continue;\n if (typeof raw[key] !== \"string\") fail(`environments.${key} must be a string (\"\" turns that check off)`);\n out[key] = raw[key] as string;\n }\n return out;\n}\n\nexport interface LoadedConfig {\n config: DoctorConfig;\n /** The file it came from, or null when no config exists (defaults apply). */\n file: string | null;\n /** Folder that relative plugin paths resolve against. */\n dir: string;\n}\n\nconst STRING_LISTS = [\"src\", \"extensions\", \"ignore\", \"tokenFiles\", \"ignoreTokenPrefixes\", \"localPrimitiveDirs\", \"build\", \"componentPackages\"] as const;\nconst STRINGS = [\"uiPackage\", \"rulesDoc\"] as const;\nconst KNOWN = new Set<string>([\n ...STRING_LISTS,\n ...STRINGS,\n \"themeCss\",\n \"rawTags\",\n \"forbiddenImports\",\n \"rules\",\n \"allow\",\n \"extend\",\n \"patterns\",\n \"plugins\",\n \"packs\",\n \"native\",\n \"supabase\",\n \"packages\",\n \"routesDir\",\n \"packageRules\",\n \"ratchet\",\n \"contracts\",\n \"$schema\",\n \"$comment\",\n]);\nconst LEVELS = new Set([\"error\", \"warn\", \"info\", \"off\"]);\n/**\n * The rules that guard `allow`, `rules` and `packageRules` themselves under `--base`. Config can't\n * lower or allow them (an entry for one would switch its own check off), and the ratchet never lowers them.\n */\nexport const META_RULES: ReadonlySet<string> = new Set([\"allow-grew\", \"rules-weakened\", \"ratchet-skipped\", \"extension-invalid\"]);\n/** Rules about the config's own entries: an extension can't cover them. */\nconst CONFIG_RULES = new Set([\"stale-exception\", \"stale-extension\", \"package-rule-override\"]);\nconst EXTENSION_KEYS = new Set([\"rule\", \"file\", \"buildsOn\", \"reason\", \"upstream\"]);\n/** A declared extension's reason is a sentence a reviewer can check, not a word. */\nexport const EXTENSION_REASON_MIN = { chars: 40, words: 6 } as const;\nconst PATTERN_KEYS = new Set([\"id\", \"level\", \"files\", \"exclude\", \"forbid\", \"require\", \"path\", \"message\", \"newOnly\"]);\nconst PACKAGE_RULE_KEYS = new Set([\"level\", \"files\", \"exclude\", \"reason\"]);\nconst CONTRACT_KEYS = new Set([\"out\", \"schemas\", \"databaseEnv\"]);\nconst PACKS = new Set([\"native\", \"supabase\", \"packages\"]);\n/** Each pack's settings: key → \"string\", \"path\" (app-relative folder, normalized), \"list\" or \"boolean\". */\nconst PACK_KEYS: Record<string, Record<string, \"string\" | \"path\" | \"list\" | \"boolean\">> = {\n native: { routerRoot: \"path\" },\n supabase: { migrations: \"path\", base: \"string\", exposedSchemas: \"list\", since: \"string\", automaticBranching: \"boolean\" },\n packages: { base: \"string\" },\n};\n\n/** An app-relative folder in POSIX form (`./app/` → `app`); absolute paths and paths leaving the app are rejected. */\nfunction appPath(v: unknown, where: string, fail: (msg: string) => never): string {\n if (typeof v !== \"string\" || !v.trim()) return fail(`${where} must be a non-empty path`);\n if (path.isAbsolute(v) || /^[A-Za-z]:[\\\\/]/.test(v)) fail(`${where} must be relative to the app, not absolute (\"${v}\")`);\n const norm = path.posix.normalize(v.replace(/\\\\/g, \"/\")).replace(/\\/+$/, \"\");\n if (norm === \".\" || norm === \"..\" || norm.startsWith(\"../\")) fail(`${where} must be a folder inside the app (\"${v}\")`);\n return norm;\n}\n\nexport function loadConfig(root: string, configPath?: string): LoadedConfig {\n if (configPath) {\n const file = path.resolve(root, configPath);\n if (!existsSync(file)) throw new DoctorConfigError(`Config file not found: ${configPath}`);\n const json = readJson(file);\n // An explicit file may hold the block at the top level or under `doctor`\n // (or, for a package.json, under `genesis.doctor`).\n const block = path.basename(file) === \"package.json\" ? json?.genesis?.doctor : json?.doctor ?? json;\n return { config: validateConfig(block ?? {}, file), file, dir: path.dirname(file) };\n }\n const own = path.join(root, \"genesis.config.json\");\n if (existsSync(own)) {\n const block = readGenesisConfig(root)?.raw.doctor;\n return { config: validateConfig(block ?? {}, own), file: own, dir: root };\n }\n const pkg = path.join(root, \"package.json\");\n if (existsSync(pkg)) {\n const block = readJson(pkg)?.genesis?.doctor;\n // A Genesis package's own `genesis.doctor` is what it enforces in apps (package-rules.ts), not settings.\n if (block !== undefined && !isPackageDeclaration(block)) return { config: validateConfig(block, pkg), file: pkg, dir: root };\n }\n return { config: {}, file: null, dir: root };\n}\n\n/**\n * Where a config file keeps the doctor settings, as loadConfig reads it: a package.json under\n * `genesis.doctor`, genesis.config.json under `doctor`, an explicit file under `doctor` or at the top.\n */\nexport function doctorBlock(json: unknown, file: string, explicit: boolean): unknown {\n const j = json as { doctor?: unknown; genesis?: { doctor?: unknown } } | null;\n if (path.basename(file) === \"package.json\") return j?.genesis?.doctor;\n return explicit ? (j?.doctor ?? j) : j?.doctor;\n}\n\n/**\n * A package's rule declaration (`prefer`, `catalog` or its old name `primitives`, `plugin`, `enforce`), as opposed to an app's\n * doctor settings. A block that also holds an app setting is the app's, so a typo such as `plugin`\n * beside `rules` reaches validateConfig and fails instead of hiding the whole block.\n */\nexport function isPackageDeclaration(block: unknown): boolean {\n if (typeof block === \"string\") return true;\n if (!isObject(block)) return false;\n const keys = Object.keys(block).filter((k) => k !== \"$comment\");\n return keys.some((k) => [\"prefer\", \"catalog\", \"primitives\", \"plugin\", \"enforce\"].includes(k)) && !keys.some((k) => KNOWN.has(k));\n}\n\nfunction readJson(file: string) {\n try {\n return JSON.parse(readFileSync(file, \"utf8\"));\n } catch (err) {\n throw new DoctorConfigError(`${file} is not valid JSON: ${(err as Error).message}`);\n }\n}\n\n/**\n * Reads `<root>/genesis.config.json` and validates its shared blocks (today:\n * `links` and `privacy`). Returns null when the file doesn't exist; throws a\n * GenesisConfigError naming the file when it isn't valid.\n */\nexport function readGenesisConfig(root: string): GenesisConfigFile | null {\n const file = path.join(root, \"genesis.config.json\");\n if (!existsSync(file)) return null;\n const raw: unknown = readJson(file);\n if (!isObject(raw)) throw new GenesisConfigError(`${file}: the config must be a JSON object`);\n const out: GenesisConfigFile = { raw };\n if (raw.links !== undefined) out.links = validateLinks(raw.links, file);\n if (raw.privacy !== undefined) out.privacy = validatePrivacy(raw.privacy, file);\n if (raw.supabase !== undefined) {\n const supabase = validateSupabase(raw.supabase, file);\n if (supabase !== true) out.supabase = supabase;\n }\n if (raw.appFolder !== undefined) out.appFolder = validateAppFolder(raw.appFolder, file);\n if (raw.environments !== undefined) out.environments = validateEnvironments(raw.environments, file);\n // localPackages is read and validated by blocks/local.ts where it's used (doctor, add, migrate);\n // the Expo config plugin loads this file too and must not pull the CLI's block code in.\n return out;\n}\n\nconst PLAIN_FOLDER = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,59}(?:\\/[A-Za-z0-9_][A-Za-z0-9_.-]{0,59}){0,7}$/;\n\n/** A plain relative folder (`src`, `apps/web`): no `..`, not absolute, and nothing a YAML string would need escaped. */\nexport function isPlainFolder(value: string): boolean {\n return PLAIN_FOLDER.test(value) && !value.split(\"/\").includes(\"..\");\n}\n\n/**\n * Check the top-level `appFolder` setting: the app's folder from the repository root (`\"mobile\"`).\n * `genesis upgrade` writes the EAS workflows' `paths` from the repository root with it, and leaves\n * `.github/workflows` to the repository (blocks/app-folder.ts).\n */\nexport function validateAppFolder(raw: unknown, source = \"config\"): string {\n const norm = typeof raw === \"string\" ? raw.replace(/^\\.\\//, \"\").replace(/\\/+$/, \"\") : \"\";\n if (!isPlainFolder(norm)) throw new GenesisConfigError(`${source}: \"appFolder\" must be the app's folder from the repository root, such as \"mobile\" or \"apps/phone\" (got ${JSON.stringify(raw)})`);\n return norm;\n}\n\n/** Check the top-level `supabase` setting: `true`, `false` or `{ \"app\": \"<relative folder>\" }`. */\nexport function validateSupabase(raw: unknown, source = \"config\"): GenesisSupabase | true {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (typeof raw === \"boolean\") return raw ? true : false;\n if (!isObject(raw)) return fail(`\"supabase\" must be false or { \"app\": \"<the folder of the app that holds supabase/>\" }`);\n for (const key of Object.keys(raw)) if (key !== \"app\" && key !== \"$comment\") fail(`supabase: unknown setting \"${key}\" (known: app)`);\n const app = raw.app;\n if (typeof app !== \"string\" || !app.trim()) return fail(`supabase.app must be the folder of the app that holds supabase/, relative to this one (e.g. \"../app\")`);\n if (path.isAbsolute(app) || /^[A-Za-z]:[\\\\/]/.test(app) || app.includes(\"\\\\\")) fail(`supabase.app must be relative to this app, with forward slashes (\"${app}\")`);\n const norm = path.posix.normalize(app).replace(/\\/+$/, \"\");\n if (norm === \".\" || norm === \"\") fail(`supabase.app names this app itself; leave \"supabase\" out instead`);\n return { app: norm };\n}\n\nconst PRIVACY_KEYS = new Set([\"blocks\", \"collects\", \"tracking\"]);\nconst DATA_USE_KEYS = new Set([\"type\", \"purposes\", \"linked\", \"tracking\"]);\n\n/**\n * Check a `privacy` block (genesis.config.json's, or the plugin's `privacy`\n * option): a misspelt data type or purpose fails the build, since Xcode's\n * privacy report ignores values it doesn't know.\n */\nexport function validatePrivacy(raw: unknown, source = \"config\"): GenesisPrivacy {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) fail(`\"privacy\" must be an object`);\n const c = raw as Record<string, unknown>;\n for (const key of Object.keys(c)) if (!PRIVACY_KEYS.has(key)) fail(`privacy: unknown setting \"${key}\"`);\n const out: GenesisPrivacy = {};\n if (c.blocks !== undefined) {\n if (!isStringList(c.blocks)) fail(`privacy.blocks must be a list of block ids`);\n out.blocks = [...new Set(c.blocks as string[])];\n }\n if (c.tracking !== undefined) {\n if (typeof c.tracking !== \"boolean\") fail(`privacy.tracking must be true or false`);\n out.tracking = c.tracking as boolean;\n }\n if (c.collects !== undefined) {\n if (!Array.isArray(c.collects)) fail(`privacy.collects must be a list`);\n out.collects = (c.collects as unknown[]).map((entry, i) => {\n const where = `privacy.collects[${i}]`;\n if (!isObject(entry)) return fail(`${where} must be an object`);\n for (const key of Object.keys(entry)) if (!DATA_USE_KEYS.has(key)) fail(`${where}: unknown setting \"${key}\"`);\n if (typeof entry.type !== \"string\" || !privacyDataType(entry.type)) {\n fail(`${where}.type \"${String(entry.type)}\" is not one of ${Object.keys(PRIVACY_DATA_TYPES).join(\", \")}`);\n }\n if (!isStringList(entry.purposes) || entry.purposes.length === 0) fail(`${where}.purposes must be a non-empty list`);\n for (const p of entry.purposes as string[]) {\n if (!(p in PRIVACY_PURPOSES)) fail(`${where}.purposes: \"${p}\" is not one of ${Object.keys(PRIVACY_PURPOSES).join(\", \")}`);\n }\n if (typeof entry.linked !== \"boolean\") fail(`${where}.linked must be true or false`);\n if (typeof entry.tracking !== \"boolean\") fail(`${where}.tracking must be true or false`);\n return { type: entry.type as string, purposes: [...new Set(entry.purposes as string[])], linked: entry.linked as boolean, tracking: entry.tracking as boolean };\n });\n }\n return out;\n}\n\nconst LINK_KEYS = new Set([\"hosts\", \"paths\", \"webcredentials\"]);\nconst HOST = /^(?=.{1,253}$)(\\*\\.)?([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$/;\n\n/** Check the `links` block, so a typo'd host fails the build instead of shipping links that never open. */\nexport function validateLinks(raw: unknown, source = \"config\"): GenesisLinks {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) fail(`\"links\" must be an object`);\n const c = raw as Record<string, unknown>;\n for (const key of Object.keys(c)) if (!LINK_KEYS.has(key)) fail(`links: unknown setting \"${key}\"`);\n if (!isStringList(c.hosts) || c.hosts.length === 0) fail(`links.hosts must be a non-empty list of host names`);\n for (const host of c.hosts as string[]) {\n if (!HOST.test(host)) {\n fail(`links.hosts: \"${host}\" is not a bare lower-case host name (no scheme, path or port), e.g. \"example.com\"`);\n }\n }\n if (c.paths !== undefined) {\n if (!isStringList(c.paths)) fail(`links.paths must be a list of path prefixes`);\n for (const p of c.paths as string[]) {\n if (!p.startsWith(\"/\") || /[\\s?#*]/.test(p)) {\n fail(`links.paths: \"${p}\" must start with \"/\" and hold no spaces, \"?\", \"#\" or \"*\"`);\n }\n }\n }\n if (c.webcredentials !== undefined && typeof c.webcredentials !== \"boolean\") fail(`links.webcredentials must be true or false`);\n const links: GenesisLinks = { hosts: [...new Set(c.hosts as string[])] };\n if (c.paths !== undefined) links.paths = [...new Set(c.paths as string[])];\n if (c.webcredentials !== undefined) links.webcredentials = c.webcredentials as boolean;\n return links;\n}\n\n/** Check the shape, so a typo fails loudly instead of silently disabling a check. */\nexport function validateConfig(raw: unknown, source = \"config\"): DoctorConfig {\n const fail = (msg: string): never => {\n throw new DoctorConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) fail(\"the doctor settings must be an object\");\n const c = raw as Record<string, unknown>;\n for (const key of Object.keys(c)) if (!KNOWN.has(key)) fail(`unknown setting \"${key}\"`);\n // themeCss takes one stylesheet or several; normalize to a list.\n if (typeof c.themeCss === \"string\") c.themeCss = [c.themeCss];\n if (c.themeCss !== undefined && !isStringList(c.themeCss)) fail(`\"themeCss\" must be a path or a list of paths`);\n for (const key of STRING_LISTS) {\n if (c[key] !== undefined && !isStringList(c[key])) fail(`\"${key}\" must be a list of strings`);\n }\n for (const key of STRINGS) {\n if (c[key] !== undefined && typeof c[key] !== \"string\") fail(`\"${key}\" must be a string`);\n }\n if (c.routesDir !== undefined) c.routesDir = appPath(c.routesDir, `\"routesDir\"`, fail);\n if (c.rawTags !== undefined) {\n if (!isObject(c.rawTags)) fail(`\"rawTags\" must be an object`);\n for (const [tag, v] of Object.entries(c.rawTags as object)) {\n if (!/^[a-z][a-z0-9-]*$/.test(tag)) fail(`rawTags: \"${tag}\" is not an HTML tag name`);\n if (v !== false && typeof v !== \"string\") fail(`rawTags.${tag} must be a component name or false`);\n }\n }\n if (c.forbiddenImports !== undefined) {\n if (!isObject(c.forbiddenImports)) fail(`\"forbiddenImports\" must be an object of pattern → message`);\n for (const [re, msg] of Object.entries(c.forbiddenImports as object)) {\n if (typeof msg !== \"string\") fail(`forbiddenImports[\"${re}\"] must be a message string`);\n checkRegExp(re, `forbiddenImports[\"${re}\"]`, fail);\n }\n }\n if (c.rules !== undefined) {\n if (!isObject(c.rules)) fail(`\"rules\" must be an object of rule → level`);\n for (const [rule, level] of Object.entries(c.rules as object)) {\n if (!LEVELS.has(level as string)) fail(`rules.${rule} must be \"error\", \"warn\", \"info\" or \"off\"`);\n if (META_RULES.has(rule)) fail(`rules can't set ${rule}: it guards the config itself`);\n }\n }\n if (c.allow !== undefined) {\n if (!Array.isArray(c.allow)) fail(`\"allow\" must be a list`);\n (c.allow as unknown[]).forEach((e, i) => {\n if (!isObject(e)) return fail(`allow[${i}] must be an object`);\n const entry = e as Record<string, unknown>;\n if (typeof entry.rule !== \"string\" || !entry.rule) fail(`allow[${i}] needs a \"rule\"`);\n if (typeof entry.reason !== \"string\" || !entry.reason.trim()) fail(`allow[${i}] (${entry.rule}) needs a \"reason\"`);\n if (META_RULES.has(entry.rule as string)) fail(`allow[${i}] can't allow ${entry.rule}: it guards the allow list itself`);\n for (const k of [\"file\", \"match\"]) {\n if (entry[k] !== undefined && typeof entry[k] !== \"string\") fail(`allow[${i}].${k} must be a string`);\n }\n });\n }\n if (c.extend !== undefined) {\n if (!Array.isArray(c.extend)) fail(`\"extend\" must be a list of { rule, file, buildsOn, reason, upstream? }`);\n const seen = new Set<string>();\n (c.extend as unknown[]).forEach((e, i) => {\n const where = `extend[${i}]`;\n if (!isObject(e)) return fail(`${where} must be an object`);\n for (const k of Object.keys(e)) if (!EXTENSION_KEYS.has(k)) fail(`${where}: unknown key \"${k}\" (known: ${[...EXTENSION_KEYS].join(\", \")})`);\n for (const k of [\"rule\", \"file\", \"buildsOn\", \"reason\"]) if (typeof e[k] !== \"string\" || !(e[k] as string).trim()) fail(`${where} needs \"${k}\"`);\n const { rule, file, buildsOn, reason } = e as Record<string, string>;\n if (META_RULES.has(rule!) || CONFIG_RULES.has(rule!)) fail(`${where} can't extend ${rule}: it is about the config, not the app's code`);\n if (!rule!.includes(\"/\")) fail(`${where} can't extend ${rule}: only package rules declare extension points (a built-in rule's findings are fixed, or recorded as allow debt)`);\n if (/[*?[\\]{}]/.test(file!)) fail(`${where}.file must be one file, not a glob: each extension is reviewed on its own`);\n e.file = appPath(file, `${where}.file`, fail);\n if (!/^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)*$/.test(buildsOn!)) fail(`${where}.buildsOn must name a Genesis export, or a part of one (\"FormBuilder\", \"ResourceView.slots\")`);\n const text = reason!.trim();\n if (text.length < EXTENSION_REASON_MIN.chars || text.split(/\\s+/).length < EXTENSION_REASON_MIN.words) {\n fail(`${where} (${rule}) needs a reason of at least ${EXTENSION_REASON_MIN.words} words and ${EXTENSION_REASON_MIN.chars} characters: why the rule's primitive doesn't fit this file`);\n }\n if (e.upstream !== undefined && (typeof e.upstream !== \"string\" || !e.upstream.trim())) fail(`${where}.upstream must be a link to the gap's write-up`);\n const key = `${rule}\\0${e.file as string}`;\n if (seen.has(key)) fail(`${where} extends ${rule} in ${e.file as string} twice`);\n seen.add(key);\n });\n }\n if (c.patterns !== undefined) {\n if (!Array.isArray(c.patterns)) fail(`\"patterns\" must be a list`);\n (c.patterns as unknown[]).forEach((p, i) => {\n if (!isObject(p)) return fail(`patterns[${i}] must be an object`);\n const rule = p as Record<string, unknown>;\n for (const k of Object.keys(rule)) if (!PATTERN_KEYS.has(k)) fail(`patterns[${i}]: unknown key \"${k}\"`);\n if (typeof rule.id !== \"string\" || !rule.id) fail(`patterns[${i}] needs an \"id\"`);\n for (const k of [\"files\", \"exclude\"]) {\n if (rule[k] !== undefined && !isStringList(rule[k])) fail(`patterns[${i}].${k} must be a list of globs`);\n }\n if (rule.newOnly !== undefined && typeof rule.newOnly !== \"boolean\") fail(`patterns[${i}].newOnly must be true or false`);\n });\n }\n if (c.packageRules !== undefined) {\n if (!isObject(c.packageRules)) fail(`\"packageRules\" must be an object of package rule id → { level?, files?, exclude?, reason }`);\n for (const [id, v] of Object.entries(c.packageRules as object)) {\n const where = `packageRules[\"${id}\"]`;\n if (!id.includes(\"/\")) fail(`${where}: package rule ids are namespaced by package, e.g. \"ui/lists-use-resource-view\"`);\n if (!isObject(v)) fail(`${where} must be an object`);\n const setting = v as Record<string, unknown>;\n for (const k of Object.keys(setting)) if (!PACKAGE_RULE_KEYS.has(k)) fail(`${where}: unknown key \"${k}\" (known: level, files, exclude, reason)`);\n if (typeof setting.reason !== \"string\" || !setting.reason.trim()) fail(`${where} needs a \"reason\": a package rule is never changed silently`);\n if (setting.level !== undefined && !LEVELS.has(setting.level as string)) fail(`${where}.level must be \"error\", \"warn\", \"info\" or \"off\"`);\n for (const k of [\"files\", \"exclude\"]) if (setting[k] !== undefined && !isStringList(setting[k])) fail(`${where}.${k} must be a list of globs`);\n }\n }\n if (c.ratchet !== undefined && typeof c.ratchet !== \"boolean\" && !isStringList(c.ratchet)) fail(`\"ratchet\" must be true, false or a list of rule ids`);\n if (c.packs !== undefined) {\n if (!isStringList(c.packs)) fail(`\"packs\" must be a list, e.g. [\"native\", \"supabase\"]`);\n for (const p of c.packs as string[]) if (!PACKS.has(p)) fail(`packs: unknown pack \"${p}\" (known: ${[...PACKS].join(\", \")})`);\n if (new Set(c.packs as string[]).size !== (c.packs as string[]).length) fail(`packs: lists a pack twice`);\n }\n // After `packs` is known to be a list of pack names.\n if (c.contracts !== undefined) {\n if (!isObject(c.contracts)) fail(`\"contracts\" must be an object: { out?, schemas?, databaseEnv? }`);\n const contracts = c.contracts as Record<string, unknown>;\n for (const k of Object.keys(contracts)) if (!CONTRACT_KEYS.has(k)) fail(`contracts: unknown setting \"${k}\" (known: out, schemas, databaseEnv)`);\n if (!((c.packs as string[] | undefined) ?? []).includes(\"supabase\")) fail(`\"contracts\" is set but the supabase pack is not in \"packs\"`);\n if (contracts.out !== undefined) {\n if (typeof contracts.out !== \"string\" || !contracts.out.trim()) fail(`contracts.out must be a file path`);\n if (path.isAbsolute(contracts.out as string) || (contracts.out as string).replace(/\\\\/g, \"/\").split(\"/\").includes(\"..\")) fail(`contracts.out must be a file inside the app`);\n }\n if (contracts.schemas !== undefined && !isStringList(contracts.schemas)) fail(`contracts.schemas must be a list of schema names`);\n if (contracts.databaseEnv !== undefined && (typeof contracts.databaseEnv !== \"string\" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(contracts.databaseEnv))) {\n fail(`contracts.databaseEnv must be an environment variable name`);\n }\n }\n for (const [pack, keys] of Object.entries(PACK_KEYS)) {\n const block = c[pack];\n if (block === undefined) continue;\n if (!isObject(block)) fail(`\"${pack}\" must be an object`);\n if (!((c.packs as string[] | undefined) ?? []).includes(pack)) fail(`\"${pack}\" settings are set but the ${pack} pack is not in \"packs\"`);\n for (const [k, v] of Object.entries(block as object)) {\n const want = keys[k];\n if (!want) fail(`${pack}: unknown setting \"${k}\"`);\n if (want === \"string\" && typeof v !== \"string\") fail(`${pack}.${k} must be a string`);\n if (want === \"list\" && !isStringList(v)) fail(`${pack}.${k} must be a list of strings`);\n if (want === \"boolean\" && typeof v !== \"boolean\") fail(`${pack}.${k} must be true or false`);\n if (want === \"string\" && !(v as string).trim()) fail(`${pack}.${k} must not be empty`);\n if (want === \"path\") (block as Record<string, unknown>)[k] = appPath(v, `${pack}.${k}`, fail);\n }\n }\n // Schema names compare lowercased, like the SQL they're matched against.\n const supa = c.supabase as Record<string, unknown> | undefined;\n if (Array.isArray(supa?.exposedSchemas)) supa.exposedSchemas = (supa.exposedSchemas as string[]).map((s) => s.toLowerCase());\n if (c.plugins !== undefined) {\n const ok =\n Array.isArray(c.plugins) &&\n c.plugins.every((p) => typeof p === \"string\" || (Array.isArray(p) && p.length === 2 && typeof p[0] === \"string\"));\n if (!ok) fail(`\"plugins\" must be a list of module paths or [path, options] pairs`);\n }\n return c as DoctorConfig;\n}\n\nexport function checkRegExp(source: string, where: string, fail: (msg: string) => never): void {\n try {\n new RegExp(source);\n } catch (err) {\n fail(`${where} is not a valid regular expression: ${(err as Error).message}`);\n }\n}\n\nfunction isObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\nfunction isStringList(v: unknown): v is string[] {\n return Array.isArray(v) && v.every((x) => typeof x === \"string\");\n}\n","/**\n * `withGenesis()` — the Genesis Expo config plugin.\n *\n * Keeps an app's `app.config.ts` to a name, ids and plugins. It sets:\n *\n * 1. App variants: `APP_VARIANT` (`development` | `preview` | `production`,\n * default `production`) suffixes the bundle id, Android package, name and\n * URL scheme, so the three builds install side by side and a\n * `scheme://` link opens the build it names, not whichever one iOS or\n * Android picks among apps that registered the same scheme.\n * 2. Universal / app links from genesis.config.json `links`:\n * `ios.associatedDomains` (`applinks:` and `webcredentials:`) and one\n * Android `intentFilters` entry with `autoVerify`.\n * 3. The iOS privacy manifest, merged into what the app declares: the\n * required-reason APIs of React Native, Expo and the packages the app's\n * package.json lists; `NSPrivacyTracking: false`; and the collected data\n * types, the union of what each Genesis block the app uses collects\n * (`account`, `observability`, `push`), or the app's own list from\n * genesis.config.json `privacy` or the plugin's `privacy` option.\n * 4. Export compliance: `ios.config.usesNonExemptEncryption = false`.\n * 5. `runtimeVersion: { policy: \"fingerprint\" }`.\n *\n * Anything the app already sets wins: the plugin fills gaps and appends to\n * lists, never overwrites or removes a value, and running it twice changes\n * nothing.\n *\n * Determinism: the plugin reads two committed files in the project root,\n * genesis.config.json and package.json, and one environment variable,\n * APP_VARIANT. No network, no clock, no other environment. The same commit\n * and variant always give the same config; the EAS fingerprint is stable only\n * if APP_VARIANT is set the same way for builds, `eas update` and fingerprint\n * checks (an EAS environment variable, not a build profile's `env`).\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { ConfigPlugin } from \"@expo/config-plugins\";\nimport type { ExpoConfig } from \"@expo/config-types\";\nimport {\n GenesisConfigError,\n PRIVACY_PURPOSES,\n privacyDataType,\n readGenesisConfig,\n validatePrivacy,\n type GenesisDataUse,\n type GenesisLinks,\n type GenesisPrivacy,\n} from \"./doctor/config.js\";\n\nexport {\n GenesisConfigError,\n PRIVACY_DATA_TYPES,\n PRIVACY_PURPOSES,\n privacyDataType,\n validateLinks,\n validatePrivacy,\n readGenesisConfig,\n type GenesisDataUse,\n type GenesisLinks,\n type GenesisPrivacy,\n} from \"./doctor/config.js\";\n\nexport const APP_VARIANTS = [\"development\", \"preview\", \"production\"] as const;\nexport type AppVariant = (typeof APP_VARIANTS)[number];\n\nexport interface VariantSuffix {\n /** Appended to `ios.bundleIdentifier` and `android.package`, e.g. `.dev`. */\n id: string;\n /** Appended to `name`, e.g. ` (Dev)`. */\n name: string;\n /** Appended to each `scheme`, e.g. `-dev` (`myapp-dev://`). */\n scheme: string;\n}\n\n/** A required-reason API category and the reasons for it, as in PrivacyInfo.xcprivacy. */\nexport interface PrivacyApi {\n NSPrivacyAccessedAPIType: string;\n NSPrivacyAccessedAPITypeReasons: string[];\n}\n\nexport interface WithGenesisOptions {\n /**\n * The variant, overriding `APP_VARIANT`. Tests and scripts pass it; an app\n * leaves it out and sets `APP_VARIANT` per build profile in eas.json.\n */\n variant?: AppVariant;\n /** Suffixes per non-production variant. Default `.dev` / ` (Dev)` / `-dev` and `.preview` / ` (Preview)` / `-preview`. */\n variants?: Partial<Record<Exclude<AppVariant, \"production\">, Partial<VariantSuffix>>>;\n /** Where genesis.config.json and package.json live. Default: the Expo project root. */\n projectRoot?: string;\n /**\n * The manifest's collected data types, overriding genesis.config.json\n * `privacy` key by key (`blocks` here replaces the file's `blocks`; a\n * `collects` list, from either place, replaces every block's list). An app\n * passes `blocks` from its own feature switches, so a block turned off\n * declares nothing. Without `privacy` in either place, the blocks are found\n * from package.json and a warning says the app's own data isn't in the list.\n */\n privacy?: GenesisPrivacy;\n /** Turn single steps off. Every step is on by default. */\n links?: boolean;\n privacyManifest?: boolean;\n exportCompliance?: boolean;\n fingerprint?: boolean;\n}\n\nexport const DEFAULT_VARIANT_SUFFIXES: Record<Exclude<AppVariant, \"production\">, VariantSuffix> = {\n development: { id: \".dev\", name: \" (Dev)\", scheme: \"-dev\" },\n preview: { id: \".preview\", name: \" (Preview)\", scheme: \"-preview\" },\n};\n\nconst api = (category: string, ...reasons: string[]): PrivacyApi => ({\n NSPrivacyAccessedAPIType: `NSPrivacyAccessedAPICategory${category}`,\n NSPrivacyAccessedAPITypeReasons: reasons,\n});\n\n/**\n * The required-reason APIs each package needs the app to declare, copied from\n * the package's own PrivacyInfo.xcprivacy (read from the SDK 58 versions the\n * starter installs). A package is matched when the app's package.json lists\n * it in `dependencies`. CocoaPods also merges these manifests into the app's\n * at `pod install` (React Native's privacy manifest aggregation); declaring\n * them here keeps the app's manifest whole when that is off, or for a pod\n * that doesn't ship one.\n *\n * - react-native 0.88 (`React/Resources`, `ReactCommon/cxxreact`,\n * `ReactCommon/react/timing` and the boost, glog and RCT-Folly podspecs):\n * FileTimestamp C617.1, UserDefaults CA92.1, SystemBootTime 35F9.1.\n * - expo 58, for what it always installs: expo-file-system (FileTimestamp\n * 0A2A.1 and 3B52.1, DiskSpace E174.1 and 85F4.1) and expo-constants\n * (UserDefaults CA92.1).\n * - expo-updates, through expo-eas-client: UserDefaults CA92.1.\n * - expo-application: FileTimestamp C617.1.\n * - expo-notifications: UserDefaults CA92.1.\n * - async-storage 2.2.0: FileTimestamp C617.1.\n *\n * - @sentry/react-native: UserDefaults CA92.1, SystemBootTime 35F9.1,\n * FileTimestamp C617.1, as Sentry's \"Apple Privacy Manifest\" guide for\n * React Native lists (sentry-cocoa ships in a pod, not in node_modules).\n *\n * Not listed, because their packages ship no required-reason API: expo-secure-store\n * (the Keychain is not one), expo-crypto, expo-haptics, expo-linking,\n * expo-apple-authentication, expo-router, netinfo, reanimated and the other\n * starter dependencies with no PrivacyInfo.xcprivacy.\n */\nexport const PRIVACY_APIS: Record<string, PrivacyApi[]> = {\n \"react-native\": [api(\"FileTimestamp\", \"C617.1\"), api(\"UserDefaults\", \"CA92.1\"), api(\"SystemBootTime\", \"35F9.1\")],\n expo: [api(\"FileTimestamp\", \"0A2A.1\", \"3B52.1\"), api(\"DiskSpace\", \"E174.1\", \"85F4.1\"), api(\"UserDefaults\", \"CA92.1\")],\n \"expo-updates\": [api(\"UserDefaults\", \"CA92.1\")],\n \"expo-application\": [api(\"FileTimestamp\", \"C617.1\")],\n \"expo-notifications\": [api(\"UserDefaults\", \"CA92.1\")],\n \"@react-native-async-storage/async-storage\": [api(\"FileTimestamp\", \"C617.1\")],\n \"@sentry/react-native\": [api(\"UserDefaults\", \"CA92.1\"), api(\"SystemBootTime\", \"35F9.1\"), api(\"FileTimestamp\", \"C617.1\")],\n};\n\n/** A Genesis block's collected data, and the packages that mean the app uses it. */\nexport interface PrivacyBlock {\n /** The block is on when the app's `dependencies` list every one of these. */\n packages: string[];\n collects: GenesisDataUse[];\n}\n\nconst appFunctionality = (type: string, ...more: string[]): GenesisDataUse => ({\n type,\n purposes: [\"app functionality\", ...more],\n linked: true,\n tracking: false,\n});\n\n/**\n * What each Genesis block collects, mirroring its `defineBlock`\n * `privacy.collects` (the blocks themselves are React Native code, which a\n * config plugin can't load). \"Collected\" is Apple's sense: sent off the\n * phone, to the app's own backend or a vendor. Purposes follow Apple's\n * definitions: crash and performance data that keep the app working are app\n * functionality (\"minimize app crashes, improve scalability and\n * performance\"); analytics is the typed product events.\n *\n * - `account` (`@marktiderman/genesis-supabase` `accountBlock`): the\n * sign-in email, the account id, and the name (Sign in with Apple's, or\n * one typed in).\n * - `observability` (`@marktiderman/genesis-native` `createObservability`\n * with `events`, reporting through Sentry): crash and performance data,\n * and the other diagnostic data Sentry sends with them (device and OS\n * details, breadcrumbs, sessions), the three Sentry's own privacy-manifest\n * guide lists; the user id; and the typed analytics events (product\n * interaction), all linked because the sink sets the user id. Found by\n * `@sentry/react-native`; an app that never sets a DSN sends nothing and\n * should leave this block out.\n * - `push` (`@marktiderman/genesis-native` `createPush`): the device's push\n * token against the person (a device-level id).\n * - `support` (`@marktiderman/genesis-support` `supportContributions`):\n * feedback and support requests the person sends, with their text, an\n * optional screenshot, the account id and basic device facts.\n *\n * Tests keep each entry equal to its block's own list.\n */\nexport const PRIVACY_BLOCKS: Record<string, PrivacyBlock> = {\n account: {\n packages: [\"@marktiderman/genesis-supabase\"],\n collects: [appFunctionality(\"email address\"), appFunctionality(\"user id\"), appFunctionality(\"name\")],\n },\n observability: {\n packages: [\"@marktiderman/genesis-native\", \"@sentry/react-native\"],\n collects: [\n appFunctionality(\"crash data\"),\n appFunctionality(\"performance data\"),\n appFunctionality(\"other diagnostic data\"),\n appFunctionality(\"user id\", \"analytics\"),\n { type: \"product interaction\", purposes: [\"analytics\"], linked: true, tracking: false },\n ],\n },\n push: {\n packages: [\"@marktiderman/genesis-native\", \"expo-notifications\"],\n collects: [appFunctionality(\"device ID\")],\n },\n support: {\n packages: [\"@marktiderman/genesis-support\"],\n collects: [\n appFunctionality(\"user id\"),\n appFunctionality(\"customer support\"),\n appFunctionality(\"other user content\"),\n appFunctionality(\"photos or videos\"),\n appFunctionality(\"other diagnostic data\"),\n ],\n },\n};\n\n/** The variant from options, else `APP_VARIANT`, else production. An unknown value throws. */\nexport function resolveVariant(given?: string): AppVariant {\n const value = given ?? process.env.APP_VARIANT ?? \"production\";\n if (!(APP_VARIANTS as readonly string[]).includes(value)) {\n throw new GenesisConfigError(`APP_VARIANT is \"${value}\"; expected one of ${APP_VARIANTS.join(\", \")}`);\n }\n return value as AppVariant;\n}\n\nexport function applyVariant(config: ExpoConfig, variant: AppVariant, options: WithGenesisOptions[\"variants\"] = {}): ExpoConfig {\n if (variant === \"production\") return config;\n const suffix = { ...DEFAULT_VARIANT_SUFFIXES[variant], ...options[variant] };\n // A value that already ends in the suffix was suffixed by an earlier run: leave it.\n const add = (value: string, end: string) => (end && value.endsWith(end) ? value : value + end);\n const next: ExpoConfig = { ...config, name: add(config.name, suffix.name) };\n if (config.ios?.bundleIdentifier) next.ios = { ...config.ios, bundleIdentifier: add(config.ios.bundleIdentifier, suffix.id) };\n if (config.android?.package) next.android = { ...config.android, package: add(config.android.package, suffix.id) };\n // Every build registering the same scheme would let a link open the wrong one. Production keeps the base.\n if (typeof config.scheme === \"string\") next.scheme = add(config.scheme, suffix.scheme);\n else if (Array.isArray(config.scheme)) next.scheme = config.scheme.map((scheme) => add(scheme, suffix.scheme));\n return next;\n}\n\nexport function applyLinks(config: ExpoConfig, links: GenesisLinks | undefined): ExpoConfig {\n if (!links) return config;\n const services = links.webcredentials === false ? [\"applinks\"] : [\"applinks\", \"webcredentials\"];\n const domains = links.hosts.flatMap((host) => services.map((service) => `${service}:${host}`));\n const associatedDomains = union(config.ios?.associatedDomains ?? [], domains);\n\n const data = links.hosts.flatMap((host) =>\n links.paths?.length ? links.paths.map((pathPrefix) => ({ scheme: \"https\", host, pathPrefix })) : [{ scheme: \"https\", host }],\n );\n const filter = { action: \"VIEW\", autoVerify: true, data, category: [\"BROWSABLE\", \"DEFAULT\"] };\n const existing = config.android?.intentFilters ?? [];\n const intentFilters = existing.some((f) => JSON.stringify(f) === JSON.stringify(filter)) ? existing : [...existing, filter];\n\n return {\n ...config,\n ios: { ...config.ios, associatedDomains },\n android: { ...config.android, intentFilters },\n };\n}\n\n/** The required-reason APIs for the packages listed in package.json `dependencies`. */\nexport function privacyApisFor(dependencies: Record<string, unknown>): PrivacyApi[] {\n return Object.keys(PRIVACY_APIS)\n .filter((pkg) => pkg in dependencies)\n .flatMap((pkg) => PRIVACY_APIS[pkg]!);\n}\n\n/** Merge required-reason APIs into `ios.privacyManifests`, keeping every entry and reason the app declares. */\nexport function applyPrivacyApis(config: ExpoConfig, apis: PrivacyApi[]): ExpoConfig {\n if (apis.length === 0) return config;\n const manifests = config.ios?.privacyManifests ?? {};\n const types = (manifests.NSPrivacyAccessedAPITypes ?? []).map((t) => ({ ...t, NSPrivacyAccessedAPITypeReasons: [...t.NSPrivacyAccessedAPITypeReasons] }));\n for (const api of apis) {\n const found = types.find((t) => t.NSPrivacyAccessedAPIType === api.NSPrivacyAccessedAPIType);\n if (found) found.NSPrivacyAccessedAPITypeReasons = union(found.NSPrivacyAccessedAPITypeReasons, api.NSPrivacyAccessedAPITypeReasons);\n else types.push({ ...api, NSPrivacyAccessedAPITypeReasons: [...api.NSPrivacyAccessedAPITypeReasons] });\n }\n return { ...config, ios: { ...config.ios, privacyManifests: { ...manifests, NSPrivacyAccessedAPITypes: types } } };\n}\n\n/** The Genesis blocks whose packages are all in `dependencies`. */\nexport function privacyBlocksFor(dependencies: Record<string, unknown>): string[] {\n return Object.keys(PRIVACY_BLOCKS).filter((id) => PRIVACY_BLOCKS[id]!.packages.every((pkg) => pkg in dependencies));\n}\n\n/**\n * The data the app collects: `privacy.collects` when given, else the union of\n * the blocks' (`privacy.blocks`, else those found in `dependencies`). A type\n * two blocks collect appears once, with every purpose either gives, linked or\n * tracking if either says so. An unknown block id throws.\n */\nexport function collectedDataFor(privacy: GenesisPrivacy, dependencies: Record<string, unknown>): GenesisDataUse[] {\n if (privacy.collects) return mergeDataUses(privacy.collects);\n const blocks = privacy.blocks ?? privacyBlocksFor(dependencies);\n const unknown = blocks.filter((id) => !(id in PRIVACY_BLOCKS));\n if (unknown.length) {\n throw new GenesisConfigError(`privacy.blocks: ${unknown.map((id) => `\"${id}\"`).join(\", \")} not one of ${Object.keys(PRIVACY_BLOCKS).join(\", \")}; list other data in privacy.collects`);\n }\n return mergeDataUses(blocks.flatMap((id) => PRIVACY_BLOCKS[id]!.collects));\n}\n\nfunction mergeDataUses(uses: readonly GenesisDataUse[]): GenesisDataUse[] {\n const byType = new Map<string, GenesisDataUse>();\n for (const use of uses) {\n // By Apple's type, so \"user ID\" and \"user id\" are one entry.\n const key = privacyDataType(use.type) ?? use.type;\n const seen = byType.get(key);\n byType.set(\n key,\n seen\n ? { type: use.type, purposes: union(seen.purposes, use.purposes), linked: seen.linked || use.linked, tracking: seen.tracking || use.tracking }\n : { ...use, purposes: [...use.purposes] },\n );\n }\n return [...byType.values()];\n}\n\n/**\n * Write the collected data types and `NSPrivacyTracking` into\n * `ios.privacyManifests`. The app's own entries win: a type it already lists\n * is left as it wrote it, and an `NSPrivacyTracking` it set stays. Tracking\n * defaults to whether any entry tracks; an entry that tracks with tracking\n * set false throws, since the manifest would contradict itself.\n */\nexport function applyPrivacyData(config: ExpoConfig, uses: GenesisDataUse[], tracking?: boolean): ExpoConfig {\n const manifests = config.ios?.privacyManifests ?? {};\n if (tracking !== undefined && manifests.NSPrivacyTracking !== undefined && tracking !== manifests.NSPrivacyTracking) {\n throw new GenesisConfigError(`privacy.tracking is ${tracking} but app.config sets ios.privacyManifests.NSPrivacyTracking to ${manifests.NSPrivacyTracking}; set it in one place`);\n }\n const tracks = uses.some((u) => u.tracking);\n const NSPrivacyTracking = manifests.NSPrivacyTracking ?? tracking ?? tracks;\n if (tracks && NSPrivacyTracking === false) {\n const which = uses.filter((u) => u.tracking).map((u) => u.type);\n throw new GenesisConfigError(`privacy: ${which.join(\", \")} is used for tracking but NSPrivacyTracking is false; set privacy.tracking to true and list NSPrivacyTrackingDomains`);\n }\n const existing = (manifests.NSPrivacyCollectedDataTypes ?? []).map((t) => ({ ...t, NSPrivacyCollectedDataTypePurposes: [...t.NSPrivacyCollectedDataTypePurposes] }));\n const listed = new Set(existing.map((t) => t.NSPrivacyCollectedDataType));\n const added = uses\n .map((u) => ({\n NSPrivacyCollectedDataType: privacyDataType(u.type)!,\n NSPrivacyCollectedDataTypeLinked: u.linked,\n NSPrivacyCollectedDataTypeTracking: u.tracking,\n NSPrivacyCollectedDataTypePurposes: u.purposes.map((p) => PRIVACY_PURPOSES[p]!),\n }))\n .filter((t) => !listed.has(t.NSPrivacyCollectedDataType));\n return {\n ...config,\n ios: { ...config.ios, privacyManifests: { ...manifests, NSPrivacyTracking, NSPrivacyCollectedDataTypes: [...existing, ...added] } },\n };\n}\n\nexport function applyExportCompliance(config: ExpoConfig): ExpoConfig {\n if (config.ios?.config?.usesNonExemptEncryption !== undefined) return config;\n return { ...config, ios: { ...config.ios, config: { ...config.ios?.config, usesNonExemptEncryption: false } } };\n}\n\nexport function applyFingerprint(config: ExpoConfig): ExpoConfig {\n if (config.runtimeVersion !== undefined || config.ios?.runtimeVersion !== undefined || config.android?.runtimeVersion !== undefined) {\n return config;\n }\n return { ...config, runtimeVersion: { policy: \"fingerprint\" } };\n}\n\n/** The Genesis config plugin. Use it in `plugins` or call it directly in app.config.ts. */\nexport const withGenesis: ConfigPlugin<WithGenesisOptions | void> = (config, props) => {\n const options = props ?? {};\n const root = options.projectRoot ?? (config as { _internal?: { projectRoot?: string } })._internal?.projectRoot ?? process.cwd();\n let next = applyVariant(config, resolveVariant(options.variant), options.variants);\n const file = options.links !== false || options.privacyManifest !== false ? readGenesisConfig(root) : null;\n if (options.links !== false) next = applyLinks(next, file?.links);\n if (options.privacyManifest !== false) {\n const dependencies = readDependencies(root);\n const privacy = { ...file?.privacy, ...(options.privacy ? validatePrivacy(options.privacy, \"withGenesis({ privacy })\") : {}) };\n next = applyPrivacyApis(next, privacyApisFor(dependencies));\n if (!privacy.blocks && !privacy.collects && !config.ios?.privacyManifests?.NSPrivacyCollectedDataTypes) {\n // Not a throw: the default is right for an app that is only Genesis blocks. Loud, because\n // anything else the app sends is missing from it.\n console.warn(\n `[genesis] privacy manifest: collected data types are only those of the Genesis blocks found in package.json (${privacyBlocksFor(dependencies).join(\", \") || \"none\"}). If the app sends anything else, list everything it collects in genesis.config.json privacy.collects; to keep this list, set privacy.blocks.`,\n );\n }\n next = applyPrivacyData(next, collectedDataFor(privacy, dependencies), privacy.tracking);\n }\n if (options.exportCompliance !== false) next = applyExportCompliance(next);\n if (options.fingerprint !== false) next = applyFingerprint(next);\n return next;\n};\n\nexport default withGenesis;\n\nfunction readDependencies(root: string): Record<string, unknown> {\n const file = path.join(root, \"package.json\");\n if (!existsSync(file)) return {};\n try {\n const deps = JSON.parse(readFileSync(file, \"utf8\"))?.dependencies;\n return deps && typeof deps === \"object\" ? deps : {};\n } catch (err) {\n throw new GenesisConfigError(`${file} is not valid JSON: ${(err as Error).message}`);\n }\n}\n\nfunction union(a: string[], b: string[]): string[] {\n return [...new Set([...a, ...b])];\n}\n"]}
1
+ {"version":3,"sources":["../src/doctor/config.ts","../src/expo.ts"],"names":["api","path2","existsSync","readFileSync"],"mappings":";;;;AAcO,IAAM,kBAAA,GAAN,cAAiC,KAAA,CAAM;AAAA,EACnC,IAAA,GAAO,oBAAA;AAClB;AAEO,IAAM,iBAAA,GAAN,cAAgC,kBAAA,CAAmB;AAAA,EAC/C,IAAA,GAAO,mBAAA;AAClB,CAAA;AAoBO,IAAM,kBAAA,GAAuD;AAAA,EAClE,IAAA,EAAM,gCAAA;AAAA,EACN,eAAA,EAAiB,wCAAA;AAAA,EACjB,cAAA,EAAgB,uCAAA;AAAA,EAChB,kBAAA,EAAoB,2CAAA;AAAA,EACpB,yBAAA,EAA2B,gDAAA;AAAA,EAC3B,MAAA,EAAQ,kCAAA;AAAA,EACR,OAAA,EAAS,mCAAA;AAAA,EACT,cAAA,EAAgB,uCAAA;AAAA,EAChB,aAAA,EAAe,sCAAA;AAAA,EACf,sBAAA,EAAwB,8CAAA;AAAA,EACxB,kBAAA,EAAoB,2CAAA;AAAA,EACpB,iBAAA,EAAmB,0CAAA;AAAA,EACnB,gBAAA,EAAkB,yCAAA;AAAA,EAClB,QAAA,EAAU,oCAAA;AAAA,EACV,yBAAA,EAA2B,gDAAA;AAAA,EAC3B,kBAAA,EAAoB,0CAAA;AAAA,EACpB,YAAA,EAAc,qCAAA;AAAA,EACd,kBAAA,EAAoB,2CAAA;AAAA,EACpB,kBAAA,EAAoB,2CAAA;AAAA,EACpB,oBAAA,EAAsB,4CAAA;AAAA,EACtB,kBAAA,EAAoB,2CAAA;AAAA,EACpB,gBAAA,EAAkB,yCAAA;AAAA,EAClB,SAAA,EAAW,kCAAA;AAAA,EACX,WAAA,EAAa,oCAAA;AAAA,EACb,kBAAA,EAAoB,2CAA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A;AAAA,OACrK;AAAA,IACF;AACA,IAAA,IAAA,GAAO,iBAAiB,IAAA,EAAM,gBAAA,CAAiB,SAAS,YAAY,CAAA,EAAG,QAAQ,QAAQ,CAAA;AAAA,EACzF;AACA,EAAA,IAAI,OAAA,CAAQ,gBAAA,KAAqB,KAAA,EAAO,IAAA,GAAO,sBAAsB,IAAI,CAAA;AACzE,EAAA,IAAI,OAAA,CAAQ,WAAA,KAAgB,KAAA,EAAO,IAAA,GAAO,iBAAiB,IAAI,CAAA;AAC/D,EAAA,OAAO,IAAA;AACT;AAEA,IAAO,YAAA,GAAQ;AAEf,SAAS,iBAAiB,IAAA,EAAuC;AAC/D,EAAA,MAAM,IAAA,GAAYC,IAAA,CAAA,IAAA,CAAK,IAAA,EAAM,cAAc,CAAA;AAC3C,EAAA,IAAI,CAACC,UAAAA,CAAW,IAAI,CAAA,SAAU,EAAC;AAC/B,EAAA,IAAI;AACF,IAAA,MAAM,OAAO,IAAA,CAAK,KAAA,CAAMC,aAAa,IAAA,EAAM,MAAM,CAAC,CAAA,EAAG,YAAA;AACrD,IAAA,OAAO,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAA,GAAW,OAAO,EAAC;AAAA,EACpD,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,IAAI,kBAAA,CAAmB,CAAA,EAAG,IAAI,CAAA,oBAAA,EAAwB,GAAA,CAAc,OAAO,CAAA,CAAE,CAAA;AAAA,EACrF;AACF;AAEA,SAAS,KAAA,CAAM,GAAa,CAAA,EAAuB;AACjD,EAAA,OAAO,CAAC,mBAAG,IAAI,GAAA,CAAI,CAAC,GAAG,CAAA,EAAG,GAAG,CAAC,CAAC,CAAC,CAAA;AAClC","file":"expo.js","sourcesContent":["/**\n * Finds and validates the app's genesis.config.json.\n *\n * The doctor's lookup order: `--config <path>`, then `genesis.config.json`\n * in the app root, then the `genesis` key of package.json. Either file holds\n * the settings under `doctor`, beside other blocks: `features` (read by\n * `genesis features`) and `links` (validated here, read by the Expo config\n * plugin).\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { DoctorConfig } from \"./types.js\";\n\n/** A genesis.config.json that can't be read or has a block of the wrong shape. */\nexport class GenesisConfigError extends Error {\n override name = \"GenesisConfigError\";\n}\n\nexport class DoctorConfigError extends GenesisConfigError {\n override name = \"DoctorConfigError\";\n}\n\n/** The `links` block: the web hosts (and optional path prefixes) the app opens as universal / app links. */\nexport interface GenesisLinks {\n /** Bare host names, such as `example.com` or `app.example.com`: no scheme, path or port. */\n hosts: string[];\n /** Path prefixes the app handles, each starting with `/`. Default: every path. */\n paths?: string[];\n /** Also add `webcredentials:` domains (password autofill). Default true. */\n webcredentials?: boolean;\n}\n\n/**\n * Apple's collected data types (`NSPrivacyCollectedDataType`), every one in\n * Apple's reference, keyed by the stores' own words, lower case, as Genesis\n * blocks name them in `privacy.collects`. Look one up with\n * {@link privacyDataType}, which ignores case (blocks write `\"device ID\"`,\n * `\"user ID\"`). The values are Apple's exact strings, `PhotosorVideos`\n * included.\n */\nexport const PRIVACY_DATA_TYPES: Readonly<Record<string, string>> = {\n name: \"NSPrivacyCollectedDataTypeName\",\n \"email address\": \"NSPrivacyCollectedDataTypeEmailAddress\",\n \"phone number\": \"NSPrivacyCollectedDataTypePhoneNumber\",\n \"physical address\": \"NSPrivacyCollectedDataTypePhysicalAddress\",\n \"other user contact info\": \"NSPrivacyCollectedDataTypeOtherUserContactInfo\",\n health: \"NSPrivacyCollectedDataTypeHealth\",\n fitness: \"NSPrivacyCollectedDataTypeFitness\",\n \"payment info\": \"NSPrivacyCollectedDataTypePaymentInfo\",\n \"credit info\": \"NSPrivacyCollectedDataTypeCreditInfo\",\n \"other financial info\": \"NSPrivacyCollectedDataTypeOtherFinancialInfo\",\n \"precise location\": \"NSPrivacyCollectedDataTypePreciseLocation\",\n \"coarse location\": \"NSPrivacyCollectedDataTypeCoarseLocation\",\n \"sensitive info\": \"NSPrivacyCollectedDataTypeSensitiveInfo\",\n contacts: \"NSPrivacyCollectedDataTypeContacts\",\n \"emails or text messages\": \"NSPrivacyCollectedDataTypeEmailsOrTextMessages\",\n \"photos or videos\": \"NSPrivacyCollectedDataTypePhotosorVideos\",\n \"audio data\": \"NSPrivacyCollectedDataTypeAudioData\",\n \"gameplay content\": \"NSPrivacyCollectedDataTypeGameplayContent\",\n \"customer support\": \"NSPrivacyCollectedDataTypeCustomerSupport\",\n \"other user content\": \"NSPrivacyCollectedDataTypeOtherUserContent\",\n \"browsing history\": \"NSPrivacyCollectedDataTypeBrowsingHistory\",\n \"search history\": \"NSPrivacyCollectedDataTypeSearchHistory\",\n \"user id\": \"NSPrivacyCollectedDataTypeUserID\",\n \"device id\": \"NSPrivacyCollectedDataTypeDeviceID\",\n \"purchase history\": \"NSPrivacyCollectedDataTypePurchaseHistory\",\n \"product interaction\": \"NSPrivacyCollectedDataTypeProductInteraction\",\n \"advertising data\": \"NSPrivacyCollectedDataTypeAdvertisingData\",\n \"other usage data\": \"NSPrivacyCollectedDataTypeOtherUsageData\",\n \"crash data\": \"NSPrivacyCollectedDataTypeCrashData\",\n \"performance data\": \"NSPrivacyCollectedDataTypePerformanceData\",\n \"other diagnostic data\": \"NSPrivacyCollectedDataTypeOtherDiagnosticData\",\n \"environment scanning\": \"NSPrivacyCollectedDataTypeEnvironmentScanning\",\n hands: \"NSPrivacyCollectedDataTypeHands\",\n head: \"NSPrivacyCollectedDataTypeHead\",\n \"other data types\": \"NSPrivacyCollectedDataTypeOtherDataTypes\",\n};\n\n/** Apple's string for a data type in the stores' words, whatever its case, or undefined. */\nexport function privacyDataType(type: string): string | undefined {\n return PRIVACY_DATA_TYPES[type.toLowerCase()];\n}\n\n/** Apple's collection purposes (`NSPrivacyCollectedDataTypePurposes`), by the stores' words. */\nexport const PRIVACY_PURPOSES: Readonly<Record<string, string>> = {\n \"app functionality\": \"NSPrivacyCollectedDataTypePurposeAppFunctionality\",\n analytics: \"NSPrivacyCollectedDataTypePurposeAnalytics\",\n \"product personalization\": \"NSPrivacyCollectedDataTypePurposeProductPersonalization\",\n \"developer advertising\": \"NSPrivacyCollectedDataTypePurposeDeveloperAdvertising\",\n \"third-party advertising\": \"NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising\",\n other: \"NSPrivacyCollectedDataTypePurposeOther\",\n};\n\n/** One kind of data the app collects, as a Genesis block's `privacy.collects` entry says it. */\nexport interface GenesisDataUse {\n /** A key of {@link PRIVACY_DATA_TYPES}: `\"email address\"`, `\"user id\"`, `\"crash data\"`… */\n type: string;\n /** Keys of {@link PRIVACY_PURPOSES}: `\"app functionality\"`, `\"analytics\"`… */\n purposes: string[];\n /** Tied to the person's identity. */\n linked: boolean;\n /** Used to track the person across other companies' apps and websites. */\n tracking: boolean;\n}\n\n/**\n * The `privacy` block: what goes in the iOS privacy manifest's collected data\n * types. Left out, the Genesis blocks the app's packages carry decide.\n */\nexport interface GenesisPrivacy {\n /** The Genesis blocks whose data the app sends anywhere (`account`, `observability`, `push`). Default: found from package.json. */\n blocks?: string[];\n /** Every kind of data the app collects. Replaces what the blocks give, so list everything. */\n collects?: GenesisDataUse[];\n /** `NSPrivacyTracking`. Default false; true needs `NSPrivacyTrackingDomains` in app.config. */\n tracking?: boolean;\n}\n\n/**\n * The top-level `supabase` setting: where this app's database files (migrations, pgTAP tests,\n * Edge Functions, config.toml) live. Left out (or `true`), they are this app's own `supabase/`.\n * `false`: this app has none. `{ app }`: another Genesis app's folder, relative to this one\n * (`\"../app\"`), whose `supabase/` holds them; a phone app beside a web app shares its database.\n * Either way `genesis add`, `migrate`, `upgrade` and `init` never write or plan Supabase files\n * here, and the doctor's supabase pack doesn't run.\n */\nexport type GenesisSupabase = false | { app: string };\n\n/** genesis.config.json, parsed, with its shared blocks validated. */\nexport interface GenesisConfigFile {\n /** The whole parsed file, for blocks other readers own (`doctor`, `features`). */\n raw: Record<string, unknown>;\n links?: GenesisLinks;\n privacy?: GenesisPrivacy;\n /** Set only when the database files live elsewhere (see {@link GenesisSupabase}). */\n supabase?: GenesisSupabase;\n /** Where this app sits in its repository (`mobile`), when that isn't the root: see {@link validateAppFolder}. */\n appFolder?: string;\n /** Preview defaults the templates read (templates/vercel/ignore-build.sh): see {@link validateEnvironments}. */\n environments?: GenesisEnvironments;\n /** The app's client layer (ADR 0020): see {@link validateClient}. */\n client?: GenesisClient;\n}\n\n/** The `client` block: where the app's client layer lives (ADR 0020). */\nexport interface GenesisClient {\n /** The layer's folder, relative to the app. Default `src/client`. */\n dir: string;\n}\n\n/** The app's preview defaults. A variable set where the build runs wins over these; these win over Genesis's defaults. */\nexport interface GenesisEnvironments {\n /** on-demand (the default), every-pr or off. */\n previews?: \"on-demand\" | \"every-pr\" | \"off\";\n /** The pull request label that asks for a preview; \"\" turns the label check off. */\n label?: string;\n /** The branch prefix that asks for a preview; \"\" turns the branch check off. */\n branchPrefix?: string;\n}\n\nconst ENVIRONMENT_KEYS = new Set([\"previews\", \"label\", \"branchPrefix\", \"$comment\"]);\n\n/** Check the top-level `environments` block: unknown keys and values fail, so a typo can't silently do nothing. */\nexport function validateEnvironments(raw: unknown, source = \"config\"): GenesisEnvironments {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) return fail(`\"environments\" must be an object`);\n for (const key of Object.keys(raw)) if (!ENVIRONMENT_KEYS.has(key)) fail(`environments: unknown setting \"${key}\" (known: previews, label, branchPrefix)`);\n const out: GenesisEnvironments = {};\n if (raw.previews !== undefined) {\n if (raw.previews !== \"on-demand\" && raw.previews !== \"every-pr\" && raw.previews !== \"off\") fail(`environments.previews must be \"on-demand\", \"every-pr\" or \"off\" (got ${JSON.stringify(raw.previews)})`);\n out.previews = raw.previews as GenesisEnvironments[\"previews\"];\n }\n for (const key of [\"label\", \"branchPrefix\"] as const) {\n if (raw[key] === undefined) continue;\n if (typeof raw[key] !== \"string\") fail(`environments.${key} must be a string (\"\" turns that check off)`);\n out[key] = raw[key] as string;\n }\n return out;\n}\n\nexport interface LoadedConfig {\n config: DoctorConfig;\n /** The file it came from, or null when no config exists (defaults apply). */\n file: string | null;\n /** Folder that relative plugin paths resolve against. */\n dir: string;\n}\n\nconst STRING_LISTS = [\"src\", \"extensions\", \"ignore\", \"tokenFiles\", \"ignoreTokenPrefixes\", \"localPrimitiveDirs\", \"build\", \"componentPackages\"] as const;\nconst STRINGS = [\"uiPackage\", \"rulesDoc\"] as const;\nconst KNOWN = new Set<string>([\n ...STRING_LISTS,\n ...STRINGS,\n \"themeCss\",\n \"rawTags\",\n \"forbiddenImports\",\n \"rules\",\n \"allow\",\n \"extend\",\n \"patterns\",\n \"plugins\",\n \"packs\",\n \"native\",\n \"supabase\",\n \"packages\",\n \"routesDir\",\n \"packageRules\",\n \"ratchet\",\n \"contracts\",\n \"$schema\",\n \"$comment\",\n]);\nconst LEVELS = new Set([\"error\", \"warn\", \"info\", \"off\"]);\n/**\n * The rules that guard `allow`, `rules` and `packageRules` themselves under `--base`. Config can't\n * lower or allow them (an entry for one would switch its own check off), and the ratchet never lowers them.\n */\nexport const META_RULES: ReadonlySet<string> = new Set([\"allow-grew\", \"rules-weakened\", \"ratchet-skipped\", \"extension-invalid\"]);\n/** Rules about the config's own entries: an extension can't cover them. */\nconst CONFIG_RULES = new Set([\"stale-exception\", \"stale-extension\", \"package-rule-override\"]);\nconst EXTENSION_KEYS = new Set([\"rule\", \"file\", \"buildsOn\", \"reason\", \"upstream\"]);\n/** A declared extension's reason is a sentence a reviewer can check, not a word. */\nexport const EXTENSION_REASON_MIN = { chars: 40, words: 6 } as const;\nconst PATTERN_KEYS = new Set([\"id\", \"level\", \"files\", \"exclude\", \"forbid\", \"require\", \"path\", \"message\", \"newOnly\"]);\nconst PACKAGE_RULE_KEYS = new Set([\"level\", \"files\", \"exclude\", \"reason\"]);\nconst CONTRACT_KEYS = new Set([\"out\", \"schemas\", \"databaseEnv\"]);\nconst PACKS = new Set([\"native\", \"supabase\", \"packages\"]);\n/** Each pack's settings: key → \"string\", \"path\" (app-relative folder, normalized), \"list\" or \"boolean\". */\nconst PACK_KEYS: Record<string, Record<string, \"string\" | \"path\" | \"list\" | \"boolean\">> = {\n native: { routerRoot: \"path\" },\n supabase: { migrations: \"path\", base: \"string\", exposedSchemas: \"list\", since: \"string\", automaticBranching: \"boolean\" },\n packages: { base: \"string\" },\n};\n\n/** An app-relative folder in POSIX form (`./app/` → `app`); absolute paths and paths leaving the app are rejected. */\nfunction appPath(v: unknown, where: string, fail: (msg: string) => never): string {\n if (typeof v !== \"string\" || !v.trim()) return fail(`${where} must be a non-empty path`);\n if (path.isAbsolute(v) || /^[A-Za-z]:[\\\\/]/.test(v)) fail(`${where} must be relative to the app, not absolute (\"${v}\")`);\n const norm = path.posix.normalize(v.replace(/\\\\/g, \"/\")).replace(/\\/+$/, \"\");\n if (norm === \".\" || norm === \"..\" || norm.startsWith(\"../\")) fail(`${where} must be a folder inside the app (\"${v}\")`);\n return norm;\n}\n\nexport function loadConfig(root: string, configPath?: string): LoadedConfig {\n if (configPath) {\n const file = path.resolve(root, configPath);\n if (!existsSync(file)) throw new DoctorConfigError(`Config file not found: ${configPath}`);\n const json = readJson(file);\n // An explicit file may hold the block at the top level or under `doctor`\n // (or, for a package.json, under `genesis.doctor`).\n const block = path.basename(file) === \"package.json\" ? json?.genesis?.doctor : json?.doctor ?? json;\n return { config: validateConfig(block ?? {}, file), file, dir: path.dirname(file) };\n }\n const own = path.join(root, \"genesis.config.json\");\n if (existsSync(own)) {\n const block = readGenesisConfig(root)?.raw.doctor;\n return { config: validateConfig(block ?? {}, own), file: own, dir: root };\n }\n const pkg = path.join(root, \"package.json\");\n if (existsSync(pkg)) {\n const block = readJson(pkg)?.genesis?.doctor;\n // A Genesis package's own `genesis.doctor` is what it enforces in apps (package-rules.ts), not settings.\n if (block !== undefined && !isPackageDeclaration(block)) return { config: validateConfig(block, pkg), file: pkg, dir: root };\n }\n return { config: {}, file: null, dir: root };\n}\n\n/**\n * Where a config file keeps the doctor settings, as loadConfig reads it: a package.json under\n * `genesis.doctor`, genesis.config.json under `doctor`, an explicit file under `doctor` or at the top.\n */\nexport function doctorBlock(json: unknown, file: string, explicit: boolean): unknown {\n const j = json as { doctor?: unknown; genesis?: { doctor?: unknown } } | null;\n if (path.basename(file) === \"package.json\") return j?.genesis?.doctor;\n return explicit ? (j?.doctor ?? j) : j?.doctor;\n}\n\n/**\n * A package's rule declaration (`prefer`, `catalog` or its old name `primitives`, `plugin`, `enforce`), as opposed to an app's\n * doctor settings. A block that also holds an app setting is the app's, so a typo such as `plugin`\n * beside `rules` reaches validateConfig and fails instead of hiding the whole block.\n */\nexport function isPackageDeclaration(block: unknown): boolean {\n if (typeof block === \"string\") return true;\n if (!isObject(block)) return false;\n const keys = Object.keys(block).filter((k) => k !== \"$comment\");\n return keys.some((k) => [\"prefer\", \"catalog\", \"primitives\", \"plugin\", \"enforce\"].includes(k)) && !keys.some((k) => KNOWN.has(k));\n}\n\nfunction readJson(file: string) {\n try {\n return JSON.parse(readFileSync(file, \"utf8\"));\n } catch (err) {\n throw new DoctorConfigError(`${file} is not valid JSON: ${(err as Error).message}`);\n }\n}\n\n/**\n * Reads `<root>/genesis.config.json` and validates its shared blocks (today:\n * `links` and `privacy`). Returns null when the file doesn't exist; throws a\n * GenesisConfigError naming the file when it isn't valid.\n */\nexport function readGenesisConfig(root: string): GenesisConfigFile | null {\n const file = path.join(root, \"genesis.config.json\");\n if (!existsSync(file)) return null;\n const raw: unknown = readJson(file);\n if (!isObject(raw)) throw new GenesisConfigError(`${file}: the config must be a JSON object`);\n const out: GenesisConfigFile = { raw };\n if (raw.links !== undefined) out.links = validateLinks(raw.links, file);\n if (raw.privacy !== undefined) out.privacy = validatePrivacy(raw.privacy, file);\n if (raw.supabase !== undefined) {\n const supabase = validateSupabase(raw.supabase, file);\n if (supabase !== true) out.supabase = supabase;\n }\n if (raw.appFolder !== undefined) out.appFolder = validateAppFolder(raw.appFolder, file);\n if (raw.environments !== undefined) out.environments = validateEnvironments(raw.environments, file);\n if (raw.client !== undefined) out.client = validateClient(raw.client, file);\n // localPackages is read and validated by blocks/local.ts where it's used (doctor, add, migrate);\n // the Expo config plugin loads this file too and must not pull the CLI's block code in.\n return out;\n}\n\nconst PLAIN_FOLDER = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,59}(?:\\/[A-Za-z0-9_][A-Za-z0-9_.-]{0,59}){0,7}$/;\n\n/** A plain relative folder (`src`, `apps/web`): no `..`, not absolute, and nothing a YAML string would need escaped. */\nexport function isPlainFolder(value: string): boolean {\n return PLAIN_FOLDER.test(value) && !value.split(\"/\").includes(\"..\");\n}\n\n/**\n * Check the top-level `appFolder` setting: the app's folder from the repository root (`\"mobile\"`).\n * `genesis upgrade` writes the EAS workflows' `paths` from the repository root with it, and leaves\n * `.github/workflows` to the repository (blocks/app-folder.ts).\n */\nexport function validateAppFolder(raw: unknown, source = \"config\"): string {\n const norm = typeof raw === \"string\" ? raw.replace(/^\\.\\//, \"\").replace(/\\/+$/, \"\") : \"\";\n if (!isPlainFolder(norm)) throw new GenesisConfigError(`${source}: \"appFolder\" must be the app's folder from the repository root, such as \"mobile\" or \"apps/phone\" (got ${JSON.stringify(raw)})`);\n return norm;\n}\n\n/** Check the top-level `client` setting: `{ \"dir\": \"<folder inside the app>\" }` (ADR 0020). */\nexport function validateClient(raw: unknown, source = \"config\"): GenesisClient {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) return fail(`\"client\" must be { \"dir\": \"<the client layer's folder, e.g. src/client>\" }`);\n for (const key of Object.keys(raw)) if (key !== \"dir\" && key !== \"$comment\") fail(`client: unknown setting \"${key}\" (known: dir)`);\n const dir = typeof raw.dir === \"string\" ? raw.dir.replace(/^\\.\\//, \"\").replace(/\\/+$/, \"\") : \"\";\n if (!isPlainFolder(dir)) return fail(`client.dir must be a folder inside the app, such as \"src/client\" (got ${JSON.stringify(raw.dir)})`);\n return { dir };\n}\n\n/** Check the top-level `supabase` setting: `true`, `false` or `{ \"app\": \"<relative folder>\" }`. */\nexport function validateSupabase(raw: unknown, source = \"config\"): GenesisSupabase | true {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (typeof raw === \"boolean\") return raw ? true : false;\n if (!isObject(raw)) return fail(`\"supabase\" must be false or { \"app\": \"<the folder of the app that holds supabase/>\" }`);\n for (const key of Object.keys(raw)) if (key !== \"app\" && key !== \"$comment\") fail(`supabase: unknown setting \"${key}\" (known: app)`);\n const app = raw.app;\n if (typeof app !== \"string\" || !app.trim()) return fail(`supabase.app must be the folder of the app that holds supabase/, relative to this one (e.g. \"../app\")`);\n if (path.isAbsolute(app) || /^[A-Za-z]:[\\\\/]/.test(app) || app.includes(\"\\\\\")) fail(`supabase.app must be relative to this app, with forward slashes (\"${app}\")`);\n const norm = path.posix.normalize(app).replace(/\\/+$/, \"\");\n if (norm === \".\" || norm === \"\") fail(`supabase.app names this app itself; leave \"supabase\" out instead`);\n return { app: norm };\n}\n\nconst PRIVACY_KEYS = new Set([\"blocks\", \"collects\", \"tracking\"]);\nconst DATA_USE_KEYS = new Set([\"type\", \"purposes\", \"linked\", \"tracking\"]);\n\n/**\n * Check a `privacy` block (genesis.config.json's, or the plugin's `privacy`\n * option): a misspelt data type or purpose fails the build, since Xcode's\n * privacy report ignores values it doesn't know.\n */\nexport function validatePrivacy(raw: unknown, source = \"config\"): GenesisPrivacy {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) fail(`\"privacy\" must be an object`);\n const c = raw as Record<string, unknown>;\n for (const key of Object.keys(c)) if (!PRIVACY_KEYS.has(key)) fail(`privacy: unknown setting \"${key}\"`);\n const out: GenesisPrivacy = {};\n if (c.blocks !== undefined) {\n if (!isStringList(c.blocks)) fail(`privacy.blocks must be a list of block ids`);\n out.blocks = [...new Set(c.blocks as string[])];\n }\n if (c.tracking !== undefined) {\n if (typeof c.tracking !== \"boolean\") fail(`privacy.tracking must be true or false`);\n out.tracking = c.tracking as boolean;\n }\n if (c.collects !== undefined) {\n if (!Array.isArray(c.collects)) fail(`privacy.collects must be a list`);\n out.collects = (c.collects as unknown[]).map((entry, i) => {\n const where = `privacy.collects[${i}]`;\n if (!isObject(entry)) return fail(`${where} must be an object`);\n for (const key of Object.keys(entry)) if (!DATA_USE_KEYS.has(key)) fail(`${where}: unknown setting \"${key}\"`);\n if (typeof entry.type !== \"string\" || !privacyDataType(entry.type)) {\n fail(`${where}.type \"${String(entry.type)}\" is not one of ${Object.keys(PRIVACY_DATA_TYPES).join(\", \")}`);\n }\n if (!isStringList(entry.purposes) || entry.purposes.length === 0) fail(`${where}.purposes must be a non-empty list`);\n for (const p of entry.purposes as string[]) {\n if (!(p in PRIVACY_PURPOSES)) fail(`${where}.purposes: \"${p}\" is not one of ${Object.keys(PRIVACY_PURPOSES).join(\", \")}`);\n }\n if (typeof entry.linked !== \"boolean\") fail(`${where}.linked must be true or false`);\n if (typeof entry.tracking !== \"boolean\") fail(`${where}.tracking must be true or false`);\n return { type: entry.type as string, purposes: [...new Set(entry.purposes as string[])], linked: entry.linked as boolean, tracking: entry.tracking as boolean };\n });\n }\n return out;\n}\n\nconst LINK_KEYS = new Set([\"hosts\", \"paths\", \"webcredentials\"]);\nconst HOST = /^(?=.{1,253}$)(\\*\\.)?([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$/;\n\n/** Check the `links` block, so a typo'd host fails the build instead of shipping links that never open. */\nexport function validateLinks(raw: unknown, source = \"config\"): GenesisLinks {\n const fail = (msg: string): never => {\n throw new GenesisConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) fail(`\"links\" must be an object`);\n const c = raw as Record<string, unknown>;\n for (const key of Object.keys(c)) if (!LINK_KEYS.has(key)) fail(`links: unknown setting \"${key}\"`);\n if (!isStringList(c.hosts) || c.hosts.length === 0) fail(`links.hosts must be a non-empty list of host names`);\n for (const host of c.hosts as string[]) {\n if (!HOST.test(host)) {\n fail(`links.hosts: \"${host}\" is not a bare lower-case host name (no scheme, path or port), e.g. \"example.com\"`);\n }\n }\n if (c.paths !== undefined) {\n if (!isStringList(c.paths)) fail(`links.paths must be a list of path prefixes`);\n for (const p of c.paths as string[]) {\n if (!p.startsWith(\"/\") || /[\\s?#*]/.test(p)) {\n fail(`links.paths: \"${p}\" must start with \"/\" and hold no spaces, \"?\", \"#\" or \"*\"`);\n }\n }\n }\n if (c.webcredentials !== undefined && typeof c.webcredentials !== \"boolean\") fail(`links.webcredentials must be true or false`);\n const links: GenesisLinks = { hosts: [...new Set(c.hosts as string[])] };\n if (c.paths !== undefined) links.paths = [...new Set(c.paths as string[])];\n if (c.webcredentials !== undefined) links.webcredentials = c.webcredentials as boolean;\n return links;\n}\n\n/** Check the shape, so a typo fails loudly instead of silently disabling a check. */\nexport function validateConfig(raw: unknown, source = \"config\"): DoctorConfig {\n const fail = (msg: string): never => {\n throw new DoctorConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) fail(\"the doctor settings must be an object\");\n const c = raw as Record<string, unknown>;\n for (const key of Object.keys(c)) if (!KNOWN.has(key)) fail(`unknown setting \"${key}\"`);\n // themeCss takes one stylesheet or several; normalize to a list.\n if (typeof c.themeCss === \"string\") c.themeCss = [c.themeCss];\n if (c.themeCss !== undefined && !isStringList(c.themeCss)) fail(`\"themeCss\" must be a path or a list of paths`);\n for (const key of STRING_LISTS) {\n if (c[key] !== undefined && !isStringList(c[key])) fail(`\"${key}\" must be a list of strings`);\n }\n for (const key of STRINGS) {\n if (c[key] !== undefined && typeof c[key] !== \"string\") fail(`\"${key}\" must be a string`);\n }\n if (c.routesDir !== undefined) c.routesDir = appPath(c.routesDir, `\"routesDir\"`, fail);\n if (c.rawTags !== undefined) {\n if (!isObject(c.rawTags)) fail(`\"rawTags\" must be an object`);\n for (const [tag, v] of Object.entries(c.rawTags as object)) {\n if (!/^[a-z][a-z0-9-]*$/.test(tag)) fail(`rawTags: \"${tag}\" is not an HTML tag name`);\n if (v !== false && typeof v !== \"string\") fail(`rawTags.${tag} must be a component name or false`);\n }\n }\n if (c.forbiddenImports !== undefined) {\n if (!isObject(c.forbiddenImports)) fail(`\"forbiddenImports\" must be an object of pattern → message`);\n for (const [re, msg] of Object.entries(c.forbiddenImports as object)) {\n if (typeof msg !== \"string\") fail(`forbiddenImports[\"${re}\"] must be a message string`);\n checkRegExp(re, `forbiddenImports[\"${re}\"]`, fail);\n }\n }\n if (c.rules !== undefined) {\n if (!isObject(c.rules)) fail(`\"rules\" must be an object of rule → level`);\n for (const [rule, level] of Object.entries(c.rules as object)) {\n if (!LEVELS.has(level as string)) fail(`rules.${rule} must be \"error\", \"warn\", \"info\" or \"off\"`);\n if (META_RULES.has(rule)) fail(`rules can't set ${rule}: it guards the config itself`);\n }\n }\n if (c.allow !== undefined) {\n if (!Array.isArray(c.allow)) fail(`\"allow\" must be a list`);\n (c.allow as unknown[]).forEach((e, i) => {\n if (!isObject(e)) return fail(`allow[${i}] must be an object`);\n const entry = e as Record<string, unknown>;\n if (typeof entry.rule !== \"string\" || !entry.rule) fail(`allow[${i}] needs a \"rule\"`);\n if (typeof entry.reason !== \"string\" || !entry.reason.trim()) fail(`allow[${i}] (${entry.rule}) needs a \"reason\"`);\n if (META_RULES.has(entry.rule as string)) fail(`allow[${i}] can't allow ${entry.rule}: it guards the allow list itself`);\n for (const k of [\"file\", \"match\"]) {\n if (entry[k] !== undefined && typeof entry[k] !== \"string\") fail(`allow[${i}].${k} must be a string`);\n }\n });\n }\n if (c.extend !== undefined) {\n if (!Array.isArray(c.extend)) fail(`\"extend\" must be a list of { rule, file, buildsOn, reason, upstream? }`);\n const seen = new Set<string>();\n (c.extend as unknown[]).forEach((e, i) => {\n const where = `extend[${i}]`;\n if (!isObject(e)) return fail(`${where} must be an object`);\n for (const k of Object.keys(e)) if (!EXTENSION_KEYS.has(k)) fail(`${where}: unknown key \"${k}\" (known: ${[...EXTENSION_KEYS].join(\", \")})`);\n for (const k of [\"rule\", \"file\", \"buildsOn\", \"reason\"]) if (typeof e[k] !== \"string\" || !(e[k] as string).trim()) fail(`${where} needs \"${k}\"`);\n const { rule, file, buildsOn, reason } = e as Record<string, string>;\n if (META_RULES.has(rule!) || CONFIG_RULES.has(rule!)) fail(`${where} can't extend ${rule}: it is about the config, not the app's code`);\n if (!rule!.includes(\"/\")) fail(`${where} can't extend ${rule}: only package rules declare extension points (a built-in rule's findings are fixed, or recorded as allow debt)`);\n if (/[*?[\\]{}]/.test(file!)) fail(`${where}.file must be one file, not a glob: each extension is reviewed on its own`);\n e.file = appPath(file, `${where}.file`, fail);\n if (!/^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)*$/.test(buildsOn!)) fail(`${where}.buildsOn must name a Genesis export, or a part of one (\"FormBuilder\", \"ResourceView.slots\")`);\n const text = reason!.trim();\n if (text.length < EXTENSION_REASON_MIN.chars || text.split(/\\s+/).length < EXTENSION_REASON_MIN.words) {\n fail(`${where} (${rule}) needs a reason of at least ${EXTENSION_REASON_MIN.words} words and ${EXTENSION_REASON_MIN.chars} characters: why the rule's primitive doesn't fit this file`);\n }\n if (e.upstream !== undefined && (typeof e.upstream !== \"string\" || !e.upstream.trim())) fail(`${where}.upstream must be a link to the gap's write-up`);\n const key = `${rule}\\0${e.file as string}`;\n if (seen.has(key)) fail(`${where} extends ${rule} in ${e.file as string} twice`);\n seen.add(key);\n });\n }\n if (c.patterns !== undefined) {\n if (!Array.isArray(c.patterns)) fail(`\"patterns\" must be a list`);\n (c.patterns as unknown[]).forEach((p, i) => {\n if (!isObject(p)) return fail(`patterns[${i}] must be an object`);\n const rule = p as Record<string, unknown>;\n for (const k of Object.keys(rule)) if (!PATTERN_KEYS.has(k)) fail(`patterns[${i}]: unknown key \"${k}\"`);\n if (typeof rule.id !== \"string\" || !rule.id) fail(`patterns[${i}] needs an \"id\"`);\n for (const k of [\"files\", \"exclude\"]) {\n if (rule[k] !== undefined && !isStringList(rule[k])) fail(`patterns[${i}].${k} must be a list of globs`);\n }\n if (rule.newOnly !== undefined && typeof rule.newOnly !== \"boolean\") fail(`patterns[${i}].newOnly must be true or false`);\n });\n }\n if (c.packageRules !== undefined) {\n if (!isObject(c.packageRules)) fail(`\"packageRules\" must be an object of package rule id → { level?, files?, exclude?, reason }`);\n for (const [id, v] of Object.entries(c.packageRules as object)) {\n const where = `packageRules[\"${id}\"]`;\n if (!id.includes(\"/\")) fail(`${where}: package rule ids are namespaced by package, e.g. \"ui/lists-use-resource-view\"`);\n if (!isObject(v)) fail(`${where} must be an object`);\n const setting = v as Record<string, unknown>;\n for (const k of Object.keys(setting)) if (!PACKAGE_RULE_KEYS.has(k)) fail(`${where}: unknown key \"${k}\" (known: level, files, exclude, reason)`);\n if (typeof setting.reason !== \"string\" || !setting.reason.trim()) fail(`${where} needs a \"reason\": a package rule is never changed silently`);\n if (setting.level !== undefined && !LEVELS.has(setting.level as string)) fail(`${where}.level must be \"error\", \"warn\", \"info\" or \"off\"`);\n for (const k of [\"files\", \"exclude\"]) if (setting[k] !== undefined && !isStringList(setting[k])) fail(`${where}.${k} must be a list of globs`);\n }\n }\n if (c.ratchet !== undefined && typeof c.ratchet !== \"boolean\" && !isStringList(c.ratchet)) fail(`\"ratchet\" must be true, false or a list of rule ids`);\n if (c.packs !== undefined) {\n if (!isStringList(c.packs)) fail(`\"packs\" must be a list, e.g. [\"native\", \"supabase\"]`);\n for (const p of c.packs as string[]) if (!PACKS.has(p)) fail(`packs: unknown pack \"${p}\" (known: ${[...PACKS].join(\", \")})`);\n if (new Set(c.packs as string[]).size !== (c.packs as string[]).length) fail(`packs: lists a pack twice`);\n }\n // After `packs` is known to be a list of pack names.\n if (c.contracts !== undefined) {\n if (!isObject(c.contracts)) fail(`\"contracts\" must be an object: { out?, schemas?, databaseEnv? }`);\n const contracts = c.contracts as Record<string, unknown>;\n for (const k of Object.keys(contracts)) if (!CONTRACT_KEYS.has(k)) fail(`contracts: unknown setting \"${k}\" (known: out, schemas, databaseEnv)`);\n if (!((c.packs as string[] | undefined) ?? []).includes(\"supabase\")) fail(`\"contracts\" is set but the supabase pack is not in \"packs\"`);\n if (contracts.out !== undefined) {\n if (typeof contracts.out !== \"string\" || !contracts.out.trim()) fail(`contracts.out must be a file path`);\n if (path.isAbsolute(contracts.out as string) || (contracts.out as string).replace(/\\\\/g, \"/\").split(\"/\").includes(\"..\")) fail(`contracts.out must be a file inside the app`);\n }\n if (contracts.schemas !== undefined && !isStringList(contracts.schemas)) fail(`contracts.schemas must be a list of schema names`);\n if (contracts.databaseEnv !== undefined && (typeof contracts.databaseEnv !== \"string\" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(contracts.databaseEnv))) {\n fail(`contracts.databaseEnv must be an environment variable name`);\n }\n }\n for (const [pack, keys] of Object.entries(PACK_KEYS)) {\n const block = c[pack];\n if (block === undefined) continue;\n if (!isObject(block)) fail(`\"${pack}\" must be an object`);\n if (!((c.packs as string[] | undefined) ?? []).includes(pack)) fail(`\"${pack}\" settings are set but the ${pack} pack is not in \"packs\"`);\n for (const [k, v] of Object.entries(block as object)) {\n const want = keys[k];\n if (!want) fail(`${pack}: unknown setting \"${k}\"`);\n if (want === \"string\" && typeof v !== \"string\") fail(`${pack}.${k} must be a string`);\n if (want === \"list\" && !isStringList(v)) fail(`${pack}.${k} must be a list of strings`);\n if (want === \"boolean\" && typeof v !== \"boolean\") fail(`${pack}.${k} must be true or false`);\n if (want === \"string\" && !(v as string).trim()) fail(`${pack}.${k} must not be empty`);\n if (want === \"path\") (block as Record<string, unknown>)[k] = appPath(v, `${pack}.${k}`, fail);\n }\n }\n // Schema names compare lowercased, like the SQL they're matched against.\n const supa = c.supabase as Record<string, unknown> | undefined;\n if (Array.isArray(supa?.exposedSchemas)) supa.exposedSchemas = (supa.exposedSchemas as string[]).map((s) => s.toLowerCase());\n if (c.plugins !== undefined) {\n const ok =\n Array.isArray(c.plugins) &&\n c.plugins.every((p) => typeof p === \"string\" || (Array.isArray(p) && p.length === 2 && typeof p[0] === \"string\"));\n if (!ok) fail(`\"plugins\" must be a list of module paths or [path, options] pairs`);\n }\n return c as DoctorConfig;\n}\n\nexport function checkRegExp(source: string, where: string, fail: (msg: string) => never): void {\n try {\n new RegExp(source);\n } catch (err) {\n fail(`${where} is not a valid regular expression: ${(err as Error).message}`);\n }\n}\n\nfunction isObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\nfunction isStringList(v: unknown): v is string[] {\n return Array.isArray(v) && v.every((x) => typeof x === \"string\");\n}\n","/**\n * `withGenesis()` — the Genesis Expo config plugin.\n *\n * Keeps an app's `app.config.ts` to a name, ids and plugins. It sets:\n *\n * 1. App variants: `APP_VARIANT` (`development` | `preview` | `production`,\n * default `production`) suffixes the bundle id, Android package, name and\n * URL scheme, so the three builds install side by side and a\n * `scheme://` link opens the build it names, not whichever one iOS or\n * Android picks among apps that registered the same scheme.\n * 2. Universal / app links from genesis.config.json `links`:\n * `ios.associatedDomains` (`applinks:` and `webcredentials:`) and one\n * Android `intentFilters` entry with `autoVerify`.\n * 3. The iOS privacy manifest, merged into what the app declares: the\n * required-reason APIs of React Native, Expo and the packages the app's\n * package.json lists; `NSPrivacyTracking: false`; and the collected data\n * types, the union of what each Genesis block the app uses collects\n * (`account`, `observability`, `push`), or the app's own list from\n * genesis.config.json `privacy` or the plugin's `privacy` option.\n * 4. Export compliance: `ios.config.usesNonExemptEncryption = false`.\n * 5. `runtimeVersion: { policy: \"fingerprint\" }`.\n *\n * Anything the app already sets wins: the plugin fills gaps and appends to\n * lists, never overwrites or removes a value, and running it twice changes\n * nothing.\n *\n * Determinism: the plugin reads two committed files in the project root,\n * genesis.config.json and package.json, and one environment variable,\n * APP_VARIANT. No network, no clock, no other environment. The same commit\n * and variant always give the same config; the EAS fingerprint is stable only\n * if APP_VARIANT is set the same way for builds, `eas update` and fingerprint\n * checks (an EAS environment variable, not a build profile's `env`).\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { ConfigPlugin } from \"@expo/config-plugins\";\nimport type { ExpoConfig } from \"@expo/config-types\";\nimport {\n GenesisConfigError,\n PRIVACY_PURPOSES,\n privacyDataType,\n readGenesisConfig,\n validatePrivacy,\n type GenesisDataUse,\n type GenesisLinks,\n type GenesisPrivacy,\n} from \"./doctor/config.js\";\n\nexport {\n GenesisConfigError,\n PRIVACY_DATA_TYPES,\n PRIVACY_PURPOSES,\n privacyDataType,\n validateLinks,\n validatePrivacy,\n readGenesisConfig,\n type GenesisDataUse,\n type GenesisLinks,\n type GenesisPrivacy,\n} from \"./doctor/config.js\";\n\nexport const APP_VARIANTS = [\"development\", \"preview\", \"production\"] as const;\nexport type AppVariant = (typeof APP_VARIANTS)[number];\n\nexport interface VariantSuffix {\n /** Appended to `ios.bundleIdentifier` and `android.package`, e.g. `.dev`. */\n id: string;\n /** Appended to `name`, e.g. ` (Dev)`. */\n name: string;\n /** Appended to each `scheme`, e.g. `-dev` (`myapp-dev://`). */\n scheme: string;\n}\n\n/** A required-reason API category and the reasons for it, as in PrivacyInfo.xcprivacy. */\nexport interface PrivacyApi {\n NSPrivacyAccessedAPIType: string;\n NSPrivacyAccessedAPITypeReasons: string[];\n}\n\nexport interface WithGenesisOptions {\n /**\n * The variant, overriding `APP_VARIANT`. Tests and scripts pass it; an app\n * leaves it out and sets `APP_VARIANT` per build profile in eas.json.\n */\n variant?: AppVariant;\n /** Suffixes per non-production variant. Default `.dev` / ` (Dev)` / `-dev` and `.preview` / ` (Preview)` / `-preview`. */\n variants?: Partial<Record<Exclude<AppVariant, \"production\">, Partial<VariantSuffix>>>;\n /** Where genesis.config.json and package.json live. Default: the Expo project root. */\n projectRoot?: string;\n /**\n * The manifest's collected data types, overriding genesis.config.json\n * `privacy` key by key (`blocks` here replaces the file's `blocks`; a\n * `collects` list, from either place, replaces every block's list). An app\n * passes `blocks` from its own feature switches, so a block turned off\n * declares nothing. Without `privacy` in either place, the blocks are found\n * from package.json and a warning says the app's own data isn't in the list.\n */\n privacy?: GenesisPrivacy;\n /** Turn single steps off. Every step is on by default. */\n links?: boolean;\n privacyManifest?: boolean;\n exportCompliance?: boolean;\n fingerprint?: boolean;\n}\n\nexport const DEFAULT_VARIANT_SUFFIXES: Record<Exclude<AppVariant, \"production\">, VariantSuffix> = {\n development: { id: \".dev\", name: \" (Dev)\", scheme: \"-dev\" },\n preview: { id: \".preview\", name: \" (Preview)\", scheme: \"-preview\" },\n};\n\nconst api = (category: string, ...reasons: string[]): PrivacyApi => ({\n NSPrivacyAccessedAPIType: `NSPrivacyAccessedAPICategory${category}`,\n NSPrivacyAccessedAPITypeReasons: reasons,\n});\n\n/**\n * The required-reason APIs each package needs the app to declare, copied from\n * the package's own PrivacyInfo.xcprivacy (read from the SDK 58 versions the\n * starter installs). A package is matched when the app's package.json lists\n * it in `dependencies`. CocoaPods also merges these manifests into the app's\n * at `pod install` (React Native's privacy manifest aggregation); declaring\n * them here keeps the app's manifest whole when that is off, or for a pod\n * that doesn't ship one.\n *\n * - react-native 0.88 (`React/Resources`, `ReactCommon/cxxreact`,\n * `ReactCommon/react/timing` and the boost, glog and RCT-Folly podspecs):\n * FileTimestamp C617.1, UserDefaults CA92.1, SystemBootTime 35F9.1.\n * - expo 58, for what it always installs: expo-file-system (FileTimestamp\n * 0A2A.1 and 3B52.1, DiskSpace E174.1 and 85F4.1) and expo-constants\n * (UserDefaults CA92.1).\n * - expo-updates, through expo-eas-client: UserDefaults CA92.1.\n * - expo-application: FileTimestamp C617.1.\n * - expo-notifications: UserDefaults CA92.1.\n * - async-storage 2.2.0: FileTimestamp C617.1.\n *\n * - @sentry/react-native: UserDefaults CA92.1, SystemBootTime 35F9.1,\n * FileTimestamp C617.1, as Sentry's \"Apple Privacy Manifest\" guide for\n * React Native lists (sentry-cocoa ships in a pod, not in node_modules).\n *\n * Not listed, because their packages ship no required-reason API: expo-secure-store\n * (the Keychain is not one), expo-crypto, expo-haptics, expo-linking,\n * expo-apple-authentication, expo-router, netinfo, reanimated and the other\n * starter dependencies with no PrivacyInfo.xcprivacy.\n */\nexport const PRIVACY_APIS: Record<string, PrivacyApi[]> = {\n \"react-native\": [api(\"FileTimestamp\", \"C617.1\"), api(\"UserDefaults\", \"CA92.1\"), api(\"SystemBootTime\", \"35F9.1\")],\n expo: [api(\"FileTimestamp\", \"0A2A.1\", \"3B52.1\"), api(\"DiskSpace\", \"E174.1\", \"85F4.1\"), api(\"UserDefaults\", \"CA92.1\")],\n \"expo-updates\": [api(\"UserDefaults\", \"CA92.1\")],\n \"expo-application\": [api(\"FileTimestamp\", \"C617.1\")],\n \"expo-notifications\": [api(\"UserDefaults\", \"CA92.1\")],\n \"@react-native-async-storage/async-storage\": [api(\"FileTimestamp\", \"C617.1\")],\n \"@sentry/react-native\": [api(\"UserDefaults\", \"CA92.1\"), api(\"SystemBootTime\", \"35F9.1\"), api(\"FileTimestamp\", \"C617.1\")],\n};\n\n/** A Genesis block's collected data, and the packages that mean the app uses it. */\nexport interface PrivacyBlock {\n /** The block is on when the app's `dependencies` list every one of these. */\n packages: string[];\n collects: GenesisDataUse[];\n}\n\nconst appFunctionality = (type: string, ...more: string[]): GenesisDataUse => ({\n type,\n purposes: [\"app functionality\", ...more],\n linked: true,\n tracking: false,\n});\n\n/**\n * What each Genesis block collects, mirroring its `defineBlock`\n * `privacy.collects` (the blocks themselves are React Native code, which a\n * config plugin can't load). \"Collected\" is Apple's sense: sent off the\n * phone, to the app's own backend or a vendor. Purposes follow Apple's\n * definitions: crash and performance data that keep the app working are app\n * functionality (\"minimize app crashes, improve scalability and\n * performance\"); analytics is the typed product events.\n *\n * - `account` (`@marktiderman/genesis-supabase` `accountBlock`): the\n * sign-in email, the account id, and the name (Sign in with Apple's, or\n * one typed in).\n * - `observability` (`@marktiderman/genesis-native` `createObservability`\n * with `events`, reporting through Sentry): crash and performance data,\n * and the other diagnostic data Sentry sends with them (device and OS\n * details, breadcrumbs, sessions), the three Sentry's own privacy-manifest\n * guide lists; the user id; and the typed analytics events (product\n * interaction), all linked because the sink sets the user id. Found by\n * `@sentry/react-native`; an app that never sets a DSN sends nothing and\n * should leave this block out.\n * - `push` (`@marktiderman/genesis-native` `createPush`): the device's push\n * token against the person (a device-level id).\n * - `support` (`@marktiderman/genesis-support` `supportContributions`):\n * feedback and support requests the person sends, with their text, an\n * optional screenshot, the account id and basic device facts.\n *\n * Tests keep each entry equal to its block's own list.\n */\nexport const PRIVACY_BLOCKS: Record<string, PrivacyBlock> = {\n account: {\n packages: [\"@marktiderman/genesis-supabase\"],\n collects: [appFunctionality(\"email address\"), appFunctionality(\"user id\"), appFunctionality(\"name\")],\n },\n observability: {\n packages: [\"@marktiderman/genesis-native\", \"@sentry/react-native\"],\n collects: [\n appFunctionality(\"crash data\"),\n appFunctionality(\"performance data\"),\n appFunctionality(\"other diagnostic data\"),\n appFunctionality(\"user id\", \"analytics\"),\n { type: \"product interaction\", purposes: [\"analytics\"], linked: true, tracking: false },\n ],\n },\n push: {\n packages: [\"@marktiderman/genesis-native\", \"expo-notifications\"],\n collects: [appFunctionality(\"device ID\")],\n },\n support: {\n packages: [\"@marktiderman/genesis-support\"],\n collects: [\n appFunctionality(\"user id\"),\n appFunctionality(\"customer support\"),\n appFunctionality(\"other user content\"),\n appFunctionality(\"photos or videos\"),\n appFunctionality(\"other diagnostic data\"),\n ],\n },\n};\n\n/** The variant from options, else `APP_VARIANT`, else production. An unknown value throws. */\nexport function resolveVariant(given?: string): AppVariant {\n const value = given ?? process.env.APP_VARIANT ?? \"production\";\n if (!(APP_VARIANTS as readonly string[]).includes(value)) {\n throw new GenesisConfigError(`APP_VARIANT is \"${value}\"; expected one of ${APP_VARIANTS.join(\", \")}`);\n }\n return value as AppVariant;\n}\n\nexport function applyVariant(config: ExpoConfig, variant: AppVariant, options: WithGenesisOptions[\"variants\"] = {}): ExpoConfig {\n if (variant === \"production\") return config;\n const suffix = { ...DEFAULT_VARIANT_SUFFIXES[variant], ...options[variant] };\n // A value that already ends in the suffix was suffixed by an earlier run: leave it.\n const add = (value: string, end: string) => (end && value.endsWith(end) ? value : value + end);\n const next: ExpoConfig = { ...config, name: add(config.name, suffix.name) };\n if (config.ios?.bundleIdentifier) next.ios = { ...config.ios, bundleIdentifier: add(config.ios.bundleIdentifier, suffix.id) };\n if (config.android?.package) next.android = { ...config.android, package: add(config.android.package, suffix.id) };\n // Every build registering the same scheme would let a link open the wrong one. Production keeps the base.\n if (typeof config.scheme === \"string\") next.scheme = add(config.scheme, suffix.scheme);\n else if (Array.isArray(config.scheme)) next.scheme = config.scheme.map((scheme) => add(scheme, suffix.scheme));\n return next;\n}\n\nexport function applyLinks(config: ExpoConfig, links: GenesisLinks | undefined): ExpoConfig {\n if (!links) return config;\n const services = links.webcredentials === false ? [\"applinks\"] : [\"applinks\", \"webcredentials\"];\n const domains = links.hosts.flatMap((host) => services.map((service) => `${service}:${host}`));\n const associatedDomains = union(config.ios?.associatedDomains ?? [], domains);\n\n const data = links.hosts.flatMap((host) =>\n links.paths?.length ? links.paths.map((pathPrefix) => ({ scheme: \"https\", host, pathPrefix })) : [{ scheme: \"https\", host }],\n );\n const filter = { action: \"VIEW\", autoVerify: true, data, category: [\"BROWSABLE\", \"DEFAULT\"] };\n const existing = config.android?.intentFilters ?? [];\n const intentFilters = existing.some((f) => JSON.stringify(f) === JSON.stringify(filter)) ? existing : [...existing, filter];\n\n return {\n ...config,\n ios: { ...config.ios, associatedDomains },\n android: { ...config.android, intentFilters },\n };\n}\n\n/** The required-reason APIs for the packages listed in package.json `dependencies`. */\nexport function privacyApisFor(dependencies: Record<string, unknown>): PrivacyApi[] {\n return Object.keys(PRIVACY_APIS)\n .filter((pkg) => pkg in dependencies)\n .flatMap((pkg) => PRIVACY_APIS[pkg]!);\n}\n\n/** Merge required-reason APIs into `ios.privacyManifests`, keeping every entry and reason the app declares. */\nexport function applyPrivacyApis(config: ExpoConfig, apis: PrivacyApi[]): ExpoConfig {\n if (apis.length === 0) return config;\n const manifests = config.ios?.privacyManifests ?? {};\n const types = (manifests.NSPrivacyAccessedAPITypes ?? []).map((t) => ({ ...t, NSPrivacyAccessedAPITypeReasons: [...t.NSPrivacyAccessedAPITypeReasons] }));\n for (const api of apis) {\n const found = types.find((t) => t.NSPrivacyAccessedAPIType === api.NSPrivacyAccessedAPIType);\n if (found) found.NSPrivacyAccessedAPITypeReasons = union(found.NSPrivacyAccessedAPITypeReasons, api.NSPrivacyAccessedAPITypeReasons);\n else types.push({ ...api, NSPrivacyAccessedAPITypeReasons: [...api.NSPrivacyAccessedAPITypeReasons] });\n }\n return { ...config, ios: { ...config.ios, privacyManifests: { ...manifests, NSPrivacyAccessedAPITypes: types } } };\n}\n\n/** The Genesis blocks whose packages are all in `dependencies`. */\nexport function privacyBlocksFor(dependencies: Record<string, unknown>): string[] {\n return Object.keys(PRIVACY_BLOCKS).filter((id) => PRIVACY_BLOCKS[id]!.packages.every((pkg) => pkg in dependencies));\n}\n\n/**\n * The data the app collects: `privacy.collects` when given, else the union of\n * the blocks' (`privacy.blocks`, else those found in `dependencies`). A type\n * two blocks collect appears once, with every purpose either gives, linked or\n * tracking if either says so. An unknown block id throws.\n */\nexport function collectedDataFor(privacy: GenesisPrivacy, dependencies: Record<string, unknown>): GenesisDataUse[] {\n if (privacy.collects) return mergeDataUses(privacy.collects);\n const blocks = privacy.blocks ?? privacyBlocksFor(dependencies);\n const unknown = blocks.filter((id) => !(id in PRIVACY_BLOCKS));\n if (unknown.length) {\n throw new GenesisConfigError(`privacy.blocks: ${unknown.map((id) => `\"${id}\"`).join(\", \")} not one of ${Object.keys(PRIVACY_BLOCKS).join(\", \")}; list other data in privacy.collects`);\n }\n return mergeDataUses(blocks.flatMap((id) => PRIVACY_BLOCKS[id]!.collects));\n}\n\nfunction mergeDataUses(uses: readonly GenesisDataUse[]): GenesisDataUse[] {\n const byType = new Map<string, GenesisDataUse>();\n for (const use of uses) {\n // By Apple's type, so \"user ID\" and \"user id\" are one entry.\n const key = privacyDataType(use.type) ?? use.type;\n const seen = byType.get(key);\n byType.set(\n key,\n seen\n ? { type: use.type, purposes: union(seen.purposes, use.purposes), linked: seen.linked || use.linked, tracking: seen.tracking || use.tracking }\n : { ...use, purposes: [...use.purposes] },\n );\n }\n return [...byType.values()];\n}\n\n/**\n * Write the collected data types and `NSPrivacyTracking` into\n * `ios.privacyManifests`. The app's own entries win: a type it already lists\n * is left as it wrote it, and an `NSPrivacyTracking` it set stays. Tracking\n * defaults to whether any entry tracks; an entry that tracks with tracking\n * set false throws, since the manifest would contradict itself.\n */\nexport function applyPrivacyData(config: ExpoConfig, uses: GenesisDataUse[], tracking?: boolean): ExpoConfig {\n const manifests = config.ios?.privacyManifests ?? {};\n if (tracking !== undefined && manifests.NSPrivacyTracking !== undefined && tracking !== manifests.NSPrivacyTracking) {\n throw new GenesisConfigError(`privacy.tracking is ${tracking} but app.config sets ios.privacyManifests.NSPrivacyTracking to ${manifests.NSPrivacyTracking}; set it in one place`);\n }\n const tracks = uses.some((u) => u.tracking);\n const NSPrivacyTracking = manifests.NSPrivacyTracking ?? tracking ?? tracks;\n if (tracks && NSPrivacyTracking === false) {\n const which = uses.filter((u) => u.tracking).map((u) => u.type);\n throw new GenesisConfigError(`privacy: ${which.join(\", \")} is used for tracking but NSPrivacyTracking is false; set privacy.tracking to true and list NSPrivacyTrackingDomains`);\n }\n const existing = (manifests.NSPrivacyCollectedDataTypes ?? []).map((t) => ({ ...t, NSPrivacyCollectedDataTypePurposes: [...t.NSPrivacyCollectedDataTypePurposes] }));\n const listed = new Set(existing.map((t) => t.NSPrivacyCollectedDataType));\n const added = uses\n .map((u) => ({\n NSPrivacyCollectedDataType: privacyDataType(u.type)!,\n NSPrivacyCollectedDataTypeLinked: u.linked,\n NSPrivacyCollectedDataTypeTracking: u.tracking,\n NSPrivacyCollectedDataTypePurposes: u.purposes.map((p) => PRIVACY_PURPOSES[p]!),\n }))\n .filter((t) => !listed.has(t.NSPrivacyCollectedDataType));\n return {\n ...config,\n ios: { ...config.ios, privacyManifests: { ...manifests, NSPrivacyTracking, NSPrivacyCollectedDataTypes: [...existing, ...added] } },\n };\n}\n\nexport function applyExportCompliance(config: ExpoConfig): ExpoConfig {\n if (config.ios?.config?.usesNonExemptEncryption !== undefined) return config;\n return { ...config, ios: { ...config.ios, config: { ...config.ios?.config, usesNonExemptEncryption: false } } };\n}\n\nexport function applyFingerprint(config: ExpoConfig): ExpoConfig {\n if (config.runtimeVersion !== undefined || config.ios?.runtimeVersion !== undefined || config.android?.runtimeVersion !== undefined) {\n return config;\n }\n return { ...config, runtimeVersion: { policy: \"fingerprint\" } };\n}\n\n/** The Genesis config plugin. Use it in `plugins` or call it directly in app.config.ts. */\nexport const withGenesis: ConfigPlugin<WithGenesisOptions | void> = (config, props) => {\n const options = props ?? {};\n const root = options.projectRoot ?? (config as { _internal?: { projectRoot?: string } })._internal?.projectRoot ?? process.cwd();\n let next = applyVariant(config, resolveVariant(options.variant), options.variants);\n const file = options.links !== false || options.privacyManifest !== false ? readGenesisConfig(root) : null;\n if (options.links !== false) next = applyLinks(next, file?.links);\n if (options.privacyManifest !== false) {\n const dependencies = readDependencies(root);\n const privacy = { ...file?.privacy, ...(options.privacy ? validatePrivacy(options.privacy, \"withGenesis({ privacy })\") : {}) };\n next = applyPrivacyApis(next, privacyApisFor(dependencies));\n if (!privacy.blocks && !privacy.collects && !config.ios?.privacyManifests?.NSPrivacyCollectedDataTypes) {\n // Not a throw: the default is right for an app that is only Genesis blocks. Loud, because\n // anything else the app sends is missing from it.\n console.warn(\n `[genesis] privacy manifest: collected data types are only those of the Genesis blocks found in package.json (${privacyBlocksFor(dependencies).join(\", \") || \"none\"}). If the app sends anything else, list everything it collects in genesis.config.json privacy.collects; to keep this list, set privacy.blocks.`,\n );\n }\n next = applyPrivacyData(next, collectedDataFor(privacy, dependencies), privacy.tracking);\n }\n if (options.exportCompliance !== false) next = applyExportCompliance(next);\n if (options.fingerprint !== false) next = applyFingerprint(next);\n return next;\n};\n\nexport default withGenesis;\n\nfunction readDependencies(root: string): Record<string, unknown> {\n const file = path.join(root, \"package.json\");\n if (!existsSync(file)) return {};\n try {\n const deps = JSON.parse(readFileSync(file, \"utf8\"))?.dependencies;\n return deps && typeof deps === \"object\" ? deps : {};\n } catch (err) {\n throw new GenesisConfigError(`${file} is not valid JSON: ${(err as Error).message}`);\n }\n}\n\nfunction union(a: string[], b: string[]): string[] {\n return [...new Set([...a, ...b])];\n}\n"]}
@@ -35,7 +35,7 @@
35
35
  "version": "0.1.2"
36
36
  },
37
37
  "@marktiderman/genesis-chat": {
38
- "version": "0.10.2",
38
+ "version": "0.11.0",
39
39
  "blocks": {
40
40
  "chat": {
41
41
  "feature": {
@@ -108,10 +108,10 @@
108
108
  "version": "0.4.0"
109
109
  },
110
110
  "@marktiderman/genesis-core": {
111
- "version": "2.16.1"
111
+ "version": "2.17.0"
112
112
  },
113
113
  "@marktiderman/genesis-design-system": {
114
- "version": "1.12.0"
114
+ "version": "1.13.0"
115
115
  },
116
116
  "@marktiderman/genesis-extension": {
117
117
  "version": "0.2.2"
@@ -141,10 +141,10 @@
141
141
  "version": "0.8.1"
142
142
  },
143
143
  "@marktiderman/genesis": {
144
- "version": "0.10.24"
144
+ "version": "0.10.25"
145
145
  },
146
146
  "@marktiderman/genesis-cli": {
147
- "version": "1.27.0"
147
+ "version": "1.28.0"
148
148
  },
149
149
  "@marktiderman/genesis-media": {
150
150
  "version": "0.3.0"
@@ -712,7 +712,7 @@
712
712
  }
713
713
  },
714
714
  "@marktiderman/genesis-support": {
715
- "version": "0.8.1",
715
+ "version": "0.9.0",
716
716
  "blocks": {
717
717
  "support-feedback": {
718
718
  "feature": {
@@ -768,6 +768,10 @@
768
768
  "how": "a ticket's agents and the tenants a sender may write to come from it. Add a migration before support 0004 that defines private.genesis_viewer_people(viewer uuid) returns table (tenant_id uuid, person_id uuid). See genesis-supabase 0016's header."
769
769
  }
770
770
  ]
771
+ },
772
+ {
773
+ "file": "migrations/0016_genesis_support_ticket_fixes.sql",
774
+ "test": "migrations/tests/0016_genesis_support_ticket_fixes.test.sql"
771
775
  }
772
776
  ],
773
777
  "functions": [
@@ -922,6 +926,22 @@
922
926
  {
923
927
  "file": "migrations/0009_genesis_support_inbox.sql",
924
928
  "test": "migrations/tests/0009_genesis_support_inbox.test.sql"
929
+ },
930
+ {
931
+ "file": "migrations/0013_genesis_support_queues.sql",
932
+ "test": "migrations/tests/0013_genesis_support_queues.test.sql"
933
+ },
934
+ {
935
+ "file": "migrations/0014_genesis_support_agent_tools.sql",
936
+ "test": "migrations/tests/0014_genesis_support_agent_tools.test.sql"
937
+ },
938
+ {
939
+ "file": "migrations/0015_genesis_support_agent_tools_bounds.sql",
940
+ "test": "migrations/tests/0015_genesis_support_agent_tools_bounds.test.sql"
941
+ },
942
+ {
943
+ "file": "migrations/0018_genesis_support_agent_queue.sql",
944
+ "test": "migrations/tests/0018_genesis_support_agent_queue.test.sql"
925
945
  }
926
946
  ],
927
947
  "steps": [
@@ -964,6 +984,10 @@
964
984
  {
965
985
  "file": "migrations/0010_genesis_support_help_center.sql",
966
986
  "test": "migrations/tests/0010_genesis_support_help_center.test.sql"
987
+ },
988
+ {
989
+ "file": "migrations/0017_genesis_support_help_answers.sql",
990
+ "test": "migrations/tests/0017_genesis_support_help_answers.test.sql"
967
991
  }
968
992
  ],
969
993
  "steps": [
@@ -1026,10 +1050,10 @@
1026
1050
  "version": "0.1.1"
1027
1051
  },
1028
1052
  "@marktiderman/genesis-ui": {
1029
- "version": "2.35.1"
1053
+ "version": "2.36.0"
1030
1054
  },
1031
1055
  "@marktiderman/genesis-ui-native": {
1032
- "version": "3.12.1"
1056
+ "version": "3.13.0"
1033
1057
  }
1034
1058
  }
1035
1059
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { FileSystem, ScaffoldLogger, ScaffoldOptions, ScaffoldResult, planScaffold, runScaffold, validateConsumerName } from './scaffolder.js';
2
2
  export { RunDoctorOptions, defineDoctorPlugin, formatReport, runDoctor } from './doctor.js';
3
- export { D as DoctorConfig, f as DoctorConfigError, g as DoctorContext, h as DoctorPlugin, i as DoctorResult, F as Finding, c as GenesisConfigError, j as GenesisConfigFile, b as GenesisLinks, k as GenesisSupabase, r as readGenesisConfig, v as validateLinks } from './config-ARs2YQ60.js';
3
+ export { D as DoctorConfig, f as DoctorConfigError, g as DoctorContext, h as DoctorPlugin, i as DoctorResult, F as Finding, c as GenesisConfigError, j as GenesisConfigFile, b as GenesisLinks, k as GenesisSupabase, r as readGenesisConfig, v as validateLinks } from './config-BmMsEWU-.js';
4
4
  import '@marktiderman/genesis-features';
5
5
 
6
6
  type StorageType = "string" | "number" | "boolean" | "datetime" | "json";