/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 58c3bdd3ac12 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BulkUploadHistoryEvent, BulkUploadHistoryEvent$inboundSchema, } from "./bulkuploadhistoryevent.js"; import { DatasourceObjectTypeDocumentCountEntry, DatasourceObjectTypeDocumentCountEntry$inboundSchema, } from "./datasourceobjecttypedocumentcountentry.js"; import { DebugDatasourceStatusIdentityResponseComponent, DebugDatasourceStatusIdentityResponseComponent$inboundSchema, } from "./debugdatasourcestatusidentityresponsecomponent.js"; import { ProcessingHistoryEvent, ProcessingHistoryEvent$inboundSchema, } from "./processinghistoryevent.js"; export type DebugDatasourceStatusResponseCounts = { /** * A list of object types and corresponding upload counts. Note: This data may be cached and could be up to 3 hours stale. * * @remarks */ uploaded?: Array | undefined; /** * The number of documents indexed, grouped by objectType */ indexed?: Array | undefined; }; export type Documents = { /** * Information about active and recent successful uploads for the datasource */ bulkUploadHistory?: Array | undefined; counts?: DebugDatasourceStatusResponseCounts | undefined; /** * Information about processing history for the datasource */ processingHistory?: Array | undefined; }; export type Identity = { /** * Information about processing history for the datasource */ processingHistory?: Array | undefined; users?: DebugDatasourceStatusIdentityResponseComponent | undefined; groups?: DebugDatasourceStatusIdentityResponseComponent | undefined; memberships?: DebugDatasourceStatusIdentityResponseComponent | undefined; }; /** * The visibility of the datasource, an enum of VISIBLE_TO_ALL, VISIBLE_TO_TEST_GROUP, NOT_VISIBLE */ export const DatasourceVisibility = { EnabledForAll: "ENABLED_FOR_ALL", EnabledForTestGroup: "ENABLED_FOR_TEST_GROUP", NotEnabled: "NOT_ENABLED", } as const; /** * The visibility of the datasource, an enum of VISIBLE_TO_ALL, VISIBLE_TO_TEST_GROUP, NOT_VISIBLE */ export type DatasourceVisibility = OpenEnum; /** * Describes the response body of the /debug/{datasource}/status API call */ export type DebugDatasourceStatusResponse = { documents?: Documents | undefined; identity?: Identity | undefined; /** * The visibility of the datasource, an enum of VISIBLE_TO_ALL, VISIBLE_TO_TEST_GROUP, NOT_VISIBLE */ datasourceVisibility?: DatasourceVisibility | undefined; }; /** @internal */ export const DebugDatasourceStatusResponseCounts$inboundSchema: z.ZodType< DebugDatasourceStatusResponseCounts, z.ZodTypeDef, unknown > = z.object({ uploaded: z.array(DatasourceObjectTypeDocumentCountEntry$inboundSchema) .optional(), indexed: z.array(DatasourceObjectTypeDocumentCountEntry$inboundSchema) .optional(), }); export function debugDatasourceStatusResponseCountsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DebugDatasourceStatusResponseCounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DebugDatasourceStatusResponseCounts' from JSON`, ); } /** @internal */ export const Documents$inboundSchema: z.ZodType< Documents, z.ZodTypeDef, unknown > = z.object({ bulkUploadHistory: z.array(BulkUploadHistoryEvent$inboundSchema).optional(), counts: z.lazy(() => DebugDatasourceStatusResponseCounts$inboundSchema) .optional(), processingHistory: z.array(ProcessingHistoryEvent$inboundSchema).optional(), }); export function documentsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Documents$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Documents' from JSON`, ); } /** @internal */ export const Identity$inboundSchema: z.ZodType< Identity, z.ZodTypeDef, unknown > = z.object({ processingHistory: z.array(ProcessingHistoryEvent$inboundSchema).optional(), users: DebugDatasourceStatusIdentityResponseComponent$inboundSchema .optional(), groups: DebugDatasourceStatusIdentityResponseComponent$inboundSchema .optional(), memberships: DebugDatasourceStatusIdentityResponseComponent$inboundSchema .optional(), }); export function identityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Identity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Identity' from JSON`, ); } /** @internal */ export const DatasourceVisibility$inboundSchema: z.ZodType< DatasourceVisibility, z.ZodTypeDef, unknown > = openEnums.inboundSchema(DatasourceVisibility); /** @internal */ export const DebugDatasourceStatusResponse$inboundSchema: z.ZodType< DebugDatasourceStatusResponse, z.ZodTypeDef, unknown > = z.object({ documents: z.lazy(() => Documents$inboundSchema).optional(), identity: z.lazy(() => Identity$inboundSchema).optional(), datasourceVisibility: DatasourceVisibility$inboundSchema.optional(), }); export function debugDatasourceStatusResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DebugDatasourceStatusResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DebugDatasourceStatusResponse' from JSON`, ); }