Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
293 changes: 293 additions & 0 deletions .agent_work/all-ts-errors.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .agent_work/debug-scripts/_check_pw.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .agent_work/debug-scripts/_query.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .agent_work/debug-scripts/_query2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .agent_work/debug-scripts/_query3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .agent_work/debug-scripts/_query4.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .agent_work/debug-scripts/_set_discount.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .agent_work/debug-scripts/get-nike-id.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { PrismaClient } = require("@prisma/client");
const p = new PrismaClient();
(async () => {
const product = await p.product.findFirst({
where: { slug: "nike-dri-fit-t-shirt" }
});
console.log("Nike Product ID:", product?.id);
await p.$disconnect();
})().catch(e => console.error(e));
38 changes: 38 additions & 0 deletions .agent_work/fix-casing-v2.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Fix Prisma model accessor casing - PascalCase to camelCase
# PowerShell string comparison is case-INSENSITIVE by default!
# Must use -cne (case-sensitive not-equal) for comparison

$models = @(
'FacebookInventorySnapshot','FacebookCheckoutSession','ProductAttributeValue',
'FacebookConversation','FacebookIntegration','FacebookWebhookLog',
'InventoryReservation','FacebookOAuthState','PlatformActivity',
'ProductAttribute','FacebookBatchJob','ProductVariant',
'FacebookProduct','FacebookMessage','ConversionEvent',
'WebhookDelivery','VerificationToken','CustomRoleRequest',
'InventoryLog','DiscountCode','FacebookOrder','StoreRequest',
'PaymentAttempt','Notification','ProjectMember','Membership',
'OrderItem','Fulfillment','StoreStaff','AuditLog','RateLimit',
'CustomRole','Organization','Customer','Category','Webhook',
'Product','Account','Session','Project','Review','Brand',
'Order','Store','User'
)

$files = Get-ChildItem -Path src -Recurse -Include *.ts,*.tsx
$modCount = 0

foreach ($file in $files) {
$content = Get-Content $file.FullName -Raw
if ($null -eq $content) { continue }
$original = $content
foreach ($model in $models) {
$camel = $model.Substring(0,1).ToLower() + $model.Substring(1)
$content = $content.Replace("prisma.$model.", "prisma.$camel.")
}
# CRITICAL: Use -cne for case-sensitive comparison!
if ($content -cne $original) {
Set-Content -Path $file.FullName -Value $content -NoNewline
$modCount++
}
}

"DONE: Modified $modCount files" | Out-Host
39 changes: 39 additions & 0 deletions .agent_work/fix-casing-v3.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Fix Prisma model accessor casing - PascalCase to camelCase
# v3: Uses -LiteralPath to handle [id] brackets in Next.js file paths
# Uses -cne for case-sensitive comparison

$models = @(
'FacebookInventorySnapshot','FacebookCheckoutSession','ProductAttributeValue',
'FacebookConversation','FacebookIntegration','FacebookWebhookLog',
'InventoryReservation','FacebookOAuthState','PlatformActivity',
'ProductAttribute','FacebookBatchJob','ProductVariant',
'FacebookProduct','FacebookMessage','ConversionEvent',
'WebhookDelivery','VerificationToken','CustomRoleRequest',
'InventoryLog','DiscountCode','FacebookOrder','StoreRequest',
'PaymentAttempt','Notification','ProjectMember','Membership',
'OrderItem','Fulfillment','StoreStaff','AuditLog','RateLimit',
'CustomRole','Organization','Customer','Category','Webhook',
'Product','Account','Session','Project','Review','Brand',
'Order','Store','User'
)

$files = Get-ChildItem -Path src -Recurse -Include *.ts,*.tsx
$modCount = 0

foreach ($file in $files) {
# Use -LiteralPath to handle brackets like [id] in Next.js paths
$content = Get-Content -LiteralPath $file.FullName -Raw
if ($null -eq $content) { continue }
$original = $content
foreach ($model in $models) {
$camel = $model.Substring(0,1).ToLower() + $model.Substring(1)
$content = $content.Replace("prisma.$model.", "prisma.$camel.")
}
# Use -cne for case-sensitive comparison
if ($content -cne $original) {
Set-Content -LiteralPath $file.FullName -Value $content -NoNewline
$modCount++
}
}

"DONE: Modified $modCount files" | Out-Host
36 changes: 36 additions & 0 deletions .agent_work/fix-casing.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Fix Prisma model accessor casing - PascalCase to camelCase
# Run from the project root: . .\.agent_work\fix-casing.ps1

