@hydradb/sdk 2.0.1 → 2.1.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/README.md +493 -554
- package/dist/Client.d.ts +33 -8
- package/dist/Client.js +124 -18
- package/dist/api/client/requests/ListProvidersRequest.d.ts +10 -0
- package/dist/api/client/requests/SearchQueryRequest.d.ts +55 -15
- package/dist/api/client/requests/index.d.ts +1 -0
- package/dist/api/errors/BadGatewayError.d.ts +6 -0
- package/dist/api/errors/{TooManyRequestsError.js → BadGatewayError.js} +5 -5
- package/dist/api/errors/{TooManyRequestsError.d.ts → ContentTooLargeError.d.ts} +1 -1
- package/dist/api/errors/ContentTooLargeError.js +54 -0
- package/dist/api/errors/NotFoundError.d.ts +1 -2
- package/dist/api/errors/ServiceUnavailableError.d.ts +6 -0
- package/dist/api/errors/ServiceUnavailableError.js +54 -0
- package/dist/api/errors/index.d.ts +3 -1
- package/dist/api/errors/index.js +3 -1
- package/dist/api/resources/connectors/client/Client.d.ts +240 -0
- package/dist/api/resources/connectors/client/Client.js +1034 -0
- package/dist/api/resources/connectors/client/requests/DeleteConnectorsRequest.d.ts +10 -0
- package/dist/api/resources/connectors/client/requests/DeleteResourceConnectorsRequest.d.ts +13 -0
- package/dist/api/resources/connectors/client/requests/DiscoverConnectorsRequest.d.ts +10 -0
- package/dist/api/resources/connectors/client/requests/GetConnectorsRequest.d.ts +10 -0
- package/dist/api/resources/connectors/client/requests/HandlerConfigureReq.d.ts +34 -0
- package/dist/api/resources/connectors/client/requests/HandlerConnectorCreateReq.d.ts +41 -0
- package/dist/api/resources/connectors/client/requests/HandlerDiscoverPreviewReq.d.ts +17 -0
- package/dist/api/resources/connectors/client/requests/HandlerResourceCreateReq.d.ts +34 -0
- package/dist/api/resources/connectors/client/requests/ListConnectorsRequest.d.ts +10 -0
- package/dist/api/resources/connectors/client/requests/ListResourcesConnectorsRequest.d.ts +10 -0
- package/dist/api/resources/connectors/client/requests/PatchConnectorsIdCredentialsRequest.d.ts +14 -0
- package/dist/api/resources/connectors/client/requests/SyncConnectorsRequest.d.ts +10 -0
- package/dist/api/resources/connectors/client/requests/index.d.ts +12 -0
- package/dist/api/resources/connectors/exports.d.ts +2 -0
- package/dist/api/resources/{embeddings → connectors}/exports.js +2 -2
- package/dist/api/resources/context/client/Client.d.ts +33 -6
- package/dist/api/resources/context/client/Client.js +134 -19
- package/dist/api/resources/context/client/requests/HandlerContextMetadataUpdateRequest.d.ts +30 -0
- package/dist/api/resources/context/client/requests/IngestContextRequest.d.ts +6 -3
- package/dist/api/resources/context/client/requests/InspectContextRequest.d.ts +12 -5
- package/dist/api/resources/context/client/requests/ListV2ListContentRequest.d.ts +16 -1
- package/dist/api/resources/context/client/requests/RelationsContextRequest.d.ts +14 -6
- package/dist/api/resources/context/client/requests/SourcesV2SourceDeleteRequest.d.ts +14 -1
- package/dist/api/resources/context/client/requests/StatusContextRequest.d.ts +10 -3
- package/dist/api/resources/context/client/requests/index.d.ts +1 -0
- package/dist/api/resources/context/index.d.ts +1 -0
- package/dist/api/resources/context/index.js +1 -0
- package/dist/api/resources/context/types/IngestContextRequestType.d.ts +5 -0
- package/dist/api/resources/context/types/IngestContextRequestType.js +8 -0
- package/dist/api/resources/context/types/ListV2ListContentRequestType.d.ts +6 -0
- package/dist/api/resources/context/types/ListV2ListContentRequestType.js +9 -0
- package/dist/api/resources/context/types/RelationsContextRequestType.d.ts +5 -0
- package/dist/api/resources/context/types/RelationsContextRequestType.js +8 -0
- package/dist/api/resources/context/types/SourcesV2SourceDeleteRequestType.d.ts +6 -0
- package/dist/api/resources/context/types/SourcesV2SourceDeleteRequestType.js +9 -0
- package/dist/api/resources/context/types/index.d.ts +4 -0
- package/dist/api/resources/context/types/index.js +20 -0
- package/dist/api/resources/databases/client/Client.d.ts +127 -0
- package/dist/api/resources/{tenants → databases}/client/Client.js +146 -78
- package/dist/api/resources/databases/client/requests/CollectionsDatabasesRequest.d.ts +10 -0
- package/dist/api/resources/databases/client/requests/DeleteDatabasesRequest.d.ts +10 -0
- package/dist/api/resources/databases/client/requests/StatsDatabasesRequest.d.ts +10 -0
- package/dist/api/resources/databases/client/requests/StatusDatabasesRequest.d.ts +10 -0
- package/dist/api/resources/databases/client/requests/TenantsTenantCreateRequest.d.ts +23 -0
- package/dist/api/resources/databases/client/requests/TenantsTenantMetadataSchemaUpdateRequest.d.ts +13 -0
- package/dist/api/resources/databases/client/requests/TenantsTenantMetadataSchemaUpdateRequest.js +3 -0
- package/dist/api/resources/databases/client/requests/index.d.ts +6 -0
- package/dist/api/resources/databases/exports.d.ts +2 -0
- package/dist/api/resources/{tenants → databases}/exports.js +2 -2
- package/dist/api/resources/index.d.ts +5 -4
- package/dist/api/resources/index.js +6 -5
- package/dist/api/resources/webhooks/client/Client.d.ts +15 -3
- package/dist/api/resources/webhooks/client/Client.js +19 -31
- package/dist/api/resources/webhooks/client/requests/GetDeliveryWebhooksRequest.d.ts +1 -1
- package/dist/api/resources/webhooks/client/requests/RetryDeliveryWebhooksRequest.d.ts +1 -1
- package/dist/api/resources/webhooks/client/requests/WebhooksWebhookRegisterRequest.d.ts +3 -0
- package/dist/api/types/ConnectorsConnector.d.ts +58 -0
- package/dist/api/types/ConnectorsConnector.js +3 -0
- package/dist/api/types/ConnectorsResource.d.ts +71 -0
- package/dist/api/types/ConnectorsResource.js +3 -0
- package/dist/api/types/DashboardPaginationMeta.d.ts +6 -0
- package/dist/api/types/FetchV2SourceFetchResponse.d.ts +10 -0
- package/dist/api/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +26 -0
- package/dist/api/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js +3 -0
- package/dist/api/types/GraphEntity.d.ts +12 -0
- package/dist/api/types/GraphGraphRelationsResponse.d.ts +4 -0
- package/dist/api/types/GraphRelationEvidence.d.ts +6 -0
- package/dist/api/types/GraphTripletWithEvidence.d.ts +2 -0
- package/dist/api/types/HandlerApiError.d.ts +2 -0
- package/dist/api/types/HandlerDeprecationNotice.d.ts +12 -0
- package/dist/api/types/HandlerDeprecationNotice.js +3 -0
- package/dist/api/types/HandlerEnvelopeFetchV2SourceFetchResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeGithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +9 -0
- package/dist/api/types/HandlerEnvelopeGithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js +3 -0
- package/dist/api/types/HandlerEnvelopeGraphGraphRelationsResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeIngestionV2BatchProcessingStatus.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeIngestionV2SourceUploadResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeListV2SourceListResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeSearchV2RetrievalResult.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeSourcesMemoryDeleteResponse.d.ts +9 -0
- package/dist/api/types/HandlerEnvelopeSourcesMemoryDeleteResponse.js +3 -0
- package/dist/api/types/HandlerEnvelopeTenantsInfraStatusResponseV2.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeTenantsSubTenantIdsResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeTenantsTenantCreateAcceptedResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeTenantsTenantDeleteResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeTenantsTenantIdsResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeTenantsTenantStatsResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeWebhooksDeliveryItem.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeWebhooksDeliveryListResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeWebhooksRetryResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeWebhooksWebhookDeleteResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeWebhooksWebhookGetResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeWebhooksWebhookRegisterResponse.d.ts +2 -0
- package/dist/api/types/HandlerEnvelopeWebhooksWebhookTestResponse.d.ts +2 -0
- package/dist/api/types/HandlerErrorDetail.d.ts +9 -0
- package/dist/api/types/HandlerErrorResponse.d.ts +1 -0
- package/dist/api/types/HandlerMetadataSchemaUpdateResponse.d.ts +7 -0
- package/dist/api/types/HandlerMetadataSchemaUpdateResponse.js +3 -0
- package/dist/api/types/HandlerResourceMapping.d.ts +46 -0
- package/dist/api/types/HandlerResourceMapping.js +3 -0
- package/dist/api/types/HandlerResponseMeta.d.ts +19 -0
- package/dist/api/types/IngestionV2BatchProcessingStatus.d.ts +1 -0
- package/dist/api/types/IngestionV2ProcessingStatus.d.ts +6 -0
- package/dist/api/types/IngestionV2SourceUploadResponse.d.ts +5 -0
- package/dist/api/types/IngestionV2SourceUploadResultItem.d.ts +7 -0
- package/dist/api/types/ListContentFilter.d.ts +8 -2
- package/dist/api/types/ListSourceListResponse.d.ts +4 -0
- package/dist/api/types/SearchGraphContext.d.ts +9 -0
- package/dist/api/types/SearchMetadataFilters.d.ts +4 -0
- package/dist/api/types/SearchMetadataFilters.js +3 -0
- package/dist/api/types/SearchPathTriplet.d.ts +3 -0
- package/dist/api/types/SearchQueryRequestCollections.d.ts +4 -0
- package/dist/api/types/SearchQueryRequestCollections.js +3 -0
- package/dist/api/types/SearchQueryRequestSubTenantIds.d.ts +4 -0
- package/dist/api/types/SearchQueryRequestSubTenantIds.js +3 -0
- package/dist/api/types/SearchRecallMode.d.ts +1 -0
- package/dist/api/types/SearchRecallMode.js +1 -0
- package/dist/api/types/SearchScoredPathResponse.d.ts +5 -0
- package/dist/api/types/SearchSourceInfo.d.ts +11 -0
- package/dist/api/types/SearchV2Chunk.d.ts +13 -0
- package/dist/api/types/SearchV2RetrievalResult.d.ts +3 -0
- package/dist/api/types/SourcesMemoryDeleteResponse.d.ts +13 -0
- package/dist/api/types/SourcesMemoryDeleteResponse.js +3 -0
- package/dist/api/types/SourcesSourceDeleteResultItem.d.ts +3 -0
- package/dist/api/types/TenantsCollectionStats.d.ts +2 -0
- package/dist/api/types/TenantsCustomPropertyDefinition.d.ts +7 -0
- package/dist/api/types/TenantsFailedTenant.d.ts +3 -0
- package/dist/api/types/TenantsInfraStatusResponseV2.d.ts +4 -0
- package/dist/api/types/TenantsInfraV2.d.ts +2 -0
- package/dist/api/types/TenantsSubTenantIdsResponse.d.ts +4 -0
- package/dist/api/types/TenantsTenantCreateAcceptedResponse.d.ts +4 -0
- package/dist/api/types/TenantsTenantDeleteResponse.d.ts +4 -0
- package/dist/api/types/TenantsTenantIdsResponse.d.ts +7 -0
- package/dist/api/types/TenantsTenantStatsResponse.d.ts +3 -0
- package/dist/api/types/TenantsVectorstoreStatusV2.d.ts +2 -0
- package/dist/api/types/WebhooksDeliveryItem.d.ts +10 -0
- package/dist/api/types/WebhooksDeliveryListResponse.d.ts +3 -0
- package/dist/api/types/WebhooksRetryResponse.d.ts +3 -0
- package/dist/api/types/WebhooksWebhookDeleteResponse.d.ts +2 -0
- package/dist/api/types/WebhooksWebhookGetResponse.d.ts +4 -0
- package/dist/api/types/WebhooksWebhookRegisterResponse.d.ts +5 -0
- package/dist/api/types/WebhooksWebhookTestResponse.d.ts +3 -0
- package/dist/api/types/index.d.ts +12 -10
- package/dist/api/types/index.js +12 -10
- package/dist/auth/BearerAuthProvider.d.ts +1 -1
- package/dist/serialization/client/catalog.d.ts +6 -0
- package/dist/serialization/{types/EmbeddingsRawEmbeddingVector.js → client/catalog.js} +2 -5
- package/dist/serialization/client/index.d.ts +2 -0
- package/dist/serialization/client/index.js +25 -0
- package/dist/serialization/client/listProviders.d.ts +6 -0
- package/dist/serialization/{types/EmbeddingsDeleteResult.js → client/listProviders.js} +2 -6
- package/dist/serialization/client/requests/SearchQueryRequest.d.ts +11 -3
- package/dist/serialization/client/requests/SearchQueryRequest.js +11 -3
- package/dist/serialization/resources/connectors/client/configure.d.ts +6 -0
- package/dist/serialization/resources/connectors/client/configure.js +39 -0
- package/dist/serialization/resources/connectors/client/delete.d.ts +6 -0
- package/dist/serialization/resources/connectors/client/delete.js +39 -0
- package/dist/serialization/resources/connectors/client/deleteResource.d.ts +6 -0
- package/dist/serialization/resources/connectors/client/deleteResource.js +39 -0
- package/dist/serialization/resources/connectors/client/discover.d.ts +6 -0
- package/dist/serialization/resources/connectors/client/discover.js +39 -0
- package/dist/serialization/resources/connectors/client/discoverPreview.d.ts +6 -0
- package/dist/serialization/resources/connectors/client/discoverPreview.js +39 -0
- package/dist/serialization/resources/connectors/client/index.d.ts +10 -0
- package/dist/serialization/resources/connectors/client/index.js +49 -0
- package/dist/serialization/resources/connectors/client/list.d.ts +6 -0
- package/dist/serialization/resources/connectors/client/list.js +39 -0
- package/dist/serialization/resources/connectors/client/listResources.d.ts +6 -0
- package/dist/serialization/resources/connectors/client/listResources.js +39 -0
- package/dist/serialization/resources/connectors/client/requests/HandlerConfigureReq.d.ts +12 -0
- package/dist/serialization/resources/{embeddings/client/requests/EmbeddingsInsertRawEmbeddingsRequest.js → connectors/client/requests/HandlerConfigureReq.js} +6 -7
- package/dist/serialization/resources/connectors/client/requests/HandlerConnectorCreateReq.d.ts +21 -0
- package/dist/serialization/resources/{embeddings/client/requests/EmbeddingsSearchRawEmbeddingsRequest.js → connectors/client/requests/HandlerConnectorCreateReq.js} +15 -8
- package/dist/serialization/resources/connectors/client/requests/HandlerDiscoverPreviewReq.d.ts +11 -0
- package/dist/serialization/resources/connectors/client/requests/HandlerDiscoverPreviewReq.js +43 -0
- package/dist/serialization/resources/connectors/client/requests/HandlerResourceCreateReq.d.ts +19 -0
- package/dist/serialization/{types/EmbeddingsRawEmbeddingSearchResult.js → resources/connectors/client/requests/HandlerResourceCreateReq.js} +13 -8
- package/dist/serialization/resources/connectors/client/requests/index.d.ts +4 -0
- package/dist/serialization/resources/connectors/client/requests/index.js +11 -0
- package/dist/serialization/resources/connectors/client/rotateAConnectorsStoredOAuthRefreshToken.d.ts +10 -0
- package/dist/serialization/resources/connectors/client/rotateAConnectorsStoredOAuthRefreshToken.js +40 -0
- package/dist/serialization/resources/connectors/client/sync.d.ts +6 -0
- package/dist/serialization/resources/connectors/client/sync.js +39 -0
- package/dist/serialization/resources/context/client/requests/HandlerContextMetadataUpdateRequest.d.ts +16 -0
- package/dist/serialization/resources/{embeddings/client/requests/EmbeddingsFilterRawEmbeddingsRequest.js → context/client/requests/HandlerContextMetadataUpdateRequest.js} +10 -8
- package/dist/serialization/resources/context/client/requests/ListV2ListContentRequest.d.ts +4 -1
- package/dist/serialization/resources/context/client/requests/ListV2ListContentRequest.js +4 -1
- package/dist/serialization/resources/context/client/requests/SourcesV2SourceDeleteRequest.d.ts +4 -1
- package/dist/serialization/resources/context/client/requests/SourcesV2SourceDeleteRequest.js +4 -1
- package/dist/serialization/resources/context/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/context/client/requests/index.js +3 -1
- package/dist/serialization/resources/context/index.d.ts +1 -0
- package/dist/serialization/resources/context/index.js +1 -0
- package/dist/serialization/resources/context/types/IngestContextRequestType.d.ts +7 -0
- package/dist/serialization/resources/context/types/IngestContextRequestType.js +39 -0
- package/dist/serialization/resources/context/types/ListV2ListContentRequestType.d.ts +7 -0
- package/dist/serialization/resources/context/types/ListV2ListContentRequestType.js +39 -0
- package/dist/serialization/resources/context/types/RelationsContextRequestType.d.ts +7 -0
- package/dist/serialization/resources/context/types/RelationsContextRequestType.js +39 -0
- package/dist/serialization/resources/context/types/SourcesV2SourceDeleteRequestType.d.ts +7 -0
- package/dist/serialization/resources/context/types/SourcesV2SourceDeleteRequestType.js +39 -0
- package/dist/serialization/resources/context/types/index.d.ts +4 -0
- package/dist/serialization/resources/context/types/index.js +20 -0
- package/dist/serialization/resources/{tenants → databases}/client/requests/TenantsTenantCreateRequest.d.ts +2 -0
- package/dist/serialization/resources/{tenants → databases}/client/requests/TenantsTenantCreateRequest.js +2 -0
- package/dist/serialization/resources/databases/client/requests/TenantsTenantMetadataSchemaUpdateRequest.d.ts +10 -0
- package/dist/serialization/resources/databases/client/requests/TenantsTenantMetadataSchemaUpdateRequest.js +42 -0
- package/dist/serialization/resources/databases/client/requests/index.d.ts +2 -0
- package/dist/serialization/resources/databases/client/requests/index.js +7 -0
- package/dist/serialization/resources/index.d.ts +5 -4
- package/dist/serialization/resources/index.js +6 -5
- package/dist/serialization/types/ConnectorsConnector.d.ts +30 -0
- package/dist/serialization/types/ConnectorsConnector.js +62 -0
- package/dist/serialization/types/ConnectorsResource.d.ts +26 -0
- package/dist/serialization/types/ConnectorsResource.js +58 -0
- package/dist/serialization/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +20 -0
- package/dist/serialization/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js +52 -0
- package/dist/serialization/types/GraphEntity.d.ts +1 -0
- package/dist/serialization/types/GraphEntity.js +1 -0
- package/dist/serialization/types/HandlerDeprecationNotice.d.ts +13 -0
- package/dist/serialization/types/HandlerDeprecationNotice.js +45 -0
- package/dist/serialization/types/HandlerEnvelopeGithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +15 -0
- package/dist/serialization/types/{HandlerEnvelopeEmbeddingsInsertResult.js → HandlerEnvelopeGithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js} +4 -4
- package/dist/serialization/types/{HandlerEnvelopeSourcesSourceDeleteResponse.d.ts → HandlerEnvelopeSourcesMemoryDeleteResponse.d.ts} +4 -4
- package/dist/serialization/types/{HandlerEnvelopeSourcesSourceDeleteResponse.js → HandlerEnvelopeSourcesMemoryDeleteResponse.js} +4 -4
- package/dist/serialization/types/HandlerErrorDetail.d.ts +3 -0
- package/dist/serialization/types/HandlerErrorDetail.js +3 -0
- package/dist/serialization/types/HandlerMetadataSchemaUpdateResponse.d.ts +11 -0
- package/dist/serialization/types/HandlerMetadataSchemaUpdateResponse.js +43 -0
- package/dist/serialization/types/HandlerResourceMapping.d.ts +17 -0
- package/dist/serialization/types/{EmbeddingsRawEmbeddingDocument.js → HandlerResourceMapping.js} +8 -5
- package/dist/serialization/types/HandlerResponseMeta.d.ts +7 -0
- package/dist/serialization/types/HandlerResponseMeta.js +7 -0
- package/dist/serialization/types/ListContentFilter.d.ts +2 -2
- package/dist/serialization/types/ListContentFilter.js +2 -2
- package/dist/serialization/types/SearchMetadataFilters.d.ts +7 -0
- package/dist/serialization/types/{EmbeddingsInsertResult.js → SearchMetadataFilters.js} +2 -7
- package/dist/serialization/types/SearchQueryRequestCollections.d.ts +7 -0
- package/dist/serialization/types/SearchQueryRequestCollections.js +42 -0
- package/dist/serialization/types/SearchQueryRequestSubTenantIds.d.ts +7 -0
- package/dist/serialization/types/SearchQueryRequestSubTenantIds.js +42 -0
- package/dist/serialization/types/SearchRecallMode.d.ts +1 -1
- package/dist/serialization/types/SearchRecallMode.js +1 -1
- package/dist/serialization/types/SearchSourceInfo.d.ts +1 -0
- package/dist/serialization/types/SearchSourceInfo.js +1 -0
- package/dist/serialization/types/SearchV2Chunk.d.ts +1 -0
- package/dist/serialization/types/SearchV2Chunk.js +1 -0
- package/dist/serialization/types/{SourcesSourceDeleteResponse.d.ts → SourcesMemoryDeleteResponse.d.ts} +3 -2
- package/dist/serialization/types/{SourcesSourceDeleteResponse.js → SourcesMemoryDeleteResponse.js} +3 -2
- package/dist/serialization/types/TenantsFailedTenant.d.ts +1 -0
- package/dist/serialization/types/TenantsFailedTenant.js +1 -0
- package/dist/serialization/types/TenantsInfraStatusResponseV2.d.ts +1 -0
- package/dist/serialization/types/TenantsInfraStatusResponseV2.js +1 -0
- package/dist/serialization/types/TenantsSubTenantIdsResponse.d.ts +1 -0
- package/dist/serialization/types/TenantsSubTenantIdsResponse.js +1 -0
- package/dist/serialization/types/TenantsTenantCreateAcceptedResponse.d.ts +1 -0
- package/dist/serialization/types/TenantsTenantCreateAcceptedResponse.js +1 -0
- package/dist/serialization/types/TenantsTenantDeleteResponse.d.ts +1 -0
- package/dist/serialization/types/TenantsTenantDeleteResponse.js +1 -0
- package/dist/serialization/types/TenantsTenantIdsResponse.d.ts +2 -0
- package/dist/serialization/types/TenantsTenantIdsResponse.js +2 -0
- package/dist/serialization/types/TenantsTenantStatsResponse.d.ts +1 -0
- package/dist/serialization/types/TenantsTenantStatsResponse.js +1 -0
- package/dist/serialization/types/index.d.ts +12 -10
- package/dist/serialization/types/index.js +12 -10
- package/package.json +1 -1
- package/dist/api/resources/embeddings/client/Client.d.ts +0 -80
- package/dist/api/resources/embeddings/client/Client.js +0 -351
- package/dist/api/resources/embeddings/client/requests/DeleteEmbeddingsRequest.d.ts +0 -18
- package/dist/api/resources/embeddings/client/requests/EmbeddingsFilterRawEmbeddingsRequest.d.ts +0 -15
- package/dist/api/resources/embeddings/client/requests/EmbeddingsInsertRawEmbeddingsRequest.d.ts +0 -14
- package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRawEmbeddingsRequest.d.ts +0 -16
- package/dist/api/resources/embeddings/client/requests/index.d.ts +0 -4
- package/dist/api/resources/embeddings/exports.d.ts +0 -2
- package/dist/api/resources/tenants/client/Client.d.ts +0 -109
- package/dist/api/resources/tenants/client/requests/DeleteTenantsRequest.d.ts +0 -10
- package/dist/api/resources/tenants/client/requests/StatsTenantsRequest.d.ts +0 -10
- package/dist/api/resources/tenants/client/requests/StatusTenantsRequest.d.ts +0 -10
- package/dist/api/resources/tenants/client/requests/SubTenantsTenantsRequest.d.ts +0 -10
- package/dist/api/resources/tenants/client/requests/TenantsTenantCreateRequest.d.ts +0 -11
- package/dist/api/resources/tenants/client/requests/index.d.ts +0 -5
- package/dist/api/resources/tenants/exports.d.ts +0 -2
- package/dist/api/types/EmbeddingsDeleteResult.d.ts +0 -5
- package/dist/api/types/EmbeddingsInsertResult.d.ts +0 -6
- package/dist/api/types/EmbeddingsRawEmbeddingDocument.d.ts +0 -8
- package/dist/api/types/EmbeddingsRawEmbeddingSearchResult.d.ts +0 -8
- package/dist/api/types/EmbeddingsRawEmbeddingVector.d.ts +0 -5
- package/dist/api/types/HandlerEnvelopeArrayEmbeddingsRawEmbeddingSearchResult.d.ts +0 -7
- package/dist/api/types/HandlerEnvelopeEmbeddingsDeleteResult.d.ts +0 -7
- package/dist/api/types/HandlerEnvelopeEmbeddingsInsertResult.d.ts +0 -7
- package/dist/api/types/HandlerEnvelopeSourcesSourceDeleteResponse.d.ts +0 -7
- package/dist/api/types/SourcesSourceDeleteResponse.d.ts +0 -7
- package/dist/serialization/resources/embeddings/client/requests/EmbeddingsFilterRawEmbeddingsRequest.d.ts +0 -14
- package/dist/serialization/resources/embeddings/client/requests/EmbeddingsInsertRawEmbeddingsRequest.d.ts +0 -13
- package/dist/serialization/resources/embeddings/client/requests/EmbeddingsSearchRawEmbeddingsRequest.d.ts +0 -14
- package/dist/serialization/resources/embeddings/client/requests/index.d.ts +0 -3
- package/dist/serialization/resources/embeddings/client/requests/index.js +0 -9
- package/dist/serialization/resources/tenants/client/index.d.ts +0 -1
- package/dist/serialization/resources/tenants/client/index.js +0 -17
- package/dist/serialization/resources/tenants/client/requests/index.d.ts +0 -1
- package/dist/serialization/resources/tenants/client/requests/index.js +0 -5
- package/dist/serialization/types/EmbeddingsDeleteResult.d.ts +0 -11
- package/dist/serialization/types/EmbeddingsInsertResult.d.ts +0 -12
- package/dist/serialization/types/EmbeddingsRawEmbeddingDocument.d.ts +0 -14
- package/dist/serialization/types/EmbeddingsRawEmbeddingSearchResult.d.ts +0 -14
- package/dist/serialization/types/EmbeddingsRawEmbeddingVector.d.ts +0 -10
- package/dist/serialization/types/HandlerEnvelopeArrayEmbeddingsRawEmbeddingSearchResult.d.ts +0 -15
- package/dist/serialization/types/HandlerEnvelopeArrayEmbeddingsRawEmbeddingSearchResult.js +0 -47
- package/dist/serialization/types/HandlerEnvelopeEmbeddingsDeleteResult.d.ts +0 -15
- package/dist/serialization/types/HandlerEnvelopeEmbeddingsDeleteResult.js +0 -47
- package/dist/serialization/types/HandlerEnvelopeEmbeddingsInsertResult.d.ts +0 -15
- /package/dist/api/{resources/embeddings/client/requests/DeleteEmbeddingsRequest.js → client/requests/ListProvidersRequest.js} +0 -0
- /package/dist/api/resources/{embeddings → connectors}/client/index.d.ts +0 -0
- /package/dist/api/resources/{embeddings → connectors}/client/index.js +0 -0
- /package/dist/api/resources/{embeddings/client/requests/EmbeddingsFilterRawEmbeddingsRequest.js → connectors/client/requests/DeleteConnectorsRequest.js} +0 -0
- /package/dist/api/resources/{embeddings/client/requests/EmbeddingsInsertRawEmbeddingsRequest.js → connectors/client/requests/DeleteResourceConnectorsRequest.js} +0 -0
- /package/dist/api/resources/{embeddings/client/requests/EmbeddingsSearchRawEmbeddingsRequest.js → connectors/client/requests/DiscoverConnectorsRequest.js} +0 -0
- /package/dist/api/resources/{tenants/client/requests/DeleteTenantsRequest.js → connectors/client/requests/GetConnectorsRequest.js} +0 -0
- /package/dist/api/resources/{tenants/client/requests/StatsTenantsRequest.js → connectors/client/requests/HandlerConfigureReq.js} +0 -0
- /package/dist/api/resources/{tenants/client/requests/StatusTenantsRequest.js → connectors/client/requests/HandlerConnectorCreateReq.js} +0 -0
- /package/dist/api/resources/{tenants/client/requests/SubTenantsTenantsRequest.js → connectors/client/requests/HandlerDiscoverPreviewReq.js} +0 -0
- /package/dist/api/resources/{tenants/client/requests/TenantsTenantCreateRequest.js → connectors/client/requests/HandlerResourceCreateReq.js} +0 -0
- /package/dist/api/{types/EmbeddingsDeleteResult.js → resources/connectors/client/requests/ListConnectorsRequest.js} +0 -0
- /package/dist/api/{types/EmbeddingsInsertResult.js → resources/connectors/client/requests/ListResourcesConnectorsRequest.js} +0 -0
- /package/dist/api/{types/EmbeddingsRawEmbeddingDocument.js → resources/connectors/client/requests/PatchConnectorsIdCredentialsRequest.js} +0 -0
- /package/dist/api/{types/EmbeddingsRawEmbeddingSearchResult.js → resources/connectors/client/requests/SyncConnectorsRequest.js} +0 -0
- /package/dist/api/resources/{embeddings → connectors}/client/requests/index.js +0 -0
- /package/dist/api/resources/{embeddings → connectors}/index.d.ts +0 -0
- /package/dist/api/resources/{embeddings → connectors}/index.js +0 -0
- /package/dist/api/{types/EmbeddingsRawEmbeddingVector.js → resources/context/client/requests/HandlerContextMetadataUpdateRequest.js} +0 -0
- /package/dist/api/resources/{tenants → databases}/client/index.d.ts +0 -0
- /package/dist/api/resources/{tenants → databases}/client/index.js +0 -0
- /package/dist/api/{types/HandlerEnvelopeArrayEmbeddingsRawEmbeddingSearchResult.js → resources/databases/client/requests/CollectionsDatabasesRequest.js} +0 -0
- /package/dist/api/{types/HandlerEnvelopeEmbeddingsDeleteResult.js → resources/databases/client/requests/DeleteDatabasesRequest.js} +0 -0
- /package/dist/api/{types/HandlerEnvelopeEmbeddingsInsertResult.js → resources/databases/client/requests/StatsDatabasesRequest.js} +0 -0
- /package/dist/api/{types/HandlerEnvelopeSourcesSourceDeleteResponse.js → resources/databases/client/requests/StatusDatabasesRequest.js} +0 -0
- /package/dist/api/{types/SourcesSourceDeleteResponse.js → resources/databases/client/requests/TenantsTenantCreateRequest.js} +0 -0
- /package/dist/api/resources/{tenants → databases}/client/requests/index.js +0 -0
- /package/dist/api/resources/{tenants → databases}/index.d.ts +0 -0
- /package/dist/api/resources/{tenants → databases}/index.js +0 -0
- /package/dist/serialization/resources/{embeddings → connectors}/index.d.ts +0 -0
- /package/dist/serialization/resources/{embeddings → connectors}/index.js +0 -0
- /package/dist/serialization/resources/{embeddings → databases}/client/index.d.ts +0 -0
- /package/dist/serialization/resources/{embeddings → databases}/client/index.js +0 -0
- /package/dist/serialization/resources/{tenants → databases}/index.d.ts +0 -0
- /package/dist/serialization/resources/{tenants → databases}/index.js +0 -0
package/README.md
CHANGED
|
@@ -1,750 +1,689 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
The official TypeScript SDK for
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
1
|
+
# HydraDB TypeScript SDK
|
|
2
|
+
|
|
3
|
+
The official TypeScript/JavaScript SDK for [HydraDB](https://hydradb.com) — a managed retrieval
|
|
4
|
+
engine that combines vector search, full‑text search, and a knowledge graph behind a single API.
|
|
5
|
+
|
|
6
|
+
- **Package:** `@hydradb/sdk`
|
|
7
|
+
- **Client class:** `HydraDBClient`
|
|
8
|
+
- **Version:** `2.1.1` (API version `2`)
|
|
9
|
+
- **Docs:** https://docs.hydradb.com
|
|
10
|
+
- **Runtime:** Node.js 18+ (works with any `fetch`-capable runtime)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Table of contents
|
|
15
|
+
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [Quick start](#quick-start)
|
|
18
|
+
- [Client configuration](#client-configuration)
|
|
19
|
+
- [Core concepts](#core-concepts)
|
|
20
|
+
- [Responses & raw access](#responses--raw-access)
|
|
21
|
+
- [Endpoints](#endpoints)
|
|
22
|
+
- [`query` — unified retrieval](#query--unified-retrieval)
|
|
23
|
+
- [Context (`client.context`)](#context-clientcontext)
|
|
24
|
+
- [`ingest`](#contextingest)
|
|
25
|
+
- [`list`](#contextlist)
|
|
26
|
+
- [`inspect`](#contextinspect)
|
|
27
|
+
- [`status`](#contextstatus)
|
|
28
|
+
- [`relations`](#contextrelations)
|
|
29
|
+
- [`updateSourceMetadata`](#contextupdatesourcemetadata)
|
|
30
|
+
- [`delete`](#contextdelete)
|
|
31
|
+
- [Databases (`client.databases`)](#databases-clientdatabases)
|
|
32
|
+
- [`create`](#databasescreate)
|
|
33
|
+
- [`list`](#databaseslist)
|
|
34
|
+
- [`collections`](#databasescollections)
|
|
35
|
+
- [`stats`](#databasesstats)
|
|
36
|
+
- [`status`](#databasesstatus)
|
|
37
|
+
- [`delete`](#databasesdelete)
|
|
38
|
+
- [Webhooks (`client.webhooks`)](#webhooks-clientwebhooks)
|
|
39
|
+
- [`register`](#webhooksregister)
|
|
40
|
+
- [`get`](#webhooksget)
|
|
41
|
+
- [`test`](#webhookstest)
|
|
42
|
+
- [`delete`](#webhooksdelete)
|
|
43
|
+
- [`listDeliveries`](#webhookslistdeliveries)
|
|
44
|
+
- [`getDelivery`](#webhooksgetdelivery)
|
|
45
|
+
- [`retryDelivery`](#webhooksretrydelivery)
|
|
46
|
+
- [Error handling](#error-handling)
|
|
47
|
+
- [Advanced](#advanced)
|
|
48
|
+
- [Per-request options (timeouts, retries, abort)](#per-request-options-timeouts-retries-abort)
|
|
49
|
+
- [Passthrough `fetch`](#passthrough-fetch)
|
|
50
|
+
- [Custom fetch & logging](#custom-fetch--logging)
|
|
51
|
+
|
|
52
|
+
---
|
|
19
53
|
|
|
20
54
|
## Installation
|
|
21
55
|
|
|
22
56
|
```bash
|
|
23
57
|
npm install @hydradb/sdk
|
|
24
|
-
# or
|
|
25
|
-
yarn add @hydradb/sdk
|
|
26
|
-
# or
|
|
27
|
-
pnpm add @hydradb/sdk
|
|
58
|
+
# or: pnpm add @hydradb/sdk / yarn add @hydradb/sdk
|
|
28
59
|
```
|
|
29
60
|
|
|
30
|
-
##
|
|
61
|
+
## Quick start
|
|
31
62
|
|
|
32
|
-
```
|
|
63
|
+
```typescript
|
|
33
64
|
import { HydraDBClient } from "@hydradb/sdk";
|
|
34
65
|
|
|
35
66
|
const client = new HydraDBClient({
|
|
36
|
-
token:
|
|
67
|
+
token: "YOUR_API_KEY", // bearer token
|
|
37
68
|
});
|
|
38
69
|
|
|
39
|
-
|
|
40
|
-
const
|
|
70
|
+
// Run a hybrid search over a database ("tenant")
|
|
71
|
+
const result = await client.query({
|
|
72
|
+
query: "What is our refund policy?",
|
|
73
|
+
database: "acme-corp",
|
|
74
|
+
type: "knowledge",
|
|
75
|
+
maxResults: 5,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(result.data);
|
|
41
79
|
```
|
|
42
80
|
|
|
43
|
-
|
|
81
|
+
Every method returns an awaitable `HttpResponsePromise`. `await`-ing it resolves to the parsed
|
|
82
|
+
response body (a `HandlerEnvelope…` object whose payload is on `.data`). See
|
|
83
|
+
[Responses & raw access](#responses--raw-access).
|
|
44
84
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Client configuration
|
|
48
88
|
|
|
49
|
-
|
|
89
|
+
```typescript
|
|
90
|
+
import { HydraDBClient, HydraDBEnvironment } from "@hydradb/sdk";
|
|
50
91
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
92
|
+
const client = new HydraDBClient({
|
|
93
|
+
token: "YOUR_API_KEY",
|
|
94
|
+
apiVersion: "2", // optional, defaults to "2"
|
|
95
|
+
environment: HydraDBEnvironment.Default, // https://api.hydradb.com
|
|
96
|
+
// baseUrl: "https://api.hydradb.com", // override for self-hosted / staging
|
|
97
|
+
timeoutInSeconds: 60, // default 60
|
|
98
|
+
maxRetries: 2, // default 2
|
|
99
|
+
headers: { "X-Custom-Header": "value" }, // sent on every request
|
|
55
100
|
});
|
|
56
101
|
```
|
|
57
102
|
|
|
58
|
-
|
|
103
|
+
| Option | Type | Default | Notes |
|
|
104
|
+
| ------------------ | ------------------------------------- | ------------------------ | ----- |
|
|
105
|
+
| `token` | `string \| () => string \| Promise` | – | Bearer token. Accepts a supplier for dynamic/refreshing tokens. |
|
|
106
|
+
| `apiVersion` | `string` | `"2"` | Sets the `API-Version` header. |
|
|
107
|
+
| `environment` | `HydraDBEnvironment \| string` | `Default` | `Default` → `https://api.hydradb.com`. |
|
|
108
|
+
| `baseUrl` | `string` | – | Explicit URL; overrides `environment`. |
|
|
109
|
+
| `timeoutInSeconds` | `number` | `60` | Per‑request timeout. |
|
|
110
|
+
| `maxRetries` | `number` | `2` | Automatic retries on transient failures. |
|
|
111
|
+
| `headers` | `Record<string, string>` | – | Extra headers on every request. |
|
|
112
|
+
| `fetch` | `typeof fetch` | runtime default | Custom fetch implementation. |
|
|
113
|
+
| `logging` | `LogConfig \| Logger` | silent | SDK logging. |
|
|
59
114
|
|
|
60
|
-
> Note
|
|
115
|
+
> **Note:** all request fields use **camelCase** in TypeScript (e.g. `subTenantId`,
|
|
116
|
+
> `maxResults`); the SDK maps them to the API's snake_case wire format for you.
|
|
61
117
|
|
|
62
|
-
|
|
118
|
+
---
|
|
63
119
|
|
|
64
|
-
|
|
120
|
+
## Core concepts
|
|
65
121
|
|
|
66
|
-
|
|
67
|
-
|---|---|
|
|
68
|
-
| `client.query(...)` | Retrieve knowledge and/or memory in a single call. |
|
|
69
|
-
| `client.context` | Ingest, inspect, list, delete sources, and fetch graph relations. |
|
|
70
|
-
| `client.tenants` | Create, list, delete, and inspect tenants. |
|
|
71
|
-
| `client.webhooks` | Register and manage webhooks and inspect deliveries. |
|
|
122
|
+
**Database vs. Collection (tenant vs. sub‑tenant).** HydraDB v2 renamed the isolation scopes:
|
|
72
123
|
|
|
73
|
-
|
|
124
|
+
| v2 name (canonical) | v1 alias (deprecated, still accepted) | Meaning |
|
|
125
|
+
| ------------------- | ------------------------------------- | ------- |
|
|
126
|
+
| `database` | `tenantId` | Top‑level isolation boundary. |
|
|
127
|
+
| `collection` | `subTenantId` | A namespace within a database. |
|
|
74
128
|
|
|
75
|
-
|
|
129
|
+
The server’s `TenantAliases` middleware reconciles the two, so you can pass either — but new
|
|
130
|
+
code should use `database` / `collection`. The legacy aliases will be removed in a future release.
|
|
76
131
|
|
|
77
|
-
|
|
132
|
+
**Corpora (`type`).** Data is split into two corpora you can target independently:
|
|
133
|
+
`"knowledge"` (documents), `"memory"` (agent memories), or `"all"`.
|
|
78
134
|
|
|
79
|
-
|
|
135
|
+
---
|
|
80
136
|
|
|
81
|
-
|
|
137
|
+
## Responses & raw access
|
|
82
138
|
|
|
83
|
-
|
|
139
|
+
`await`-ing any call gives you the parsed body:
|
|
84
140
|
|
|
85
|
-
```
|
|
86
|
-
await client.
|
|
87
|
-
|
|
88
|
-
|
|
141
|
+
```typescript
|
|
142
|
+
const res = await client.databases.list();
|
|
143
|
+
console.log(res.data); // the payload
|
|
144
|
+
console.log(res.meta); // request metadata
|
|
89
145
|
```
|
|
90
146
|
|
|
91
|
-
|
|
147
|
+
To also get the HTTP status and headers, call `.withRawResponse()`:
|
|
92
148
|
|
|
93
|
-
|
|
149
|
+
```typescript
|
|
150
|
+
const { data, rawResponse } = await client.query({ query: "hi", database: "acme-corp" })
|
|
151
|
+
.withRawResponse();
|
|
94
152
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
isEmbeddingsTenant: true,
|
|
99
|
-
embeddingsDimension: 1536,
|
|
100
|
-
});
|
|
153
|
+
console.log(rawResponse.status);
|
|
154
|
+
console.log(rawResponse.headers.get("x-request-id"));
|
|
155
|
+
console.log(data);
|
|
101
156
|
```
|
|
102
157
|
|
|
103
|
-
|
|
158
|
+
---
|
|
104
159
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
```ts
|
|
108
|
-
await client.tenants.create({
|
|
109
|
-
tenantId: TENANT_ID,
|
|
110
|
-
tenantMetadataSchema: [
|
|
111
|
-
{
|
|
112
|
-
name: "department",
|
|
113
|
-
dataType: "string",
|
|
114
|
-
enableMatch: true,
|
|
115
|
-
enableDenseEmbedding: false,
|
|
116
|
-
enableSparseEmbedding: false,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
});
|
|
120
|
-
```
|
|
160
|
+
## Endpoints
|
|
121
161
|
|
|
122
|
-
###
|
|
162
|
+
### `query` — unified retrieval
|
|
123
163
|
|
|
124
|
-
|
|
125
|
-
const tenants = await client.tenants.list();
|
|
126
|
-
console.log(tenants);
|
|
127
|
-
```
|
|
164
|
+
`POST /query` → `HandlerEnvelopeSearchV2RetrievalResult`
|
|
128
165
|
|
|
129
|
-
|
|
166
|
+
The single retrieval endpoint. Dispatches across corpus (`type`) and retrieval method
|
|
167
|
+
(`queryBy`), optionally enriching results with knowledge‑graph context.
|
|
130
168
|
|
|
131
|
-
```
|
|
132
|
-
const
|
|
133
|
-
|
|
169
|
+
```typescript
|
|
170
|
+
const result = await client.query({
|
|
171
|
+
query: "How do I rotate API keys?",
|
|
172
|
+
database: "acme-corp", // v2 name for the tenant scope
|
|
173
|
+
type: "knowledge", // "knowledge" | "memory" | "all"
|
|
174
|
+
queryBy: "hybrid", // "hybrid" | "text"
|
|
175
|
+
mode: "auto", // "fast" | "thinking" | "auto"
|
|
176
|
+
operator: "or", // "or" | "and" | "phrase"
|
|
177
|
+
maxResults: 10,
|
|
178
|
+
numRelatedChunks: 3,
|
|
179
|
+
graphContext: true, // include KG context (default true)
|
|
180
|
+
recencyBias: 0.2,
|
|
181
|
+
metadataFilters: { // exact-match on tenant/document metadata
|
|
182
|
+
department: "security",
|
|
183
|
+
additional_metadata: { author: "ada" },
|
|
184
|
+
},
|
|
134
185
|
});
|
|
135
186
|
|
|
136
|
-
console.log(
|
|
187
|
+
console.log(result.data);
|
|
137
188
|
```
|
|
138
189
|
|
|
139
|
-
|
|
190
|
+
**Scoping to specific collections** (preferred over the deprecated `subTenantIds`):
|
|
140
191
|
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
192
|
+
```typescript
|
|
193
|
+
// Equal weighting across collections
|
|
194
|
+
await client.query({ query: "pricing", database: "acme-corp", collections: ["eu", "us"] });
|
|
145
195
|
|
|
146
|
-
|
|
196
|
+
// Weighted ranking (one decimal place max)
|
|
197
|
+
await client.query({ query: "pricing", database: "acme-corp", collections: { eu: 1.0, us: 0.5 } });
|
|
147
198
|
```
|
|
148
199
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
```ts
|
|
152
|
-
const stats = await client.tenants.stats({
|
|
153
|
-
tenantId: TENANT_ID,
|
|
154
|
-
});
|
|
200
|
+
**Scoping to specific source IDs** — `ids` applies a hard `source_id in [...]` pre‑filter; if
|
|
201
|
+
nothing matches it returns empty rather than widening to the whole corpus:
|
|
155
202
|
|
|
156
|
-
|
|
203
|
+
```typescript
|
|
204
|
+
await client.query({ query: "onboarding", database: "acme-corp", ids: ["doc_123", "doc_456"] });
|
|
157
205
|
```
|
|
158
206
|
|
|
159
|
-
|
|
207
|
+
Key fields (`SearchQueryRequest`):
|
|
160
208
|
|
|
161
|
-
|
|
209
|
+
| Field | Type | Notes |
|
|
210
|
+
| ------------------------- | ----------------------------------- | ----- |
|
|
211
|
+
| `query` | `string` | The search text. |
|
|
212
|
+
| `database` | `string` | Tenant scope (v2). Alias: `tenantId`. |
|
|
213
|
+
| `collection` / `collections` | `string` / `string[] \| Record<string, number>` | Sub‑tenant scope. Prefer over `subTenantId(s)`. |
|
|
214
|
+
| `type` | `"knowledge" \| "memory" \| "all"` | Corpus to query. |
|
|
215
|
+
| `queryBy` | `"hybrid" \| "text"` | Retrieval method. |
|
|
216
|
+
| `mode` | `"fast" \| "thinking" \| "auto"` | Recall mode. |
|
|
217
|
+
| `operator` | `"or" \| "and" \| "phrase"` | Text‑match operator. |
|
|
218
|
+
| `maxResults` | `number` | Result cap. |
|
|
219
|
+
| `numRelatedChunks` | `number` | Neighboring chunks to attach. |
|
|
220
|
+
| `graphContext` | `boolean` | Include KG context. Default `true`. |
|
|
221
|
+
| `queryApps` | `boolean` | App‑aware knowledge retrieval. |
|
|
222
|
+
| `queryForcefulRelations` | `boolean` | Force relation expansion. Default `true`. |
|
|
223
|
+
| `metadataFilters` | `Record<string, unknown>` | Exact‑match (nest doc metadata under `additional_metadata`). |
|
|
224
|
+
| `recencyBias` | `number` | Boost newer sources. |
|
|
225
|
+
| `ids` | `string[]` | Restrict to specific source IDs. |
|
|
162
226
|
|
|
163
|
-
|
|
164
|
-
await client.tenants.delete({
|
|
165
|
-
tenantId: TENANT_ID,
|
|
166
|
-
});
|
|
167
|
-
```
|
|
227
|
+
---
|
|
168
228
|
|
|
169
|
-
|
|
229
|
+
### Context (`client.context`)
|
|
170
230
|
|
|
171
|
-
|
|
231
|
+
Everything about the data *inside* a database: ingesting, listing, inspecting, updating
|
|
232
|
+
metadata, checking processing status, reading graph relations, and deleting.
|
|
172
233
|
|
|
173
|
-
|
|
234
|
+
#### `context.ingest`
|
|
174
235
|
|
|
175
|
-
`
|
|
236
|
+
`POST /context/ingest` (multipart) → `HandlerEnvelopeIngestionV2SourceUploadResponse`
|
|
176
237
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
tenantId: TENANT_ID,
|
|
180
|
-
subTenantId: SUB_TENANT_ID,
|
|
181
|
-
type: "knowledge",
|
|
182
|
-
documents: [
|
|
183
|
-
{
|
|
184
|
-
path: "./report.pdf",
|
|
185
|
-
filename: "report.pdf",
|
|
186
|
-
contentType: "application/pdf",
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
upsert: true,
|
|
190
|
-
});
|
|
238
|
+
Ingest knowledge documents or memories. `documents` is a file upload; the other structured
|
|
239
|
+
fields are JSON strings.
|
|
191
240
|
|
|
192
|
-
|
|
193
|
-
|
|
241
|
+
```typescript
|
|
242
|
+
import { createReadStream } from "fs";
|
|
194
243
|
|
|
195
|
-
|
|
244
|
+
// Ingest a document file
|
|
245
|
+
const res = await client.context.ingest({
|
|
246
|
+
database: "acme-corp", // required
|
|
247
|
+
documents: createReadStream("handbook.pdf"),
|
|
248
|
+
collection: "hr",
|
|
249
|
+
type: "knowledge",
|
|
250
|
+
// documentMetadata is a JSON *array* — one object per uploaded file.
|
|
251
|
+
documentMetadata: JSON.stringify([{ title: "Employee Handbook", author: "HR" }]),
|
|
252
|
+
upsert: "true", // form field is a string
|
|
253
|
+
});
|
|
196
254
|
|
|
197
|
-
|
|
255
|
+
console.log(res.data);
|
|
198
256
|
|
|
199
|
-
|
|
257
|
+
// Ingest memories (no file). Each item needs "text" (or "user_assistant_pairs").
|
|
200
258
|
await client.context.ingest({
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
type: "
|
|
204
|
-
documents: [
|
|
205
|
-
{ path: "./a.pdf", filename: "a.pdf", contentType: "application/pdf" },
|
|
206
|
-
{ path: "./notes.txt", filename: "notes.txt", contentType: "text/plain" },
|
|
207
|
-
],
|
|
208
|
-
upsert: true,
|
|
259
|
+
database: "acme-corp",
|
|
260
|
+
memories: JSON.stringify([{ text: "User prefers dark mode" }]),
|
|
261
|
+
type: "memory",
|
|
209
262
|
});
|
|
210
263
|
```
|
|
211
264
|
|
|
212
|
-
|
|
265
|
+
| Field | Type | Notes |
|
|
266
|
+
| ------------------ | ------------------------ | ----- |
|
|
267
|
+
| `database` | `string` (required) | Database (tenant scope). Alias: `tenantId`. |
|
|
268
|
+
| `documents` | `Uploadable` | File upload (stream, `Blob`, `Buffer`, etc.). |
|
|
269
|
+
| `memories` | `string` | JSON **array** string; each item needs `text` (or `user_assistant_pairs`). |
|
|
270
|
+
| `documentMetadata` | `string` | JSON **array** string of per‑document metadata — one object per uploaded file (count must match). |
|
|
271
|
+
| `appKnowledge` | `string` | App‑knowledge items as a JSON **array** string (not raw text). |
|
|
272
|
+
| `graphPayload` | `string` | Pre‑computed graph payload. |
|
|
273
|
+
| `collection` | `string` | Collection (sub‑tenant scope). Alias: `subTenantId`. |
|
|
274
|
+
| `type` | `string` | `"knowledge"` or `"memory"`. |
|
|
275
|
+
| `upsert` | `string` | `"true"` to upsert on existing IDs. |
|
|
213
276
|
|
|
214
|
-
|
|
215
|
-
import { readFileSync } from "node:fs";
|
|
277
|
+
#### `context.list`
|
|
216
278
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
279
|
+
`POST /context/list` → `HandlerEnvelopeListV2SourceListResponse`
|
|
280
|
+
|
|
281
|
+
List sources or memories (IDs + metadata) for a database, with filtering and pagination.
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
const res = await client.context.list({
|
|
285
|
+
database: "acme-corp",
|
|
286
|
+
collection: "hr",
|
|
220
287
|
type: "knowledge",
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
},
|
|
227
|
-
|
|
288
|
+
page: 1,
|
|
289
|
+
pageSize: 50,
|
|
290
|
+
includeFields: ["title", "type", "timestamp"],
|
|
291
|
+
filters: {
|
|
292
|
+
metadata: { department: "finance" }, // tenant/source metadata
|
|
293
|
+
additionalMetadata: { author: "ada" }, // document metadata
|
|
294
|
+
sourceFields: { type: "pdf" }, // well-known source fields
|
|
295
|
+
},
|
|
228
296
|
});
|
|
297
|
+
|
|
298
|
+
for (const source of res.data?.inner?.sources ?? []) {
|
|
299
|
+
console.log(source);
|
|
300
|
+
}
|
|
229
301
|
```
|
|
230
302
|
|
|
231
|
-
|
|
303
|
+
#### `context.inspect`
|
|
232
304
|
|
|
233
|
-
`
|
|
305
|
+
`GET /context/inspect` → `HandlerEnvelopeFetchV2SourceFetchResponse`
|
|
234
306
|
|
|
235
|
-
|
|
236
|
-
const documentMetadata = [
|
|
237
|
-
{
|
|
238
|
-
id: "doc_a",
|
|
239
|
-
metadata: { department: "sales" },
|
|
240
|
-
additional_metadata: { author: "Alice" },
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
id: "doc_b",
|
|
244
|
-
metadata: { department: "marketing" },
|
|
245
|
-
additional_metadata: { author: "Bob" },
|
|
246
|
-
relations: {
|
|
247
|
-
cortex_source_ids: ["doc_a"],
|
|
248
|
-
properties: { relation: "same_upload_batch" },
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
];
|
|
307
|
+
Fetch a single ingested source: its content, inferred content, and a presigned download URL.
|
|
252
308
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
],
|
|
261
|
-
documentMetadata: JSON.stringify(documentMetadata),
|
|
262
|
-
upsert: true,
|
|
309
|
+
```typescript
|
|
310
|
+
const res = await client.context.inspect({
|
|
311
|
+
id: "doc_1234", // required — source ID
|
|
312
|
+
database: "acme-corp", // required
|
|
313
|
+
collection: "hr",
|
|
314
|
+
expirySeconds: 3600, // presigned URL lifetime
|
|
315
|
+
mode: "both", // fetch mode: "content", "url", or "both"
|
|
263
316
|
});
|
|
317
|
+
console.log(res.data);
|
|
264
318
|
```
|
|
265
319
|
|
|
266
|
-
|
|
320
|
+
#### `context.status`
|
|
267
321
|
|
|
268
|
-
`
|
|
322
|
+
`GET /context/status` → `HandlerEnvelopeIngestionV2BatchProcessingStatus`
|
|
269
323
|
|
|
270
|
-
|
|
271
|
-
const appKnowledge = [
|
|
272
|
-
{
|
|
273
|
-
id: "app_source_1",
|
|
274
|
-
title: "CRM Account Note",
|
|
275
|
-
content: { text: "Acme is interested in the enterprise plan." },
|
|
276
|
-
type: "document",
|
|
277
|
-
tenant_metadata: { department: "sales" },
|
|
278
|
-
document_metadata: { source: "crm" },
|
|
279
|
-
},
|
|
280
|
-
];
|
|
324
|
+
Check processing status for one or more source IDs.
|
|
281
325
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
326
|
+
```typescript
|
|
327
|
+
// Single source
|
|
328
|
+
await client.context.status({ database: "acme-corp", id: "doc_1234", collection: "hr" });
|
|
329
|
+
|
|
330
|
+
// Batch
|
|
331
|
+
const res = await client.context.status({
|
|
332
|
+
database: "acme-corp",
|
|
333
|
+
ids: ["doc_1", "doc_2", "doc_3"],
|
|
288
334
|
});
|
|
335
|
+
console.log(res.data);
|
|
289
336
|
```
|
|
290
337
|
|
|
291
|
-
|
|
338
|
+
#### `context.relations`
|
|
292
339
|
|
|
293
|
-
`
|
|
340
|
+
`GET /context/relations` → `HandlerEnvelopeGraphGraphRelationsResponse`
|
|
294
341
|
|
|
295
|
-
|
|
296
|
-
const memories = [
|
|
297
|
-
{
|
|
298
|
-
source_id: "memory_001",
|
|
299
|
-
text: "User prefers detailed technical explanations.",
|
|
300
|
-
title: "User preference",
|
|
301
|
-
infer: true,
|
|
302
|
-
metadata: { category: "preference" },
|
|
303
|
-
},
|
|
304
|
-
];
|
|
342
|
+
Return knowledge‑graph relations for a whole database or a single source.
|
|
305
343
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
344
|
+
```typescript
|
|
345
|
+
const res = await client.context.relations({
|
|
346
|
+
database: "acme-corp", // required
|
|
347
|
+
collection: "hr",
|
|
348
|
+
id: "doc_1234", // omit for database-wide relations
|
|
349
|
+
type: "knowledge", // "knowledge" | "memory"
|
|
350
|
+
limit: 100,
|
|
351
|
+
cursor: 0, // pagination cursor
|
|
312
352
|
});
|
|
353
|
+
console.log(res.data);
|
|
313
354
|
```
|
|
314
355
|
|
|
315
|
-
|
|
356
|
+
#### `context.updateSourceMetadata`
|
|
316
357
|
|
|
317
|
-
`
|
|
358
|
+
`PATCH /context/{id}/metadata` → `HandlerEnvelope…MetadataEditResult`
|
|
318
359
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
tenantId: TENANT_ID,
|
|
322
|
-
subTenantId: SUB_TENANT_ID,
|
|
323
|
-
ids: ["source-id-1", "source-id-2"],
|
|
324
|
-
});
|
|
360
|
+
Merge/upsert `tenantMetadata` and `additionalMetadata` for one source. `collection`
|
|
361
|
+
(alias `subTenantId`) is required by the server.
|
|
325
362
|
|
|
326
|
-
|
|
363
|
+
```typescript
|
|
364
|
+
const res = await client.context.updateSourceMetadata({
|
|
365
|
+
id: "doc_1234", // required — source ID (path param)
|
|
366
|
+
database: "acme-corp",
|
|
367
|
+
collection: "hr", // required by the server
|
|
368
|
+
// tenantMetadata keys must be declared in the database's tenant_metadata_schema
|
|
369
|
+
// (and match the declared type). Use additionalMetadata for free-form fields.
|
|
370
|
+
tenantMetadata: { department: "finance" },
|
|
371
|
+
additionalMetadata: { author: "ada", tags: ["policy", "2026"], reviewed: true },
|
|
372
|
+
});
|
|
373
|
+
console.log(res.data);
|
|
327
374
|
```
|
|
328
375
|
|
|
329
|
-
|
|
376
|
+
> **Note:** although the SDK exposes a `documentMetadata` parameter here, this endpoint
|
|
377
|
+
> **rejects** it (HTTP 400 "document_metadata is not accepted; use additional_metadata").
|
|
378
|
+
> Put per-document fields in `additionalMetadata` instead.
|
|
330
379
|
|
|
331
|
-
|
|
332
|
-
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
380
|
+
#### `context.delete`
|
|
333
381
|
|
|
334
|
-
|
|
335
|
-
while (true) {
|
|
336
|
-
const status = await client.context.status({
|
|
337
|
-
tenantId: TENANT_ID,
|
|
338
|
-
subTenantId: SUB_TENANT_ID,
|
|
339
|
-
ids,
|
|
340
|
-
});
|
|
382
|
+
`DELETE /context` → `HandlerEnvelopeSourcesMemoryDeleteResponse`
|
|
341
383
|
|
|
342
|
-
|
|
343
|
-
// schema) and break once everything has completed or errored.
|
|
344
|
-
console.log(status);
|
|
384
|
+
Delete one or more sources or memories by ID.
|
|
345
385
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
386
|
+
```typescript
|
|
387
|
+
const res = await client.context.delete({
|
|
388
|
+
database: "acme-corp",
|
|
389
|
+
collection: "hr",
|
|
390
|
+
ids: ["doc_1234", "doc_5678"],
|
|
391
|
+
type: "knowledge",
|
|
392
|
+
});
|
|
393
|
+
console.log(res.data);
|
|
349
394
|
```
|
|
350
395
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
`client.query()` is the single retrieval entry point. It searches knowledge, memory, or both, with optional graph context. It returns a promise resolving to a `QueryApiResponse`; the retrieval payload is on `.data`.
|
|
354
|
-
|
|
355
|
-
```ts
|
|
356
|
-
const response = await client.query({
|
|
357
|
-
tenantId: TENANT_ID,
|
|
358
|
-
subTenantId: SUB_TENANT_ID,
|
|
359
|
-
query: "What did the account notes say about Acme?",
|
|
360
|
-
maxResults: 10,
|
|
361
|
-
mode: "fast",
|
|
362
|
-
alpha: 0.8,
|
|
363
|
-
recencyBias: 0,
|
|
364
|
-
graphContext: true,
|
|
365
|
-
});
|
|
396
|
+
---
|
|
366
397
|
|
|
367
|
-
|
|
368
|
-
console.log(response.data?.sources);
|
|
369
|
-
```
|
|
398
|
+
### Databases (`client.databases`)
|
|
370
399
|
|
|
371
|
-
|
|
400
|
+
Manage databases (tenants) and inspect their collections, stats, and provisioning status.
|
|
372
401
|
|
|
373
|
-
|
|
402
|
+
#### `databases.create`
|
|
374
403
|
|
|
375
|
-
|
|
376
|
-
// Knowledge only
|
|
377
|
-
await client.query({ tenantId: TENANT_ID, query: "quarterly revenue", type: "knowledge" });
|
|
404
|
+
`POST /databases` → `HandlerEnvelopeTenantsTenantCreateAcceptedResponse`
|
|
378
405
|
|
|
379
|
-
|
|
380
|
-
await client.query({ tenantId: TENANT_ID, query: "user preferences", type: "memory" });
|
|
406
|
+
Create a new database, optionally with a custom metadata schema for its collections.
|
|
381
407
|
|
|
382
|
-
|
|
383
|
-
await client.
|
|
408
|
+
```typescript
|
|
409
|
+
const res = await client.databases.create({
|
|
410
|
+
database: "acme-corp",
|
|
411
|
+
embeddingsDimension: 1536,
|
|
412
|
+
databaseMetadataSchema: [
|
|
413
|
+
{
|
|
414
|
+
name: "department",
|
|
415
|
+
dataType: "VARCHAR", // BOOL | INT8..INT64 | FLOAT | DOUBLE | VARCHAR | JSON | ARRAY
|
|
416
|
+
maxLength: 128,
|
|
417
|
+
enableMatch: true,
|
|
418
|
+
},
|
|
419
|
+
{ name: "priority", dataType: "INT32" },
|
|
420
|
+
],
|
|
421
|
+
});
|
|
422
|
+
console.log(res.data);
|
|
384
423
|
```
|
|
385
424
|
|
|
386
|
-
|
|
425
|
+
> Creation is asynchronous — poll [`databases.status`](#databasesstatus) until infrastructure
|
|
426
|
+
> is provisioned before ingesting.
|
|
387
427
|
|
|
388
|
-
|
|
428
|
+
#### `databases.list`
|
|
389
429
|
|
|
390
|
-
|
|
391
|
-
- `0.0`: more keyword/BM25 weighted
|
|
392
|
-
- `"auto"`: backend chooses the balance
|
|
430
|
+
`GET /databases` → `HandlerEnvelopeTenantsTenantIdsResponse`
|
|
393
431
|
|
|
394
|
-
|
|
432
|
+
List all databases for the authenticated user. Takes no request body.
|
|
395
433
|
|
|
396
|
-
```
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
subTenantId: SUB_TENANT_ID,
|
|
400
|
-
query: "enterprise plan",
|
|
401
|
-
queryBy: "text",
|
|
402
|
-
operator: "phrase", // "or" | "and" | "phrase"
|
|
403
|
-
type: "knowledge",
|
|
404
|
-
});
|
|
434
|
+
```typescript
|
|
435
|
+
const res = await client.databases.list();
|
|
436
|
+
console.log(res.data);
|
|
405
437
|
```
|
|
406
438
|
|
|
407
|
-
|
|
439
|
+
#### `databases.collections`
|
|
408
440
|
|
|
409
|
-
|
|
441
|
+
`GET /databases/collections` → `HandlerEnvelopeTenantsSubTenantIdsResponse`
|
|
410
442
|
|
|
411
|
-
|
|
443
|
+
List all collections within a database.
|
|
412
444
|
|
|
413
|
-
```
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
subTenantId: SUB_TENANT_ID,
|
|
417
|
-
query: "revenue forecast",
|
|
418
|
-
maxResults: 10,
|
|
419
|
-
metadataFilters: {
|
|
420
|
-
department: "sales",
|
|
421
|
-
additional_metadata: { author: "Alice" },
|
|
422
|
-
},
|
|
423
|
-
});
|
|
445
|
+
```typescript
|
|
446
|
+
const res = await client.databases.collections({ database: "acme-corp" });
|
|
447
|
+
console.log(res.data);
|
|
424
448
|
```
|
|
425
449
|
|
|
426
|
-
|
|
450
|
+
#### `databases.stats`
|
|
427
451
|
|
|
428
|
-
|
|
429
|
-
|---|---|---|
|
|
430
|
-
| `tenantId` | `string` | Tenant identifier (required). |
|
|
431
|
-
| `query` | `string` | Search terms (required). |
|
|
432
|
-
| `subTenantId` | `string` | Optional sub-tenant identifier. |
|
|
433
|
-
| `maxResults` | `number` | Maximum number of results. |
|
|
434
|
-
| `mode` | `string` | `"fast"` or `"thinking"`. |
|
|
435
|
-
| `alpha` | `string \| number` | Hybrid balance (`0.0`–`1.0` or `"auto"`). |
|
|
436
|
-
| `recencyBias` | `number` | Preference for newer content (`0.0`–`1.0`). |
|
|
437
|
-
| `graphContext` | `boolean` | Enable graph context (on by default in v2; set `false` to omit). |
|
|
438
|
-
| `queryForcefulRelations` | `boolean` | Search forceful relations in thinking mode. |
|
|
439
|
-
| `additionalContext` | `string` | Extra context to guide retrieval. |
|
|
440
|
-
| `queryApps` | `boolean` | Run a parallel app-aware retrieval lane and fuse results. |
|
|
441
|
-
| `metadataFilters` | `object` | Key-value metadata filters. |
|
|
442
|
-
| `type` | `string` | `"knowledge"`, `"memory"`, or `"all"`. |
|
|
443
|
-
| `queryBy` | `string` | `"hybrid"` or `"text"`. |
|
|
444
|
-
| `operator` | `string` | `"or"`, `"and"`, or `"phrase"` (only with `queryBy: "text"`). |
|
|
452
|
+
`GET /databases/stats` → `HandlerEnvelopeTenantsTenantStatsResponse`
|
|
445
453
|
|
|
446
|
-
|
|
454
|
+
Get collection statistics for a database.
|
|
447
455
|
|
|
448
|
-
|
|
456
|
+
```typescript
|
|
457
|
+
const res = await client.databases.stats({ database: "acme-corp" });
|
|
458
|
+
console.log(res.data);
|
|
459
|
+
```
|
|
449
460
|
|
|
450
|
-
|
|
451
|
-
import { HydraDBClient, buildString } from "@hydradb/sdk";
|
|
461
|
+
#### `databases.status`
|
|
452
462
|
|
|
453
|
-
|
|
463
|
+
`GET /databases/status` → `HandlerEnvelopeTenantsInfraStatusResponseV2`
|
|
454
464
|
|
|
455
|
-
|
|
456
|
-
tenantId: TENANT_ID,
|
|
457
|
-
query: "What does the user prefer?",
|
|
458
|
-
});
|
|
465
|
+
Check infrastructure provisioning status for a database.
|
|
459
466
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
console.log(
|
|
467
|
+
```typescript
|
|
468
|
+
const res = await client.databases.status({ database: "acme-corp" });
|
|
469
|
+
console.log(res.data);
|
|
463
470
|
```
|
|
464
471
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
## Inspect, list, and delete sources
|
|
472
|
+
#### `databases.delete`
|
|
468
473
|
|
|
469
|
-
|
|
474
|
+
`DELETE /databases` → `HandlerEnvelopeTenantsTenantDeleteResponse`
|
|
470
475
|
|
|
471
|
-
|
|
472
|
-
const sources = await client.context.list({
|
|
473
|
-
tenantId: TENANT_ID,
|
|
474
|
-
subTenantId: SUB_TENANT_ID,
|
|
475
|
-
type: "knowledge",
|
|
476
|
-
page: 1,
|
|
477
|
-
pageSize: 50,
|
|
478
|
-
});
|
|
476
|
+
Delete a database and **all** associated data.
|
|
479
477
|
|
|
480
|
-
|
|
478
|
+
```typescript
|
|
479
|
+
const res = await client.databases.delete({ database: "acme-corp" });
|
|
480
|
+
console.log(res.data);
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
|
|
483
|
+
---
|
|
484
484
|
|
|
485
|
-
###
|
|
485
|
+
### Webhooks (`client.webhooks`)
|
|
486
486
|
|
|
487
|
-
|
|
488
|
-
const sources = await client.context.list({
|
|
489
|
-
tenantId: TENANT_ID,
|
|
490
|
-
subTenantId: SUB_TENANT_ID,
|
|
491
|
-
type: "knowledge",
|
|
492
|
-
ids: ["doc_a", "doc_b"],
|
|
493
|
-
});
|
|
494
|
-
```
|
|
487
|
+
Register a single indexing webhook per org and inspect/replay its deliveries.
|
|
495
488
|
|
|
496
|
-
|
|
489
|
+
#### `webhooks.register`
|
|
497
490
|
|
|
498
|
-
|
|
499
|
-
const filtered = await client.context.list({
|
|
500
|
-
tenantId: TENANT_ID,
|
|
501
|
-
subTenantId: SUB_TENANT_ID,
|
|
502
|
-
type: "knowledge",
|
|
503
|
-
filters: {
|
|
504
|
-
tenant_metadata: { department: "sales" },
|
|
505
|
-
document_metadata: { author: "Alice" },
|
|
506
|
-
},
|
|
507
|
-
});
|
|
508
|
-
```
|
|
491
|
+
`POST /webhooks/indexing` → `HandlerEnvelopeWebhooksWebhookRegisterResponse`
|
|
509
492
|
|
|
510
|
-
|
|
493
|
+
Register (or update) the indexing webhook for this API key’s org.
|
|
511
494
|
|
|
512
|
-
```
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
includeFields: ["title", "document_metadata", "tenant_metadata"],
|
|
495
|
+
```typescript
|
|
496
|
+
const res = await client.webhooks.register({
|
|
497
|
+
url: "https://example.com/hooks/hydradb",
|
|
498
|
+
eventTypes: ["indexing.status_changed"], // the only supported event type
|
|
499
|
+
signingSecret: "whsec_at_least_16_chars", // must be >= 16 characters
|
|
518
500
|
});
|
|
501
|
+
console.log(res.data);
|
|
519
502
|
```
|
|
520
503
|
|
|
521
|
-
|
|
504
|
+
#### `webhooks.get`
|
|
522
505
|
|
|
523
|
-
|
|
524
|
-
attachments, content, description, document_metadata, note, relations,
|
|
525
|
-
tenant_metadata, timestamp, title, type, url
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
### Inspect a single source
|
|
506
|
+
`GET /webhooks/indexing` → `HandlerEnvelopeWebhooksWebhookGetResponse`
|
|
529
507
|
|
|
530
|
-
|
|
531
|
-
const source = await client.context.inspect({
|
|
532
|
-
tenantId: TENANT_ID,
|
|
533
|
-
subTenantId: SUB_TENANT_ID,
|
|
534
|
-
id: "source-id-1",
|
|
535
|
-
mode: "content",
|
|
536
|
-
});
|
|
508
|
+
Fetch the currently registered webhook. Takes no request body.
|
|
537
509
|
|
|
538
|
-
|
|
510
|
+
```typescript
|
|
511
|
+
const res = await client.webhooks.get();
|
|
512
|
+
console.log(res.data);
|
|
539
513
|
```
|
|
540
514
|
|
|
541
|
-
|
|
515
|
+
#### `webhooks.test`
|
|
542
516
|
|
|
543
|
-
|
|
544
|
-
const source = await client.context.inspect({
|
|
545
|
-
tenantId: TENANT_ID,
|
|
546
|
-
subTenantId: SUB_TENANT_ID,
|
|
547
|
-
id: "source-id-1",
|
|
548
|
-
mode: "url",
|
|
549
|
-
expirySeconds: 3600,
|
|
550
|
-
});
|
|
551
|
-
```
|
|
517
|
+
`POST /webhooks/indexing/test` → `HandlerEnvelopeWebhooksWebhookTestResponse`
|
|
552
518
|
|
|
553
|
-
|
|
519
|
+
Send a test delivery to the registered endpoint.
|
|
554
520
|
|
|
555
|
-
```
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
subTenantId: SUB_TENANT_ID,
|
|
559
|
-
id: "source-id-1",
|
|
560
|
-
type: "knowledge",
|
|
561
|
-
limit: 10,
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
console.log(relations);
|
|
521
|
+
```typescript
|
|
522
|
+
const res = await client.webhooks.test();
|
|
523
|
+
console.log(res.data);
|
|
565
524
|
```
|
|
566
525
|
|
|
567
|
-
|
|
526
|
+
#### `webhooks.delete`
|
|
568
527
|
|
|
569
|
-
|
|
528
|
+
`DELETE /webhooks/indexing` → `HandlerEnvelopeWebhooksWebhookDeleteResponse`
|
|
570
529
|
|
|
571
|
-
|
|
530
|
+
Remove the registered webhook.
|
|
572
531
|
|
|
573
|
-
```
|
|
574
|
-
await client.
|
|
575
|
-
|
|
576
|
-
subTenantId: SUB_TENANT_ID,
|
|
577
|
-
ids: ["source-id-1", "source-id-2"],
|
|
578
|
-
type: "knowledge",
|
|
579
|
-
});
|
|
532
|
+
```typescript
|
|
533
|
+
const res = await client.webhooks.delete();
|
|
534
|
+
console.log(res.data);
|
|
580
535
|
```
|
|
581
536
|
|
|
582
|
-
|
|
537
|
+
#### `webhooks.listDeliveries`
|
|
583
538
|
|
|
584
|
-
|
|
539
|
+
`GET /webhooks/indexing/deliveries` → `HandlerEnvelopeWebhooksDeliveryListResponse`
|
|
585
540
|
|
|
586
|
-
|
|
541
|
+
List recent webhook deliveries, with filtering and cursor pagination.
|
|
587
542
|
|
|
588
|
-
```
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
543
|
+
```typescript
|
|
544
|
+
const res = await client.webhooks.listDeliveries({
|
|
545
|
+
limit: 50,
|
|
546
|
+
cursor: undefined, // pass the previous page's cursor to continue
|
|
547
|
+
status: "failed", // filter by delivery status
|
|
593
548
|
});
|
|
594
|
-
|
|
595
|
-
console.log(hook);
|
|
549
|
+
console.log(res.data);
|
|
596
550
|
```
|
|
597
551
|
|
|
598
|
-
|
|
552
|
+
#### `webhooks.getDelivery`
|
|
553
|
+
|
|
554
|
+
`GET` → `HandlerEnvelopeWebhooksDeliveryItem`
|
|
599
555
|
|
|
600
|
-
|
|
556
|
+
Fetch a single delivery by ID.
|
|
601
557
|
|
|
602
|
-
```
|
|
603
|
-
|
|
558
|
+
```typescript
|
|
559
|
+
const res = await client.webhooks.getDelivery({ deliveryId: "dlv_1234" });
|
|
560
|
+
console.log(res.data);
|
|
604
561
|
```
|
|
605
562
|
|
|
606
|
-
|
|
563
|
+
#### `webhooks.retryDelivery`
|
|
607
564
|
|
|
608
|
-
|
|
609
|
-
await client.webhooks.delete();
|
|
610
|
-
```
|
|
565
|
+
`POST` → `HandlerEnvelopeWebhooksRetryResponse`
|
|
611
566
|
|
|
612
|
-
|
|
567
|
+
Re‑attempt a failed delivery.
|
|
613
568
|
|
|
614
|
-
```
|
|
615
|
-
await client.webhooks.
|
|
569
|
+
```typescript
|
|
570
|
+
const res = await client.webhooks.retryDelivery({ deliveryId: "dlv_1234" });
|
|
571
|
+
console.log(res.data);
|
|
616
572
|
```
|
|
617
573
|
|
|
618
|
-
|
|
574
|
+
---
|
|
619
575
|
|
|
620
|
-
|
|
621
|
-
const deliveries = await client.webhooks.listDeliveries({
|
|
622
|
-
limit: 20,
|
|
623
|
-
status: "failed", // pending | failed | delivered | permanently_failed
|
|
624
|
-
});
|
|
625
|
-
console.log(deliveries);
|
|
576
|
+
## Error handling
|
|
626
577
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
```
|
|
578
|
+
Non‑2xx responses throw typed errors. Each carries `statusCode`, the parsed `body`, and the
|
|
579
|
+
`rawResponse`. All extend `HydraDBError`.
|
|
630
580
|
|
|
631
|
-
|
|
581
|
+
```typescript
|
|
582
|
+
import {
|
|
583
|
+
HydraDBClient,
|
|
584
|
+
HydraDB, // namespace with the typed error classes
|
|
585
|
+
HydraDBError,
|
|
586
|
+
} from "@hydradb/sdk";
|
|
632
587
|
|
|
633
|
-
|
|
588
|
+
const client = new HydraDBClient({ token: "YOUR_API_KEY" });
|
|
634
589
|
|
|
635
|
-
|
|
636
|
-
await client.
|
|
590
|
+
try {
|
|
591
|
+
await client.databases.status({ database: "does-not-exist" });
|
|
592
|
+
} catch (err) {
|
|
593
|
+
if (err instanceof HydraDB.NotFoundError) {
|
|
594
|
+
console.error("not found:", err.body);
|
|
595
|
+
} else if (err instanceof HydraDBError) {
|
|
596
|
+
console.error(`API error ${err.statusCode}:`, err.body);
|
|
597
|
+
} else {
|
|
598
|
+
throw err;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
637
601
|
```
|
|
638
602
|
|
|
639
|
-
|
|
603
|
+
Typed error classes (under the `HydraDB` namespace): `BadRequestError` (400),
|
|
604
|
+
`ForbiddenError` (403), `NotFoundError` (404), `ConflictError` (409),
|
|
605
|
+
`UnprocessableEntityError` (422), `InternalServerError` (500). Network/timeout failures throw
|
|
606
|
+
`HydraDBTimeoutError` / `HydraDBError`.
|
|
640
607
|
|
|
641
|
-
|
|
608
|
+
---
|
|
642
609
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
610
|
+
## Advanced
|
|
611
|
+
|
|
612
|
+
### Per-request options (timeouts, retries, abort)
|
|
613
|
+
|
|
614
|
+
Every method accepts a second `requestOptions` argument that overrides client defaults for
|
|
615
|
+
that call.
|
|
647
616
|
|
|
648
|
-
|
|
617
|
+
```typescript
|
|
618
|
+
const controller = new AbortController();
|
|
619
|
+
|
|
620
|
+
await client.query(
|
|
621
|
+
{ query: "hello", database: "acme-corp" },
|
|
622
|
+
{
|
|
623
|
+
timeoutInSeconds: 30,
|
|
624
|
+
maxRetries: 3,
|
|
625
|
+
apiVersion: "2",
|
|
626
|
+
headers: { "X-Trace-Id": "abc123" },
|
|
627
|
+
abortSignal: controller.signal,
|
|
628
|
+
},
|
|
629
|
+
);
|
|
649
630
|
```
|
|
650
631
|
|
|
651
|
-
|
|
632
|
+
### Passthrough `fetch`
|
|
652
633
|
|
|
653
|
-
|
|
634
|
+
For endpoints not yet wrapped by the SDK, `client.fetch` issues a request using the SDK's
|
|
635
|
+
configured auth, retries, and logging. Relative paths resolve against the configured base URL.
|
|
654
636
|
|
|
655
|
-
```
|
|
656
|
-
const response = await client.fetch("/
|
|
657
|
-
|
|
637
|
+
```typescript
|
|
638
|
+
const response = await client.fetch("/some/new/endpoint", {
|
|
639
|
+
method: "POST",
|
|
640
|
+
body: JSON.stringify({ hello: "world" }),
|
|
641
|
+
});
|
|
642
|
+
console.log(await response.json());
|
|
658
643
|
```
|
|
659
644
|
|
|
660
|
-
|
|
645
|
+
### Custom fetch & logging
|
|
661
646
|
|
|
662
|
-
```
|
|
663
|
-
import {
|
|
664
|
-
|
|
665
|
-
HydraDBTimeoutError,
|
|
666
|
-
HydraDB,
|
|
667
|
-
} from "@hydradb/sdk";
|
|
647
|
+
```typescript
|
|
648
|
+
import { HydraDBClient } from "@hydradb/sdk";
|
|
649
|
+
import nodeFetch from "node-fetch";
|
|
668
650
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
documents: [{ path: "./missing.pdf" }],
|
|
675
|
-
});
|
|
676
|
-
} catch (error) {
|
|
677
|
-
if (error instanceof HydraDBTimeoutError) {
|
|
678
|
-
console.error("Request timed out", error);
|
|
679
|
-
} else if (error instanceof HydraDB.UnauthorizedError) {
|
|
680
|
-
console.error("Invalid or missing API key");
|
|
681
|
-
} else if (error instanceof HydraDBError) {
|
|
682
|
-
console.error("Hydra DB API error", error.statusCode, error.body);
|
|
683
|
-
} else {
|
|
684
|
-
console.error("Unexpected error", error);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
651
|
+
const client = new HydraDBClient({
|
|
652
|
+
token: "YOUR_API_KEY",
|
|
653
|
+
fetch: nodeFetch as unknown as typeof fetch,
|
|
654
|
+
logging: { level: "debug" },
|
|
655
|
+
});
|
|
687
656
|
```
|
|
688
657
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
|
707
|
-
|
|
708
|
-
| `
|
|
709
|
-
| `
|
|
710
|
-
| `
|
|
711
|
-
| `
|
|
712
|
-
| `
|
|
713
|
-
| `
|
|
714
|
-
| `
|
|
715
|
-
| `
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
| `client.webhooks.register()` | Register a webhook. |
|
|
722
|
-
| `client.webhooks.get()` | Get the current webhook. |
|
|
723
|
-
| `client.webhooks.delete()` | Delete the webhook. |
|
|
724
|
-
| `client.webhooks.test()` | Send a test event. |
|
|
725
|
-
| `client.webhooks.listDeliveries()` | List webhook deliveries. |
|
|
726
|
-
| `client.webhooks.getDelivery()` | Get a single delivery. |
|
|
727
|
-
| `client.webhooks.retryDelivery()` | Retry a delivery. |
|
|
728
|
-
| `client.fetch()` | Authenticated passthrough request. |
|
|
729
|
-
| `buildString()` | Format a query result into an LLM-ready string. |
|
|
730
|
-
|
|
731
|
-
## Notes for contributors
|
|
732
|
-
|
|
733
|
-
This SDK is generated from the Hydra DB API definition with Fern. The generated clients live in `Client.ts` and under `api/resources/{context,tenants,webhooks}/client/Client.ts`. If method signatures change in the generated code, update this README to match.
|
|
734
|
-
|
|
735
|
-
Before publishing, verify these stay consistent:
|
|
736
|
-
|
|
737
|
-
- Package name and version in `package.json` (`@hydradb/sdk`)
|
|
738
|
-
- Installation command in this README
|
|
739
|
-
- Request fields use camelCase
|
|
740
|
-
- The ingest payload shapes (`documentMetadata`, `appKnowledge`, and `memories` are JSON strings)
|
|
741
|
-
|
|
742
|
-
## Links
|
|
743
|
-
|
|
744
|
-
- **Homepage:** [hydradb.com](https://www.hydradb.com/)
|
|
745
|
-
- **Documentation:** [docs.hydradb.com](https://docs.hydradb.com/)
|
|
746
|
-
- **API Reference:** [docs.hydradb.com/api-reference/introduction](https://docs.hydradb.com/api-reference/introduction)
|
|
747
|
-
|
|
748
|
-
## Support
|
|
749
|
-
|
|
750
|
-
If you have any questions or need help, reach out at [founders@hydradb.com](mailto:founders@hydradb.com).
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
## Endpoint reference
|
|
661
|
+
|
|
662
|
+
| Group | Method | HTTP | Description |
|
|
663
|
+
| --------- | ----------------------- | ------------------------------------------ | ----------- |
|
|
664
|
+
| — | `query` | `POST /query` | Unified hybrid/text retrieval with optional graph context. |
|
|
665
|
+
| context | `ingest` | `POST /context/ingest` | Ingest documents or memories (multipart). |
|
|
666
|
+
| context | `list` | `POST /context/list` | List sources/memories with filters + pagination. |
|
|
667
|
+
| context | `inspect` | `GET /context/inspect` | Fetch a source’s content + presigned URL. |
|
|
668
|
+
| context | `status` | `GET /context/status` | Processing status for one or many source IDs. |
|
|
669
|
+
| context | `relations` | `GET /context/relations` | KG relations for a database or source. |
|
|
670
|
+
| context | `updateSourceMetadata` | `PATCH /context/{id}/metadata` | Merge/upsert metadata for a source. |
|
|
671
|
+
| context | `delete` | `DELETE /context` | Delete sources/memories by ID. |
|
|
672
|
+
| databases | `create` | `POST /databases` | Create a database with optional schema. |
|
|
673
|
+
| databases | `list` | `GET /databases` | List all databases. |
|
|
674
|
+
| databases | `collections` | `GET /databases/collections` | List collections in a database. |
|
|
675
|
+
| databases | `stats` | `GET /databases/stats` | Collection statistics. |
|
|
676
|
+
| databases | `status` | `GET /databases/status` | Infra provisioning status. |
|
|
677
|
+
| databases | `delete` | `DELETE /databases` | Delete a database and its data. |
|
|
678
|
+
| webhooks | `register` | `POST /webhooks/indexing` | Register/update the org indexing webhook. |
|
|
679
|
+
| webhooks | `get` | `GET /webhooks/indexing` | Get the registered webhook. |
|
|
680
|
+
| webhooks | `test` | `POST /webhooks/indexing/test` | Send a test delivery. |
|
|
681
|
+
| webhooks | `delete` | `DELETE /webhooks/indexing` | Remove the webhook. |
|
|
682
|
+
| webhooks | `listDeliveries` | `GET /webhooks/indexing/deliveries` | List recent deliveries. |
|
|
683
|
+
| webhooks | `getDelivery` | `GET` | Fetch one delivery by ID. |
|
|
684
|
+
| webhooks | `retryDelivery` | `POST` | Retry a failed delivery. |
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
_This SDK is generated from the HydraDB API definition. For the full type reference see the
|
|
689
|
+
`api/` directory or https://docs.hydradb.com._
|