paymongo-cli 1.4.6 → 1.4.7
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.
- package/CHANGELOG.md +58 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/commands/config.js +17 -16
- package/dist/commands/dev/logs.js +3 -3
- package/dist/commands/dev/status.js +2 -2
- package/dist/commands/dev/stop.js +3 -3
- package/dist/commands/dev.js +7 -7
- package/dist/commands/env.js +6 -6
- package/dist/commands/init.js +3 -3
- package/dist/commands/login.js +3 -3
- package/dist/commands/payments.js +9 -8
- package/dist/commands/team/index.js +7 -6
- package/dist/commands/trigger.js +18 -16
- package/dist/commands/webhooks.js +7 -6
- package/dist/index.js +9 -2
- package/dist/services/analytics/service.js +19 -18
- package/dist/services/api/client.js +15 -15
- package/dist/services/dev/process-manager.js +30 -32
- package/dist/services/dev/server.js +45 -39
- package/dist/utils/bulk.js +36 -4
- package/dist/utils/constants.js +11 -1
- package/dist/utils/errors.js +6 -0
- package/dist/utils/validator.js +10 -9
- package/dist/utils/webhook-store.js +18 -15
- package/package.json +1 -1
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import * as os from 'os';
|
|
4
4
|
class WebhookEventStore {
|
|
5
5
|
storePath;
|
|
6
|
+
storeDir;
|
|
6
7
|
constructor() {
|
|
7
|
-
|
|
8
|
-
this.storePath = path.join(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
this.storeDir = path.join(os.homedir(), '.paymongo');
|
|
9
|
+
this.storePath = path.join(this.storeDir, 'webhook-events.json');
|
|
10
|
+
}
|
|
11
|
+
async ensureDir() {
|
|
12
|
+
await fs.mkdir(this.storeDir, { recursive: true });
|
|
12
13
|
}
|
|
13
14
|
async storeEvent(event) {
|
|
14
15
|
try {
|
|
16
|
+
await this.ensureDir();
|
|
15
17
|
const events = await this.loadEvents();
|
|
16
18
|
events.push(event);
|
|
17
19
|
if (events.length > 1000) {
|
|
18
20
|
events.splice(0, events.length - 1000);
|
|
19
21
|
}
|
|
20
|
-
fs.
|
|
22
|
+
await fs.writeFile(this.storePath, JSON.stringify(events, null, 2));
|
|
21
23
|
}
|
|
22
24
|
catch (error) {
|
|
23
25
|
console.warn('Failed to store webhook event:', error);
|
|
@@ -25,13 +27,13 @@ class WebhookEventStore {
|
|
|
25
27
|
}
|
|
26
28
|
async loadEvents() {
|
|
27
29
|
try {
|
|
28
|
-
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
const data = fs.readFileSync(this.storePath, 'utf-8');
|
|
30
|
+
const data = await fs.readFile(this.storePath, 'utf-8');
|
|
32
31
|
return JSON.parse(data);
|
|
33
32
|
}
|
|
34
|
-
catch (
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
35
37
|
return [];
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -45,11 +47,12 @@ class WebhookEventStore {
|
|
|
45
47
|
}
|
|
46
48
|
async clearEvents() {
|
|
47
49
|
try {
|
|
48
|
-
|
|
49
|
-
fs.unlinkSync(this.storePath);
|
|
50
|
-
}
|
|
50
|
+
await fs.unlink(this.storePath);
|
|
51
51
|
}
|
|
52
52
|
catch (error) {
|
|
53
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
53
56
|
console.warn('Failed to clear webhook events:', error);
|
|
54
57
|
}
|
|
55
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paymongo-cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"description": "Developer-first CLI tool for PayMongo integration development with local webhook forwarding, payment testing, and team collaboration features. See USER_GUIDE.md for comprehensive documentation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|