paymongo-cli 1.0.0 → 1.2.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 (92) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/bin/paymongo.js +1 -1
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/commands/config.d.ts.map +1 -1
  5. package/dist/commands/config.js +103 -128
  6. package/dist/commands/config.js.map +1 -1
  7. package/dist/commands/dev.d.ts.map +1 -1
  8. package/dist/commands/dev.js +319 -110
  9. package/dist/commands/dev.js.map +1 -1
  10. package/dist/commands/gui.js +26 -31
  11. package/dist/commands/gui.js.map +1 -1
  12. package/dist/commands/init.d.ts.map +1 -1
  13. package/dist/commands/init.js +109 -159
  14. package/dist/commands/init.js.map +1 -1
  15. package/dist/commands/login.d.ts.map +1 -1
  16. package/dist/commands/login.js +81 -121
  17. package/dist/commands/login.js.map +1 -1
  18. package/dist/commands/payments.d.ts.map +1 -1
  19. package/dist/commands/payments.js +63 -65
  20. package/dist/commands/payments.js.map +1 -1
  21. package/dist/commands/team/index.js +31 -36
  22. package/dist/commands/team/index.js.map +1 -1
  23. package/dist/commands/trigger.d.ts.map +1 -1
  24. package/dist/commands/trigger.js +144 -93
  25. package/dist/commands/trigger.js.map +1 -1
  26. package/dist/commands/webhooks.d.ts.map +1 -1
  27. package/dist/commands/webhooks.js +144 -150
  28. package/dist/commands/webhooks.js.map +1 -1
  29. package/dist/index.js +37 -44
  30. package/dist/index.js.map +1 -1
  31. package/dist/services/analytics/service.d.ts +7 -1
  32. package/dist/services/analytics/service.d.ts.map +1 -1
  33. package/dist/services/analytics/service.js +15 -20
  34. package/dist/services/analytics/service.js.map +1 -1
  35. package/dist/services/api/client.d.ts +9 -8
  36. package/dist/services/api/client.d.ts.map +1 -1
  37. package/dist/services/api/client.js +34 -30
  38. package/dist/services/api/client.js.map +1 -1
  39. package/dist/services/config/manager.d.ts +1 -1
  40. package/dist/services/config/manager.d.ts.map +1 -1
  41. package/dist/services/config/manager.js +30 -72
  42. package/dist/services/config/manager.js.map +1 -1
  43. package/dist/services/dev/process-manager.d.ts +50 -0
  44. package/dist/services/dev/process-manager.d.ts.map +1 -0
  45. package/dist/services/dev/process-manager.js +135 -0
  46. package/dist/services/dev/process-manager.js.map +1 -0
  47. package/dist/services/github/auth.d.ts +2 -2
  48. package/dist/services/github/auth.d.ts.map +1 -1
  49. package/dist/services/github/auth.js +15 -55
  50. package/dist/services/github/auth.js.map +1 -1
  51. package/dist/services/github/client.d.ts +1 -1
  52. package/dist/services/github/client.d.ts.map +1 -1
  53. package/dist/services/github/client.js +12 -17
  54. package/dist/services/github/client.js.map +1 -1
  55. package/dist/services/github/sync.d.ts +2 -2
  56. package/dist/services/github/sync.d.ts.map +1 -1
  57. package/dist/services/github/sync.js +14 -11
  58. package/dist/services/github/sync.js.map +1 -1
  59. package/dist/services/web/server.d.ts +5 -4
  60. package/dist/services/web/server.d.ts.map +1 -1
  61. package/dist/services/web/server.js +74 -27
  62. package/dist/services/web/server.js.map +1 -1
  63. package/dist/types/paymongo.d.ts +53 -0
  64. package/dist/types/paymongo.d.ts.map +1 -1
  65. package/dist/types/paymongo.js +1 -2
  66. package/dist/types/schemas.d.ts +80 -0
  67. package/dist/types/schemas.d.ts.map +1 -0
  68. package/dist/types/schemas.js +63 -0
  69. package/dist/types/schemas.js.map +1 -0
  70. package/dist/utils/cache.d.ts +2 -0
  71. package/dist/utils/cache.d.ts.map +1 -1
  72. package/dist/utils/cache.js +65 -77
  73. package/dist/utils/cache.js.map +1 -1
  74. package/dist/utils/constants.js +16 -19
  75. package/dist/utils/constants.js.map +1 -1
  76. package/dist/utils/errors.d.ts +1 -0
  77. package/dist/utils/errors.d.ts.map +1 -1
  78. package/dist/utils/errors.js +19 -20
  79. package/dist/utils/errors.js.map +1 -1
  80. package/dist/utils/logger.d.ts +5 -4
  81. package/dist/utils/logger.d.ts.map +1 -1
  82. package/dist/utils/logger.js +12 -16
  83. package/dist/utils/logger.js.map +1 -1
  84. package/dist/utils/spinner.js +4 -8
  85. package/dist/utils/spinner.js.map +1 -1
  86. package/dist/utils/validator.d.ts +1 -1
  87. package/dist/utils/validator.d.ts.map +1 -1
  88. package/dist/utils/validator.js +7 -14
  89. package/dist/utils/validator.js.map +1 -1
  90. package/eslint.config.ts +70 -0
  91. package/jest.config.ts +30 -0
  92. package/package.json +76 -70
