polyv-live-cli 1.0.2
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/LICENSE +21 -0
- package/README.md +417 -0
- package/dist/commands/channel.commands.d.ts +9 -0
- package/dist/commands/channel.commands.d.ts.map +1 -0
- package/dist/commands/channel.commands.js +439 -0
- package/dist/commands/channel.commands.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +8 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/stream.commands.d.ts +3 -0
- package/dist/commands/stream.commands.d.ts.map +1 -0
- package/dist/commands/stream.commands.js +272 -0
- package/dist/commands/stream.commands.js.map +1 -0
- package/dist/config/auth.d.ts +11 -0
- package/dist/config/auth.d.ts.map +1 -0
- package/dist/config/auth.js +124 -0
- package/dist/config/auth.js.map +1 -0
- package/dist/config/loader.d.ts +22 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +127 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/manager.d.ts +20 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +258 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/validator.d.ts +43 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +222 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/handlers/base.handler.d.ts +15 -0
- package/dist/handlers/base.handler.d.ts.map +1 -0
- package/dist/handlers/base.handler.js +122 -0
- package/dist/handlers/base.handler.js.map +1 -0
- package/dist/handlers/channel.handler.d.ts +31 -0
- package/dist/handlers/channel.handler.d.ts.map +1 -0
- package/dist/handlers/channel.handler.js +690 -0
- package/dist/handlers/channel.handler.js.map +1 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +10 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/stream.handler.d.ts +25 -0
- package/dist/handlers/stream.handler.d.ts.map +1 -0
- package/dist/handlers/stream.handler.js +241 -0
- package/dist/handlers/stream.handler.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +342 -0
- package/dist/index.js.map +1 -0
- package/dist/services/channel.service.d.ts +25 -0
- package/dist/services/channel.service.d.ts.map +1 -0
- package/dist/services/channel.service.js +672 -0
- package/dist/services/channel.service.js.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +8 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/stream.service.d.ts +29 -0
- package/dist/services/stream.service.d.ts.map +1 -0
- package/dist/services/stream.service.js +489 -0
- package/dist/services/stream.service.js.map +1 -0
- package/dist/types/auth.d.ts +31 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +14 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/channel.d.ts +262 -0
- package/dist/types/channel.d.ts.map +1 -0
- package/dist/types/channel.js +3 -0
- package/dist/types/channel.js.map +1 -0
- package/dist/types/config.d.ts +82 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +56 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +22 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/signature.d.ts +22 -0
- package/dist/types/signature.d.ts.map +1 -0
- package/dist/types/signature.js +3 -0
- package/dist/types/signature.js.map +1 -0
- package/dist/types/stream.d.ts +104 -0
- package/dist/types/stream.d.ts.map +1 -0
- package/dist/types/stream.js +3 -0
- package/dist/types/stream.js.map +1 -0
- package/dist/utils/confirmation.d.ts +12 -0
- package/dist/utils/confirmation.d.ts.map +1 -0
- package/dist/utils/confirmation.js +164 -0
- package/dist/utils/confirmation.js.map +1 -0
- package/dist/utils/errors.d.ts +40 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +113 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/formatter.d.ts +8 -0
- package/dist/utils/formatter.d.ts.map +1 -0
- package/dist/utils/formatter.js +93 -0
- package/dist/utils/formatter.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +20 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/signature.d.ts +9 -0
- package/dist/utils/signature.d.ts.map +1 -0
- package/dist/utils/signature.js +77 -0
- package/dist/utils/signature.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/types/stream.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConfirmationResponse } from '../types/channel';
|
|
2
|
+
export declare function confirmDeletion(message: string, expectedInput?: string, timeoutMs?: number): Promise<boolean>;
|
|
3
|
+
export declare function promptConfirmation(message: string, options?: {
|
|
4
|
+
acceptedInputs?: string[];
|
|
5
|
+
rejectedInputs?: string[];
|
|
6
|
+
timeout?: number;
|
|
7
|
+
caseSensitive?: boolean;
|
|
8
|
+
}): Promise<ConfirmationResponse>;
|
|
9
|
+
export declare function isInteractiveEnvironment(): boolean;
|
|
10
|
+
export declare function validateConfirmationEnvironment(requireForce?: boolean, forceFlag?: boolean): void;
|
|
11
|
+
export declare function confirmDangerousOperation(operationName: string, resourceId: string, additionalWarnings?: string[]): Promise<boolean>;
|
|
12
|
+
//# sourceMappingURL=confirmation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../src/utils/confirmation.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAuBxD,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,MAAc,EAC7B,SAAS,GAAE,MAAc,GACxB,OAAO,CAAC,OAAO,CAAC,CAsDlB;AAqBD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACP,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACpB,GACL,OAAO,CAAC,oBAAoB,CAAC,CA0E/B;AAMD,wBAAgB,wBAAwB,IAAI,OAAO,CAElD;AAQD,wBAAgB,+BAA+B,CAAC,YAAY,GAAE,OAAc,EAAE,SAAS,GAAE,OAAe,GAAG,IAAI,CAM9G;AAkBD,wBAAsB,yBAAyB,CAC7C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,kBAAkB,GAAE,MAAM,EAAO,GAChC,OAAO,CAAC,OAAO,CAAC,CA2BlB"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.confirmDeletion = confirmDeletion;
|
|
37
|
+
exports.promptConfirmation = promptConfirmation;
|
|
38
|
+
exports.isInteractiveEnvironment = isInteractiveEnvironment;
|
|
39
|
+
exports.validateConfirmationEnvironment = validateConfirmationEnvironment;
|
|
40
|
+
exports.confirmDangerousOperation = confirmDangerousOperation;
|
|
41
|
+
const readline = __importStar(require("readline"));
|
|
42
|
+
async function confirmDeletion(message, expectedInput = 'yes', timeoutMs = 30000) {
|
|
43
|
+
if (!process.stdin.isTTY) {
|
|
44
|
+
throw new Error('Interactive confirmation not available in non-TTY environment. Use --force flag to bypass confirmation.');
|
|
45
|
+
}
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const rl = readline.createInterface({
|
|
48
|
+
input: process.stdin,
|
|
49
|
+
output: process.stdout
|
|
50
|
+
});
|
|
51
|
+
const timeoutId = setTimeout(() => {
|
|
52
|
+
rl.close();
|
|
53
|
+
reject(new Error(`Confirmation timed out after ${timeoutMs / 1000} seconds`));
|
|
54
|
+
}, timeoutMs);
|
|
55
|
+
console.log(`\n🚨 ${message}`);
|
|
56
|
+
console.log(`Type '${expectedInput}' to confirm, or anything else to cancel:`);
|
|
57
|
+
rl.question('> ', (answer) => {
|
|
58
|
+
clearTimeout(timeoutId);
|
|
59
|
+
rl.close();
|
|
60
|
+
const normalizedAnswer = answer.trim().toLowerCase();
|
|
61
|
+
const normalizedExpected = expectedInput.toLowerCase();
|
|
62
|
+
const confirmed = normalizedAnswer === normalizedExpected ||
|
|
63
|
+
normalizedAnswer === 'y' ||
|
|
64
|
+
normalizedAnswer === 'yes';
|
|
65
|
+
if (confirmed) {
|
|
66
|
+
console.log('✅ Confirmed. Proceeding with operation...\n');
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.log('❌ Cancelled. Operation aborted.\n');
|
|
70
|
+
}
|
|
71
|
+
resolve(confirmed);
|
|
72
|
+
});
|
|
73
|
+
rl.on('SIGINT', () => {
|
|
74
|
+
clearTimeout(timeoutId);
|
|
75
|
+
rl.close();
|
|
76
|
+
console.log('\n❌ Operation cancelled by user (Ctrl+C)\n');
|
|
77
|
+
resolve(false);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async function promptConfirmation(message, options = {}) {
|
|
82
|
+
const { acceptedInputs = ['yes', 'y'], rejectedInputs = ['no', 'n'], timeout = 30000, caseSensitive = false } = options;
|
|
83
|
+
if (!process.stdin.isTTY) {
|
|
84
|
+
throw new Error('Interactive confirmation not available in non-TTY environment.');
|
|
85
|
+
}
|
|
86
|
+
return new Promise((resolve, reject) => {
|
|
87
|
+
const rl = readline.createInterface({
|
|
88
|
+
input: process.stdin,
|
|
89
|
+
output: process.stdout
|
|
90
|
+
});
|
|
91
|
+
const timeoutId = setTimeout(() => {
|
|
92
|
+
rl.close();
|
|
93
|
+
reject(new Error(`Confirmation timed out after ${timeout / 1000} seconds`));
|
|
94
|
+
}, timeout);
|
|
95
|
+
console.log(`\n${message}`);
|
|
96
|
+
console.log(`Accepted inputs: ${acceptedInputs.join(', ')}`);
|
|
97
|
+
console.log(`Rejected inputs: ${rejectedInputs.join(', ')}`);
|
|
98
|
+
rl.question('> ', (answer) => {
|
|
99
|
+
clearTimeout(timeoutId);
|
|
100
|
+
rl.close();
|
|
101
|
+
const processedAnswer = caseSensitive ? answer.trim() : answer.trim().toLowerCase();
|
|
102
|
+
const processedAccepted = caseSensitive
|
|
103
|
+
? acceptedInputs
|
|
104
|
+
: acceptedInputs.map(input => input.toLowerCase());
|
|
105
|
+
const processedRejected = caseSensitive
|
|
106
|
+
? rejectedInputs
|
|
107
|
+
: rejectedInputs.map(input => input.toLowerCase());
|
|
108
|
+
let confirmed;
|
|
109
|
+
if (processedAccepted.includes(processedAnswer)) {
|
|
110
|
+
confirmed = true;
|
|
111
|
+
console.log('✅ Confirmed. Proceeding with operation...\n');
|
|
112
|
+
}
|
|
113
|
+
else if (processedRejected.includes(processedAnswer)) {
|
|
114
|
+
confirmed = false;
|
|
115
|
+
console.log('❌ Cancelled. Operation aborted.\n');
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
confirmed = false;
|
|
119
|
+
console.log(`❓ Invalid input: "${answer}". Operation cancelled.\n`);
|
|
120
|
+
}
|
|
121
|
+
resolve({
|
|
122
|
+
confirmed,
|
|
123
|
+
input: answer.trim()
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
rl.on('SIGINT', () => {
|
|
127
|
+
clearTimeout(timeoutId);
|
|
128
|
+
rl.close();
|
|
129
|
+
console.log('\n❌ Operation cancelled by user (Ctrl+C)\n');
|
|
130
|
+
resolve({
|
|
131
|
+
confirmed: false,
|
|
132
|
+
input: ''
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function isInteractiveEnvironment() {
|
|
138
|
+
return process.stdin.isTTY === true;
|
|
139
|
+
}
|
|
140
|
+
function validateConfirmationEnvironment(requireForce = true, forceFlag = false) {
|
|
141
|
+
if (!isInteractiveEnvironment() && requireForce && !forceFlag) {
|
|
142
|
+
throw new Error('Interactive confirmation not available in non-TTY environment. Use --force flag to bypass confirmation.');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function confirmDangerousOperation(operationName, resourceId, additionalWarnings = []) {
|
|
146
|
+
console.log('\n' + '='.repeat(60));
|
|
147
|
+
console.log('🚨 DANGEROUS OPERATION WARNING 🚨');
|
|
148
|
+
console.log('='.repeat(60));
|
|
149
|
+
console.log(`Operation: ${operationName.toUpperCase()}`);
|
|
150
|
+
console.log(`Resource: ${resourceId}`);
|
|
151
|
+
console.log('='.repeat(60));
|
|
152
|
+
if (additionalWarnings.length > 0) {
|
|
153
|
+
console.log('\nWarnings:');
|
|
154
|
+
additionalWarnings.forEach((warning, index) => {
|
|
155
|
+
console.log(`${index + 1}. ${warning}`);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
console.log('\nThis action is IRREVERSIBLE and cannot be undone.');
|
|
159
|
+
console.log('All data associated with this resource will be permanently lost.');
|
|
160
|
+
const confirmed = await confirmDeletion(`Type 'yes' to confirm ${operationName} for ${resourceId}`, 'yes', 60000);
|
|
161
|
+
console.log('='.repeat(60));
|
|
162
|
+
return confirmed;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=confirmation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.js","sourceRoot":"","sources":["../../src/utils/confirmation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,0CA0DC;AAqBD,gDAkFC;AAMD,4DAEC;AAQD,0EAMC;AAkBD,8DA+BC;AAhQD,mDAAqC;AAwB9B,KAAK,UAAU,eAAe,CACnC,OAAe,EACf,gBAAwB,KAAK,EAC7B,YAAoB,KAAK;IAGzB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,yGAAyG,CAC1G,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,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G,KAAK,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,kEAAkE,CAAC,CAAC;IAEhF,MAAM,SAAS,GAAG,MAAM,eAAe,CACrC,yBAAyB,aAAa,QAAQ,UAAU,EAAE,EAC1D,KAAK,EACL,KAAK,CACN,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5B,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare class CLIError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly statusCode: number;
|
|
4
|
+
constructor(message: string, code?: string, statusCode?: number);
|
|
5
|
+
}
|
|
6
|
+
export declare class ValidationError extends CLIError {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class ConfigurationError extends CLIError {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class APIError extends CLIError {
|
|
13
|
+
constructor(message: string, statusCode?: number);
|
|
14
|
+
}
|
|
15
|
+
export declare class PolyVError extends CLIError {
|
|
16
|
+
readonly context?: Record<string, any> | undefined;
|
|
17
|
+
constructor(message: string, code?: string, statusCode?: number, context?: Record<string, any>);
|
|
18
|
+
}
|
|
19
|
+
export declare class PolyVValidationError extends PolyVError {
|
|
20
|
+
readonly field: string;
|
|
21
|
+
readonly value: any;
|
|
22
|
+
readonly rule: string;
|
|
23
|
+
constructor(message: string, field: string, value: any, rule: string, context?: Record<string, any>);
|
|
24
|
+
}
|
|
25
|
+
export declare class PolyVAPIError extends PolyVError {
|
|
26
|
+
readonly httpStatus: number;
|
|
27
|
+
readonly apiResponse?: any;
|
|
28
|
+
constructor(message: string, code?: string, httpStatus?: number, context?: Record<string, any>);
|
|
29
|
+
}
|
|
30
|
+
export declare class PolyVConfigError extends PolyVError {
|
|
31
|
+
constructor(message: string, context?: Record<string, any>);
|
|
32
|
+
}
|
|
33
|
+
export declare class PolyVAuthenticationError extends PolyVError {
|
|
34
|
+
constructor(message: string, context?: Record<string, any>);
|
|
35
|
+
}
|
|
36
|
+
export declare function formatError(error: Error): string;
|
|
37
|
+
export declare function logError(error: Error): void;
|
|
38
|
+
export declare function handleUncaughtError(error: Error): void;
|
|
39
|
+
export declare function handleUnhandledRejection(reason: unknown): void;
|
|
40
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAIA,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,UAAU,EAAE,MAAM,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,IAAI,SAAc,EAAE,UAAU,SAAI;CAWhE;AAED,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,QAAQ;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,QAAS,SAAQ,QAAQ;gBACxB,OAAO,EAAE,MAAM,EAAE,UAAU,SAAI;CAI5C;AAKD,qBAAa,UAAW,SAAQ,QAAQ;IACtC,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;gBAGxD,OAAO,EAAE,MAAM,EACf,IAAI,SAAgB,EACpB,UAAU,SAAI,EACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAMhC;AAKD,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,SAAgB,KAAK,EAAE,GAAG,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAG3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,GAAG,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAQhC;AAKD,qBAAa,aAAc,SAAQ,UAAU;IAC3C,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,WAAW,CAAC,EAAE,GAAG,CAAC;gBAGhC,OAAO,EAAE,MAAM,EACf,IAAI,SAAoB,EACxB,UAAU,SAAM,EAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAOhC;AAKD,qBAAa,gBAAiB,SAAQ,UAAU;gBAClC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAI3D;AAKD,qBAAa,wBAAyB,SAAQ,UAAU;gBAC1C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAI3D;AAKD,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAoBhD;AAKD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAQ3C;AAKD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAGtD;AAKD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAI9D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolyVAuthenticationError = exports.PolyVConfigError = exports.PolyVAPIError = exports.PolyVValidationError = exports.PolyVError = exports.APIError = exports.ConfigurationError = exports.ValidationError = exports.CLIError = void 0;
|
|
4
|
+
exports.formatError = formatError;
|
|
5
|
+
exports.logError = logError;
|
|
6
|
+
exports.handleUncaughtError = handleUncaughtError;
|
|
7
|
+
exports.handleUnhandledRejection = handleUnhandledRejection;
|
|
8
|
+
class CLIError extends Error {
|
|
9
|
+
constructor(message, code = 'CLI_ERROR', statusCode = 1) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'CLIError';
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.statusCode = statusCode;
|
|
14
|
+
if (Error.captureStackTrace) {
|
|
15
|
+
Error.captureStackTrace(this, CLIError);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.CLIError = CLIError;
|
|
20
|
+
class ValidationError extends CLIError {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message, 'VALIDATION_ERROR', 1);
|
|
23
|
+
this.name = 'ValidationError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ValidationError = ValidationError;
|
|
27
|
+
class ConfigurationError extends CLIError {
|
|
28
|
+
constructor(message) {
|
|
29
|
+
super(message, 'CONFIG_ERROR', 1);
|
|
30
|
+
this.name = 'ConfigurationError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ConfigurationError = ConfigurationError;
|
|
34
|
+
class APIError extends CLIError {
|
|
35
|
+
constructor(message, statusCode = 1) {
|
|
36
|
+
super(message, 'API_ERROR', statusCode);
|
|
37
|
+
this.name = 'APIError';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.APIError = APIError;
|
|
41
|
+
class PolyVError extends CLIError {
|
|
42
|
+
constructor(message, code = 'POLYV_ERROR', statusCode = 1, context) {
|
|
43
|
+
super(message, code, statusCode);
|
|
44
|
+
this.name = 'PolyVError';
|
|
45
|
+
this.context = context;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.PolyVError = PolyVError;
|
|
49
|
+
class PolyVValidationError extends PolyVError {
|
|
50
|
+
constructor(message, field, value, rule, context) {
|
|
51
|
+
super(message, 'POLYV_VALIDATION_ERROR', 1, context);
|
|
52
|
+
this.name = 'PolyVValidationError';
|
|
53
|
+
this.field = field;
|
|
54
|
+
this.value = value;
|
|
55
|
+
this.rule = rule;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.PolyVValidationError = PolyVValidationError;
|
|
59
|
+
class PolyVAPIError extends PolyVError {
|
|
60
|
+
constructor(message, code = 'POLYV_API_ERROR', httpStatus = 500, context) {
|
|
61
|
+
super(message, code, httpStatus, context);
|
|
62
|
+
this.name = 'PolyVAPIError';
|
|
63
|
+
this.httpStatus = httpStatus;
|
|
64
|
+
this.apiResponse = context?.['responseData'] || context?.['polyvData'];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.PolyVAPIError = PolyVAPIError;
|
|
68
|
+
class PolyVConfigError extends PolyVError {
|
|
69
|
+
constructor(message, context) {
|
|
70
|
+
super(message, 'POLYV_CONFIG_ERROR', 1, context);
|
|
71
|
+
this.name = 'PolyVConfigError';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.PolyVConfigError = PolyVConfigError;
|
|
75
|
+
class PolyVAuthenticationError extends PolyVError {
|
|
76
|
+
constructor(message, context) {
|
|
77
|
+
super(message, 'POLYV_AUTH_ERROR', 1, context);
|
|
78
|
+
this.name = 'PolyVAuthenticationError';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.PolyVAuthenticationError = PolyVAuthenticationError;
|
|
82
|
+
function formatError(error) {
|
|
83
|
+
if (error instanceof CLIError) {
|
|
84
|
+
return `Error: ${error.message}`;
|
|
85
|
+
}
|
|
86
|
+
if (error.message.includes('ENOENT')) {
|
|
87
|
+
return 'Error: File or directory not found';
|
|
88
|
+
}
|
|
89
|
+
if (error.message.includes('EACCES')) {
|
|
90
|
+
return 'Error: Permission denied';
|
|
91
|
+
}
|
|
92
|
+
if (error.message.includes('ENOTDIR')) {
|
|
93
|
+
return 'Error: Not a directory';
|
|
94
|
+
}
|
|
95
|
+
return `Unexpected error: ${error.message}`;
|
|
96
|
+
}
|
|
97
|
+
function logError(error) {
|
|
98
|
+
const formattedMessage = formatError(error);
|
|
99
|
+
console.error(formattedMessage);
|
|
100
|
+
if (process.env['NODE_ENV'] === 'development' || process.env['DEBUG']) {
|
|
101
|
+
console.error('Stack trace:', error.stack);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function handleUncaughtError(error) {
|
|
105
|
+
logError(error);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
function handleUnhandledRejection(reason) {
|
|
109
|
+
const error = reason instanceof Error ? reason : new Error(String(reason));
|
|
110
|
+
logError(error);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AA8HA,kCAoBC;AAKD,4BAQC;AAKD,kDAGC;AAKD,4DAIC;AA5KD,MAAa,QAAS,SAAQ,KAAK;IAIjC,YAAY,OAAe,EAAE,IAAI,GAAG,WAAW,EAAE,UAAU,GAAG,CAAC;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAG7B,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;CACF;AAfD,4BAeC;AAED,MAAa,eAAgB,SAAQ,QAAQ;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,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ACnC,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAGhC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACtE,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAKD,SAAgB,mBAAmB,CAAC,KAAY;IAC9C,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAKD,SAAgB,wBAAwB,CAAC,MAAe;IACtD,MAAM,KAAK,GAAG,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3E,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StreamStatusInfo } from '../types/stream';
|
|
2
|
+
export declare function formatStreamStatusForTable(status: StreamStatusInfo): Record<string, string>;
|
|
3
|
+
export declare function formatStreamStatusForJson(status: StreamStatusInfo): StreamStatusInfo;
|
|
4
|
+
export declare function formatStatusWithIcon(status: 'live' | 'stopped' | 'waiting' | 'error' | 'unknown', statusText: string): string;
|
|
5
|
+
export declare function formatDuration(duration: number): string;
|
|
6
|
+
export declare function formatBandwidth(bandwidth: number): string;
|
|
7
|
+
export declare function formatCompactStatus(status: StreamStatusInfo): string;
|
|
8
|
+
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOnD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAwC3F;AAOD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAGpF;AAQD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC5D,UAAU,EAAE,MAAM,GACjB,MAAM,CAcR;AAOD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYvD;AAOD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAazD;AAOD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CASpE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatStreamStatusForTable = formatStreamStatusForTable;
|
|
4
|
+
exports.formatStreamStatusForJson = formatStreamStatusForJson;
|
|
5
|
+
exports.formatStatusWithIcon = formatStatusWithIcon;
|
|
6
|
+
exports.formatDuration = formatDuration;
|
|
7
|
+
exports.formatBandwidth = formatBandwidth;
|
|
8
|
+
exports.formatCompactStatus = formatCompactStatus;
|
|
9
|
+
function formatStreamStatusForTable(status) {
|
|
10
|
+
const formattedStatus = {
|
|
11
|
+
'Channel ID': status.channelId,
|
|
12
|
+
'Status': formatStatusWithIcon(status.status, status.statusText),
|
|
13
|
+
'Last Updated': status.lastUpdated.toLocaleString()
|
|
14
|
+
};
|
|
15
|
+
if (status.isLive && status.durationText) {
|
|
16
|
+
formattedStatus['Duration'] = status.durationText;
|
|
17
|
+
}
|
|
18
|
+
if (status.metrics) {
|
|
19
|
+
formattedStatus['FPS'] = status.metrics.fps.toFixed(2);
|
|
20
|
+
if (status.metrics.lfr > 0) {
|
|
21
|
+
formattedStatus['Frame Loss'] = `${status.metrics.lfr.toFixed(2)}%`;
|
|
22
|
+
}
|
|
23
|
+
formattedStatus['Bandwidth'] = status.metrics.bandwidthText;
|
|
24
|
+
}
|
|
25
|
+
if (status.network) {
|
|
26
|
+
if (status.network.deployAddress) {
|
|
27
|
+
formattedStatus['Deploy Address'] = status.network.deployAddress;
|
|
28
|
+
}
|
|
29
|
+
if (status.network.inAddress) {
|
|
30
|
+
formattedStatus['Input Address'] = status.network.inAddress;
|
|
31
|
+
}
|
|
32
|
+
if (status.network.streamName) {
|
|
33
|
+
formattedStatus['Stream Name'] = status.network.streamName;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (status.error) {
|
|
37
|
+
formattedStatus['Error'] = `${status.error.code}: ${status.error.message}`;
|
|
38
|
+
}
|
|
39
|
+
return formattedStatus;
|
|
40
|
+
}
|
|
41
|
+
function formatStreamStatusForJson(status) {
|
|
42
|
+
return status;
|
|
43
|
+
}
|
|
44
|
+
function formatStatusWithIcon(status, statusText) {
|
|
45
|
+
switch (status) {
|
|
46
|
+
case 'live':
|
|
47
|
+
return `🟢 ${statusText}`;
|
|
48
|
+
case 'stopped':
|
|
49
|
+
return `⚫ ${statusText}`;
|
|
50
|
+
case 'waiting':
|
|
51
|
+
return `🟡 ${statusText}`;
|
|
52
|
+
case 'error':
|
|
53
|
+
return `🔴 ${statusText}`;
|
|
54
|
+
case 'unknown':
|
|
55
|
+
default:
|
|
56
|
+
return `⚪ ${statusText}`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function formatDuration(duration) {
|
|
60
|
+
const seconds = Math.floor(duration / 1000);
|
|
61
|
+
const minutes = Math.floor(seconds / 60);
|
|
62
|
+
const hours = Math.floor(minutes / 60);
|
|
63
|
+
if (hours > 0) {
|
|
64
|
+
return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
|
|
65
|
+
}
|
|
66
|
+
else if (minutes > 0) {
|
|
67
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return `${seconds}s`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function formatBandwidth(bandwidth) {
|
|
74
|
+
if (bandwidth === 0)
|
|
75
|
+
return '0 bps';
|
|
76
|
+
const units = ['bps', 'Kbps', 'Mbps', 'Gbps'];
|
|
77
|
+
let unitIndex = 0;
|
|
78
|
+
let value = bandwidth;
|
|
79
|
+
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
80
|
+
value /= 1024;
|
|
81
|
+
unitIndex++;
|
|
82
|
+
}
|
|
83
|
+
return `${value.toFixed(2)} ${units[unitIndex]}`;
|
|
84
|
+
}
|
|
85
|
+
function formatCompactStatus(status) {
|
|
86
|
+
const icon = formatStatusWithIcon(status.status, '').trim();
|
|
87
|
+
let summary = `${icon} ${status.statusText}`;
|
|
88
|
+
if (status.isLive && status.durationText) {
|
|
89
|
+
summary += ` (${status.durationText})`;
|
|
90
|
+
}
|
|
91
|
+
return summary;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":";;AAaA,gEAwCC;AAOD,8DAGC;AAQD,oDAiBC;AAOD,wCAYC;AAOD,0CAaC;AAOD,kDASC;AAlID,SAAgB,0BAA0B,CAAC,MAAwB;IACjE,MAAM,eAAe,GAA2B;QAC9C,YAAY,EAAE,MAAM,CAAC,SAAS;QAC9B,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC;QAChE,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,cAAc,EAAE;KACpD,CAAC;IAGF,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACz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S,CAAC;IAEtB,OAAO,KAAK,IAAI,IAAI,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrD,KAAK,IAAI,IAAI,CAAC;QACd,SAAS,EAAE,CAAC;IACd,CAAC;IAED,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;AACnD,CAAC;AAOD,SAAgB,mBAAmB,CAAC,MAAwB;IAC1D,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5D,IAAI,OAAO,GAAG,GAAG,IAAI,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;IAE7C,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACzC,OAAO,IAAI,KAAK,MAAM,CAAC,YAAY,GAAG,CAAC;IACzC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAKA,cAAc,UAAU,CAAC;AAGzB,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./errors"), exports);
|
|
18
|
+
__exportStar(require("./signature"), exports);
|
|
19
|
+
__exportStar(require("./confirmation"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,2CAAyB;AAGzB,8CAA4B;AAG5B,iDAA+B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SignatureParams, SignatureOptions, SignatureResult, ProcessedParams } from '../types/signature';
|
|
2
|
+
export declare function generateTimestamp(customTimestamp?: number): number;
|
|
3
|
+
export declare function filterParams(params: SignatureParams): Record<string, string | number | boolean>;
|
|
4
|
+
export declare function sortAndConcatenateParams(params: Record<string, string | number | boolean>): string;
|
|
5
|
+
export declare function processParams(params: SignatureParams): ProcessedParams;
|
|
6
|
+
export declare function generateMD5Signature(paramString: string, appSecret: string): string;
|
|
7
|
+
export declare function generateSignature(params: SignatureParams, options: SignatureOptions): SignatureResult;
|
|
8
|
+
export declare function createSignature(params: SignatureParams, appSecret: string, debug?: boolean): SignatureResult;
|
|
9
|
+
//# sourceMappingURL=signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAOzG,wBAAgB,iBAAiB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAElE;AAOD,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAW/F;AAQD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,CAWlG;AAOD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAQtE;AASD,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAQnF;AAQD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,GAAG,eAAe,CA8CrG;AASD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,EACjB,KAAK,UAAQ,GACZ,eAAe,CAEjB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateTimestamp = generateTimestamp;
|
|
4
|
+
exports.filterParams = filterParams;
|
|
5
|
+
exports.sortAndConcatenateParams = sortAndConcatenateParams;
|
|
6
|
+
exports.processParams = processParams;
|
|
7
|
+
exports.generateMD5Signature = generateMD5Signature;
|
|
8
|
+
exports.generateSignature = generateSignature;
|
|
9
|
+
exports.createSignature = createSignature;
|
|
10
|
+
const crypto_1 = require("crypto");
|
|
11
|
+
function generateTimestamp(customTimestamp) {
|
|
12
|
+
return customTimestamp ?? Date.now();
|
|
13
|
+
}
|
|
14
|
+
function filterParams(params) {
|
|
15
|
+
const filtered = {};
|
|
16
|
+
for (const [key, value] of Object.entries(params)) {
|
|
17
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
18
|
+
filtered[key] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return filtered;
|
|
22
|
+
}
|
|
23
|
+
function sortAndConcatenateParams(params) {
|
|
24
|
+
const sortedKeys = Object.keys(params).sort();
|
|
25
|
+
let result = '';
|
|
26
|
+
for (const key of sortedKeys) {
|
|
27
|
+
result += key + String(params[key]);
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
function processParams(params) {
|
|
32
|
+
const filteredParams = filterParams(params);
|
|
33
|
+
const paramString = sortAndConcatenateParams(filteredParams);
|
|
34
|
+
return {
|
|
35
|
+
params: filteredParams,
|
|
36
|
+
paramString
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function generateMD5Signature(paramString, appSecret) {
|
|
40
|
+
const signatureSource = appSecret + paramString + appSecret;
|
|
41
|
+
const md5Hash = (0, crypto_1.createHash)('md5').update(signatureSource, 'utf8').digest('hex');
|
|
42
|
+
return md5Hash.toUpperCase();
|
|
43
|
+
}
|
|
44
|
+
function generateSignature(params, options) {
|
|
45
|
+
if (!params.appId) {
|
|
46
|
+
throw new Error('appId is required for signature generation');
|
|
47
|
+
}
|
|
48
|
+
if (!options.appSecret) {
|
|
49
|
+
throw new Error('appSecret is required for signature generation');
|
|
50
|
+
}
|
|
51
|
+
const timestamp = options.customTimestamp ?? params.timestamp ?? generateTimestamp();
|
|
52
|
+
const signatureParams = {
|
|
53
|
+
...params,
|
|
54
|
+
timestamp
|
|
55
|
+
};
|
|
56
|
+
const { params: sortedParams, paramString } = processParams(signatureParams);
|
|
57
|
+
const signature = generateMD5Signature(paramString, options.appSecret);
|
|
58
|
+
const result = {
|
|
59
|
+
signature,
|
|
60
|
+
timestamp,
|
|
61
|
+
sortedParams
|
|
62
|
+
};
|
|
63
|
+
if (options.debug) {
|
|
64
|
+
result.rawString = options.appSecret + paramString + options.appSecret;
|
|
65
|
+
}
|
|
66
|
+
if (options.debug) {
|
|
67
|
+
console.log('[Signature Debug] Sorted parameters:', sortedParams);
|
|
68
|
+
console.log('[Signature Debug] Parameter string:', paramString);
|
|
69
|
+
console.log('[Signature Debug] Raw signature string:', result.rawString);
|
|
70
|
+
console.log('[Signature Debug] Final signature:', signature);
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
function createSignature(params, appSecret, debug = false) {
|
|
75
|
+
return generateSignature(params, { appSecret, debug });
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":";;AAYA,8CAEC;AAOD,oCAWC;AAQD,4DAWC;AAOD,sCAQC;AASD,oDAQC;AAQD,8CA8CC;AASD,0CAMC;AApJD,mCAAoC;AAQpC,SAAgB,iBAAiB,CAAC,eAAwB;IACxD,OAAO,eAAe,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACvC,CAAC;AAOD,SAAgB,YAAY,CAAC,MAAuB;IAClD,MAAM,QAAQ,GAA8C,EAAE,CAAC;IAE/D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAElD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YAC1D,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAQD,SAAgB,wBAAwB,CAAC,MAAiD;IAExF,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAG9C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACtC,CA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