@sima-land/isomorph 11.0.0-alpha.35 → 11.0.0-alpha.37
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/LICENSE +201 -0
- package/README.md +25 -0
- package/dist/cjs/cache/index.js +6 -0
- package/dist/cjs/cache/index.js.map +1 -0
- package/dist/cjs/cache/types.js +6 -0
- package/dist/cjs/cache/types.js.map +1 -0
- package/dist/cjs/config/base.js +22 -0
- package/dist/cjs/config/base.js.map +1 -0
- package/dist/cjs/config/index.js +20 -0
- package/dist/cjs/config/index.js.map +1 -0
- package/dist/cjs/config/source.js +25 -0
- package/dist/cjs/config/source.js.map +1 -0
- package/dist/cjs/config/types.js +6 -0
- package/dist/cjs/config/types.js.map +1 -0
- package/dist/cjs/di/application.js +106 -0
- package/dist/cjs/di/application.js.map +1 -0
- package/dist/cjs/di/container.js +55 -0
- package/dist/cjs/di/container.js.map +1 -0
- package/dist/cjs/di/errors.js +65 -0
- package/dist/cjs/di/errors.js.map +1 -0
- package/dist/cjs/di/index.js +59 -0
- package/dist/cjs/di/index.js.map +1 -0
- package/dist/cjs/di/preset.js +32 -0
- package/dist/cjs/di/preset.js.map +1 -0
- package/dist/cjs/di/token.js +44 -0
- package/dist/cjs/di/token.js.map +1 -0
- package/dist/cjs/di/types.js +6 -0
- package/dist/cjs/di/types.js.map +1 -0
- package/dist/cjs/http/errors.js +47 -0
- package/dist/cjs/http/errors.js.map +1 -0
- package/dist/cjs/http/index.js +63 -0
- package/dist/cjs/http/index.js.map +1 -0
- package/dist/cjs/http/types.js +6 -0
- package/dist/cjs/http/types.js.map +1 -0
- package/dist/cjs/log/errors.js +35 -0
- package/dist/cjs/log/errors.js.map +1 -0
- package/dist/cjs/log/handler/pino.js +31 -0
- package/dist/cjs/log/handler/pino.js.map +1 -0
- package/dist/cjs/log/handler/sentry.js +57 -0
- package/dist/cjs/log/handler/sentry.js.map +1 -0
- package/dist/cjs/log/index.js +26 -0
- package/dist/cjs/log/index.js.map +1 -0
- package/dist/cjs/log/logger.js +35 -0
- package/dist/cjs/log/logger.js.map +1 -0
- package/dist/cjs/log/types.js +6 -0
- package/dist/cjs/log/types.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/preset/isomorphic/constants.js +14 -0
- package/dist/cjs/preset/isomorphic/constants.js.map +1 -0
- package/dist/cjs/preset/isomorphic/providers/index.js +42 -0
- package/dist/cjs/preset/isomorphic/providers/index.js.map +1 -0
- package/dist/cjs/preset/isomorphic/types.js +6 -0
- package/dist/cjs/preset/isomorphic/types.js.map +1 -0
- package/dist/cjs/preset/isomorphic/utils/index.js +322 -0
- package/dist/cjs/preset/isomorphic/utils/index.js.map +1 -0
- package/dist/cjs/preset/node/handler/index.js +52 -0
- package/dist/cjs/preset/node/handler/index.js.map +1 -0
- package/dist/cjs/preset/node/handler/providers/index.js +212 -0
- package/dist/cjs/preset/node/handler/providers/index.js.map +1 -0
- package/dist/cjs/preset/node/handler/utils/index.js +132 -0
- package/dist/cjs/preset/node/handler/utils/index.js.map +1 -0
- package/dist/cjs/preset/node/index.js +26 -0
- package/dist/cjs/preset/node/index.js.map +1 -0
- package/dist/cjs/preset/node/node/index.js +61 -0
- package/dist/cjs/preset/node/node/index.js.map +1 -0
- package/dist/cjs/preset/node/node/providers/index.js +403 -0
- package/dist/cjs/preset/node/node/providers/index.js.map +1 -0
- package/dist/cjs/preset/node/node/utils/http-client/index.js +122 -0
- package/dist/cjs/preset/node/node/utils/http-client/index.js.map +1 -0
- package/dist/cjs/preset/node/node/utils/http-server/index.js +18 -0
- package/dist/cjs/preset/node/node/utils/http-server/index.js.map +1 -0
- package/dist/cjs/preset/node/node/utils/index.js +20 -0
- package/dist/cjs/preset/node/node/utils/index.js.map +1 -0
- package/dist/cjs/preset/web/index.js +34 -0
- package/dist/cjs/preset/web/index.js.map +1 -0
- package/dist/cjs/preset/web/providers/index.js +94 -0
- package/dist/cjs/preset/web/providers/index.js.map +1 -0
- package/dist/cjs/tokens.js +86 -0
- package/dist/cjs/tokens.js.map +1 -0
- package/dist/cjs/utils/axios/index.js +40 -0
- package/dist/cjs/utils/axios/index.js.map +1 -0
- package/dist/cjs/utils/axios/middleware/cookie.js +28 -0
- package/dist/cjs/utils/axios/middleware/cookie.js.map +1 -0
- package/dist/cjs/utils/axios/middleware/log.js +37 -0
- package/dist/cjs/utils/axios/middleware/log.js.map +1 -0
- package/dist/cjs/utils/axios/sauce/index.js +57 -0
- package/dist/cjs/utils/axios/sauce/index.js.map +1 -0
- package/dist/cjs/utils/axios/utils/index.js +30 -0
- package/dist/cjs/utils/axios/utils/index.js.map +1 -0
- package/{http-server → dist/cjs/utils/express}/handler/health-check.js +11 -7
- package/dist/cjs/utils/express/handler/health-check.js.map +1 -0
- package/dist/cjs/utils/express/index.js +20 -0
- package/dist/cjs/utils/express/index.js.map +1 -0
- package/dist/cjs/utils/express/utils/index.js +22 -0
- package/dist/cjs/utils/express/utils/index.js.map +1 -0
- package/dist/cjs/utils/function.js +44 -0
- package/dist/cjs/utils/function.js.map +1 -0
- package/dist/cjs/utils/index.js +20 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/{utils/number.js → dist/cjs/utils/math.js} +7 -5
- package/dist/cjs/utils/math.js.map +1 -0
- package/dist/cjs/utils/react/error-handlers/index.js +80 -0
- package/dist/cjs/utils/react/error-handlers/index.js.map +1 -0
- package/dist/cjs/utils/react/index.js +19 -0
- package/dist/cjs/utils/react/index.js.map +1 -0
- package/dist/cjs/utils/redux/index.js +19 -0
- package/dist/cjs/utils/redux/index.js.map +1 -0
- package/dist/cjs/utils/redux/remote-data.js +118 -0
- package/dist/cjs/utils/redux/remote-data.js.map +1 -0
- package/dist/cjs/utils/redux-saga/index.js +20 -0
- package/dist/cjs/utils/redux-saga/index.js.map +1 -0
- package/dist/cjs/utils/redux-saga/middleware.js +149 -0
- package/dist/cjs/utils/redux-saga/middleware.js.map +1 -0
- package/dist/cjs/utils/redux-saga/take-chain.js +66 -0
- package/dist/cjs/utils/redux-saga/take-chain.js.map +1 -0
- package/dist/cjs/utils/redux-saga/types.js +6 -0
- package/dist/cjs/utils/redux-saga/types.js.map +1 -0
- package/dist/cjs/utils/ssr/index.js +73 -0
- package/dist/cjs/utils/ssr/index.js.map +1 -0
- package/{utils/browser → dist/cjs/utils/web}/analytics/data-layer.js +11 -5
- package/dist/cjs/utils/web/analytics/data-layer.js.map +1 -0
- package/dist/cjs/utils/web/analytics/index.js +20 -0
- package/dist/cjs/utils/web/analytics/index.js.map +1 -0
- package/dist/cjs/utils/web/analytics/oko.js +20 -0
- package/dist/cjs/utils/web/analytics/oko.js.map +1 -0
- package/dist/cjs/utils/web/storage/index.js +75 -0
- package/dist/cjs/utils/web/storage/index.js.map +1 -0
- package/dist/cjs/utils/webpack/env/index.js +96 -0
- package/dist/cjs/utils/webpack/env/index.js.map +1 -0
- package/dist/cjs/utils/webpack/env/types.js +6 -0
- package/dist/cjs/utils/webpack/env/types.js.map +1 -0
- package/dist/cjs/utils/webpack/env/utils.js +55 -0
- package/dist/cjs/utils/webpack/env/utils.js.map +1 -0
- package/dist/cjs/utils/webpack/index.js +20 -0
- package/dist/cjs/utils/webpack/index.js.map +1 -0
- package/dist/cjs/utils/webpack/module-federation/index.js +110 -0
- package/dist/cjs/utils/webpack/module-federation/index.js.map +1 -0
- package/dist/cjs/utils/webpack/module-federation/types.js +6 -0
- package/dist/cjs/utils/webpack/module-federation/types.js.map +1 -0
- package/{utils → dist/cjs/utils}/webpack/module-federation/utils.js +26 -31
- package/dist/cjs/utils/webpack/module-federation/utils.js.map +1 -0
- package/dist/esm/cache/index.js +2 -0
- package/dist/esm/cache/index.js.map +1 -0
- package/dist/esm/cache/types.js +2 -0
- package/dist/esm/cache/types.js.map +1 -0
- package/dist/esm/config/base.js +16 -0
- package/dist/esm/config/base.js.map +1 -0
- package/dist/esm/config/index.js +3 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/config/source.js +19 -0
- package/dist/esm/config/source.js.map +1 -0
- package/dist/esm/config/types.js +2 -0
- package/dist/esm/config/types.js.map +1 -0
- package/dist/esm/di/application.js +100 -0
- package/dist/esm/di/application.js.map +1 -0
- package/dist/esm/di/container.js +49 -0
- package/dist/esm/di/container.js.map +1 -0
- package/dist/esm/di/errors.js +56 -0
- package/dist/esm/di/errors.js.map +1 -0
- package/dist/esm/di/index.js +6 -0
- package/dist/esm/di/index.js.map +1 -0
- package/dist/esm/di/preset.js +26 -0
- package/dist/esm/di/preset.js.map +1 -0
- package/dist/esm/di/token.js +38 -0
- package/dist/esm/di/token.js.map +1 -0
- package/dist/esm/di/types.js +2 -0
- package/dist/esm/di/types.js.map +1 -0
- package/dist/esm/http/errors.js +39 -0
- package/dist/esm/http/errors.js.map +1 -0
- package/dist/esm/http/index.js +4 -0
- package/dist/esm/http/index.js.map +1 -0
- package/dist/esm/http/types.js +2 -0
- package/dist/esm/http/types.js.map +1 -0
- package/dist/esm/log/errors.js +27 -0
- package/dist/esm/log/errors.js.map +1 -0
- package/dist/esm/log/handler/pino.js +25 -0
- package/dist/esm/log/handler/pino.js.map +1 -0
- package/dist/esm/log/handler/sentry.js +52 -0
- package/dist/esm/log/handler/sentry.js.map +1 -0
- package/dist/esm/log/index.js +3 -0
- package/dist/esm/log/index.js.map +1 -0
- package/dist/esm/log/logger.js +29 -0
- package/dist/esm/log/logger.js.map +1 -0
- package/dist/esm/log/types.js +2 -0
- package/dist/esm/log/types.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/preset/isomorphic/constants.js +8 -0
- package/dist/esm/preset/isomorphic/constants.js.map +1 -0
- package/dist/esm/preset/isomorphic/providers/index.js +35 -0
- package/dist/esm/preset/isomorphic/providers/index.js.map +1 -0
- package/dist/esm/preset/isomorphic/types.js +2 -0
- package/dist/esm/preset/isomorphic/types.js.map +1 -0
- package/dist/esm/preset/isomorphic/utils/index.js +309 -0
- package/dist/esm/preset/isomorphic/utils/index.js.map +1 -0
- package/dist/esm/preset/node/handler/index.js +42 -0
- package/dist/esm/preset/node/handler/index.js.map +1 -0
- package/dist/esm/preset/node/handler/providers/index.js +194 -0
- package/dist/esm/preset/node/handler/providers/index.js.map +1 -0
- package/dist/esm/preset/node/handler/utils/index.js +113 -0
- package/dist/esm/preset/node/handler/utils/index.js.map +1 -0
- package/dist/esm/preset/node/index.js +3 -0
- package/dist/esm/preset/node/index.js.map +1 -0
- package/dist/esm/preset/node/node/index.js +56 -0
- package/dist/esm/preset/node/node/index.js.map +1 -0
- package/dist/esm/preset/node/node/providers/index.js +378 -0
- package/dist/esm/preset/node/node/providers/index.js.map +1 -0
- package/dist/esm/preset/node/node/utils/http-client/index.js +114 -0
- package/dist/esm/preset/node/node/utils/http-client/index.js.map +1 -0
- package/dist/esm/preset/node/node/utils/http-server/index.js +12 -0
- package/dist/esm/preset/node/node/utils/http-server/index.js.map +1 -0
- package/dist/esm/preset/node/node/utils/index.js +3 -0
- package/dist/esm/preset/node/node/utils/index.js.map +1 -0
- package/dist/esm/preset/web/index.js +29 -0
- package/dist/esm/preset/web/index.js.map +1 -0
- package/dist/esm/preset/web/providers/index.js +85 -0
- package/dist/esm/preset/web/providers/index.js.map +1 -0
- package/dist/esm/tokens.js +81 -0
- package/dist/esm/tokens.js.map +1 -0
- package/dist/esm/utils/axios/index.js +5 -0
- package/dist/esm/utils/axios/index.js.map +1 -0
- package/dist/esm/utils/axios/middleware/cookie.js +22 -0
- package/dist/esm/utils/axios/middleware/cookie.js.map +1 -0
- package/dist/esm/utils/axios/middleware/log.js +31 -0
- package/dist/esm/utils/axios/middleware/log.js.map +1 -0
- package/dist/esm/utils/axios/sauce/index.js +50 -0
- package/dist/esm/utils/axios/sauce/index.js.map +1 -0
- package/dist/esm/utils/axios/utils/index.js +24 -0
- package/dist/esm/utils/axios/utils/index.js.map +1 -0
- package/dist/esm/utils/express/handler/health-check.js +13 -0
- package/dist/esm/utils/express/handler/health-check.js.map +1 -0
- package/dist/esm/utils/express/index.js +3 -0
- package/dist/esm/utils/express/index.js.map +1 -0
- package/dist/esm/utils/express/utils/index.js +16 -0
- package/dist/esm/utils/express/utils/index.js.map +1 -0
- package/dist/esm/utils/function.js +38 -0
- package/dist/esm/utils/function.js.map +1 -0
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/math.js +9 -0
- package/dist/esm/utils/math.js.map +1 -0
- package/dist/esm/utils/react/error-handlers/index.js +69 -0
- package/dist/esm/utils/react/error-handlers/index.js.map +1 -0
- package/dist/esm/utils/react/index.js +3 -0
- package/dist/esm/utils/react/index.js.map +1 -0
- package/dist/esm/utils/redux/index.js +3 -0
- package/dist/esm/utils/redux/index.js.map +1 -0
- package/dist/esm/utils/redux/remote-data.js +108 -0
- package/dist/esm/utils/redux/remote-data.js.map +1 -0
- package/dist/esm/utils/redux-saga/index.js +3 -0
- package/dist/esm/utils/redux-saga/index.js.map +1 -0
- package/dist/esm/utils/redux-saga/middleware.js +143 -0
- package/dist/esm/utils/redux-saga/middleware.js.map +1 -0
- package/dist/esm/utils/redux-saga/take-chain.js +59 -0
- package/dist/esm/utils/redux-saga/take-chain.js.map +1 -0
- package/dist/esm/utils/redux-saga/types.js +2 -0
- package/dist/esm/utils/redux-saga/types.js.map +1 -0
- package/dist/esm/utils/ssr/index.js +66 -0
- package/dist/esm/utils/ssr/index.js.map +1 -0
- package/dist/esm/utils/web/analytics/data-layer.js +14 -0
- package/dist/esm/utils/web/analytics/data-layer.js.map +1 -0
- package/dist/esm/utils/web/analytics/index.js +3 -0
- package/dist/esm/utils/web/analytics/index.js.map +1 -0
- package/dist/esm/utils/web/analytics/oko.js +14 -0
- package/dist/esm/utils/web/analytics/oko.js.map +1 -0
- package/dist/esm/utils/web/storage/index.js +69 -0
- package/dist/esm/utils/web/storage/index.js.map +1 -0
- package/dist/esm/utils/webpack/env/index.js +89 -0
- package/dist/esm/utils/webpack/env/index.js.map +1 -0
- package/dist/esm/utils/webpack/env/types.js +2 -0
- package/dist/esm/utils/webpack/env/types.js.map +1 -0
- package/dist/esm/utils/webpack/env/utils.js +48 -0
- package/dist/esm/utils/webpack/env/utils.js.map +1 -0
- package/dist/esm/utils/webpack/index.js +4 -0
- package/dist/esm/utils/webpack/index.js.map +1 -0
- package/dist/esm/utils/webpack/module-federation/index.js +96 -0
- package/dist/esm/utils/webpack/module-federation/index.js.map +1 -0
- package/dist/esm/utils/webpack/module-federation/types.js +2 -0
- package/dist/esm/utils/webpack/module-federation/types.js.map +1 -0
- package/dist/esm/utils/webpack/module-federation/utils.js +80 -0
- package/dist/esm/utils/webpack/module-federation/utils.js.map +1 -0
- package/dist/types/cache/index.d.ts +1 -0
- package/{http → dist/types/http}/errors.d.ts +12 -0
- package/{http → dist/types/http}/index.d.ts +2 -2
- package/dist/types/log/index.d.ts +3 -0
- package/dist/types/preset/isomorphic/constants.d.ts +7 -0
- package/dist/types/preset/isomorphic/providers/index.d.ts +22 -0
- package/dist/types/preset/isomorphic/types.d.ts +44 -0
- package/{preset/parts/utils.d.ts → dist/types/preset/isomorphic/utils/index.d.ts} +14 -6
- package/dist/types/preset/node/handler/index.d.ts +10 -0
- package/dist/types/preset/node/handler/providers/index.d.ts +35 -0
- package/dist/types/preset/node/handler/utils/index.d.ts +46 -0
- package/dist/types/preset/node/index.d.ts +2 -0
- package/dist/types/preset/node/node/index.d.ts +8 -0
- package/dist/types/preset/node/node/providers/index.d.ts +112 -0
- package/{http-client/middleware/tracing.d.ts → dist/types/preset/node/node/utils/http-client/index.d.ts} +9 -0
- package/dist/types/preset/node/node/utils/http-server/index.d.ts +7 -0
- package/dist/types/preset/node/node/utils/index.d.ts +2 -0
- package/dist/types/preset/web/index.d.ts +8 -0
- package/dist/types/preset/web/providers/index.d.ts +35 -0
- package/{tokens.d.ts → dist/types/tokens.d.ts} +11 -11
- package/dist/types/utils/axios/index.d.ts +4 -0
- package/dist/types/utils/axios/middleware/cookie.d.ts +8 -0
- package/{http-client → dist/types/utils/axios}/sauce/index.d.ts +1 -1
- package/{http-client/utils.d.ts → dist/types/utils/axios/utils/index.d.ts} +0 -7
- package/dist/types/utils/express/index.d.ts +2 -0
- package/dist/types/utils/express/utils/index.d.ts +7 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/{utils → dist/types/utils}/react/error-handlers/index.d.ts +1 -1
- package/{utils → dist/types/utils}/redux/remote-data.d.ts +8 -8
- package/{utils → dist/types/utils}/ssr/index.d.ts +1 -0
- package/dist/types/utils/web/analytics/index.d.ts +2 -0
- package/dist/types/utils/web/analytics/oko.d.ts +6 -0
- package/{utils/browser → dist/types/utils/web}/storage/index.d.ts +1 -0
- package/{utils → dist/types/utils}/webpack/module-federation/index.d.ts +2 -2
- package/package.json +173 -14
- package/src/cache/index.ts +1 -0
- package/src/cache/types.ts +34 -0
- package/src/config/base.ts +18 -0
- package/src/config/index.ts +3 -0
- package/src/config/source.ts +23 -0
- package/src/config/types.ts +25 -0
- package/src/di/__test__/application.test.ts +258 -0
- package/src/di/__test__/container.test.ts +103 -0
- package/src/di/__test__/errors.test.ts +56 -0
- package/src/di/__test__/preset.test.ts +23 -0
- package/src/di/__test__/token.test.ts +25 -0
- package/src/di/application.ts +126 -0
- package/src/di/container.ts +60 -0
- package/src/di/errors.ts +59 -0
- package/src/di/index.ts +6 -0
- package/src/di/preset.ts +32 -0
- package/src/di/token.ts +41 -0
- package/src/di/types.ts +105 -0
- package/src/http/__test__/errors.test.ts +35 -0
- package/src/http/errors.ts +42 -0
- package/src/http/index.ts +14 -0
- package/src/http/types.ts +8 -0
- package/src/log/__test__/errors.test.ts +13 -0
- package/src/log/__test__/logger.test.ts +24 -0
- package/src/log/errors.ts +33 -0
- package/src/log/handler/pino.ts +27 -0
- package/src/log/handler/sentry.ts +57 -0
- package/src/log/index.ts +12 -0
- package/src/log/logger.ts +30 -0
- package/src/log/types.ts +76 -0
- package/src/preset/isomorphic/constants.ts +7 -0
- package/src/preset/isomorphic/providers/index.ts +40 -0
- package/src/preset/isomorphic/types.ts +48 -0
- package/src/preset/isomorphic/utils/__test__/index.test.ts +541 -0
- package/src/preset/isomorphic/utils/index.ts +349 -0
- package/src/preset/node/handler/index.ts +46 -0
- package/src/preset/node/handler/providers/index.tsx +214 -0
- package/src/preset/node/handler/utils/index.tsx +110 -0
- package/src/preset/node/index.ts +2 -0
- package/src/preset/node/node/index.ts +73 -0
- package/src/preset/node/node/providers/index.ts +434 -0
- package/src/preset/node/node/utils/http-client/__test__/index.test.ts +232 -0
- package/src/preset/node/node/utils/http-client/index.ts +129 -0
- package/src/preset/node/node/utils/http-server/index.ts +17 -0
- package/src/preset/node/node/utils/index.ts +2 -0
- package/src/preset/web/index.ts +40 -0
- package/src/preset/web/providers/index.ts +108 -0
- package/src/tokens.ts +112 -0
- package/src/utils/axios/index.ts +12 -0
- package/src/utils/axios/middleware/__test__/cookie.test.ts +94 -0
- package/src/utils/axios/middleware/__test__/log.test.ts +121 -0
- package/src/utils/axios/middleware/cookie.ts +26 -0
- package/src/utils/axios/middleware/log.ts +52 -0
- package/src/utils/axios/sauce/index.ts +76 -0
- package/src/utils/axios/utils/__test__/index.test.ts +89 -0
- package/src/utils/axios/utils/index.ts +26 -0
- package/src/utils/express/handler/health-check.ts +13 -0
- package/src/utils/express/index.ts +2 -0
- package/src/utils/express/utils/index.ts +18 -0
- package/src/utils/function.ts +57 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/math.ts +8 -0
- package/src/utils/react/error-handlers/__test__/__snapshots__/index.test.tsx.snap +27 -0
- package/src/utils/react/error-handlers/__test__/index.test.tsx +63 -0
- package/src/utils/react/error-handlers/index.tsx +68 -0
- package/src/utils/react/index.ts +3 -0
- package/src/utils/redux/__test__/remote-data.test.ts +172 -0
- package/src/utils/redux/index.ts +4 -0
- package/src/utils/redux/remote-data.ts +138 -0
- package/src/utils/redux-saga/__test__/take-chain.test.ts +141 -0
- package/src/utils/redux-saga/index.ts +3 -0
- package/src/utils/redux-saga/middleware.ts +168 -0
- package/src/utils/redux-saga/take-chain.ts +67 -0
- package/src/utils/redux-saga/types.ts +43 -0
- package/src/utils/ssr/index.tsx +78 -0
- package/src/utils/web/analytics/__test__/data-layer.test.ts +50 -0
- package/src/utils/web/analytics/__test__/oko.test.ts +50 -0
- package/src/utils/web/analytics/data-layer.ts +12 -0
- package/src/utils/web/analytics/index.ts +2 -0
- package/src/utils/web/analytics/oko.ts +14 -0
- package/src/utils/web/storage/index.ts +84 -0
- package/src/utils/webpack/env/index.ts +91 -0
- package/src/utils/webpack/env/types.ts +14 -0
- package/src/utils/webpack/env/utils.ts +53 -0
- package/src/utils/webpack/index.ts +7 -0
- package/src/utils/webpack/module-federation/__test__/__snapshots__/utils.test.ts.snap +124 -0
- package/src/utils/webpack/module-federation/__test__/index.test.ts +311 -0
- package/src/utils/webpack/module-federation/__test__/utils.test.ts +28 -0
- package/src/utils/webpack/module-federation/index.ts +102 -0
- package/src/utils/webpack/module-federation/types.ts +54 -0
- package/src/utils/webpack/module-federation/utils.ts +104 -0
- package/cache/types.js +0 -3
- package/cache/types.js.map +0 -1
- package/config/base.js +0 -20
- package/config/base.js.map +0 -1
- package/config/index.js +0 -8
- package/config/index.js.map +0 -1
- package/config/source.js +0 -21
- package/config/source.js.map +0 -1
- package/config/types.js +0 -3
- package/config/types.js.map +0 -1
- package/di/application.js +0 -88
- package/di/application.js.map +0 -1
- package/di/container.js +0 -52
- package/di/container.js.map +0 -1
- package/di/errors.js +0 -59
- package/di/errors.js.map +0 -1
- package/di/index.js +0 -17
- package/di/index.js.map +0 -1
- package/di/preset.js +0 -27
- package/di/preset.js.map +0 -1
- package/di/token.js +0 -39
- package/di/token.js.map +0 -1
- package/di/types.js +0 -3
- package/di/types.js.map +0 -1
- package/http/errors.js +0 -26
- package/http/errors.js.map +0 -1
- package/http/index.js +0 -14
- package/http/index.js.map +0 -1
- package/http/types.js +0 -3
- package/http/types.js.map +0 -1
- package/http-client/middleware/cookie.d.ts +0 -20
- package/http-client/middleware/cookie.js +0 -64
- package/http-client/middleware/cookie.js.map +0 -1
- package/http-client/middleware/headers.d.ts +0 -13
- package/http-client/middleware/headers.js +0 -25
- package/http-client/middleware/headers.js.map +0 -1
- package/http-client/middleware/log.js +0 -26
- package/http-client/middleware/log.js.map +0 -1
- package/http-client/middleware/tracing.js +0 -80
- package/http-client/middleware/tracing.js.map +0 -1
- package/http-client/sauce/index.js +0 -50
- package/http-client/sauce/index.js.map +0 -1
- package/http-client/types.d.ts +0 -6
- package/http-client/types.js +0 -3
- package/http-client/types.js.map +0 -1
- package/http-client/utils.js +0 -51
- package/http-client/utils.js.map +0 -1
- package/http-server/constants.d.ts +0 -4
- package/http-server/constants.js +0 -8
- package/http-server/constants.js.map +0 -1
- package/http-server/errors.d.ts +0 -11
- package/http-server/errors.js +0 -18
- package/http-server/errors.js.map +0 -1
- package/http-server/handler/health-check.js.map +0 -1
- package/http-server/middleware/tracing.d.ts +0 -14
- package/http-server/middleware/tracing.js +0 -51
- package/http-server/middleware/tracing.js.map +0 -1
- package/http-server/types.d.ts +0 -20
- package/http-server/types.js +0 -3
- package/http-server/types.js.map +0 -1
- package/http-server/utils.d.ts +0 -43
- package/http-server/utils.js +0 -134
- package/http-server/utils.js.map +0 -1
- package/log/errors.js +0 -31
- package/log/errors.js.map +0 -1
- package/log/handler/pino.js +0 -29
- package/log/handler/pino.js.map +0 -1
- package/log/handler/sentry.js +0 -50
- package/log/handler/sentry.js.map +0 -1
- package/log/index.d.ts +0 -3
- package/log/index.js +0 -9
- package/log/index.js.map +0 -1
- package/log/logger.js +0 -29
- package/log/logger.js.map +0 -1
- package/log/types.js +0 -3
- package/log/types.js.map +0 -1
- package/preset/browser/index.d.ts +0 -17
- package/preset/browser/index.js +0 -88
- package/preset/browser/index.js.map +0 -1
- package/preset/node/handler.d.ts +0 -20
- package/preset/node/handler.js +0 -208
- package/preset/node/handler.js.map +0 -1
- package/preset/node/index.d.ts +0 -29
- package/preset/node/index.js +0 -292
- package/preset/node/index.js.map +0 -1
- package/preset/parts/providers.d.ts +0 -7
- package/preset/parts/providers.js +0 -26
- package/preset/parts/providers.js.map +0 -1
- package/preset/parts/types.d.ts +0 -14
- package/preset/parts/types.js +0 -3
- package/preset/parts/types.js.map +0 -1
- package/preset/parts/utils.js +0 -263
- package/preset/parts/utils.js.map +0 -1
- package/tokens.js +0 -82
- package/tokens.js.map +0 -1
- package/utils/browser/analytics/data-layer.js.map +0 -1
- package/utils/browser/analytics/oko.d.ts +0 -13
- package/utils/browser/analytics/oko.js +0 -40
- package/utils/browser/analytics/oko.js.map +0 -1
- package/utils/browser/storage/index.js +0 -68
- package/utils/browser/storage/index.js.map +0 -1
- package/utils/function.js +0 -23
- package/utils/function.js.map +0 -1
- package/utils/number.js.map +0 -1
- package/utils/react/error-handlers/index.js +0 -47
- package/utils/react/error-handlers/index.js.map +0 -1
- package/utils/react/index.js +0 -7
- package/utils/react/index.js.map +0 -1
- package/utils/redux/index.js +0 -7
- package/utils/redux/index.js.map +0 -1
- package/utils/redux/remote-data.js +0 -91
- package/utils/redux/remote-data.js.map +0 -1
- package/utils/redux-saga/index.js +0 -8
- package/utils/redux-saga/index.js.map +0 -1
- package/utils/redux-saga/middleware.js +0 -142
- package/utils/redux-saga/middleware.js.map +0 -1
- package/utils/redux-saga/take-chain.js +0 -58
- package/utils/redux-saga/take-chain.js.map +0 -1
- package/utils/redux-saga/types.js +0 -3
- package/utils/redux-saga/types.js.map +0 -1
- package/utils/ssr/index.js +0 -54
- package/utils/ssr/index.js.map +0 -1
- package/utils/webpack/env/index.js +0 -76
- package/utils/webpack/env/index.js.map +0 -1
- package/utils/webpack/env/types.js +0 -3
- package/utils/webpack/env/types.js.map +0 -1
- package/utils/webpack/env/utils.js +0 -52
- package/utils/webpack/env/utils.js.map +0 -1
- package/utils/webpack/index.js +0 -8
- package/utils/webpack/index.js.map +0 -1
- package/utils/webpack/module-federation/index.js +0 -81
- package/utils/webpack/module-federation/index.js.map +0 -1
- package/utils/webpack/module-federation/types.js +0 -3
- package/utils/webpack/module-federation/types.js.map +0 -1
- package/utils/webpack/module-federation/utils.js.map +0 -1
- /package/{cache → dist/types/cache}/types.d.ts +0 -0
- /package/{config → dist/types/config}/base.d.ts +0 -0
- /package/{config → dist/types/config}/index.d.ts +0 -0
- /package/{config → dist/types/config}/source.d.ts +0 -0
- /package/{config → dist/types/config}/types.d.ts +0 -0
- /package/{di → dist/types/di}/application.d.ts +0 -0
- /package/{di → dist/types/di}/container.d.ts +0 -0
- /package/{di → dist/types/di}/errors.d.ts +0 -0
- /package/{di → dist/types/di}/index.d.ts +0 -0
- /package/{di → dist/types/di}/preset.d.ts +0 -0
- /package/{di → dist/types/di}/token.d.ts +0 -0
- /package/{di → dist/types/di}/types.d.ts +0 -0
- /package/{http → dist/types/http}/types.d.ts +0 -0
- /package/{log → dist/types/log}/errors.d.ts +0 -0
- /package/{log → dist/types/log}/handler/pino.d.ts +0 -0
- /package/{log → dist/types/log}/handler/sentry.d.ts +0 -0
- /package/{log → dist/types/log}/logger.d.ts +0 -0
- /package/{log → dist/types/log}/types.d.ts +0 -0
- /package/{http-client → dist/types/utils/axios}/middleware/log.d.ts +0 -0
- /package/{http-server → dist/types/utils/express}/handler/health-check.d.ts +0 -0
- /package/{utils → dist/types/utils}/function.d.ts +0 -0
- /package/{utils/number.d.ts → dist/types/utils/math.d.ts} +0 -0
- /package/{utils → dist/types/utils}/react/index.d.ts +0 -0
- /package/{utils → dist/types/utils}/redux/index.d.ts +0 -0
- /package/{utils → dist/types/utils}/redux-saga/index.d.ts +0 -0
- /package/{utils → dist/types/utils}/redux-saga/middleware.d.ts +0 -0
- /package/{utils → dist/types/utils}/redux-saga/take-chain.d.ts +0 -0
- /package/{utils → dist/types/utils}/redux-saga/types.d.ts +0 -0
- /package/{utils/browser → dist/types/utils/web}/analytics/data-layer.d.ts +0 -0
- /package/{utils → dist/types/utils}/webpack/env/index.d.ts +0 -0
- /package/{utils → dist/types/utils}/webpack/env/types.d.ts +0 -0
- /package/{utils → dist/types/utils}/webpack/env/utils.d.ts +0 -0
- /package/{utils → dist/types/utils}/webpack/index.d.ts +0 -0
- /package/{utils → dist/types/utils}/webpack/module-federation/types.d.ts +0 -0
- /package/{utils → dist/types/utils}/webpack/module-federation/utils.d.ts +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AlreadyBoundError", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _errors.AlreadyBoundError;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "CURRENT_APP", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _application.CURRENT_APP;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "CircularDependencyError", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _errors.CircularDependencyError;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "NothingBoundError", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _errors.NothingBoundError;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "createApplication", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _application.createApplication;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "createContainer", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _container.createContainer;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "createPreset", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _preset.createPreset;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "createToken", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _token.createToken;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var _errors = require("./errors");
|
|
55
|
+
var _token = require("./token");
|
|
56
|
+
var _container = require("./container");
|
|
57
|
+
var _preset = require("./preset");
|
|
58
|
+
var _application = require("./application");
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_errors","require","_token","_container","_preset","_application"],"sources":["../../../src/di/index.ts"],"sourcesContent":["export type { Token, Resolve, Provider, Container, Application, Preset } from './types';\nexport { NothingBoundError, CircularDependencyError, AlreadyBoundError } from './errors';\nexport { createToken } from './token';\nexport { createContainer } from './container';\nexport { createPreset } from './preset';\nexport { createApplication, CURRENT_APP } from './application';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createPreset = createPreset;
|
|
7
|
+
/* eslint-disable require-jsdoc, jsdoc/require-jsdoc */
|
|
8
|
+
|
|
9
|
+
class PresetImplementation {
|
|
10
|
+
constructor(defaults) {
|
|
11
|
+
this.registry = new Map(defaults);
|
|
12
|
+
}
|
|
13
|
+
set(token, provider) {
|
|
14
|
+
this.registry.set(token, provider);
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
apply(app) {
|
|
18
|
+
for (const [token, provider] of this.registry) {
|
|
19
|
+
app.bind(token).toProvider(provider);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Возвращает новый "preset" для DI-приложения - набор предустановленных компонентов которые можно переопределять.
|
|
26
|
+
* @param defaults Предустановленные зависимости.
|
|
27
|
+
* @return Preset.
|
|
28
|
+
*/
|
|
29
|
+
function createPreset(defaults) {
|
|
30
|
+
return new PresetImplementation(defaults);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.js","names":["PresetImplementation","constructor","defaults","registry","Map","set","token","provider","apply","app","bind","toProvider","createPreset"],"sources":["../../../src/di/preset.ts"],"sourcesContent":["/* eslint-disable require-jsdoc, jsdoc/require-jsdoc */\nimport type { Application, Provider, Token, Preset } from './types';\n\ntype PresetEntry<T = any> = [Token<T>, Provider<T>];\n\nclass PresetImplementation implements Preset {\n private registry: Map<Token<any>, Provider<any>>;\n\n constructor(defaults?: Iterable<PresetEntry>) {\n this.registry = new Map<Token<any>, Provider<any>>(defaults);\n }\n\n set<T>(token: Token<T>, provider: Provider<T>): this {\n this.registry.set(token, provider);\n return this;\n }\n\n apply(app: Application): void {\n for (const [token, provider] of this.registry) {\n app.bind(token).toProvider(provider);\n }\n }\n}\n\n/**\n * Возвращает новый \"preset\" для DI-приложения - набор предустановленных компонентов которые можно переопределять.\n * @param defaults Предустановленные зависимости.\n * @return Preset.\n */\nexport function createPreset(defaults?: PresetEntry[]): Preset {\n return new PresetImplementation(defaults);\n}\n"],"mappings":";;;;;;AAAA;;AAKA,MAAMA,oBAAoB,CAAmB;EAG3CC,WAAWA,CAACC,QAAgC,EAAE;IAC5C,IAAI,CAACC,QAAQ,GAAG,IAAIC,GAAG,CAA4BF,QAAQ,CAAC;EAC9D;EAEAG,GAAGA,CAAIC,KAAe,EAAEC,QAAqB,EAAQ;IACnD,IAAI,CAACJ,QAAQ,CAACE,GAAG,CAACC,KAAK,EAAEC,QAAQ,CAAC;IAClC,OAAO,IAAI;EACb;EAEAC,KAAKA,CAACC,GAAgB,EAAQ;IAC5B,KAAK,MAAM,CAACH,KAAK,EAAEC,QAAQ,CAAC,IAAI,IAAI,CAACJ,QAAQ,EAAE;MAC7CM,GAAG,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,UAAU,CAACJ,QAAQ,CAAC;IACtC;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASK,YAAYA,CAACV,QAAwB,EAAU;EAC7D,OAAO,IAAIF,oBAAoB,CAACE,QAAQ,CAAC;AAC3C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createToken = createToken;
|
|
7
|
+
/**
|
|
8
|
+
* Реализация токена.
|
|
9
|
+
*/
|
|
10
|
+
class TokenImplementation {
|
|
11
|
+
/**
|
|
12
|
+
* Конструктор.
|
|
13
|
+
* @param name Имя для отладки.
|
|
14
|
+
*/
|
|
15
|
+
constructor(name) {
|
|
16
|
+
this._key = Symbol(name);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Получив реестр вернет из него нужный компонент.
|
|
21
|
+
* @param registry Реестр.
|
|
22
|
+
* @return Компонент.
|
|
23
|
+
*/
|
|
24
|
+
_resolve(registry) {
|
|
25
|
+
return registry.get(this._key);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @inheritdoc
|
|
30
|
+
*/
|
|
31
|
+
toString() {
|
|
32
|
+
return `Token(${this._key.description ?? 'unknown'})`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Возвращает новый токен.
|
|
38
|
+
* @param name Имя токена для отладки в случае ошибок.
|
|
39
|
+
* @return Токен.
|
|
40
|
+
*/
|
|
41
|
+
function createToken(name) {
|
|
42
|
+
return new TokenImplementation(name);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","names":["TokenImplementation","constructor","name","_key","Symbol","_resolve","registry","get","toString","description","createToken"],"sources":["../../../src/di/token.ts"],"sourcesContent":["import { Token } from './types';\n\n/**\n * Реализация токена.\n */\nclass TokenImplementation<T = never> implements Token<T> {\n readonly _key: symbol;\n\n /**\n * Конструктор.\n * @param name Имя для отладки.\n */\n constructor(name?: string) {\n this._key = Symbol(name);\n }\n\n /**\n * Получив реестр вернет из него нужный компонент.\n * @param registry Реестр.\n * @return Компонент.\n */\n _resolve(registry: Map<symbol, any>): T {\n return registry.get(this._key);\n }\n\n /**\n * @inheritdoc\n */\n toString(): string {\n return `Token(${this._key.description ?? 'unknown'})`;\n }\n}\n\n/**\n * Возвращает новый токен.\n * @param name Имя токена для отладки в случае ошибок.\n * @return Токен.\n */\nexport function createToken<T = never>(name?: string): Token<T> {\n return new TokenImplementation(name);\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA,MAAMA,mBAAmB,CAAgC;EAGvD;AACF;AACA;AACA;EACEC,WAAWA,CAACC,IAAa,EAAE;IACzB,IAAI,CAACC,IAAI,GAAGC,MAAM,CAACF,IAAI,CAAC;EAC1B;;EAEA;AACF;AACA;AACA;AACA;EACEG,QAAQA,CAACC,QAA0B,EAAK;IACtC,OAAOA,QAAQ,CAACC,GAAG,CAAC,IAAI,CAACJ,IAAI,CAAC;EAChC;;EAEA;AACF;AACA;EACEK,QAAQA,CAAA,EAAW;IACjB,OAAQ,SAAQ,IAAI,CAACL,IAAI,CAACM,WAAW,IAAI,SAAU,GAAE;EACvD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAYR,IAAa,EAAY;EAC9D,OAAO,IAAIF,mBAAmB,CAACE,IAAI,CAAC;AACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/di/types.ts"],"sourcesContent":["/**\n * Токен - ключ который можно использовать для привязки реализации и получения компонента из контейнера.\n * За токеном можно закрепить интерфейс. В дальнейшем это поможет нне ошибиться при привязке реализации.\n */\nexport interface Token<T> {\n readonly _key: symbol;\n readonly _resolve: (registry: Map<symbol, any>) => T;\n}\n\n/**\n * Резолвер. Получив токен вернет реализацию интерфейса, который за ним закреплён.\n */\nexport interface Resolve {\n <T>(token: Token<T>): T;\n}\n\n/**\n * Провайдер - функция, которая, получив резолвер, должна вернуть реализацию интерфейса.\n */\nexport interface Provider<T> {\n (resolve: Resolve): T;\n}\n\n/**\n * DI-контейнер.\n * Позволяет зарегистрировать за токеном компонент в виде функции-провайдера и в дальнейшем получить его по токену.\n */\nexport interface Container {\n /**\n * Регистрирует провайдер.\n */\n set: <T = never>(token: Token<T>, provider: Provider<T>) => void;\n\n get: Resolve;\n}\n\n/**\n * Интерфейс привязки компонента к токену.\n */\nexport interface Binding<T> {\n /**\n * Привязывает к токену конкретное \"статическое\" значение.\n */\n toValue: (value: T) => void;\n\n /**\n * Привязывает к токену функцию-провайдер.\n */\n toProvider: (provider: Provider<T>) => void;\n}\n\n/** @internal */\nexport type ExtractType<T extends readonly Token<any>[]> = {\n [index in keyof T]: T[index] extends T[number] ? ReturnType<T[index]['_resolve']> : never;\n};\n\n/**\n * DI-Приложение. Расширенная версия DI-контейнера.\n * Позволяет применять пресеты, задавать \"родительские\" приложения, вызывать callback-функции с инъекцией компонентов.\n */\nexport interface Application {\n /**\n * Добавляет пресет к приложению. Пресет будет применен в момент первой попытки получить компонент или вызвать функцию.\n */\n preset(preset: Preset): void;\n\n /**\n * Получив приложение, пометит его как \"родительское\".\n * При попытке достать компонент, в случае если его нет в текущем приложении, будет произведена попытка найти его в \"родительском\".\n */\n attach(parent: Application): void;\n\n /**\n * Аналог метода set у Container. Получив токен вернет интерфейс привязки реализации.\n * @param token Токен.\n */\n bind<T>(token: Token<T>): Binding<T>;\n\n /**\n * Получив токен, вернет его реализацию если она была зарегистрирована.\n * @param token Токен.\n */\n get<T>(token: Token<T>): T;\n\n /**\n * Получив список токенов и callback-функцию, вызовет функцию с компонентами по соответствующим токенам.\n */\n invoke<Tokens extends readonly Token<any>[]>(\n tokens: [...Tokens],\n fn: (...args: ExtractType<Tokens>) => void,\n ): void;\n}\n\n/**\n * Пресет - набор провайдеров (с возможностью их добавлять/переопределять) который можно применить к DI-приложению.\n */\nexport interface Preset {\n /** Добавляет провайдер в пресет. */\n set: <T>(token: Token<T>, provider: Provider<T>) => this;\n\n /** Применяет пресет к переданному приложению. */\n apply: (app: Application) => void;\n\n // @todo preventExtensions()\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StatusError = exports.ResponseError = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Ошибка валидации статуса ответа.
|
|
9
|
+
* @todo Переименовать в HttpStatusValidationError?
|
|
10
|
+
*/
|
|
11
|
+
class StatusError extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* @param response Ответ.
|
|
14
|
+
*/
|
|
15
|
+
constructor(response) {
|
|
16
|
+
super(`HTTP Request failed with status ${response.status}`);
|
|
17
|
+
this.name = 'StatusError';
|
|
18
|
+
this.response = response;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Определяет, является ли переданное значение ошибкой валидации статуса.
|
|
23
|
+
* @param value Значение.
|
|
24
|
+
* @return Результат.
|
|
25
|
+
*/
|
|
26
|
+
static is(value) {
|
|
27
|
+
return value?.name === 'StatusError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Ошибка в процессе формирования ответа.
|
|
33
|
+
*/
|
|
34
|
+
exports.StatusError = StatusError;
|
|
35
|
+
class ResponseError extends Error {
|
|
36
|
+
/**
|
|
37
|
+
* @param message Сообщение.
|
|
38
|
+
* @param statusCode Код ответа.
|
|
39
|
+
*/
|
|
40
|
+
constructor(message, statusCode = 500) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = 'ResponseError';
|
|
43
|
+
this.statusCode = statusCode;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.ResponseError = ResponseError;
|
|
47
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","names":["StatusError","Error","constructor","response","status","name","is","value","exports","ResponseError","message","statusCode"],"sources":["../../../src/http/errors.ts"],"sourcesContent":["/**\n * Ошибка валидации статуса ответа.\n * @todo Переименовать в HttpStatusValidationError?\n */\nexport class StatusError extends Error {\n readonly response: Response;\n\n /**\n * @param response Ответ.\n */\n constructor(response: Response) {\n super(`HTTP Request failed with status ${response.status}`);\n this.name = 'StatusError';\n this.response = response;\n }\n\n /**\n * Определяет, является ли переданное значение ошибкой валидации статуса.\n * @param value Значение.\n * @return Результат.\n */\n static is(value: unknown): value is StatusError {\n return (value as any)?.name === 'StatusError';\n }\n}\n\n/**\n * Ошибка в процессе формирования ответа.\n */\nexport class ResponseError extends Error {\n statusCode: number;\n\n /**\n * @param message Сообщение.\n * @param statusCode Код ответа.\n */\n constructor(message: string, statusCode = 500) {\n super(message);\n this.name = 'ResponseError';\n this.statusCode = statusCode;\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,WAAW,SAASC,KAAK,CAAC;EAGrC;AACF;AACA;EACEC,WAAWA,CAACC,QAAkB,EAAE;IAC9B,KAAK,CAAE,mCAAkCA,QAAQ,CAACC,MAAO,EAAC,CAAC;IAC3D,IAAI,CAACC,IAAI,GAAG,aAAa;IACzB,IAAI,CAACF,QAAQ,GAAGA,QAAQ;EAC1B;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOG,EAAEA,CAACC,KAAc,EAAwB;IAC9C,OAAQA,KAAK,EAAUF,IAAI,KAAK,aAAa;EAC/C;AACF;;AAEA;AACA;AACA;AAFAG,OAAA,CAAAR,WAAA,GAAAA,WAAA;AAGO,MAAMS,aAAa,SAASR,KAAK,CAAC;EAGvC;AACF;AACA;AACA;EACEC,WAAWA,CAACQ,OAAe,EAAEC,UAAU,GAAG,GAAG,EAAE;IAC7C,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACL,IAAI,GAAG,eAAe;IAC3B,IAAI,CAACM,UAAU,GAAGA,UAAU;EAC9B;AACF;AAACH,OAAA,CAAAC,aAAA,GAAAA,aAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ResponseError", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _errors.ResponseError;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "StatusError", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _errors.StatusError;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "applyMiddleware", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _fetchTools.applyMiddleware;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "configureFetch", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _fetchTools.configureFetch;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "cookie", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _middleware.cookie;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "createCookieStore", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _fetchTools.createCookieStore;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "defaultHeaders", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _middleware.defaultHeaders;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "log", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _middleware.log;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "validateStatus", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _middleware.validateStatus;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var _fetchTools = require("@krutoo/fetch-tools");
|
|
61
|
+
var _middleware = require("@krutoo/fetch-tools/middleware");
|
|
62
|
+
var _errors = require("./errors");
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_fetchTools","require","_middleware","_errors"],"sources":["../../../src/http/index.ts"],"sourcesContent":["export type {\n Handler,\n Enhancer,\n Middleware,\n LogData,\n DoneLogData,\n FailLogData,\n LogHandler,\n LogHandlerFactory,\n CookieStore,\n} from './types';\nexport { configureFetch, applyMiddleware, createCookieStore } from '@krutoo/fetch-tools';\nexport { log, cookie, defaultHeaders, validateStatus } from '@krutoo/fetch-tools/middleware';\nexport { StatusError, ResponseError } from './errors';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/http/types.ts"],"sourcesContent":["export type { Handler, Enhancer, Middleware, CookieStore } from '@krutoo/fetch-tools';\nexport type {\n LogData,\n DoneLogData,\n FailLogData,\n LogHandler,\n LogHandlerFactory,\n} from '@krutoo/fetch-tools/middleware';\n"],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DetailedError = exports.Breadcrumb = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Ошибка с данными.
|
|
9
|
+
*/
|
|
10
|
+
class DetailedError extends Error {
|
|
11
|
+
/**
|
|
12
|
+
* @param message Сообщение.
|
|
13
|
+
* @param data Данные.
|
|
14
|
+
*/
|
|
15
|
+
constructor(message, data = {}) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.data = data;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Хлебная крошка.
|
|
23
|
+
*/
|
|
24
|
+
exports.DetailedError = DetailedError;
|
|
25
|
+
class Breadcrumb {
|
|
26
|
+
/**
|
|
27
|
+
* @param data Данные.
|
|
28
|
+
*/
|
|
29
|
+
constructor(data) {
|
|
30
|
+
this.type = 'breadcrumb';
|
|
31
|
+
this.data = data;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.Breadcrumb = Breadcrumb;
|
|
35
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","names":["DetailedError","Error","constructor","message","data","exports","Breadcrumb","type"],"sources":["../../../src/log/errors.ts"],"sourcesContent":["import { ErrorDetails, BreadcrumbDetails } from './types';\n\n/**\n * Ошибка с данными.\n */\nexport class DetailedError extends Error {\n data: ErrorDetails;\n\n /**\n * @param message Сообщение.\n * @param data Данные.\n */\n constructor(message?: string, data: ErrorDetails = {}) {\n super(message);\n this.data = data;\n }\n}\n\n/**\n * Хлебная крошка.\n */\nexport class Breadcrumb {\n type: string;\n data: BreadcrumbDetails;\n\n /**\n * @param data Данные.\n */\n constructor(data: BreadcrumbDetails) {\n this.type = 'breadcrumb';\n this.data = data;\n }\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACO,MAAMA,aAAa,SAASC,KAAK,CAAC;EAGvC;AACF;AACA;AACA;EACEC,WAAWA,CAACC,OAAgB,EAAEC,IAAkB,GAAG,CAAC,CAAC,EAAE;IACrD,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAGA,IAAI;EAClB;AACF;;AAEA;AACA;AACA;AAFAC,OAAA,CAAAL,aAAA,GAAAA,aAAA;AAGO,MAAMM,UAAU,CAAC;EAItB;AACF;AACA;EACEJ,WAAWA,CAACE,IAAuB,EAAE;IACnC,IAAI,CAACG,IAAI,GAAG,YAAY;IACxB,IAAI,CAACH,IAAI,GAAGA,IAAI;EAClB;AACF;AAACC,OAAA,CAAAC,UAAA,GAAAA,UAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createPinoHandler = createPinoHandler;
|
|
7
|
+
/**
|
|
8
|
+
* Возвращает новый handler для logger'а для вывода событий в терминал.
|
|
9
|
+
* @param pinoInstance Конфиг.
|
|
10
|
+
* @return Handler.
|
|
11
|
+
*/
|
|
12
|
+
function createPinoHandler(pinoInstance) {
|
|
13
|
+
return function pinoHandler(event) {
|
|
14
|
+
switch (event.type) {
|
|
15
|
+
case 'log':
|
|
16
|
+
case 'info':
|
|
17
|
+
pinoInstance.info(event.data);
|
|
18
|
+
break;
|
|
19
|
+
case 'warn':
|
|
20
|
+
pinoInstance.warn(event.data);
|
|
21
|
+
break;
|
|
22
|
+
case 'debug':
|
|
23
|
+
pinoInstance.debug(event.data);
|
|
24
|
+
break;
|
|
25
|
+
case 'error':
|
|
26
|
+
pinoInstance.error(event.data);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=pino.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pino.js","names":["createPinoHandler","pinoInstance","pinoHandler","event","type","info","data","warn","debug","error"],"sources":["../../../../src/log/handler/pino.ts"],"sourcesContent":["import type { LogHandler } from '../types';\nimport type pino from 'pino';\n\n/**\n * Возвращает новый handler для logger'а для вывода событий в терминал.\n * @param pinoInstance Конфиг.\n * @return Handler.\n */\nexport function createPinoHandler(pinoInstance: pino.Logger): LogHandler {\n return function pinoHandler(event) {\n switch (event.type) {\n case 'log':\n case 'info':\n pinoInstance.info(event.data);\n break;\n case 'warn':\n pinoInstance.warn(event.data);\n break;\n case 'debug':\n pinoInstance.debug(event.data);\n break;\n case 'error':\n pinoInstance.error(event.data);\n break;\n }\n };\n}\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAiBA,CAACC,YAAyB,EAAc;EACvE,OAAO,SAASC,WAAWA,CAACC,KAAK,EAAE;IACjC,QAAQA,KAAK,CAACC,IAAI;MAChB,KAAK,KAAK;MACV,KAAK,MAAM;QACTH,YAAY,CAACI,IAAI,CAACF,KAAK,CAACG,IAAI,CAAC;QAC7B;MACF,KAAK,MAAM;QACTL,YAAY,CAACM,IAAI,CAACJ,KAAK,CAACG,IAAI,CAAC;QAC7B;MACF,KAAK,OAAO;QACVL,YAAY,CAACO,KAAK,CAACL,KAAK,CAACG,IAAI,CAAC;QAC9B;MACF,KAAK,OAAO;QACVL,YAAY,CAACQ,KAAK,CAACN,KAAK,CAACG,IAAI,CAAC;QAC9B;IACJ;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSentryHandler = createSentryHandler;
|
|
7
|
+
var _log = require("../../log");
|
|
8
|
+
/**
|
|
9
|
+
* Возвращает новый handler для logger'а для отправки событий в Sentry.
|
|
10
|
+
* @param hubInit Sentry Hub или функция которая его вернёт.
|
|
11
|
+
* @return Handler.
|
|
12
|
+
*/
|
|
13
|
+
function createSentryHandler(hubInit) {
|
|
14
|
+
const getHub = typeof hubInit === 'function' ? hubInit : () => hubInit;
|
|
15
|
+
return event => {
|
|
16
|
+
// ВАЖНО: каждый входящий http-запрос должен иметь свой собственный hub
|
|
17
|
+
// подробности: https://github.com/getsentry/sentry-javascript/discussions/5648
|
|
18
|
+
// поэтому если передана функция - вызываем каждый раз (внутри обработчика)
|
|
19
|
+
const hub = getHub();
|
|
20
|
+
|
|
21
|
+
// error
|
|
22
|
+
if (event.type === 'error') {
|
|
23
|
+
const error = event.data;
|
|
24
|
+
if (error instanceof _log.DetailedError) {
|
|
25
|
+
const {
|
|
26
|
+
level,
|
|
27
|
+
context,
|
|
28
|
+
extra
|
|
29
|
+
} = error.data;
|
|
30
|
+
hub.withScope(scope => {
|
|
31
|
+
if (level) {
|
|
32
|
+
scope.setLevel(level);
|
|
33
|
+
}
|
|
34
|
+
if (context) {
|
|
35
|
+
const list = Array.isArray(context) ? context : [context];
|
|
36
|
+
for (const item of list) {
|
|
37
|
+
scope.setContext(item.key, item.data);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (extra) {
|
|
41
|
+
scope.setExtra(extra.key, extra.data);
|
|
42
|
+
}
|
|
43
|
+
hub.captureException(error);
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
hub.captureException(error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// breadcrumb
|
|
51
|
+
if (event.data instanceof _log.Breadcrumb) {
|
|
52
|
+
const breadcrumb = event.data.data;
|
|
53
|
+
hub.addBreadcrumb(breadcrumb);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=sentry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.js","names":["_log","require","createSentryHandler","hubInit","getHub","event","hub","type","error","data","DetailedError","level","context","extra","withScope","scope","setLevel","list","Array","isArray","item","setContext","key","setExtra","captureException","Breadcrumb","breadcrumb","addBreadcrumb"],"sources":["../../../../src/log/handler/sentry.ts"],"sourcesContent":["import type { LogHandler } from '../types';\nimport type { Hub } from '@sentry/types';\nimport { Breadcrumb, DetailedError } from '../../log';\n\n/**\n * Возвращает новый handler для logger'а для отправки событий в Sentry.\n * @param hubInit Sentry Hub или функция которая его вернёт.\n * @return Handler.\n */\nexport function createSentryHandler(hubInit: Hub | (() => Hub)): LogHandler {\n const getHub = typeof hubInit === 'function' ? hubInit : () => hubInit;\n\n return event => {\n // ВАЖНО: каждый входящий http-запрос должен иметь свой собственный hub\n // подробности: https://github.com/getsentry/sentry-javascript/discussions/5648\n // поэтому если передана функция - вызываем каждый раз (внутри обработчика)\n const hub = getHub();\n\n // error\n if (event.type === 'error') {\n const error = event.data;\n\n if (error instanceof DetailedError) {\n const { level, context, extra } = error.data;\n\n hub.withScope(scope => {\n if (level) {\n scope.setLevel(level);\n }\n\n if (context) {\n const list = Array.isArray(context) ? context : [context];\n\n for (const item of list) {\n scope.setContext(item.key, item.data);\n }\n }\n\n if (extra) {\n scope.setExtra(extra.key, extra.data);\n }\n\n hub.captureException(error);\n });\n } else {\n hub.captureException(error);\n }\n }\n\n // breadcrumb\n if (event.data instanceof Breadcrumb) {\n const breadcrumb = event.data.data;\n\n hub.addBreadcrumb(breadcrumb);\n }\n };\n}\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAACC,OAA0B,EAAc;EAC1E,MAAMC,MAAM,GAAG,OAAOD,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,MAAMA,OAAO;EAEtE,OAAOE,KAAK,IAAI;IACd;IACA;IACA;IACA,MAAMC,GAAG,GAAGF,MAAM,CAAC,CAAC;;IAEpB;IACA,IAAIC,KAAK,CAACE,IAAI,KAAK,OAAO,EAAE;MAC1B,MAAMC,KAAK,GAAGH,KAAK,CAACI,IAAI;MAExB,IAAID,KAAK,YAAYE,kBAAa,EAAE;QAClC,MAAM;UAAEC,KAAK;UAAEC,OAAO;UAAEC;QAAM,CAAC,GAAGL,KAAK,CAACC,IAAI;QAE5CH,GAAG,CAACQ,SAAS,CAACC,KAAK,IAAI;UACrB,IAAIJ,KAAK,EAAE;YACTI,KAAK,CAACC,QAAQ,CAACL,KAAK,CAAC;UACvB;UAEA,IAAIC,OAAO,EAAE;YACX,MAAMK,IAAI,GAAGC,KAAK,CAACC,OAAO,CAACP,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC;YAEzD,KAAK,MAAMQ,IAAI,IAAIH,IAAI,EAAE;cACvBF,KAAK,CAACM,UAAU,CAACD,IAAI,CAACE,GAAG,EAAEF,IAAI,CAACX,IAAI,CAAC;YACvC;UACF;UAEA,IAAII,KAAK,EAAE;YACTE,KAAK,CAACQ,QAAQ,CAACV,KAAK,CAACS,GAAG,EAAET,KAAK,CAACJ,IAAI,CAAC;UACvC;UAEAH,GAAG,CAACkB,gBAAgB,CAAChB,KAAK,CAAC;QAC7B,CAAC,CAAC;MACJ,CAAC,MAAM;QACLF,GAAG,CAACkB,gBAAgB,CAAChB,KAAK,CAAC;MAC7B;IACF;;IAEA;IACA,IAAIH,KAAK,CAACI,IAAI,YAAYgB,eAAU,EAAE;MACpC,MAAMC,UAAU,GAAGrB,KAAK,CAACI,IAAI,CAACA,IAAI;MAElCH,GAAG,CAACqB,aAAa,CAACD,UAAU,CAAC;IAC/B;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Breadcrumb", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _errors.Breadcrumb;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DetailedError", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _errors.DetailedError;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "createLogger", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _logger.createLogger;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _logger = require("./logger");
|
|
25
|
+
var _errors = require("./errors");
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_logger","require","_errors"],"sources":["../../../src/log/index.ts"],"sourcesContent":["export type {\n Logger,\n LogEvent,\n LogLevel,\n LogHandler,\n ErrorDetails,\n BreadcrumbDetails,\n ContextData,\n} from './types';\n\nexport { createLogger } from './logger';\nexport { DetailedError, Breadcrumb } from './errors';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createLogger = createLogger;
|
|
7
|
+
/**
|
|
8
|
+
* Возвращает новый logger - объект для журналирования событий подобно console.
|
|
9
|
+
* @return Logger.
|
|
10
|
+
*/
|
|
11
|
+
function createLogger() {
|
|
12
|
+
const handlers = [];
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line require-jsdoc, jsdoc/require-jsdoc
|
|
15
|
+
const createMethod = type => data => {
|
|
16
|
+
const event = {
|
|
17
|
+
type,
|
|
18
|
+
data
|
|
19
|
+
};
|
|
20
|
+
for (const handler of handlers) {
|
|
21
|
+
handler(event);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
log: createMethod('log'),
|
|
26
|
+
info: createMethod('info'),
|
|
27
|
+
warn: createMethod('warn'),
|
|
28
|
+
error: createMethod('error'),
|
|
29
|
+
debug: createMethod('debug'),
|
|
30
|
+
subscribe: handler => {
|
|
31
|
+
handlers.push(handler);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","names":["createLogger","handlers","createMethod","type","data","event","handler","log","info","warn","error","debug","subscribe","push"],"sources":["../../../src/log/logger.ts"],"sourcesContent":["import type { Logger, LogEvent, LogLevel, LogHandler } from './types';\n\n/**\n * Возвращает новый logger - объект для журналирования событий подобно console.\n * @return Logger.\n */\nexport function createLogger(): Logger {\n const handlers: LogHandler[] = [];\n\n // eslint-disable-next-line require-jsdoc, jsdoc/require-jsdoc\n const createMethod = (type: LogLevel) => (data: any) => {\n const event: LogEvent = { type, data };\n\n for (const handler of handlers) {\n handler(event);\n }\n };\n\n return {\n log: createMethod('log'),\n info: createMethod('info'),\n warn: createMethod('warn'),\n error: createMethod('error'),\n debug: createMethod('debug'),\n\n subscribe: handler => {\n handlers.push(handler);\n },\n };\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,YAAYA,CAAA,EAAW;EACrC,MAAMC,QAAsB,GAAG,EAAE;;EAEjC;EACA,MAAMC,YAAY,GAAIC,IAAc,IAAMC,IAAS,IAAK;IACtD,MAAMC,KAAe,GAAG;MAAEF,IAAI;MAAEC;IAAK,CAAC;IAEtC,KAAK,MAAME,OAAO,IAAIL,QAAQ,EAAE;MAC9BK,OAAO,CAACD,KAAK,CAAC;IAChB;EACF,CAAC;EAED,OAAO;IACLE,GAAG,EAAEL,YAAY,CAAC,KAAK,CAAC;IACxBM,IAAI,EAAEN,YAAY,CAAC,MAAM,CAAC;IAC1BO,IAAI,EAAEP,YAAY,CAAC,MAAM,CAAC;IAC1BQ,KAAK,EAAER,YAAY,CAAC,OAAO,CAAC;IAC5BS,KAAK,EAAET,YAAY,CAAC,OAAO,CAAC;IAE5BU,SAAS,EAAEN,OAAO,IAAI;MACpBL,QAAQ,CAACY,IAAI,CAACP,OAAO,CAAC;IACxB;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/log/types.ts"],"sourcesContent":["import type { SeverityLevel, Context, Extra, Breadcrumb } from '@sentry/types';\n\n/**\n * Тип события.\n */\nexport type LogLevel = 'error' | 'log' | 'info' | 'warn' | 'debug';\n\n/**\n * Интерфейс события.\n */\nexport interface LogEvent {\n type: LogLevel;\n data: unknown;\n}\n\n/**\n * Интерфейс функции-обработчика события.\n */\nexport interface LogHandler {\n (event: LogEvent): void;\n}\n\n/**\n * Logger.\n * Поддерживает наиболее распространенные события жизненного цикла программы.\n */\nexport interface Logger {\n error(data: any): void;\n log(data: any): void;\n info(data: any): void;\n warn(data: any): void;\n debug(data: any): void;\n\n // @todo вынести в интерфейс SubscribableLogger?\n subscribe(handler: LogHandler): void;\n}\n\n/**\n * Контекст ошибки.\n */\nexport interface ContextData {\n key: string;\n data: Context | null;\n}\n\n/**\n * Детали ошибки.\n */\nexport interface ErrorDetails {\n level?: SeverityLevel;\n\n context?: ContextData | ContextData[];\n\n extra?: {\n key: string;\n data: Extra | null;\n };\n}\n\n/**\n * Детали хлебной крошки.\n */\nexport type BreadcrumbDetails = Breadcrumb;\n\n/**\n * Структура данных, которую необходимо выводить в терминал по соглашению внутри компании.\n * @todo Убрать в preset'ы.\n */\nexport interface ConventionalFluentInfo {\n version: string;\n latency: number;\n method: string;\n remote_ip: string;\n route: string;\n status: number;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RESPONSE_EVENT_TYPE = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* События в процессе ответа на запрос.
|
|
9
|
+
*/
|
|
10
|
+
const RESPONSE_EVENT_TYPE = exports.RESPONSE_EVENT_TYPE = {
|
|
11
|
+
renderStart: Symbol('render:start'),
|
|
12
|
+
renderFinish: Symbol('render:finish')
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["RESPONSE_EVENT_TYPE","exports","renderStart","Symbol","renderFinish"],"sources":["../../../../src/preset/isomorphic/constants.ts"],"sourcesContent":["/**\n * События в процессе ответа на запрос.\n */\nexport const RESPONSE_EVENT_TYPE = {\n renderStart: Symbol('render:start'),\n renderFinish: Symbol('render:finish'),\n} as const;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EACjCE,WAAW,EAAEC,MAAM,CAAC,cAAc,CAAC;EACnCC,YAAY,EAAED,MAAM,CAAC,eAAe;AACtC,CAAU"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.provideBaseConfig = provideBaseConfig;
|
|
7
|
+
exports.provideHttpClientLogHandler = provideHttpClientLogHandler;
|
|
8
|
+
exports.provideSagaMiddleware = provideSagaMiddleware;
|
|
9
|
+
var _base = require("../../../config/base");
|
|
10
|
+
var _tokens = require("../../../tokens");
|
|
11
|
+
var _reduxSaga = require("../../../utils/redux-saga");
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
/**
|
|
14
|
+
* Провайдер базовой конфигурации приложения.
|
|
15
|
+
* @param resolve Функция для получения зависимости по токену.
|
|
16
|
+
* @return Базовая конфигурация.
|
|
17
|
+
*/
|
|
18
|
+
function provideBaseConfig(resolve) {
|
|
19
|
+
const source = resolve(_tokens.KnownToken.Config.source);
|
|
20
|
+
return (0, _base.createBaseConfig)(source);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Провайдер кастомной версии createSagaMiddleware из redux-saga.
|
|
25
|
+
* @param resolve Функция для получения зависимости по токену.
|
|
26
|
+
* @return Промежуточный слой для redux-хранилища.
|
|
27
|
+
*/
|
|
28
|
+
function provideSagaMiddleware(resolve) {
|
|
29
|
+
const logger = resolve(_tokens.KnownToken.logger);
|
|
30
|
+
return (0, _reduxSaga.createSagaMiddleware)(new _utils.SagaLogging(logger));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Провайдер обработчика логирования исходящих http-запросов.
|
|
35
|
+
* @param resolve Функция для получения зависимости по токену.
|
|
36
|
+
* @return Обработчик.
|
|
37
|
+
*/
|
|
38
|
+
function provideHttpClientLogHandler(resolve) {
|
|
39
|
+
const logger = resolve(_tokens.KnownToken.logger);
|
|
40
|
+
return data => new _utils.HttpClientLogging(logger, data);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_base","require","_tokens","_reduxSaga","_utils","provideBaseConfig","resolve","source","KnownToken","Config","createBaseConfig","provideSagaMiddleware","logger","createSagaMiddleware","SagaLogging","provideHttpClientLogHandler","data","HttpClientLogging"],"sources":["../../../../../src/preset/isomorphic/providers/index.ts"],"sourcesContent":["import { createBaseConfig } from '../../../config/base';\nimport { BaseConfig } from '../../../config/types';\nimport { Resolve } from '../../../di';\nimport { LogMiddlewareHandlerInit } from '../../../utils/axios/middleware/log';\nimport { KnownToken } from '../../../tokens';\nimport { createSagaMiddleware, SagaExtendedMiddleware } from '../../../utils/redux-saga';\nimport { HttpClientLogging, SagaLogging } from '../utils';\n\n/**\n * Провайдер базовой конфигурации приложения.\n * @param resolve Функция для получения зависимости по токену.\n * @return Базовая конфигурация.\n */\nexport function provideBaseConfig(resolve: Resolve): BaseConfig {\n const source = resolve(KnownToken.Config.source);\n\n return createBaseConfig(source);\n}\n\n/**\n * Провайдер кастомной версии createSagaMiddleware из redux-saga.\n * @param resolve Функция для получения зависимости по токену.\n * @return Промежуточный слой для redux-хранилища.\n */\nexport function provideSagaMiddleware(resolve: Resolve): SagaExtendedMiddleware {\n const logger = resolve(KnownToken.logger);\n\n return createSagaMiddleware(new SagaLogging(logger));\n}\n\n/**\n * Провайдер обработчика логирования исходящих http-запросов.\n * @param resolve Функция для получения зависимости по токену.\n * @return Обработчик.\n */\nexport function provideHttpClientLogHandler(resolve: Resolve): LogMiddlewareHandlerInit {\n const logger = resolve(KnownToken.logger);\n\n return data => new HttpClientLogging(logger, data);\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASI,iBAAiBA,CAACC,OAAgB,EAAc;EAC9D,MAAMC,MAAM,GAAGD,OAAO,CAACE,kBAAU,CAACC,MAAM,CAACF,MAAM,CAAC;EAEhD,OAAO,IAAAG,sBAAgB,EAACH,MAAM,CAAC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASI,qBAAqBA,CAACL,OAAgB,EAA0B;EAC9E,MAAMM,MAAM,GAAGN,OAAO,CAACE,kBAAU,CAACI,MAAM,CAAC;EAEzC,OAAO,IAAAC,+BAAoB,EAAC,IAAIC,kBAAW,CAACF,MAAM,CAAC,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,2BAA2BA,CAACT,OAAgB,EAA4B;EACtF,MAAMM,MAAM,GAAGN,OAAO,CAACE,kBAAU,CAACI,MAAM,CAAC;EAEzC,OAAOI,IAAI,IAAI,IAAIC,wBAAiB,CAACL,MAAM,EAAEI,IAAI,CAAC;AACpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/preset/isomorphic/types.ts"],"sourcesContent":["import type { Provider, Token } from '../../di';\nimport type { Request, Response, NextFunction } from 'express';\n\nexport interface PresetTuner {\n (tools: { override: <T>(token: Token<T>, provider: Provider<T>) => void }): void;\n}\n\nexport type KnownHttpApiKey = 'ilium' | 'simaV3' | 'simaV4' | 'simaV6';\n\n/**\n * Строгая версия Map без возможности добавлять/удалять.\n */\nexport interface StrictMap<Key extends string> {\n /** Возвращает значение по ключу. */\n get(key: Key): string;\n}\n\n/**\n * Контекст обработчика express.\n * @todo Перенести!\n */\nexport interface HandlerContext {\n req: Request;\n res: Response;\n next: NextFunction;\n}\n\n/**\n * Внутренний интерфейс для хранения ссылок на ассеты.\n */\nexport interface PageAssets {\n js: string;\n css: string;\n criticalJs?: string;\n criticalCss?: string;\n}\n\n/**\n * Структура ответа от frontend-микросервиса в формате JSON по соглашению.\n */\nexport interface ConventionalJson {\n markup: string;\n bundle_js: string;\n bundle_css: string;\n critical_js?: string;\n critical_css?: string;\n meta?: any;\n}\n"],"mappings":""}
|