@ominity/api-typescript 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FUNCTIONS.md +38 -0
- package/LICENSE.md +8 -0
- package/README.md +468 -0
- package/RUNTIMES.md +48 -0
- package/dist/commonjs/core.d.ts +10 -0
- package/dist/commonjs/core.d.ts.map +1 -0
- package/dist/commonjs/core.js +14 -0
- package/dist/commonjs/core.js.map +1 -0
- package/dist/commonjs/hooks/hooks.d.ts +25 -0
- package/dist/commonjs/hooks/hooks.d.ts.map +1 -0
- package/dist/commonjs/hooks/hooks.js +83 -0
- package/dist/commonjs/hooks/hooks.js.map +1 -0
- package/dist/commonjs/hooks/index.d.ts +3 -0
- package/dist/commonjs/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/hooks/index.js +19 -0
- package/dist/commonjs/hooks/index.js.map +1 -0
- package/dist/commonjs/hooks/ominity-hooks.d.ts +12 -0
- package/dist/commonjs/hooks/ominity-hooks.d.ts.map +1 -0
- package/dist/commonjs/hooks/ominity-hooks.js +86 -0
- package/dist/commonjs/hooks/ominity-hooks.js.map +1 -0
- package/dist/commonjs/hooks/registration.d.ts +3 -0
- package/dist/commonjs/hooks/registration.d.ts.map +1 -0
- package/dist/commonjs/hooks/registration.js +16 -0
- package/dist/commonjs/hooks/registration.js.map +1 -0
- package/dist/commonjs/hooks/types.d.ts +76 -0
- package/dist/commonjs/hooks/types.d.ts.map +1 -0
- package/dist/commonjs/hooks/types.js +3 -0
- package/dist/commonjs/hooks/types.js.map +1 -0
- package/dist/commonjs/index.d.ts +6 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +45 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/lib/base64.d.ts +10 -0
- package/dist/commonjs/lib/base64.d.ts.map +1 -0
- package/dist/commonjs/lib/base64.js +70 -0
- package/dist/commonjs/lib/base64.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +52 -0
- package/dist/commonjs/lib/config.d.ts.map +1 -0
- package/dist/commonjs/lib/config.js +33 -0
- package/dist/commonjs/lib/config.js.map +1 -0
- package/dist/commonjs/lib/dlv.d.ts +14 -0
- package/dist/commonjs/lib/dlv.d.ts.map +1 -0
- package/dist/commonjs/lib/dlv.js +46 -0
- package/dist/commonjs/lib/dlv.js.map +1 -0
- package/dist/commonjs/lib/encodings.d.ts +53 -0
- package/dist/commonjs/lib/encodings.d.ts.map +1 -0
- package/dist/commonjs/lib/encodings.js +381 -0
- package/dist/commonjs/lib/encodings.js.map +1 -0
- package/dist/commonjs/lib/env.d.ts +16 -0
- package/dist/commonjs/lib/env.d.ts.map +1 -0
- package/dist/commonjs/lib/env.js +80 -0
- package/dist/commonjs/lib/env.js.map +1 -0
- package/dist/commonjs/lib/files.d.ts +13 -0
- package/dist/commonjs/lib/files.d.ts.map +1 -0
- package/dist/commonjs/lib/files.js +74 -0
- package/dist/commonjs/lib/files.js.map +1 -0
- package/dist/commonjs/lib/http.d.ts +67 -0
- package/dist/commonjs/lib/http.d.ts.map +1 -0
- package/dist/commonjs/lib/http.js +214 -0
- package/dist/commonjs/lib/http.js.map +1 -0
- package/dist/commonjs/lib/is-plain-object.d.ts +2 -0
- package/dist/commonjs/lib/is-plain-object.d.ts.map +1 -0
- package/dist/commonjs/lib/is-plain-object.js +38 -0
- package/dist/commonjs/lib/is-plain-object.js.map +1 -0
- package/dist/commonjs/lib/logger.d.ts +6 -0
- package/dist/commonjs/lib/logger.d.ts.map +1 -0
- package/dist/commonjs/lib/logger.js +3 -0
- package/dist/commonjs/lib/logger.js.map +1 -0
- package/dist/commonjs/lib/matchers.d.ts +59 -0
- package/dist/commonjs/lib/matchers.d.ts.map +1 -0
- package/dist/commonjs/lib/matchers.js +219 -0
- package/dist/commonjs/lib/matchers.js.map +1 -0
- package/dist/commonjs/lib/primitives.d.ts +26 -0
- package/dist/commonjs/lib/primitives.d.ts.map +1 -0
- package/dist/commonjs/lib/primitives.js +108 -0
- package/dist/commonjs/lib/primitives.js.map +1 -0
- package/dist/commonjs/lib/retries.d.ts +38 -0
- package/dist/commonjs/lib/retries.d.ts.map +1 -0
- package/dist/commonjs/lib/retries.js +150 -0
- package/dist/commonjs/lib/retries.js.map +1 -0
- package/dist/commonjs/lib/schemas.d.ts +21 -0
- package/dist/commonjs/lib/schemas.d.ts.map +1 -0
- package/dist/commonjs/lib/schemas.js +92 -0
- package/dist/commonjs/lib/schemas.js.map +1 -0
- package/dist/commonjs/lib/sdks.d.ts +63 -0
- package/dist/commonjs/lib/sdks.d.ts.map +1 -0
- package/dist/commonjs/lib/sdks.js +270 -0
- package/dist/commonjs/lib/sdks.js.map +1 -0
- package/dist/commonjs/lib/security.d.ts +83 -0
- package/dist/commonjs/lib/security.d.ts.map +1 -0
- package/dist/commonjs/lib/security.js +155 -0
- package/dist/commonjs/lib/security.js.map +1 -0
- package/dist/commonjs/lib/url.d.ts +5 -0
- package/dist/commonjs/lib/url.d.ts.map +1 -0
- package/dist/commonjs/lib/url.js +22 -0
- package/dist/commonjs/lib/url.js.map +1 -0
- package/dist/commonjs/models/errors/documentation.d.ts +22 -0
- package/dist/commonjs/models/errors/documentation.d.ts.map +1 -0
- package/dist/commonjs/models/errors/documentation.js +61 -0
- package/dist/commonjs/models/errors/documentation.js.map +1 -0
- package/dist/commonjs/models/errors/error-response-links.d.ts +21 -0
- package/dist/commonjs/models/errors/error-response-links.d.ts.map +1 -0
- package/dist/commonjs/models/errors/error-response-links.js +59 -0
- package/dist/commonjs/models/errors/error-response-links.js.map +1 -0
- package/dist/commonjs/models/errors/error-response.d.ts +56 -0
- package/dist/commonjs/models/errors/error-response.d.ts.map +1 -0
- package/dist/commonjs/models/errors/error-response.js +98 -0
- package/dist/commonjs/models/errors/error-response.js.map +1 -0
- package/dist/commonjs/models/errors/http-client-errors.d.ts +44 -0
- package/dist/commonjs/models/errors/http-client-errors.d.ts.map +1 -0
- package/dist/commonjs/models/errors/http-client-errors.js +75 -0
- package/dist/commonjs/models/errors/http-client-errors.js.map +1 -0
- package/dist/commonjs/models/errors/index.d.ts +9 -0
- package/dist/commonjs/models/errors/index.d.ts.map +1 -0
- package/dist/commonjs/models/errors/index.js +25 -0
- package/dist/commonjs/models/errors/index.js.map +1 -0
- package/dist/commonjs/models/errors/ominity-default-error.d.ts +10 -0
- package/dist/commonjs/models/errors/ominity-default-error.d.ts.map +1 -0
- package/dist/commonjs/models/errors/ominity-default-error.js +31 -0
- package/dist/commonjs/models/errors/ominity-default-error.js.map +1 -0
- package/dist/commonjs/models/errors/ominity-error.d.ts +19 -0
- package/dist/commonjs/models/errors/ominity-error.d.ts.map +1 -0
- package/dist/commonjs/models/errors/ominity-error.js +17 -0
- package/dist/commonjs/models/errors/ominity-error.js.map +1 -0
- package/dist/commonjs/models/errors/response-validation-error.d.ts +26 -0
- package/dist/commonjs/models/errors/response-validation-error.d.ts.map +1 -0
- package/dist/commonjs/models/errors/response-validation-error.js +63 -0
- package/dist/commonjs/models/errors/response-validation-error.js.map +1 -0
- package/dist/commonjs/models/errors/sdk-validation-error.d.ts +21 -0
- package/dist/commonjs/models/errors/sdk-validation-error.d.ts.map +1 -0
- package/dist/commonjs/models/errors/sdk-validation-error.js +79 -0
- package/dist/commonjs/models/errors/sdk-validation-error.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +2 -0
- package/dist/commonjs/models/index.d.ts.map +1 -0
- package/dist/commonjs/models/index.js +18 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -0
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -0
- package/dist/commonjs/models/security.d.ts +19 -0
- package/dist/commonjs/models/security.d.ts.map +1 -0
- package/dist/commonjs/models/security.js +58 -0
- package/dist/commonjs/models/security.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/sdk/cms/index.d.ts +4 -0
- package/dist/commonjs/sdk/cms/index.d.ts.map +1 -0
- package/dist/commonjs/sdk/cms/index.js +11 -0
- package/dist/commonjs/sdk/cms/index.js.map +1 -0
- package/dist/commonjs/sdk/commerce/index.d.ts +7 -0
- package/dist/commonjs/sdk/commerce/index.d.ts.map +1 -0
- package/dist/commonjs/sdk/commerce/index.js +15 -0
- package/dist/commonjs/sdk/commerce/index.js.map +1 -0
- package/dist/commonjs/sdk/commerce/products.d.ts +4 -0
- package/dist/commonjs/sdk/commerce/products.d.ts.map +1 -0
- package/dist/commonjs/sdk/commerce/products.js +11 -0
- package/dist/commonjs/sdk/commerce/products.js.map +1 -0
- package/dist/commonjs/sdk/http.d.ts +19 -0
- package/dist/commonjs/sdk/http.d.ts.map +1 -0
- package/dist/commonjs/sdk/http.js +143 -0
- package/dist/commonjs/sdk/http.js.map +1 -0
- package/dist/commonjs/sdk/index.d.ts +2 -0
- package/dist/commonjs/sdk/index.d.ts.map +1 -0
- package/dist/commonjs/sdk/index.js +18 -0
- package/dist/commonjs/sdk/index.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +16 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -0
- package/dist/commonjs/sdk/sdk.js +24 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -0
- package/dist/commonjs/sdk/settings/index.d.ts +4 -0
- package/dist/commonjs/sdk/settings/index.d.ts.map +1 -0
- package/dist/commonjs/sdk/settings/index.js +11 -0
- package/dist/commonjs/sdk/settings/index.js.map +1 -0
- package/dist/commonjs/types/async.d.ts +23 -0
- package/dist/commonjs/types/async.d.ts.map +1 -0
- package/dist/commonjs/types/async.js +41 -0
- package/dist/commonjs/types/async.js.map +1 -0
- package/dist/commonjs/types/blobs.d.ts +4 -0
- package/dist/commonjs/types/blobs.d.ts.map +1 -0
- package/dist/commonjs/types/blobs.js +59 -0
- package/dist/commonjs/types/blobs.js.map +1 -0
- package/dist/commonjs/types/const-date-time.d.ts +3 -0
- package/dist/commonjs/types/const-date-time.d.ts.map +1 -0
- package/dist/commonjs/types/const-date-time.js +43 -0
- package/dist/commonjs/types/const-date-time.js.map +1 -0
- package/dist/commonjs/types/default-to-zero-value.d.ts +12 -0
- package/dist/commonjs/types/default-to-zero-value.d.ts.map +1 -0
- package/dist/commonjs/types/default-to-zero-value.js +32 -0
- package/dist/commonjs/types/default-to-zero-value.js.map +1 -0
- package/dist/commonjs/types/enums.d.ts +9 -0
- package/dist/commonjs/types/enums.d.ts.map +1 -0
- package/dist/commonjs/types/enums.js +63 -0
- package/dist/commonjs/types/enums.js.map +1 -0
- package/dist/commonjs/types/fp.d.ts +31 -0
- package/dist/commonjs/types/fp.d.ts.map +1 -0
- package/dist/commonjs/types/fp.js +34 -0
- package/dist/commonjs/types/fp.js.map +1 -0
- package/dist/commonjs/types/index.d.ts +10 -0
- package/dist/commonjs/types/index.d.ts.map +1 -0
- package/dist/commonjs/types/index.js +28 -0
- package/dist/commonjs/types/index.js.map +1 -0
- package/dist/commonjs/types/operations.d.ts +27 -0
- package/dist/commonjs/types/operations.d.ts.map +1 -0
- package/dist/commonjs/types/operations.js +80 -0
- package/dist/commonjs/types/operations.js.map +1 -0
- package/dist/commonjs/types/primitives.d.ts +11 -0
- package/dist/commonjs/types/primitives.d.ts.map +1 -0
- package/dist/commonjs/types/primitives.js +173 -0
- package/dist/commonjs/types/primitives.js.map +1 -0
- package/dist/commonjs/types/rfcdate.d.ts +21 -0
- package/dist/commonjs/types/rfcdate.d.ts.map +1 -0
- package/dist/commonjs/types/rfcdate.js +43 -0
- package/dist/commonjs/types/rfcdate.js.map +1 -0
- package/dist/commonjs/types/smart-union.d.ts +7 -0
- package/dist/commonjs/types/smart-union.d.ts.map +1 -0
- package/dist/commonjs/types/smart-union.js +143 -0
- package/dist/commonjs/types/smart-union.js.map +1 -0
- package/dist/commonjs/types/streams.d.ts +2 -0
- package/dist/commonjs/types/streams.d.ts.map +1 -0
- package/dist/commonjs/types/streams.js +15 -0
- package/dist/commonjs/types/streams.js.map +1 -0
- package/dist/commonjs/types/unrecognized.d.ts +16 -0
- package/dist/commonjs/types/unrecognized.d.ts.map +1 -0
- package/dist/commonjs/types/unrecognized.js +31 -0
- package/dist/commonjs/types/unrecognized.js.map +1 -0
- package/dist/esm/core.d.ts +10 -0
- package/dist/esm/core.d.ts.map +1 -0
- package/dist/esm/core.js +10 -0
- package/dist/esm/core.js.map +1 -0
- package/dist/esm/hooks/hooks.d.ts +25 -0
- package/dist/esm/hooks/hooks.d.ts.map +1 -0
- package/dist/esm/hooks/hooks.js +79 -0
- package/dist/esm/hooks/hooks.js.map +1 -0
- package/dist/esm/hooks/index.d.ts +3 -0
- package/dist/esm/hooks/index.d.ts.map +1 -0
- package/dist/esm/hooks/index.js +3 -0
- package/dist/esm/hooks/index.js.map +1 -0
- package/dist/esm/hooks/ominity-hooks.d.ts +12 -0
- package/dist/esm/hooks/ominity-hooks.d.ts.map +1 -0
- package/dist/esm/hooks/ominity-hooks.js +82 -0
- package/dist/esm/hooks/ominity-hooks.js.map +1 -0
- package/dist/esm/hooks/registration.d.ts +3 -0
- package/dist/esm/hooks/registration.d.ts.map +1 -0
- package/dist/esm/hooks/registration.js +13 -0
- package/dist/esm/hooks/registration.js.map +1 -0
- package/dist/esm/hooks/types.d.ts +76 -0
- package/dist/esm/hooks/types.d.ts.map +1 -0
- package/dist/esm/hooks/types.js +2 -0
- package/dist/esm/hooks/types.js.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/base64.d.ts +10 -0
- package/dist/esm/lib/base64.d.ts.map +1 -0
- package/dist/esm/lib/base64.js +28 -0
- package/dist/esm/lib/base64.js.map +1 -0
- package/dist/esm/lib/config.d.ts +52 -0
- package/dist/esm/lib/config.d.ts.map +1 -0
- package/dist/esm/lib/config.js +29 -0
- package/dist/esm/lib/config.js.map +1 -0
- package/dist/esm/lib/dlv.d.ts +14 -0
- package/dist/esm/lib/dlv.d.ts.map +1 -0
- package/dist/esm/lib/dlv.js +43 -0
- package/dist/esm/lib/dlv.js.map +1 -0
- package/dist/esm/lib/encodings.d.ts +53 -0
- package/dist/esm/lib/encodings.d.ts.map +1 -0
- package/dist/esm/lib/encodings.js +367 -0
- package/dist/esm/lib/encodings.js.map +1 -0
- package/dist/esm/lib/env.d.ts +16 -0
- package/dist/esm/lib/env.d.ts.map +1 -0
- package/dist/esm/lib/env.js +42 -0
- package/dist/esm/lib/env.js.map +1 -0
- package/dist/esm/lib/files.d.ts +13 -0
- package/dist/esm/lib/files.d.ts.map +1 -0
- package/dist/esm/lib/files.js +70 -0
- package/dist/esm/lib/files.js.map +1 -0
- package/dist/esm/lib/http.d.ts +67 -0
- package/dist/esm/lib/http.d.ts.map +1 -0
- package/dist/esm/lib/http.js +204 -0
- package/dist/esm/lib/http.js.map +1 -0
- package/dist/esm/lib/is-plain-object.d.ts +2 -0
- package/dist/esm/lib/is-plain-object.d.ts.map +1 -0
- package/dist/esm/lib/is-plain-object.js +35 -0
- package/dist/esm/lib/is-plain-object.js.map +1 -0
- package/dist/esm/lib/logger.d.ts +6 -0
- package/dist/esm/lib/logger.d.ts.map +1 -0
- package/dist/esm/lib/logger.js +2 -0
- package/dist/esm/lib/logger.js.map +1 -0
- package/dist/esm/lib/matchers.d.ts +59 -0
- package/dist/esm/lib/matchers.d.ts.map +1 -0
- package/dist/esm/lib/matchers.js +200 -0
- package/dist/esm/lib/matchers.js.map +1 -0
- package/dist/esm/lib/primitives.d.ts +26 -0
- package/dist/esm/lib/primitives.d.ts.map +1 -0
- package/dist/esm/lib/primitives.js +100 -0
- package/dist/esm/lib/primitives.js.map +1 -0
- package/dist/esm/lib/retries.d.ts +38 -0
- package/dist/esm/lib/retries.d.ts.map +1 -0
- package/dist/esm/lib/retries.js +144 -0
- package/dist/esm/lib/retries.js.map +1 -0
- package/dist/esm/lib/schemas.d.ts +21 -0
- package/dist/esm/lib/schemas.d.ts.map +1 -0
- package/dist/esm/lib/schemas.js +54 -0
- package/dist/esm/lib/schemas.js.map +1 -0
- package/dist/esm/lib/sdks.d.ts +63 -0
- package/dist/esm/lib/sdks.d.ts.map +1 -0
- package/dist/esm/lib/sdks.js +266 -0
- package/dist/esm/lib/sdks.js.map +1 -0
- package/dist/esm/lib/security.d.ts +83 -0
- package/dist/esm/lib/security.d.ts.map +1 -0
- package/dist/esm/lib/security.js +148 -0
- package/dist/esm/lib/security.js.map +1 -0
- package/dist/esm/lib/url.d.ts +5 -0
- package/dist/esm/lib/url.d.ts.map +1 -0
- package/dist/esm/lib/url.js +19 -0
- package/dist/esm/lib/url.js.map +1 -0
- package/dist/esm/models/errors/documentation.d.ts +22 -0
- package/dist/esm/models/errors/documentation.d.ts.map +1 -0
- package/dist/esm/models/errors/documentation.js +23 -0
- package/dist/esm/models/errors/documentation.js.map +1 -0
- package/dist/esm/models/errors/error-response-links.d.ts +21 -0
- package/dist/esm/models/errors/error-response-links.d.ts.map +1 -0
- package/dist/esm/models/errors/error-response-links.js +21 -0
- package/dist/esm/models/errors/error-response-links.js.map +1 -0
- package/dist/esm/models/errors/error-response.d.ts +56 -0
- package/dist/esm/models/errors/error-response.d.ts.map +1 -0
- package/dist/esm/models/errors/error-response.js +61 -0
- package/dist/esm/models/errors/error-response.js.map +1 -0
- package/dist/esm/models/errors/http-client-errors.d.ts +44 -0
- package/dist/esm/models/errors/http-client-errors.d.ts.map +1 -0
- package/dist/esm/models/errors/http-client-errors.js +66 -0
- package/dist/esm/models/errors/http-client-errors.js.map +1 -0
- package/dist/esm/models/errors/index.d.ts +9 -0
- package/dist/esm/models/errors/index.d.ts.map +1 -0
- package/dist/esm/models/errors/index.js +9 -0
- package/dist/esm/models/errors/index.js.map +1 -0
- package/dist/esm/models/errors/ominity-default-error.d.ts +10 -0
- package/dist/esm/models/errors/ominity-default-error.d.ts.map +1 -0
- package/dist/esm/models/errors/ominity-default-error.js +27 -0
- package/dist/esm/models/errors/ominity-default-error.js.map +1 -0
- package/dist/esm/models/errors/ominity-error.d.ts +19 -0
- package/dist/esm/models/errors/ominity-error.d.ts.map +1 -0
- package/dist/esm/models/errors/ominity-error.js +13 -0
- package/dist/esm/models/errors/ominity-error.js.map +1 -0
- package/dist/esm/models/errors/response-validation-error.d.ts +26 -0
- package/dist/esm/models/errors/response-validation-error.d.ts.map +1 -0
- package/dist/esm/models/errors/response-validation-error.js +26 -0
- package/dist/esm/models/errors/response-validation-error.js.map +1 -0
- package/dist/esm/models/errors/sdk-validation-error.d.ts +21 -0
- package/dist/esm/models/errors/sdk-validation-error.d.ts.map +1 -0
- package/dist/esm/models/errors/sdk-validation-error.js +41 -0
- package/dist/esm/models/errors/sdk-validation-error.js.map +1 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.d.ts.map +1 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -0
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -0
- package/dist/esm/models/security.d.ts +19 -0
- package/dist/esm/models/security.d.ts.map +1 -0
- package/dist/esm/models/security.js +20 -0
- package/dist/esm/models/security.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/sdk/cms/index.d.ts +4 -0
- package/dist/esm/sdk/cms/index.d.ts.map +1 -0
- package/dist/esm/sdk/cms/index.js +7 -0
- package/dist/esm/sdk/cms/index.js.map +1 -0
- package/dist/esm/sdk/commerce/index.d.ts +7 -0
- package/dist/esm/sdk/commerce/index.d.ts.map +1 -0
- package/dist/esm/sdk/commerce/index.js +11 -0
- package/dist/esm/sdk/commerce/index.js.map +1 -0
- package/dist/esm/sdk/commerce/products.d.ts +4 -0
- package/dist/esm/sdk/commerce/products.d.ts.map +1 -0
- package/dist/esm/sdk/commerce/products.js +7 -0
- package/dist/esm/sdk/commerce/products.js.map +1 -0
- package/dist/esm/sdk/http.d.ts +19 -0
- package/dist/esm/sdk/http.d.ts.map +1 -0
- package/dist/esm/sdk/http.js +139 -0
- package/dist/esm/sdk/http.js.map +1 -0
- package/dist/esm/sdk/index.d.ts +2 -0
- package/dist/esm/sdk/index.d.ts.map +1 -0
- package/dist/esm/sdk/index.js +2 -0
- package/dist/esm/sdk/index.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +16 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -0
- package/dist/esm/sdk/sdk.js +20 -0
- package/dist/esm/sdk/sdk.js.map +1 -0
- package/dist/esm/sdk/settings/index.d.ts +4 -0
- package/dist/esm/sdk/settings/index.d.ts.map +1 -0
- package/dist/esm/sdk/settings/index.js +7 -0
- package/dist/esm/sdk/settings/index.js.map +1 -0
- package/dist/esm/types/async.d.ts +23 -0
- package/dist/esm/types/async.d.ts.map +1 -0
- package/dist/esm/types/async.js +37 -0
- package/dist/esm/types/async.js.map +1 -0
- package/dist/esm/types/blobs.d.ts +4 -0
- package/dist/esm/types/blobs.d.ts.map +1 -0
- package/dist/esm/types/blobs.js +22 -0
- package/dist/esm/types/blobs.js.map +1 -0
- package/dist/esm/types/const-date-time.d.ts +3 -0
- package/dist/esm/types/const-date-time.d.ts.map +1 -0
- package/dist/esm/types/const-date-time.js +7 -0
- package/dist/esm/types/const-date-time.js.map +1 -0
- package/dist/esm/types/default-to-zero-value.d.ts +12 -0
- package/dist/esm/types/default-to-zero-value.d.ts.map +1 -0
- package/dist/esm/types/default-to-zero-value.js +28 -0
- package/dist/esm/types/default-to-zero-value.js.map +1 -0
- package/dist/esm/types/enums.d.ts +9 -0
- package/dist/esm/types/enums.d.ts.map +1 -0
- package/dist/esm/types/enums.js +24 -0
- package/dist/esm/types/enums.js.map +1 -0
- package/dist/esm/types/fp.d.ts +31 -0
- package/dist/esm/types/fp.d.ts.map +1 -0
- package/dist/esm/types/fp.js +28 -0
- package/dist/esm/types/fp.js.map +1 -0
- package/dist/esm/types/index.d.ts +10 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/index.js +7 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/operations.d.ts +27 -0
- package/dist/esm/types/operations.d.ts.map +1 -0
- package/dist/esm/types/operations.js +74 -0
- package/dist/esm/types/operations.js.map +1 -0
- package/dist/esm/types/primitives.d.ts +11 -0
- package/dist/esm/types/primitives.d.ts.map +1 -0
- package/dist/esm/types/primitives.js +129 -0
- package/dist/esm/types/primitives.js.map +1 -0
- package/dist/esm/types/rfcdate.d.ts +21 -0
- package/dist/esm/types/rfcdate.d.ts.map +1 -0
- package/dist/esm/types/rfcdate.js +39 -0
- package/dist/esm/types/rfcdate.js.map +1 -0
- package/dist/esm/types/smart-union.d.ts +7 -0
- package/dist/esm/types/smart-union.d.ts.map +1 -0
- package/dist/esm/types/smart-union.js +107 -0
- package/dist/esm/types/smart-union.js.map +1 -0
- package/dist/esm/types/streams.d.ts +2 -0
- package/dist/esm/types/streams.d.ts.map +1 -0
- package/dist/esm/types/streams.js +12 -0
- package/dist/esm/types/streams.js.map +1 -0
- package/dist/esm/types/unrecognized.d.ts +16 -0
- package/dist/esm/types/unrecognized.d.ts.map +1 -0
- package/dist/esm/types/unrecognized.js +28 -0
- package/dist/esm/types/unrecognized.js.map +1 -0
- package/jsr.json +27 -0
- package/package.json +122 -0
- package/src/core.ts +10 -0
- package/src/hooks/hooks.ts +128 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/ominity-hooks.ts +117 -0
- package/src/hooks/registration.ts +15 -0
- package/src/hooks/types.ts +103 -0
- package/src/index.ts +6 -0
- package/src/lib/base64.ts +36 -0
- package/src/lib/config.ts +84 -0
- package/src/lib/dlv.ts +49 -0
- package/src/lib/encodings.ts +497 -0
- package/src/lib/env.ts +56 -0
- package/src/lib/files.ts +79 -0
- package/src/lib/http.ts +320 -0
- package/src/lib/is-plain-object.ts +40 -0
- package/src/lib/logger.ts +6 -0
- package/src/lib/matchers.ts +349 -0
- package/src/lib/primitives.ts +147 -0
- package/src/lib/retries.ts +215 -0
- package/src/lib/schemas.ts +91 -0
- package/src/lib/sdks.ts +403 -0
- package/src/lib/security.ts +276 -0
- package/src/lib/url.ts +30 -0
- package/src/models/errors/documentation.ts +50 -0
- package/src/models/errors/error-response-links.ts +58 -0
- package/src/models/errors/error-response.ts +121 -0
- package/src/models/errors/http-client-errors.ts +58 -0
- package/src/models/errors/index.ts +8 -0
- package/src/models/errors/ominity-default-error.ts +36 -0
- package/src/models/errors/ominity-error.ts +31 -0
- package/src/models/errors/response-validation-error.ts +46 -0
- package/src/models/errors/sdk-validation-error.ts +50 -0
- package/src/models/index.ts +1 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/security.ts +46 -0
- package/src/sdk/cms/index.ts +7 -0
- package/src/sdk/commerce/index.ts +13 -0
- package/src/sdk/commerce/products.ts +7 -0
- package/src/sdk/http.ts +204 -0
- package/src/sdk/index.ts +2 -0
- package/src/sdk/sdk.ts +28 -0
- package/src/sdk/settings/index.ts +7 -0
- package/src/types/async.ts +65 -0
- package/src/types/blobs.ts +30 -0
- package/src/types/const-date-time.ts +12 -0
- package/src/types/default-to-zero-value.ts +30 -0
- package/src/types/enums.ts +42 -0
- package/src/types/fp.ts +47 -0
- package/src/types/index.ts +10 -0
- package/src/types/operations.ts +102 -0
- package/src/types/primitives.ts +165 -0
- package/src/types/rfcdate.ts +51 -0
- package/src/types/smart-union.ts +142 -0
- package/src/types/streams.ts +18 -0
- package/src/types/unrecognized.ts +32 -0
- package/tsconfig.json +40 -0
package/FUNCTIONS.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Standalone Functions
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This section is useful if you are using a bundler and targetting browsers and
|
|
5
|
+
> runtimes where the size of an application affects performance and load times.
|
|
6
|
+
|
|
7
|
+
Standalone functions are not yet available. This SDK currently focuses on the
|
|
8
|
+
class-based client and the generic `http` helper while the typed endpoints are
|
|
9
|
+
being implemented.
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
// Standalone functions will be documented here once they are introduced.
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Result types
|
|
18
|
+
|
|
19
|
+
Standalone functions differ from SDK methods in that they return a
|
|
20
|
+
`Result<Value, Error>` type to capture _known errors_ and document them using
|
|
21
|
+
the type system. By avoiding throwing errors, application code maintains clear
|
|
22
|
+
control flow and error-handling become part of the regular flow of application
|
|
23
|
+
code.
|
|
24
|
+
|
|
25
|
+
> We use the term "known errors" because standalone functions, and JavaScript
|
|
26
|
+
> code in general, can still throw unexpected errors such as `TypeError`s,
|
|
27
|
+
> `RangeError`s and `DOMException`s. Exhaustively catching all errors may be
|
|
28
|
+
> something this SDK addresses in the future. Nevertheless, there is still a lot
|
|
29
|
+
> of benefit from capturing most errors and turning them into values.
|
|
30
|
+
|
|
31
|
+
The second reason for this style of programming is because these functions will
|
|
32
|
+
typically be used in front-end applications where exception throwing is
|
|
33
|
+
sometimes discouraged or considered unidiomatic. React and similar ecosystems
|
|
34
|
+
and libraries tend to promote this style of programming so that components
|
|
35
|
+
render useful content under all states (loading, success, error and so on).
|
|
36
|
+
|
|
37
|
+
Once standalone functions are added, this guide will show how to use the core
|
|
38
|
+
client with tree-shakable function imports.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Copyright (c) 2026, Ominity
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# @ominity/api-typescript
|
|
2
|
+
|
|
3
|
+
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@ominity/api-typescript* API.
|
|
4
|
+
|
|
5
|
+
<br /><br />
|
|
6
|
+
> [!IMPORTANT]
|
|
7
|
+
> This SDK is under active development and not yet ready for production use.
|
|
8
|
+
|
|
9
|
+
<!-- Start Summary [summary] -->
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
Type-safe TypeScript SDK for the Ominity API. This SDK is manually maintained
|
|
13
|
+
and provides a stable core, module namespaces (`commerce`, `cms`, `settings`),
|
|
14
|
+
and a generic HTTP client for endpoints not yet implemented.
|
|
15
|
+
|
|
16
|
+
Documentation: https://docs.ominity.com
|
|
17
|
+
<!-- End Summary [summary] -->
|
|
18
|
+
|
|
19
|
+
<!-- Start Table of Contents [toc] -->
|
|
20
|
+
## Table of Contents
|
|
21
|
+
<!-- $toc-max-depth=2 -->
|
|
22
|
+
* [@ominity/api-typescript](#ominityapi-typescript)
|
|
23
|
+
* [SDK Installation](#sdk-installation)
|
|
24
|
+
* [Requirements](#requirements)
|
|
25
|
+
* [SDK Example Usage](#sdk-example-usage)
|
|
26
|
+
* [Authentication](#authentication)
|
|
27
|
+
* [Available Resources and Operations](#available-resources-and-operations)
|
|
28
|
+
* [Standalone functions](#standalone-functions)
|
|
29
|
+
* [File uploads](#file-uploads)
|
|
30
|
+
* [Retries](#retries)
|
|
31
|
+
* [Error Handling](#error-handling)
|
|
32
|
+
* [Server URL Per-Client](#server-url-per-client)
|
|
33
|
+
* [Custom HTTP Client](#custom-http-client)
|
|
34
|
+
* [Debugging](#debugging)
|
|
35
|
+
* [Development](#development)
|
|
36
|
+
* [Maturity](#maturity)
|
|
37
|
+
* [Contributions](#contributions)
|
|
38
|
+
|
|
39
|
+
<!-- End Table of Contents [toc] -->
|
|
40
|
+
|
|
41
|
+
<!-- Start SDK Installation [installation] -->
|
|
42
|
+
## SDK Installation
|
|
43
|
+
|
|
44
|
+
The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
|
|
45
|
+
|
|
46
|
+
### NPM
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm add @ominity/api-typescript
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### PNPM
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pnpm add @ominity/api-typescript
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Bun
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
bun add @ominity/api-typescript
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Yarn
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
yarn add @ominity/api-typescript
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
> [!NOTE]
|
|
71
|
+
> This package is published with CommonJS and ES Modules (ESM) support.
|
|
72
|
+
<!-- End SDK Installation [installation] -->
|
|
73
|
+
|
|
74
|
+
<!-- Start Requirements [requirements] -->
|
|
75
|
+
## Requirements
|
|
76
|
+
|
|
77
|
+
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
|
78
|
+
<!-- End Requirements [requirements] -->
|
|
79
|
+
|
|
80
|
+
<!-- Start SDK Example Usage [usage] -->
|
|
81
|
+
## SDK Example Usage
|
|
82
|
+
|
|
83
|
+
### Example
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
87
|
+
|
|
88
|
+
const ominity = new Ominity({
|
|
89
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
90
|
+
security: {
|
|
91
|
+
apiKey: process.env["OMINITY_API_KEY"] ?? "",
|
|
92
|
+
},
|
|
93
|
+
language: "en",
|
|
94
|
+
channelId: "019c2dee-2ed6-7754-8698-6b8dd37bc61e",
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
async function run() {
|
|
98
|
+
const res = await ominity.http.get("/commerce/products", {
|
|
99
|
+
query: { include: "variants", sort: "-price" },
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
console.log(await res.json());
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
run();
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
<!-- End SDK Example Usage [usage] -->
|
|
109
|
+
|
|
110
|
+
<!-- Start Authentication [security] -->
|
|
111
|
+
## Authentication
|
|
112
|
+
|
|
113
|
+
### Per-Client Security Schemes
|
|
114
|
+
|
|
115
|
+
This SDK supports the following security schemes globally:
|
|
116
|
+
|
|
117
|
+
| Name | Type | Scheme | Environment Variable |
|
|
118
|
+
| ------- | ------ | -------------- | ------------------------- |
|
|
119
|
+
| `apiKey` | http | Bearer (API key) | `OMINITY_API_KEY` |
|
|
120
|
+
| `oAuth` | http | Bearer (OAuth) | `OMINITY_OAUTH_TOKEN` |
|
|
121
|
+
|
|
122
|
+
To authenticate with the API, set the `security` object when initializing the SDK client instance. If `security.oAuth` is provided, it will be used; otherwise `security.apiKey` is used.
|
|
123
|
+
For example:
|
|
124
|
+
```typescript
|
|
125
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
126
|
+
|
|
127
|
+
const ominity = new Ominity({
|
|
128
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
129
|
+
security: {
|
|
130
|
+
apiKey: process.env["OMINITY_API_KEY"] ?? "",
|
|
131
|
+
// oAuth: process.env["OMINITY_OAUTH_TOKEN"] ?? "",
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
async function run() {
|
|
136
|
+
const res = await ominity.http.get("/commerce/products");
|
|
137
|
+
console.log(await res.json());
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
run();
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
<!-- End Authentication [security] -->
|
|
144
|
+
|
|
145
|
+
<!-- Start Available Resources and Operations [operations] -->
|
|
146
|
+
## Available Resources and Operations
|
|
147
|
+
|
|
148
|
+
Typed operations are being added. Current namespaces:
|
|
149
|
+
|
|
150
|
+
- `commerce`
|
|
151
|
+
- `cms`
|
|
152
|
+
- `settings`
|
|
153
|
+
- `http` (generic client for unimplemented endpoints)
|
|
154
|
+
|
|
155
|
+
Use `ominity.http` for endpoints that are not yet implemented in the SDK.
|
|
156
|
+
<!-- End Available Resources and Operations [operations] -->
|
|
157
|
+
|
|
158
|
+
<!-- Start Standalone functions [standalone-funcs] -->
|
|
159
|
+
## Standalone functions
|
|
160
|
+
|
|
161
|
+
Standalone functions are not yet available. This SDK currently focuses on the
|
|
162
|
+
class-based client and the generic `http` helper.
|
|
163
|
+
|
|
164
|
+
To read more about the intended standalone function approach, check
|
|
165
|
+
[FUNCTIONS.md](./FUNCTIONS.md).
|
|
166
|
+
<!-- End Standalone functions [standalone-funcs] -->
|
|
167
|
+
|
|
168
|
+
<!-- Start File uploads [file-upload] -->
|
|
169
|
+
## File uploads
|
|
170
|
+
|
|
171
|
+
Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
|
|
172
|
+
|
|
173
|
+
> [!TIP]
|
|
174
|
+
>
|
|
175
|
+
> Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
|
|
176
|
+
>
|
|
177
|
+
> - **Node.js v20+:** Since v20, Node.js comes with a native `openAsBlob` function in [`node:fs`](https://nodejs.org/docs/latest-v20.x/api/fs.html#fsopenasblobpath-options).
|
|
178
|
+
> - **Bun:** The native [`Bun.file`](https://bun.sh/docs/api/file-io#reading-files-bun-file) function produces a file handle that can be used for streaming file uploads.
|
|
179
|
+
> - **Browsers:** All supported browsers return an instance to a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) when reading the value from an `<input type="file">` element.
|
|
180
|
+
> - **Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob).
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
184
|
+
import { openAsBlob } from "node:fs";
|
|
185
|
+
|
|
186
|
+
const ominity = new Ominity({
|
|
187
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
188
|
+
security: {
|
|
189
|
+
apiKey: process.env["OMINITY_API_KEY"] ?? "",
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
async function run() {
|
|
194
|
+
const form = new FormData();
|
|
195
|
+
form.append("file", await openAsBlob("./path/to/file.pdf"));
|
|
196
|
+
|
|
197
|
+
const res = await ominity.http.post("/files", {
|
|
198
|
+
body: form,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
console.log(await res.json());
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
run();
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
<!-- End File uploads [file-upload] -->
|
|
208
|
+
|
|
209
|
+
<!-- Start Retries [retries] -->
|
|
210
|
+
## Retries
|
|
211
|
+
|
|
212
|
+
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
|
213
|
+
|
|
214
|
+
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
|
|
215
|
+
```typescript
|
|
216
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
217
|
+
|
|
218
|
+
const ominity = new Ominity({
|
|
219
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
220
|
+
security: {
|
|
221
|
+
apiKey: process.env["OMINITY_API_KEY"] ?? "",
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
async function run() {
|
|
226
|
+
const res = await ominity.http.get("/commerce/products", {
|
|
227
|
+
retries: {
|
|
228
|
+
strategy: "backoff",
|
|
229
|
+
backoff: {
|
|
230
|
+
initialInterval: 1,
|
|
231
|
+
maxInterval: 50,
|
|
232
|
+
exponent: 1.1,
|
|
233
|
+
maxElapsedTime: 100,
|
|
234
|
+
},
|
|
235
|
+
retryConnectionErrors: false,
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
console.log(await res.json());
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
run();
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
|
|
247
|
+
```typescript
|
|
248
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
249
|
+
|
|
250
|
+
const ominity = new Ominity({
|
|
251
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
252
|
+
retryConfig: {
|
|
253
|
+
strategy: "backoff",
|
|
254
|
+
backoff: {
|
|
255
|
+
initialInterval: 1,
|
|
256
|
+
maxInterval: 50,
|
|
257
|
+
exponent: 1.1,
|
|
258
|
+
maxElapsedTime: 100,
|
|
259
|
+
},
|
|
260
|
+
retryConnectionErrors: false,
|
|
261
|
+
},
|
|
262
|
+
security: {
|
|
263
|
+
apiKey: process.env["OMINITY_API_KEY"] ?? "",
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
async function run() {
|
|
268
|
+
const res = await ominity.http.get("/commerce/products");
|
|
269
|
+
|
|
270
|
+
console.log(await res.json());
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
run();
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
<!-- End Retries [retries] -->
|
|
277
|
+
|
|
278
|
+
<!-- Start Error Handling [errors] -->
|
|
279
|
+
## Error Handling
|
|
280
|
+
|
|
281
|
+
[`OminityError`](./src/models/errors/ominity-error.ts) is the base class for all HTTP error responses. It has the following properties:
|
|
282
|
+
|
|
283
|
+
| Property | Type | Description |
|
|
284
|
+
| ------------------- | ---------- | --------------------------------------------------------------------------------------- |
|
|
285
|
+
| `error.message` | `string` | Error message |
|
|
286
|
+
| `error.statusCode` | `number` | HTTP response status code eg `404` |
|
|
287
|
+
| `error.headers` | `Headers` | HTTP response headers |
|
|
288
|
+
| `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
|
|
289
|
+
| `error.rawResponse` | `Response` | Raw HTTP response |
|
|
290
|
+
| `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
|
|
291
|
+
|
|
292
|
+
### Example
|
|
293
|
+
```typescript
|
|
294
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
295
|
+
import * as errors from "@ominity/api-typescript/models/errors";
|
|
296
|
+
|
|
297
|
+
const ominity = new Ominity({
|
|
298
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
299
|
+
security: {
|
|
300
|
+
apiKey: process.env["OMINITY_API_KEY"] ?? "",
|
|
301
|
+
oAuth: process.env["OMINITY_OAUTH_TOKEN"] ?? "",
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
async function run() {
|
|
306
|
+
try {
|
|
307
|
+
// Call a method that performs a request
|
|
308
|
+
console.log(ominity);
|
|
309
|
+
} catch (error) {
|
|
310
|
+
// The base class for HTTP error responses
|
|
311
|
+
if (error instanceof errors.OminityError) {
|
|
312
|
+
console.log(error.message);
|
|
313
|
+
console.log(error.statusCode);
|
|
314
|
+
console.log(error.body);
|
|
315
|
+
console.log(error.headers);
|
|
316
|
+
|
|
317
|
+
// Structured API error response
|
|
318
|
+
if (error instanceof errors.ErrorResponse) {
|
|
319
|
+
console.log(error.data$.status); // number
|
|
320
|
+
console.log(error.data$.title); // string
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
run();
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Error Classes
|
|
331
|
+
**Primary error:**
|
|
332
|
+
* [`OminityError`](./src/models/errors/ominity-error.ts): The base class for HTTP error responses.
|
|
333
|
+
|
|
334
|
+
<details><summary>Less common errors (9)</summary>
|
|
335
|
+
|
|
336
|
+
<br />
|
|
337
|
+
|
|
338
|
+
**Network errors:**
|
|
339
|
+
* [`ConnectionError`](./src/models/errors/http-client-errors.ts): HTTP client was unable to make a request to a server.
|
|
340
|
+
* [`RequestTimeoutError`](./src/models/errors/http-client-errors.ts): HTTP request timed out due to an AbortSignal signal.
|
|
341
|
+
* [`RequestAbortedError`](./src/models/errors/http-client-errors.ts): HTTP request was aborted by the client.
|
|
342
|
+
* [`InvalidRequestError`](./src/models/errors/http-client-errors.ts): Any input used to create a request is invalid.
|
|
343
|
+
* [`UnexpectedClientError`](./src/models/errors/http-client-errors.ts): Unrecognised or unexpected error.
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
**Inherit from [`OminityError`](./src/models/errors/ominity-error.ts)**:
|
|
347
|
+
* [`ErrorResponse`](./src/models/errors/error-response.ts): Standard API error response (including validation errors).
|
|
348
|
+
* [`ResponseValidationError`](./src/models/errors/response-validation-error.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
|
|
349
|
+
|
|
350
|
+
</details>
|
|
351
|
+
|
|
352
|
+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
|
|
353
|
+
<!-- End Error Handling [errors] -->
|
|
354
|
+
|
|
355
|
+
<!-- Start Server Selection [server] -->
|
|
356
|
+
## Server URL Per-Client
|
|
357
|
+
|
|
358
|
+
Each tenant runs on its own domain, so `serverURL` is required when initializing the SDK client instance. The SDK appends the API version (default `"v1"`) to this base URL. For example:
|
|
359
|
+
```typescript
|
|
360
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
361
|
+
|
|
362
|
+
const ominity = new Ominity({
|
|
363
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
364
|
+
security: {
|
|
365
|
+
apiKey: process.env["OMINITY_API_KEY"] ?? "",
|
|
366
|
+
oAuth: process.env["OMINITY_OAUTH_TOKEN"] ?? "",
|
|
367
|
+
},
|
|
368
|
+
language: "en",
|
|
369
|
+
channelId: "web",
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
async function run() {
|
|
373
|
+
console.log(ominity);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
run();
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
<!-- End Server Selection [server] -->
|
|
380
|
+
|
|
381
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
382
|
+
## Custom HTTP Client
|
|
383
|
+
|
|
384
|
+
The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
|
|
385
|
+
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
|
|
386
|
+
client is a thin wrapper around `fetch` and provides the ability to attach hooks
|
|
387
|
+
around the request lifecycle that can be used to modify the request or handle
|
|
388
|
+
errors and response.
|
|
389
|
+
|
|
390
|
+
The `HTTPClient` constructor takes an optional `fetcher` argument that can be
|
|
391
|
+
used to integrate a third-party HTTP client or when writing tests to mock out
|
|
392
|
+
the HTTP client and feed in fixtures.
|
|
393
|
+
|
|
394
|
+
The following example shows how to use the `"beforeRequest"` hook to to add a
|
|
395
|
+
custom header and a timeout to requests and how to use the `"requestError"` hook
|
|
396
|
+
to log errors:
|
|
397
|
+
|
|
398
|
+
```typescript
|
|
399
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
400
|
+
import { HTTPClient } from "@ominity/api-typescript/lib/http";
|
|
401
|
+
|
|
402
|
+
const httpClient = new HTTPClient({
|
|
403
|
+
// fetcher takes a function that has the same signature as native `fetch`.
|
|
404
|
+
fetcher: (request) => {
|
|
405
|
+
return fetch(request);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
httpClient.addHook("beforeRequest", (request) => {
|
|
410
|
+
const nextRequest = new Request(request, {
|
|
411
|
+
signal: request.signal || AbortSignal.timeout(5000)
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
nextRequest.headers.set("x-custom-header", "custom value");
|
|
415
|
+
|
|
416
|
+
return nextRequest;
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
httpClient.addHook("requestError", (error, request) => {
|
|
420
|
+
console.group("Request Error");
|
|
421
|
+
console.log("Reason:", `${error}`);
|
|
422
|
+
console.log("Endpoint:", `${request.method} ${request.url}`);
|
|
423
|
+
console.groupEnd();
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
const sdk = new Ominity({
|
|
427
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
428
|
+
security: { apiKey: process.env["OMINITY_API_KEY"] ?? "" },
|
|
429
|
+
httpClient: httpClient,
|
|
430
|
+
});
|
|
431
|
+
```
|
|
432
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
433
|
+
|
|
434
|
+
<!-- Start Debugging [debug] -->
|
|
435
|
+
## Debugging
|
|
436
|
+
|
|
437
|
+
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
438
|
+
|
|
439
|
+
You can pass a logger that matches `console`'s interface as an SDK option.
|
|
440
|
+
|
|
441
|
+
> [!WARNING]
|
|
442
|
+
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
|
|
443
|
+
|
|
444
|
+
```typescript
|
|
445
|
+
import { Ominity } from "@ominity/api-typescript";
|
|
446
|
+
|
|
447
|
+
const sdk = new Ominity({
|
|
448
|
+
serverURL: "https://tenant-a.example.com/api",
|
|
449
|
+
security: { apiKey: process.env["OMINITY_API_KEY"] ?? "" },
|
|
450
|
+
debugLogger: console,
|
|
451
|
+
});
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
You can also enable a default debug logger by setting an environment variable `OMINITY_DEBUG` to true.
|
|
455
|
+
<!-- End Debugging [debug] -->
|
|
456
|
+
|
|
457
|
+
# Development
|
|
458
|
+
|
|
459
|
+
## Maturity
|
|
460
|
+
|
|
461
|
+
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
462
|
+
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
463
|
+
looking for the latest version.
|
|
464
|
+
|
|
465
|
+
## Contributions
|
|
466
|
+
|
|
467
|
+
While we value open-source contributions to this SDK, it is still under active development.
|
|
468
|
+
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
package/RUNTIMES.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Supported JavaScript runtimes
|
|
2
|
+
|
|
3
|
+
This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
|
|
4
|
+
|
|
5
|
+
- [Web Fetch API][web-fetch]
|
|
6
|
+
- [Web Streams API][web-streams] and in particular `ReadableStream`
|
|
7
|
+
- [Async iterables][async-iter] using `Symbol.asyncIterator`
|
|
8
|
+
|
|
9
|
+
[web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
|
10
|
+
[web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
|
|
11
|
+
[async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
|
|
12
|
+
|
|
13
|
+
Runtime environments that are explicitly supported are:
|
|
14
|
+
|
|
15
|
+
- Evergreen browsers which include: Chrome, Safari, Edge, Firefox
|
|
16
|
+
- Node.js active and maintenance LTS releases
|
|
17
|
+
- Currently, this is v18, v20 and v22
|
|
18
|
+
- Bun v1 and above
|
|
19
|
+
- Deno v1.39
|
|
20
|
+
- Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
|
|
21
|
+
|
|
22
|
+
[deno-file-streaming]: https://github.com/denoland/deno/issues/11018
|
|
23
|
+
|
|
24
|
+
## Recommended TypeScript compiler options
|
|
25
|
+
|
|
26
|
+
The following `tsconfig.json` options are recommended for projects using this
|
|
27
|
+
SDK in order to get static type support for features like async iterables,
|
|
28
|
+
streams and `fetch`-related APIs ([`for await...of`][for-await-of],
|
|
29
|
+
[`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
|
|
30
|
+
so on):
|
|
31
|
+
|
|
32
|
+
[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
33
|
+
[abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
34
|
+
[request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
35
|
+
[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
{
|
|
39
|
+
"compilerOptions": {
|
|
40
|
+
"target": "es2020", // or higher
|
|
41
|
+
"lib": ["es2020", "dom", "dom.iterable"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
While `target` can be set to older ECMAScript versions, it may result in extra,
|
|
47
|
+
unnecessary compatibility code being generated if you are not targeting old
|
|
48
|
+
runtimes.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientSDK } from "./lib/sdks.js";
|
|
2
|
+
/**
|
|
3
|
+
* A minimal client to use when calling standalone SDK functions. Typically, an
|
|
4
|
+
* instance of this class would be instantiated once at the start of an
|
|
5
|
+
* application and passed around through some dependency injection mechanism to
|
|
6
|
+
* parts of an application that need to make SDK calls.
|
|
7
|
+
*/
|
|
8
|
+
export declare class OminityCore extends ClientSDK {
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,SAAS;CAAG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OminityCore = void 0;
|
|
4
|
+
const sdks_js_1 = require("./lib/sdks.js");
|
|
5
|
+
/**
|
|
6
|
+
* A minimal client to use when calling standalone SDK functions. Typically, an
|
|
7
|
+
* instance of this class would be instantiated once at the start of an
|
|
8
|
+
* application and passed around through some dependency injection mechanism to
|
|
9
|
+
* parts of an application that need to make SDK calls.
|
|
10
|
+
*/
|
|
11
|
+
class OminityCore extends sdks_js_1.ClientSDK {
|
|
12
|
+
}
|
|
13
|
+
exports.OminityCore = OminityCore;
|
|
14
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":";;;AACA,2CAA0C;AAE1C;;;;;GAKG;AACH,MAAa,WAAY,SAAQ,mBAAS;CAAG;AAA7C,kCAA6C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SDKOptions } from "../lib/config.js";
|
|
2
|
+
import { RequestInput } from "../lib/http.js";
|
|
3
|
+
import { AfterErrorContext, AfterErrorHook, AfterSuccessContext, AfterSuccessHook, BeforeCreateRequestContext, BeforeCreateRequestHook, BeforeRequestContext, BeforeRequestHook, Hooks, SDKInitHook } from "./types.js";
|
|
4
|
+
export declare class SDKHooks implements Hooks {
|
|
5
|
+
sdkInitHooks: SDKInitHook[];
|
|
6
|
+
beforeCreateRequestHooks: BeforeCreateRequestHook[];
|
|
7
|
+
beforeRequestHooks: BeforeRequestHook[];
|
|
8
|
+
afterSuccessHooks: AfterSuccessHook[];
|
|
9
|
+
afterErrorHooks: AfterErrorHook[];
|
|
10
|
+
constructor();
|
|
11
|
+
registerSDKInitHook(hook: SDKInitHook): void;
|
|
12
|
+
registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook): void;
|
|
13
|
+
registerBeforeRequestHook(hook: BeforeRequestHook): void;
|
|
14
|
+
registerAfterSuccessHook(hook: AfterSuccessHook): void;
|
|
15
|
+
registerAfterErrorHook(hook: AfterErrorHook): void;
|
|
16
|
+
sdkInit(opts: SDKOptions): SDKOptions;
|
|
17
|
+
beforeCreateRequest(hookCtx: BeforeCreateRequestContext, input: RequestInput): RequestInput;
|
|
18
|
+
beforeRequest(hookCtx: BeforeRequestContext, request: Request): Promise<Request>;
|
|
19
|
+
afterSuccess(hookCtx: AfterSuccessContext, response: Response): Promise<Response>;
|
|
20
|
+
afterError(hookCtx: AfterErrorContext, response: Response | null, error: unknown): Promise<{
|
|
21
|
+
response: Response | null;
|
|
22
|
+
error: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EAEjB,KAAK,EACL,WAAW,EACZ,MAAM,YAAY,CAAC;AAIpB,qBAAa,QAAS,YAAW,KAAK;IACpC,YAAY,EAAE,WAAW,EAAE,CAAM;IACjC,wBAAwB,EAAE,uBAAuB,EAAE,CAAM;IACzD,kBAAkB,EAAE,iBAAiB,EAAE,CAAM;IAC7C,iBAAiB,EAAE,gBAAgB,EAAE,CAAM;IAC3C,eAAe,EAAE,cAAc,EAAE,CAAM;;IAyBvC,mBAAmB,CAAC,IAAI,EAAE,WAAW;IAIrC,+BAA+B,CAAC,IAAI,EAAE,uBAAuB;IAI7D,yBAAyB,CAAC,IAAI,EAAE,iBAAiB;IAIjD,wBAAwB,CAAC,IAAI,EAAE,gBAAgB;IAI/C,sBAAsB,CAAC,IAAI,EAAE,cAAc;IAI3C,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU;IAIrC,mBAAmB,CACjB,OAAO,EAAE,0BAA0B,EACnC,KAAK,EAAE,YAAY,GAClB,YAAY;IAUT,aAAa,CACjB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,OAAO,CAAC;IAUb,YAAY,CAChB,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,QAAQ,CAAC;IAUd,UAAU,CACd,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,QAAQ,GAAG,IAAI,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC;QAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;CAY1D"}
|