@markupai/api 0.0.6
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 +40 -0
- package/Client.js +32 -0
- package/LICENSE +201 -0
- package/README.md +165 -0
- package/api/errors/ContentTooLargeError.d.ts +8 -0
- package/api/errors/ContentTooLargeError.js +52 -0
- package/api/errors/ForbiddenError.d.ts +9 -0
- package/api/errors/ForbiddenError.js +52 -0
- package/api/errors/InternalServerError.d.ts +9 -0
- package/api/errors/InternalServerError.js +52 -0
- package/api/errors/NotFoundError.d.ts +9 -0
- package/api/errors/NotFoundError.js +52 -0
- package/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/api/errors/UnprocessableEntityError.js +52 -0
- package/api/errors/index.d.ts +5 -0
- package/api/errors/index.js +21 -0
- package/api/index.d.ts +3 -0
- package/api/index.js +19 -0
- package/api/resources/index.d.ts +8 -0
- package/api/resources/index.js +47 -0
- package/api/resources/styleChecks/client/Client.d.ts +70 -0
- package/api/resources/styleChecks/client/Client.js +215 -0
- package/api/resources/styleChecks/client/index.d.ts +1 -0
- package/api/resources/styleChecks/client/index.js +17 -0
- package/api/resources/styleChecks/client/requests/StyleChecksCreateStyleCheckRequest.d.ts +22 -0
- package/api/resources/styleChecks/client/requests/StyleChecksCreateStyleCheckRequest.js +5 -0
- package/api/resources/styleChecks/client/requests/index.d.ts +1 -0
- package/api/resources/styleChecks/client/requests/index.js +2 -0
- package/api/resources/styleChecks/index.d.ts +1 -0
- package/api/resources/styleChecks/index.js +17 -0
- package/api/resources/styleGuides/client/Client.d.ts +109 -0
- package/api/resources/styleGuides/client/Client.js +394 -0
- package/api/resources/styleGuides/client/index.d.ts +1 -0
- package/api/resources/styleGuides/client/index.js +17 -0
- package/api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.d.ts +13 -0
- package/api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.js +5 -0
- package/api/resources/styleGuides/client/requests/StyleGuideRequestBody.d.ts +11 -0
- package/api/resources/styleGuides/client/requests/StyleGuideRequestBody.js +5 -0
- package/api/resources/styleGuides/client/requests/index.d.ts +2 -0
- package/api/resources/styleGuides/client/requests/index.js +2 -0
- package/api/resources/styleGuides/index.d.ts +1 -0
- package/api/resources/styleGuides/index.js +17 -0
- package/api/resources/styleRewrites/client/Client.d.ts +70 -0
- package/api/resources/styleRewrites/client/Client.js +215 -0
- package/api/resources/styleRewrites/client/index.d.ts +1 -0
- package/api/resources/styleRewrites/client/index.js +17 -0
- package/api/resources/styleRewrites/client/requests/StyleRewritesCreateStyleRewriteRequest.d.ts +22 -0
- package/api/resources/styleRewrites/client/requests/StyleRewritesCreateStyleRewriteRequest.js +5 -0
- package/api/resources/styleRewrites/client/requests/index.d.ts +1 -0
- package/api/resources/styleRewrites/client/requests/index.js +2 -0
- package/api/resources/styleRewrites/index.d.ts +1 -0
- package/api/resources/styleRewrites/index.js +17 -0
- package/api/resources/styleSuggestions/client/Client.d.ts +70 -0
- package/api/resources/styleSuggestions/client/Client.js +215 -0
- package/api/resources/styleSuggestions/client/index.d.ts +1 -0
- package/api/resources/styleSuggestions/client/index.js +17 -0
- package/api/resources/styleSuggestions/client/requests/StyleSuggestionsCreateStyleSuggestionRequest.d.ts +22 -0
- package/api/resources/styleSuggestions/client/requests/StyleSuggestionsCreateStyleSuggestionRequest.js +5 -0
- package/api/resources/styleSuggestions/client/requests/index.d.ts +1 -0
- package/api/resources/styleSuggestions/client/requests/index.js +2 -0
- package/api/resources/styleSuggestions/index.d.ts +1 -0
- package/api/resources/styleSuggestions/index.js +17 -0
- package/api/types/CheckOptions.d.ts +9 -0
- package/api/types/CheckOptions.js +5 -0
- package/api/types/ClarityScore.d.ts +14 -0
- package/api/types/ClarityScore.js +5 -0
- package/api/types/Dialects.d.ts +9 -0
- package/api/types/Dialects.js +11 -0
- package/api/types/ErrorResponse.d.ts +11 -0
- package/api/types/ErrorResponse.js +5 -0
- package/api/types/GrammarCategory.d.ts +13 -0
- package/api/types/GrammarCategory.js +15 -0
- package/api/types/GrammarScore.d.ts +7 -0
- package/api/types/GrammarScore.js +5 -0
- package/api/types/Issue.d.ts +13 -0
- package/api/types/Issue.js +5 -0
- package/api/types/IssueCategory.d.ts +13 -0
- package/api/types/IssueCategory.js +15 -0
- package/api/types/QualityScore.d.ts +6 -0
- package/api/types/QualityScore.js +5 -0
- package/api/types/RewriteResponse.d.ts +15 -0
- package/api/types/RewriteResponse.js +5 -0
- package/api/types/ScoreOutput.d.ts +12 -0
- package/api/types/ScoreOutput.js +5 -0
- package/api/types/SentenceLengthCategory.d.ts +13 -0
- package/api/types/SentenceLengthCategory.js +15 -0
- package/api/types/SentenceStructureCategory.d.ts +14 -0
- package/api/types/SentenceStructureCategory.js +16 -0
- package/api/types/SimpleVocabCategory.d.ts +8 -0
- package/api/types/SimpleVocabCategory.js +10 -0
- package/api/types/StyleCheckResponse.d.ts +13 -0
- package/api/types/StyleCheckResponse.js +5 -0
- package/api/types/StyleGuide.d.ts +10 -0
- package/api/types/StyleGuide.js +5 -0
- package/api/types/StyleGuideCategory.d.ts +15 -0
- package/api/types/StyleGuideCategory.js +17 -0
- package/api/types/StyleGuideResponse.d.ts +19 -0
- package/api/types/StyleGuideResponse.js +5 -0
- package/api/types/StyleGuideScore.d.ts +7 -0
- package/api/types/StyleGuideScore.js +5 -0
- package/api/types/StyleGuideStatus.d.ts +10 -0
- package/api/types/StyleGuideStatus.js +12 -0
- package/api/types/StyleGuides.d.ts +11 -0
- package/api/types/StyleGuides.js +13 -0
- package/api/types/Subcategory.d.ts +8 -0
- package/api/types/Subcategory.js +5 -0
- package/api/types/Suggestion.d.ts +14 -0
- package/api/types/Suggestion.js +5 -0
- package/api/types/SuggestionResponse.d.ts +13 -0
- package/api/types/SuggestionResponse.js +5 -0
- package/api/types/TermReplaceCategory.d.ts +8 -0
- package/api/types/TermReplaceCategory.js +10 -0
- package/api/types/TerminologyScore.d.ts +7 -0
- package/api/types/TerminologyScore.js +5 -0
- package/api/types/ToneCategory.d.ts +12 -0
- package/api/types/ToneCategory.js +14 -0
- package/api/types/ToneScore.d.ts +12 -0
- package/api/types/ToneScore.js +5 -0
- package/api/types/Tones.d.ts +12 -0
- package/api/types/Tones.js +14 -0
- package/api/types/WebhookResponse.d.ts +7 -0
- package/api/types/WebhookResponse.js +5 -0
- package/api/types/WorkflowResponse.d.ts +8 -0
- package/api/types/WorkflowResponse.js +5 -0
- package/api/types/WorkflowStatus.d.ts +10 -0
- package/api/types/WorkflowStatus.js +12 -0
- package/api/types/index.d.ts +32 -0
- package/api/types/index.js +48 -0
- package/core/auth/BasicAuth.d.ts +8 -0
- package/core/auth/BasicAuth.js +26 -0
- package/core/auth/BearerToken.d.ts +5 -0
- package/core/auth/BearerToken.js +15 -0
- package/core/auth/index.d.ts +2 -0
- package/core/auth/index.js +7 -0
- package/core/fetcher/APIResponse.d.ts +20 -0
- package/core/fetcher/APIResponse.js +2 -0
- package/core/fetcher/Fetcher.d.ts +39 -0
- package/core/fetcher/Fetcher.js +107 -0
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/Supplier.d.ts +4 -0
- package/core/fetcher/Supplier.js +22 -0
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +12 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +68 -0
- package/core/fetcher/getHeader.d.ts +1 -0
- package/core/fetcher/getHeader.js +11 -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 +54 -0
- package/core/fetcher/index.d.ts +8 -0
- package/core/fetcher/index.js +15 -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 +40 -0
- package/core/fetcher/signals.d.ts +11 -0
- package/core/fetcher/signals.js +36 -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 +21 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -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 +59 -0
- package/core/form-data-utils/FormDataWrapper.d.ts +63 -0
- package/core/form-data-utils/FormDataWrapper.js +227 -0
- package/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/core/form-data-utils/index.d.ts +2 -0
- package/core/form-data-utils/index.js +20 -0
- package/core/index.d.ts +4 -0
- package/core/index.js +20 -0
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/runtime/index.d.ts +1 -0
- package/core/runtime/index.js +5 -0
- package/core/runtime/runtime.d.ts +9 -0
- package/core/runtime/runtime.js +103 -0
- package/dist/Client.d.ts +40 -0
- package/dist/Client.js +32 -0
- package/dist/api/errors/ContentTooLargeError.d.ts +8 -0
- package/dist/api/errors/ContentTooLargeError.js +52 -0
- package/dist/api/errors/ForbiddenError.d.ts +9 -0
- package/dist/api/errors/ForbiddenError.js +52 -0
- package/dist/api/errors/InternalServerError.d.ts +9 -0
- package/dist/api/errors/InternalServerError.js +52 -0
- package/dist/api/errors/NotFoundError.d.ts +9 -0
- package/dist/api/errors/NotFoundError.js +52 -0
- package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/dist/api/errors/UnprocessableEntityError.js +52 -0
- package/dist/api/errors/index.d.ts +5 -0
- package/dist/api/errors/index.js +21 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +19 -0
- package/dist/api/resources/index.d.ts +8 -0
- package/dist/api/resources/index.js +47 -0
- package/dist/api/resources/styleChecks/client/Client.d.ts +70 -0
- package/dist/api/resources/styleChecks/client/Client.js +215 -0
- package/dist/api/resources/styleChecks/client/index.d.ts +1 -0
- package/dist/api/resources/styleChecks/client/index.js +17 -0
- package/dist/api/resources/styleChecks/client/requests/StyleChecksCreateStyleCheckRequest.d.ts +22 -0
- package/dist/api/resources/styleChecks/client/requests/StyleChecksCreateStyleCheckRequest.js +5 -0
- package/dist/api/resources/styleChecks/client/requests/index.d.ts +1 -0
- package/dist/api/resources/styleChecks/client/requests/index.js +2 -0
- package/dist/api/resources/styleChecks/index.d.ts +1 -0
- package/dist/api/resources/styleChecks/index.js +17 -0
- package/dist/api/resources/styleGuides/client/Client.d.ts +109 -0
- package/dist/api/resources/styleGuides/client/Client.js +394 -0
- package/dist/api/resources/styleGuides/client/index.d.ts +1 -0
- package/dist/api/resources/styleGuides/client/index.js +17 -0
- package/dist/api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.d.ts +13 -0
- package/dist/api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.js +5 -0
- package/dist/api/resources/styleGuides/client/requests/StyleGuideRequestBody.d.ts +11 -0
- package/dist/api/resources/styleGuides/client/requests/StyleGuideRequestBody.js +5 -0
- package/dist/api/resources/styleGuides/client/requests/index.d.ts +2 -0
- package/dist/api/resources/styleGuides/client/requests/index.js +2 -0
- package/dist/api/resources/styleGuides/index.d.ts +1 -0
- package/dist/api/resources/styleGuides/index.js +17 -0
- package/dist/api/resources/styleRewrites/client/Client.d.ts +70 -0
- package/dist/api/resources/styleRewrites/client/Client.js +215 -0
- package/dist/api/resources/styleRewrites/client/index.d.ts +1 -0
- package/dist/api/resources/styleRewrites/client/index.js +17 -0
- package/dist/api/resources/styleRewrites/client/requests/StyleRewritesCreateStyleRewriteRequest.d.ts +22 -0
- package/dist/api/resources/styleRewrites/client/requests/StyleRewritesCreateStyleRewriteRequest.js +5 -0
- package/dist/api/resources/styleRewrites/client/requests/index.d.ts +1 -0
- package/dist/api/resources/styleRewrites/client/requests/index.js +2 -0
- package/dist/api/resources/styleRewrites/index.d.ts +1 -0
- package/dist/api/resources/styleRewrites/index.js +17 -0
- package/dist/api/resources/styleSuggestions/client/Client.d.ts +70 -0
- package/dist/api/resources/styleSuggestions/client/Client.js +215 -0
- package/dist/api/resources/styleSuggestions/client/index.d.ts +1 -0
- package/dist/api/resources/styleSuggestions/client/index.js +17 -0
- package/dist/api/resources/styleSuggestions/client/requests/StyleSuggestionsCreateStyleSuggestionRequest.d.ts +22 -0
- package/dist/api/resources/styleSuggestions/client/requests/StyleSuggestionsCreateStyleSuggestionRequest.js +5 -0
- package/dist/api/resources/styleSuggestions/client/requests/index.d.ts +1 -0
- package/dist/api/resources/styleSuggestions/client/requests/index.js +2 -0
- package/dist/api/resources/styleSuggestions/index.d.ts +1 -0
- package/dist/api/resources/styleSuggestions/index.js +17 -0
- package/dist/api/types/CheckOptions.d.ts +9 -0
- package/dist/api/types/CheckOptions.js +5 -0
- package/dist/api/types/ClarityScore.d.ts +14 -0
- package/dist/api/types/ClarityScore.js +5 -0
- package/dist/api/types/Dialects.d.ts +9 -0
- package/dist/api/types/Dialects.js +11 -0
- package/dist/api/types/ErrorResponse.d.ts +11 -0
- package/dist/api/types/ErrorResponse.js +5 -0
- package/dist/api/types/GrammarCategory.d.ts +13 -0
- package/dist/api/types/GrammarCategory.js +15 -0
- package/dist/api/types/GrammarScore.d.ts +7 -0
- package/dist/api/types/GrammarScore.js +5 -0
- package/dist/api/types/Issue.d.ts +13 -0
- package/dist/api/types/Issue.js +5 -0
- package/dist/api/types/IssueCategory.d.ts +13 -0
- package/dist/api/types/IssueCategory.js +15 -0
- package/dist/api/types/QualityScore.d.ts +6 -0
- package/dist/api/types/QualityScore.js +5 -0
- package/dist/api/types/RewriteResponse.d.ts +15 -0
- package/dist/api/types/RewriteResponse.js +5 -0
- package/dist/api/types/ScoreOutput.d.ts +12 -0
- package/dist/api/types/ScoreOutput.js +5 -0
- package/dist/api/types/SentenceLengthCategory.d.ts +13 -0
- package/dist/api/types/SentenceLengthCategory.js +15 -0
- package/dist/api/types/SentenceStructureCategory.d.ts +14 -0
- package/dist/api/types/SentenceStructureCategory.js +16 -0
- package/dist/api/types/SimpleVocabCategory.d.ts +8 -0
- package/dist/api/types/SimpleVocabCategory.js +10 -0
- package/dist/api/types/StyleCheckResponse.d.ts +13 -0
- package/dist/api/types/StyleCheckResponse.js +5 -0
- package/dist/api/types/StyleGuide.d.ts +10 -0
- package/dist/api/types/StyleGuide.js +5 -0
- package/dist/api/types/StyleGuideCategory.d.ts +15 -0
- package/dist/api/types/StyleGuideCategory.js +17 -0
- package/dist/api/types/StyleGuideResponse.d.ts +19 -0
- package/dist/api/types/StyleGuideResponse.js +5 -0
- package/dist/api/types/StyleGuideScore.d.ts +7 -0
- package/dist/api/types/StyleGuideScore.js +5 -0
- package/dist/api/types/StyleGuideStatus.d.ts +10 -0
- package/dist/api/types/StyleGuideStatus.js +12 -0
- package/dist/api/types/StyleGuides.d.ts +11 -0
- package/dist/api/types/StyleGuides.js +13 -0
- package/dist/api/types/Subcategory.d.ts +8 -0
- package/dist/api/types/Subcategory.js +5 -0
- package/dist/api/types/Suggestion.d.ts +14 -0
- package/dist/api/types/Suggestion.js +5 -0
- package/dist/api/types/SuggestionResponse.d.ts +13 -0
- package/dist/api/types/SuggestionResponse.js +5 -0
- package/dist/api/types/TermReplaceCategory.d.ts +8 -0
- package/dist/api/types/TermReplaceCategory.js +10 -0
- package/dist/api/types/TerminologyScore.d.ts +7 -0
- package/dist/api/types/TerminologyScore.js +5 -0
- package/dist/api/types/ToneCategory.d.ts +12 -0
- package/dist/api/types/ToneCategory.js +14 -0
- package/dist/api/types/ToneScore.d.ts +12 -0
- package/dist/api/types/ToneScore.js +5 -0
- package/dist/api/types/Tones.d.ts +12 -0
- package/dist/api/types/Tones.js +14 -0
- package/dist/api/types/WebhookResponse.d.ts +7 -0
- package/dist/api/types/WebhookResponse.js +5 -0
- package/dist/api/types/WorkflowResponse.d.ts +8 -0
- package/dist/api/types/WorkflowResponse.js +5 -0
- package/dist/api/types/WorkflowStatus.d.ts +10 -0
- package/dist/api/types/WorkflowStatus.js +12 -0
- package/dist/api/types/index.d.ts +32 -0
- package/dist/api/types/index.js +48 -0
- package/dist/core/auth/BasicAuth.d.ts +8 -0
- package/dist/core/auth/BasicAuth.js +26 -0
- package/dist/core/auth/BearerToken.d.ts +5 -0
- package/dist/core/auth/BearerToken.js +15 -0
- package/dist/core/auth/index.d.ts +2 -0
- package/dist/core/auth/index.js +7 -0
- package/dist/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/Fetcher.d.ts +39 -0
- package/dist/core/fetcher/Fetcher.js +107 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +22 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +12 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +68 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +11 -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 +54 -0
- package/dist/core/fetcher/index.d.ts +8 -0
- package/dist/core/fetcher/index.js +15 -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 +40 -0
- package/dist/core/fetcher/signals.d.ts +11 -0
- package/dist/core/fetcher/signals.js +36 -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 +21 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -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 +59 -0
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +63 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +227 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/dist/core/form-data-utils/index.d.ts +2 -0
- package/dist/core/form-data-utils/index.js +20 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +20 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +9 -0
- package/dist/core/runtime/runtime.js +103 -0
- package/dist/environments.d.ts +7 -0
- package/dist/environments.js +9 -0
- package/dist/errors/MarkupAIError.d.ts +15 -0
- package/dist/errors/MarkupAIError.js +30 -0
- package/dist/errors/MarkupAITimeoutError.d.ts +6 -0
- package/dist/errors/MarkupAITimeoutError.js +13 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +44 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/environments.d.ts +7 -0
- package/environments.js +9 -0
- package/errors/MarkupAIError.d.ts +15 -0
- package/errors/MarkupAIError.js +30 -0
- package/errors/MarkupAITimeoutError.d.ts +6 -0
- package/errors/MarkupAITimeoutError.js +13 -0
- package/errors/index.d.ts +2 -0
- package/errors/index.js +7 -0
- package/index.d.ts +4 -0
- package/index.js +44 -0
- package/jest.config.mjs +8 -0
- package/package.json +46 -0
- package/reference.md +748 -0
- package/scripts/rename-to-esm-files.js +115 -0
- package/version.d.ts +1 -0
- package/version.js +4 -0
|
@@ -0,0 +1,59 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.chooseStreamWrapper = chooseStreamWrapper;
|
|
46
|
+
const runtime_1 = require("../../runtime");
|
|
47
|
+
function chooseStreamWrapper(responseBody) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
if (runtime_1.RUNTIME.type === "node" && runtime_1.RUNTIME.parsedVersion != null && runtime_1.RUNTIME.parsedVersion >= 18) {
|
|
50
|
+
return new (yield Promise.resolve().then(() => __importStar(require("./Node18UniversalStreamWrapper")))).Node18UniversalStreamWrapper(responseBody);
|
|
51
|
+
}
|
|
52
|
+
else if (runtime_1.RUNTIME.type !== "node" && typeof fetch === "function") {
|
|
53
|
+
return new (yield Promise.resolve().then(() => __importStar(require("./UndiciStreamWrapper")))).UndiciStreamWrapper(responseBody);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return new (yield Promise.resolve().then(() => __importStar(require("./NodePre18StreamWrapper")))).NodePre18StreamWrapper(responseBody);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type MaybePromise<T> = Promise<T> | T;
|
|
2
|
+
interface FormDataRequest<Body> {
|
|
3
|
+
body: Body;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
duplex?: "half";
|
|
6
|
+
}
|
|
7
|
+
export interface CrossPlatformFormData {
|
|
8
|
+
setup(): Promise<void>;
|
|
9
|
+
append(key: string, value: unknown): void;
|
|
10
|
+
appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
|
|
11
|
+
getRequest(): MaybePromise<FormDataRequest<unknown>>;
|
|
12
|
+
}
|
|
13
|
+
export declare function newFormData(): Promise<CrossPlatformFormData>;
|
|
14
|
+
export type Node18FormDataFd = {
|
|
15
|
+
append(name: string, value: unknown, fileName?: string): void;
|
|
16
|
+
} | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Form Data Implementation for Node.js 18+
|
|
19
|
+
*/
|
|
20
|
+
export declare class Node18FormData implements CrossPlatformFormData {
|
|
21
|
+
private fd;
|
|
22
|
+
setup(): Promise<void>;
|
|
23
|
+
append(key: string, value: any): void;
|
|
24
|
+
private getFileName;
|
|
25
|
+
appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
|
|
26
|
+
getRequest(): Promise<FormDataRequest<unknown>>;
|
|
27
|
+
}
|
|
28
|
+
export type Node16FormDataFd = {
|
|
29
|
+
append(name: string, value: unknown, options?: string | {
|
|
30
|
+
header?: string | Headers;
|
|
31
|
+
knownLength?: number;
|
|
32
|
+
filename?: string;
|
|
33
|
+
filepath?: string;
|
|
34
|
+
contentType?: string;
|
|
35
|
+
}): void;
|
|
36
|
+
getHeaders(): Record<string, string>;
|
|
37
|
+
} | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Form Data Implementation for Node.js 16-18
|
|
40
|
+
*/
|
|
41
|
+
export declare class Node16FormData implements CrossPlatformFormData {
|
|
42
|
+
private fd;
|
|
43
|
+
setup(): Promise<void>;
|
|
44
|
+
append(key: string, value: any): void;
|
|
45
|
+
private getFileName;
|
|
46
|
+
appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
|
|
47
|
+
getRequest(): FormDataRequest<Node16FormDataFd>;
|
|
48
|
+
}
|
|
49
|
+
export type WebFormDataFd = {
|
|
50
|
+
append(name: string, value: string | Blob, fileName?: string): void;
|
|
51
|
+
} | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Form Data Implementation for Web
|
|
54
|
+
*/
|
|
55
|
+
export declare class WebFormData implements CrossPlatformFormData {
|
|
56
|
+
protected fd: WebFormDataFd;
|
|
57
|
+
setup(): Promise<void>;
|
|
58
|
+
append(key: string, value: any): void;
|
|
59
|
+
private getFileName;
|
|
60
|
+
appendFile(key: string, value: any, fileName?: string): Promise<void>;
|
|
61
|
+
getRequest(): FormDataRequest<WebFormDataFd>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,227 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.WebFormData = exports.Node16FormData = exports.Node18FormData = void 0;
|
|
46
|
+
exports.newFormData = newFormData;
|
|
47
|
+
const runtime_1 = require("../runtime");
|
|
48
|
+
function isNamedValue(value) {
|
|
49
|
+
return typeof value === "object" && value != null && "name" in value;
|
|
50
|
+
}
|
|
51
|
+
function isPathedValue(value) {
|
|
52
|
+
return typeof value === "object" && value != null && "path" in value;
|
|
53
|
+
}
|
|
54
|
+
function getLastPathSegment(pathStr) {
|
|
55
|
+
const lastForwardSlash = pathStr.lastIndexOf("/");
|
|
56
|
+
const lastBackSlash = pathStr.lastIndexOf("\\");
|
|
57
|
+
const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
|
|
58
|
+
return lastSlashIndex >= 0 ? pathStr.substring(lastSlashIndex + 1) : pathStr;
|
|
59
|
+
}
|
|
60
|
+
function newFormData() {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
let formdata;
|
|
63
|
+
if (runtime_1.RUNTIME.type === "node" && runtime_1.RUNTIME.parsedVersion != null && runtime_1.RUNTIME.parsedVersion >= 18) {
|
|
64
|
+
formdata = new Node18FormData();
|
|
65
|
+
}
|
|
66
|
+
else if (runtime_1.RUNTIME.type === "node") {
|
|
67
|
+
formdata = new Node16FormData();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
formdata = new WebFormData();
|
|
71
|
+
}
|
|
72
|
+
yield formdata.setup();
|
|
73
|
+
return formdata;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Form Data Implementation for Node.js 18+
|
|
78
|
+
*/
|
|
79
|
+
class Node18FormData {
|
|
80
|
+
setup() {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
this.fd = new (yield Promise.resolve().then(() => __importStar(require("formdata-node")))).FormData();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
append(key, value) {
|
|
86
|
+
var _a;
|
|
87
|
+
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
88
|
+
}
|
|
89
|
+
getFileName(value, filename) {
|
|
90
|
+
if (filename != null) {
|
|
91
|
+
return filename;
|
|
92
|
+
}
|
|
93
|
+
if (isNamedValue(value)) {
|
|
94
|
+
return value.name;
|
|
95
|
+
}
|
|
96
|
+
if (isPathedValue(value) && value.path) {
|
|
97
|
+
return getLastPathSegment(value.path.toString());
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
appendFile(key, value, fileName) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
fileName = this.getFileName(value, fileName);
|
|
105
|
+
if (value instanceof Blob) {
|
|
106
|
+
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value, fileName);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
(_b = this.fd) === null || _b === void 0 ? void 0 : _b.append(key, {
|
|
110
|
+
type: undefined,
|
|
111
|
+
name: fileName,
|
|
112
|
+
[Symbol.toStringTag]: "File",
|
|
113
|
+
stream() {
|
|
114
|
+
return value;
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
getRequest() {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const encoder = new (yield Promise.resolve().then(() => __importStar(require("form-data-encoder")))).FormDataEncoder(this.fd);
|
|
123
|
+
return {
|
|
124
|
+
body: (yield Promise.resolve().then(() => __importStar(require("readable-stream")))).Readable.from(encoder),
|
|
125
|
+
headers: encoder.headers,
|
|
126
|
+
duplex: "half",
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.Node18FormData = Node18FormData;
|
|
132
|
+
/**
|
|
133
|
+
* Form Data Implementation for Node.js 16-18
|
|
134
|
+
*/
|
|
135
|
+
class Node16FormData {
|
|
136
|
+
setup() {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
this.fd = new (yield Promise.resolve().then(() => __importStar(require("form-data")))).default();
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
append(key, value) {
|
|
142
|
+
var _a;
|
|
143
|
+
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
144
|
+
}
|
|
145
|
+
getFileName(value, filename) {
|
|
146
|
+
if (filename != null) {
|
|
147
|
+
return filename;
|
|
148
|
+
}
|
|
149
|
+
if (isNamedValue(value)) {
|
|
150
|
+
return value.name;
|
|
151
|
+
}
|
|
152
|
+
if (isPathedValue(value) && value.path) {
|
|
153
|
+
return getLastPathSegment(value.path.toString());
|
|
154
|
+
}
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
appendFile(key, value, fileName) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
var _a, _b;
|
|
160
|
+
fileName = this.getFileName(value, fileName);
|
|
161
|
+
let bufferedValue;
|
|
162
|
+
if (value instanceof Blob) {
|
|
163
|
+
bufferedValue = Buffer.from(yield value.arrayBuffer());
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
bufferedValue = value;
|
|
167
|
+
}
|
|
168
|
+
if (fileName == null) {
|
|
169
|
+
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, bufferedValue);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
(_b = this.fd) === null || _b === void 0 ? void 0 : _b.append(key, bufferedValue, { filename: fileName });
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
getRequest() {
|
|
177
|
+
return {
|
|
178
|
+
body: this.fd,
|
|
179
|
+
headers: this.fd ? this.fd.getHeaders() : {},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.Node16FormData = Node16FormData;
|
|
184
|
+
/**
|
|
185
|
+
* Form Data Implementation for Web
|
|
186
|
+
*/
|
|
187
|
+
class WebFormData {
|
|
188
|
+
setup() {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
this.fd = new FormData();
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
append(key, value) {
|
|
194
|
+
var _a;
|
|
195
|
+
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
196
|
+
}
|
|
197
|
+
getFileName(value, filename) {
|
|
198
|
+
if (filename != null) {
|
|
199
|
+
return filename;
|
|
200
|
+
}
|
|
201
|
+
if (isNamedValue(value)) {
|
|
202
|
+
return value.name;
|
|
203
|
+
}
|
|
204
|
+
if (isPathedValue(value) && value.path) {
|
|
205
|
+
return getLastPathSegment(value.path.toString());
|
|
206
|
+
}
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
appendFile(key, value, fileName) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
var _a, _b;
|
|
212
|
+
fileName = this.getFileName(value, fileName);
|
|
213
|
+
if (value instanceof Blob) {
|
|
214
|
+
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value, fileName);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
(_b = this.fd) === null || _b === void 0 ? void 0 : _b.append(key, new Blob([value]), fileName);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
getRequest() {
|
|
221
|
+
return {
|
|
222
|
+
body: this.fd,
|
|
223
|
+
headers: {},
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.WebFormData = WebFormData;
|
|
@@ -0,0 +1,18 @@
|
|
|
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.encodeAsFormParameter = encodeAsFormParameter;
|
|
7
|
+
const qs_1 = __importDefault(require("qs"));
|
|
8
|
+
/**
|
|
9
|
+
* Takes an unknown value, stringifies it using qs, and parses it into a key-value record
|
|
10
|
+
*/
|
|
11
|
+
function encodeAsFormParameter(value) {
|
|
12
|
+
const stringified = qs_1.default.stringify(value, { encode: false });
|
|
13
|
+
const keyValuePairs = stringified.split("&").map((pair) => {
|
|
14
|
+
const [key, value] = pair.split("=");
|
|
15
|
+
return [key, value];
|
|
16
|
+
});
|
|
17
|
+
return Object.fromEntries(keyValuePairs);
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.encodeAsFormParameter = void 0;
|
|
18
|
+
var encodeAsFormParameter_1 = require("./encodeAsFormParameter");
|
|
19
|
+
Object.defineProperty(exports, "encodeAsFormParameter", { enumerable: true, get: function () { return encodeAsFormParameter_1.encodeAsFormParameter; } });
|
|
20
|
+
__exportStar(require("./FormDataWrapper"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./fetcher"), exports);
|
|
18
|
+
__exportStar(require("./runtime"), exports);
|
|
19
|
+
__exportStar(require("./auth"), exports);
|
|
20
|
+
__exportStar(require("./form-data-utils"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a value to JSON
|
|
3
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
4
|
+
* @param replacer A function that transforms the results.
|
|
5
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
6
|
+
* @returns JSON string
|
|
7
|
+
*/
|
|
8
|
+
export declare const toJson: (value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Parse JSON string to object, array, or other type
|
|
11
|
+
* @param text A valid JSON string.
|
|
12
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
13
|
+
* @returns Parsed object, array, or other type
|
|
14
|
+
*/
|
|
15
|
+
export declare function fromJson<T = unknown>(text: string, reviver?: (this: unknown, key: string, value: unknown) => unknown): T;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toJson = void 0;
|
|
4
|
+
exports.fromJson = fromJson;
|
|
5
|
+
/**
|
|
6
|
+
* Serialize a value to JSON
|
|
7
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
8
|
+
* @param replacer A function that transforms the results.
|
|
9
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
10
|
+
* @returns JSON string
|
|
11
|
+
*/
|
|
12
|
+
const toJson = (value, replacer, space) => {
|
|
13
|
+
return JSON.stringify(value, replacer, space);
|
|
14
|
+
};
|
|
15
|
+
exports.toJson = toJson;
|
|
16
|
+
/**
|
|
17
|
+
* Parse JSON string to object, array, or other type
|
|
18
|
+
* @param text A valid JSON string.
|
|
19
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
20
|
+
* @returns Parsed object, array, or other type
|
|
21
|
+
*/
|
|
22
|
+
function fromJson(text, reviver) {
|
|
23
|
+
return JSON.parse(text, reviver);
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RUNTIME } from "./runtime";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
3
|
+
*/
|
|
4
|
+
export declare const RUNTIME: Runtime;
|
|
5
|
+
export interface Runtime {
|
|
6
|
+
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
|
|
7
|
+
version?: string;
|
|
8
|
+
parsedVersion?: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RUNTIME = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
6
|
+
*/
|
|
7
|
+
exports.RUNTIME = evaluateRuntime();
|
|
8
|
+
function evaluateRuntime() {
|
|
9
|
+
var _a, _b, _c, _d, _e;
|
|
10
|
+
/**
|
|
11
|
+
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
12
|
+
*/
|
|
13
|
+
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
14
|
+
if (isBrowser) {
|
|
15
|
+
return {
|
|
16
|
+
type: "browser",
|
|
17
|
+
version: window.navigator.userAgent,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A constant that indicates whether the environment the code is running is Cloudflare.
|
|
22
|
+
* https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent
|
|
23
|
+
*/
|
|
24
|
+
const isCloudflare = typeof globalThis !== "undefined" && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === "Cloudflare-Workers";
|
|
25
|
+
if (isCloudflare) {
|
|
26
|
+
return {
|
|
27
|
+
type: "workerd",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A constant that indicates whether the environment the code is running is Edge Runtime.
|
|
32
|
+
* https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime
|
|
33
|
+
*/
|
|
34
|
+
const isEdgeRuntime = typeof EdgeRuntime === "string";
|
|
35
|
+
if (isEdgeRuntime) {
|
|
36
|
+
return {
|
|
37
|
+
type: "edge-runtime",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
42
|
+
*/
|
|
43
|
+
const isWebWorker = typeof self === "object" &&
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
|
|
46
|
+
(((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "DedicatedWorkerGlobalScope" ||
|
|
47
|
+
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "ServiceWorkerGlobalScope" ||
|
|
48
|
+
((_d = self.constructor) === null || _d === void 0 ? void 0 : _d.name) === "SharedWorkerGlobalScope");
|
|
49
|
+
if (isWebWorker) {
|
|
50
|
+
return {
|
|
51
|
+
type: "web-worker",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A constant that indicates whether the environment the code is running is Deno.
|
|
56
|
+
* FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions
|
|
57
|
+
*/
|
|
58
|
+
const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
|
|
59
|
+
if (isDeno) {
|
|
60
|
+
return {
|
|
61
|
+
type: "deno",
|
|
62
|
+
version: Deno.version.deno,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A constant that indicates whether the environment the code is running is Bun.sh.
|
|
67
|
+
*/
|
|
68
|
+
const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
|
|
69
|
+
if (isBun) {
|
|
70
|
+
return {
|
|
71
|
+
type: "bun",
|
|
72
|
+
version: Bun.version,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
77
|
+
*/
|
|
78
|
+
const isNode = typeof process !== "undefined" &&
|
|
79
|
+
"version" in process &&
|
|
80
|
+
!!process.version &&
|
|
81
|
+
"versions" in process &&
|
|
82
|
+
!!((_e = process.versions) === null || _e === void 0 ? void 0 : _e.node);
|
|
83
|
+
if (isNode) {
|
|
84
|
+
return {
|
|
85
|
+
type: "node",
|
|
86
|
+
version: process.versions.node,
|
|
87
|
+
parsedVersion: Number(process.versions.node.split(".")[0]),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A constant that indicates whether the environment the code is running is in React-Native.
|
|
92
|
+
* https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
|
|
93
|
+
*/
|
|
94
|
+
const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
|
|
95
|
+
if (isReactNative) {
|
|
96
|
+
return {
|
|
97
|
+
type: "react-native",
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
type: "unknown",
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MarkupAIEnvironment = void 0;
|
|
7
|
+
exports.MarkupAIEnvironment = {
|
|
8
|
+
Production: "https://app.acrolinx.cloud",
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as core from "../core";
|
|
5
|
+
export declare class MarkupAIError extends Error {
|
|
6
|
+
readonly statusCode?: number;
|
|
7
|
+
readonly body?: unknown;
|
|
8
|
+
readonly rawResponse?: core.RawResponse;
|
|
9
|
+
constructor({ message, statusCode, body, rawResponse, }: {
|
|
10
|
+
message?: string;
|
|
11
|
+
statusCode?: number;
|
|
12
|
+
body?: unknown;
|
|
13
|
+
rawResponse?: core.RawResponse;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MarkupAIError = void 0;
|
|
7
|
+
const json_1 = require("../core/json");
|
|
8
|
+
class MarkupAIError extends Error {
|
|
9
|
+
constructor({ message, statusCode, body, rawResponse, }) {
|
|
10
|
+
super(buildMessage({ message, statusCode, body }));
|
|
11
|
+
Object.setPrototypeOf(this, MarkupAIError.prototype);
|
|
12
|
+
this.statusCode = statusCode;
|
|
13
|
+
this.body = body;
|
|
14
|
+
this.rawResponse = rawResponse;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.MarkupAIError = MarkupAIError;
|
|
18
|
+
function buildMessage({ message, statusCode, body, }) {
|
|
19
|
+
let lines = [];
|
|
20
|
+
if (message != null) {
|
|
21
|
+
lines.push(message);
|
|
22
|
+
}
|
|
23
|
+
if (statusCode != null) {
|
|
24
|
+
lines.push(`Status code: ${statusCode.toString()}`);
|
|
25
|
+
}
|
|
26
|
+
if (body != null) {
|
|
27
|
+
lines.push(`Body: ${(0, json_1.toJson)(body, undefined, 2)}`);
|
|
28
|
+
}
|
|
29
|
+
return lines.join("\n");
|
|
30
|
+
}
|