@credal/sdk 0.0.13 → 0.0.15
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/Client.d.ts +3 -0
- package/api/resources/common/types/index.d.ts +1 -0
- package/api/resources/common/types/index.js +1 -0
- package/api/resources/copilots/client/Client.d.ts +25 -11
- package/api/resources/copilots/client/Client.js +119 -37
- package/api/resources/copilots/client/requests/CreateCopilotRequest.d.ts +1 -1
- package/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.d.ts +1 -1
- package/api/resources/copilots/client/requests/SendMessageRequest.d.ts +14 -1
- package/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +60 -0
- package/api/resources/copilots/client/requests/StreamMessageRequest.js +5 -0
- package/api/resources/copilots/client/requests/index.d.ts +1 -0
- package/api/resources/copilots/types/BlockedChunk.d.ts +10 -0
- package/api/resources/copilots/types/BlockedChunk.js +5 -0
- package/api/resources/copilots/types/BooleanFieldSchema.d.ts +8 -0
- package/api/resources/copilots/types/BooleanFieldSchema.js +5 -0
- package/api/resources/copilots/types/CollectionFilteredData.d.ts +9 -0
- package/api/resources/copilots/types/CollectionFilteredData.js +5 -0
- package/api/resources/copilots/types/DataChunk.d.ts +6 -0
- package/api/resources/copilots/types/DataChunk.js +5 -0
- package/api/resources/copilots/types/DataFilter.d.ts +9 -0
- package/api/resources/copilots/types/DataFilter.js +5 -0
- package/api/resources/copilots/types/DatetimeFieldSchema.d.ts +9 -0
- package/api/resources/copilots/types/DatetimeFieldSchema.js +5 -0
- package/api/resources/copilots/types/Filter.d.ts +19 -0
- package/api/resources/copilots/types/Filter.js +5 -0
- package/api/resources/copilots/types/FinalChunk.d.ts +7 -0
- package/api/resources/copilots/types/FinalChunk.js +5 -0
- package/api/resources/copilots/types/InitialChunk.d.ts +10 -0
- package/api/resources/copilots/types/InitialChunk.js +5 -0
- package/api/resources/copilots/types/InputVariable.d.ts +7 -0
- package/api/resources/copilots/types/InputVariable.js +5 -0
- package/api/resources/copilots/types/MessageReply.d.ts +1 -0
- package/api/resources/copilots/types/NumberFieldSchema.d.ts +9 -0
- package/api/resources/copilots/types/NumberFieldSchema.js +5 -0
- package/api/resources/copilots/types/StreamingChunk.d.ts +5 -0
- package/api/resources/copilots/types/StreamingChunk.js +5 -0
- package/api/resources/copilots/types/StringFieldSchema.d.ts +9 -0
- package/api/resources/copilots/types/StringFieldSchema.js +5 -0
- package/api/resources/copilots/types/WebSearchResult.d.ts +8 -0
- package/api/resources/copilots/types/WebSearchResult.js +5 -0
- package/api/resources/copilots/types/index.d.ts +14 -0
- package/api/resources/copilots/types/index.js +14 -0
- package/api/resources/documentCatalog/client/Client.d.ts +7 -4
- package/api/resources/documentCatalog/client/Client.js +13 -13
- package/api/resources/documentCollections/client/Client.d.ts +14 -11
- package/api/resources/documentCollections/client/Client.js +39 -29
- package/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.d.ts +2 -2
- package/api/resources/documentCollections/client/requests/CreateCollectionRequest.d.ts +1 -1
- package/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.d.ts +2 -2
- package/api/resources/permissionsService/client/Client.d.ts +8 -5
- package/api/resources/permissionsService/client/Client.js +20 -14
- package/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +1 -1
- package/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +1 -1
- package/api/resources/search/client/Client.d.ts +5 -2
- package/api/resources/search/client/Client.js +7 -7
- package/api/resources/search/client/requests/SearchDocumentCollectionRequest.d.ts +1 -1
- package/api/resources/search/types/index.d.ts +0 -1
- package/api/resources/search/types/index.js +0 -1
- package/api/resources/users/client/Client.d.ts +4 -1
- package/api/resources/users/client/Client.js +5 -3
- package/core/fetcher/Fetcher.d.ts +4 -1
- package/core/fetcher/Fetcher.js +19 -176
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +13 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +59 -0
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +23 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +55 -0
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +42 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +41 -0
- package/core/fetcher/signals.d.ts +12 -0
- package/core/fetcher/signals.js +37 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +50 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/runtime/runtime.d.ts +2 -1
- package/core/runtime/runtime.js +12 -1
- package/core/schemas/Schema.d.ts +8 -4
- package/core/schemas/Schema.js +1 -0
- package/core/schemas/builders/bigint/bigint.d.ts +2 -0
- package/core/schemas/builders/bigint/bigint.js +50 -0
- package/core/schemas/builders/bigint/index.d.ts +1 -0
- package/core/schemas/builders/bigint/index.js +5 -0
- package/core/schemas/builders/index.d.ts +1 -0
- package/core/schemas/builders/index.js +1 -0
- package/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/core/schemas/builders/lazy/lazy.js +8 -19
- package/core/schemas/builders/lazy/lazyObject.js +1 -10
- package/core/schemas/builders/list/list.js +31 -44
- package/core/schemas/builders/object/object.js +90 -111
- package/core/schemas/builders/object/types.d.ts +2 -2
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
- package/core/schemas/builders/record/record.js +49 -60
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
- package/core/schemas/builders/set/set.js +6 -15
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
- package/core/schemas/builders/union/union.js +51 -62
- package/core/schemas/utils/getErrorMessageForIncorrectType.js +4 -0
- package/core/schemas/utils/maybeSkipValidation.js +3 -12
- package/core/streaming-fetcher/Stream.d.ts +48 -0
- package/core/streaming-fetcher/Stream.js +170 -0
- package/core/streaming-fetcher/index.d.ts +1 -0
- package/core/streaming-fetcher/index.js +5 -0
- package/dist/Client.d.ts +3 -0
- package/dist/api/resources/common/types/index.d.ts +1 -0
- package/dist/api/resources/common/types/index.js +1 -0
- package/dist/api/resources/copilots/client/Client.d.ts +25 -11
- package/dist/api/resources/copilots/client/Client.js +119 -37
- package/dist/api/resources/copilots/client/requests/CreateCopilotRequest.d.ts +1 -1
- package/dist/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.d.ts +1 -1
- package/dist/api/resources/copilots/client/requests/SendMessageRequest.d.ts +14 -1
- package/dist/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +60 -0
- package/dist/api/resources/copilots/client/requests/StreamMessageRequest.js +5 -0
- package/dist/api/resources/copilots/client/requests/index.d.ts +1 -0
- package/dist/api/resources/copilots/types/BlockedChunk.d.ts +10 -0
- package/dist/api/resources/copilots/types/BlockedChunk.js +5 -0
- package/dist/api/resources/copilots/types/BooleanFieldSchema.d.ts +8 -0
- package/dist/api/resources/copilots/types/BooleanFieldSchema.js +5 -0
- package/dist/api/resources/copilots/types/CollectionFilteredData.d.ts +9 -0
- package/dist/api/resources/copilots/types/CollectionFilteredData.js +5 -0
- package/dist/api/resources/copilots/types/DataChunk.d.ts +6 -0
- package/dist/api/resources/copilots/types/DataChunk.js +5 -0
- package/dist/api/resources/copilots/types/DataFilter.d.ts +9 -0
- package/dist/api/resources/copilots/types/DataFilter.js +5 -0
- package/dist/api/resources/copilots/types/DatetimeFieldSchema.d.ts +9 -0
- package/dist/api/resources/copilots/types/DatetimeFieldSchema.js +5 -0
- package/dist/api/resources/copilots/types/Filter.d.ts +19 -0
- package/dist/api/resources/copilots/types/Filter.js +5 -0
- package/dist/api/resources/copilots/types/FinalChunk.d.ts +7 -0
- package/dist/api/resources/copilots/types/FinalChunk.js +5 -0
- package/dist/api/resources/copilots/types/InitialChunk.d.ts +10 -0
- package/dist/api/resources/copilots/types/InitialChunk.js +5 -0
- package/dist/api/resources/copilots/types/InputVariable.d.ts +7 -0
- package/dist/api/resources/copilots/types/InputVariable.js +5 -0
- package/dist/api/resources/copilots/types/MessageReply.d.ts +1 -0
- package/dist/api/resources/copilots/types/NumberFieldSchema.d.ts +9 -0
- package/dist/api/resources/copilots/types/NumberFieldSchema.js +5 -0
- package/dist/api/resources/copilots/types/StreamingChunk.d.ts +5 -0
- package/dist/api/resources/copilots/types/StreamingChunk.js +5 -0
- package/dist/api/resources/copilots/types/StringFieldSchema.d.ts +9 -0
- package/dist/api/resources/copilots/types/StringFieldSchema.js +5 -0
- package/dist/api/resources/copilots/types/WebSearchResult.d.ts +8 -0
- package/dist/api/resources/copilots/types/WebSearchResult.js +5 -0
- package/dist/api/resources/copilots/types/index.d.ts +14 -0
- package/dist/api/resources/copilots/types/index.js +14 -0
- package/dist/api/resources/documentCatalog/client/Client.d.ts +7 -4
- package/dist/api/resources/documentCatalog/client/Client.js +13 -13
- package/dist/api/resources/documentCollections/client/Client.d.ts +14 -11
- package/dist/api/resources/documentCollections/client/Client.js +39 -29
- package/dist/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.d.ts +2 -2
- package/dist/api/resources/documentCollections/client/requests/CreateCollectionRequest.d.ts +1 -1
- package/dist/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.d.ts +2 -2
- package/dist/api/resources/permissionsService/client/Client.d.ts +8 -5
- package/dist/api/resources/permissionsService/client/Client.js +20 -14
- package/dist/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +1 -1
- package/dist/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +1 -1
- package/dist/api/resources/search/client/Client.d.ts +5 -2
- package/dist/api/resources/search/client/Client.js +7 -7
- package/dist/api/resources/search/client/requests/SearchDocumentCollectionRequest.d.ts +1 -1
- package/dist/api/resources/search/types/index.d.ts +0 -1
- package/dist/api/resources/search/types/index.js +0 -1
- package/dist/api/resources/users/client/Client.d.ts +4 -1
- package/dist/api/resources/users/client/Client.js +5 -3
- package/dist/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/core/fetcher/Fetcher.js +19 -176
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +13 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +59 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +23 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +55 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +42 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +41 -0
- package/dist/core/fetcher/signals.d.ts +12 -0
- package/dist/core/fetcher/signals.js +37 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +50 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/runtime/runtime.d.ts +2 -1
- package/dist/core/runtime/runtime.js +12 -1
- package/dist/core/schemas/Schema.d.ts +8 -4
- package/dist/core/schemas/Schema.js +1 -0
- package/dist/core/schemas/builders/bigint/bigint.d.ts +2 -0
- package/dist/core/schemas/builders/bigint/bigint.js +50 -0
- package/dist/core/schemas/builders/bigint/index.d.ts +1 -0
- package/dist/core/schemas/builders/bigint/index.js +5 -0
- package/dist/core/schemas/builders/index.d.ts +1 -0
- package/dist/core/schemas/builders/index.js +1 -0
- package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/dist/core/schemas/builders/lazy/lazy.js +8 -19
- package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
- package/dist/core/schemas/builders/list/list.js +31 -44
- package/dist/core/schemas/builders/object/object.js +90 -111
- package/dist/core/schemas/builders/object/types.d.ts +2 -2
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
- package/dist/core/schemas/builders/record/record.js +49 -60
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
- package/dist/core/schemas/builders/set/set.js +6 -15
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
- package/dist/core/schemas/builders/union/union.js +51 -62
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +4 -0
- package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
- package/dist/core/streaming-fetcher/Stream.d.ts +48 -0
- package/dist/core/streaming-fetcher/Stream.js +170 -0
- package/dist/core/streaming-fetcher/index.d.ts +1 -0
- package/dist/core/streaming-fetcher/index.js +5 -0
- package/dist/serialization/resources/common/types/index.d.ts +1 -0
- package/dist/serialization/resources/common/types/index.js +1 -0
- package/dist/serialization/resources/copilots/client/requests/SendMessageRequest.d.ts +2 -0
- package/dist/serialization/resources/copilots/client/requests/SendMessageRequest.js +2 -0
- package/dist/serialization/resources/copilots/client/requests/StreamMessageRequest.d.ts +17 -0
- package/dist/serialization/resources/copilots/client/requests/StreamMessageRequest.js +38 -0
- package/dist/serialization/resources/copilots/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/copilots/client/requests/index.js +3 -1
- package/dist/serialization/resources/copilots/types/BlockedChunk.d.ts +16 -0
- package/dist/serialization/resources/copilots/types/BlockedChunk.js +37 -0
- package/dist/serialization/resources/copilots/types/BooleanFieldSchema.d.ts +14 -0
- package/dist/serialization/resources/copilots/types/BooleanFieldSchema.js +35 -0
- package/dist/serialization/resources/copilots/types/CollectionFilteredData.d.ts +15 -0
- package/dist/serialization/resources/copilots/types/CollectionFilteredData.js +36 -0
- package/dist/serialization/resources/copilots/types/DataChunk.d.ts +12 -0
- package/dist/serialization/resources/copilots/types/DataChunk.js +33 -0
- package/dist/serialization/resources/copilots/types/DataFilter.d.ts +15 -0
- package/dist/serialization/resources/copilots/types/DataFilter.js +36 -0
- package/dist/serialization/resources/copilots/types/DatetimeFieldSchema.d.ts +15 -0
- package/dist/serialization/resources/copilots/types/DatetimeFieldSchema.js +36 -0
- package/dist/serialization/resources/copilots/types/Filter.d.ts +26 -0
- package/dist/serialization/resources/copilots/types/Filter.js +45 -0
- package/dist/serialization/resources/copilots/types/FinalChunk.d.ts +13 -0
- package/dist/serialization/resources/copilots/types/FinalChunk.js +34 -0
- package/dist/serialization/resources/copilots/types/InitialChunk.d.ts +17 -0
- package/dist/serialization/resources/copilots/types/InitialChunk.js +38 -0
- package/dist/serialization/resources/copilots/types/InputVariable.d.ts +13 -0
- package/dist/serialization/resources/copilots/types/InputVariable.js +34 -0
- package/dist/serialization/resources/copilots/types/MessageReply.d.ts +2 -0
- package/dist/serialization/resources/copilots/types/MessageReply.js +2 -0
- package/dist/serialization/resources/copilots/types/NumberFieldSchema.d.ts +15 -0
- package/dist/serialization/resources/copilots/types/NumberFieldSchema.js +36 -0
- package/dist/serialization/resources/copilots/types/StreamingChunk.d.ts +14 -0
- package/dist/serialization/resources/copilots/types/StreamingChunk.js +35 -0
- package/dist/serialization/resources/copilots/types/StringFieldSchema.d.ts +15 -0
- package/dist/serialization/resources/copilots/types/StringFieldSchema.js +36 -0
- package/dist/serialization/resources/copilots/types/WebSearchResult.d.ts +14 -0
- package/dist/serialization/resources/copilots/types/WebSearchResult.js +35 -0
- package/dist/serialization/resources/copilots/types/index.d.ts +14 -0
- package/dist/serialization/resources/copilots/types/index.js +14 -0
- package/dist/serialization/resources/search/types/SingleFieldFilter.d.ts +1 -1
- package/dist/serialization/resources/search/types/SingleFieldFilter.js +1 -1
- package/dist/serialization/resources/search/types/index.d.ts +0 -1
- package/dist/serialization/resources/search/types/index.js +0 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/package.json +12 -2
- package/reference.md +203 -511
- package/serialization/resources/common/types/index.d.ts +1 -0
- package/serialization/resources/common/types/index.js +1 -0
- package/serialization/resources/copilots/client/requests/SendMessageRequest.d.ts +2 -0
- package/serialization/resources/copilots/client/requests/SendMessageRequest.js +2 -0
- package/serialization/resources/copilots/client/requests/StreamMessageRequest.d.ts +17 -0
- package/serialization/resources/copilots/client/requests/StreamMessageRequest.js +38 -0
- package/serialization/resources/copilots/client/requests/index.d.ts +1 -0
- package/serialization/resources/copilots/client/requests/index.js +3 -1
- package/serialization/resources/copilots/types/BlockedChunk.d.ts +16 -0
- package/serialization/resources/copilots/types/BlockedChunk.js +37 -0
- package/serialization/resources/copilots/types/BooleanFieldSchema.d.ts +14 -0
- package/serialization/resources/copilots/types/BooleanFieldSchema.js +35 -0
- package/serialization/resources/copilots/types/CollectionFilteredData.d.ts +15 -0
- package/serialization/resources/copilots/types/CollectionFilteredData.js +36 -0
- package/serialization/resources/copilots/types/DataChunk.d.ts +12 -0
- package/serialization/resources/copilots/types/DataChunk.js +33 -0
- package/serialization/resources/copilots/types/DataFilter.d.ts +15 -0
- package/serialization/resources/copilots/types/DataFilter.js +36 -0
- package/serialization/resources/copilots/types/DatetimeFieldSchema.d.ts +15 -0
- package/serialization/resources/copilots/types/DatetimeFieldSchema.js +36 -0
- package/serialization/resources/copilots/types/Filter.d.ts +26 -0
- package/serialization/resources/copilots/types/Filter.js +45 -0
- package/serialization/resources/copilots/types/FinalChunk.d.ts +13 -0
- package/serialization/resources/copilots/types/FinalChunk.js +34 -0
- package/serialization/resources/copilots/types/InitialChunk.d.ts +17 -0
- package/serialization/resources/copilots/types/InitialChunk.js +38 -0
- package/serialization/resources/copilots/types/InputVariable.d.ts +13 -0
- package/serialization/resources/copilots/types/InputVariable.js +34 -0
- package/serialization/resources/copilots/types/MessageReply.d.ts +2 -0
- package/serialization/resources/copilots/types/MessageReply.js +2 -0
- package/serialization/resources/copilots/types/NumberFieldSchema.d.ts +15 -0
- package/serialization/resources/copilots/types/NumberFieldSchema.js +36 -0
- package/serialization/resources/copilots/types/StreamingChunk.d.ts +14 -0
- package/serialization/resources/copilots/types/StreamingChunk.js +35 -0
- package/serialization/resources/copilots/types/StringFieldSchema.d.ts +15 -0
- package/serialization/resources/copilots/types/StringFieldSchema.js +36 -0
- package/serialization/resources/copilots/types/WebSearchResult.d.ts +14 -0
- package/serialization/resources/copilots/types/WebSearchResult.js +35 -0
- package/serialization/resources/copilots/types/index.d.ts +14 -0
- package/serialization/resources/copilots/types/index.js +14 -0
- package/serialization/resources/search/types/SingleFieldFilter.d.ts +1 -1
- package/serialization/resources/search/types/SingleFieldFilter.js +1 -1
- package/serialization/resources/search/types/index.d.ts +0 -1
- package/serialization/resources/search/types/index.js +0 -1
- package/version.d.ts +1 -0
- package/version.js +4 -0
- /package/api/resources/{search → common}/types/Operator.d.ts +0 -0
- /package/api/resources/{search → common}/types/Operator.js +0 -0
- /package/dist/api/resources/{search → common}/types/Operator.d.ts +0 -0
- /package/dist/api/resources/{search → common}/types/Operator.js +0 -0
- /package/dist/serialization/resources/{search → common}/types/Operator.d.ts +0 -0
- /package/dist/serialization/resources/{search → common}/types/Operator.js +0 -0
- /package/serialization/resources/{search → common}/types/Operator.d.ts +0 -0
- /package/serialization/resources/{search → common}/types/Operator.js +0 -0
|
@@ -11,8 +11,11 @@ export declare namespace PermissionsService {
|
|
|
11
11
|
fetcher?: core.FetchFunction;
|
|
12
12
|
}
|
|
13
13
|
interface RequestOptions {
|
|
14
|
+
/** The maximum time to wait for a response in seconds. */
|
|
14
15
|
timeoutInSeconds?: number;
|
|
16
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
15
17
|
maxRetries?: number;
|
|
18
|
+
/** A hook to abort the request. */
|
|
16
19
|
abortSignal?: AbortSignal;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -26,11 +29,11 @@ export declare class PermissionsService {
|
|
|
26
29
|
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
30
|
*
|
|
28
31
|
* @example
|
|
29
|
-
* await
|
|
32
|
+
* await client.permissionsService.checkResourceAuthorizationForUser({
|
|
30
33
|
* resourceIdentifier: {
|
|
31
34
|
* type: "external-resource-id",
|
|
32
35
|
* externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
|
|
33
|
-
* resourceType:
|
|
36
|
+
* resourceType: "GOOGLE_DRIVE_ITEM"
|
|
34
37
|
* },
|
|
35
38
|
* userEmail: "john.smith@foo.com"
|
|
36
39
|
* })
|
|
@@ -43,14 +46,14 @@ export declare class PermissionsService {
|
|
|
43
46
|
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
44
47
|
*
|
|
45
48
|
* @example
|
|
46
|
-
* await
|
|
49
|
+
* await client.permissionsService.checkBulkResourcesAuthorizationForUser({
|
|
47
50
|
* resourceIdentifiers: [{
|
|
48
51
|
* type: "url",
|
|
49
52
|
* url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit"
|
|
50
53
|
* }, {
|
|
51
54
|
* type: "external-resource-id",
|
|
52
55
|
* externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
|
|
53
|
-
* resourceType:
|
|
56
|
+
* resourceType: "ZENDESK_TICKET"
|
|
54
57
|
* }],
|
|
55
58
|
* userEmail: "john.smith@foo.com"
|
|
56
59
|
* })
|
|
@@ -63,7 +66,7 @@ export declare class PermissionsService {
|
|
|
63
66
|
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
67
|
*
|
|
65
68
|
* @example
|
|
66
|
-
* await
|
|
69
|
+
* await client.permissionsService.listCachedAuthorizedResourcesForUser({
|
|
67
70
|
* userEmail: "john.smith@foo.com"
|
|
68
71
|
* })
|
|
69
72
|
*/
|
|
@@ -55,11 +55,11 @@ class PermissionsService {
|
|
|
55
55
|
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
|
-
* await
|
|
58
|
+
* await client.permissionsService.checkResourceAuthorizationForUser({
|
|
59
59
|
* resourceIdentifier: {
|
|
60
60
|
* type: "external-resource-id",
|
|
61
61
|
* externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
|
|
62
|
-
* resourceType:
|
|
62
|
+
* resourceType: "GOOGLE_DRIVE_ITEM"
|
|
63
63
|
* },
|
|
64
64
|
* userEmail: "john.smith@foo.com"
|
|
65
65
|
* })
|
|
@@ -74,12 +74,14 @@ class PermissionsService {
|
|
|
74
74
|
Authorization: yield this._getAuthorizationHeader(),
|
|
75
75
|
"X-Fern-Language": "JavaScript",
|
|
76
76
|
"X-Fern-SDK-Name": "@credal/sdk",
|
|
77
|
-
"X-Fern-SDK-Version": "0.0.
|
|
77
|
+
"X-Fern-SDK-Version": "0.0.15",
|
|
78
|
+
"User-Agent": "@credal/sdk/0.0.15",
|
|
78
79
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
79
80
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
80
81
|
},
|
|
81
82
|
contentType: "application/json",
|
|
82
|
-
|
|
83
|
+
requestType: "json",
|
|
84
|
+
body: serializers.CheckResourceAuthorizationForUserRequest.jsonOrThrow(request, {
|
|
83
85
|
unrecognizedObjectKeys: "strip",
|
|
84
86
|
}),
|
|
85
87
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -87,7 +89,7 @@ class PermissionsService {
|
|
|
87
89
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
88
90
|
});
|
|
89
91
|
if (_response.ok) {
|
|
90
|
-
return
|
|
92
|
+
return serializers.CheckResourceAuthorizationResponse.parseOrThrow(_response.body, {
|
|
91
93
|
unrecognizedObjectKeys: "passthrough",
|
|
92
94
|
allowUnrecognizedUnionMembers: true,
|
|
93
95
|
allowUnrecognizedEnumValues: true,
|
|
@@ -122,14 +124,14 @@ class PermissionsService {
|
|
|
122
124
|
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
123
125
|
*
|
|
124
126
|
* @example
|
|
125
|
-
* await
|
|
127
|
+
* await client.permissionsService.checkBulkResourcesAuthorizationForUser({
|
|
126
128
|
* resourceIdentifiers: [{
|
|
127
129
|
* type: "url",
|
|
128
130
|
* url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit"
|
|
129
131
|
* }, {
|
|
130
132
|
* type: "external-resource-id",
|
|
131
133
|
* externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
|
|
132
|
-
* resourceType:
|
|
134
|
+
* resourceType: "ZENDESK_TICKET"
|
|
133
135
|
* }],
|
|
134
136
|
* userEmail: "john.smith@foo.com"
|
|
135
137
|
* })
|
|
@@ -144,12 +146,14 @@ class PermissionsService {
|
|
|
144
146
|
Authorization: yield this._getAuthorizationHeader(),
|
|
145
147
|
"X-Fern-Language": "JavaScript",
|
|
146
148
|
"X-Fern-SDK-Name": "@credal/sdk",
|
|
147
|
-
"X-Fern-SDK-Version": "0.0.
|
|
149
|
+
"X-Fern-SDK-Version": "0.0.15",
|
|
150
|
+
"User-Agent": "@credal/sdk/0.0.15",
|
|
148
151
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
149
152
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
150
153
|
},
|
|
151
154
|
contentType: "application/json",
|
|
152
|
-
|
|
155
|
+
requestType: "json",
|
|
156
|
+
body: serializers.CheckBulkResourcesAuthorizationForUserRequest.jsonOrThrow(request, {
|
|
153
157
|
unrecognizedObjectKeys: "strip",
|
|
154
158
|
}),
|
|
155
159
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -157,7 +161,7 @@ class PermissionsService {
|
|
|
157
161
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
158
162
|
});
|
|
159
163
|
if (_response.ok) {
|
|
160
|
-
return
|
|
164
|
+
return serializers.CheckBulkResourcesAuthorizationResponse.parseOrThrow(_response.body, {
|
|
161
165
|
unrecognizedObjectKeys: "passthrough",
|
|
162
166
|
allowUnrecognizedUnionMembers: true,
|
|
163
167
|
allowUnrecognizedEnumValues: true,
|
|
@@ -192,7 +196,7 @@ class PermissionsService {
|
|
|
192
196
|
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
193
197
|
*
|
|
194
198
|
* @example
|
|
195
|
-
* await
|
|
199
|
+
* await client.permissionsService.listCachedAuthorizedResourcesForUser({
|
|
196
200
|
* userEmail: "john.smith@foo.com"
|
|
197
201
|
* })
|
|
198
202
|
*/
|
|
@@ -206,12 +210,14 @@ class PermissionsService {
|
|
|
206
210
|
Authorization: yield this._getAuthorizationHeader(),
|
|
207
211
|
"X-Fern-Language": "JavaScript",
|
|
208
212
|
"X-Fern-SDK-Name": "@credal/sdk",
|
|
209
|
-
"X-Fern-SDK-Version": "0.0.
|
|
213
|
+
"X-Fern-SDK-Version": "0.0.15",
|
|
214
|
+
"User-Agent": "@credal/sdk/0.0.15",
|
|
210
215
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
211
216
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
212
217
|
},
|
|
213
218
|
contentType: "application/json",
|
|
214
|
-
|
|
219
|
+
requestType: "json",
|
|
220
|
+
body: serializers.ListCachedAuthorizedResourcesForUserRequest.jsonOrThrow(request, {
|
|
215
221
|
unrecognizedObjectKeys: "strip",
|
|
216
222
|
}),
|
|
217
223
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -219,7 +225,7 @@ class PermissionsService {
|
|
|
219
225
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
220
226
|
});
|
|
221
227
|
if (_response.ok) {
|
|
222
|
-
return
|
|
228
|
+
return serializers.AuthorizedResourceListPage.parseOrThrow(_response.body, {
|
|
223
229
|
unrecognizedObjectKeys: "passthrough",
|
|
224
230
|
allowUnrecognizedUnionMembers: true,
|
|
225
231
|
allowUnrecognizedEnumValues: true,
|
|
@@ -11,7 +11,7 @@ import * as Credal from "../../../../index";
|
|
|
11
11
|
* }, {
|
|
12
12
|
* type: "external-resource-id",
|
|
13
13
|
* externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
|
|
14
|
-
* resourceType:
|
|
14
|
+
* resourceType: "ZENDESK_TICKET"
|
|
15
15
|
* }],
|
|
16
16
|
* userEmail: "john.smith@foo.com"
|
|
17
17
|
* }
|
|
@@ -8,7 +8,7 @@ import * as Credal from "../../../../index";
|
|
|
8
8
|
* resourceIdentifier: {
|
|
9
9
|
* type: "external-resource-id",
|
|
10
10
|
* externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
|
|
11
|
-
* resourceType:
|
|
11
|
+
* resourceType: "GOOGLE_DRIVE_ITEM"
|
|
12
12
|
* },
|
|
13
13
|
* userEmail: "john.smith@foo.com"
|
|
14
14
|
* }
|
|
@@ -11,8 +11,11 @@ export declare namespace Search {
|
|
|
11
11
|
fetcher?: core.FetchFunction;
|
|
12
12
|
}
|
|
13
13
|
interface RequestOptions {
|
|
14
|
+
/** The maximum time to wait for a response in seconds. */
|
|
14
15
|
timeoutInSeconds?: number;
|
|
16
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
15
17
|
maxRetries?: number;
|
|
18
|
+
/** A hook to abort the request. */
|
|
16
19
|
abortSignal?: AbortSignal;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -26,12 +29,12 @@ export declare class Search {
|
|
|
26
29
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
30
|
*
|
|
28
31
|
* @example
|
|
29
|
-
* await
|
|
32
|
+
* await client.search.searchDocumentCollection({
|
|
30
33
|
* collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
|
|
31
34
|
* searchQuery: "ABC Corp",
|
|
32
35
|
* structuredQueryFilters: [{
|
|
33
36
|
* field: "status",
|
|
34
|
-
* operator:
|
|
37
|
+
* operator: "==",
|
|
35
38
|
* value: "Open"
|
|
36
39
|
* }],
|
|
37
40
|
* userEmail: "jack@credal.ai",
|
|
@@ -55,12 +55,12 @@ class Search {
|
|
|
55
55
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
|
-
* await
|
|
58
|
+
* await client.search.searchDocumentCollection({
|
|
59
59
|
* collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
|
|
60
60
|
* searchQuery: "ABC Corp",
|
|
61
61
|
* structuredQueryFilters: [{
|
|
62
62
|
* field: "status",
|
|
63
|
-
* operator:
|
|
63
|
+
* operator: "==",
|
|
64
64
|
* value: "Open"
|
|
65
65
|
* }],
|
|
66
66
|
* userEmail: "jack@credal.ai",
|
|
@@ -84,20 +84,20 @@ class Search {
|
|
|
84
84
|
Authorization: yield this._getAuthorizationHeader(),
|
|
85
85
|
"X-Fern-Language": "JavaScript",
|
|
86
86
|
"X-Fern-SDK-Name": "@credal/sdk",
|
|
87
|
-
"X-Fern-SDK-Version": "0.0.
|
|
87
|
+
"X-Fern-SDK-Version": "0.0.15",
|
|
88
|
+
"User-Agent": "@credal/sdk/0.0.15",
|
|
88
89
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
89
90
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
90
91
|
},
|
|
91
92
|
contentType: "application/json",
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}),
|
|
93
|
+
requestType: "json",
|
|
94
|
+
body: serializers.SearchDocumentCollectionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
95
95
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
96
96
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
97
97
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
98
98
|
});
|
|
99
99
|
if (_response.ok) {
|
|
100
|
-
return
|
|
100
|
+
return serializers.SearchDocumentCollectionResponse.parseOrThrow(_response.body, {
|
|
101
101
|
unrecognizedObjectKeys: "passthrough",
|
|
102
102
|
allowUnrecognizedUnionMembers: true,
|
|
103
103
|
allowUnrecognizedEnumValues: true,
|
|
@@ -18,5 +18,4 @@ __exportStar(require("./DocumentCollectionSearchOptions"), exports);
|
|
|
18
18
|
__exportStar(require("./SearchDocumentCollectionResponse"), exports);
|
|
19
19
|
__exportStar(require("./DocumentCollectionSearchResult"), exports);
|
|
20
20
|
__exportStar(require("./SearchResultChunk"), exports);
|
|
21
|
-
__exportStar(require("./Operator"), exports);
|
|
22
21
|
__exportStar(require("./SingleFieldFilter"), exports);
|
|
@@ -11,8 +11,11 @@ export declare namespace Users {
|
|
|
11
11
|
fetcher?: core.FetchFunction;
|
|
12
12
|
}
|
|
13
13
|
interface RequestOptions {
|
|
14
|
+
/** The maximum time to wait for a response in seconds. */
|
|
14
15
|
timeoutInSeconds?: number;
|
|
16
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
15
17
|
maxRetries?: number;
|
|
18
|
+
/** A hook to abort the request. */
|
|
16
19
|
abortSignal?: AbortSignal;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -26,7 +29,7 @@ export declare class Users {
|
|
|
26
29
|
* @param {Users.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
30
|
*
|
|
28
31
|
* @example
|
|
29
|
-
* await
|
|
32
|
+
* await client.users.metadata([{
|
|
30
33
|
* metadata: {
|
|
31
34
|
* "State": "NY",
|
|
32
35
|
* "Job Role": "CEO"
|
|
@@ -55,7 +55,7 @@ class Users {
|
|
|
55
55
|
* @param {Users.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
|
-
* await
|
|
58
|
+
* await client.users.metadata([{
|
|
59
59
|
* metadata: {
|
|
60
60
|
* "State": "NY",
|
|
61
61
|
* "Job Role": "CEO"
|
|
@@ -79,12 +79,14 @@ class Users {
|
|
|
79
79
|
Authorization: yield this._getAuthorizationHeader(),
|
|
80
80
|
"X-Fern-Language": "JavaScript",
|
|
81
81
|
"X-Fern-SDK-Name": "@credal/sdk",
|
|
82
|
-
"X-Fern-SDK-Version": "0.0.
|
|
82
|
+
"X-Fern-SDK-Version": "0.0.15",
|
|
83
|
+
"User-Agent": "@credal/sdk/0.0.15",
|
|
83
84
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
84
85
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
85
86
|
},
|
|
86
87
|
contentType: "application/json",
|
|
87
|
-
|
|
88
|
+
requestType: "json",
|
|
89
|
+
body: serializers.users.metadata.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
88
90
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
89
91
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
90
92
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -12,7 +12,9 @@ export declare namespace Fetcher {
|
|
|
12
12
|
maxRetries?: number;
|
|
13
13
|
withCredentials?: boolean;
|
|
14
14
|
abortSignal?: AbortSignal;
|
|
15
|
-
|
|
15
|
+
requestType?: "json" | "file" | "bytes";
|
|
16
|
+
responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer";
|
|
17
|
+
duplex?: "half";
|
|
16
18
|
}
|
|
17
19
|
type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
|
|
18
20
|
interface FailedStatusCodeError {
|
|
@@ -33,4 +35,5 @@ export declare namespace Fetcher {
|
|
|
33
35
|
errorMessage: string;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
38
|
+
export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
|
|
36
39
|
export declare const fetcher: FetchFunction;
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,18 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
9
|
});
|
|
33
10
|
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.fetcher = void 0;
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
12
|
+
exports.fetcher = exports.fetcherImpl = void 0;
|
|
13
|
+
const createRequestUrl_1 = require("./createRequestUrl");
|
|
14
|
+
const getFetchFn_1 = require("./getFetchFn");
|
|
15
|
+
const getRequestBody_1 = require("./getRequestBody");
|
|
16
|
+
const getResponseBody_1 = require("./getResponseBody");
|
|
17
|
+
const makeRequest_1 = require("./makeRequest");
|
|
18
|
+
const requestWithRetries_1 = require("./requestWithRetries");
|
|
44
19
|
function fetcherImpl(args) {
|
|
45
|
-
var _a, _b;
|
|
46
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
21
|
const headers = {};
|
|
48
22
|
if (args.body !== undefined && args.contentType != null) {
|
|
@@ -55,121 +29,21 @@ function fetcherImpl(args) {
|
|
|
55
29
|
}
|
|
56
30
|
}
|
|
57
31
|
}
|
|
58
|
-
const url =
|
|
59
|
-
|
|
60
|
-
: args.
|
|
61
|
-
|
|
62
|
-
const maybeStringifyBody = (body) => {
|
|
63
|
-
if (body instanceof Uint8Array) {
|
|
64
|
-
return body;
|
|
65
|
-
}
|
|
66
|
-
else if (args.contentType === "application/x-www-form-urlencoded" && typeof args.body === "string") {
|
|
67
|
-
return args.body;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return JSON.stringify(body);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
if (runtime_1.RUNTIME.type === "node") {
|
|
74
|
-
if (args.body instanceof (yield Promise.resolve().then(() => __importStar(require("formdata-node")))).FormData) {
|
|
75
|
-
// @ts-expect-error
|
|
76
|
-
body = args.body;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
body = maybeStringifyBody(args.body);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
if (args.body instanceof (yield Promise.resolve().then(() => __importStar(require("form-data")))).default) {
|
|
84
|
-
// @ts-expect-error
|
|
85
|
-
body = args.body;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
body = maybeStringifyBody(args.body);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// In Node.js environments, the SDK always uses`node-fetch`.
|
|
92
|
-
// If not in Node.js the SDK uses global fetch if available,
|
|
93
|
-
// and falls back to node-fetch.
|
|
94
|
-
const fetchFn = runtime_1.RUNTIME.type === "node"
|
|
95
|
-
? // `.default` is required due to this issue:
|
|
96
|
-
// https://github.com/node-fetch/node-fetch/issues/450#issuecomment-387045223
|
|
97
|
-
(yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default
|
|
98
|
-
: typeof fetch == "function"
|
|
99
|
-
? fetch
|
|
100
|
-
: (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
|
|
101
|
-
const makeRequest = () => __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
const signals = [];
|
|
103
|
-
// Add timeout signal
|
|
104
|
-
let timeoutAbortId = undefined;
|
|
105
|
-
if (args.timeoutMs != null) {
|
|
106
|
-
const { signal, abortId } = getTimeoutSignal(args.timeoutMs);
|
|
107
|
-
timeoutAbortId = abortId;
|
|
108
|
-
signals.push(signal);
|
|
109
|
-
}
|
|
110
|
-
// Add arbitrary signal
|
|
111
|
-
if (args.abortSignal != null) {
|
|
112
|
-
signals.push(args.abortSignal);
|
|
113
|
-
}
|
|
114
|
-
const response = yield fetchFn(url, {
|
|
115
|
-
method: args.method,
|
|
116
|
-
headers,
|
|
117
|
-
body,
|
|
118
|
-
signal: anySignal(signals),
|
|
119
|
-
credentials: args.withCredentials ? "include" : undefined,
|
|
120
|
-
});
|
|
121
|
-
if (timeoutAbortId != null) {
|
|
122
|
-
clearTimeout(timeoutAbortId);
|
|
123
|
-
}
|
|
124
|
-
return response;
|
|
32
|
+
const url = (0, createRequestUrl_1.createRequestUrl)(args.url, args.queryParameters);
|
|
33
|
+
let requestBody = yield (0, getRequestBody_1.getRequestBody)({
|
|
34
|
+
body: args.body,
|
|
35
|
+
type: args.requestType === "json" ? "json" : "other",
|
|
125
36
|
});
|
|
37
|
+
const fetchFn = yield (0, getFetchFn_1.getFetchFn)();
|
|
126
38
|
try {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
response.status === 429 ||
|
|
132
|
-
response.status >= 500) {
|
|
133
|
-
const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(i, 2), MAX_RETRY_DELAY);
|
|
134
|
-
yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
135
|
-
response = yield makeRequest();
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
let body;
|
|
142
|
-
if (response.body != null && args.responseType === "blob") {
|
|
143
|
-
body = yield response.blob();
|
|
144
|
-
}
|
|
145
|
-
else if (response.body != null && args.responseType === "streaming") {
|
|
146
|
-
body = response.body;
|
|
147
|
-
}
|
|
148
|
-
else if (response.body != null && args.responseType === "text") {
|
|
149
|
-
body = yield response.text();
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
const text = yield response.text();
|
|
153
|
-
if (text.length > 0) {
|
|
154
|
-
try {
|
|
155
|
-
body = JSON.parse(text);
|
|
156
|
-
}
|
|
157
|
-
catch (err) {
|
|
158
|
-
return {
|
|
159
|
-
ok: false,
|
|
160
|
-
error: {
|
|
161
|
-
reason: "non-json",
|
|
162
|
-
statusCode: response.status,
|
|
163
|
-
rawBody: text,
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
39
|
+
const response = yield (0, requestWithRetries_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return (0, makeRequest_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
|
|
41
|
+
}), args.maxRetries);
|
|
42
|
+
let responseBody = yield (0, getResponseBody_1.getResponseBody)(response, args.responseType);
|
|
169
43
|
if (response.status >= 200 && response.status < 400) {
|
|
170
44
|
return {
|
|
171
45
|
ok: true,
|
|
172
|
-
body:
|
|
46
|
+
body: responseBody,
|
|
173
47
|
headers: response.headers,
|
|
174
48
|
};
|
|
175
49
|
}
|
|
@@ -179,7 +53,7 @@ function fetcherImpl(args) {
|
|
|
179
53
|
error: {
|
|
180
54
|
reason: "status-code",
|
|
181
55
|
statusCode: response.status,
|
|
182
|
-
body,
|
|
56
|
+
body: responseBody,
|
|
183
57
|
},
|
|
184
58
|
};
|
|
185
59
|
}
|
|
@@ -221,36 +95,5 @@ function fetcherImpl(args) {
|
|
|
221
95
|
}
|
|
222
96
|
});
|
|
223
97
|
}
|
|
224
|
-
|
|
225
|
-
function getTimeoutSignal(timeoutMs) {
|
|
226
|
-
const controller = new AbortController();
|
|
227
|
-
const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
|
|
228
|
-
return { signal: controller.signal, abortId };
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Returns an abort signal that is getting aborted when
|
|
232
|
-
* at least one of the specified abort signals is aborted.
|
|
233
|
-
*
|
|
234
|
-
* Requires at least node.js 18.
|
|
235
|
-
*/
|
|
236
|
-
function anySignal(...args) {
|
|
237
|
-
// Allowing signals to be passed either as array
|
|
238
|
-
// of signals or as multiple arguments.
|
|
239
|
-
const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args);
|
|
240
|
-
const controller = new AbortController();
|
|
241
|
-
for (const signal of signals) {
|
|
242
|
-
if (signal.aborted) {
|
|
243
|
-
// Exiting early if one of the signals
|
|
244
|
-
// is already aborted.
|
|
245
|
-
controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
// Listening for signals and removing the listeners
|
|
249
|
-
// when at least one symbol is aborted.
|
|
250
|
-
signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
|
|
251
|
-
signal: controller.signal,
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
return controller.signal;
|
|
255
|
-
}
|
|
98
|
+
exports.fetcherImpl = fetcherImpl;
|
|
256
99
|
exports.fetcher = fetcherImpl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createRequestUrl(baseUrl: string, queryParameters?: Record<string, string | string[] | object | object[]>): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createRequestUrl = void 0;
|
|
7
|
+
const qs_1 = __importDefault(require("qs"));
|
|
8
|
+
function createRequestUrl(baseUrl, queryParameters) {
|
|
9
|
+
return Object.keys(queryParameters !== null && queryParameters !== void 0 ? queryParameters : {}).length > 0
|
|
10
|
+
? `${baseUrl}?${qs_1.default.stringify(queryParameters, { arrayFormat: "repeat" })}`
|
|
11
|
+
: baseUrl;
|
|
12
|
+
}
|
|
13
|
+
exports.createRequestUrl = createRequestUrl;
|