@symbo.ls/sdk 2.32.11 → 2.32.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/README.md +141 -0
- package/dist/cjs/config/environment.js +18 -7
- package/dist/cjs/index.js +38 -12
- package/dist/cjs/services/BaseService.js +46 -0
- package/dist/cjs/services/DnsService.js +6 -5
- package/dist/cjs/services/TrackingService.js +661 -0
- package/dist/cjs/services/index.js +5 -5
- package/dist/cjs/utils/changePreprocessor.js +8 -1
- package/dist/cjs/utils/services.js +27 -3
- package/dist/esm/config/environment.js +18 -7
- package/dist/esm/index.js +20747 -5912
- package/dist/esm/services/AdminService.js +64 -7
- package/dist/esm/services/AuthService.js +64 -7
- package/dist/esm/services/BaseService.js +64 -7
- package/dist/esm/services/BranchService.js +64 -7
- package/dist/esm/services/CollabService.js +72 -8
- package/dist/esm/services/DnsService.js +70 -12
- package/dist/esm/services/FileService.js +64 -7
- package/dist/esm/services/PaymentService.js +64 -7
- package/dist/esm/services/PlanService.js +64 -7
- package/dist/esm/services/ProjectService.js +72 -8
- package/dist/esm/services/PullRequestService.js +64 -7
- package/dist/esm/services/ScreenshotService.js +64 -7
- package/dist/esm/services/SubscriptionService.js +64 -7
- package/dist/esm/services/TrackingService.js +18321 -0
- package/dist/esm/services/index.js +20667 -5882
- package/dist/esm/utils/CollabClient.js +18 -7
- package/dist/esm/utils/changePreprocessor.js +8 -1
- package/dist/esm/utils/services.js +27 -3
- package/dist/node/config/environment.js +18 -7
- package/dist/node/index.js +42 -16
- package/dist/node/services/BaseService.js +46 -0
- package/dist/node/services/DnsService.js +6 -5
- package/dist/node/services/TrackingService.js +632 -0
- package/dist/node/services/index.js +5 -5
- package/dist/node/utils/changePreprocessor.js +8 -1
- package/dist/node/utils/services.js +27 -3
- package/package.json +8 -6
- package/src/config/environment.js +19 -11
- package/src/index.js +44 -14
- package/src/services/BaseService.js +43 -0
- package/src/services/DnsService.js +5 -5
- package/src/services/TrackingService.js +853 -0
- package/src/services/index.js +6 -5
- package/src/utils/changePreprocessor.js +25 -1
- package/src/utils/services.js +28 -4
- package/dist/cjs/services/CoreService.js +0 -2818
- package/dist/esm/services/CoreService.js +0 -3513
- package/dist/node/services/CoreService.js +0 -2789
- package/src/services/CoreService.js +0 -3208
|
@@ -12,7 +12,9 @@ var CONFIG = {
|
|
|
12
12
|
// Feature toggles that apply across all environments by default
|
|
13
13
|
features: {
|
|
14
14
|
newUserOnboarding: true,
|
|
15
|
-
betaFeatures: false
|
|
15
|
+
betaFeatures: false,
|
|
16
|
+
// Tracking is enabled by default unless overridden per environment
|
|
17
|
+
trackingEnabled: true
|
|
16
18
|
}
|
|
17
19
|
},
|
|
18
20
|
// Environment-specific configurations
|
|
@@ -30,13 +32,17 @@ var CONFIG = {
|
|
|
30
32
|
// For based api
|
|
31
33
|
githubClientId: "Ov23liAFrsR0StbAO6PO",
|
|
32
34
|
// For github api
|
|
33
|
-
grafanaUrl: "
|
|
35
|
+
grafanaUrl: "",
|
|
34
36
|
// For grafana tracing
|
|
35
|
-
grafanaAppName: "Localhost
|
|
37
|
+
grafanaAppName: "Symbols Localhost",
|
|
36
38
|
// Environment-specific feature toggles (override common)
|
|
37
39
|
features: {
|
|
38
|
-
|
|
40
|
+
// Disable tracking by default on localhost/dev machines
|
|
41
|
+
trackingEnabled: false,
|
|
39
42
|
// Enable beta features in local dev
|
|
43
|
+
betaFeatures: true,
|
|
44
|
+
// Preserve common defaults explicitly for local
|
|
45
|
+
newUserOnboarding: true
|
|
40
46
|
},
|
|
41
47
|
typesenseCollectionName: "docs",
|
|
42
48
|
typesenseApiKey: "vZya3L2zpq8L6iI5WWMUZJZABvT63VDb",
|
|
@@ -64,7 +70,7 @@ var CONFIG = {
|
|
|
64
70
|
basedProject: "platform-v2-sm",
|
|
65
71
|
basedOrg: "symbols",
|
|
66
72
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
67
|
-
grafanaUrl: "
|
|
73
|
+
grafanaUrl: "",
|
|
68
74
|
// For grafana tracing
|
|
69
75
|
grafanaAppName: "Symbols Test",
|
|
70
76
|
typesenseCollectionName: "docs",
|
|
@@ -77,7 +83,7 @@ var CONFIG = {
|
|
|
77
83
|
socketUrl: "https://upcoming.api.symbols.app",
|
|
78
84
|
apiUrl: "https://upcoming.api.symbols.app",
|
|
79
85
|
githubClientId: "Ov23liWF7NvdZ056RV5J",
|
|
80
|
-
grafanaUrl: "
|
|
86
|
+
grafanaUrl: "",
|
|
81
87
|
// For grafana tracing
|
|
82
88
|
grafanaAppName: "Symbols Upcoming",
|
|
83
89
|
typesenseCollectionName: "docs",
|
|
@@ -93,7 +99,7 @@ var CONFIG = {
|
|
|
93
99
|
basedProject: "platform-v2-sm",
|
|
94
100
|
basedOrg: "symbols",
|
|
95
101
|
githubClientId: "Ov23ligwZDQVD0VfuWNa",
|
|
96
|
-
grafanaUrl: "
|
|
102
|
+
grafanaUrl: "",
|
|
97
103
|
// For grafana tracing
|
|
98
104
|
grafanaAppName: "Symbols Staging",
|
|
99
105
|
typesenseCollectionName: "docs",
|
|
@@ -132,6 +138,11 @@ var getConfig = () => {
|
|
|
132
138
|
const envConfig = { ...CONFIG.common, ...CONFIG[env] };
|
|
133
139
|
const finalConfig = {
|
|
134
140
|
...envConfig,
|
|
141
|
+
// Deep-merge feature flags so env-specific overrides don't drop common defaults
|
|
142
|
+
features: {
|
|
143
|
+
...CONFIG.common.features || {},
|
|
144
|
+
...CONFIG[env] && CONFIG[env].features || {}
|
|
145
|
+
},
|
|
135
146
|
socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
|
|
136
147
|
apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
|
|
137
148
|
basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
|
|
@@ -637,6 +648,39 @@ var BaseService = class {
|
|
|
637
648
|
this._ready = false;
|
|
638
649
|
this._error = error;
|
|
639
650
|
}
|
|
651
|
+
_getTrackingService() {
|
|
652
|
+
var _a;
|
|
653
|
+
const services = (_a = this._context) == null ? void 0 : _a.services;
|
|
654
|
+
const tracking = services == null ? void 0 : services.tracking;
|
|
655
|
+
if (!tracking || typeof tracking.trackError !== "function") {
|
|
656
|
+
return null;
|
|
657
|
+
}
|
|
658
|
+
return tracking;
|
|
659
|
+
}
|
|
660
|
+
_shouldTrackErrors() {
|
|
661
|
+
var _a;
|
|
662
|
+
const name = (_a = this == null ? void 0 : this.constructor) == null ? void 0 : _a.name;
|
|
663
|
+
return name !== "TrackingService";
|
|
664
|
+
}
|
|
665
|
+
_trackServiceError(error, details = {}) {
|
|
666
|
+
var _a;
|
|
667
|
+
if (!this._shouldTrackErrors()) {
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
try {
|
|
671
|
+
const tracking = this._getTrackingService();
|
|
672
|
+
if (!tracking) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const context = {
|
|
676
|
+
service: ((_a = this == null ? void 0 : this.constructor) == null ? void 0 : _a.name) || "UnknownService",
|
|
677
|
+
apiUrl: this._apiUrl || null,
|
|
678
|
+
...details
|
|
679
|
+
};
|
|
680
|
+
tracking.trackError(error instanceof Error ? error : new Error(String(error)), context);
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
}
|
|
640
684
|
_requireAuth() {
|
|
641
685
|
if (!this._context.authToken) {
|
|
642
686
|
throw new Error("Authentication required");
|
|
@@ -686,10 +730,23 @@ var BaseService = class {
|
|
|
686
730
|
error = await response.json();
|
|
687
731
|
} catch {
|
|
688
732
|
}
|
|
733
|
+
this._trackServiceError(
|
|
734
|
+
new Error(error.message || error.error || `HTTP ${response.status}: ${response.statusText}`),
|
|
735
|
+
{
|
|
736
|
+
endpoint,
|
|
737
|
+
methodName: options.methodName,
|
|
738
|
+
status: response.status,
|
|
739
|
+
statusText: response.statusText
|
|
740
|
+
}
|
|
741
|
+
);
|
|
689
742
|
throw new Error(error.message || error.error || "Request failed", { cause: error });
|
|
690
743
|
}
|
|
691
744
|
return response.status === 204 ? null : response.json();
|
|
692
745
|
} catch (error) {
|
|
746
|
+
this._trackServiceError(error, {
|
|
747
|
+
endpoint,
|
|
748
|
+
methodName: options.methodName
|
|
749
|
+
});
|
|
693
750
|
throw new Error(`Request failed: ${error.message}`, { cause: error });
|
|
694
751
|
}
|
|
695
752
|
}
|
|
@@ -1077,7 +1134,14 @@ function preprocessChanges(root, tuples = [], options = {}) {
|
|
|
1077
1134
|
if (!canConsiderExpansion || isFilesPath || value && value.type === "files") {
|
|
1078
1135
|
return [t];
|
|
1079
1136
|
}
|
|
1080
|
-
const
|
|
1137
|
+
const prevRaw = getByPathSafe(root, path);
|
|
1138
|
+
const isCreatePath = Array.isArray(path) && action === "update" && // e.g. ['update', ['components', 'NewKey'], {...}]
|
|
1139
|
+
(!isSchemaPath && path.length === 2 || // e.g. ['update', ['schema', 'components', 'NewKey'], {...}]
|
|
1140
|
+
isSchemaPath && path.length === 3) && (prevRaw === null || typeof prevRaw === "undefined");
|
|
1141
|
+
if (isCreatePath) {
|
|
1142
|
+
return [t];
|
|
1143
|
+
}
|
|
1144
|
+
const prev = prevRaw || {};
|
|
1081
1145
|
const next = value || {};
|
|
1082
1146
|
if (!isPlainObject2(prev) || !isPlainObject2(next)) {
|
|
1083
1147
|
return [t];
|
|
@@ -12,7 +12,9 @@ var CONFIG = {
|
|
|
12
12
|
// Feature toggles that apply across all environments by default
|
|
13
13
|
features: {
|
|
14
14
|
newUserOnboarding: true,
|
|
15
|
-
betaFeatures: false
|
|
15
|
+
betaFeatures: false,
|
|
16
|
+
// Tracking is enabled by default unless overridden per environment
|
|
17
|
+
trackingEnabled: true
|
|
16
18
|
}
|
|
17
19
|
},
|
|
18
20
|
// Environment-specific configurations
|
|
@@ -30,13 +32,17 @@ var CONFIG = {
|
|
|
30
32
|
// For based api
|
|
31
33
|
githubClientId: "Ov23liAFrsR0StbAO6PO",
|
|
32
34
|
// For github api
|
|
33
|
-
grafanaUrl: "
|
|
35
|
+
grafanaUrl: "",
|
|
34
36
|
// For grafana tracing
|
|
35
|
-
grafanaAppName: "Localhost
|
|
37
|
+
grafanaAppName: "Symbols Localhost",
|
|
36
38
|
// Environment-specific feature toggles (override common)
|
|
37
39
|
features: {
|
|
38
|
-
|
|
40
|
+
// Disable tracking by default on localhost/dev machines
|
|
41
|
+
trackingEnabled: false,
|
|
39
42
|
// Enable beta features in local dev
|
|
43
|
+
betaFeatures: true,
|
|
44
|
+
// Preserve common defaults explicitly for local
|
|
45
|
+
newUserOnboarding: true
|
|
40
46
|
},
|
|
41
47
|
typesenseCollectionName: "docs",
|
|
42
48
|
typesenseApiKey: "vZya3L2zpq8L6iI5WWMUZJZABvT63VDb",
|
|
@@ -64,7 +70,7 @@ var CONFIG = {
|
|
|
64
70
|
basedProject: "platform-v2-sm",
|
|
65
71
|
basedOrg: "symbols",
|
|
66
72
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
67
|
-
grafanaUrl: "
|
|
73
|
+
grafanaUrl: "",
|
|
68
74
|
// For grafana tracing
|
|
69
75
|
grafanaAppName: "Symbols Test",
|
|
70
76
|
typesenseCollectionName: "docs",
|
|
@@ -77,7 +83,7 @@ var CONFIG = {
|
|
|
77
83
|
socketUrl: "https://upcoming.api.symbols.app",
|
|
78
84
|
apiUrl: "https://upcoming.api.symbols.app",
|
|
79
85
|
githubClientId: "Ov23liWF7NvdZ056RV5J",
|
|
80
|
-
grafanaUrl: "
|
|
86
|
+
grafanaUrl: "",
|
|
81
87
|
// For grafana tracing
|
|
82
88
|
grafanaAppName: "Symbols Upcoming",
|
|
83
89
|
typesenseCollectionName: "docs",
|
|
@@ -93,7 +99,7 @@ var CONFIG = {
|
|
|
93
99
|
basedProject: "platform-v2-sm",
|
|
94
100
|
basedOrg: "symbols",
|
|
95
101
|
githubClientId: "Ov23ligwZDQVD0VfuWNa",
|
|
96
|
-
grafanaUrl: "
|
|
102
|
+
grafanaUrl: "",
|
|
97
103
|
// For grafana tracing
|
|
98
104
|
grafanaAppName: "Symbols Staging",
|
|
99
105
|
typesenseCollectionName: "docs",
|
|
@@ -132,6 +138,11 @@ var getConfig = () => {
|
|
|
132
138
|
const envConfig = { ...CONFIG.common, ...CONFIG[env] };
|
|
133
139
|
const finalConfig = {
|
|
134
140
|
...envConfig,
|
|
141
|
+
// Deep-merge feature flags so env-specific overrides don't drop common defaults
|
|
142
|
+
features: {
|
|
143
|
+
...CONFIG.common.features || {},
|
|
144
|
+
...CONFIG[env] && CONFIG[env].features || {}
|
|
145
|
+
},
|
|
135
146
|
socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
|
|
136
147
|
apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
|
|
137
148
|
basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
|
|
@@ -637,6 +648,39 @@ var BaseService = class {
|
|
|
637
648
|
this._ready = false;
|
|
638
649
|
this._error = error;
|
|
639
650
|
}
|
|
651
|
+
_getTrackingService() {
|
|
652
|
+
var _a;
|
|
653
|
+
const services = (_a = this._context) == null ? void 0 : _a.services;
|
|
654
|
+
const tracking = services == null ? void 0 : services.tracking;
|
|
655
|
+
if (!tracking || typeof tracking.trackError !== "function") {
|
|
656
|
+
return null;
|
|
657
|
+
}
|
|
658
|
+
return tracking;
|
|
659
|
+
}
|
|
660
|
+
_shouldTrackErrors() {
|
|
661
|
+
var _a;
|
|
662
|
+
const name = (_a = this == null ? void 0 : this.constructor) == null ? void 0 : _a.name;
|
|
663
|
+
return name !== "TrackingService";
|
|
664
|
+
}
|
|
665
|
+
_trackServiceError(error, details = {}) {
|
|
666
|
+
var _a;
|
|
667
|
+
if (!this._shouldTrackErrors()) {
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
try {
|
|
671
|
+
const tracking = this._getTrackingService();
|
|
672
|
+
if (!tracking) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const context = {
|
|
676
|
+
service: ((_a = this == null ? void 0 : this.constructor) == null ? void 0 : _a.name) || "UnknownService",
|
|
677
|
+
apiUrl: this._apiUrl || null,
|
|
678
|
+
...details
|
|
679
|
+
};
|
|
680
|
+
tracking.trackError(error instanceof Error ? error : new Error(String(error)), context);
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
}
|
|
640
684
|
_requireAuth() {
|
|
641
685
|
if (!this._context.authToken) {
|
|
642
686
|
throw new Error("Authentication required");
|
|
@@ -686,10 +730,23 @@ var BaseService = class {
|
|
|
686
730
|
error = await response.json();
|
|
687
731
|
} catch {
|
|
688
732
|
}
|
|
733
|
+
this._trackServiceError(
|
|
734
|
+
new Error(error.message || error.error || `HTTP ${response.status}: ${response.statusText}`),
|
|
735
|
+
{
|
|
736
|
+
endpoint,
|
|
737
|
+
methodName: options.methodName,
|
|
738
|
+
status: response.status,
|
|
739
|
+
statusText: response.statusText
|
|
740
|
+
}
|
|
741
|
+
);
|
|
689
742
|
throw new Error(error.message || error.error || "Request failed", { cause: error });
|
|
690
743
|
}
|
|
691
744
|
return response.status === 204 ? null : response.json();
|
|
692
745
|
} catch (error) {
|
|
746
|
+
this._trackServiceError(error, {
|
|
747
|
+
endpoint,
|
|
748
|
+
methodName: options.methodName
|
|
749
|
+
});
|
|
693
750
|
throw new Error(`Request failed: ${error.message}`, { cause: error });
|
|
694
751
|
}
|
|
695
752
|
}
|
|
@@ -12,7 +12,9 @@ var CONFIG = {
|
|
|
12
12
|
// Feature toggles that apply across all environments by default
|
|
13
13
|
features: {
|
|
14
14
|
newUserOnboarding: true,
|
|
15
|
-
betaFeatures: false
|
|
15
|
+
betaFeatures: false,
|
|
16
|
+
// Tracking is enabled by default unless overridden per environment
|
|
17
|
+
trackingEnabled: true
|
|
16
18
|
}
|
|
17
19
|
},
|
|
18
20
|
// Environment-specific configurations
|
|
@@ -30,13 +32,17 @@ var CONFIG = {
|
|
|
30
32
|
// For based api
|
|
31
33
|
githubClientId: "Ov23liAFrsR0StbAO6PO",
|
|
32
34
|
// For github api
|
|
33
|
-
grafanaUrl: "
|
|
35
|
+
grafanaUrl: "",
|
|
34
36
|
// For grafana tracing
|
|
35
|
-
grafanaAppName: "Localhost
|
|
37
|
+
grafanaAppName: "Symbols Localhost",
|
|
36
38
|
// Environment-specific feature toggles (override common)
|
|
37
39
|
features: {
|
|
38
|
-
|
|
40
|
+
// Disable tracking by default on localhost/dev machines
|
|
41
|
+
trackingEnabled: false,
|
|
39
42
|
// Enable beta features in local dev
|
|
43
|
+
betaFeatures: true,
|
|
44
|
+
// Preserve common defaults explicitly for local
|
|
45
|
+
newUserOnboarding: true
|
|
40
46
|
},
|
|
41
47
|
typesenseCollectionName: "docs",
|
|
42
48
|
typesenseApiKey: "vZya3L2zpq8L6iI5WWMUZJZABvT63VDb",
|
|
@@ -64,7 +70,7 @@ var CONFIG = {
|
|
|
64
70
|
basedProject: "platform-v2-sm",
|
|
65
71
|
basedOrg: "symbols",
|
|
66
72
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
67
|
-
grafanaUrl: "
|
|
73
|
+
grafanaUrl: "",
|
|
68
74
|
// For grafana tracing
|
|
69
75
|
grafanaAppName: "Symbols Test",
|
|
70
76
|
typesenseCollectionName: "docs",
|
|
@@ -77,7 +83,7 @@ var CONFIG = {
|
|
|
77
83
|
socketUrl: "https://upcoming.api.symbols.app",
|
|
78
84
|
apiUrl: "https://upcoming.api.symbols.app",
|
|
79
85
|
githubClientId: "Ov23liWF7NvdZ056RV5J",
|
|
80
|
-
grafanaUrl: "
|
|
86
|
+
grafanaUrl: "",
|
|
81
87
|
// For grafana tracing
|
|
82
88
|
grafanaAppName: "Symbols Upcoming",
|
|
83
89
|
typesenseCollectionName: "docs",
|
|
@@ -93,7 +99,7 @@ var CONFIG = {
|
|
|
93
99
|
basedProject: "platform-v2-sm",
|
|
94
100
|
basedOrg: "symbols",
|
|
95
101
|
githubClientId: "Ov23ligwZDQVD0VfuWNa",
|
|
96
|
-
grafanaUrl: "
|
|
102
|
+
grafanaUrl: "",
|
|
97
103
|
// For grafana tracing
|
|
98
104
|
grafanaAppName: "Symbols Staging",
|
|
99
105
|
typesenseCollectionName: "docs",
|
|
@@ -132,6 +138,11 @@ var getConfig = () => {
|
|
|
132
138
|
const envConfig = { ...CONFIG.common, ...CONFIG[env] };
|
|
133
139
|
const finalConfig = {
|
|
134
140
|
...envConfig,
|
|
141
|
+
// Deep-merge feature flags so env-specific overrides don't drop common defaults
|
|
142
|
+
features: {
|
|
143
|
+
...CONFIG.common.features || {},
|
|
144
|
+
...CONFIG[env] && CONFIG[env].features || {}
|
|
145
|
+
},
|
|
135
146
|
socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
|
|
136
147
|
apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
|
|
137
148
|
basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
|
|
@@ -637,6 +648,39 @@ var BaseService = class {
|
|
|
637
648
|
this._ready = false;
|
|
638
649
|
this._error = error;
|
|
639
650
|
}
|
|
651
|
+
_getTrackingService() {
|
|
652
|
+
var _a;
|
|
653
|
+
const services = (_a = this._context) == null ? void 0 : _a.services;
|
|
654
|
+
const tracking = services == null ? void 0 : services.tracking;
|
|
655
|
+
if (!tracking || typeof tracking.trackError !== "function") {
|
|
656
|
+
return null;
|
|
657
|
+
}
|
|
658
|
+
return tracking;
|
|
659
|
+
}
|
|
660
|
+
_shouldTrackErrors() {
|
|
661
|
+
var _a;
|
|
662
|
+
const name = (_a = this == null ? void 0 : this.constructor) == null ? void 0 : _a.name;
|
|
663
|
+
return name !== "TrackingService";
|
|
664
|
+
}
|
|
665
|
+
_trackServiceError(error, details = {}) {
|
|
666
|
+
var _a;
|
|
667
|
+
if (!this._shouldTrackErrors()) {
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
try {
|
|
671
|
+
const tracking = this._getTrackingService();
|
|
672
|
+
if (!tracking) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const context = {
|
|
676
|
+
service: ((_a = this == null ? void 0 : this.constructor) == null ? void 0 : _a.name) || "UnknownService",
|
|
677
|
+
apiUrl: this._apiUrl || null,
|
|
678
|
+
...details
|
|
679
|
+
};
|
|
680
|
+
tracking.trackError(error instanceof Error ? error : new Error(String(error)), context);
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
}
|
|
640
684
|
_requireAuth() {
|
|
641
685
|
if (!this._context.authToken) {
|
|
642
686
|
throw new Error("Authentication required");
|
|
@@ -686,10 +730,23 @@ var BaseService = class {
|
|
|
686
730
|
error = await response.json();
|
|
687
731
|
} catch {
|
|
688
732
|
}
|
|
733
|
+
this._trackServiceError(
|
|
734
|
+
new Error(error.message || error.error || `HTTP ${response.status}: ${response.statusText}`),
|
|
735
|
+
{
|
|
736
|
+
endpoint,
|
|
737
|
+
methodName: options.methodName,
|
|
738
|
+
status: response.status,
|
|
739
|
+
statusText: response.statusText
|
|
740
|
+
}
|
|
741
|
+
);
|
|
689
742
|
throw new Error(error.message || error.error || "Request failed", { cause: error });
|
|
690
743
|
}
|
|
691
744
|
return response.status === 204 ? null : response.json();
|
|
692
745
|
} catch (error) {
|
|
746
|
+
this._trackServiceError(error, {
|
|
747
|
+
endpoint,
|
|
748
|
+
methodName: options.methodName
|
|
749
|
+
});
|
|
693
750
|
throw new Error(`Request failed: ${error.message}`, { cause: error });
|
|
694
751
|
}
|
|
695
752
|
}
|
|
@@ -12,7 +12,9 @@ var CONFIG = {
|
|
|
12
12
|
// Feature toggles that apply across all environments by default
|
|
13
13
|
features: {
|
|
14
14
|
newUserOnboarding: true,
|
|
15
|
-
betaFeatures: false
|
|
15
|
+
betaFeatures: false,
|
|
16
|
+
// Tracking is enabled by default unless overridden per environment
|
|
17
|
+
trackingEnabled: true
|
|
16
18
|
}
|
|
17
19
|
},
|
|
18
20
|
// Environment-specific configurations
|
|
@@ -30,13 +32,17 @@ var CONFIG = {
|
|
|
30
32
|
// For based api
|
|
31
33
|
githubClientId: "Ov23liAFrsR0StbAO6PO",
|
|
32
34
|
// For github api
|
|
33
|
-
grafanaUrl: "
|
|
35
|
+
grafanaUrl: "",
|
|
34
36
|
// For grafana tracing
|
|
35
|
-
grafanaAppName: "Localhost
|
|
37
|
+
grafanaAppName: "Symbols Localhost",
|
|
36
38
|
// Environment-specific feature toggles (override common)
|
|
37
39
|
features: {
|
|
38
|
-
|
|
40
|
+
// Disable tracking by default on localhost/dev machines
|
|
41
|
+
trackingEnabled: false,
|
|
39
42
|
// Enable beta features in local dev
|
|
43
|
+
betaFeatures: true,
|
|
44
|
+
// Preserve common defaults explicitly for local
|
|
45
|
+
newUserOnboarding: true
|
|
40
46
|
},
|
|
41
47
|
typesenseCollectionName: "docs",
|
|
42
48
|
typesenseApiKey: "vZya3L2zpq8L6iI5WWMUZJZABvT63VDb",
|
|
@@ -64,7 +70,7 @@ var CONFIG = {
|
|
|
64
70
|
basedProject: "platform-v2-sm",
|
|
65
71
|
basedOrg: "symbols",
|
|
66
72
|
githubClientId: "Ov23liHxyWFBxS8f1gnF",
|
|
67
|
-
grafanaUrl: "
|
|
73
|
+
grafanaUrl: "",
|
|
68
74
|
// For grafana tracing
|
|
69
75
|
grafanaAppName: "Symbols Test",
|
|
70
76
|
typesenseCollectionName: "docs",
|
|
@@ -77,7 +83,7 @@ var CONFIG = {
|
|
|
77
83
|
socketUrl: "https://upcoming.api.symbols.app",
|
|
78
84
|
apiUrl: "https://upcoming.api.symbols.app",
|
|
79
85
|
githubClientId: "Ov23liWF7NvdZ056RV5J",
|
|
80
|
-
grafanaUrl: "
|
|
86
|
+
grafanaUrl: "",
|
|
81
87
|
// For grafana tracing
|
|
82
88
|
grafanaAppName: "Symbols Upcoming",
|
|
83
89
|
typesenseCollectionName: "docs",
|
|
@@ -93,7 +99,7 @@ var CONFIG = {
|
|
|
93
99
|
basedProject: "platform-v2-sm",
|
|
94
100
|
basedOrg: "symbols",
|
|
95
101
|
githubClientId: "Ov23ligwZDQVD0VfuWNa",
|
|
96
|
-
grafanaUrl: "
|
|
102
|
+
grafanaUrl: "",
|
|
97
103
|
// For grafana tracing
|
|
98
104
|
grafanaAppName: "Symbols Staging",
|
|
99
105
|
typesenseCollectionName: "docs",
|
|
@@ -132,6 +138,11 @@ var getConfig = () => {
|
|
|
132
138
|
const envConfig = { ...CONFIG.common, ...CONFIG[env] };
|
|
133
139
|
const finalConfig = {
|
|
134
140
|
...envConfig,
|
|
141
|
+
// Deep-merge feature flags so env-specific overrides don't drop common defaults
|
|
142
|
+
features: {
|
|
143
|
+
...CONFIG.common.features || {},
|
|
144
|
+
...CONFIG[env] && CONFIG[env].features || {}
|
|
145
|
+
},
|
|
135
146
|
socketUrl: process.env.SYMBOLS_APP_SOCKET_URL || envConfig.socketUrl,
|
|
136
147
|
apiUrl: process.env.SYMBOLS_APP_API_URL || envConfig.apiUrl,
|
|
137
148
|
basedEnv: process.env.SYMBOLS_APP_BASED_ENV || envConfig.basedEnv,
|
|
@@ -637,6 +648,39 @@ var BaseService = class {
|
|
|
637
648
|
this._ready = false;
|
|
638
649
|
this._error = error;
|
|
639
650
|
}
|
|
651
|
+
_getTrackingService() {
|
|
652
|
+
var _a;
|
|
653
|
+
const services = (_a = this._context) == null ? void 0 : _a.services;
|
|
654
|
+
const tracking = services == null ? void 0 : services.tracking;
|
|
655
|
+
if (!tracking || typeof tracking.trackError !== "function") {
|
|
656
|
+
return null;
|
|
657
|
+
}
|
|
658
|
+
return tracking;
|
|
659
|
+
}
|
|
660
|
+
_shouldTrackErrors() {
|
|
661
|
+
var _a;
|
|
662
|
+
const name = (_a = this == null ? void 0 : this.constructor) == null ? void 0 : _a.name;
|
|
663
|
+
return name !== "TrackingService";
|
|
664
|
+
}
|
|
665
|
+
_trackServiceError(error, details = {}) {
|
|
666
|
+
var _a;
|
|
667
|
+
if (!this._shouldTrackErrors()) {
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
try {
|
|
671
|
+
const tracking = this._getTrackingService();
|
|
672
|
+
if (!tracking) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const context = {
|
|
676
|
+
service: ((_a = this == null ? void 0 : this.constructor) == null ? void 0 : _a.name) || "UnknownService",
|
|
677
|
+
apiUrl: this._apiUrl || null,
|
|
678
|
+
...details
|
|
679
|
+
};
|
|
680
|
+
tracking.trackError(error instanceof Error ? error : new Error(String(error)), context);
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
}
|
|
640
684
|
_requireAuth() {
|
|
641
685
|
if (!this._context.authToken) {
|
|
642
686
|
throw new Error("Authentication required");
|
|
@@ -686,10 +730,23 @@ var BaseService = class {
|
|
|
686
730
|
error = await response.json();
|
|
687
731
|
} catch {
|
|
688
732
|
}
|
|
733
|
+
this._trackServiceError(
|
|
734
|
+
new Error(error.message || error.error || `HTTP ${response.status}: ${response.statusText}`),
|
|
735
|
+
{
|
|
736
|
+
endpoint,
|
|
737
|
+
methodName: options.methodName,
|
|
738
|
+
status: response.status,
|
|
739
|
+
statusText: response.statusText
|
|
740
|
+
}
|
|
741
|
+
);
|
|
689
742
|
throw new Error(error.message || error.error || "Request failed", { cause: error });
|
|
690
743
|
}
|
|
691
744
|
return response.status === 204 ? null : response.json();
|
|
692
745
|
} catch (error) {
|
|
746
|
+
this._trackServiceError(error, {
|
|
747
|
+
endpoint,
|
|
748
|
+
methodName: options.methodName
|
|
749
|
+
});
|
|
693
750
|
throw new Error(`Request failed: ${error.message}`, { cause: error });
|
|
694
751
|
}
|
|
695
752
|
}
|