@credal/sdk 0.1.6 → 0.1.8
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/cjs/BaseClient.d.ts +27 -0
- package/dist/cjs/{api/resources/copilots/types/PolicyTrigger.js → BaseClient.js} +1 -3
- package/dist/cjs/Client.d.ts +3 -24
- package/dist/cjs/Client.js +3 -5
- package/dist/cjs/api/resources/common/types/Collaborator.d.ts +0 -3
- package/dist/cjs/api/resources/common/types/Collaborator.js +1 -3
- package/dist/cjs/api/resources/common/types/CustomMetadataValue.d.ts +0 -3
- package/dist/cjs/api/resources/common/types/CustomMetadataValue.js +1 -3
- package/dist/cjs/api/resources/common/types/ExternalResourceId.d.ts +0 -3
- package/dist/cjs/api/resources/common/types/ExternalResourceId.js +1 -3
- package/dist/cjs/api/resources/common/types/Operator.d.ts +1 -4
- package/dist/cjs/api/resources/common/types/Operator.js +1 -3
- package/dist/cjs/api/resources/common/types/ResourceIdentifier.d.ts +0 -3
- package/dist/cjs/api/resources/common/types/ResourceIdentifier.js +1 -3
- package/dist/cjs/api/resources/common/types/ResourceType.d.ts +1 -4
- package/dist/cjs/api/resources/common/types/ResourceType.js +1 -3
- package/dist/cjs/api/resources/common/types/Role.d.ts +1 -4
- package/dist/cjs/api/resources/common/types/Role.js +1 -3
- package/dist/cjs/api/resources/common/types/Url.d.ts +0 -3
- package/dist/cjs/api/resources/common/types/Url.js +1 -3
- package/dist/cjs/api/resources/copilots/client/Client.d.ts +3 -23
- package/dist/cjs/api/resources/copilots/client/Client.js +28 -30
- package/dist/cjs/api/resources/copilots/client/requests/AddCollectionToCopilotRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/AddCollectionToCopilotRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/client/requests/CreateConversationRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/CreateConversationRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/client/requests/CreateCopilotRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/CreateCopilotRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/client/requests/DeleteCopilotRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/DeleteCopilotRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/client/requests/RemoveCollectionFromCopilotRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/RemoveCollectionFromCopilotRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/client/requests/SendMessageRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/SendMessageRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/StreamMessageRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/client/requests/UpdateConfigurationRequest.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/client/requests/UpdateConfigurationRequest.js +1 -3
- package/dist/cjs/api/resources/copilots/types/AiEndpointConfiguration.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/AiEndpointConfiguration.js +1 -3
- package/dist/cjs/api/resources/copilots/types/BlockedChunk.d.ts +0 -5
- package/dist/cjs/api/resources/copilots/types/BlockedChunk.js +1 -3
- package/dist/cjs/api/resources/copilots/types/BooleanFieldSchema.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/BooleanFieldSchema.js +1 -3
- package/dist/cjs/api/resources/copilots/types/CollectionFilteredData.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/CollectionFilteredData.js +1 -3
- package/dist/cjs/api/resources/copilots/types/Configuration.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/Configuration.js +1 -3
- package/dist/cjs/api/resources/copilots/types/CreateConversationResponse.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/CreateConversationResponse.js +1 -3
- package/dist/cjs/api/resources/copilots/types/CreateCopilotResponse.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/CreateCopilotResponse.js +1 -3
- package/dist/cjs/api/resources/copilots/types/DataChunk.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/DataChunk.js +1 -3
- package/dist/cjs/api/resources/copilots/types/DataFilter.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/DataFilter.js +1 -3
- package/dist/cjs/api/resources/copilots/types/DatetimeFieldSchema.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/DatetimeFieldSchema.js +1 -3
- package/dist/cjs/api/resources/copilots/types/DeleteCopilotResponse.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/DeleteCopilotResponse.js +1 -3
- package/dist/cjs/api/resources/copilots/types/EndOfMessageChunk.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/EndOfMessageChunk.js +1 -3
- package/dist/cjs/api/resources/copilots/types/ErrorChunk.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/ErrorChunk.js +1 -3
- package/dist/cjs/api/resources/copilots/types/ErrorChunkData.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/ErrorChunkData.js +1 -3
- package/dist/cjs/api/resources/copilots/types/FeedbackEnum.d.ts +1 -4
- package/dist/cjs/api/resources/copilots/types/FeedbackEnum.js +1 -3
- package/dist/cjs/api/resources/copilots/types/Filter.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/Filter.js +1 -3
- package/dist/cjs/api/resources/copilots/types/FinalChunk.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/FinalChunk.js +1 -3
- package/dist/cjs/api/resources/copilots/types/InitialChunk.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/InitialChunk.js +1 -3
- package/dist/cjs/api/resources/copilots/types/InputVariable.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/InputVariable.js +1 -3
- package/dist/cjs/api/resources/copilots/types/InsertedAuditLog.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/InsertedAuditLog.js +1 -3
- package/dist/cjs/api/resources/copilots/types/MessageBlocked.d.ts +0 -4
- package/dist/cjs/api/resources/copilots/types/MessageBlocked.js +1 -3
- package/dist/cjs/api/resources/copilots/types/MessageFeedback.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/MessageFeedback.js +1 -3
- package/dist/cjs/api/resources/copilots/types/MessageReply.d.ts +0 -4
- package/dist/cjs/api/resources/copilots/types/MessageReply.js +1 -3
- package/dist/cjs/api/resources/copilots/types/NumberFieldSchema.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/NumberFieldSchema.js +1 -3
- package/dist/cjs/api/resources/copilots/types/ReferencedSource.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/ReferencedSource.js +1 -3
- package/dist/cjs/api/resources/copilots/types/ResponseChunk.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/ResponseChunk.js +1 -3
- package/dist/cjs/api/resources/copilots/types/SendAgentMessageResponse.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/SendAgentMessageResponse.js +1 -3
- package/dist/cjs/api/resources/copilots/types/SendMessageResponse.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/SendMessageResponse.js +1 -3
- package/dist/cjs/api/resources/copilots/types/StreamingChunk.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/StreamingChunk.js +1 -3
- package/dist/cjs/api/resources/copilots/types/StringFieldSchema.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/StringFieldSchema.js +1 -3
- package/dist/cjs/api/resources/copilots/types/WebSearchResult.d.ts +0 -3
- package/dist/cjs/api/resources/copilots/types/WebSearchResult.js +1 -3
- package/dist/cjs/api/resources/copilots/types/index.d.ts +0 -1
- package/dist/cjs/api/resources/copilots/types/index.js +0 -1
- package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +3 -23
- package/dist/cjs/api/resources/documentCatalog/client/Client.js +10 -12
- package/dist/cjs/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.js +1 -3
- package/dist/cjs/api/resources/documentCatalog/types/DocumentMetadataPatch.d.ts +0 -3
- package/dist/cjs/api/resources/documentCatalog/types/DocumentMetadataPatch.js +1 -3
- package/dist/cjs/api/resources/documentCatalog/types/DocumentMetadataPatchRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCatalog/types/DocumentMetadataPatchRequest.js +1 -3
- package/dist/cjs/api/resources/documentCatalog/types/SyncSourceByUrlRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCatalog/types/SyncSourceByUrlRequest.js +1 -3
- package/dist/cjs/api/resources/documentCatalog/types/SyncSourceByUrlResponse.d.ts +0 -3
- package/dist/cjs/api/resources/documentCatalog/types/SyncSourceByUrlResponse.js +1 -3
- package/dist/cjs/api/resources/documentCatalog/types/UploadDocumentResponse.d.ts +0 -3
- package/dist/cjs/api/resources/documentCatalog/types/UploadDocumentResponse.js +1 -3
- package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +3 -23
- package/dist/cjs/api/resources/documentCollections/client/Client.js +22 -24
- package/dist/cjs/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.js +1 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/CreateCollectionRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/CreateCollectionRequest.js +1 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/CreateMongoCollectionSyncRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/CreateMongoCollectionSyncRequest.js +1 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/DeleteCollectionRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/DeleteCollectionRequest.js +1 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.js +1 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.js +1 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/UpdateMongoCollectionSyncRequest.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/client/requests/UpdateMongoCollectionSyncRequest.js +1 -3
- package/dist/cjs/api/resources/documentCollections/types/CreateCollectionResponse.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/types/CreateCollectionResponse.js +1 -3
- package/dist/cjs/api/resources/documentCollections/types/DeleteCollectionResponse.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/types/DeleteCollectionResponse.js +1 -3
- package/dist/cjs/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.js +1 -3
- package/dist/cjs/api/resources/documentCollections/types/MongoCollectionSyncConfig.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/types/MongoCollectionSyncConfig.js +1 -3
- package/dist/cjs/api/resources/documentCollections/types/MongoCollectionSyncResponse.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/types/MongoCollectionSyncResponse.js +1 -3
- package/dist/cjs/api/resources/documentCollections/types/MongoSourceFieldsConfig.d.ts +0 -3
- package/dist/cjs/api/resources/documentCollections/types/MongoSourceFieldsConfig.js +1 -3
- package/dist/cjs/api/resources/search/client/Client.d.ts +3 -23
- package/dist/cjs/api/resources/search/client/Client.js +4 -6
- package/dist/cjs/api/resources/search/client/requests/SearchDocumentCollectionRequest.d.ts +0 -3
- package/dist/cjs/api/resources/search/client/requests/SearchDocumentCollectionRequest.js +1 -3
- package/dist/cjs/api/resources/search/types/DocumentCollectionSearchOptions.d.ts +0 -3
- package/dist/cjs/api/resources/search/types/DocumentCollectionSearchOptions.js +1 -3
- package/dist/cjs/api/resources/search/types/DocumentCollectionSearchResult.d.ts +0 -3
- package/dist/cjs/api/resources/search/types/DocumentCollectionSearchResult.js +1 -3
- package/dist/cjs/api/resources/search/types/SearchDocumentCollectionResponse.d.ts +0 -3
- package/dist/cjs/api/resources/search/types/SearchDocumentCollectionResponse.js +1 -3
- package/dist/cjs/api/resources/search/types/SearchResultChunk.d.ts +0 -3
- package/dist/cjs/api/resources/search/types/SearchResultChunk.js +1 -3
- package/dist/cjs/api/resources/search/types/SingleFieldFilter.d.ts +0 -3
- package/dist/cjs/api/resources/search/types/SingleFieldFilter.js +1 -3
- package/dist/cjs/api/resources/users/client/Client.d.ts +3 -23
- package/dist/cjs/api/resources/users/client/Client.js +4 -6
- package/dist/cjs/api/resources/users/types/UserMetadataPatch.d.ts +0 -3
- package/dist/cjs/api/resources/users/types/UserMetadataPatch.js +1 -3
- package/dist/cjs/core/auth/AuthProvider.d.ts +1 -1
- package/dist/cjs/core/auth/BasicAuth.js +2 -1
- package/dist/cjs/core/auth/index.d.ts +2 -2
- package/dist/cjs/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -3
- package/dist/cjs/core/fetcher/Fetcher.js +3 -2
- package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +1 -1
- package/dist/cjs/core/fetcher/index.d.ts +2 -0
- package/dist/cjs/core/fetcher/index.js +3 -1
- package/dist/cjs/core/fetcher/requestWithRetries.js +20 -16
- package/dist/cjs/core/headers.d.ts +2 -3
- package/dist/cjs/environments.d.ts +0 -3
- package/dist/cjs/environments.js +1 -3
- package/dist/cjs/errors/CredalError.d.ts +0 -3
- package/dist/cjs/errors/CredalError.js +1 -3
- package/dist/cjs/errors/CredalTimeoutError.d.ts +0 -3
- package/dist/cjs/errors/CredalTimeoutError.js +1 -3
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +27 -0
- package/dist/esm/BaseClient.mjs +3 -0
- package/dist/esm/Client.d.mts +3 -24
- package/dist/esm/Client.mjs +4 -5
- package/dist/esm/api/resources/common/types/Collaborator.d.mts +0 -3
- package/dist/esm/api/resources/common/types/Collaborator.mjs +2 -4
- package/dist/esm/api/resources/common/types/CustomMetadataValue.d.mts +0 -3
- package/dist/esm/api/resources/common/types/CustomMetadataValue.mjs +1 -3
- package/dist/esm/api/resources/common/types/ExternalResourceId.d.mts +0 -3
- package/dist/esm/api/resources/common/types/ExternalResourceId.mjs +2 -4
- package/dist/esm/api/resources/common/types/Operator.d.mts +1 -4
- package/dist/esm/api/resources/common/types/Operator.mjs +1 -3
- package/dist/esm/api/resources/common/types/ResourceIdentifier.d.mts +0 -3
- package/dist/esm/api/resources/common/types/ResourceIdentifier.mjs +2 -4
- package/dist/esm/api/resources/common/types/ResourceType.d.mts +1 -4
- package/dist/esm/api/resources/common/types/ResourceType.mjs +1 -3
- package/dist/esm/api/resources/common/types/Role.d.mts +1 -4
- package/dist/esm/api/resources/common/types/Role.mjs +1 -3
- package/dist/esm/api/resources/common/types/Url.d.mts +0 -3
- package/dist/esm/api/resources/common/types/Url.mjs +1 -3
- package/dist/esm/api/resources/copilots/client/Client.d.mts +3 -23
- package/dist/esm/api/resources/copilots/client/Client.mjs +29 -30
- package/dist/esm/api/resources/copilots/client/index.mjs +1 -0
- package/dist/esm/api/resources/copilots/client/requests/AddCollectionToCopilotRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/AddCollectionToCopilotRequest.mjs +1 -3
- package/dist/esm/api/resources/copilots/client/requests/CreateConversationRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/CreateConversationRequest.mjs +1 -3
- package/dist/esm/api/resources/copilots/client/requests/CreateCopilotRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/CreateCopilotRequest.mjs +2 -4
- package/dist/esm/api/resources/copilots/client/requests/DeleteCopilotRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/DeleteCopilotRequest.mjs +1 -3
- package/dist/esm/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.mjs +2 -4
- package/dist/esm/api/resources/copilots/client/requests/RemoveCollectionFromCopilotRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/RemoveCollectionFromCopilotRequest.mjs +1 -3
- package/dist/esm/api/resources/copilots/client/requests/SendMessageRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/SendMessageRequest.mjs +2 -4
- package/dist/esm/api/resources/copilots/client/requests/StreamMessageRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/StreamMessageRequest.mjs +2 -4
- package/dist/esm/api/resources/copilots/client/requests/UpdateConfigurationRequest.d.mts +0 -3
- package/dist/esm/api/resources/copilots/client/requests/UpdateConfigurationRequest.mjs +2 -4
- package/dist/esm/api/resources/copilots/client/requests/index.mjs +9 -1
- package/dist/esm/api/resources/copilots/types/AiEndpointConfiguration.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/AiEndpointConfiguration.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/BlockedChunk.d.mts +0 -5
- package/dist/esm/api/resources/copilots/types/BlockedChunk.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/BooleanFieldSchema.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/BooleanFieldSchema.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/CollectionFilteredData.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/CollectionFilteredData.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/Configuration.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/Configuration.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/CreateConversationResponse.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/CreateConversationResponse.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/CreateCopilotResponse.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/CreateCopilotResponse.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/DataChunk.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/DataChunk.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/DataFilter.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/DataFilter.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/DatetimeFieldSchema.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/DatetimeFieldSchema.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/DeleteCopilotResponse.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/DeleteCopilotResponse.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/EndOfMessageChunk.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/EndOfMessageChunk.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/ErrorChunk.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/ErrorChunk.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/ErrorChunkData.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/ErrorChunkData.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/FeedbackEnum.d.mts +1 -4
- package/dist/esm/api/resources/copilots/types/FeedbackEnum.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/Filter.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/Filter.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/FinalChunk.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/FinalChunk.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/InitialChunk.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/InitialChunk.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/InputVariable.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/InputVariable.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/InsertedAuditLog.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/InsertedAuditLog.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/MessageBlocked.d.mts +0 -4
- package/dist/esm/api/resources/copilots/types/MessageBlocked.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/MessageFeedback.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/MessageFeedback.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/MessageReply.d.mts +0 -4
- package/dist/esm/api/resources/copilots/types/MessageReply.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/NumberFieldSchema.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/NumberFieldSchema.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/ReferencedSource.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/ReferencedSource.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/ResponseChunk.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/ResponseChunk.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/SendAgentMessageResponse.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/SendAgentMessageResponse.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/SendMessageResponse.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/SendMessageResponse.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/StreamingChunk.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/StreamingChunk.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/StringFieldSchema.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/StringFieldSchema.mjs +2 -4
- package/dist/esm/api/resources/copilots/types/WebSearchResult.d.mts +0 -3
- package/dist/esm/api/resources/copilots/types/WebSearchResult.mjs +1 -3
- package/dist/esm/api/resources/copilots/types/index.d.mts +0 -1
- package/dist/esm/api/resources/copilots/types/index.mjs +0 -1
- package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +3 -23
- package/dist/esm/api/resources/documentCatalog/client/Client.mjs +11 -12
- package/dist/esm/api/resources/documentCatalog/client/index.mjs +1 -0
- package/dist/esm/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.mjs +2 -4
- package/dist/esm/api/resources/documentCatalog/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/documentCatalog/types/DocumentMetadataPatch.d.mts +0 -3
- package/dist/esm/api/resources/documentCatalog/types/DocumentMetadataPatch.mjs +2 -4
- package/dist/esm/api/resources/documentCatalog/types/DocumentMetadataPatchRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCatalog/types/DocumentMetadataPatchRequest.mjs +2 -4
- package/dist/esm/api/resources/documentCatalog/types/SyncSourceByUrlRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCatalog/types/SyncSourceByUrlRequest.mjs +1 -3
- package/dist/esm/api/resources/documentCatalog/types/SyncSourceByUrlResponse.d.mts +0 -3
- package/dist/esm/api/resources/documentCatalog/types/SyncSourceByUrlResponse.mjs +1 -3
- package/dist/esm/api/resources/documentCatalog/types/UploadDocumentResponse.d.mts +0 -3
- package/dist/esm/api/resources/documentCatalog/types/UploadDocumentResponse.mjs +1 -3
- package/dist/esm/api/resources/documentCollections/client/Client.d.mts +3 -23
- package/dist/esm/api/resources/documentCollections/client/Client.mjs +23 -24
- package/dist/esm/api/resources/documentCollections/client/index.mjs +1 -0
- package/dist/esm/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.mjs +2 -4
- package/dist/esm/api/resources/documentCollections/client/requests/CreateCollectionRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/client/requests/CreateCollectionRequest.mjs +2 -4
- package/dist/esm/api/resources/documentCollections/client/requests/CreateMongoCollectionSyncRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/client/requests/CreateMongoCollectionSyncRequest.mjs +2 -4
- package/dist/esm/api/resources/documentCollections/client/requests/DeleteCollectionRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/client/requests/DeleteCollectionRequest.mjs +1 -3
- package/dist/esm/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.mjs +1 -3
- package/dist/esm/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.mjs +2 -4
- package/dist/esm/api/resources/documentCollections/client/requests/UpdateMongoCollectionSyncRequest.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/client/requests/UpdateMongoCollectionSyncRequest.mjs +2 -4
- package/dist/esm/api/resources/documentCollections/client/requests/index.mjs +7 -1
- package/dist/esm/api/resources/documentCollections/types/CreateCollectionResponse.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/types/CreateCollectionResponse.mjs +1 -3
- package/dist/esm/api/resources/documentCollections/types/DeleteCollectionResponse.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/types/DeleteCollectionResponse.mjs +1 -3
- package/dist/esm/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.mjs +2 -4
- package/dist/esm/api/resources/documentCollections/types/MongoCollectionSyncConfig.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/types/MongoCollectionSyncConfig.mjs +2 -4
- package/dist/esm/api/resources/documentCollections/types/MongoCollectionSyncResponse.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/types/MongoCollectionSyncResponse.mjs +1 -3
- package/dist/esm/api/resources/documentCollections/types/MongoSourceFieldsConfig.d.mts +0 -3
- package/dist/esm/api/resources/documentCollections/types/MongoSourceFieldsConfig.mjs +1 -3
- package/dist/esm/api/resources/search/client/Client.d.mts +3 -23
- package/dist/esm/api/resources/search/client/Client.mjs +5 -6
- package/dist/esm/api/resources/search/client/index.mjs +1 -0
- package/dist/esm/api/resources/search/client/requests/SearchDocumentCollectionRequest.d.mts +0 -3
- package/dist/esm/api/resources/search/client/requests/SearchDocumentCollectionRequest.mjs +2 -4
- package/dist/esm/api/resources/search/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/search/types/DocumentCollectionSearchOptions.d.mts +0 -3
- package/dist/esm/api/resources/search/types/DocumentCollectionSearchOptions.mjs +1 -3
- package/dist/esm/api/resources/search/types/DocumentCollectionSearchResult.d.mts +0 -3
- package/dist/esm/api/resources/search/types/DocumentCollectionSearchResult.mjs +2 -4
- package/dist/esm/api/resources/search/types/SearchDocumentCollectionResponse.d.mts +0 -3
- package/dist/esm/api/resources/search/types/SearchDocumentCollectionResponse.mjs +2 -4
- package/dist/esm/api/resources/search/types/SearchResultChunk.d.mts +0 -3
- package/dist/esm/api/resources/search/types/SearchResultChunk.mjs +1 -3
- package/dist/esm/api/resources/search/types/SingleFieldFilter.d.mts +0 -3
- package/dist/esm/api/resources/search/types/SingleFieldFilter.mjs +2 -4
- package/dist/esm/api/resources/users/client/Client.d.mts +3 -23
- package/dist/esm/api/resources/users/client/Client.mjs +5 -6
- package/dist/esm/api/resources/users/types/UserMetadataPatch.d.mts +0 -3
- package/dist/esm/api/resources/users/types/UserMetadataPatch.mjs +1 -3
- package/dist/esm/core/auth/AuthProvider.d.mts +1 -1
- package/dist/esm/core/auth/BasicAuth.mjs +2 -1
- package/dist/esm/core/auth/index.d.mts +2 -2
- package/dist/esm/core/fetcher/APIResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
- package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +20 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +5 -3
- package/dist/esm/core/fetcher/Fetcher.mjs +3 -2
- package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +1 -1
- package/dist/esm/core/fetcher/index.d.mts +2 -0
- package/dist/esm/core/fetcher/index.mjs +1 -0
- package/dist/esm/core/fetcher/requestWithRetries.mjs +20 -16
- package/dist/esm/core/headers.d.mts +2 -3
- package/dist/esm/environments.d.mts +0 -3
- package/dist/esm/environments.mjs +1 -3
- package/dist/esm/errors/CredalError.d.mts +0 -3
- package/dist/esm/errors/CredalError.mjs +2 -3
- package/dist/esm/errors/CredalTimeoutError.d.mts +0 -3
- package/dist/esm/errors/CredalTimeoutError.mjs +1 -3
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +8 -13
- package/dist/cjs/api/resources/copilots/types/PolicyTrigger.d.ts +0 -8
- package/dist/esm/api/resources/copilots/types/PolicyTrigger.d.mts +0 -8
- package/dist/esm/api/resources/copilots/types/PolicyTrigger.mjs +0 -4
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -85,7 +83,7 @@ class Search {
|
|
|
85
83
|
}
|
|
86
84
|
__searchDocumentCollection(request, requestOptions) {
|
|
87
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
var _a, _b, _c, _d;
|
|
86
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
89
87
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
90
88
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
91
89
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/search/searchDocumentCollection"),
|
|
@@ -95,8 +93,8 @@ class Search {
|
|
|
95
93
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
96
94
|
requestType: "json",
|
|
97
95
|
body: request,
|
|
98
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds)
|
|
99
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
96
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
97
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
100
98
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
101
99
|
});
|
|
102
100
|
if (_response.ok) {
|
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as environments from "../../../../environments.js";
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
5
2
|
import * as core from "../../../../core/index.js";
|
|
6
3
|
import * as Credal from "../../../index.js";
|
|
7
4
|
export declare namespace Users {
|
|
8
|
-
interface Options {
|
|
9
|
-
environment?: core.Supplier<environments.CredalEnvironment | string>;
|
|
10
|
-
/** Specify a custom URL to connect the client to. */
|
|
11
|
-
baseUrl?: core.Supplier<string>;
|
|
12
|
-
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
|
-
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
|
-
fetcher?: core.FetchFunction;
|
|
5
|
+
interface Options extends BaseClientOptions {
|
|
16
6
|
}
|
|
17
|
-
interface RequestOptions {
|
|
18
|
-
/** The maximum time to wait for a response in seconds. */
|
|
19
|
-
timeoutInSeconds?: number;
|
|
20
|
-
/** The number of times to retry the request. Defaults to 2. */
|
|
21
|
-
maxRetries?: number;
|
|
22
|
-
/** A hook to abort the request. */
|
|
23
|
-
abortSignal?: AbortSignal;
|
|
24
|
-
/** Additional query string parameters to include in the request. */
|
|
25
|
-
queryParams?: Record<string, unknown>;
|
|
26
|
-
/** Additional headers to include in the request. */
|
|
27
|
-
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
28
8
|
}
|
|
29
9
|
}
|
|
30
10
|
export declare class Users {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -80,7 +78,7 @@ class Users {
|
|
|
80
78
|
}
|
|
81
79
|
__metadata(request, requestOptions) {
|
|
82
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
var _a, _b, _c, _d;
|
|
81
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
84
82
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
85
83
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
86
84
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/users/metadata"),
|
|
@@ -90,8 +88,8 @@ class Users {
|
|
|
90
88
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
91
89
|
requestType: "json",
|
|
92
90
|
body: request,
|
|
93
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds)
|
|
94
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
91
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
92
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
95
93
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
96
94
|
});
|
|
97
95
|
if (_response.ok) {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
1
|
export interface UserMetadataPatch {
|
|
5
2
|
userEmail: string;
|
|
6
3
|
/** Key-value object of metadata for user. Keys will be merged with any existing values but can also be set to `null` to effectively remove */
|
|
@@ -14,7 +14,8 @@ exports.BasicAuth = {
|
|
|
14
14
|
fromAuthorizationHeader: (header) => {
|
|
15
15
|
const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
|
|
16
16
|
const decoded = (0, base64_js_1.base64Decode)(credentials);
|
|
17
|
-
const [username,
|
|
17
|
+
const [username, ...passwordParts] = decoded.split(":");
|
|
18
|
+
const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined;
|
|
18
19
|
if (username == null || password == null) {
|
|
19
20
|
throw new Error("Invalid basic auth");
|
|
20
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthProvider } from "./AuthProvider.js";
|
|
2
|
-
export {
|
|
1
|
+
export type { AuthProvider } from "./AuthProvider.js";
|
|
2
|
+
export type { AuthRequest } from "./AuthRequest.js";
|
|
3
3
|
export { BasicAuth } from "./BasicAuth.js";
|
|
4
4
|
export { BearerToken } from "./BearerToken.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SecuritySchemeKey = string;
|
|
2
|
+
/**
|
|
3
|
+
* A collection of security schemes, where the key is the name of the security scheme and the value is the list of scopes required for that scheme.
|
|
4
|
+
* All schemes in the collection must be satisfied for authentication to be successful.
|
|
5
|
+
*/
|
|
6
|
+
export type SecuritySchemeCollection = Record<SecuritySchemeKey, AuthScope[]>;
|
|
7
|
+
export type AuthScope = string;
|
|
8
|
+
export type EndpointMetadata = {
|
|
9
|
+
/**
|
|
10
|
+
* An array of security scheme collections. Each collection represents an alternative way to authenticate.
|
|
11
|
+
*/
|
|
12
|
+
security?: SecuritySchemeCollection[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
2
|
+
import { Supplier } from "./Supplier.js";
|
|
3
|
+
type EndpointSupplierFn<T> = (arg: {
|
|
4
|
+
endpointMetadata: EndpointMetadata;
|
|
5
|
+
}) => T | Promise<T>;
|
|
6
|
+
export type EndpointSupplier<T> = Supplier<T> | EndpointSupplierFn<T>;
|
|
7
|
+
export declare const EndpointSupplier: {
|
|
8
|
+
get: <T>(supplier: EndpointSupplier<T>, arg: {
|
|
9
|
+
endpointMetadata: EndpointMetadata;
|
|
10
|
+
}) => Promise<T>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EndpointSupplier = void 0;
|
|
13
|
+
exports.EndpointSupplier = {
|
|
14
|
+
get: (supplier, arg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
if (typeof supplier === "function") {
|
|
16
|
+
return supplier(arg);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return supplier;
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { APIResponse } from "./APIResponse.js";
|
|
2
|
-
import {
|
|
1
|
+
import type { APIResponse } from "./APIResponse.js";
|
|
2
|
+
import type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
3
|
+
import { EndpointSupplier } from "./EndpointSupplier.js";
|
|
3
4
|
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
4
5
|
export declare namespace Fetcher {
|
|
5
6
|
interface Args {
|
|
6
7
|
url: string;
|
|
7
8
|
method: string;
|
|
8
9
|
contentType?: string;
|
|
9
|
-
headers?: Record<string, string |
|
|
10
|
+
headers?: Record<string, string | EndpointSupplier<string | null | undefined> | null | undefined>;
|
|
10
11
|
queryParameters?: Record<string, unknown>;
|
|
11
12
|
body?: unknown;
|
|
12
13
|
timeoutMs?: number;
|
|
@@ -16,6 +17,7 @@ export declare namespace Fetcher {
|
|
|
16
17
|
requestType?: "json" | "file" | "bytes";
|
|
17
18
|
responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response";
|
|
18
19
|
duplex?: "half";
|
|
20
|
+
endpointMetadata?: EndpointMetadata;
|
|
19
21
|
}
|
|
20
22
|
type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
|
|
21
23
|
interface FailedStatusCodeError {
|
|
@@ -13,6 +13,7 @@ exports.fetcher = void 0;
|
|
|
13
13
|
exports.fetcherImpl = fetcherImpl;
|
|
14
14
|
const json_js_1 = require("../json.js");
|
|
15
15
|
const createRequestUrl_js_1 = require("./createRequestUrl.js");
|
|
16
|
+
const EndpointSupplier_js_1 = require("./EndpointSupplier.js");
|
|
16
17
|
const getErrorResponseBody_js_1 = require("./getErrorResponseBody.js");
|
|
17
18
|
const getFetchFn_js_1 = require("./getFetchFn.js");
|
|
18
19
|
const getRequestBody_js_1 = require("./getRequestBody.js");
|
|
@@ -20,9 +21,9 @@ const getResponseBody_js_1 = require("./getResponseBody.js");
|
|
|
20
21
|
const makeRequest_js_1 = require("./makeRequest.js");
|
|
21
22
|
const RawResponse_js_1 = require("./RawResponse.js");
|
|
22
23
|
const requestWithRetries_js_1 = require("./requestWithRetries.js");
|
|
23
|
-
const Supplier_js_1 = require("./Supplier.js");
|
|
24
24
|
function getHeaders(args) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
var _a;
|
|
26
27
|
const newHeaders = {};
|
|
27
28
|
if (args.body !== undefined && args.contentType != null) {
|
|
28
29
|
newHeaders["Content-Type"] = args.contentType;
|
|
@@ -31,7 +32,7 @@ function getHeaders(args) {
|
|
|
31
32
|
return newHeaders;
|
|
32
33
|
}
|
|
33
34
|
for (const [key, value] of Object.entries(args.headers)) {
|
|
34
|
-
const result = yield
|
|
35
|
+
const result = yield EndpointSupplier_js_1.EndpointSupplier.get(value, { endpointMetadata: (_a = args.endpointMetadata) !== null && _a !== void 0 ? _a : {} });
|
|
35
36
|
if (typeof result === "string") {
|
|
36
37
|
newHeaders[key] = result;
|
|
37
38
|
continue;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { APIResponse } from "./APIResponse.js";
|
|
2
2
|
export type { BinaryResponse } from "./BinaryResponse.js";
|
|
3
|
+
export type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
4
|
+
export { EndpointSupplier } from "./EndpointSupplier.js";
|
|
3
5
|
export type { Fetcher, FetchFunction } from "./Fetcher.js";
|
|
4
6
|
export { fetcher } from "./Fetcher.js";
|
|
5
7
|
export { getHeader } from "./getHeader.js";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = void 0;
|
|
3
|
+
exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
|
|
4
|
+
var EndpointSupplier_js_1 = require("./EndpointSupplier.js");
|
|
5
|
+
Object.defineProperty(exports, "EndpointSupplier", { enumerable: true, get: function () { return EndpointSupplier_js_1.EndpointSupplier; } });
|
|
4
6
|
var Fetcher_js_1 = require("./Fetcher.js");
|
|
5
7
|
Object.defineProperty(exports, "fetcher", { enumerable: true, get: function () { return Fetcher_js_1.fetcher; } });
|
|
6
8
|
var getHeader_js_1 = require("./getHeader.js");
|
|
@@ -14,29 +14,35 @@ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
|
|
|
14
14
|
const MAX_RETRY_DELAY = 60000; // in milliseconds
|
|
15
15
|
const DEFAULT_MAX_RETRIES = 2;
|
|
16
16
|
const JITTER_FACTOR = 0.2; // 20% random jitter
|
|
17
|
-
function
|
|
18
|
-
// Generate a random value between
|
|
19
|
-
const jitterMultiplier = 1 +
|
|
17
|
+
function addPositiveJitter(delay) {
|
|
18
|
+
// Generate a random value between 0 and +JITTER_FACTOR
|
|
19
|
+
const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
|
|
20
|
+
return delay * jitterMultiplier;
|
|
21
|
+
}
|
|
22
|
+
function addSymmetricJitter(delay) {
|
|
23
|
+
// Generate a random value in a JITTER_FACTOR-sized percentage range around delay
|
|
24
|
+
const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR;
|
|
20
25
|
return delay * jitterMultiplier;
|
|
21
26
|
}
|
|
22
27
|
function getRetryDelayFromHeaders(response, retryAttempt) {
|
|
23
|
-
// Check for Retry-After header first (RFC 7231)
|
|
28
|
+
// Check for Retry-After header first (RFC 7231), with no jitter
|
|
24
29
|
const retryAfter = response.headers.get("Retry-After");
|
|
25
30
|
if (retryAfter) {
|
|
26
31
|
// Parse as number of seconds...
|
|
27
32
|
const retryAfterSeconds = parseInt(retryAfter, 10);
|
|
28
|
-
if (!isNaN(retryAfterSeconds)) {
|
|
29
|
-
// Convert seconds to milliseconds and cap at MAX_RETRY_DELAY
|
|
33
|
+
if (!isNaN(retryAfterSeconds) && retryAfterSeconds > 0) {
|
|
30
34
|
return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY);
|
|
31
35
|
}
|
|
32
36
|
// ...or as an HTTP date; both are valid
|
|
33
37
|
const retryAfterDate = new Date(retryAfter);
|
|
34
38
|
if (!isNaN(retryAfterDate.getTime())) {
|
|
35
39
|
const delay = retryAfterDate.getTime() - Date.now();
|
|
36
|
-
|
|
40
|
+
if (delay > 0) {
|
|
41
|
+
return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY);
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
|
-
// Then check for industry-standard X-RateLimit-Reset header
|
|
45
|
+
// Then check for industry-standard X-RateLimit-Reset header, with positive jitter
|
|
40
46
|
const rateLimitReset = response.headers.get("X-RateLimit-Reset");
|
|
41
47
|
if (rateLimitReset) {
|
|
42
48
|
const resetTime = parseInt(rateLimitReset, 10);
|
|
@@ -44,23 +50,21 @@ function getRetryDelayFromHeaders(response, retryAttempt) {
|
|
|
44
50
|
// Assume Unix timestamp in epoch seconds
|
|
45
51
|
const delay = resetTime * 1000 - Date.now();
|
|
46
52
|
if (delay > 0) {
|
|
47
|
-
return Math.min(delay, MAX_RETRY_DELAY);
|
|
53
|
+
return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY));
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
|
-
// Fall back to exponential backoff
|
|
52
|
-
return Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY);
|
|
57
|
+
// Fall back to exponential backoff, with symmetric jitter
|
|
58
|
+
return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY));
|
|
53
59
|
}
|
|
54
60
|
function requestWithRetries(requestFn_1) {
|
|
55
61
|
return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
56
62
|
let response = yield requestFn();
|
|
57
63
|
for (let i = 0; i < maxRetries; ++i) {
|
|
58
64
|
if ([408, 429].includes(response.status) || response.status >= 500) {
|
|
59
|
-
// Get delay
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const delayWithJitter = addJitter(baseDelay);
|
|
63
|
-
yield new Promise((resolve) => setTimeout(resolve, delayWithJitter));
|
|
65
|
+
// Get delay with appropriate jitter applied
|
|
66
|
+
const delay = getRetryDelayFromHeaders(response, i);
|
|
67
|
+
yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
64
68
|
response = yield requestFn();
|
|
65
69
|
}
|
|
66
70
|
else {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, string | core.Supplier<string | null | undefined> | null | undefined> | null | undefined)[]): Record<string, string | core.Supplier<string | null | undefined>>;
|
|
1
|
+
export declare function mergeHeaders<THeaderValue>(...headersArray: (Record<string, THeaderValue> | null | undefined)[]): Record<string, string | THeaderValue>;
|
|
2
|
+
export declare function mergeOnlyDefinedHeaders<THeaderValue>(...headersArray: (Record<string, THeaderValue> | null | undefined)[]): Record<string, THeaderValue>;
|
package/dist/cjs/environments.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.CredalEnvironment = void 0;
|
|
7
5
|
exports.CredalEnvironment = {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.CredalError = void 0;
|
|
7
5
|
const json_js_1 = require("../core/json.js");
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.CredalTimeoutError = void 0;
|
|
7
5
|
class CredalTimeoutError extends Error {
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as Credal from "./api/index.js";
|
|
2
2
|
export { CredalError, CredalTimeoutError } from "./errors/index.js";
|
|
3
|
+
export { type BaseClientOptions, type BaseRequestOptions } from "./BaseClient.js";
|
|
3
4
|
export { CredalClient } from "./Client.js";
|
|
4
5
|
export { CredalEnvironment } from "./environments.js";
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.8";
|
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as environments from "./environments.mjs";
|
|
2
|
+
import * as core from "./core/index.mjs";
|
|
3
|
+
export interface BaseClientOptions {
|
|
4
|
+
environment?: core.Supplier<environments.CredalEnvironment | string>;
|
|
5
|
+
/** Specify a custom URL to connect the client to. */
|
|
6
|
+
baseUrl?: core.Supplier<string>;
|
|
7
|
+
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
8
|
+
/** Additional headers to include in requests. */
|
|
9
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
10
|
+
/** The default maximum time to wait for a response in seconds. */
|
|
11
|
+
timeoutInSeconds?: number;
|
|
12
|
+
/** The default number of times to retry the request. Defaults to 2. */
|
|
13
|
+
maxRetries?: number;
|
|
14
|
+
fetcher?: core.FetchFunction;
|
|
15
|
+
}
|
|
16
|
+
export interface BaseRequestOptions {
|
|
17
|
+
/** The maximum time to wait for a response in seconds. */
|
|
18
|
+
timeoutInSeconds?: number;
|
|
19
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
20
|
+
maxRetries?: number;
|
|
21
|
+
/** A hook to abort the request. */
|
|
22
|
+
abortSignal?: AbortSignal;
|
|
23
|
+
/** Additional query string parameters to include in the request. */
|
|
24
|
+
queryParams?: Record<string, unknown>;
|
|
25
|
+
/** Additional headers to include in the request. */
|
|
26
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
27
|
+
}
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as environments from "./environments.mjs";
|
|
5
|
-
import * as core from "./core/index.mjs";
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
|
|
6
2
|
import { Copilots } from "./api/resources/copilots/client/Client.mjs";
|
|
7
3
|
import { DocumentCatalog } from "./api/resources/documentCatalog/client/Client.mjs";
|
|
8
4
|
import { DocumentCollections } from "./api/resources/documentCollections/client/Client.mjs";
|
|
9
5
|
import { Search } from "./api/resources/search/client/Client.mjs";
|
|
10
6
|
import { Users } from "./api/resources/users/client/Client.mjs";
|
|
11
7
|
export declare namespace CredalClient {
|
|
12
|
-
interface Options {
|
|
13
|
-
environment?: core.Supplier<environments.CredalEnvironment | string>;
|
|
14
|
-
/** Specify a custom URL to connect the client to. */
|
|
15
|
-
baseUrl?: core.Supplier<string>;
|
|
16
|
-
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
17
|
-
/** Additional headers to include in requests. */
|
|
18
|
-
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
19
|
-
fetcher?: core.FetchFunction;
|
|
8
|
+
interface Options extends BaseClientOptions {
|
|
20
9
|
}
|
|
21
|
-
interface RequestOptions {
|
|
22
|
-
/** The maximum time to wait for a response in seconds. */
|
|
23
|
-
timeoutInSeconds?: number;
|
|
24
|
-
/** The number of times to retry the request. Defaults to 2. */
|
|
25
|
-
maxRetries?: number;
|
|
26
|
-
/** A hook to abort the request. */
|
|
27
|
-
abortSignal?: AbortSignal;
|
|
28
|
-
/** Additional query string parameters to include in the request. */
|
|
29
|
-
queryParams?: Record<string, unknown>;
|
|
30
|
-
/** Additional headers to include in the request. */
|
|
31
|
-
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
10
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
32
11
|
}
|
|
33
12
|
}
|
|
34
13
|
export declare class CredalClient {
|