@bernierllc/email 1.0.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.
Files changed (53) hide show
  1. package/.eslintrc.json +112 -0
  2. package/.flake8 +18 -0
  3. package/.github/workflows/ci.yml +300 -0
  4. package/EXTRACTION_SUMMARY.md +265 -0
  5. package/IMPLEMENTATION_STATUS.md +159 -0
  6. package/LICENSE +7 -0
  7. package/OPEN_SOURCE_SETUP.md +420 -0
  8. package/PACKAGE_USAGE.md +471 -0
  9. package/README.md +232 -0
  10. package/examples/fastapi-example/main.py +257 -0
  11. package/examples/nextjs-example/next-env.d.ts +13 -0
  12. package/examples/nextjs-example/package.json +26 -0
  13. package/examples/nextjs-example/pages/admin/templates.tsx +157 -0
  14. package/examples/nextjs-example/tsconfig.json +28 -0
  15. package/package.json +32 -0
  16. package/packages/core/package.json +70 -0
  17. package/packages/core/rollup.config.js +37 -0
  18. package/packages/core/specification.md +416 -0
  19. package/packages/core/src/adapters/supabase.ts +291 -0
  20. package/packages/core/src/core/scheduler.ts +356 -0
  21. package/packages/core/src/core/template-manager.ts +388 -0
  22. package/packages/core/src/index.ts +30 -0
  23. package/packages/core/src/providers/base.ts +104 -0
  24. package/packages/core/src/providers/sendgrid.ts +368 -0
  25. package/packages/core/src/types/provider.ts +91 -0
  26. package/packages/core/src/types/scheduled.ts +78 -0
  27. package/packages/core/src/types/template.ts +97 -0
  28. package/packages/core/tsconfig.json +23 -0
  29. package/packages/python/README.md +106 -0
  30. package/packages/python/email_template_manager/__init__.py +66 -0
  31. package/packages/python/email_template_manager/config.py +98 -0
  32. package/packages/python/email_template_manager/core/magic_links.py +245 -0
  33. package/packages/python/email_template_manager/core/manager.py +344 -0
  34. package/packages/python/email_template_manager/core/scheduler.py +473 -0
  35. package/packages/python/email_template_manager/exceptions.py +67 -0
  36. package/packages/python/email_template_manager/models/magic_link.py +59 -0
  37. package/packages/python/email_template_manager/models/scheduled.py +78 -0
  38. package/packages/python/email_template_manager/models/template.py +90 -0
  39. package/packages/python/email_template_manager/providers/aws_ses.py +44 -0
  40. package/packages/python/email_template_manager/providers/base.py +94 -0
  41. package/packages/python/email_template_manager/providers/sendgrid.py +325 -0
  42. package/packages/python/email_template_manager/providers/smtp.py +44 -0
  43. package/packages/python/pyproject.toml +133 -0
  44. package/packages/python/setup.py +93 -0
  45. package/packages/python/specification.md +930 -0
  46. package/packages/react/README.md +13 -0
  47. package/packages/react/package.json +105 -0
  48. package/packages/react/rollup.config.js +37 -0
  49. package/packages/react/specification.md +569 -0
  50. package/packages/react/src/index.ts +20 -0
  51. package/packages/react/tsconfig.json +24 -0
  52. package/src/index.js +1 -0
  53. package/test_package.py +125 -0
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright (c) 2025 Bernier LLC
3
+
4
+ This file is licensed to the client under a limited-use license.
5
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
6
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
+ */
8
+
9
+ /**
10
+ * Email Template Manager - React Components
11
+ * React components for email template management
12
+ */
13
+
14
+ // Re-export core types and classes
15
+ export * from '@email-template-manager/core';
16
+
17
+ // TODO: Add React components when implemented
18
+ // export { EmailTemplateProvider } from './components/EmailTemplateProvider';
19
+ // export { EmailTemplateEditor } from './components/EmailTemplateEditor';
20
+ // export { useEmailTemplates } from './hooks/useEmailTemplates';
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "sourceMap": true,
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "strict": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "moduleResolution": "node",
16
+ "allowSyntheticDefaultImports": true,
17
+ "resolveJsonModule": true,
18
+ "isolatedModules": true,
19
+ "noEmit": false,
20
+ "jsx": "react-jsx"
21
+ },
22
+ "include": ["src/**/*"],
23
+ "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
24
+ }
package/src/index.js ADDED
@@ -0,0 +1 @@
1
+ // Entry point for @bernierllc/email package
@@ -0,0 +1,125 @@
1
+ """
2
+ Copyright (c) 2025 Bernier LLC
3
+
4
+ This file is licensed to the client under a limited-use license.
5
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
6
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
+ """
8
+
9
+ #!/usr/bin/env python3
10
+ """
11
+ Test script to verify the email template manager package structure
12
+ """
13
+
14
+ import sys
15
+ import os
16
+
17
+ # Add the packages/python directory to the path for testing
18
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'packages', 'python'))
19
+
20
+ def test_imports():
21
+ """Test that core imports work"""
22
+ try:
23
+ # Test core imports
24
+ from email_template_manager.exceptions import EmailTemplateManagerError
25
+ from email_template_manager.models.template import EmailTemplate, TemplateVariable
26
+ from email_template_manager.models.scheduled import ScheduledEmail
27
+ from email_template_manager.providers.base import EmailProvider, EmailMessage
28
+ from email_template_manager.config import EmailManagerConfig
29
+
30
+ print("✅ Core imports successful!")
31
+
32
+ # Test creating a template
33
+ template = EmailTemplate(
34
+ name="Test Template",
35
+ subject="Hello {{name}}!",
36
+ html_body="<h1>Hello {{name}}!</h1>",
37
+ text_body="Hello {{name}}!",
38
+ variables=[
39
+ TemplateVariable(name="name", type="text", required=True)
40
+ ],
41
+ tags=["test"],
42
+ is_active=True,
43
+ version=1
44
+ )
45
+
46
+ print(f"✅ Template created: {template.name}")
47
+
48
+ # Test creating a scheduled email
49
+ scheduled_email = ScheduledEmail(
50
+ template_id="test-template",
51
+ recipient_email="test@example.com",
52
+ variables={"name": "Test User"},
53
+ trigger_type="immediate",
54
+ status="pending",
55
+ retry_count=0,
56
+ max_retries=3,
57
+ metadata={}
58
+ )
59
+
60
+ print(f"✅ Scheduled email created for: {scheduled_email.recipient_email}")
61
+
62
+ return True
63
+
64
+ except ImportError as e:
65
+ print(f"❌ Import error: {e}")
66
+ return False
67
+ except Exception as e:
68
+ print(f"❌ Error: {e}")
69
+ return False
70
+
71
+ def test_sendgrid_provider():
72
+ """Test SendGrid provider (without actual API call)"""
73
+ try:
74
+ from email_template_manager.providers.sendgrid import SendGridProvider
75
+
76
+ # Test provider creation (will fail without API key, but that's expected)
77
+ try:
78
+ provider = SendGridProvider({
79
+ 'api_key': 'test-key',
80
+ 'from_email': 'test@example.com'
81
+ })
82
+ print("✅ SendGrid provider created successfully")
83
+ return True
84
+ except Exception as e:
85
+ if "SendGrid API key is required" in str(e):
86
+ print("✅ SendGrid provider validation working (expected error)")
87
+ return True
88
+ else:
89
+ print(f"❌ Unexpected SendGrid error: {e}")
90
+ return False
91
+
92
+ except ImportError as e:
93
+ print(f"❌ SendGrid import error: {e}")
94
+ return False
95
+
96
+ def main():
97
+ """Run all tests"""
98
+ print("🚀 Testing Email Template Manager Package Structure\n")
99
+
100
+ tests = [
101
+ ("Core Imports", test_imports),
102
+ ("SendGrid Provider", test_sendgrid_provider),
103
+ ]
104
+
105
+ passed = 0
106
+ total = len(tests)
107
+
108
+ for test_name, test_func in tests:
109
+ print(f"\n📋 Testing {test_name}...")
110
+ if test_func():
111
+ passed += 1
112
+ else:
113
+ print(f"❌ {test_name} failed")
114
+
115
+ print(f"\n🎯 Results: {passed}/{total} tests passed")
116
+
117
+ if passed == total:
118
+ print("🎉 All tests passed! Package structure is working correctly.")
119
+ return 0
120
+ else:
121
+ print("⚠️ Some tests failed. Check the implementation.")
122
+ return 1
123
+
124
+ if __name__ == "__main__":
125
+ sys.exit(main())