@gpt-core/admin 0.11.0 → 0.11.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.d.mts +22 -10
- package/dist/index.d.ts +22 -10
- package/dist/index.js +16 -14
- package/dist/index.mjs +16 -14
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1767,6 +1767,10 @@ type DocumentStats = {
|
|
|
1767
1767
|
* Field included by default.
|
|
1768
1768
|
*/
|
|
1769
1769
|
completed?: number | null | unknown;
|
|
1770
|
+
/**
|
|
1771
|
+
* Field included by default.
|
|
1772
|
+
*/
|
|
1773
|
+
duplicate?: number | null | unknown;
|
|
1770
1774
|
/**
|
|
1771
1775
|
* Field included by default.
|
|
1772
1776
|
*/
|
|
@@ -3268,6 +3272,10 @@ type WorkspaceDocumentStats = {
|
|
|
3268
3272
|
* Field included by default.
|
|
3269
3273
|
*/
|
|
3270
3274
|
completed?: number | null | unknown;
|
|
3275
|
+
/**
|
|
3276
|
+
* Field included by default.
|
|
3277
|
+
*/
|
|
3278
|
+
duplicate?: number | null | unknown;
|
|
3271
3279
|
/**
|
|
3272
3280
|
* Field included by default.
|
|
3273
3281
|
*/
|
|
@@ -5144,6 +5152,10 @@ type TenantDocumentStats = {
|
|
|
5144
5152
|
* Field included by default.
|
|
5145
5153
|
*/
|
|
5146
5154
|
completed?: number | null | unknown;
|
|
5155
|
+
/**
|
|
5156
|
+
* Field included by default.
|
|
5157
|
+
*/
|
|
5158
|
+
duplicate?: number | null | unknown;
|
|
5147
5159
|
/**
|
|
5148
5160
|
* Field included by default.
|
|
5149
5161
|
*/
|
|
@@ -5974,7 +5986,7 @@ type ExtractionDocument = {
|
|
|
5974
5986
|
/**
|
|
5975
5987
|
* Field included by default.
|
|
5976
5988
|
*/
|
|
5977
|
-
status?: "queued" | "processing" | "completed" | "failed" | "cancelled" | "pending_credits" | unknown;
|
|
5989
|
+
status?: "queued" | "processing" | "completed" | "failed" | "duplicate" | "cancelled" | "pending_credits" | unknown;
|
|
5978
5990
|
/**
|
|
5979
5991
|
* Field included by default.
|
|
5980
5992
|
*/
|
|
@@ -34142,7 +34154,7 @@ type PatchAdminExtractionDocumentsByIdStatusData = {
|
|
|
34142
34154
|
* State or province code (2-letter)
|
|
34143
34155
|
*/
|
|
34144
34156
|
state?: string | unknown;
|
|
34145
|
-
status?: "queued" | "processing" | "completed" | "failed" | "cancelled" | "pending_credits" | unknown;
|
|
34157
|
+
status?: "queued" | "processing" | "completed" | "failed" | "duplicate" | "cancelled" | "pending_credits" | unknown;
|
|
34146
34158
|
/**
|
|
34147
34159
|
* Metadata about the training session for this document (trained_at, user_id, scores)
|
|
34148
34160
|
*/
|
|
@@ -42834,14 +42846,14 @@ declare class GptAdmin extends BaseClient {
|
|
|
42834
42846
|
/**
|
|
42835
42847
|
* Get storage statistics
|
|
42836
42848
|
*/
|
|
42837
|
-
stats: (workspaceId?: string) => Promise<
|
|
42849
|
+
stats: (workspaceId?: string) => Promise<Record<string, unknown>>;
|
|
42838
42850
|
/**
|
|
42839
42851
|
* Bucket management
|
|
42840
42852
|
*/
|
|
42841
42853
|
buckets: {
|
|
42842
42854
|
list: () => Promise<Bucket[]>;
|
|
42843
42855
|
get: (id: string) => Promise<Bucket>;
|
|
42844
|
-
stats: (id: string) => Promise<
|
|
42856
|
+
stats: (id: string) => Promise<Record<string, unknown>>;
|
|
42845
42857
|
objects: (id: string) => Promise<_Object[]>;
|
|
42846
42858
|
};
|
|
42847
42859
|
};
|
|
@@ -42870,12 +42882,12 @@ declare class GptAdmin extends BaseClient {
|
|
|
42870
42882
|
secret?: string;
|
|
42871
42883
|
}>) => Promise<WebhookConfig>;
|
|
42872
42884
|
delete: (id: string) => Promise<boolean>;
|
|
42873
|
-
test: (id: string) => Promise<
|
|
42885
|
+
test: (id: string) => Promise<Record<string, unknown>>;
|
|
42874
42886
|
};
|
|
42875
42887
|
deliveries: {
|
|
42876
42888
|
list: () => Promise<WebhookDelivery[]>;
|
|
42877
42889
|
get: (id: string) => Promise<WebhookDelivery>;
|
|
42878
|
-
retry: (id: string) => Promise<
|
|
42890
|
+
retry: (id: string) => Promise<Record<string, unknown>>;
|
|
42879
42891
|
};
|
|
42880
42892
|
};
|
|
42881
42893
|
/**
|
|
@@ -42885,7 +42897,7 @@ declare class GptAdmin extends BaseClient {
|
|
|
42885
42897
|
list: () => Promise<ExtractionDocument[]>;
|
|
42886
42898
|
get: (id: string) => Promise<ExtractionDocument>;
|
|
42887
42899
|
stats: () => Promise<DocumentStats>;
|
|
42888
|
-
bulkDelete: (documentIds: string[]) => Promise<
|
|
42900
|
+
bulkDelete: (documentIds: string[]) => Promise<Record<string, unknown>>;
|
|
42889
42901
|
};
|
|
42890
42902
|
/**
|
|
42891
42903
|
* API Key management
|
|
@@ -42908,14 +42920,14 @@ declare class GptCoreError extends Error {
|
|
|
42908
42920
|
readonly code?: string;
|
|
42909
42921
|
readonly requestId?: string;
|
|
42910
42922
|
readonly headers?: Record<string, string>;
|
|
42911
|
-
readonly body?:
|
|
42923
|
+
readonly body?: unknown;
|
|
42912
42924
|
cause?: Error;
|
|
42913
42925
|
constructor(message: string, options?: {
|
|
42914
42926
|
statusCode?: number;
|
|
42915
42927
|
code?: string;
|
|
42916
42928
|
requestId?: string;
|
|
42917
42929
|
headers?: Record<string, string>;
|
|
42918
|
-
body?:
|
|
42930
|
+
body?: unknown;
|
|
42919
42931
|
cause?: Error;
|
|
42920
42932
|
});
|
|
42921
42933
|
}
|
|
@@ -42978,7 +42990,7 @@ declare class ServerError extends GptCoreError {
|
|
|
42978
42990
|
/**
|
|
42979
42991
|
* Parse error response and throw appropriate error class
|
|
42980
42992
|
*/
|
|
42981
|
-
declare function handleApiError(error:
|
|
42993
|
+
declare function handleApiError(error: unknown): never;
|
|
42982
42994
|
|
|
42983
42995
|
declare const StorageStatsRequestSchema: z.ZodObject<{
|
|
42984
42996
|
workspace_id: z.ZodOptional<z.ZodString>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1767,6 +1767,10 @@ type DocumentStats = {
|
|
|
1767
1767
|
* Field included by default.
|
|
1768
1768
|
*/
|
|
1769
1769
|
completed?: number | null | unknown;
|
|
1770
|
+
/**
|
|
1771
|
+
* Field included by default.
|
|
1772
|
+
*/
|
|
1773
|
+
duplicate?: number | null | unknown;
|
|
1770
1774
|
/**
|
|
1771
1775
|
* Field included by default.
|
|
1772
1776
|
*/
|
|
@@ -3268,6 +3272,10 @@ type WorkspaceDocumentStats = {
|
|
|
3268
3272
|
* Field included by default.
|
|
3269
3273
|
*/
|
|
3270
3274
|
completed?: number | null | unknown;
|
|
3275
|
+
/**
|
|
3276
|
+
* Field included by default.
|
|
3277
|
+
*/
|
|
3278
|
+
duplicate?: number | null | unknown;
|
|
3271
3279
|
/**
|
|
3272
3280
|
* Field included by default.
|
|
3273
3281
|
*/
|
|
@@ -5144,6 +5152,10 @@ type TenantDocumentStats = {
|
|
|
5144
5152
|
* Field included by default.
|
|
5145
5153
|
*/
|
|
5146
5154
|
completed?: number | null | unknown;
|
|
5155
|
+
/**
|
|
5156
|
+
* Field included by default.
|
|
5157
|
+
*/
|
|
5158
|
+
duplicate?: number | null | unknown;
|
|
5147
5159
|
/**
|
|
5148
5160
|
* Field included by default.
|
|
5149
5161
|
*/
|
|
@@ -5974,7 +5986,7 @@ type ExtractionDocument = {
|
|
|
5974
5986
|
/**
|
|
5975
5987
|
* Field included by default.
|
|
5976
5988
|
*/
|
|
5977
|
-
status?: "queued" | "processing" | "completed" | "failed" | "cancelled" | "pending_credits" | unknown;
|
|
5989
|
+
status?: "queued" | "processing" | "completed" | "failed" | "duplicate" | "cancelled" | "pending_credits" | unknown;
|
|
5978
5990
|
/**
|
|
5979
5991
|
* Field included by default.
|
|
5980
5992
|
*/
|
|
@@ -34142,7 +34154,7 @@ type PatchAdminExtractionDocumentsByIdStatusData = {
|
|
|
34142
34154
|
* State or province code (2-letter)
|
|
34143
34155
|
*/
|
|
34144
34156
|
state?: string | unknown;
|
|
34145
|
-
status?: "queued" | "processing" | "completed" | "failed" | "cancelled" | "pending_credits" | unknown;
|
|
34157
|
+
status?: "queued" | "processing" | "completed" | "failed" | "duplicate" | "cancelled" | "pending_credits" | unknown;
|
|
34146
34158
|
/**
|
|
34147
34159
|
* Metadata about the training session for this document (trained_at, user_id, scores)
|
|
34148
34160
|
*/
|
|
@@ -42834,14 +42846,14 @@ declare class GptAdmin extends BaseClient {
|
|
|
42834
42846
|
/**
|
|
42835
42847
|
* Get storage statistics
|
|
42836
42848
|
*/
|
|
42837
|
-
stats: (workspaceId?: string) => Promise<
|
|
42849
|
+
stats: (workspaceId?: string) => Promise<Record<string, unknown>>;
|
|
42838
42850
|
/**
|
|
42839
42851
|
* Bucket management
|
|
42840
42852
|
*/
|
|
42841
42853
|
buckets: {
|
|
42842
42854
|
list: () => Promise<Bucket[]>;
|
|
42843
42855
|
get: (id: string) => Promise<Bucket>;
|
|
42844
|
-
stats: (id: string) => Promise<
|
|
42856
|
+
stats: (id: string) => Promise<Record<string, unknown>>;
|
|
42845
42857
|
objects: (id: string) => Promise<_Object[]>;
|
|
42846
42858
|
};
|
|
42847
42859
|
};
|
|
@@ -42870,12 +42882,12 @@ declare class GptAdmin extends BaseClient {
|
|
|
42870
42882
|
secret?: string;
|
|
42871
42883
|
}>) => Promise<WebhookConfig>;
|
|
42872
42884
|
delete: (id: string) => Promise<boolean>;
|
|
42873
|
-
test: (id: string) => Promise<
|
|
42885
|
+
test: (id: string) => Promise<Record<string, unknown>>;
|
|
42874
42886
|
};
|
|
42875
42887
|
deliveries: {
|
|
42876
42888
|
list: () => Promise<WebhookDelivery[]>;
|
|
42877
42889
|
get: (id: string) => Promise<WebhookDelivery>;
|
|
42878
|
-
retry: (id: string) => Promise<
|
|
42890
|
+
retry: (id: string) => Promise<Record<string, unknown>>;
|
|
42879
42891
|
};
|
|
42880
42892
|
};
|
|
42881
42893
|
/**
|
|
@@ -42885,7 +42897,7 @@ declare class GptAdmin extends BaseClient {
|
|
|
42885
42897
|
list: () => Promise<ExtractionDocument[]>;
|
|
42886
42898
|
get: (id: string) => Promise<ExtractionDocument>;
|
|
42887
42899
|
stats: () => Promise<DocumentStats>;
|
|
42888
|
-
bulkDelete: (documentIds: string[]) => Promise<
|
|
42900
|
+
bulkDelete: (documentIds: string[]) => Promise<Record<string, unknown>>;
|
|
42889
42901
|
};
|
|
42890
42902
|
/**
|
|
42891
42903
|
* API Key management
|
|
@@ -42908,14 +42920,14 @@ declare class GptCoreError extends Error {
|
|
|
42908
42920
|
readonly code?: string;
|
|
42909
42921
|
readonly requestId?: string;
|
|
42910
42922
|
readonly headers?: Record<string, string>;
|
|
42911
|
-
readonly body?:
|
|
42923
|
+
readonly body?: unknown;
|
|
42912
42924
|
cause?: Error;
|
|
42913
42925
|
constructor(message: string, options?: {
|
|
42914
42926
|
statusCode?: number;
|
|
42915
42927
|
code?: string;
|
|
42916
42928
|
requestId?: string;
|
|
42917
42929
|
headers?: Record<string, string>;
|
|
42918
|
-
body?:
|
|
42930
|
+
body?: unknown;
|
|
42919
42931
|
cause?: Error;
|
|
42920
42932
|
});
|
|
42921
42933
|
}
|
|
@@ -42978,7 +42990,7 @@ declare class ServerError extends GptCoreError {
|
|
|
42978
42990
|
/**
|
|
42979
42991
|
* Parse error response and throw appropriate error class
|
|
42980
42992
|
*/
|
|
42981
|
-
declare function handleApiError(error:
|
|
42993
|
+
declare function handleApiError(error: unknown): never;
|
|
42982
42994
|
|
|
42983
42995
|
declare const StorageStatsRequestSchema: z.ZodObject<{
|
|
42984
42996
|
workspace_id: z.ZodOptional<z.ZodString>;
|
package/dist/index.js
CHANGED
|
@@ -1555,26 +1555,28 @@ var ServerError = class extends GptCoreError {
|
|
|
1555
1555
|
}
|
|
1556
1556
|
};
|
|
1557
1557
|
function handleApiError(error) {
|
|
1558
|
-
const
|
|
1559
|
-
const
|
|
1560
|
-
const
|
|
1558
|
+
const err = error;
|
|
1559
|
+
const response = err?.response || err;
|
|
1560
|
+
const statusCode = response?.status || err?.status || err?.statusCode;
|
|
1561
|
+
const headers = response?.headers || err?.headers;
|
|
1561
1562
|
const requestId = headers?.get?.("x-request-id") || headers?.["x-request-id"];
|
|
1562
|
-
const body = response?.body || response?.data ||
|
|
1563
|
+
const body = response?.body || response?.data || err?.body || err?.data || err;
|
|
1563
1564
|
let message = "An error occurred";
|
|
1564
1565
|
let errors;
|
|
1565
|
-
|
|
1566
|
-
|
|
1566
|
+
const bodyObj = body;
|
|
1567
|
+
if (bodyObj?.errors && Array.isArray(bodyObj.errors)) {
|
|
1568
|
+
const firstError = bodyObj.errors[0];
|
|
1567
1569
|
message = firstError?.title || firstError?.detail || message;
|
|
1568
|
-
errors =
|
|
1569
|
-
field:
|
|
1570
|
-
message:
|
|
1570
|
+
errors = bodyObj.errors.map((e) => ({
|
|
1571
|
+
field: e.source?.pointer?.split("/").pop(),
|
|
1572
|
+
message: e.detail || e.title || "Unknown error"
|
|
1571
1573
|
}));
|
|
1572
|
-
} else if (
|
|
1573
|
-
message =
|
|
1574
|
+
} else if (bodyObj?.message) {
|
|
1575
|
+
message = bodyObj.message;
|
|
1574
1576
|
} else if (typeof body === "string") {
|
|
1575
1577
|
message = body;
|
|
1576
|
-
} else if (
|
|
1577
|
-
message =
|
|
1578
|
+
} else if (err?.message) {
|
|
1579
|
+
message = err.message;
|
|
1578
1580
|
}
|
|
1579
1581
|
const sensitiveHeaderPatterns = [
|
|
1580
1582
|
"set-cookie",
|
|
@@ -1600,7 +1602,7 @@ function handleApiError(error) {
|
|
|
1600
1602
|
requestId,
|
|
1601
1603
|
headers: filterSensitiveHeaders(headers),
|
|
1602
1604
|
body,
|
|
1603
|
-
cause: error
|
|
1605
|
+
cause: error instanceof Error ? error : void 0
|
|
1604
1606
|
};
|
|
1605
1607
|
switch (statusCode) {
|
|
1606
1608
|
case 401:
|
package/dist/index.mjs
CHANGED
|
@@ -1506,26 +1506,28 @@ var ServerError = class extends GptCoreError {
|
|
|
1506
1506
|
}
|
|
1507
1507
|
};
|
|
1508
1508
|
function handleApiError(error) {
|
|
1509
|
-
const
|
|
1510
|
-
const
|
|
1511
|
-
const
|
|
1509
|
+
const err = error;
|
|
1510
|
+
const response = err?.response || err;
|
|
1511
|
+
const statusCode = response?.status || err?.status || err?.statusCode;
|
|
1512
|
+
const headers = response?.headers || err?.headers;
|
|
1512
1513
|
const requestId = headers?.get?.("x-request-id") || headers?.["x-request-id"];
|
|
1513
|
-
const body = response?.body || response?.data ||
|
|
1514
|
+
const body = response?.body || response?.data || err?.body || err?.data || err;
|
|
1514
1515
|
let message = "An error occurred";
|
|
1515
1516
|
let errors;
|
|
1516
|
-
|
|
1517
|
-
|
|
1517
|
+
const bodyObj = body;
|
|
1518
|
+
if (bodyObj?.errors && Array.isArray(bodyObj.errors)) {
|
|
1519
|
+
const firstError = bodyObj.errors[0];
|
|
1518
1520
|
message = firstError?.title || firstError?.detail || message;
|
|
1519
|
-
errors =
|
|
1520
|
-
field:
|
|
1521
|
-
message:
|
|
1521
|
+
errors = bodyObj.errors.map((e) => ({
|
|
1522
|
+
field: e.source?.pointer?.split("/").pop(),
|
|
1523
|
+
message: e.detail || e.title || "Unknown error"
|
|
1522
1524
|
}));
|
|
1523
|
-
} else if (
|
|
1524
|
-
message =
|
|
1525
|
+
} else if (bodyObj?.message) {
|
|
1526
|
+
message = bodyObj.message;
|
|
1525
1527
|
} else if (typeof body === "string") {
|
|
1526
1528
|
message = body;
|
|
1527
|
-
} else if (
|
|
1528
|
-
message =
|
|
1529
|
+
} else if (err?.message) {
|
|
1530
|
+
message = err.message;
|
|
1529
1531
|
}
|
|
1530
1532
|
const sensitiveHeaderPatterns = [
|
|
1531
1533
|
"set-cookie",
|
|
@@ -1551,7 +1553,7 @@ function handleApiError(error) {
|
|
|
1551
1553
|
requestId,
|
|
1552
1554
|
headers: filterSensitiveHeaders(headers),
|
|
1553
1555
|
body,
|
|
1554
|
-
cause: error
|
|
1556
|
+
cause: error instanceof Error ? error : void 0
|
|
1555
1557
|
};
|
|
1556
1558
|
switch (statusCode) {
|
|
1557
1559
|
case 401:
|