@codeguide/core 0.0.2 → 0.0.4
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.
|
@@ -30,6 +30,22 @@ class BaseService {
|
|
|
30
30
|
headers['Authorization'] = `Bearer ${this.config.databaseApiKey}`;
|
|
31
31
|
return headers;
|
|
32
32
|
}
|
|
33
|
+
// Priority 2: Legacy API Key + User ID
|
|
34
|
+
if (this.config.apiKey && this.config.userId) {
|
|
35
|
+
headers['X-API-Key'] = this.config.apiKey;
|
|
36
|
+
headers['X-User-ID'] = this.config.userId;
|
|
37
|
+
return headers;
|
|
38
|
+
}
|
|
39
|
+
// Priority 3: Clerk JWT Token
|
|
40
|
+
if (this.config.jwtToken) {
|
|
41
|
+
headers['Authorization'] = `Bearer ${this.config.jwtToken}`;
|
|
42
|
+
return headers;
|
|
43
|
+
}
|
|
44
|
+
// Fallback: Legacy API key without user ID
|
|
45
|
+
if (this.config.apiKey) {
|
|
46
|
+
headers['X-API-Key'] = this.config.apiKey;
|
|
47
|
+
return headers;
|
|
48
|
+
}
|
|
33
49
|
return headers;
|
|
34
50
|
}
|
|
35
51
|
/**
|
package/package.json
CHANGED
|
@@ -35,6 +35,25 @@ export abstract class BaseService {
|
|
|
35
35
|
return headers
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
// Priority 2: Legacy API Key + User ID
|
|
39
|
+
if (this.config.apiKey && this.config.userId) {
|
|
40
|
+
headers['X-API-Key'] = this.config.apiKey
|
|
41
|
+
headers['X-User-ID'] = this.config.userId
|
|
42
|
+
return headers
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Priority 3: Clerk JWT Token
|
|
46
|
+
if (this.config.jwtToken) {
|
|
47
|
+
headers['Authorization'] = `Bearer ${this.config.jwtToken}`
|
|
48
|
+
return headers
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Fallback: Legacy API key without user ID
|
|
52
|
+
if (this.config.apiKey) {
|
|
53
|
+
headers['X-API-Key'] = this.config.apiKey
|
|
54
|
+
return headers
|
|
55
|
+
}
|
|
56
|
+
|
|
38
57
|
return headers
|
|
39
58
|
}
|
|
40
59
|
|