chati-dev 4.0.6 → 4.0.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/package.json +1 -1
- package/src/telemetry/config.js +1 -1
- package/src/telemetry/sender.js +22 -1
- package/src/wizard/index.js +1 -1
package/package.json
CHANGED
package/src/telemetry/config.js
CHANGED
|
@@ -26,7 +26,7 @@ export function getTelemetryConfig(targetDir) {
|
|
|
26
26
|
const defaults = {
|
|
27
27
|
enabled: true,
|
|
28
28
|
anonymousId: null,
|
|
29
|
-
endpoint: process.env.CHATI_TELEMETRY_ENDPOINT || 'https://chati
|
|
29
|
+
endpoint: process.env.CHATI_TELEMETRY_ENDPOINT || 'https://chati.dev/api/telemetry',
|
|
30
30
|
apiKey: process.env.CHATI_TELEMETRY_KEY || '10b0b54ba4f392fa46379ba778062ab0af5ca61e79609a7dce4aadd660104b56',
|
|
31
31
|
};
|
|
32
32
|
|
package/src/telemetry/sender.js
CHANGED
|
@@ -5,12 +5,31 @@
|
|
|
5
5
|
* Fire-and-forget: never blocks the user workflow, fails silently.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { existsSync, readFileSync } from 'fs';
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
import { homedir } from 'os';
|
|
11
|
+
|
|
8
12
|
// ---------------------------------------------------------------------------
|
|
9
13
|
// Default Endpoint
|
|
10
14
|
// ---------------------------------------------------------------------------
|
|
11
15
|
|
|
12
16
|
export const DEFAULT_ENDPOINT = 'https://chati.dev/api/telemetry';
|
|
13
17
|
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Helpers
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
function readGlobalLicenseKey() {
|
|
23
|
+
try {
|
|
24
|
+
const p = join(homedir(), '.chati-dev', 'license.yaml');
|
|
25
|
+
if (!existsSync(p)) return null;
|
|
26
|
+
const content = readFileSync(p, 'utf-8');
|
|
27
|
+
const match = content.match(/^key:\s*(.+)$/m);
|
|
28
|
+
const key = match?.[1]?.trim();
|
|
29
|
+
return key && key !== 'null' ? key : null;
|
|
30
|
+
} catch { return null; }
|
|
31
|
+
}
|
|
32
|
+
|
|
14
33
|
// ---------------------------------------------------------------------------
|
|
15
34
|
// Sender
|
|
16
35
|
// ---------------------------------------------------------------------------
|
|
@@ -21,7 +40,7 @@ export const DEFAULT_ENDPOINT = 'https://chati.dev/api/telemetry';
|
|
|
21
40
|
* Fire-and-forget with 5s timeout. Never throws, never blocks.
|
|
22
41
|
*
|
|
23
42
|
* @param {Array<{ type: string, properties: object, timestamp: string }>} events
|
|
24
|
-
* @param {{ anonymousId: string, version: string, endpoint?: string }} config
|
|
43
|
+
* @param {{ anonymousId: string, version: string, endpoint?: string, projectName?: string }} config
|
|
25
44
|
* @returns {Promise<boolean>} true if sent successfully, false otherwise
|
|
26
45
|
*/
|
|
27
46
|
export async function sendEvents(events, config) {
|
|
@@ -31,6 +50,8 @@ export async function sendEvents(events, config) {
|
|
|
31
50
|
|
|
32
51
|
const payload = {
|
|
33
52
|
anonymousId: config.anonymousId,
|
|
53
|
+
license_key: readGlobalLicenseKey(),
|
|
54
|
+
project_name: config.projectName ?? null,
|
|
34
55
|
chatiVersion: config.version || 'unknown',
|
|
35
56
|
nodeVersion: process.version,
|
|
36
57
|
os: process.platform,
|
package/src/wizard/index.js
CHANGED
|
@@ -188,7 +188,7 @@ export async function runWizard(targetDir, options = {}) {
|
|
|
188
188
|
const installEvents = telemetryFlush();
|
|
189
189
|
if (installEvents.length > 0) {
|
|
190
190
|
const tConfig = getTelemetryConfig(targetDir);
|
|
191
|
-
sendEvents(installEvents, { ...tConfig, version: VERSION });
|
|
191
|
+
sendEvents(installEvents, { ...tConfig, version: VERSION, projectName: config.projectName });
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
return { success: true, config, validation };
|