@djust-b2b/djust-front-sdk 3.0.0-beta.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -30
- package/dist/.tsbuildinfo +1 -1
- package/dist/.tsbuildinfo-esm +1 -1
- package/dist/client/create-client.d.ts +18 -0
- package/dist/client/create-client.d.ts.map +1 -1
- package/dist/client/transport.d.ts +5 -0
- package/dist/client/transport.d.ts.map +1 -1
- package/dist/errors/classes/not-found.error.d.ts +1 -1
- package/dist/errors/classes/not-found.error.d.ts.map +1 -1
- package/dist/errors/factory.d.ts.map +1 -1
- package/dist/errors/helpers/djust-api-error.d.ts +29 -0
- package/dist/errors/helpers/djust-api-error.d.ts.map +1 -0
- package/dist/errors/types.d.ts +4 -0
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/index.d.ts +43 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +274 -64
- package/dist/interfaces/index.d.ts +15 -3
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/services/base.service.d.ts +2 -0
- package/dist/services/base.service.d.ts.map +1 -1
- package/dist/services/commercial-order/commercial-order.service.d.ts +8 -5
- package/dist/services/commercial-order/commercial-order.service.d.ts.map +1 -1
- package/dist/services/commercial-order/definitions.d.ts +13 -0
- package/dist/services/commercial-order/definitions.d.ts.map +1 -1
- package/dist/services/commercial-order/index.d.ts +30 -19
- package/dist/services/commercial-order/index.d.ts.map +1 -1
- package/dist/services/commercial-order/module.d.ts +1 -1
- package/dist/services/commercial-order/module.d.ts.map +1 -1
- package/dist/services/commercial-order/types.d.ts +1 -0
- package/dist/services/commercial-order/types.d.ts.map +1 -1
- package/dist/services/logistic-order/definitions.d.ts +23 -1
- package/dist/services/logistic-order/definitions.d.ts.map +1 -1
- package/dist/services/logistic-order/endpoints.d.ts +1 -0
- package/dist/services/logistic-order/endpoints.d.ts.map +1 -1
- package/dist/services/logistic-order/index.d.ts +77 -1
- package/dist/services/logistic-order/index.d.ts.map +1 -1
- package/dist/services/logistic-order/logistic-order.service.d.ts +6 -1
- package/dist/services/logistic-order/logistic-order.service.d.ts.map +1 -1
- package/dist/services/logistic-order/module.d.ts +1 -1
- package/dist/services/logistic-order/module.d.ts.map +1 -1
- package/dist/services/logistic-order/types.d.ts +9 -0
- package/dist/services/logistic-order/types.d.ts.map +1 -1
- package/dist/services/operation/definitions.d.ts +1 -18
- package/dist/services/operation/definitions.d.ts.map +1 -1
- package/dist/services/payment/definitions.d.ts +0 -10
- package/dist/services/payment/definitions.d.ts.map +1 -1
- package/dist/services/product/definitions.d.ts +1 -0
- package/dist/services/product/definitions.d.ts.map +1 -1
- package/dist/services/product/index.d.ts +6 -5
- package/dist/services/product/index.d.ts.map +1 -1
- package/dist/services/product-variant/definitions.d.ts +3 -142
- package/dist/services/product-variant/definitions.d.ts.map +1 -1
- package/dist/services/quote/definitions.d.ts +3 -1
- package/dist/services/quote/definitions.d.ts.map +1 -1
- package/dist/services/quote/index.d.ts +2 -1
- package/dist/services/quote/index.d.ts.map +1 -1
- package/dist/services/quote/quote.service.d.ts +1 -0
- package/dist/services/quote/quote.service.d.ts.map +1 -1
- package/dist/services/quote/types.d.ts +2 -0
- package/dist/services/quote/types.d.ts.map +1 -1
- package/dist/settings/fetch-instance.d.ts.map +1 -1
- package/dist/settings/sdk-version.d.ts +3 -0
- package/dist/settings/sdk-version.d.ts.map +1 -0
- package/lib/.tsbuildinfo +1 -0
- package/lib/client/create-client.d.ts +251 -0
- package/lib/client/create-client.d.ts.map +1 -0
- package/lib/client/create-client.js +233 -0
- package/lib/client/create-client.js.map +1 -0
- package/lib/client/index.d.ts +14 -0
- package/lib/client/index.d.ts.map +1 -0
- package/lib/client/index.js +91 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client/performance.d.ts +203 -0
- package/lib/client/performance.d.ts.map +1 -0
- package/lib/client/performance.js +409 -0
- package/lib/client/performance.js.map +1 -0
- package/lib/client/transport.d.ts +372 -0
- package/lib/client/transport.d.ts.map +1 -0
- package/lib/client/transport.js +735 -0
- package/lib/client/transport.js.map +1 -0
- package/lib/errors/base.d.ts +101 -0
- package/lib/errors/base.d.ts.map +1 -0
- package/lib/errors/base.js +145 -0
- package/lib/errors/base.js.map +1 -0
- package/lib/errors/classes/auth.error.d.ts +64 -0
- package/lib/errors/classes/auth.error.d.ts.map +1 -0
- package/lib/errors/classes/auth.error.js +116 -0
- package/lib/errors/classes/auth.error.js.map +1 -0
- package/lib/errors/classes/forbidden.error.d.ts +52 -0
- package/lib/errors/classes/forbidden.error.d.ts.map +1 -0
- package/lib/errors/classes/forbidden.error.js +90 -0
- package/lib/errors/classes/forbidden.error.js.map +1 -0
- package/lib/errors/classes/index.d.ts +17 -0
- package/lib/errors/classes/index.d.ts.map +1 -0
- package/lib/errors/classes/index.js +29 -0
- package/lib/errors/classes/index.js.map +1 -0
- package/lib/errors/classes/network.error.d.ts +63 -0
- package/lib/errors/classes/network.error.d.ts.map +1 -0
- package/lib/errors/classes/network.error.js +122 -0
- package/lib/errors/classes/network.error.js.map +1 -0
- package/lib/errors/classes/not-found.error.d.ts +58 -0
- package/lib/errors/classes/not-found.error.d.ts.map +1 -0
- package/lib/errors/classes/not-found.error.js +120 -0
- package/lib/errors/classes/not-found.error.js.map +1 -0
- package/lib/errors/classes/rate-limit.error.d.ts +49 -0
- package/lib/errors/classes/rate-limit.error.d.ts.map +1 -0
- package/lib/errors/classes/rate-limit.error.js +107 -0
- package/lib/errors/classes/rate-limit.error.js.map +1 -0
- package/lib/errors/classes/server.error.d.ts +63 -0
- package/lib/errors/classes/server.error.d.ts.map +1 -0
- package/lib/errors/classes/server.error.js +156 -0
- package/lib/errors/classes/server.error.js.map +1 -0
- package/lib/errors/classes/timeout.error.d.ts +64 -0
- package/lib/errors/classes/timeout.error.d.ts.map +1 -0
- package/lib/errors/classes/timeout.error.js +90 -0
- package/lib/errors/classes/timeout.error.js.map +1 -0
- package/lib/errors/classes/unexpected.error.d.ts +70 -0
- package/lib/errors/classes/unexpected.error.d.ts.map +1 -0
- package/lib/errors/classes/unexpected.error.js +105 -0
- package/lib/errors/classes/unexpected.error.js.map +1 -0
- package/lib/errors/classes/validation.error.d.ts +68 -0
- package/lib/errors/classes/validation.error.d.ts.map +1 -0
- package/lib/errors/classes/validation.error.js +103 -0
- package/lib/errors/classes/validation.error.js.map +1 -0
- package/lib/errors/codes.d.ts +111 -0
- package/lib/errors/codes.d.ts.map +1 -0
- package/lib/errors/codes.js +143 -0
- package/lib/errors/codes.js.map +1 -0
- package/lib/errors/compat.d.ts +99 -0
- package/lib/errors/compat.d.ts.map +1 -0
- package/lib/errors/compat.js +280 -0
- package/lib/errors/compat.js.map +1 -0
- package/lib/errors/factory.d.ts +33 -0
- package/lib/errors/factory.d.ts.map +1 -0
- package/lib/errors/factory.js +298 -0
- package/lib/errors/factory.js.map +1 -0
- package/lib/errors/guards.d.ts +142 -0
- package/lib/errors/guards.d.ts.map +1 -0
- package/lib/errors/guards.js +281 -0
- package/lib/errors/guards.js.map +1 -0
- package/lib/errors/helpers/djust-api-error.d.ts +29 -0
- package/lib/errors/helpers/djust-api-error.d.ts.map +1 -0
- package/lib/errors/helpers/djust-api-error.js +49 -0
- package/lib/errors/helpers/djust-api-error.js.map +1 -0
- package/lib/errors/index.d.ts +25 -0
- package/lib/errors/index.d.ts.map +1 -0
- package/lib/errors/index.js +89 -0
- package/lib/errors/index.js.map +1 -0
- package/lib/errors/types.d.ts +104 -0
- package/lib/errors/types.d.ts.map +1 -0
- package/lib/errors/types.js +10 -0
- package/lib/errors/types.js.map +1 -0
- package/lib/helpers/index.d.ts +42 -0
- package/lib/helpers/index.d.ts.map +1 -0
- package/lib/helpers/index.js +102 -0
- package/lib/helpers/index.js.map +1 -0
- package/lib/helpers/parameters-validation.d.ts +3 -0
- package/lib/helpers/parameters-validation.d.ts.map +1 -0
- package/lib/helpers/parameters-validation.js +22 -0
- package/lib/helpers/parameters-validation.js.map +1 -0
- package/lib/helpers/utils.d.ts +5 -0
- package/lib/helpers/utils.d.ts.map +1 -0
- package/lib/helpers/utils.js +30 -0
- package/lib/helpers/utils.js.map +1 -0
- package/lib/index.d.ts +267 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +182 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/index.d.ts +43 -0
- package/lib/interfaces/index.d.ts.map +1 -0
- package/lib/interfaces/index.js +36 -0
- package/lib/interfaces/index.js.map +1 -0
- package/lib/interfaces/models/address.d.ts +61 -0
- package/lib/interfaces/models/address.d.ts.map +1 -0
- package/lib/interfaces/models/address.js +3 -0
- package/lib/interfaces/models/address.js.map +1 -0
- package/lib/interfaces/models/attribute.d.ts +31 -0
- package/lib/interfaces/models/attribute.d.ts.map +1 -0
- package/lib/interfaces/models/attribute.js +3 -0
- package/lib/interfaces/models/attribute.js.map +1 -0
- package/lib/interfaces/models/auth.d.ts +37 -0
- package/lib/interfaces/models/auth.d.ts.map +1 -0
- package/lib/interfaces/models/auth.js +3 -0
- package/lib/interfaces/models/auth.js.map +1 -0
- package/lib/interfaces/models/cart.d.ts +64 -0
- package/lib/interfaces/models/cart.d.ts.map +1 -0
- package/lib/interfaces/models/cart.js +3 -0
- package/lib/interfaces/models/cart.js.map +1 -0
- package/lib/interfaces/models/common.d.ts +68 -0
- package/lib/interfaces/models/common.d.ts.map +1 -0
- package/lib/interfaces/models/common.js +3 -0
- package/lib/interfaces/models/common.js.map +1 -0
- package/lib/interfaces/models/custom-field.d.ts +57 -0
- package/lib/interfaces/models/custom-field.d.ts.map +1 -0
- package/lib/interfaces/models/custom-field.js +3 -0
- package/lib/interfaces/models/custom-field.js.map +1 -0
- package/lib/interfaces/models/customer-account.d.ts +52 -0
- package/lib/interfaces/models/customer-account.d.ts.map +1 -0
- package/lib/interfaces/models/customer-account.js +3 -0
- package/lib/interfaces/models/customer-account.js.map +1 -0
- package/lib/interfaces/models/customer-organisation.d.ts +14 -0
- package/lib/interfaces/models/customer-organisation.d.ts.map +1 -0
- package/lib/interfaces/models/customer-organisation.js +3 -0
- package/lib/interfaces/models/customer-organisation.js.map +1 -0
- package/lib/interfaces/models/customer-user.d.ts +114 -0
- package/lib/interfaces/models/customer-user.d.ts.map +1 -0
- package/lib/interfaces/models/customer-user.js +3 -0
- package/lib/interfaces/models/customer-user.js.map +1 -0
- package/lib/interfaces/models/incident.d.ts +37 -0
- package/lib/interfaces/models/incident.d.ts.map +1 -0
- package/lib/interfaces/models/incident.js +3 -0
- package/lib/interfaces/models/incident.js.map +1 -0
- package/lib/interfaces/models/navigation-category.d.ts +22 -0
- package/lib/interfaces/models/navigation-category.d.ts.map +1 -0
- package/lib/interfaces/models/navigation-category.js +3 -0
- package/lib/interfaces/models/navigation-category.js.map +1 -0
- package/lib/interfaces/models/offer.d.ts +151 -0
- package/lib/interfaces/models/offer.d.ts.map +1 -0
- package/lib/interfaces/models/offer.js +3 -0
- package/lib/interfaces/models/offer.js.map +1 -0
- package/lib/interfaces/models/order.d.ts +701 -0
- package/lib/interfaces/models/order.d.ts.map +1 -0
- package/lib/interfaces/models/order.js +3 -0
- package/lib/interfaces/models/order.js.map +1 -0
- package/lib/interfaces/models/payment.d.ts +20 -0
- package/lib/interfaces/models/payment.d.ts.map +1 -0
- package/lib/interfaces/models/payment.js +3 -0
- package/lib/interfaces/models/payment.js.map +1 -0
- package/lib/interfaces/models/price.d.ts +6 -0
- package/lib/interfaces/models/price.d.ts.map +1 -0
- package/lib/interfaces/models/price.js +3 -0
- package/lib/interfaces/models/price.js.map +1 -0
- package/lib/interfaces/models/product.d.ts +243 -0
- package/lib/interfaces/models/product.d.ts.map +1 -0
- package/lib/interfaces/models/product.js +3 -0
- package/lib/interfaces/models/product.js.map +1 -0
- package/lib/interfaces/models/quote.d.ts +77 -0
- package/lib/interfaces/models/quote.d.ts.map +1 -0
- package/lib/interfaces/models/quote.js +3 -0
- package/lib/interfaces/models/quote.js.map +1 -0
- package/lib/interfaces/models/searchProduct.d.ts +128 -0
- package/lib/interfaces/models/searchProduct.d.ts.map +1 -0
- package/lib/interfaces/models/searchProduct.js +3 -0
- package/lib/interfaces/models/searchProduct.js.map +1 -0
- package/lib/interfaces/models/supplier.d.ts +72 -0
- package/lib/interfaces/models/supplier.d.ts.map +1 -0
- package/lib/interfaces/models/supplier.js +3 -0
- package/lib/interfaces/models/supplier.js.map +1 -0
- package/lib/services/attributes/attributes.service.d.ts +18 -0
- package/lib/services/attributes/attributes.service.d.ts.map +1 -0
- package/lib/services/attributes/attributes.service.js +37 -0
- package/lib/services/attributes/attributes.service.js.map +1 -0
- package/lib/services/attributes/definitions.d.ts +28 -0
- package/lib/services/attributes/definitions.d.ts.map +1 -0
- package/lib/services/attributes/definitions.js +3 -0
- package/lib/services/attributes/definitions.js.map +1 -0
- package/lib/services/attributes/endpoints.d.ts +12 -0
- package/lib/services/attributes/endpoints.d.ts.map +1 -0
- package/lib/services/attributes/endpoints.js +14 -0
- package/lib/services/attributes/endpoints.js.map +1 -0
- package/lib/services/attributes/index.d.ts +33 -0
- package/lib/services/attributes/index.d.ts.map +1 -0
- package/lib/services/attributes/index.js +50 -0
- package/lib/services/attributes/index.js.map +1 -0
- package/lib/services/attributes/module.d.ts +11 -0
- package/lib/services/attributes/module.d.ts.map +1 -0
- package/lib/services/attributes/module.js +15 -0
- package/lib/services/attributes/module.js.map +1 -0
- package/lib/services/attributes/types.d.ts +35 -0
- package/lib/services/attributes/types.d.ts.map +1 -0
- package/lib/services/attributes/types.js +10 -0
- package/lib/services/attributes/types.js.map +1 -0
- package/lib/services/auth/__mocks__/auth.mocks.d.ts +249 -0
- package/lib/services/auth/__mocks__/auth.mocks.d.ts.map +1 -0
- package/lib/services/auth/__mocks__/auth.mocks.js +221 -0
- package/lib/services/auth/__mocks__/auth.mocks.js.map +1 -0
- package/lib/services/auth/auth.service.d.ts +286 -0
- package/lib/services/auth/auth.service.d.ts.map +1 -0
- package/lib/services/auth/auth.service.js +423 -0
- package/lib/services/auth/auth.service.js.map +1 -0
- package/lib/services/auth/definitions.d.ts +69 -0
- package/lib/services/auth/definitions.d.ts.map +1 -0
- package/lib/services/auth/definitions.js +3 -0
- package/lib/services/auth/definitions.js.map +1 -0
- package/lib/services/auth/definitions.requests.d.ts +25 -0
- package/lib/services/auth/definitions.requests.d.ts.map +1 -0
- package/lib/services/auth/definitions.requests.js +6 -0
- package/lib/services/auth/definitions.requests.js.map +1 -0
- package/lib/services/auth/endpoints.d.ts +30 -0
- package/lib/services/auth/endpoints.d.ts.map +1 -0
- package/lib/services/auth/endpoints.js +32 -0
- package/lib/services/auth/endpoints.js.map +1 -0
- package/lib/services/auth/index.d.ts +232 -0
- package/lib/services/auth/index.d.ts.map +1 -0
- package/lib/services/auth/index.js +310 -0
- package/lib/services/auth/index.js.map +1 -0
- package/lib/services/auth/module.d.ts +11 -0
- package/lib/services/auth/module.d.ts.map +1 -0
- package/lib/services/auth/module.js +17 -0
- package/lib/services/auth/module.js.map +1 -0
- package/lib/services/auth/types.d.ts +124 -0
- package/lib/services/auth/types.d.ts.map +1 -0
- package/lib/services/auth/types.js +10 -0
- package/lib/services/auth/types.js.map +1 -0
- package/lib/services/base.service.d.ts +83 -0
- package/lib/services/base.service.d.ts.map +1 -0
- package/lib/services/base.service.js +121 -0
- package/lib/services/base.service.js.map +1 -0
- package/lib/services/cart/cart.service.d.ts +443 -0
- package/lib/services/cart/cart.service.d.ts.map +1 -0
- package/lib/services/cart/cart.service.js +551 -0
- package/lib/services/cart/cart.service.js.map +1 -0
- package/lib/services/cart/definitions.d.ts +84 -0
- package/lib/services/cart/definitions.d.ts.map +1 -0
- package/lib/services/cart/definitions.js +3 -0
- package/lib/services/cart/definitions.js.map +1 -0
- package/lib/services/cart/endpoints.d.ts +24 -0
- package/lib/services/cart/endpoints.d.ts.map +1 -0
- package/lib/services/cart/endpoints.js +26 -0
- package/lib/services/cart/endpoints.js.map +1 -0
- package/lib/services/cart/index.d.ts +330 -0
- package/lib/services/cart/index.d.ts.map +1 -0
- package/lib/services/cart/index.js +464 -0
- package/lib/services/cart/index.js.map +1 -0
- package/lib/services/cart/module.d.ts +11 -0
- package/lib/services/cart/module.d.ts.map +1 -0
- package/lib/services/cart/module.js +17 -0
- package/lib/services/cart/module.js.map +1 -0
- package/lib/services/cart/types.d.ts +236 -0
- package/lib/services/cart/types.d.ts.map +1 -0
- package/lib/services/cart/types.js +10 -0
- package/lib/services/cart/types.js.map +1 -0
- package/lib/services/commercial-order/commercial-order.service.d.ts +435 -0
- package/lib/services/commercial-order/commercial-order.service.d.ts.map +1 -0
- package/lib/services/commercial-order/commercial-order.service.js +690 -0
- package/lib/services/commercial-order/commercial-order.service.js.map +1 -0
- package/lib/services/commercial-order/definitions.d.ts +182 -0
- package/lib/services/commercial-order/definitions.d.ts.map +1 -0
- package/lib/services/commercial-order/definitions.js +3 -0
- package/lib/services/commercial-order/definitions.js.map +1 -0
- package/lib/services/commercial-order/endpoints.d.ts +28 -0
- package/lib/services/commercial-order/endpoints.d.ts.map +1 -0
- package/lib/services/commercial-order/endpoints.js +33 -0
- package/lib/services/commercial-order/endpoints.js.map +1 -0
- package/lib/services/commercial-order/index.d.ts +721 -0
- package/lib/services/commercial-order/index.d.ts.map +1 -0
- package/lib/services/commercial-order/index.js +986 -0
- package/lib/services/commercial-order/index.js.map +1 -0
- package/lib/services/commercial-order/module.d.ts +11 -0
- package/lib/services/commercial-order/module.d.ts.map +1 -0
- package/lib/services/commercial-order/module.js +15 -0
- package/lib/services/commercial-order/module.js.map +1 -0
- package/lib/services/commercial-order/types.d.ts +244 -0
- package/lib/services/commercial-order/types.d.ts.map +1 -0
- package/lib/services/commercial-order/types.js +10 -0
- package/lib/services/commercial-order/types.js.map +1 -0
- package/lib/services/custom-field/custom-field.service.d.ts +23 -0
- package/lib/services/custom-field/custom-field.service.d.ts.map +1 -0
- package/lib/services/custom-field/custom-field.service.js +64 -0
- package/lib/services/custom-field/custom-field.service.js.map +1 -0
- package/lib/services/custom-field/definitions.d.ts +107 -0
- package/lib/services/custom-field/definitions.d.ts.map +1 -0
- package/lib/services/custom-field/definitions.js +61 -0
- package/lib/services/custom-field/definitions.js.map +1 -0
- package/lib/services/custom-field/endpoints.d.ts +13 -0
- package/lib/services/custom-field/endpoints.d.ts.map +1 -0
- package/lib/services/custom-field/endpoints.js +15 -0
- package/lib/services/custom-field/endpoints.js.map +1 -0
- package/lib/services/custom-field/index.d.ts +115 -0
- package/lib/services/custom-field/index.d.ts.map +1 -0
- package/lib/services/custom-field/index.js +144 -0
- package/lib/services/custom-field/index.js.map +1 -0
- package/lib/services/custom-field/module.d.ts +11 -0
- package/lib/services/custom-field/module.d.ts.map +1 -0
- package/lib/services/custom-field/module.js +15 -0
- package/lib/services/custom-field/module.js.map +1 -0
- package/lib/services/custom-field/types.d.ts +51 -0
- package/lib/services/custom-field/types.d.ts.map +1 -0
- package/lib/services/custom-field/types.js +10 -0
- package/lib/services/custom-field/types.js.map +1 -0
- package/lib/services/customer-account/customer-account.service.d.ts +387 -0
- package/lib/services/customer-account/customer-account.service.d.ts.map +1 -0
- package/lib/services/customer-account/customer-account.service.js +579 -0
- package/lib/services/customer-account/customer-account.service.js.map +1 -0
- package/lib/services/customer-account/definitions.d.ts +164 -0
- package/lib/services/customer-account/definitions.d.ts.map +1 -0
- package/lib/services/customer-account/definitions.js +3 -0
- package/lib/services/customer-account/definitions.js.map +1 -0
- package/lib/services/customer-account/endpoints.d.ts +25 -0
- package/lib/services/customer-account/endpoints.d.ts.map +1 -0
- package/lib/services/customer-account/endpoints.js +33 -0
- package/lib/services/customer-account/endpoints.js.map +1 -0
- package/lib/services/customer-account/index.d.ts +656 -0
- package/lib/services/customer-account/index.d.ts.map +1 -0
- package/lib/services/customer-account/index.js +929 -0
- package/lib/services/customer-account/index.js.map +1 -0
- package/lib/services/customer-account/module.d.ts +11 -0
- package/lib/services/customer-account/module.d.ts.map +1 -0
- package/lib/services/customer-account/module.js +15 -0
- package/lib/services/customer-account/module.js.map +1 -0
- package/lib/services/customer-account/types.d.ts +253 -0
- package/lib/services/customer-account/types.d.ts.map +1 -0
- package/lib/services/customer-account/types.js +10 -0
- package/lib/services/customer-account/types.js.map +1 -0
- package/lib/services/customer-user/customer-user.service.d.ts +280 -0
- package/lib/services/customer-user/customer-user.service.d.ts.map +1 -0
- package/lib/services/customer-user/customer-user.service.js +402 -0
- package/lib/services/customer-user/customer-user.service.js.map +1 -0
- package/lib/services/customer-user/definitions.d.ts +84 -0
- package/lib/services/customer-user/definitions.d.ts.map +1 -0
- package/lib/services/customer-user/definitions.js +3 -0
- package/lib/services/customer-user/definitions.js.map +1 -0
- package/lib/services/customer-user/endpoints.d.ts +19 -0
- package/lib/services/customer-user/endpoints.d.ts.map +1 -0
- package/lib/services/customer-user/endpoints.js +21 -0
- package/lib/services/customer-user/endpoints.js.map +1 -0
- package/lib/services/customer-user/index.d.ts +394 -0
- package/lib/services/customer-user/index.d.ts.map +1 -0
- package/lib/services/customer-user/index.js +528 -0
- package/lib/services/customer-user/index.js.map +1 -0
- package/lib/services/customer-user/module.d.ts +11 -0
- package/lib/services/customer-user/module.d.ts.map +1 -0
- package/lib/services/customer-user/module.js +15 -0
- package/lib/services/customer-user/module.js.map +1 -0
- package/lib/services/customer-user/types.d.ts +118 -0
- package/lib/services/customer-user/types.d.ts.map +1 -0
- package/lib/services/customer-user/types.js +10 -0
- package/lib/services/customer-user/types.js.map +1 -0
- package/lib/services/factory.d.ts +104 -0
- package/lib/services/factory.d.ts.map +1 -0
- package/lib/services/factory.js +89 -0
- package/lib/services/factory.js.map +1 -0
- package/lib/services/incident/definitions.d.ts +85 -0
- package/lib/services/incident/definitions.d.ts.map +1 -0
- package/lib/services/incident/definitions.js +3 -0
- package/lib/services/incident/definitions.js.map +1 -0
- package/lib/services/incident/endpoints.d.ts +17 -0
- package/lib/services/incident/endpoints.d.ts.map +1 -0
- package/lib/services/incident/endpoints.js +19 -0
- package/lib/services/incident/endpoints.js.map +1 -0
- package/lib/services/incident/incident.service.d.ts +24 -0
- package/lib/services/incident/incident.service.d.ts.map +1 -0
- package/lib/services/incident/incident.service.js +141 -0
- package/lib/services/incident/incident.service.js.map +1 -0
- package/lib/services/incident/index.d.ts +270 -0
- package/lib/services/incident/index.d.ts.map +1 -0
- package/lib/services/incident/index.js +389 -0
- package/lib/services/incident/index.js.map +1 -0
- package/lib/services/incident/module.d.ts +11 -0
- package/lib/services/incident/module.d.ts.map +1 -0
- package/lib/services/incident/module.js +15 -0
- package/lib/services/incident/module.js.map +1 -0
- package/lib/services/incident/types.d.ts +116 -0
- package/lib/services/incident/types.d.ts.map +1 -0
- package/lib/services/incident/types.js +10 -0
- package/lib/services/incident/types.js.map +1 -0
- package/lib/services/logistic-order/definitions.d.ts +315 -0
- package/lib/services/logistic-order/definitions.d.ts.map +1 -0
- package/lib/services/logistic-order/definitions.js +3 -0
- package/lib/services/logistic-order/definitions.js.map +1 -0
- package/lib/services/logistic-order/endpoints.d.ts +44 -0
- package/lib/services/logistic-order/endpoints.d.ts.map +1 -0
- package/lib/services/logistic-order/endpoints.js +57 -0
- package/lib/services/logistic-order/endpoints.js.map +1 -0
- package/lib/services/logistic-order/index.d.ts +1376 -0
- package/lib/services/logistic-order/index.d.ts.map +1 -0
- package/lib/services/logistic-order/index.js +1823 -0
- package/lib/services/logistic-order/index.js.map +1 -0
- package/lib/services/logistic-order/logistic-order.service.d.ts +62 -0
- package/lib/services/logistic-order/logistic-order.service.d.ts.map +1 -0
- package/lib/services/logistic-order/logistic-order.service.js +499 -0
- package/lib/services/logistic-order/logistic-order.service.js.map +1 -0
- package/lib/services/logistic-order/module.d.ts +11 -0
- package/lib/services/logistic-order/module.d.ts.map +1 -0
- package/lib/services/logistic-order/module.js +15 -0
- package/lib/services/logistic-order/module.js.map +1 -0
- package/lib/services/logistic-order/types.d.ts +411 -0
- package/lib/services/logistic-order/types.d.ts.map +1 -0
- package/lib/services/logistic-order/types.js +10 -0
- package/lib/services/logistic-order/types.js.map +1 -0
- package/lib/services/module.d.ts +64 -0
- package/lib/services/module.d.ts.map +1 -0
- package/lib/services/module.js +147 -0
- package/lib/services/module.js.map +1 -0
- package/lib/services/navigation-category/definitions.d.ts +31 -0
- package/lib/services/navigation-category/definitions.d.ts.map +1 -0
- package/lib/services/navigation-category/definitions.js +3 -0
- package/lib/services/navigation-category/definitions.js.map +1 -0
- package/lib/services/navigation-category/endpoints.d.ts +15 -0
- package/lib/services/navigation-category/endpoints.d.ts.map +1 -0
- package/lib/services/navigation-category/endpoints.js +17 -0
- package/lib/services/navigation-category/endpoints.js.map +1 -0
- package/lib/services/navigation-category/index.d.ts +114 -0
- package/lib/services/navigation-category/index.d.ts.map +1 -0
- package/lib/services/navigation-category/index.js +160 -0
- package/lib/services/navigation-category/index.js.map +1 -0
- package/lib/services/navigation-category/module.d.ts +11 -0
- package/lib/services/navigation-category/module.d.ts.map +1 -0
- package/lib/services/navigation-category/module.js +15 -0
- package/lib/services/navigation-category/module.js.map +1 -0
- package/lib/services/navigation-category/navigation-category.service.d.ts +148 -0
- package/lib/services/navigation-category/navigation-category.service.d.ts.map +1 -0
- package/lib/services/navigation-category/navigation-category.service.js +191 -0
- package/lib/services/navigation-category/navigation-category.service.js.map +1 -0
- package/lib/services/navigation-category/types.d.ts +51 -0
- package/lib/services/navigation-category/types.d.ts.map +1 -0
- package/lib/services/navigation-category/types.js +10 -0
- package/lib/services/navigation-category/types.js.map +1 -0
- package/lib/services/offer-inventories/definitions.d.ts +73 -0
- package/lib/services/offer-inventories/definitions.d.ts.map +1 -0
- package/lib/services/offer-inventories/definitions.js +3 -0
- package/lib/services/offer-inventories/definitions.js.map +1 -0
- package/lib/services/offer-inventories/endpoints.d.ts +16 -0
- package/lib/services/offer-inventories/endpoints.d.ts.map +1 -0
- package/lib/services/offer-inventories/endpoints.js +18 -0
- package/lib/services/offer-inventories/endpoints.js.map +1 -0
- package/lib/services/offer-inventories/index.d.ts +120 -0
- package/lib/services/offer-inventories/index.d.ts.map +1 -0
- package/lib/services/offer-inventories/index.js +175 -0
- package/lib/services/offer-inventories/index.js.map +1 -0
- package/lib/services/offer-inventories/module.d.ts +11 -0
- package/lib/services/offer-inventories/module.d.ts.map +1 -0
- package/lib/services/offer-inventories/module.js +15 -0
- package/lib/services/offer-inventories/module.js.map +1 -0
- package/lib/services/offer-inventories/offer-inventories.service.d.ts +26 -0
- package/lib/services/offer-inventories/offer-inventories.service.d.ts.map +1 -0
- package/lib/services/offer-inventories/offer-inventories.service.js +80 -0
- package/lib/services/offer-inventories/offer-inventories.service.js.map +1 -0
- package/lib/services/offer-inventories/types.d.ts +85 -0
- package/lib/services/offer-inventories/types.d.ts.map +1 -0
- package/lib/services/offer-inventories/types.js +10 -0
- package/lib/services/offer-inventories/types.js.map +1 -0
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.d.ts +109 -0
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.d.ts.map +1 -0
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.js +201 -0
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.js.map +1 -0
- package/lib/services/offer-prices/definitions.d.ts +24 -0
- package/lib/services/offer-prices/definitions.d.ts.map +1 -0
- package/lib/services/offer-prices/definitions.js +3 -0
- package/lib/services/offer-prices/definitions.js.map +1 -0
- package/lib/services/offer-prices/endpoints.d.ts +12 -0
- package/lib/services/offer-prices/endpoints.d.ts.map +1 -0
- package/lib/services/offer-prices/endpoints.js +14 -0
- package/lib/services/offer-prices/endpoints.js.map +1 -0
- package/lib/services/offer-prices/index.d.ts +36 -0
- package/lib/services/offer-prices/index.d.ts.map +1 -0
- package/lib/services/offer-prices/index.js +53 -0
- package/lib/services/offer-prices/index.js.map +1 -0
- package/lib/services/offer-prices/module.d.ts +11 -0
- package/lib/services/offer-prices/module.d.ts.map +1 -0
- package/lib/services/offer-prices/module.js +15 -0
- package/lib/services/offer-prices/module.js.map +1 -0
- package/lib/services/offer-prices/offer-prices.service.d.ts +18 -0
- package/lib/services/offer-prices/offer-prices.service.d.ts.map +1 -0
- package/lib/services/offer-prices/offer-prices.service.js +36 -0
- package/lib/services/offer-prices/offer-prices.service.js.map +1 -0
- package/lib/services/offer-prices/types.d.ts +33 -0
- package/lib/services/offer-prices/types.d.ts.map +1 -0
- package/lib/services/offer-prices/types.js +10 -0
- package/lib/services/offer-prices/types.js.map +1 -0
- package/lib/services/operation/definitions.d.ts +263 -0
- package/lib/services/operation/definitions.d.ts.map +1 -0
- package/lib/services/operation/definitions.js +18 -0
- package/lib/services/operation/definitions.js.map +1 -0
- package/lib/services/operation/endpoints.d.ts +18 -0
- package/lib/services/operation/endpoints.d.ts.map +1 -0
- package/lib/services/operation/endpoints.js +22 -0
- package/lib/services/operation/endpoints.js.map +1 -0
- package/lib/services/operation/index.d.ts +520 -0
- package/lib/services/operation/index.d.ts.map +1 -0
- package/lib/services/operation/index.js +704 -0
- package/lib/services/operation/index.js.map +1 -0
- package/lib/services/operation/module.d.ts +11 -0
- package/lib/services/operation/module.d.ts.map +1 -0
- package/lib/services/operation/module.js +15 -0
- package/lib/services/operation/module.js.map +1 -0
- package/lib/services/operation/operation.service.d.ts +32 -0
- package/lib/services/operation/operation.service.d.ts.map +1 -0
- package/lib/services/operation/operation.service.js +206 -0
- package/lib/services/operation/operation.service.js.map +1 -0
- package/lib/services/operation/types.d.ts +174 -0
- package/lib/services/operation/types.d.ts.map +1 -0
- package/lib/services/operation/types.js +10 -0
- package/lib/services/operation/types.js.map +1 -0
- package/lib/services/payment/definitions.d.ts +69 -0
- package/lib/services/payment/definitions.d.ts.map +1 -0
- package/lib/services/payment/definitions.js +3 -0
- package/lib/services/payment/definitions.js.map +1 -0
- package/lib/services/payment/endpoints.d.ts +16 -0
- package/lib/services/payment/endpoints.d.ts.map +1 -0
- package/lib/services/payment/endpoints.js +18 -0
- package/lib/services/payment/endpoints.js.map +1 -0
- package/lib/services/payment/index.d.ts +150 -0
- package/lib/services/payment/index.d.ts.map +1 -0
- package/lib/services/payment/index.js +220 -0
- package/lib/services/payment/index.js.map +1 -0
- package/lib/services/payment/module.d.ts +11 -0
- package/lib/services/payment/module.d.ts.map +1 -0
- package/lib/services/payment/module.js +15 -0
- package/lib/services/payment/module.js.map +1 -0
- package/lib/services/payment/payment.service.d.ts +224 -0
- package/lib/services/payment/payment.service.d.ts.map +1 -0
- package/lib/services/payment/payment.service.js +288 -0
- package/lib/services/payment/payment.service.js.map +1 -0
- package/lib/services/payment/types.d.ts +93 -0
- package/lib/services/payment/types.d.ts.map +1 -0
- package/lib/services/payment/types.js +10 -0
- package/lib/services/payment/types.js.map +1 -0
- package/lib/services/product/definitions.d.ts +150 -0
- package/lib/services/product/definitions.d.ts.map +1 -0
- package/lib/services/product/definitions.js +9 -0
- package/lib/services/product/definitions.js.map +1 -0
- package/lib/services/product/endpoints.d.ts +40 -0
- package/lib/services/product/endpoints.d.ts.map +1 -0
- package/lib/services/product/endpoints.js +42 -0
- package/lib/services/product/endpoints.js.map +1 -0
- package/lib/services/product/index.d.ts +388 -0
- package/lib/services/product/index.d.ts.map +1 -0
- package/lib/services/product/index.js +564 -0
- package/lib/services/product/index.js.map +1 -0
- package/lib/services/product/module.d.ts +11 -0
- package/lib/services/product/module.d.ts.map +1 -0
- package/lib/services/product/module.js +17 -0
- package/lib/services/product/module.js.map +1 -0
- package/lib/services/product/product.service.d.ts +452 -0
- package/lib/services/product/product.service.d.ts.map +1 -0
- package/lib/services/product/product.service.js +624 -0
- package/lib/services/product/product.service.js.map +1 -0
- package/lib/services/product/types.d.ts +344 -0
- package/lib/services/product/types.d.ts.map +1 -0
- package/lib/services/product/types.js +10 -0
- package/lib/services/product/types.js.map +1 -0
- package/lib/services/product-variant/definitions.d.ts +33 -0
- package/lib/services/product-variant/definitions.d.ts.map +1 -0
- package/lib/services/product-variant/definitions.js +7 -0
- package/lib/services/product-variant/definitions.js.map +1 -0
- package/lib/services/product-variant/endpoints.d.ts +15 -0
- package/lib/services/product-variant/endpoints.d.ts.map +1 -0
- package/lib/services/product-variant/endpoints.js +17 -0
- package/lib/services/product-variant/endpoints.js.map +1 -0
- package/lib/services/product-variant/index.d.ts +123 -0
- package/lib/services/product-variant/index.d.ts.map +1 -0
- package/lib/services/product-variant/index.js +172 -0
- package/lib/services/product-variant/index.js.map +1 -0
- package/lib/services/product-variant/module.d.ts +11 -0
- package/lib/services/product-variant/module.d.ts.map +1 -0
- package/lib/services/product-variant/module.js +15 -0
- package/lib/services/product-variant/module.js.map +1 -0
- package/lib/services/product-variant/product-variant.service.d.ts +21 -0
- package/lib/services/product-variant/product-variant.service.d.ts.map +1 -0
- package/lib/services/product-variant/product-variant.service.js +69 -0
- package/lib/services/product-variant/product-variant.service.js.map +1 -0
- package/lib/services/product-variant/types.d.ts +73 -0
- package/lib/services/product-variant/types.d.ts.map +1 -0
- package/lib/services/product-variant/types.js +10 -0
- package/lib/services/product-variant/types.js.map +1 -0
- package/lib/services/quote/definitions.d.ts +102 -0
- package/lib/services/quote/definitions.d.ts.map +1 -0
- package/lib/services/quote/definitions.js +3 -0
- package/lib/services/quote/definitions.js.map +1 -0
- package/lib/services/quote/endpoints.d.ts +20 -0
- package/lib/services/quote/endpoints.d.ts.map +1 -0
- package/lib/services/quote/endpoints.js +24 -0
- package/lib/services/quote/endpoints.js.map +1 -0
- package/lib/services/quote/index.d.ts +378 -0
- package/lib/services/quote/index.d.ts.map +1 -0
- package/lib/services/quote/index.js +506 -0
- package/lib/services/quote/index.js.map +1 -0
- package/lib/services/quote/module.d.ts +11 -0
- package/lib/services/quote/module.d.ts.map +1 -0
- package/lib/services/quote/module.js +15 -0
- package/lib/services/quote/module.js.map +1 -0
- package/lib/services/quote/quote.service.d.ts +346 -0
- package/lib/services/quote/quote.service.d.ts.map +1 -0
- package/lib/services/quote/quote.service.js +479 -0
- package/lib/services/quote/quote.service.js.map +1 -0
- package/lib/services/quote/types.d.ts +160 -0
- package/lib/services/quote/types.d.ts.map +1 -0
- package/lib/services/quote/types.js +10 -0
- package/lib/services/quote/types.js.map +1 -0
- package/lib/services/supplier/__mocks__/supplier-mocks.d.ts +49 -0
- package/lib/services/supplier/__mocks__/supplier-mocks.d.ts.map +1 -0
- package/lib/services/supplier/__mocks__/supplier-mocks.js +168 -0
- package/lib/services/supplier/__mocks__/supplier-mocks.js.map +1 -0
- package/lib/services/supplier/definitions.d.ts +30 -0
- package/lib/services/supplier/definitions.d.ts.map +1 -0
- package/lib/services/supplier/definitions.js +3 -0
- package/lib/services/supplier/definitions.js.map +1 -0
- package/lib/services/supplier/endpoints.d.ts +14 -0
- package/lib/services/supplier/endpoints.d.ts.map +1 -0
- package/lib/services/supplier/endpoints.js +16 -0
- package/lib/services/supplier/endpoints.js.map +1 -0
- package/lib/services/supplier/index.d.ts +102 -0
- package/lib/services/supplier/index.d.ts.map +1 -0
- package/lib/services/supplier/index.js +146 -0
- package/lib/services/supplier/index.js.map +1 -0
- package/lib/services/supplier/module.d.ts +11 -0
- package/lib/services/supplier/module.d.ts.map +1 -0
- package/lib/services/supplier/module.js +15 -0
- package/lib/services/supplier/module.js.map +1 -0
- package/lib/services/supplier/supplier.service.d.ts +20 -0
- package/lib/services/supplier/supplier.service.d.ts.map +1 -0
- package/lib/services/supplier/supplier.service.js +63 -0
- package/lib/services/supplier/supplier.service.js.map +1 -0
- package/lib/services/supplier/types.d.ts +58 -0
- package/lib/services/supplier/types.d.ts.map +1 -0
- package/lib/services/supplier/types.js +10 -0
- package/lib/services/supplier/types.js.map +1 -0
- package/lib/services/types.d.ts +81 -0
- package/lib/services/types.d.ts.map +1 -0
- package/lib/services/types.js +10 -0
- package/lib/services/types.js.map +1 -0
- package/lib/settings/fetch-instance.d.ts +30 -0
- package/lib/settings/fetch-instance.d.ts.map +1 -0
- package/lib/settings/fetch-instance.js +223 -0
- package/lib/settings/fetch-instance.js.map +1 -0
- package/lib/settings/sdk-version.d.ts +3 -0
- package/lib/settings/sdk-version.d.ts.map +1 -0
- package/lib/settings/sdk-version.js +6 -0
- package/lib/settings/sdk-version.js.map +1 -0
- package/package.json +27 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/classes/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DJUST SDK Error Classes
|
|
4
|
+
* Re-exports all error class types.
|
|
5
|
+
*
|
|
6
|
+
* @module errors/classes
|
|
7
|
+
* @since 2.17.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.UnexpectedError = exports.ServerError = exports.TimeoutError = exports.NetworkError = exports.RateLimitError = exports.NotFoundError = exports.ForbiddenError = exports.AuthError = exports.ValidationError = void 0;
|
|
11
|
+
var validation_error_1 = require("./validation.error");
|
|
12
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.ValidationError; } });
|
|
13
|
+
var auth_error_1 = require("./auth.error");
|
|
14
|
+
Object.defineProperty(exports, "AuthError", { enumerable: true, get: function () { return auth_error_1.AuthError; } });
|
|
15
|
+
var forbidden_error_1 = require("./forbidden.error");
|
|
16
|
+
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return forbidden_error_1.ForbiddenError; } });
|
|
17
|
+
var not_found_error_1 = require("./not-found.error");
|
|
18
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return not_found_error_1.NotFoundError; } });
|
|
19
|
+
var rate_limit_error_1 = require("./rate-limit.error");
|
|
20
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return rate_limit_error_1.RateLimitError; } });
|
|
21
|
+
var network_error_1 = require("./network.error");
|
|
22
|
+
Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return network_error_1.NetworkError; } });
|
|
23
|
+
var timeout_error_1 = require("./timeout.error");
|
|
24
|
+
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return timeout_error_1.TimeoutError; } });
|
|
25
|
+
var server_error_1 = require("./server.error");
|
|
26
|
+
Object.defineProperty(exports, "ServerError", { enumerable: true, get: function () { return server_error_1.ServerError; } });
|
|
27
|
+
var unexpected_error_1 = require("./unexpected.error");
|
|
28
|
+
Object.defineProperty(exports, "UnexpectedError", { enumerable: true, get: function () { return unexpected_error_1.UnexpectedError; } });
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/errors/classes/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DJUST SDK Network Error
|
|
3
|
+
* Errors related to network connectivity.
|
|
4
|
+
*
|
|
5
|
+
* @module errors/classes/network
|
|
6
|
+
* @since 2.17.0
|
|
7
|
+
*/
|
|
8
|
+
import { SDKError } from "../base";
|
|
9
|
+
import { type SDKErrorCodeType } from "../codes";
|
|
10
|
+
import type { RequestMetadata } from "../types";
|
|
11
|
+
/**
|
|
12
|
+
* Error thrown when a network-level failure occurs.
|
|
13
|
+
*
|
|
14
|
+
* This includes:
|
|
15
|
+
* - Connection refused
|
|
16
|
+
* - DNS resolution failures
|
|
17
|
+
* - SSL/TLS errors
|
|
18
|
+
* - Request aborted
|
|
19
|
+
* - General network failures
|
|
20
|
+
*
|
|
21
|
+
* Network errors are typically retriable.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { NetworkError, isNetworkError } from '@djust-b2b/djust-front-sdk';
|
|
26
|
+
*
|
|
27
|
+
* try {
|
|
28
|
+
* await sdk.getProducts();
|
|
29
|
+
* } catch (error) {
|
|
30
|
+
* if (isNetworkError(error)) {
|
|
31
|
+
* if (error.retriable) {
|
|
32
|
+
* // Retry with exponential backoff
|
|
33
|
+
* } else {
|
|
34
|
+
* // Show offline message
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class NetworkError extends SDKError {
|
|
41
|
+
constructor(message: string, code?: SDKErrorCodeType, cause?: Error, metadata?: RequestMetadata);
|
|
42
|
+
/**
|
|
43
|
+
* Creates a NetworkError for connection refused.
|
|
44
|
+
*/
|
|
45
|
+
static connectionRefused(host?: string, cause?: Error, metadata?: RequestMetadata): NetworkError;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a NetworkError for DNS resolution failure.
|
|
48
|
+
*/
|
|
49
|
+
static dnsError(hostname?: string, cause?: Error, metadata?: RequestMetadata): NetworkError;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a NetworkError for SSL/TLS errors.
|
|
52
|
+
*/
|
|
53
|
+
static sslError(reason?: string, cause?: Error, metadata?: RequestMetadata): NetworkError;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a NetworkError for an aborted request.
|
|
56
|
+
*/
|
|
57
|
+
static aborted(metadata?: RequestMetadata): NetworkError;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a NetworkError from a fetch exception.
|
|
60
|
+
*/
|
|
61
|
+
static fromException(error: Error, metadata?: RequestMetadata): NetworkError;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=network.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.error.d.ts","sourceRoot":"","sources":["../../../src/errors/classes/network.error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,YAAa,SAAQ,QAAQ;gBAEtC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,gBAA6C,EACnD,KAAK,CAAC,EAAE,KAAK,EACb,QAAQ,CAAC,EAAE,eAAe;IAc5B;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,IAAI,CAAC,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,KAAK,EACb,QAAQ,CAAC,EAAE,eAAe,GACzB,YAAY;IAYf;;OAEG;IACH,MAAM,CAAC,QAAQ,CACb,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,KAAK,EACb,QAAQ,CAAC,EAAE,eAAe,GACzB,YAAY;IAOf;;OAEG;IACH,MAAM,CAAC,QAAQ,CACb,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,KAAK,EACb,QAAQ,CAAC,EAAE,eAAe,GACzB,YAAY;IAOf;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,YAAY;IASxD;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,YAAY;CA0D7E"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DJUST SDK Network Error
|
|
4
|
+
* Errors related to network connectivity.
|
|
5
|
+
*
|
|
6
|
+
* @module errors/classes/network
|
|
7
|
+
* @since 2.17.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.NetworkError = void 0;
|
|
11
|
+
const base_1 = require("../base");
|
|
12
|
+
const codes_1 = require("../codes");
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when a network-level failure occurs.
|
|
15
|
+
*
|
|
16
|
+
* This includes:
|
|
17
|
+
* - Connection refused
|
|
18
|
+
* - DNS resolution failures
|
|
19
|
+
* - SSL/TLS errors
|
|
20
|
+
* - Request aborted
|
|
21
|
+
* - General network failures
|
|
22
|
+
*
|
|
23
|
+
* Network errors are typically retriable.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { NetworkError, isNetworkError } from '@djust-b2b/djust-front-sdk';
|
|
28
|
+
*
|
|
29
|
+
* try {
|
|
30
|
+
* await sdk.getProducts();
|
|
31
|
+
* } catch (error) {
|
|
32
|
+
* if (isNetworkError(error)) {
|
|
33
|
+
* if (error.retriable) {
|
|
34
|
+
* // Retry with exponential backoff
|
|
35
|
+
* } else {
|
|
36
|
+
* // Show offline message
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class NetworkError extends base_1.SDKError {
|
|
43
|
+
constructor(message, code = codes_1.SDKErrorCode.NETWORK_ERROR, cause, metadata) {
|
|
44
|
+
super({
|
|
45
|
+
code,
|
|
46
|
+
message,
|
|
47
|
+
httpStatus: 0, // No HTTP response
|
|
48
|
+
cause,
|
|
49
|
+
retriable: true, // Network errors are typically retriable
|
|
50
|
+
metadata,
|
|
51
|
+
});
|
|
52
|
+
this.name = "NetworkError";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates a NetworkError for connection refused.
|
|
56
|
+
*/
|
|
57
|
+
static connectionRefused(host, cause, metadata) {
|
|
58
|
+
const message = host
|
|
59
|
+
? `Connection refused to ${host}`
|
|
60
|
+
: "Connection refused";
|
|
61
|
+
return new NetworkError(message, codes_1.SDKErrorCode.CONNECTION_REFUSED, cause, metadata);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Creates a NetworkError for DNS resolution failure.
|
|
65
|
+
*/
|
|
66
|
+
static dnsError(hostname, cause, metadata) {
|
|
67
|
+
const message = hostname
|
|
68
|
+
? `DNS lookup failed for ${hostname}`
|
|
69
|
+
: "DNS lookup failed";
|
|
70
|
+
return new NetworkError(message, codes_1.SDKErrorCode.DNS_ERROR, cause, metadata);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a NetworkError for SSL/TLS errors.
|
|
74
|
+
*/
|
|
75
|
+
static sslError(reason, cause, metadata) {
|
|
76
|
+
const message = reason
|
|
77
|
+
? `SSL/TLS error: ${reason}`
|
|
78
|
+
: "SSL/TLS connection failed";
|
|
79
|
+
return new NetworkError(message, codes_1.SDKErrorCode.SSL_ERROR, cause, metadata);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates a NetworkError for an aborted request.
|
|
83
|
+
*/
|
|
84
|
+
static aborted(metadata) {
|
|
85
|
+
return new NetworkError("Request was aborted", codes_1.SDKErrorCode.ABORTED, undefined, metadata);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Creates a NetworkError from a fetch exception.
|
|
89
|
+
*/
|
|
90
|
+
static fromException(error, metadata) {
|
|
91
|
+
const message = error.message.toLowerCase();
|
|
92
|
+
// Detect specific network error types
|
|
93
|
+
if (error.name === "AbortError") {
|
|
94
|
+
return NetworkError.aborted(metadata);
|
|
95
|
+
}
|
|
96
|
+
if (message.includes("econnrefused") ||
|
|
97
|
+
message.includes("connection refused")) {
|
|
98
|
+
return NetworkError.connectionRefused(undefined, error, metadata);
|
|
99
|
+
}
|
|
100
|
+
if (message.includes("enotfound") ||
|
|
101
|
+
message.includes("dns") ||
|
|
102
|
+
message.includes("getaddrinfo")) {
|
|
103
|
+
return NetworkError.dnsError(undefined, error, metadata);
|
|
104
|
+
}
|
|
105
|
+
if (message.includes("ssl") ||
|
|
106
|
+
message.includes("tls") ||
|
|
107
|
+
message.includes("certificate")) {
|
|
108
|
+
return NetworkError.sslError(undefined, error, metadata);
|
|
109
|
+
}
|
|
110
|
+
if (message.includes("econnreset") || message.includes("socket hang up")) {
|
|
111
|
+
return new NetworkError("Connection was reset", codes_1.SDKErrorCode.NETWORK_ERROR, error, metadata);
|
|
112
|
+
}
|
|
113
|
+
if (message.includes("etimedout") || message.includes("timeout")) {
|
|
114
|
+
// This should be handled by TimeoutError, but catch here as fallback
|
|
115
|
+
return new NetworkError("Connection timed out", codes_1.SDKErrorCode.TIMEOUT, error, metadata);
|
|
116
|
+
}
|
|
117
|
+
// Generic network error
|
|
118
|
+
return new NetworkError(error.message || "Network request failed", codes_1.SDKErrorCode.NETWORK_ERROR, error, metadata);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.NetworkError = NetworkError;
|
|
122
|
+
//# sourceMappingURL=network.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.error.js","sourceRoot":"","sources":["../../../src/errors/classes/network.error.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DJUST SDK Not Found Error
|
|
3
|
+
* Errors for missing resources (404).
|
|
4
|
+
*
|
|
5
|
+
* @module errors/classes/not-found
|
|
6
|
+
* @since 2.17.0
|
|
7
|
+
*/
|
|
8
|
+
import { SDKError } from "../base";
|
|
9
|
+
import type { RequestMetadata } from "../types";
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when a requested resource doesn't exist (HTTP 404).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { NotFoundError } from '@djust-b2b/djust-front-sdk';
|
|
16
|
+
*
|
|
17
|
+
* try {
|
|
18
|
+
* await sdk.getCart({ cartId: 'non-existent', currency: 'EUR' });
|
|
19
|
+
* } catch (error) {
|
|
20
|
+
* if (error instanceof NotFoundError) {
|
|
21
|
+
* console.log(error.resource); // 'Cart'
|
|
22
|
+
* console.log(error.resourceId); // 'non-existent'
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class NotFoundError extends SDKError {
|
|
28
|
+
/** The type of resource that was not found */
|
|
29
|
+
readonly resource: string;
|
|
30
|
+
/** The ID of the resource that was not found (if known) */
|
|
31
|
+
readonly resourceId?: string;
|
|
32
|
+
constructor(resource: string, resourceId?: string, metadata?: RequestMetadata, messageOverride?: string);
|
|
33
|
+
/**
|
|
34
|
+
* Creates a NotFoundError for a cart.
|
|
35
|
+
*/
|
|
36
|
+
static cart(cartId: string, metadata?: RequestMetadata): NotFoundError;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a NotFoundError for a product.
|
|
39
|
+
*/
|
|
40
|
+
static product(productId: string, metadata?: RequestMetadata): NotFoundError;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a NotFoundError for an order.
|
|
43
|
+
*/
|
|
44
|
+
static order(orderId: string, metadata?: RequestMetadata): NotFoundError;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a NotFoundError for a customer account.
|
|
47
|
+
*/
|
|
48
|
+
static customerAccount(accountId: string, metadata?: RequestMetadata): NotFoundError;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a NotFoundError for a generic resource.
|
|
51
|
+
*/
|
|
52
|
+
static resource(type: string, id?: string, metadata?: RequestMetadata): NotFoundError;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a NotFoundError from HTTP 404 response.
|
|
55
|
+
*/
|
|
56
|
+
static fromResponse(body: string, endpoint?: string, metadata?: RequestMetadata): NotFoundError;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=not-found.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.error.d.ts","sourceRoot":"","sources":["../../../src/errors/classes/not-found.error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAOhD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,8CAA8C;IAC9C,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,2DAA2D;IAC3D,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAGlC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,eAAe,EAC1B,eAAe,CAAC,EAAE,MAAM;IAsB1B;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,aAAa;IAItE;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,aAAa;IAI5E;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,aAAa;IAIxE;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,eAAe,GACzB,aAAa;IAIhB;;OAEG;IACH,MAAM,CAAC,QAAQ,CACb,IAAI,EAAE,MAAM,EACZ,EAAE,CAAC,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,eAAe,GACzB,aAAa;IAIhB;;OAEG;IACH,MAAM,CAAC,YAAY,CACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,eAAe,GACzB,aAAa;CAcjB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DJUST SDK Not Found Error
|
|
4
|
+
* Errors for missing resources (404).
|
|
5
|
+
*
|
|
6
|
+
* @module errors/classes/not-found
|
|
7
|
+
* @since 2.17.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.NotFoundError = void 0;
|
|
11
|
+
const base_1 = require("../base");
|
|
12
|
+
const codes_1 = require("../codes");
|
|
13
|
+
const djust_api_error_1 = require("../helpers/djust-api-error");
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when a requested resource doesn't exist (HTTP 404).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { NotFoundError } from '@djust-b2b/djust-front-sdk';
|
|
20
|
+
*
|
|
21
|
+
* try {
|
|
22
|
+
* await sdk.getCart({ cartId: 'non-existent', currency: 'EUR' });
|
|
23
|
+
* } catch (error) {
|
|
24
|
+
* if (error instanceof NotFoundError) {
|
|
25
|
+
* console.log(error.resource); // 'Cart'
|
|
26
|
+
* console.log(error.resourceId); // 'non-existent'
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
class NotFoundError extends base_1.SDKError {
|
|
32
|
+
constructor(resource, resourceId, metadata, messageOverride) {
|
|
33
|
+
const message = messageOverride ??
|
|
34
|
+
(resourceId
|
|
35
|
+
? `${resource} '${resourceId}' not found`
|
|
36
|
+
: `${resource} not found`);
|
|
37
|
+
super({
|
|
38
|
+
code: codes_1.SDKErrorCode.NOT_FOUND,
|
|
39
|
+
message,
|
|
40
|
+
httpStatus: 404,
|
|
41
|
+
details: { resource, resourceId },
|
|
42
|
+
retriable: false, // Resource doesn't exist
|
|
43
|
+
metadata,
|
|
44
|
+
});
|
|
45
|
+
this.name = "NotFoundError";
|
|
46
|
+
this.resource = resource;
|
|
47
|
+
this.resourceId = resourceId;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a NotFoundError for a cart.
|
|
51
|
+
*/
|
|
52
|
+
static cart(cartId, metadata) {
|
|
53
|
+
return new NotFoundError("Cart", cartId, metadata);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Creates a NotFoundError for a product.
|
|
57
|
+
*/
|
|
58
|
+
static product(productId, metadata) {
|
|
59
|
+
return new NotFoundError("Product", productId, metadata);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates a NotFoundError for an order.
|
|
63
|
+
*/
|
|
64
|
+
static order(orderId, metadata) {
|
|
65
|
+
return new NotFoundError("Order", orderId, metadata);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Creates a NotFoundError for a customer account.
|
|
69
|
+
*/
|
|
70
|
+
static customerAccount(accountId, metadata) {
|
|
71
|
+
return new NotFoundError("Customer account", accountId, metadata);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a NotFoundError for a generic resource.
|
|
75
|
+
*/
|
|
76
|
+
static resource(type, id, metadata) {
|
|
77
|
+
return new NotFoundError(type, id, metadata);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Creates a NotFoundError from HTTP 404 response.
|
|
81
|
+
*/
|
|
82
|
+
static fromResponse(body, endpoint, metadata) {
|
|
83
|
+
const parsed = (0, djust_api_error_1.parseDjustApiErrorBody)(body);
|
|
84
|
+
const apiError = parsed.errors?.[0];
|
|
85
|
+
const apiMessage = (0, djust_api_error_1.extractDjustApiErrorMessage)(body);
|
|
86
|
+
const resource = parsed.resource ||
|
|
87
|
+
(0, djust_api_error_1.inferResourceFromDjustErrorCode)(apiError?.code) ||
|
|
88
|
+
inferResourceFromEndpoint(endpoint) ||
|
|
89
|
+
"Resource";
|
|
90
|
+
const resourceId = parsed.id;
|
|
91
|
+
return new NotFoundError(resource, resourceId, metadata, apiMessage);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.NotFoundError = NotFoundError;
|
|
95
|
+
/**
|
|
96
|
+
* Infers resource type from API endpoint path.
|
|
97
|
+
*/
|
|
98
|
+
function inferResourceFromEndpoint(endpoint) {
|
|
99
|
+
if (!endpoint)
|
|
100
|
+
return undefined;
|
|
101
|
+
const patterns = [
|
|
102
|
+
[/\/carts\//, "Cart"],
|
|
103
|
+
[/\/products\//, "Product"],
|
|
104
|
+
[/\/commercial-orders\//, "Commercial order"],
|
|
105
|
+
[/\/logistic-orders\//, "Logistic order"],
|
|
106
|
+
[/\/customer-accounts\//, "Customer account"],
|
|
107
|
+
[/\/customer-users\//, "Customer user"],
|
|
108
|
+
[/\/quotes\//, "Quote"],
|
|
109
|
+
[/\/suppliers\//, "Supplier"],
|
|
110
|
+
[/\/addresses\//, "Address"],
|
|
111
|
+
[/\/organisations\//, "Organisation"],
|
|
112
|
+
];
|
|
113
|
+
for (const [pattern, resource] of patterns) {
|
|
114
|
+
if (pattern.test(endpoint)) {
|
|
115
|
+
return resource;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=not-found.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.error.js","sourceRoot":"","sources":["../../../src/errors/classes/not-found.error.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DJUST SDK Rate Limit Error
|
|
3
|
+
* Errors for rate limiting (429).
|
|
4
|
+
*
|
|
5
|
+
* @module errors/classes/rate-limit
|
|
6
|
+
* @since 2.17.0
|
|
7
|
+
*/
|
|
8
|
+
import { SDKError } from "../base";
|
|
9
|
+
import type { RequestMetadata } from "../types";
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when rate limit is exceeded (HTTP 429).
|
|
12
|
+
*
|
|
13
|
+
* This error is retriable after a delay. Check `retryAfterMs` for
|
|
14
|
+
* the recommended wait time.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { RateLimitError } from '@djust-b2b/djust-front-sdk';
|
|
19
|
+
*
|
|
20
|
+
* try {
|
|
21
|
+
* await sdk.searchProducts({ query: 'laptop' });
|
|
22
|
+
* } catch (error) {
|
|
23
|
+
* if (error instanceof RateLimitError) {
|
|
24
|
+
* const waitTime = error.retryAfterMs || 60000;
|
|
25
|
+
* console.log(`Rate limited. Retry after ${waitTime}ms`);
|
|
26
|
+
*
|
|
27
|
+
* // Wait and retry
|
|
28
|
+
* await sleep(waitTime);
|
|
29
|
+
* await sdk.searchProducts({ query: 'laptop' });
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class RateLimitError extends SDKError {
|
|
35
|
+
constructor(retryAfterMs?: number, details?: Record<string, unknown>, metadata?: RequestMetadata);
|
|
36
|
+
/**
|
|
37
|
+
* Returns the recommended wait time in seconds.
|
|
38
|
+
*/
|
|
39
|
+
getRetryAfterSeconds(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a RateLimitError from HTTP 429 response.
|
|
42
|
+
*/
|
|
43
|
+
static fromResponse(body: string, headers?: Headers, metadata?: RequestMetadata): RateLimitError;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a RateLimitError with a specific retry delay.
|
|
46
|
+
*/
|
|
47
|
+
static withDelay(seconds: number, metadata?: RequestMetadata): RateLimitError;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=rate-limit.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.error.d.ts","sourceRoot":"","sources":["../../../src/errors/classes/rate-limit.error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,cAAe,SAAQ,QAAQ;gBAExC,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,QAAQ,CAAC,EAAE,eAAe;IAqB5B;;OAEG;IACH,oBAAoB,IAAI,MAAM;IAI9B;;OAEG;IACH,MAAM,CAAC,YAAY,CACjB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,EACjB,QAAQ,CAAC,EAAE,eAAe,GACzB,cAAc;IAsCjB;;OAEG;IACH,MAAM,CAAC,SAAS,CACd,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,eAAe,GACzB,cAAc;CAGlB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DJUST SDK Rate Limit Error
|
|
4
|
+
* Errors for rate limiting (429).
|
|
5
|
+
*
|
|
6
|
+
* @module errors/classes/rate-limit
|
|
7
|
+
* @since 2.17.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.RateLimitError = void 0;
|
|
11
|
+
const base_1 = require("../base");
|
|
12
|
+
const codes_1 = require("../codes");
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when rate limit is exceeded (HTTP 429).
|
|
15
|
+
*
|
|
16
|
+
* This error is retriable after a delay. Check `retryAfterMs` for
|
|
17
|
+
* the recommended wait time.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { RateLimitError } from '@djust-b2b/djust-front-sdk';
|
|
22
|
+
*
|
|
23
|
+
* try {
|
|
24
|
+
* await sdk.searchProducts({ query: 'laptop' });
|
|
25
|
+
* } catch (error) {
|
|
26
|
+
* if (error instanceof RateLimitError) {
|
|
27
|
+
* const waitTime = error.retryAfterMs || 60000;
|
|
28
|
+
* console.log(`Rate limited. Retry after ${waitTime}ms`);
|
|
29
|
+
*
|
|
30
|
+
* // Wait and retry
|
|
31
|
+
* await sleep(waitTime);
|
|
32
|
+
* await sdk.searchProducts({ query: 'laptop' });
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
class RateLimitError extends base_1.SDKError {
|
|
38
|
+
constructor(retryAfterMs, details, metadata) {
|
|
39
|
+
const message = retryAfterMs
|
|
40
|
+
? `Rate limit exceeded. Retry after ${Math.ceil(retryAfterMs / 1000)} seconds`
|
|
41
|
+
: "Rate limit exceeded";
|
|
42
|
+
super({
|
|
43
|
+
code: codes_1.SDKErrorCode.RATE_LIMITED,
|
|
44
|
+
message,
|
|
45
|
+
httpStatus: 429,
|
|
46
|
+
details,
|
|
47
|
+
retriable: true, // Rate limit errors ARE retriable (after delay)
|
|
48
|
+
retryAfterMs,
|
|
49
|
+
metadata,
|
|
50
|
+
});
|
|
51
|
+
this.name = "RateLimitError";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns the recommended wait time in seconds.
|
|
55
|
+
*/
|
|
56
|
+
getRetryAfterSeconds() {
|
|
57
|
+
return this.retryAfterMs ? Math.ceil(this.retryAfterMs / 1000) : 60;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a RateLimitError from HTTP 429 response.
|
|
61
|
+
*/
|
|
62
|
+
static fromResponse(body, headers, metadata) {
|
|
63
|
+
let retryAfterMs;
|
|
64
|
+
// Check Retry-After header
|
|
65
|
+
if (headers) {
|
|
66
|
+
const retryAfterHeader = headers.get("Retry-After");
|
|
67
|
+
if (retryAfterHeader) {
|
|
68
|
+
// Can be seconds or HTTP-date
|
|
69
|
+
const seconds = parseInt(retryAfterHeader, 10);
|
|
70
|
+
if (!isNaN(seconds)) {
|
|
71
|
+
retryAfterMs = seconds * 1000;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// Try parsing as HTTP-date
|
|
75
|
+
const date = new Date(retryAfterHeader);
|
|
76
|
+
if (!isNaN(date.getTime())) {
|
|
77
|
+
retryAfterMs = date.getTime() - Date.now();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Check body for retry info
|
|
83
|
+
if (!retryAfterMs) {
|
|
84
|
+
try {
|
|
85
|
+
const parsed = JSON.parse(body);
|
|
86
|
+
if (typeof parsed.retryAfter === "number") {
|
|
87
|
+
retryAfterMs = parsed.retryAfter * 1000;
|
|
88
|
+
}
|
|
89
|
+
else if (typeof parsed.retryAfterMs === "number") {
|
|
90
|
+
retryAfterMs = parsed.retryAfterMs;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Not JSON
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return new RateLimitError(retryAfterMs, { rawBody: body }, metadata);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Creates a RateLimitError with a specific retry delay.
|
|
101
|
+
*/
|
|
102
|
+
static withDelay(seconds, metadata) {
|
|
103
|
+
return new RateLimitError(seconds * 1000, {}, metadata);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.RateLimitError = RateLimitError;
|
|
107
|
+
//# sourceMappingURL=rate-limit.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.error.js","sourceRoot":"","sources":["../../../src/errors/classes/rate-limit.error.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,kCAAmC;AACnC,oCAAwC;AAGxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,cAAe,SAAQ,eAAQ;IAC1C,YACE,YAAqB,EACrB,OAAiC,EACjC,QAA0B;QAE1B,MAAM,OAAO,GAAG,YAAY;YAC1B,CAAC,CAAC,oCAAoC,IAAI,CAAC,IAAI,CAC3C,YAAY,GAAG,IAAI,CACpB,UAAU;YACb,CAAC,CAAC,qBAAqB,CAAC;QAE1B,KAAK,CAAC;YACJ,IAAI,EAAE,oBAAY,CAAC,YAAY;YAC/B,OAAO;YACP,UAAU,EAAE,GAAG;YACf,OAAO;YACP,SAAS,EAAE,IAAI,EAAE,gDAAgD;YACjE,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,oBAAoB;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CACjB,IAAY,EACZ,OAAiB,EACjB,QAA0B;QAE1B,IAAI,YAAgC,CAAC;QAErC,2BAA2B;QAC3B,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YACpD,IAAI,gBAAgB,EAAE,CAAC;gBACrB,8BAA8B;gBAC9B,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;gBAC/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;oBACpB,YAAY,GAAG,OAAO,GAAG,IAAI,CAAC;gBAChC,CAAC;qBAAM,CAAC;oBACN,2BAA2B;oBAC3B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACxC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;wBAC3B,YAAY,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;oBAC7C,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,4BAA4B;QAC5B,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAChC,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;oBAC1C,YAAY,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;gBAC1C,CAAC;qBAAM,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;oBACnD,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;gBACrC,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,WAAW;YACb,CAAC;QACH,CAAC;QAED,OAAO,IAAI,cAAc,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAS,CACd,OAAe,EACf,QAA0B;QAE1B,OAAO,IAAI,cAAc,CAAC,OAAO,GAAG,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;CACF;AAtFD,wCAsFC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DJUST SDK Server Error
|
|
3
|
+
* Errors for server-side failures (5xx).
|
|
4
|
+
*
|
|
5
|
+
* @module errors/classes/server
|
|
6
|
+
* @since 2.17.0
|
|
7
|
+
*/
|
|
8
|
+
import { SDKError } from "../base";
|
|
9
|
+
import { type SDKErrorCodeType } from "../codes";
|
|
10
|
+
import type { RequestMetadata } from "../types";
|
|
11
|
+
/**
|
|
12
|
+
* Error thrown when the server returns a 5xx error.
|
|
13
|
+
*
|
|
14
|
+
* Server errors are typically retriable, as they often indicate
|
|
15
|
+
* temporary issues like overload or maintenance.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { ServerError } from '@djust-b2b/djust-front-sdk';
|
|
20
|
+
*
|
|
21
|
+
* try {
|
|
22
|
+
* await sdk.checkout();
|
|
23
|
+
* } catch (error) {
|
|
24
|
+
* if (error instanceof ServerError) {
|
|
25
|
+
* if (error.retriable) {
|
|
26
|
+
* // Retry with exponential backoff
|
|
27
|
+
* await retryWithBackoff(() => sdk.checkout());
|
|
28
|
+
* } else {
|
|
29
|
+
* // Show error page
|
|
30
|
+
* showErrorPage('Service temporarily unavailable');
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class ServerError extends SDKError {
|
|
37
|
+
constructor(message: string, httpStatus?: number, code?: SDKErrorCodeType, details?: Record<string, unknown>, metadata?: RequestMetadata);
|
|
38
|
+
/**
|
|
39
|
+
* Creates a ServerError for Internal Server Error (500).
|
|
40
|
+
*/
|
|
41
|
+
static internalError(message?: string, metadata?: RequestMetadata): ServerError;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a ServerError for Bad Gateway (502).
|
|
44
|
+
*/
|
|
45
|
+
static badGateway(metadata?: RequestMetadata): ServerError;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a ServerError for Service Unavailable (503).
|
|
48
|
+
*/
|
|
49
|
+
static serviceUnavailable(retryAfterMs?: number, metadata?: RequestMetadata): ServerError;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a ServerError for Gateway Timeout (504).
|
|
52
|
+
*/
|
|
53
|
+
static gatewayTimeout(metadata?: RequestMetadata): ServerError;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a ServerError from HTTP 5xx response.
|
|
56
|
+
*/
|
|
57
|
+
static fromResponse(statusCode: number, body: string, headers?: Headers, metadata?: RequestMetadata): ServerError;
|
|
58
|
+
/**
|
|
59
|
+
* Checks if this is a transient error that will likely resolve on retry.
|
|
60
|
+
*/
|
|
61
|
+
isTransient(): boolean;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=server.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.error.d.ts","sourceRoot":"","sources":["../../../src/errors/classes/server.error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,WAAY,SAAQ,QAAQ;gBAErC,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAAY,EACxB,IAAI,GAAE,gBAA4C,EAClD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,QAAQ,CAAC,EAAE,eAAe;IAc5B;;OAEG;IACH,MAAM,CAAC,aAAa,CAClB,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,eAAe,GACzB,WAAW;IAUd;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,WAAW;IAU1D;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,YAAY,CAAC,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,eAAe,GACzB,WAAW;IAgBd;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,WAAW;IAU9D;;OAEG;IACH,MAAM,CAAC,YAAY,CACjB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,EACjB,QAAQ,CAAC,EAAE,eAAe,GACzB,WAAW;IAwCd;;OAEG;IACH,WAAW,IAAI,OAAO;CAGvB"}
|