115 lines
4.2 KiB
PowerShell
115 lines
4.2 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$requiredFiles = @('utils/config.js', 'utils/session.js', 'utils/genealogy-context.js', 'utils/api.js', 'utils/md5.js', 'pages/auth/login.vue', 'pages/lineage/first-person.vue', 'pages/content/list.vue', 'pages/content/editor.vue')
|
|
foreach ($file in $requiredFiles) {
|
|
if (-not (Test-Path (Join-Path $root $file))) {
|
|
throw "Missing core-flow file: $file"
|
|
}
|
|
}
|
|
|
|
$config = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'utils/config.js')
|
|
foreach ($token in @('mode:', 'isMockMode')) {
|
|
if ($config -notmatch [regex]::Escape($token)) {
|
|
throw "Missing runtime mode contract: $token"
|
|
}
|
|
}
|
|
|
|
$context = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'utils/genealogy-context.js')
|
|
foreach ($method in @('getCurrentGenealogyId', 'setCurrentGenealogyId', 'clearCurrentGenealogyId')) {
|
|
if ($context -notmatch [regex]::Escape($method)) {
|
|
throw "Missing genealogy context method: $method"
|
|
}
|
|
}
|
|
|
|
$api = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'utils/api.js')
|
|
foreach ($method in @('unwrapResponse', 'sendSmsCode', 'loginWithPassword', 'loginWithSms')) {
|
|
if ($api -notmatch [regex]::Escape($method)) {
|
|
throw "Missing auth API method: $method"
|
|
}
|
|
}
|
|
|
|
foreach ($method in @('createPerson', 'getPerson')) {
|
|
if ($api -notmatch [regex]::Escape($method)) {
|
|
throw "Missing lineage API method: $method"
|
|
}
|
|
}
|
|
|
|
foreach ($method in @('getArticles', 'getAlbums', 'getCeremonies', 'getGrowthRecords', 'createFeed')) {
|
|
if ($api -notmatch [regex]::Escape($method)) {
|
|
throw "Missing family content API method: $method"
|
|
}
|
|
}
|
|
|
|
if ($api -notmatch 'getProfile') {
|
|
throw 'Missing current-user profile API method'
|
|
}
|
|
|
|
$login = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/auth/login.vue')
|
|
foreach ($token in @('calcMD5', 'loginWithPassword', 'password', 'isSubmitting')) {
|
|
if ($login -notmatch [regex]::Escape($token)) {
|
|
throw "Missing password login behavior: $token"
|
|
}
|
|
}
|
|
|
|
$pages = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages.json')
|
|
if ($pages -notmatch 'pages/lineage/first-person') {
|
|
throw 'Missing first-person page route'
|
|
}
|
|
foreach ($route in @('pages/content/list', 'pages/content/editor')) {
|
|
if ($pages -notmatch [regex]::Escape($route)) {
|
|
throw "Missing content page route: $route"
|
|
}
|
|
}
|
|
|
|
foreach ($pageFile in @('pages/genealogy/detail.vue', 'pages/tree/index.vue', 'pages/member/detail.vue')) {
|
|
$page = Get-Content -Raw -Encoding UTF8 (Join-Path $root $pageFile)
|
|
if ($page -match "id=1001|id=3") {
|
|
throw "Hard-coded route ID remains in $pageFile"
|
|
}
|
|
if ($page -notmatch 'genealogyContext') {
|
|
throw "Missing genealogy context in $pageFile"
|
|
}
|
|
}
|
|
|
|
foreach ($method in @('markNotificationRead', 'markAllNotificationsRead')) {
|
|
if ($api -notmatch [regex]::Escape($method)) {
|
|
throw "Missing notification API method: $method"
|
|
}
|
|
}
|
|
|
|
foreach ($pageFile in @('pages/genealogy/applications.vue', 'pages/notification/index.vue')) {
|
|
$page = Get-Content -Raw -Encoding UTF8 (Join-Path $root $pageFile)
|
|
if ($page -match '1001') {
|
|
throw "Hard-coded genealogy ID remains in $pageFile"
|
|
}
|
|
}
|
|
|
|
$applications = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/genealogy/applications.vue')
|
|
if ($applications -notmatch 'genealogyContext') {
|
|
throw 'Missing genealogy context in applications page'
|
|
}
|
|
|
|
$notifications = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/notification/index.vue')
|
|
foreach ($method in @('markNotificationRead', 'markAllNotificationsRead')) {
|
|
if ($notifications -notmatch [regex]::Escape($method)) {
|
|
throw "Notification page does not use $method"
|
|
}
|
|
}
|
|
|
|
$family = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/family/index.vue')
|
|
foreach ($token in @('genealogyContext', 'openSection', 'pages/content/list', 'pages/content/editor')) {
|
|
if ($family -notmatch [regex]::Escape($token)) {
|
|
throw "Missing family content flow: $token"
|
|
}
|
|
}
|
|
|
|
$profile = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/profile/index.vue')
|
|
foreach ($token in @('appApi', 'getProfile', 'profile.name')) {
|
|
if ($profile -notmatch [regex]::Escape($token)) {
|
|
throw "Missing dynamic profile behavior: $token"
|
|
}
|
|
}
|
|
|
|
Write-Output 'PASS core-flow session and auth contract'
|