package/CHANGELOG.md ADDED
@@ -0,0 +1,185 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.2.0] - 2026-01-24
11
+
12
+ ### Added
13
+
14
+ - **Dev Server Background Mode** - Run dev server in detached mode with `paymongo dev --detach`:
15
+ - `paymongo dev status` - Check if dev server is running in background
16
+ - `paymongo dev stop` - Stop the background dev server
17
+ - `paymongo dev logs` - View dev server logs with `-f` follow option
18
+ - Process state management via DevProcessManager service
19
+ - **Project-Specific Webhook Paths** - Webhooks now use project slug in URL (`/webhook/{project-slug}`)
20
+ - **Automatic Webhook Cleanup** - Stale webhooks from previous sessions are cleaned up on dev start
21
+ - **Registered Webhook Tracking** - Track webhooks created by the CLI for proper cleanup
22
+
23
+ ### Improved
24
+
25
+ - **Webhook Trigger Error Handling** - Enhanced error messages for webhook delivery failures:
26
+ - Specific handling for HTTP 404, 4xx, and 5xx errors
27
+ - Connection refused (ECONNREFUSED) guidance
28
+ - Host not found (ENOTFOUND) troubleshooting
29
+ - Timeout error handling with actionable suggestions
30
+ - **Dev Server Output** - Clearer display of external and local webhook URLs with forwarding info
31
+ - **Webhooks List** - Added helpful note for ngrok tunnel URLs
32
+
33
+ ### Fixed
34
+
35
+ - **ES Module Compatibility** - Added `__dirname` compatibility for ES modules in web server
36
+ - **ESLint Warnings** - Resolved all 19 ESLint warnings
37
+
38
+ ## [1.1.0] - 2026-01-24
39
+
40
+ ### Added
41
+
42
+ - **Zod Schema Validation** - Runtime configuration validation with comprehensive error messages
43
+ - **Rate Limiting** - Express rate limiting for GUI API endpoints (100 req/min general, 20 req/min config writes)
44
+ - **New Unit Tests** - Added 11 new test files with comprehensive coverage for all services
45
+
46
+ ### Changed
47
+
48
+ - **Async Cache Operations** - Converted all sync file operations to async for better performance
49
+ - **Updated Dependencies** - Major version updates for all packages:
50
+ - commander: 11.1.0 → 14.0.2
51
+ - cosmiconfig: 8.3.6 → 9.0.0
52
+ - ora: 8.2.0 → 9.1.0
53
+ - jest: 29.7.0 → 30.2.0
54
+ - @types/node: 20.10.0 → 25.0.10
55
+ - globals: 15.0.0 → 17.1.0
56
+
57
+ ### Fixed
58
+
59
+ - **Type Safety** - Eliminated all `any` types throughout codebase (was 13+, now 0)
60
+ - **Error Handling** - Standardized error handling with custom error classes (ApiKeyError, PayMongoError, NetworkError)
61
+ - **CORS Security** - Restricted CORS to localhost origins only
62
+ - **Duplicate Handler** - Removed duplicate `unhandledRejection` handler in index.ts
63
+ - **Deprecated Imports** - Removed deprecated ZodIssue import, using native Zod 4.x types
64
+
65
+ ### Security
66
+
67
+ - Added rate limiting to prevent API abuse
68
+ - Restricted CORS to localhost origins for GUI server
69
+ - Improved webhook signature verification
70
+
71
+ ## [1.0.0] - 2026-01-24
72
+
73
+ ### Added
74
+
75
+ - **CLI Commands**
76
+ - `paymongo init` - Initialize PayMongo configuration in your project with interactive setup
77
+ - `paymongo login` - Authenticate with PayMongo using API keys with secure credential storage
78
+ - `paymongo dev` - Start local development server with webhook forwarding via ngrok tunnel
79
+ - `paymongo gui` - Launch web-based dashboard for visual payment management
80
+ - `paymongo config` - Manage CLI configuration (get, set, list, reset, export, import)
81
+ - `paymongo payments` - Create and manage payments (create, list, retrieve, refund)
82
+ - `paymongo webhooks` - Manage webhooks (create, list, delete, update, test)
83
+ - `paymongo trigger` - Trigger test webhook events for local development
84
+ - `paymongo team` - Team collaboration features (invite, list, remove members)
85
+
86
+ - **Core Features**
87
+ - Secure API key management with local encrypted storage
88
+ - Local webhook forwarding using ngrok integration
89
+ - Real-time webhook event monitoring and logging
90
+ - Support for both test and live environments
91
+ - Configuration file support (`.paymongo.json`, `paymongo.config.js`)
92
+
93
+ - **Developer Experience**
94
+ - Interactive prompts with inquirer for guided setup
95
+ - Colorful terminal output with chalk
96
+ - Loading spinners for async operations
97
+ - Comprehensive error messages with troubleshooting hints
98
+ - Input validation for API keys, amounts, and currencies
99
+
100
+ - **Web Dashboard (GUI)**
101
+ - Visual interface for payment operations
102
+ - Real-time webhook event viewer
103
+ - Configuration management panel
104
+ - Analytics and metrics display
105
+
106
+ - **GitHub Integration**
107
+ - GitHub authentication support
108
+ - Configuration sync across team members
109
+ - Secure credential sharing for teams
110
+
111
+ - **Documentation**
112
+ - Comprehensive README with quick start guide
113
+ - Detailed USER_GUIDE.md with examples
114
+ - API_REFERENCE.md for programmatic usage
115
+ - INSTALLATION.md with platform-specific instructions
116
+ - TROUBLESHOOTING.md for common issues
117
+ - CONTRIBUTING.md for contributors
118
+
119
+ ### Security
120
+
121
+ - Secure storage of API credentials in user home directory
122
+ - Support for environment variables for CI/CD pipelines
123
+ - No sensitive data logged to console or files
124
+
125
+ ---
126
+
127
+ ## Version History
128
+
129
+ | Version | Release Date | Highlights |
130
+ |---------|--------------|------------|
131
+ | [1.2.0] | 2026-01-24 | Dev server background mode, improved error handling, webhook cleanup |
132
+ | [1.1.0] | 2026-01-24 | Type safety, Zod validation, rate limiting, dependency updates |
133
+ | [1.0.0] | 2026-01-24 | Initial public release |
134
+
135
+ ---
136
+
137
+ ## Upgrade Guide
138
+
139
+ ### Upgrading to 1.2.0
140
+
141
+ ```bash
142
+ npm install -g paymongo-cli@latest
143
+ ```
144
+
145
+ **Breaking Changes:** None. This is a backward-compatible release.
146
+
147
+ **New Features:**
148
+ - Run dev server in background with `--detach` flag
149
+ - New subcommands: `dev status`, `dev stop`, `dev logs`
150
+ - Automatic cleanup of stale webhooks
151
+ - Improved error messages for webhook triggers
152
+
153
+ ### Upgrading to 1.1.0
154
+
155
+ ```bash
156
+ npm install -g paymongo-cli@latest
157
+ ```
158
+
159
+ **Breaking Changes:** None. This is a backward-compatible release.
160
+
161
+ **New Features:**
162
+ - Runtime config validation with helpful error messages
163
+ - Rate limiting on GUI API endpoints
164
+
165
+ ### Upgrading to 1.0.0
166
+
167
+ This is the initial release. To install:
168
+
169
+ ```bash
170
+ npm install -g paymongo-cli
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Links
176
+
177
+ - [npm Package](https://www.npmjs.com/package/paymongo-cli)
178
+ - [GitHub Repository](https://github.com/leodyversemilla07/paymongo-cli)
179
+ - [Issue Tracker](https://github.com/leodyversemilla07/paymongo-cli/issues)
180
+ - [PayMongo API Documentation](https://developers.paymongo.com/)
181
+
182
+ [Unreleased]: https://github.com/leodyversemilla07/paymongo-cli/compare/v1.2.0...HEAD
183
+ [1.2.0]: https://github.com/leodyversemilla07/paymongo-cli/compare/v1.1.0...v1.2.0
184
+ [1.1.0]: https://github.com/leodyversemilla07/paymongo-cli/compare/v1.0.0...v1.1.0
185
+ [1.0.0]: https://github.com/leodyversemilla07/paymongo-cli/releases/tag/v1.0.0
package/bin/paymongo.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('../dist/index.js');
3
+ import '../dist/index.js';