spaps-sdk 1.6.0 → 1.6.1
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/dist/index.js +15 -20
- package/dist/index.mjs +15 -20
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -648,28 +648,23 @@ var SPAPSClient = class {
|
|
|
648
648
|
}
|
|
649
649
|
if (!apiUrl || apiUrl.includes("localhost") || apiUrl.includes("127.0.0.1")) {
|
|
650
650
|
this._isLocalMode = true;
|
|
651
|
-
this.client = import_axios.default.create({
|
|
652
|
-
baseURL: apiUrl || "http://localhost:3301",
|
|
653
|
-
timeout: config.timeout || 1e4,
|
|
654
|
-
headers: {
|
|
655
|
-
"Content-Type": "application/json"
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
} else {
|
|
659
|
-
if (!effectiveApiKey) {
|
|
660
|
-
console.warn("\u26A0\uFE0F SPAPS: No API key provided. Some features may not work.");
|
|
661
|
-
}
|
|
662
|
-
this.apiKey = effectiveApiKey;
|
|
663
|
-
this.client = import_axios.default.create({
|
|
664
|
-
baseURL: apiUrl,
|
|
665
|
-
timeout: config.timeout || 1e4,
|
|
666
|
-
headers: {
|
|
667
|
-
"Content-Type": "application/json",
|
|
668
|
-
...this.apiKey && { "X-API-Key": this.apiKey }
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
651
|
}
|
|
652
|
+
this.apiKey = effectiveApiKey;
|
|
653
|
+
if (!this.apiKey && !this._isLocalMode) {
|
|
654
|
+
console.warn("\u26A0\uFE0F SPAPS: No API key provided. Some features may not work.");
|
|
655
|
+
}
|
|
656
|
+
this.client = import_axios.default.create({
|
|
657
|
+
baseURL: apiUrl || "http://localhost:3301",
|
|
658
|
+
timeout: config.timeout || 1e4,
|
|
659
|
+
headers: {
|
|
660
|
+
"Content-Type": "application/json",
|
|
661
|
+
...this.apiKey && { "X-API-Key": this.apiKey }
|
|
662
|
+
}
|
|
663
|
+
});
|
|
672
664
|
this.client.interceptors.request.use((config2) => {
|
|
665
|
+
if (this.apiKey && !config2.headers["X-API-Key"]) {
|
|
666
|
+
config2.headers["X-API-Key"] = this.apiKey;
|
|
667
|
+
}
|
|
673
668
|
if (this.accessToken && !config2.headers.Authorization) {
|
|
674
669
|
config2.headers.Authorization = `Bearer ${this.accessToken}`;
|
|
675
670
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -618,28 +618,23 @@ var SPAPSClient = class {
|
|
|
618
618
|
}
|
|
619
619
|
if (!apiUrl || apiUrl.includes("localhost") || apiUrl.includes("127.0.0.1")) {
|
|
620
620
|
this._isLocalMode = true;
|
|
621
|
-
this.client = axios.create({
|
|
622
|
-
baseURL: apiUrl || "http://localhost:3301",
|
|
623
|
-
timeout: config.timeout || 1e4,
|
|
624
|
-
headers: {
|
|
625
|
-
"Content-Type": "application/json"
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
} else {
|
|
629
|
-
if (!effectiveApiKey) {
|
|
630
|
-
console.warn("\u26A0\uFE0F SPAPS: No API key provided. Some features may not work.");
|
|
631
|
-
}
|
|
632
|
-
this.apiKey = effectiveApiKey;
|
|
633
|
-
this.client = axios.create({
|
|
634
|
-
baseURL: apiUrl,
|
|
635
|
-
timeout: config.timeout || 1e4,
|
|
636
|
-
headers: {
|
|
637
|
-
"Content-Type": "application/json",
|
|
638
|
-
...this.apiKey && { "X-API-Key": this.apiKey }
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
621
|
}
|
|
622
|
+
this.apiKey = effectiveApiKey;
|
|
623
|
+
if (!this.apiKey && !this._isLocalMode) {
|
|
624
|
+
console.warn("\u26A0\uFE0F SPAPS: No API key provided. Some features may not work.");
|
|
625
|
+
}
|
|
626
|
+
this.client = axios.create({
|
|
627
|
+
baseURL: apiUrl || "http://localhost:3301",
|
|
628
|
+
timeout: config.timeout || 1e4,
|
|
629
|
+
headers: {
|
|
630
|
+
"Content-Type": "application/json",
|
|
631
|
+
...this.apiKey && { "X-API-Key": this.apiKey }
|
|
632
|
+
}
|
|
633
|
+
});
|
|
642
634
|
this.client.interceptors.request.use((config2) => {
|
|
635
|
+
if (this.apiKey && !config2.headers["X-API-Key"]) {
|
|
636
|
+
config2.headers["X-API-Key"] = this.apiKey;
|
|
637
|
+
}
|
|
643
638
|
if (this.accessToken && !config2.headers.Authorization) {
|
|
644
639
|
config2.headers.Authorization = `Bearer ${this.accessToken}`;
|
|
645
640
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spaps-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Sweet Potato Authentication & Payment Service SDK - Zero-config client with built-in permission checking, role-based access control, and dayrate scheduling",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -75,4 +75,4 @@
|
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=14.0.0"
|
|
77
77
|
}
|
|
78
|
-
}
|
|
78
|
+
}
|