@octaviaflow/telemetry-config-schema 1.0.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.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # OctaviaFlow Telemetry Config Schema
2
+
3
+ Configuration file schema for [OctaviaFlow Telemetry](https://github.com/OctaviaFlow/telemetry).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @octaviaflow/telemetry-config-schema
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Schema Validation
14
+
15
+ Add the YAML language server to your YAML files:
16
+
17
+ ```yml
18
+ # yaml-language-server: $schema=https://unpkg.com/@octaviaflow/telemetry-config-schema@1/dist/config.schema.json
19
+ ```
20
+
21
+ ### Sample Configuration
22
+
23
+ ```yaml
24
+ # yaml-language-server: $schema=https://unpkg.com/@octaviaflow/telemetry-config-schema@1/dist/config.schema.json
25
+ version: 1
26
+ projectId: 'my-awesome-project'
27
+ storage:
28
+ type: 'file'
29
+ file:
30
+ directory: './telemetry-logs'
31
+ fileNamePattern: 'octaviaflow-telemetry-{timestamp}.json'
32
+ maxFileSizeMB: 10
33
+ compress: false
34
+ collect:
35
+ npm:
36
+ dependencies:
37
+ jsx:
38
+ elements:
39
+ allowedAttributeNames:
40
+ - 'size'
41
+ - 'variant'
42
+ allowedAttributeStringValues:
43
+ - 'small'
44
+ - 'medium'
45
+ - 'large'
46
+ js:
47
+ tokens:
48
+ functions:
49
+ allowedArgumentStringValues:
50
+ - 'debug'
51
+ - 'info'
52
+ - 'warn'
53
+ - 'error'
54
+ ```
55
+
56
+ ## Storage Options
57
+
58
+ ### File Storage (Current)
59
+
60
+ Store telemetry data in JSON files that are MongoDB Atlas import-ready:
61
+
62
+ ```yaml
63
+ storage:
64
+ type: 'file'
65
+ file:
66
+ directory: './telemetry-logs'
67
+ fileNamePattern: 'octaviaflow-telemetry-{timestamp}.json'
68
+ maxFileSizeMB: 10
69
+ compress: false
70
+ ```
71
+
72
+ ### MongoDB Storage (Future)
73
+
74
+ Direct MongoDB integration (coming soon):
75
+
76
+ ```yaml
77
+ storage:
78
+ type: 'mongodb'
79
+ mongodb:
80
+ connectionString: 'mongodb+srv://user:pass@cluster.mongodb.net'
81
+ database: 'telemetry'
82
+ collection: 'metrics'
83
+ ```
84
+
85
+ ## Schema Keys
86
+
87
+ | Key | Description | Required | Type |
88
+ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------ |
89
+ | `version` | Current schema version. | Required | 1 |
90
+ | `projectId` | Unique identifier assigned on a per-project basis. | Required | String |
91
+ | `storage` | Storage configuration for telemetry data. | Required | Object |
92
+ | `collect` | Object containing one or more scopes for which to collect data. | Required | Object |
93
+
94
+ ## Collect Scopes
95
+
96
+ ### NPM Scope
97
+ Captures dependency information and package usage data.
98
+
99
+ ### JSX Scope
100
+ Captures React component usage and prop configurations.
101
+
102
+ ### JS Scope
103
+ Captures JavaScript function calls and token usage.
104
+
105
+ ### WC Scope
106
+ Captures Web Component usage and attribute configurations.
107
+
108
+ ## License
109
+
110
+ MIT
File without changes
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Configuration outline for metrics collection using octaviaflow telemetry.
3
+ */
4
+ export interface ConfigSchema {
5
+ /**
6
+ * Current schema version.
7
+ */
8
+ version: 1;
9
+ /**
10
+ * Unique identifier assigned on a per-project basis.
11
+ */
12
+ projectId: string;
13
+ /**
14
+ * Telemetry configuration for OctaviaFlow Telemetry.
15
+ */
16
+ name?: string;
17
+ /**
18
+ * Storage configuration for telemetry data.
19
+ */
20
+ storage: StorageConfig;
21
+ /**
22
+ * The keys under `collect` represent the various types of data that Telemetry is capable of collecting (i.e. `scopes`).
23
+ */
24
+ collect: CollectConfig;
25
+ }
26
+ /**
27
+ * Storage configuration options
28
+ */
29
+ export interface StorageConfig {
30
+ /**
31
+ * Storage type - currently supports 'file' with future MongoDB support
32
+ */
33
+ type: 'file' | 'mongodb';
34
+ /**
35
+ * Configuration specific to file storage
36
+ */
37
+ file?: FileStorageConfig;
38
+ /**
39
+ * Configuration specific to MongoDB storage (future use)
40
+ */
41
+ mongodb?: MongoDBStorageConfig;
42
+ }
43
+ /**
44
+ * File storage configuration
45
+ */
46
+ export interface FileStorageConfig {
47
+ /**
48
+ * Directory path where telemetry files will be stored
49
+ */
50
+ directory: string;
51
+ /**
52
+ * File name pattern for telemetry logs
53
+ * @default "octaviaflow-telemetry-{timestamp}.json"
54
+ */
55
+ fileNamePattern?: string;
56
+ /**
57
+ * Maximum file size in MB before rotating to a new file
58
+ * @default 10
59
+ */
60
+ maxFileSizeMB?: number;
61
+ /**
62
+ * Whether to compress old files
63
+ * @default false
64
+ */
65
+ compress?: boolean;
66
+ }
67
+ /**
68
+ * MongoDB storage configuration (for future use)
69
+ */
70
+ export interface MongoDBStorageConfig {
71
+ /**
72
+ * MongoDB connection string
73
+ */
74
+ connectionString: string;
75
+ /**
76
+ * Database name
77
+ */
78
+ database: string;
79
+ /**
80
+ * Collection name for telemetry data
81
+ */
82
+ collection: string;
83
+ }
84
+ /**
85
+ * Collection configuration
86
+ */
87
+ export interface CollectConfig {
88
+ /**
89
+ * Configuration for collecting telemetry data from an npm environment.
90
+ */
91
+ npm?: NpmScopeConfig;
92
+ /**
93
+ * Configuration for collecting telemetry data from JSX files.
94
+ */
95
+ jsx?: JsxScopeConfig;
96
+ /**
97
+ * Configuration for collecting telemetry data for tokens and functions.
98
+ */
99
+ js?: JsScopeConfig;
100
+ /**
101
+ * Configuration for collecting telemetry data from HTML and JSX files.
102
+ */
103
+ wc?: WcScopeConfig;
104
+ }
105
+ /**
106
+ * NPM scope configuration
107
+ */
108
+ export interface NpmScopeConfig {
109
+ /**
110
+ * Enable telemetry data collection for NPM dependencies.
111
+ */
112
+ dependencies?: null;
113
+ }
114
+ /**
115
+ * JSX scope configuration
116
+ */
117
+ export interface JsxScopeConfig {
118
+ /**
119
+ * Enable telemetry data collection for JSX elements.
120
+ */
121
+ elements?: ElementsConfig;
122
+ }
123
+ /**
124
+ * JavaScript scope configuration
125
+ */
126
+ export interface JsScopeConfig {
127
+ /**
128
+ * Enable telemetry data collection for JS tokens.
129
+ */
130
+ tokens?: null;
131
+ /**
132
+ * Enable telemetry data collection for JS functions.
133
+ */
134
+ functions?: FunctionsConfig;
135
+ }
136
+ /**
137
+ * Web Components scope configuration
138
+ */
139
+ export interface WcScopeConfig {
140
+ /**
141
+ * Enable telemetry data collection for Web Component elements.
142
+ */
143
+ elements?: ElementsConfig;
144
+ }
145
+ /**
146
+ * Elements configuration for JSX and WC scopes
147
+ */
148
+ export interface ElementsConfig {
149
+ /**
150
+ * Enable telemetry data collection for specific attribute names.
151
+ */
152
+ allowedAttributeNames?: string[];
153
+ /**
154
+ * Enable telemetry data collection for specific attribute string values.
155
+ */
156
+ allowedAttributeStringValues?: string[];
157
+ }
158
+ /**
159
+ * Functions configuration for JS scope
160
+ */
161
+ export interface FunctionsConfig {
162
+ /**
163
+ * Enable telemetry data collection for specific string function argument values.
164
+ */
165
+ allowedArgumentStringValues?: string[];
166
+ }
167
+ //# sourceMappingURL=config-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../src/main/config-schema.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzB;;OAEG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,E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,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;CACxC"}
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright OctaviaFlow 2025
3
+ *
4
+ * This source code is licensed under the Apache license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=config-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../../src/main/config-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@octaviaflow/telemetry-config-schema",
3
+ "description": "Telemetry config schema for OctaviaFlow Telemetry",
4
+ "version": "1.0.0",
5
+ "license": "Apache-2.0",
6
+ "author": "OctaviaFlow",
7
+ "keywords": [
8
+ "octaviaflow",
9
+ "telemetry",
10
+ "schema",
11
+ "yaml",
12
+ "analytics",
13
+ "metrics"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "homepage": "https://github.com/OctaviaFlow/OctaviaFlow-Design-System#readme",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/OctaviaFlow/OctaviaFlow-Design-System.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/OctaviaFlow/OctaviaFlow-Design-System/issues"
25
+ },
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/main/config-schema.d.ts",
30
+ "default": "./dist/main/config-schema.js"
31
+ },
32
+ "./config.schema.json": "./dist/config.schema.json"
33
+ },
34
+ "files": [
35
+ "dist/"
36
+ ],
37
+ "scripts": {
38
+ "build": "yarn clean && tsc && yarn build:schema",
39
+ "build:schema": "mkdir -p dist && ts-json-schema-generator --path ./src/main/config-schema.ts --type ConfigSchema > dist/config.schema.json",
40
+ "clean": "rimraf dist",
41
+ "lint": "scripts/lint",
42
+ "lint:fix": "scripts/lint_and_fix",
43
+ "prepare": "husky"
44
+ },
45
+ "devDependencies": {
46
+ "@commitlint/cli": "^19.8.1",
47
+ "@commitlint/config-conventional": "^19.8.1",
48
+ "@types/node": "^20.19.8",
49
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
50
+ "@typescript-eslint/parser": "^7.18.0",
51
+ "eslint": "^8.57.1",
52
+ "eslint-plugin-eslint-comments": "^3.2.0",
53
+ "eslint-plugin-import": "^2.32.0",
54
+ "eslint-plugin-jsdoc": "^48.11.0",
55
+ "eslint-plugin-n": "^17.21.0",
56
+ "eslint-plugin-notice": "^0.9.10",
57
+ "eslint-plugin-promise": "^6.6.0",
58
+ "eslint-plugin-simple-import-sort": "^12.1.1",
59
+ "husky": "^9.1.7",
60
+ "lint-staged": "^15.5.2",
61
+ "prettier": "^3.6.2",
62
+ "rimraf": "^5.0.10",
63
+ "ts-json-schema-generator": "^1.5.1",
64
+ "typescript": "^5.8.3"
65
+ }
66
+ }