This directory contains scripts to safely delete projects with titles that are "test" or start with "test" from Gigya DS.
A straightforward script that deletes test projects with minimal configuration.
Features:
A comprehensive script with extensive safety features and configuration options.
Features:
IMPORTANT: These scripts perform soft deletes by marking projects as deleted: true rather than permanently removing them from the database. This allows for potential recovery if needed.
Environment Variables:
export GIGYA_API_KEY="your_api_key" export GIGYA_APP_KEY="your_app_key" export GIGYA_APP_SECRET="your_app_secret" export GIGYA_DOMAIN="accounts.eu1.gigya.com" # Optional, defaults to EU1
Permissions:
oss_projects data store# Delete all test projects (basic version) npx tsx delete-test-projects.ts
# Preview what would be deleted without making changes DRY_RUN=true npx tsx delete-test-projects-advanced.ts
# Delete test projects with confirmation prompt CONFIRM_DELETE=DELETE npx tsx delete-test-projects-advanced.ts
# Delete test projects without confirmation (use with caution!) REQUIRE_CONFIRMATION=false npx tsx delete-test-projects-advanced.ts
# Only match "Test" with exact case CASE_SENSITIVE=true npx tsx delete-test-projects-advanced.ts
# Only delete projects with title exactly "test" EXACT_MATCH_ONLY=true npx tsx delete-test-projects-advanced.ts
# Delete projects matching custom patterns CUSTOM_PATTERNS="demo,sample,temp" npx tsx delete-test-projects-advanced.ts
| Environment Variable | Default | Description |
|---|---|---|
DRY_RUN | false | Preview deletions without executing them |
REQUIRE_CONFIRMATION | true | Require manual confirmation before deletion |
CASE_SENSITIVE | false | Use case-sensitive title matching |
EXACT_MATCH_ONLY | false | Only delete exact "test" matches, not "test*" |
CUSTOM_PATTERNS | "" | Comma-separated additional patterns to match |
CONFIRM_DELETE | "" | Set to "DELETE" to confirm deletion |
The scripts will delete projects with titles that:
Examples of matched titles:
testTestTESTtest projectTest Applicationtesting somethingWith EXACT_MATCH_ONLY=true, only projects with title exactly "test" will be deleted.
You can specify additional patterns to match:
CUSTOM_PATTERNS="demo,sample,temp,prototype"
This will also delete projects containing these words in their titles.
๐ Analyzing projects for test patterns...
๐ Project Analysis:
๐ Total active projects: 25
๐งช Test projects found: 3
๐ฏ Exact 'test' matches: 1
๐ค Starts with 'test': 2
๐ง Custom pattern matches: 0
๐ Projects that will be deleted:
1. "test" - Exact match: 'test'
๐ค Author: User I123456
๐
Created: 12/3/2024
2. "test project" - Starts with 'test'
๐ค Author: Developer
๐
Created: 12/2/2024
๐๏ธ Starting test project deletion...
๐ฆ Processing batch 1/1
๐ Deleting "test"
๐ Reason: Exact match: 'test'
โ
Successfully deleted
๐ Final Deletion Report:
โ
Successfully deleted: 3 projects
โ Errors: 0 projects
๐ Success rate: 100.0%
deleted: trueIf you need to recover deleted projects:
# Find deleted test projects # You would need to create a recovery script that: # 1. Searches for projects with deleted=true # 2. Filters for test projects # 3. Sets deleted=false to restore them
โ
No test projects found to delete.
โ Failed to delete: Access denied
โ Deletion not confirmed. Exiting.
CONFIRM_DELETE=DELETE environment variableREQUIRE_CONFIRMATION=false to skip confirmationโ Error: Too many requests
Always start with dry run:
DRY_RUN=true npx tsx delete-test-projects-advanced.ts
Review the analysis carefully:
Use confirmation for safety:
REQUIRE_CONFIRMATION=true for manual operationsTest with exact match first:
EXACT_MATCH_ONLY=true DRY_RUN=true npx tsx delete-test-projects-advanced.ts
Backup considerations:
These deletion scripts work well with other project management scripts:
# 1. Preview what would be deleted DRY_RUN=true npx tsx delete-test-projects-advanced.ts # 2. Delete exact "test" matches only EXACT_MATCH_ONLY=true CONFIRM_DELETE=DELETE npx tsx delete-test-projects-advanced.ts # 3. Delete all test projects CONFIRM_DELETE=DELETE npx tsx delete-test-projects-advanced.ts
# For CI/CD or automated environments REQUIRE_CONFIRMATION=false CUSTOM_PATTERNS="temp,demo" npx tsx delete-test-projects-advanced.ts
# Very careful deletion - exact matches only, case sensitive EXACT_MATCH_ONLY=true CASE_SENSITIVE=true CONFIRM_DELETE=DELETE npx tsx delete-test-projects-advanced.ts