@gpt-core/admin 0.10.13 → 0.10.20
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.d.mts +164 -10
- package/dist/index.d.ts +164 -10
- package/dist/index.js +39 -1
- package/dist/index.mjs +39 -1
- package/llms.txt +1 -0
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -869,14 +869,35 @@ var client = createClient(
|
|
|
869
869
|
|
|
870
870
|
// src/base-client.ts
|
|
871
871
|
var DEFAULT_API_VERSION = "2025-12-03";
|
|
872
|
+
function isSecureUrl(url) {
|
|
873
|
+
try {
|
|
874
|
+
const parsed = new URL(url);
|
|
875
|
+
if (parsed.protocol === "https:") return true;
|
|
876
|
+
if (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") return true;
|
|
877
|
+
return false;
|
|
878
|
+
} catch {
|
|
879
|
+
return false;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
872
882
|
var BaseClient = class {
|
|
873
883
|
constructor(config = {}) {
|
|
874
884
|
this.config = config;
|
|
875
885
|
this.apiVersion = config.apiVersion ?? DEFAULT_API_VERSION;
|
|
886
|
+
if (config.baseUrl && !isSecureUrl(config.baseUrl)) {
|
|
887
|
+
console.warn(
|
|
888
|
+
"[GPT Core SDK] Warning: Using non-HTTPS URL. Credentials may be transmitted insecurely. Use HTTPS in production environments."
|
|
889
|
+
);
|
|
890
|
+
}
|
|
876
891
|
if (config.baseUrl) {
|
|
877
892
|
client.setConfig({ baseUrl: config.baseUrl });
|
|
878
893
|
}
|
|
879
894
|
client.interceptors.request.use((req) => {
|
|
895
|
+
const requestUrl = req.url || config.baseUrl || "";
|
|
896
|
+
if ((config.apiKey || config.token) && !isSecureUrl(requestUrl)) {
|
|
897
|
+
console.warn(
|
|
898
|
+
"[GPT Core SDK] Warning: Sending credentials over non-HTTPS connection."
|
|
899
|
+
);
|
|
900
|
+
}
|
|
880
901
|
req.headers.set("Accept", `application/vnd.api+json; version=${this.apiVersion}`);
|
|
881
902
|
req.headers.set("Content-Type", "application/vnd.api+json");
|
|
882
903
|
if (config.apiKey) {
|
|
@@ -1539,10 +1560,27 @@ function handleApiError(error) {
|
|
|
1539
1560
|
} else if (error?.message) {
|
|
1540
1561
|
message = error.message;
|
|
1541
1562
|
}
|
|
1563
|
+
const sensitiveHeaderPatterns = [
|
|
1564
|
+
"set-cookie",
|
|
1565
|
+
"authorization",
|
|
1566
|
+
"x-application-key",
|
|
1567
|
+
"cookie",
|
|
1568
|
+
"x-forwarded-for",
|
|
1569
|
+
"x-real-ip"
|
|
1570
|
+
];
|
|
1571
|
+
const filterSensitiveHeaders = (hdrs) => {
|
|
1572
|
+
if (!hdrs) return void 0;
|
|
1573
|
+
const entries = hdrs instanceof Headers ? Array.from(hdrs.entries()) : Object.entries(hdrs);
|
|
1574
|
+
const filtered = entries.filter(([key]) => {
|
|
1575
|
+
const lowerKey = key.toLowerCase();
|
|
1576
|
+
return !sensitiveHeaderPatterns.some((pattern) => lowerKey.includes(pattern));
|
|
1577
|
+
});
|
|
1578
|
+
return filtered.length > 0 ? Object.fromEntries(filtered) : void 0;
|
|
1579
|
+
};
|
|
1542
1580
|
const errorOptions = {
|
|
1543
1581
|
statusCode,
|
|
1544
1582
|
requestId,
|
|
1545
|
-
headers:
|
|
1583
|
+
headers: filterSensitiveHeaders(headers),
|
|
1546
1584
|
body,
|
|
1547
1585
|
cause: error
|
|
1548
1586
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -820,14 +820,35 @@ var client = createClient(
|
|
|
820
820
|
|
|
821
821
|
// src/base-client.ts
|
|
822
822
|
var DEFAULT_API_VERSION = "2025-12-03";
|
|
823
|
+
function isSecureUrl(url) {
|
|
824
|
+
try {
|
|
825
|
+
const parsed = new URL(url);
|
|
826
|
+
if (parsed.protocol === "https:") return true;
|
|
827
|
+
if (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") return true;
|
|
828
|
+
return false;
|
|
829
|
+
} catch {
|
|
830
|
+
return false;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
823
833
|
var BaseClient = class {
|
|
824
834
|
constructor(config = {}) {
|
|
825
835
|
this.config = config;
|
|
826
836
|
this.apiVersion = config.apiVersion ?? DEFAULT_API_VERSION;
|
|
837
|
+
if (config.baseUrl && !isSecureUrl(config.baseUrl)) {
|
|
838
|
+
console.warn(
|
|
839
|
+
"[GPT Core SDK] Warning: Using non-HTTPS URL. Credentials may be transmitted insecurely. Use HTTPS in production environments."
|
|
840
|
+
);
|
|
841
|
+
}
|
|
827
842
|
if (config.baseUrl) {
|
|
828
843
|
client.setConfig({ baseUrl: config.baseUrl });
|
|
829
844
|
}
|
|
830
845
|
client.interceptors.request.use((req) => {
|
|
846
|
+
const requestUrl = req.url || config.baseUrl || "";
|
|
847
|
+
if ((config.apiKey || config.token) && !isSecureUrl(requestUrl)) {
|
|
848
|
+
console.warn(
|
|
849
|
+
"[GPT Core SDK] Warning: Sending credentials over non-HTTPS connection."
|
|
850
|
+
);
|
|
851
|
+
}
|
|
831
852
|
req.headers.set("Accept", `application/vnd.api+json; version=${this.apiVersion}`);
|
|
832
853
|
req.headers.set("Content-Type", "application/vnd.api+json");
|
|
833
854
|
if (config.apiKey) {
|
|
@@ -1490,10 +1511,27 @@ function handleApiError(error) {
|
|
|
1490
1511
|
} else if (error?.message) {
|
|
1491
1512
|
message = error.message;
|
|
1492
1513
|
}
|
|
1514
|
+
const sensitiveHeaderPatterns = [
|
|
1515
|
+
"set-cookie",
|
|
1516
|
+
"authorization",
|
|
1517
|
+
"x-application-key",
|
|
1518
|
+
"cookie",
|
|
1519
|
+
"x-forwarded-for",
|
|
1520
|
+
"x-real-ip"
|
|
1521
|
+
];
|
|
1522
|
+
const filterSensitiveHeaders = (hdrs) => {
|
|
1523
|
+
if (!hdrs) return void 0;
|
|
1524
|
+
const entries = hdrs instanceof Headers ? Array.from(hdrs.entries()) : Object.entries(hdrs);
|
|
1525
|
+
const filtered = entries.filter(([key]) => {
|
|
1526
|
+
const lowerKey = key.toLowerCase();
|
|
1527
|
+
return !sensitiveHeaderPatterns.some((pattern) => lowerKey.includes(pattern));
|
|
1528
|
+
});
|
|
1529
|
+
return filtered.length > 0 ? Object.fromEntries(filtered) : void 0;
|
|
1530
|
+
};
|
|
1493
1531
|
const errorOptions = {
|
|
1494
1532
|
statusCode,
|
|
1495
1533
|
requestId,
|
|
1496
|
-
headers:
|
|
1534
|
+
headers: filterSensitiveHeaders(headers),
|
|
1497
1535
|
body,
|
|
1498
1536
|
cause: error
|
|
1499
1537
|
};
|
package/llms.txt
CHANGED
|
@@ -304,6 +304,7 @@ client.setConfig({
|
|
|
304
304
|
- `getExtractionResults()` - List results
|
|
305
305
|
- `getExtractionResultsById()` - Get results
|
|
306
306
|
- `getExtractionResultsDocumentByDocumentId()` - Get document
|
|
307
|
+
- `getExtractionResultsDocumentByDocumentIdHistory()` - Get history
|
|
307
308
|
- `getExtractionResultsWorkspaceByWorkspaceId()` - Get workspace
|
|
308
309
|
- `patchExtractionResultsById()` - Update results
|
|
309
310
|
- `patchExtractionResultsByIdRegenerate()` - Update regenerate
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gpt-core/admin",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.20",
|
|
4
4
|
"description": "TypeScript SDK for GPT Core Admin API - Platform administration and ISV management",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -51,15 +51,6 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"scripts": {
|
|
55
|
-
"generate": "openapi-ts",
|
|
56
|
-
"typecheck": "tsc --noEmit",
|
|
57
|
-
"build": "npm run typecheck && tsup src/index.ts --format cjs,esm --dts",
|
|
58
|
-
"test": "vitest run",
|
|
59
|
-
"test:watch": "vitest",
|
|
60
|
-
"test:ui": "vitest --ui",
|
|
61
|
-
"test:coverage": "vitest run --coverage"
|
|
62
|
-
},
|
|
63
54
|
"dependencies": {
|
|
64
55
|
"zod": "^3.25.76"
|
|
65
56
|
},
|
|
@@ -71,5 +62,14 @@
|
|
|
71
62
|
"tsup": "^8.5.1",
|
|
72
63
|
"typescript": "^5.9.3",
|
|
73
64
|
"vitest": "^4.0.15"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"generate": "bunx openapi-ts",
|
|
68
|
+
"typecheck": "bunx tsc --noEmit",
|
|
69
|
+
"build": "bun run typecheck && bunx tsup src/index.ts --format cjs,esm --dts",
|
|
70
|
+
"test": "bunx vitest run",
|
|
71
|
+
"test:watch": "bunx vitest",
|
|
72
|
+
"test:ui": "bunx vitest --ui",
|
|
73
|
+
"test:coverage": "bunx vitest run --coverage"
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|