paymongo-cli 1.4.12 → 1.4.13
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 +21 -0
- package/README.md +3 -3
- package/biome.json +72 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/commands/config/actions.js +13 -5
- package/dist/commands/config/analytics.js +75 -0
- package/dist/commands/config/helpers.js +14 -25
- package/dist/commands/config/rate-limit.js +3 -3
- package/dist/commands/config.js +7 -1
- package/dist/commands/dev/logs.js +13 -4
- package/dist/commands/dev/status.js +1 -1
- package/dist/commands/dev/stop.js +2 -2
- package/dist/commands/dev.js +10 -258
- package/dist/commands/doctor.js +6 -7
- package/dist/commands/env.js +10 -19
- package/dist/commands/generate/templates/index.js +3 -3
- package/dist/commands/generate.js +6 -6
- package/dist/commands/init.js +22 -36
- package/dist/commands/login.js +18 -29
- package/dist/commands/payments/actions.js +15 -15
- package/dist/commands/payments/helpers.js +6 -24
- package/dist/commands/payments.js +1 -1
- package/dist/commands/shared/auth.js +23 -0
- package/dist/commands/shared/runtime.js +35 -0
- package/dist/commands/team/index.js +3 -3
- package/dist/commands/trigger/actions.js +2 -2
- package/dist/commands/trigger/helpers.js +13 -9
- package/dist/commands/trigger.js +2 -2
- package/dist/commands/webhooks/actions.js +11 -11
- package/dist/commands/webhooks/helpers.js +5 -23
- package/dist/commands/webhooks.js +1 -1
- package/dist/index.js +32 -14
- package/dist/services/analytics/service.js +3 -3
- package/dist/services/api/client.js +8 -4
- package/dist/services/config/manager.js +3 -3
- package/dist/services/dev/process-manager.js +4 -4
- package/dist/services/dev/server.js +4 -6
- package/dist/services/dev/session.js +353 -0
- package/dist/services/team/service.js +1 -1
- package/dist/utils/bulk.js +11 -11
- package/dist/utils/cache.js +5 -5
- package/dist/utils/constants.js +1 -1
- package/dist/utils/webhook-store.js +3 -3
- package/package.json +11 -25
- package/vitest.config.ts +18 -0
- package/eslint.config.ts +0 -70
package/dist/utils/bulk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
3
|
import { PayMongoError } from './errors.js';
|
|
4
4
|
export class BulkOperations {
|
|
5
5
|
static EXPORT_VERSION = '1.0';
|
|
@@ -8,7 +8,7 @@ export class BulkOperations {
|
|
|
8
8
|
metadata: {
|
|
9
9
|
exported_at: new Date().toISOString(),
|
|
10
10
|
exported_by: 'paymongo-cli',
|
|
11
|
-
version:
|
|
11
|
+
version: BulkOperations.EXPORT_VERSION,
|
|
12
12
|
environment,
|
|
13
13
|
},
|
|
14
14
|
data: webhooks,
|
|
@@ -22,7 +22,7 @@ export class BulkOperations {
|
|
|
22
22
|
metadata: {
|
|
23
23
|
exported_at: new Date().toISOString(),
|
|
24
24
|
exported_by: 'paymongo-cli',
|
|
25
|
-
version:
|
|
25
|
+
version: BulkOperations.EXPORT_VERSION,
|
|
26
26
|
environment,
|
|
27
27
|
},
|
|
28
28
|
data: payments,
|
|
@@ -50,7 +50,7 @@ export class BulkOperations {
|
|
|
50
50
|
catch {
|
|
51
51
|
throw new PayMongoError(`Invalid JSON in ${filename}`, 'INVALID_JSON', 400);
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
BulkOperations.validateImportData(data, 'webhooks');
|
|
54
54
|
return {
|
|
55
55
|
webhooks: data.data,
|
|
56
56
|
metadata: data.metadata,
|
|
@@ -75,7 +75,7 @@ export class BulkOperations {
|
|
|
75
75
|
catch {
|
|
76
76
|
throw new PayMongoError(`Invalid JSON in ${filename}`, 'INVALID_JSON', 400);
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
BulkOperations.validateImportData(data, 'payments');
|
|
79
79
|
return {
|
|
80
80
|
payments: data.data,
|
|
81
81
|
metadata: data.metadata,
|
|
@@ -93,17 +93,17 @@ export class BulkOperations {
|
|
|
93
93
|
if (typeof metadata.version !== 'string') {
|
|
94
94
|
throw new PayMongoError('Invalid metadata - version must be a string', 'INVALID_FILE_FORMAT', 400);
|
|
95
95
|
}
|
|
96
|
-
if (metadata.version !==
|
|
97
|
-
throw new PayMongoError(`Unsupported export version: ${metadata.version}. Current version: ${
|
|
96
|
+
if (metadata.version !== BulkOperations.EXPORT_VERSION) {
|
|
97
|
+
throw new PayMongoError(`Unsupported export version: ${metadata.version}. Current version: ${BulkOperations.EXPORT_VERSION}`, 'UNSUPPORTED_VERSION', 400);
|
|
98
98
|
}
|
|
99
99
|
if (obj.data.length === 0) {
|
|
100
100
|
throw new PayMongoError('No data found in export file', 'EMPTY_FILE', 400);
|
|
101
101
|
}
|
|
102
102
|
if (type === 'webhooks') {
|
|
103
|
-
|
|
103
|
+
BulkOperations.validateWebhookData(obj.data);
|
|
104
104
|
}
|
|
105
105
|
else if (type === 'payments') {
|
|
106
|
-
|
|
106
|
+
BulkOperations.validatePaymentData(obj.data);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
static validateWebhookData(webhooks) {
|
|
@@ -150,6 +150,6 @@ export class BulkOperations {
|
|
|
150
150
|
if (path.extname(filename).toLowerCase() === '.json') {
|
|
151
151
|
return filename;
|
|
152
152
|
}
|
|
153
|
-
return filename
|
|
153
|
+
return `${filename}.json`;
|
|
154
154
|
}
|
|
155
155
|
}
|
package/dist/utils/cache.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import * as crypto from 'node:crypto';
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
5
|
export class Cache {
|
|
6
6
|
cacheDir;
|
|
7
7
|
options;
|
|
@@ -26,7 +26,7 @@ export class Cache {
|
|
|
26
26
|
return crypto.createHash('md5').update(key).digest('hex');
|
|
27
27
|
}
|
|
28
28
|
getCachePath(key) {
|
|
29
|
-
return path.join(this.cacheDir, this.getCacheKey(key)
|
|
29
|
+
return path.join(this.cacheDir, `${this.getCacheKey(key)}.json`);
|
|
30
30
|
}
|
|
31
31
|
async isExpired(filePath) {
|
|
32
32
|
try {
|
package/dist/utils/constants.js
CHANGED
|
@@ -12,7 +12,7 @@ export const ENVIRONMENTS = ['test', 'live'];
|
|
|
12
12
|
export const CONFIG_FILE_NAME = '.paymongo';
|
|
13
13
|
export const ENV_FILE_NAME = '.env';
|
|
14
14
|
export const CLI_NAME = 'paymongo';
|
|
15
|
-
import { createRequire } from 'module';
|
|
15
|
+
import { createRequire } from 'node:module';
|
|
16
16
|
const _require = createRequire(import.meta.url);
|
|
17
17
|
const _pkg = _require('../../package.json');
|
|
18
18
|
export const CLI_VERSION = _pkg.version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paymongo-cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
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",
|
|
@@ -12,23 +12,17 @@
|
|
|
12
12
|
"build:incremental": "tsc --incremental",
|
|
13
13
|
"dev": "tsc --watch",
|
|
14
14
|
"start": "node dist/index.js",
|
|
15
|
-
"test": "
|
|
16
|
-
"test:watch": "
|
|
17
|
-
"lint": "
|
|
18
|
-
"lint:fix": "
|
|
19
|
-
"lint:src": "
|
|
20
|
-
"lint:tests": "
|
|
21
|
-
"format": "
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"test:watch": "vitest",
|
|
17
|
+
"lint": "biome check .",
|
|
18
|
+
"lint:fix": "biome check --write .",
|
|
19
|
+
"lint:src": "biome check src",
|
|
20
|
+
"lint:tests": "biome check tests",
|
|
21
|
+
"format": "biome format --write .",
|
|
22
22
|
"benchmark": "npx tsx scripts/benchmark.ts",
|
|
23
23
|
"prepare": "npm run build"
|
|
24
24
|
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"paymongo",
|
|
27
|
-
"cli",
|
|
28
|
-
"payments",
|
|
29
|
-
"webhooks",
|
|
30
|
-
"development"
|
|
31
|
-
],
|
|
25
|
+
"keywords": ["paymongo", "cli", "payments", "webhooks", "development"],
|
|
32
26
|
"author": "Leodyver Semilla",
|
|
33
27
|
"license": "MIT",
|
|
34
28
|
"repository": {
|
|
@@ -54,20 +48,12 @@
|
|
|
54
48
|
"zod": "^4.3.6"
|
|
55
49
|
},
|
|
56
50
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@types/jest": "^30.0.0",
|
|
51
|
+
"@biomejs/biome": "2.4.10",
|
|
59
52
|
"@types/node": "^25.0.10",
|
|
60
|
-
"cross-env": "^10.1.0",
|
|
61
|
-
"eslint": "^9.0.0",
|
|
62
|
-
"globals": "^17.1.0",
|
|
63
|
-
"jest": "^30.2.0",
|
|
64
|
-
"jiti": "^2.6.1",
|
|
65
|
-
"prettier": "^3.1.1",
|
|
66
|
-
"ts-jest": "^29.4.6",
|
|
67
53
|
"ts-node": "^10.9.2",
|
|
68
54
|
"tsx": "^4.7.0",
|
|
69
55
|
"typescript": "^5.3.3",
|
|
70
|
-
"
|
|
56
|
+
"vitest": "^4.1.2"
|
|
71
57
|
},
|
|
72
58
|
"publishConfig": {
|
|
73
59
|
"access": "public"
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
environment: 'node',
|
|
6
|
+
globals: true,
|
|
7
|
+
include: ['tests/**/*.test.ts'],
|
|
8
|
+
setupFiles: ['tests/setup-vitest.ts'],
|
|
9
|
+
coverage: {
|
|
10
|
+
provider: 'v8',
|
|
11
|
+
reporter: ['text', 'lcov', 'html'],
|
|
12
|
+
reportsDirectory: 'coverage',
|
|
13
|
+
include: ['src/**/*.ts'],
|
|
14
|
+
exclude: ['src/**/*.d.ts'],
|
|
15
|
+
},
|
|
16
|
+
silent: true,
|
|
17
|
+
},
|
|
18
|
+
});
|
package/eslint.config.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import eslint from '@eslint/js';
|
|
2
|
-
import tseslint from 'typescript-eslint';
|
|
3
|
-
import globals from 'globals';
|
|
4
|
-
|
|
5
|
-
export default tseslint.config(
|
|
6
|
-
eslint.configs.recommended,
|
|
7
|
-
...tseslint.configs.recommended,
|
|
8
|
-
{
|
|
9
|
-
files: ['src/**/*.ts'],
|
|
10
|
-
languageOptions: {
|
|
11
|
-
ecmaVersion: 2022,
|
|
12
|
-
sourceType: 'module',
|
|
13
|
-
globals: {
|
|
14
|
-
...globals.node,
|
|
15
|
-
...globals.es2022,
|
|
16
|
-
},
|
|
17
|
-
parserOptions: {
|
|
18
|
-
project: './tsconfig.json',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
'no-unused-vars': 'off',
|
|
23
|
-
'@typescript-eslint/no-unused-vars': ['warn', {
|
|
24
|
-
argsIgnorePattern: '^_',
|
|
25
|
-
varsIgnorePattern: '^_',
|
|
26
|
-
caughtErrorsIgnorePattern: '^_'
|
|
27
|
-
}],
|
|
28
|
-
'no-console': 'off',
|
|
29
|
-
'no-redeclare': 'off',
|
|
30
|
-
'@typescript-eslint/no-redeclare': 'error',
|
|
31
|
-
'no-shadow': 'off',
|
|
32
|
-
'@typescript-eslint/no-shadow': 'error',
|
|
33
|
-
'no-undef': 'off',
|
|
34
|
-
'no-empty': 'error',
|
|
35
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
36
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
37
|
-
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
38
|
-
eqeqeq: ['error', 'always'],
|
|
39
|
-
curly: ['error', 'all'],
|
|
40
|
-
'no-var': 'error',
|
|
41
|
-
'prefer-const': 'error',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
files: ['tests/**/*.ts'],
|
|
46
|
-
languageOptions: {
|
|
47
|
-
ecmaVersion: 2022,
|
|
48
|
-
sourceType: 'module',
|
|
49
|
-
globals: {
|
|
50
|
-
...globals.node,
|
|
51
|
-
...globals.es2022,
|
|
52
|
-
...globals.jest,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
rules: {
|
|
56
|
-
'no-unused-vars': 'off',
|
|
57
|
-
'@typescript-eslint/no-unused-vars': ['warn', {
|
|
58
|
-
argsIgnorePattern: '^_',
|
|
59
|
-
varsIgnorePattern: '^_',
|
|
60
|
-
caughtErrorsIgnorePattern: '^_'
|
|
61
|
-
}],
|
|
62
|
-
'@typescript-eslint/no-explicit-any': 'off', // Allow any in tests for mocking
|
|
63
|
-
'no-console': 'off',
|
|
64
|
-
'no-undef': 'off',
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
ignores: ['dist/', 'node_modules/', '*.js', '*.cjs', 'coverage/'],
|
|
69
|
-
}
|
|
70
|
-
);
|