Skip to content

Commit 2400d37

Browse files
authored
Merge pull request #73 from sigmacomputing/recipe-portal-from-main
Add Recipe Portal - QuickStarts API Toolkit
2 parents 850be45 + 756c596 commit 2400d37

File tree

23 files changed

+8678
-0
lines changed

23 files changed

+8678
-0
lines changed

recipe-portal/.claude/claude.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# QuickStarts API Toolkit - VERSION 1.0 COMPLETE ✅
2+
3+
## Project Status: PRODUCTION READY
4+
The recipe portal has been fully implemented with all core functionality working correctly. Version 1.0 includes robust authentication, smart parameters, race condition fixes, and comprehensive recipe execution capabilities.
5+
6+
## ✅ VERSION 1.0 FEATURES IMPLEMENTED
7+
8+
### Authentication System
9+
- **Multi-Configuration Support**: Named configs for different environments (Production, Staging, etc.)
10+
- **Configuration-Specific Token Caching**: Isolated token storage per client configuration
11+
- **Race Condition Fixes**: AbortController-based request cancellation prevents mixed authentication data
12+
- **Seamless Config Switching**: No browser refresh required when switching between authentication configs
13+
- **Smart Parameter Isolation**: Dropdowns always show correct data for current authenticated configuration
14+
- **Session Management**: Clean session termination with "End Session" functionality
15+
16+
### Smart Parameter System
17+
- **Automatic Resource Detection**: Detects workbooks, teams, members, data models, etc.
18+
- **Dynamic Dropdown Population**: Auto-populates selection lists with authenticated user's available resources
19+
- **Dependency Management**: Dependent parameters (e.g., workbook → materialization schedules)
20+
- **Cross-Configuration Isolation**: Parameters refresh correctly when switching authentication configs
21+
- **Real-time Updates**: Parameters update immediately upon authentication changes
22+
23+
### Recipe Execution Engine
24+
- **Binary File Support**: Proper handling of PDF, CSV, and other binary downloads
25+
- **Multi-Output Methods**: Browser downloads AND console responses
26+
- **Extended Timeouts**: 5-minute timeout for long-running operations (materialization, exports)
27+
- **Progress Monitoring**: Real-time status updates during execution
28+
- **Error Handling**: Comprehensive error reporting and recovery
29+
30+
### User Interface
31+
- **Consistent Tab Styling**: Professional blue theme across all tab interfaces
32+
- **Responsive Design**: Works on desktop and mobile devices
33+
- **Real-time Feedback**: Immediate visual feedback for all user actions
34+
- **Clean Professional Appearance**: No emojis in production logging (configurable)
35+
36+
## 🎉 VERSION 1.0 PRODUCTION RELEASE READY
37+
38+
The QuickStarts API Toolkit Version 1.0 is a complete, production-ready application that provides:
39+
40+
- **Professional API exploration interface** for Sigma Computing APIs
41+
- **Robust authentication system** with multi-environment support
42+
- **Smart parameter detection** with real-time dropdown population
43+
- **Comprehensive recipe execution engine** with proper file handling
44+
- **Race condition-free user experience** with seamless config switching
45+
- **Standalone code compatibility** for direct VS Code/Node.js usage
46+
- **Clean, maintainable architecture** ready for future enhancements
47+
48+
All core functionality has been implemented, tested, and documented. The application is ready for user adoption and production deployment.

recipe-portal/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

recipe-portal/.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Dependencies
2+
node_modules/
3+
/.pnp
4+
.pnp.js
5+
6+
# Testing
7+
/coverage
8+
9+
# Next.js
10+
/.next/
11+
/out/
12+
13+
# Production
14+
/build
15+
16+
# Misc
17+
.DS_Store
18+
*.tsbuildinfo
19+
next-env.d.ts
20+
21+
# Debug
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*
25+
26+
# Local env files
27+
.env*.local
28+
29+
# IDE
30+
.vscode/
31+
.idea/
32+
33+
# OS
34+
.DS_Store
35+
Thumbs.db
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { NextResponse } from 'next/server';
2+
import fs from 'fs';
3+
import path from 'path';
4+
5+
export async function GET(request: Request) {
6+
try {
7+
const { searchParams } = new URL(request.url);
8+
const filePath = searchParams.get('path');
9+
10+
if (!filePath) {
11+
return NextResponse.json(
12+
{ error: 'File path is required' },
13+
{ status: 400 }
14+
);
15+
}
16+
17+
// Security check: ensure the file is within the sigma-api-recipes directory
18+
const recipesPath = path.join(process.cwd(), '..', 'sigma-api-recipes');
19+
const resolvedPath = path.resolve(filePath);
20+
const resolvedRecipesPath = path.resolve(recipesPath);
21+
22+
if (!resolvedPath.startsWith(resolvedRecipesPath)) {
23+
return NextResponse.json(
24+
{ error: 'Access denied: File must be within sigma-api-recipes directory' },
25+
{ status: 403 }
26+
);
27+
}
28+
29+
// Check if file exists and is a JavaScript file
30+
if (!fs.existsSync(resolvedPath)) {
31+
return NextResponse.json(
32+
{ error: 'File not found' },
33+
{ status: 404 }
34+
);
35+
}
36+
37+
if (!resolvedPath.endsWith('.js')) {
38+
return NextResponse.json(
39+
{ error: 'Only JavaScript files are allowed' },
40+
{ status: 400 }
41+
);
42+
}
43+
44+
// Read the file content
45+
const content = fs.readFileSync(resolvedPath, 'utf-8');
46+
47+
return NextResponse.json({
48+
content,
49+
filePath: resolvedPath,
50+
timestamp: new Date().toISOString()
51+
});
52+
53+
} catch (error) {
54+
console.error('Error reading file:', error);
55+
return NextResponse.json(
56+
{ error: 'Failed to read file' },
57+
{ status: 500 }
58+
);
59+
}
60+
}

recipe-portal/app/api/env/route.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { NextResponse } from 'next/server';
2+
import fs from 'fs';
3+
import path from 'path';
4+
5+
export async function GET() {
6+
try {
7+
const envFilePath = path.join(process.cwd(), '..', 'sigma-api-recipes', '.env');
8+
9+
if (!fs.existsSync(envFilePath)) {
10+
return NextResponse.json({
11+
values: {},
12+
exists: false,
13+
message: 'Environment file not found'
14+
});
15+
}
16+
17+
const envContent = fs.readFileSync(envFilePath, 'utf-8');
18+
const envValues: Record<string, string> = {};
19+
20+
// Parse the .env file
21+
const lines = envContent.split('\n');
22+
for (const line of lines) {
23+
const trimmed = line.trim();
24+
// Skip comments and empty lines
25+
if (trimmed && !trimmed.startsWith('#')) {
26+
const match = trimmed.match(/^([^=]+)=(.*)$/);
27+
if (match) {
28+
const key = match[1].trim();
29+
const value = match[2].trim();
30+
// Only include non-empty values
31+
if (value && value !== '') {
32+
envValues[key] = value;
33+
}
34+
}
35+
}
36+
}
37+
38+
return NextResponse.json({
39+
values: envValues,
40+
exists: true,
41+
timestamp: new Date().toISOString()
42+
});
43+
44+
} catch (error) {
45+
console.error('Error reading .env file:', error);
46+
return NextResponse.json(
47+
{
48+
error: 'Failed to read environment file',
49+
values: {},
50+
exists: false
51+
},
52+
{ status: 500 }
53+
);
54+
}
55+
}

0 commit comments

Comments
 (0)