$models = @(
'FacebookInventorySnapshot','FacebookCheckoutSession','ProductAttributeValue',
'FacebookConversation','FacebookIntegration','FacebookWebhookLog',
'InventoryReservation','FacebookOAuthState','PlatformActivity',
'ProductAttribute','FacebookBatchJob','ProductVariant',
'FacebookProduct','FacebookMessage','ConversionEvent',
'WebhookDelivery','VerificationToken','CustomRoleRequest',
'InventoryLog','DiscountCode','FacebookOrder','StoreRequest',
'PaymentAttempt','Notification','ProjectMember','Membership',
'OrderItem','Fulfillment','StoreStaff','AuditLog','RateLimit',
'CustomRole','Organization','Customer','Category','Webhook',
'Product','Account','Session','Project','Review','Brand',
'Order','Store','User'
)

$files = Get-ChildItem -Path src -Recurse -Include *.ts,*.tsx
$modCount = 0

foreach ($file in $files) {
$content = Get-Content $file.FullName -Raw
if ($null -eq $content) { continue }
$original = $content
foreach ($model in $models) {
$camel = $model.Substring(0,1).ToLower() + $model.Substring(1)
$content = $content.Replace("prisma.$model.", "prisma.$camel.")
}
if ($content -ne $original) {
Set-Content -Path $file.FullName -Value $content -NoNewline
$modCount++
}
}

"DONE: Modified $modCount files" | Out-Host
66 changes: 66 additions & 0 deletions .agent_work/fix-prisma-casing.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
$models = @(
@('FacebookInventorySnapshot','facebookInventorySnapshot'),
@('FacebookCheckoutSession','facebookCheckoutSession'),
@('ProductAttributeValue','productAttributeValue'),
@('FacebookConversation','facebookConversation'),
@('FacebookIntegration','facebookIntegration'),
@('FacebookWebhookLog','facebookWebhookLog'),
@('InventoryReservation','inventoryReservation'),
@('FacebookOAuthState','facebookOAuthState'),
@('PlatformActivity','platformActivity'),
@('ProductAttribute','productAttribute'),
@('FacebookBatchJob','facebookBatchJob'),
@('ProductVariant','productVariant'),
@('FacebookProduct','facebookProduct'),
@('FacebookMessage','facebookMessage'),
@('ConversionEvent','conversionEvent'),
@('WebhookDelivery','webhookDelivery'),
@('VerificationToken','verificationToken'),
@('CustomRoleRequest','customRoleRequest'),
@('InventoryLog','inventoryLog'),
@('DiscountCode','discountCode'),
@('FacebookOrder','facebookOrder'),
@('StoreRequest','storeRequest'),
@('PaymentAttempt','paymentAttempt'),
@('Notification','notification'),
@('ProjectMember','projectMember'),
@('Membership','membership'),
@('OrderItem','orderItem'),
@('Fulfillment','fulfillment'),
@('StoreStaff','storeStaff'),
@('AuditLog','auditLog'),
@('RateLimit','rateLimit'),
@('CustomRole','customRole'),
@('Organization','organization'),
@('Customer','customer'),
@('Category','category'),
@('Webhook','webhook'),
@('Product','product'),
@('Account','account'),
@('Session','session'),
@('Project','project'),
@('Review','review'),
@('Brand','brand'),
@('Order','order'),
@('Store','store'),
@('User','user')
)

$files = Get-ChildItem -Path src -Recurse -Include *.ts,*.tsx
$modCount = 0

foreach ($file in $files) {
$content = [System.IO.File]::ReadAllText($file.FullName)
$original = $content
foreach ($m in $models) {
$pattern = 'prisma\.' + $m[0] + '\b'
$replacement = 'prisma.' + $m[1]
$content = [regex]::Replace($content, $pattern, $replacement)
}
if ($content -ne $original) {
[System.IO.File]::WriteAllText($file.FullName, $content)
$modCount++
}
}

Write-Host "Modified $modCount files"
79 changes: 79 additions & 0 deletions .agent_work/fix-prisma-casing2.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
param()

$ErrorActionPreference = 'Stop'

