@gpt-core/admin 0.11.0 → 0.11.2
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 +23 -12
- package/dist/index.d.ts +23 -12
- 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
|
*/
|
|
@@ -20714,7 +20726,7 @@ type GetAdminLegalDocumentsForApplicationData = {
|
|
|
20714
20726
|
"x-application-key": string;
|
|
20715
20727
|
};
|
|
20716
20728
|
path?: never;
|
|
20717
|
-
query
|
|
20729
|
+
query?: {
|
|
20718
20730
|
/**
|
|
20719
20731
|
* JSON:API filter parameters (use flat query string format: filter[field][operator]=value)
|
|
20720
20732
|
*/
|
|
@@ -20735,7 +20747,6 @@ type GetAdminLegalDocumentsForApplicationData = {
|
|
|
20735
20747
|
fields?: {
|
|
20736
20748
|
[key: string]: unknown;
|
|
20737
20749
|
};
|
|
20738
|
-
application_id: string;
|
|
20739
20750
|
};
|
|
20740
20751
|
url: "/admin/legal-documents/for-application";
|
|
20741
20752
|
};
|
|
@@ -34142,7 +34153,7 @@ type PatchAdminExtractionDocumentsByIdStatusData = {
|
|
|
34142
34153
|
* State or province code (2-letter)
|
|
34143
34154
|
*/
|
|
34144
34155
|
state?: string | unknown;
|
|
34145
|
-
status?: "queued" | "processing" | "completed" | "failed" | "cancelled" | "pending_credits" | unknown;
|
|
34156
|
+
status?: "queued" | "processing" | "completed" | "failed" | "duplicate" | "cancelled" | "pending_credits" | unknown;
|
|
34146
34157
|
/**
|
|
34147
34158
|
* Metadata about the training session for this document (trained_at, user_id, scores)
|
|
34148
34159
|
*/
|
|
@@ -42834,14 +42845,14 @@ declare class GptAdmin extends BaseClient {
|
|
|
42834
42845
|
/**
|
|
42835
42846
|
* Get storage statistics
|
|
42836
42847
|
*/
|
|
42837
|
-
stats: (workspaceId?: string) => Promise<
|
|
42848
|
+
stats: (workspaceId?: string) => Promise<Record<string, unknown>>;
|
|
42838
42849
|
/**
|
|
42839
42850
|
* Bucket management
|
|
42840
42851
|
*/
|
|
42841
42852
|
buckets: {
|
|
42842
42853
|
list: () => Promise<Bucket[]>;
|
|
42843
42854
|
get: (id: string) => Promise<Bucket>;
|
|
42844
|
-
stats: (id: string) => Promise<
|
|
42855
|
+
stats: (id: string) => Promise<Record<string, unknown>>;
|
|
42845
42856
|
objects: (id: string) => Promise<_Object[]>;
|
|
42846
42857
|
};
|
|
42847
42858
|
};
|
|
@@ -42870,12 +42881,12 @@ declare class GptAdmin extends BaseClient {
|
|
|
42870
42881
|
secret?: string;
|
|
42871
42882
|
}>) => Promise<WebhookConfig>;
|
|
42872
42883
|
delete: (id: string) => Promise<boolean>;
|
|
42873
|
-
test: (id: string) => Promise<
|
|
42884
|
+
test: (id: string) => Promise<Record<string, unknown>>;
|
|
42874
42885
|
};
|
|
42875
42886
|
deliveries: {
|
|
42876
42887
|
list: () => Promise<WebhookDelivery[]>;
|
|
42877
42888
|
get: (id: string) => Promise<WebhookDelivery>;
|
|
42878
|
-
retry: (id: string) => Promise<
|
|
42889
|
+
retry: (id: string) => Promise<Record<string, unknown>>;
|
|
42879
42890
|
};
|
|
42880
42891
|
};
|
|
42881
42892
|
/**
|
|
@@ -42885,7 +42896,7 @@ declare class GptAdmin extends BaseClient {
|
|
|
42885
42896
|
list: () => Promise<ExtractionDocument[]>;
|
|
42886
42897
|
get: (id: string) => Promise<ExtractionDocument>;
|
|
42887
42898
|
stats: () => Promise<DocumentStats>;
|
|
42888
|
-
bulkDelete: (documentIds: string[]) => Promise<
|
|
42899
|
+
bulkDelete: (documentIds: string[]) => Promise<Record<string, unknown>>;
|
|
42889
42900
|
};
|
|
42890
42901
|
/**
|
|
42891
42902
|
* API Key management
|
|
@@ -42908,14 +42919,14 @@ declare class GptCoreError extends Error {
|
|
|
42908
42919
|
readonly code?: string;
|
|
42909
42920
|
readonly requestId?: string;
|
|
42910
42921
|
readonly headers?: Record<string, string>;
|
|
42911
|
-
readonly body?:
|
|
42922
|
+
readonly body?: unknown;
|
|
42912
42923
|
cause?: Error;
|
|
42913
42924
|
constructor(message: string, options?: {
|
|
42914
42925
|
statusCode?: number;
|
|
42915
42926
|
code?: string;
|
|
42916
42927
|
requestId?: string;
|
|
42917
42928
|
headers?: Record<string, string>;
|
|
42918
|
-
body?:
|
|
42929
|
+
body?: unknown;
|
|
42919
42930
|
cause?: Error;
|
|
42920
42931
|
});
|
|
42921
42932
|
}
|
|
@@ -42978,7 +42989,7 @@ declare class ServerError extends GptCoreError {
|
|
|
42978
42989
|
/**
|
|
42979
42990
|
* Parse error response and throw appropriate error class
|
|
42980
42991
|
*/
|
|
42981
|
-
declare function handleApiError(error:
|
|
42992
|
+
declare function handleApiError(error: unknown): never;
|
|
42982
42993
|
|
|
42983
42994
|
declare const StorageStatsRequestSchema: z.ZodObject<{
|
|
42984
42995
|
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
|
*/
|
|
@@ -20714,7 +20726,7 @@ type GetAdminLegalDocumentsForApplicationData = {
|
|
|
20714
20726
|
"x-application-key": string;
|
|
20715
20727
|
};
|
|
20716
20728
|
path?: never;
|
|
20717
|
-
query
|
|
20729
|
+
query?: {
|
|
20718
20730
|
/**
|
|
20719
20731
|
* JSON:API filter parameters (use flat query string format: filter[field][operator]=value)
|
|
20720
20732
|
*/
|
|
@@ -20735,7 +20747,6 @@ type GetAdminLegalDocumentsForApplicationData = {
|
|
|
20735
20747
|
fields?: {
|
|
20736
20748
|
[key: string]: unknown;
|
|
20737
20749
|
};
|
|
20738
|
-
application_id: string;
|
|
20739
20750
|
};
|
|
20740
20751
|
url: "/admin/legal-documents/for-application";
|
|
20741
20752
|
};
|
|
@@ -34142,7 +34153,7 @@ type PatchAdminExtractionDocumentsByIdStatusData = {
|
|
|
34142
34153
|
* State or province code (2-letter)
|
|
34143
34154
|
*/
|
|
34144
34155
|
state?: string | unknown;
|
|
34145
|
-
status?: "queued" | "processing" | "completed" | "failed" | "cancelled" | "pending_credits" | unknown;
|
|
34156
|
+
status?: "queued" | "processing" | "completed" | "failed" | "duplicate" | "cancelled" | "pending_credits" | unknown;
|
|
34146
34157
|
/**
|
|
34147
34158
|
* Metadata about the training session for this document (trained_at, user_id, scores)
|
|
34148
34159
|
*/
|
|
@@ -42834,14 +42845,14 @@ declare class GptAdmin extends BaseClient {
|
|
|
42834
42845
|
/**
|
|
42835
42846
|
* Get storage statistics
|
|
42836
42847
|
*/
|
|
42837
|
-
stats: (workspaceId?: string) => Promise<
|
|
42848
|
+
stats: (workspaceId?: string) => Promise<Record<string, unknown>>;
|
|
42838
42849
|
/**
|
|
42839
42850
|
* Bucket management
|
|
42840
42851
|
*/
|
|
42841
42852
|
buckets: {
|
|
42842
42853
|
list: () => Promise<Bucket[]>;
|
|
42843
42854
|
get: (id: string) => Promise<Bucket>;
|
|
42844
|
-
stats: (id: string) => Promise<
|
|
42855
|
+
stats: (id: string) => Promise<Record<string, unknown>>;
|
|
42845
42856
|
objects: (id: string) => Promise<_Object[]>;
|
|
42846
42857
|
};
|
|
42847
42858
|
};
|
|
@@ -42870,12 +42881,12 @@ declare class GptAdmin extends BaseClient {
|
|
|
42870
42881
|
secret?: string;
|
|
42871
42882
|
}>) => Promise<WebhookConfig>;
|
|
42872
42883
|
delete: (id: string) => Promise<boolean>;
|
|
42873
|
-
test: (id: string) => Promise<
|
|
42884
|
+
test: (id: string) => Promise<Record<string, unknown>>;
|
|
42874
42885
|
};
|
|
42875
42886
|
deliveries: {
|
|
42876
42887
|
list: () => Promise<WebhookDelivery[]>;
|
|
42877
42888
|
get: (id: string) => Promise<WebhookDelivery>;
|
|
42878
|
-
retry: (id: string) => Promise<
|
|
42889
|
+
retry: (id: string) => Promise<Record<string, unknown>>;
|
|
42879
42890
|
};
|
|
42880
42891
|
};
|
|
42881
42892
|
/**
|
|
@@ -42885,7 +42896,7 @@ declare class GptAdmin extends BaseClient {
|
|
|
42885
42896
|
list: () => Promise<ExtractionDocument[]>;
|
|
42886
42897
|
get: (id: string) => Promise<ExtractionDocument>;
|
|
42887
42898
|
stats: () => Promise<DocumentStats>;
|
|
42888
|
-
bulkDelete: (documentIds: string[]) => Promise<
|
|
42899
|
+
bulkDelete: (documentIds: string[]) => Promise<Record<string, unknown>>;
|
|
42889
42900
|
};
|
|
42890
42901
|
/**
|
|
42891
42902
|
* API Key management
|
|
@@ -42908,14 +42919,14 @@ declare class GptCoreError extends Error {
|
|
|
42908
42919
|
readonly code?: string;
|
|
42909
42920
|
readonly requestId?: string;
|
|
42910
42921
|
readonly headers?: Record<string, string>;
|
|
42911
|
-
readonly body?:
|
|
42922
|
+
readonly body?: unknown;
|
|
42912
42923
|
cause?: Error;
|
|
42913
42924
|
constructor(message: string, options?: {
|
|
42914
42925
|
statusCode?: number;
|
|
42915
42926
|
code?: string;
|
|
42916
42927
|
requestId?: string;
|
|
42917
42928
|
headers?: Record<string, string>;
|
|
42918
|
-
body?:
|
|
42929
|
+
body?: unknown;
|
|
42919
42930
|
cause?: Error;
|
|
42920
42931
|
});
|
|
42921
42932
|
}
|
|
@@ -42978,7 +42989,7 @@ declare class ServerError extends GptCoreError {
|
|
|
42978
42989
|
/**
|
|
42979
42990
|
* Parse error response and throw appropriate error class
|
|
42980
42991
|
*/
|
|
42981
|
-
declare function handleApiError(error:
|
|
42992
|
+
declare function handleApiError(error: unknown): never;
|
|
42982
42993
|
|
|
42983
42994
|
declare const StorageStatsRequestSchema: z.ZodObject<{
|
|
42984
42995
|
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:
|