$models = @(
@('FacebookInventorySnapshot','facebookInventorySnapshot'),
@('FacebookCheckoutSession','facebookCheckoutSession'),
@('ProductAttributeValue','productAttributeValue'),
@('FacebookConversation','facebookConversation'),
@('FacebookIntegration','facebookIntegration'),
@('FacebookWebhookLog','facebookWebhookLog'),
@('InventoryReservation','inventoryReservation'),
@('FacebookOAuthState','facebookOAuthState'),
@('PlatformActivity','platformActivity'),
@('ProductAttribute','productAttribute'),
@('FacebookBatchJob','facebookBatchJob'),
@('ProductVariant','productVariant'),
@('FacebookProduct','facebookProduct'),
@('FacebookMessage','facebookMessage'),
@('ConversionEvent','conversionEvent'),
@('WebhookDelivery','webhookDelivery'),
@('VerificationToken','verificationToken'),
@('CustomRoleRequest','customRoleRequest'),
@('InventoryLog','inventoryLog'),
@('DiscountCode','discountCode'),
@('FacebookOrder','facebookOrder'),
@('StoreRequest','storeRequest'),
@('PaymentAttempt','paymentAttempt'),
@('Notification','notification'),
@('ProjectMember','projectMember'),
@('Membership','membership'),
@('OrderItem','orderItem'),
@('Fulfillment','fulfillment'),
@('StoreStaff','storeStaff'),
@('AuditLog','auditLog'),
@('RateLimit','rateLimit'),
@('CustomRole','customRole'),
@('Organization','organization'),
@('Customer','customer'),
@('Category','category'),
@('Webhook','webhook'),
@('Product','product'),
@('Account','account'),
@('Session','session'),
@('Project','project'),
@('Review','review'),
@('Brand','brand'),
@('Order','order'),
@('Store','store'),
@('User','user')
)

$files = Get-ChildItem -Path "src" -Recurse -Include "*.ts","*.tsx"
$modCount = 0
$totalReplacements = 0

foreach ($file in $files) {
try {
$content = [System.IO.File]::ReadAllText($file.FullName)
$original = $content

foreach ($m in $models) {
$pascal = $m[0]
$camel = $m[1]
$pattern = "prisma\.$pascal(?=\.|\.)"
# Use lookahead for . which follows model name like prisma.User.findMany
$content = $content -creplace "prisma\.$pascal\.", "prisma.$camel."
}

if ($content -ne $original) {
[System.IO.File]::WriteAllText($file.FullName, $content)
$modCount++
}
} catch {
Write-Host "ERROR on $($file.Name): $_"
}
}

Write-Host "Modified: $modCount files"
78 changes: 78 additions & 0 deletions .agent_work/fix-prisma-casing3.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
param()

$ErrorActionPreference = 'Stop'

# All Prisma models - longest first to avoid partial matches
$models = @(
'FacebookInventorySnapshot',
'FacebookCheckoutSession',
'ProductAttributeValue',
'FacebookConversation',
'FacebookIntegration',
'FacebookWebhookLog',
'InventoryReservation',
'FacebookOAuthState',
'PlatformActivity',
'ProductAttribute',
'FacebookBatchJob',
'ProductVariant',
'FacebookProduct',
'FacebookMessage',
'ConversionEvent',
'WebhookDelivery',
'VerificationToken',
'CustomRoleRequest',
'InventoryLog',
'DiscountCode',
'FacebookOrder',
'StoreRequest',
'PaymentAttempt',
'Notification',
'ProjectMember',
'Membership',
'OrderItem',
'Fulfillment',
'StoreStaff',
'AuditLog',
'RateLimit',
'CustomRole',
'Organization',
'Customer',
'Category',
'Webhook',
'Product',
'Account',
'Session',
'Project',
'Review',
'Brand',
'Order',
'Store',
'User'
)

function ToCamelCase($s) {
return $s.Substring(0,1).ToLower() + $s.Substring(1)
}

$files = Get-ChildItem -Path "src" -Recurse -Include "*.ts","*.tsx"
$modCount = 0

foreach ($file in $files) {
$content = Get-Content $file.FullName -Raw
if ($null -eq $content) { continue }
$original = $content

foreach ($model in $models) {
$camel = ToCamelCase $model
# Replace prisma.ModelName. with prisma.modelName.
$content = $content.Replace("prisma.$model.", "prisma.$camel.")
}

if ($content -ne $original) {
Set-Content -Path $file.FullName -Value $content -NoNewline
$modCount++
}
}

Write-Host "Modified: $modCount files"
Loading
Loading