@cyberskill/shared 1.209.0 → 1.211.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/commitlint/index.cjs +1 -0
- package/dist/config/config.type.cjs +1 -0
- package/dist/config/config.type.js +4 -0
- package/dist/config/config.util.cjs +1 -0
- package/dist/config/config.util.js +58 -0
- package/dist/config/env/env.constant.cjs +1 -0
- package/dist/config/env/env.util.cjs +1 -0
- package/dist/config/env/env.util.js +29 -0
- package/dist/config/env/index.cjs +1 -0
- package/dist/config/eslint/index.cjs +1 -0
- package/dist/config/eslint/index.js +26 -0
- package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -0
- package/dist/config/graphql-codegen/graphql-codegen.util.js +42 -0
- package/dist/config/graphql-codegen/index.cjs +1 -0
- package/dist/config/index.cjs +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/lint-staged/index.cjs +1 -0
- package/dist/config/vitest/index.cjs +1 -0
- package/dist/config/vitest/vitest.e2e.cjs +1 -0
- package/dist/config/vitest/vitest.e2e.js +30 -0
- package/dist/config/vitest/vitest.unit.cjs +1 -0
- package/dist/config/vitest/vitest.unit.js +26 -0
- package/dist/constant/common.cjs +1 -0
- package/dist/constant/common.js +4 -0
- package/dist/constant/index.cjs +1 -0
- package/dist/constant/response-status.cjs +1 -0
- package/dist/node/apollo-server/apollo-server.util.cjs +1 -0
- package/dist/node/apollo-server/apollo-server.util.js +56 -0
- package/dist/node/apollo-server/index.cjs +1 -0
- package/dist/node/cli/index.cjs +6 -0
- package/dist/node/cli/index.js +160 -0
- package/dist/node/command/command.type.cjs +1 -0
- package/dist/node/command/command.type.js +4 -0
- package/dist/node/command/command.util.cjs +2 -0
- package/dist/node/command/command.util.js +175 -0
- package/dist/node/command/index.cjs +1 -0
- package/dist/node/command/index.js +11 -0
- package/dist/node/express/express.util.cjs +1 -0
- package/dist/node/express/express.util.js +81 -0
- package/dist/node/express/index.cjs +1 -0
- package/dist/node/fs/fs.util.cjs +1 -0
- package/dist/node/fs/fs.util.js +63 -0
- package/dist/node/fs/index.cjs +1 -0
- package/dist/node/log/index.cjs +1 -0
- package/dist/node/log/index.js +8 -0
- package/dist/node/log/log.type.cjs +1 -0
- package/dist/node/log/log.type.js +4 -0
- package/dist/node/log/log.util.cjs +1 -0
- package/dist/node/log/log.util.js +60 -0
- package/dist/node/mongo/index.cjs +1 -0
- package/dist/node/mongo/index.js +17 -0
- package/dist/node/mongo/mongo.constant.cjs +1 -0
- package/dist/node/mongo/mongo.type.cjs +1 -0
- package/dist/node/mongo/mongo.type.js +16 -0
- package/dist/node/mongo/mongo.util.cjs +5 -0
- package/dist/node/mongo/mongo.util.js +556 -0
- package/dist/node/package/index.cjs +1 -0
- package/dist/node/package/index.js +10 -0
- package/dist/node/package/package.type.cjs +1 -0
- package/dist/node/package/package.type.js +4 -0
- package/dist/node/package/package.util.cjs +1 -0
- package/dist/node/package/package.util.js +254 -0
- package/dist/node/path/index.cjs +1 -0
- package/dist/node/path/index.js +52 -0
- package/dist/node/path/path.constant.cjs +1 -0
- package/dist/node/path/path.constant.js +295 -0
- package/dist/node/path/path.util.cjs +1 -0
- package/dist/node/storage/index.cjs +1 -0
- package/dist/node/storage/storage.util.cjs +1 -0
- package/dist/node/storage/storage.util.js +81 -0
- package/dist/node/upload/index.cjs +1 -0
- package/dist/node/upload/index.js +7 -0
- package/dist/node/upload/upload.type.cjs +1 -0
- package/dist/node/upload/upload.type.js +4 -0
- package/dist/node/upload/upload.util.cjs +1 -0
- package/dist/node/upload/upload.util.js +154 -0
- package/dist/node/ws/index.cjs +1 -0
- package/dist/node/ws/ts.util.cjs +1 -0
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.13_@vitest_browser@3.2.4_jiti@2.4.2_j_cac3da623d5688a51c0b1a2270e144db/node_modules/vitest/dist/config.cjs +1 -0
- package/dist/{config-CwzVfkkX.js → node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.13_@vitest_browser@3.2.4_jiti@2.4.2_j_cac3da623d5688a51c0b1a2270e144db/node_modules/vitest/dist/config.js} +1 -1
- package/dist/react/apollo-client/apollo-client.component.cjs +1 -0
- package/dist/{src/react → react}/apollo-client/apollo-client.component.js +9 -12
- package/dist/react/apollo-client/apollo-client.constant.cjs +1 -0
- package/dist/react/apollo-client/apollo-client.context.cjs +1 -0
- package/dist/{src/react → react}/apollo-client/apollo-client.context.js +2 -2
- package/dist/react/apollo-client/apollo-client.util.cjs +1 -0
- package/dist/react/apollo-client/apollo-client.util.js +111 -0
- package/dist/react/apollo-client/index.cjs +1 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs +1 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +21 -0
- package/dist/react/apollo-client-nextjs/index.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.component.cjs +1 -0
- package/dist/{src/react → react}/apollo-error/apollo-error.component.js +5 -12
- package/dist/react/apollo-error/apollo-error.context.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.hook.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.module.scss.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.module.scss.js +11 -0
- package/dist/react/apollo-error/apollo-error.provider.cjs +1 -0
- package/dist/{src/react → react}/apollo-error/apollo-error.provider.js +2 -2
- package/dist/react/apollo-error/apollo-error.util.cjs +1 -0
- package/dist/{src/react → react}/apollo-error/apollo-error.util.js +1 -1
- package/dist/react/apollo-error/index.cjs +1 -0
- package/dist/react/i18next/i18next.hook.cjs +1 -0
- package/dist/react/i18next/i18next.util.cjs +1 -0
- package/dist/react/i18next/index.cjs +1 -0
- package/dist/react/loading/index.cjs +1 -0
- package/dist/react/loading/loading.component.cjs +6 -0
- package/dist/react/loading/loading.component.js +51 -0
- package/dist/react/loading/loading.context.cjs +1 -0
- package/dist/react/loading/loading.hook.cjs +1 -0
- package/dist/react/loading/loading.module.scss.cjs +1 -0
- package/dist/react/loading/loading.module.scss.js +15 -0
- package/dist/react/loading/loading.provider.cjs +1 -0
- package/dist/react/loading/loading.provider.js +17 -0
- package/dist/react/log/index.cjs +1 -0
- package/dist/react/log/log.util.cjs +1 -0
- package/dist/{src/react → react}/log/log.util.js +4 -4
- package/dist/react/next-intl/index.cjs +1 -0
- package/dist/react/next-intl/next-intl.constant.cjs +1 -0
- package/dist/react/next-intl/next-intl.context.cjs +1 -0
- package/dist/react/next-intl/next-intl.hoc.cjs +1 -0
- package/dist/react/next-intl/next-intl.hoc.js +32 -0
- package/dist/react/next-intl/next-intl.hook.cjs +1 -0
- package/dist/react/next-intl/next-intl.provider.cjs +1 -0
- package/dist/react/next-intl/next-intl.provider.js +23 -0
- package/dist/react/storage/index.cjs +1 -0
- package/dist/react/storage/storage.hook.cjs +1 -0
- package/dist/react/storage/storage.hook.js +77 -0
- package/dist/react/storage/storage.util.cjs +1 -0
- package/dist/react/storage/storage.util.js +60 -0
- package/dist/react/toast/index.cjs +1 -0
- package/dist/react/userback/index.cjs +1 -0
- package/dist/react/userback/userback.component.cjs +1 -0
- package/dist/react/userback/userback.component.js +51 -0
- package/dist/style.css +1 -1
- package/dist/typescript/common.type.cjs +1 -0
- package/dist/typescript/index.cjs +1 -0
- package/dist/typescript/index.js +4 -0
- package/dist/util/common/common.util.cjs +1 -0
- package/dist/util/common/common.util.js +56 -0
- package/dist/util/common/index.cjs +1 -0
- package/dist/util/index.cjs +1 -0
- package/dist/util/object/index.cjs +1 -0
- package/dist/util/object/object.util.cjs +1 -0
- package/dist/util/object/object.util.js +73 -0
- package/dist/util/serializer/index.cjs +1 -0
- package/dist/util/serializer/serializer.util.cjs +1 -0
- package/dist/util/string/index.cjs +1 -0
- package/dist/util/string/string.util.cjs +1 -0
- package/dist/util/string/string.util.js +61 -0
- package/dist/util/validate/index.cjs +1 -0
- package/dist/util/validate/validate.util.cjs +1 -0
- package/package.json +103 -69
- package/dist/index-BG1UznTl.js +0 -628
- package/dist/magic-string.es-BQ9KnLz-.js +0 -659
- package/dist/src/config/config.util.js +0 -50
- package/dist/src/config/env/env.util.js +0 -29
- package/dist/src/config/eslint/index.js +0 -18
- package/dist/src/config/graphql-codegen/graphql-codegen.util.js +0 -37
- package/dist/src/config/index.js +0 -5
- package/dist/src/config/vitest/vitest.e2e.js +0 -23
- package/dist/src/config/vitest/vitest.unit.js +0 -19
- package/dist/src/config/vitest/vitest.unit.setup.js +0 -30990
- package/dist/src/constant/common.js +0 -4
- package/dist/src/node/apollo-server/apollo-server.util.js +0 -31
- package/dist/src/node/cli/index.js +0 -108
- package/dist/src/node/command/command.util.js +0 -16
- package/dist/src/node/command/index.js +0 -10
- package/dist/src/node/express/express.util.js +0 -50
- package/dist/src/node/fs/fs.util.js +0 -48
- package/dist/src/node/log/index.js +0 -8
- package/dist/src/node/log/log.util.js +0 -59
- package/dist/src/node/mongo/index.js +0 -26
- package/dist/src/node/mongo/mongo.util.js +0 -488
- package/dist/src/node/package/index.js +0 -9
- package/dist/src/node/package/package.util.js +0 -13
- package/dist/src/node/path/index.js +0 -52
- package/dist/src/node/path/path.constant.js +0 -49
- package/dist/src/node/storage/storage.util.js +0 -51
- package/dist/src/node/upload/index.js +0 -6
- package/dist/src/node/upload/upload.util.js +0 -127
- package/dist/src/react/apollo-client/apollo-client.hook.js +0 -11
- package/dist/src/react/apollo-client/apollo-client.util.js +0 -101
- package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.util.js +0 -14
- package/dist/src/react/loading/loading.component.js +0 -40
- package/dist/src/react/loading/loading.provider.js +0 -17
- package/dist/src/react/next-intl/next-intl.hoc.js +0 -23
- package/dist/src/react/next-intl/next-intl.provider.js +0 -24
- package/dist/src/react/storage/storage.hook.js +0 -61
- package/dist/src/react/storage/storage.util.js +0 -35
- package/dist/src/react/userback/userback.component.js +0 -27
- package/dist/src/typescript/style.d.js +0 -1
- package/dist/src/util/common/common.util.js +0 -48
- package/dist/src/util/object/object.util.js +0 -67
- package/dist/src/util/string/string.util.js +0 -51
- /package/dist/{src/config → config}/commitlint/index.d.ts +0 -0
- /package/dist/{src/config → config}/commitlint/index.js +0 -0
- /package/dist/{src/config → config}/config.type.d.ts +0 -0
- /package/dist/{src/config → config}/config.util.d.ts +0 -0
- /package/dist/{src/config → config}/env/env.constant.d.ts +0 -0
- /package/dist/{src/config → config}/env/env.constant.js +0 -0
- /package/dist/{src/config → config}/env/env.type.d.ts +0 -0
- /package/dist/{src/config → config}/env/env.util.d.ts +0 -0
- /package/dist/{src/config → config}/env/index.d.ts +0 -0
- /package/dist/{src/config → config}/env/index.js +0 -0
- /package/dist/{src/config → config}/eslint/index.d.ts +0 -0
- /package/dist/{src/config → config}/graphql-codegen/graphql-codegen.type.d.ts +0 -0
- /package/dist/{src/config → config}/graphql-codegen/graphql-codegen.util.d.ts +0 -0
- /package/dist/{src/config → config}/graphql-codegen/index.d.ts +0 -0
- /package/dist/{src/config → config}/graphql-codegen/index.js +0 -0
- /package/dist/{src/config → config}/index.d.ts +0 -0
- /package/dist/{src/config → config}/lint-staged/index.d.ts +0 -0
- /package/dist/{src/config → config}/lint-staged/index.js +0 -0
- /package/dist/{src/config → config}/vitest/index.d.ts +0 -0
- /package/dist/{src/config → config}/vitest/index.js +0 -0
- /package/dist/{src/config → config}/vitest/vitest.e2e.d.ts +0 -0
- /package/dist/{src/config → config}/vitest/vitest.unit.d.ts +0 -0
- /package/dist/{src/constant → constant}/common.d.ts +0 -0
- /package/dist/{src/constant → constant}/index.d.ts +0 -0
- /package/dist/{src/constant → constant}/index.js +0 -0
- /package/dist/{src/constant → constant}/response-status.d.ts +0 -0
- /package/dist/{src/constant → constant}/response-status.js +0 -0
- /package/dist/{src/node → node}/apollo-server/apollo-server.type.d.ts +0 -0
- /package/dist/{src/node → node}/apollo-server/apollo-server.util.d.ts +0 -0
- /package/dist/{src/node → node}/apollo-server/index.d.ts +0 -0
- /package/dist/{src/node → node}/apollo-server/index.js +0 -0
- /package/dist/{src/node → node}/cli/index.d.ts +0 -0
- /package/dist/{src/node → node}/command/command.type.d.ts +0 -0
- /package/dist/{src/node → node}/command/command.util.d.ts +0 -0
- /package/dist/{src/node → node}/command/index.d.ts +0 -0
- /package/dist/{src/node → node}/express/express.type.d.ts +0 -0
- /package/dist/{src/node → node}/express/express.util.d.ts +0 -0
- /package/dist/{src/node → node}/express/index.d.ts +0 -0
- /package/dist/{src/node → node}/express/index.js +0 -0
- /package/dist/{src/node → node}/fs/fs.type.d.ts +0 -0
- /package/dist/{src/node → node}/fs/fs.util.d.ts +0 -0
- /package/dist/{src/node → node}/fs/index.d.ts +0 -0
- /package/dist/{src/node → node}/fs/index.js +0 -0
- /package/dist/{src/node → node}/log/index.d.ts +0 -0
- /package/dist/{src/node → node}/log/log.type.d.ts +0 -0
- /package/dist/{src/node → node}/log/log.util.d.ts +0 -0
- /package/dist/{src/node → node}/mongo/index.d.ts +0 -0
- /package/dist/{src/node → node}/mongo/mongo.constant.d.ts +0 -0
- /package/dist/{src/node → node}/mongo/mongo.constant.js +0 -0
- /package/dist/{src/node → node}/mongo/mongo.type.d.ts +0 -0
- /package/dist/{src/node → node}/mongo/mongo.util.d.ts +0 -0
- /package/dist/{src/node → node}/package/index.d.ts +0 -0
- /package/dist/{src/node → node}/package/package.type.d.ts +0 -0
- /package/dist/{src/node → node}/package/package.util.d.ts +0 -0
- /package/dist/{src/node → node}/path/index.d.ts +0 -0
- /package/dist/{src/node → node}/path/path.constant.d.ts +0 -0
- /package/dist/{src/node → node}/path/path.util.d.ts +0 -0
- /package/dist/{src/node → node}/path/path.util.js +0 -0
- /package/dist/{src/node → node}/storage/index.d.ts +0 -0
- /package/dist/{src/node → node}/storage/index.js +0 -0
- /package/dist/{src/node → node}/storage/storage.util.d.ts +0 -0
- /package/dist/{src/node → node}/upload/index.d.ts +0 -0
- /package/dist/{src/node → node}/upload/upload.type.d.ts +0 -0
- /package/dist/{src/node → node}/upload/upload.util.d.ts +0 -0
- /package/dist/{src/node → node}/ws/index.d.ts +0 -0
- /package/dist/{src/node → node}/ws/index.js +0 -0
- /package/dist/{src/node → node}/ws/ts.util.d.ts +0 -0
- /package/dist/{src/node → node}/ws/ts.util.js +0 -0
- /package/dist/{src/node → node}/ws/ws.type.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client/apollo-client.component.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client/apollo-client.constant.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client/apollo-client.constant.js +0 -0
- /package/dist/{src/react → react}/apollo-client/apollo-client.context.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client/apollo-client.hook.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client/apollo-client.type.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client/apollo-client.util.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client/index.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client/index.js +0 -0
- /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.component.js +0 -0
- /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.rsc.js +0 -0
- /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.util.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client-nextjs/index.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-client-nextjs/index.js +0 -0
- /package/dist/{src/react → react}/apollo-error/apollo-error.component.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-error/apollo-error.context.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-error/apollo-error.context.js +0 -0
- /package/dist/{src/react → react}/apollo-error/apollo-error.hook.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-error/apollo-error.hook.js +0 -0
- /package/dist/{src/react → react}/apollo-error/apollo-error.provider.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-error/apollo-error.type.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-error/apollo-error.util.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-error/index.d.ts +0 -0
- /package/dist/{src/react → react}/apollo-error/index.js +0 -0
- /package/dist/{src/react → react}/i18next/i18next.hook.d.ts +0 -0
- /package/dist/{src/react → react}/i18next/i18next.hook.js +0 -0
- /package/dist/{src/react → react}/i18next/i18next.util.d.ts +0 -0
- /package/dist/{src/react → react}/i18next/i18next.util.js +0 -0
- /package/dist/{src/react → react}/i18next/index.d.ts +0 -0
- /package/dist/{src/react → react}/i18next/index.js +0 -0
- /package/dist/{src/react → react}/loading/index.d.ts +0 -0
- /package/dist/{src/react → react}/loading/index.js +0 -0
- /package/dist/{src/react → react}/loading/loading.component.d.ts +0 -0
- /package/dist/{src/react → react}/loading/loading.context.d.ts +0 -0
- /package/dist/{src/react → react}/loading/loading.context.js +0 -0
- /package/dist/{src/react → react}/loading/loading.hook.d.ts +0 -0
- /package/dist/{src/react → react}/loading/loading.hook.js +0 -0
- /package/dist/{src/react → react}/loading/loading.provider.d.ts +0 -0
- /package/dist/{src/react → react}/loading/loading.type.d.ts +0 -0
- /package/dist/{src/react → react}/log/index.d.ts +0 -0
- /package/dist/{src/react → react}/log/index.js +0 -0
- /package/dist/{src/react → react}/log/log.type.d.ts +0 -0
- /package/dist/{src/react → react}/log/log.util.d.ts +0 -0
- /package/dist/{src/react → react}/next-intl/index.d.ts +0 -0
- /package/dist/{src/react → react}/next-intl/index.js +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.constant.d.ts +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.constant.js +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.context.d.ts +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.context.js +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.hoc.d.ts +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.hook.d.ts +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.hook.js +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.provider.d.ts +0 -0
- /package/dist/{src/react → react}/next-intl/next-intl.type.d.ts +0 -0
- /package/dist/{src/react → react}/storage/index.d.ts +0 -0
- /package/dist/{src/react → react}/storage/index.js +0 -0
- /package/dist/{src/react → react}/storage/storage.hook.d.ts +0 -0
- /package/dist/{src/react → react}/storage/storage.util.d.ts +0 -0
- /package/dist/{src/react → react}/toast/index.d.ts +0 -0
- /package/dist/{src/react → react}/toast/index.js +0 -0
- /package/dist/{src/react → react}/userback/index.d.ts +0 -0
- /package/dist/{src/react → react}/userback/index.js +0 -0
- /package/dist/{src/react → react}/userback/userback.component.d.ts +0 -0
- /package/dist/{src/react → react}/userback/userback.type.d.ts +0 -0
- /package/dist/{src/typescript → typescript}/common.type.d.ts +0 -0
- /package/dist/{src/typescript/index.js → typescript/common.type.js} +0 -0
- /package/dist/{src/typescript → typescript}/index.d.ts +0 -0
- /package/dist/{src/typescript → typescript}/react.type.d.ts +0 -0
- /package/dist/{src/util → util}/common/common.type.d.ts +0 -0
- /package/dist/{src/util → util}/common/common.util.d.ts +0 -0
- /package/dist/{src/util → util}/common/index.d.ts +0 -0
- /package/dist/{src/util → util}/common/index.js +0 -0
- /package/dist/{src/util → util}/index.d.ts +0 -0
- /package/dist/{src/util → util}/index.js +0 -0
- /package/dist/{src/util → util}/object/index.d.ts +0 -0
- /package/dist/{src/util → util}/object/index.js +0 -0
- /package/dist/{src/util → util}/object/object.util.d.ts +0 -0
- /package/dist/{src/util → util}/serializer/index.d.ts +0 -0
- /package/dist/{src/util → util}/serializer/index.js +0 -0
- /package/dist/{src/util → util}/serializer/serializer.type.d.ts +0 -0
- /package/dist/{src/util → util}/serializer/serializer.util.d.ts +0 -0
- /package/dist/{src/util → util}/serializer/serializer.util.js +0 -0
- /package/dist/{src/util → util}/string/index.d.ts +0 -0
- /package/dist/{src/util → util}/string/index.js +0 -0
- /package/dist/{src/util → util}/string/string.type.d.ts +0 -0
- /package/dist/{src/util → util}/string/string.util.d.ts +0 -0
- /package/dist/{src/util → util}/validate/index.d.ts +0 -0
- /package/dist/{src/util → util}/validate/index.js +0 -0
- /package/dist/{src/util → util}/validate/validate.util.d.ts +0 -0
- /package/dist/{src/util → util}/validate/validate.util.js +0 -0
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import v from "migrate-mongo";
|
|
2
|
+
import { Document as w } from "mongoose";
|
|
3
|
+
import C from "mongoose-aggregate-paginate-v2";
|
|
4
|
+
import { default as le } from "mongoose-aggregate-paginate-v2";
|
|
5
|
+
import I from "mongoose-paginate-v2";
|
|
6
|
+
import { default as de } from "mongoose-paginate-v2";
|
|
7
|
+
import { v4 as S } from "uuid";
|
|
8
|
+
import { deepClone as P, getNestedValue as M, setNestedValue as A, isObject as N } from "../../util/object/object.util.js";
|
|
9
|
+
import { regexSearchMapper as T } from "../../util/common/common.util.js";
|
|
10
|
+
import { writeFileSync as D, pathExistsSync as j, readFileSync as F, appendFileSync as G } from "../fs/fs.util.js";
|
|
11
|
+
import { PATH as g, MIGRATE_MONGO_CONFIG as x } from "../path/path.constant.js";
|
|
12
|
+
import { validate as $ } from "../../util/validate/validate.util.js";
|
|
13
|
+
import { generateShortId as q, generateSlug as O } from "../../util/string/string.util.js";
|
|
14
|
+
import { RESPONSE_STATUS as d } from "../../constant/response-status.js";
|
|
15
|
+
import { catchError as i } from "../log/log.util.js";
|
|
16
|
+
var V = Object.defineProperty, U = Object.defineProperties, L = Object.getOwnPropertyDescriptors, b = Object.getOwnPropertySymbols, Q = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable, E = (n, t, e) => t in n ? V(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, f = (n, t) => {
|
|
17
|
+
for (var e in t || (t = {}))
|
|
18
|
+
Q.call(t, e) && E(n, e, t[e]);
|
|
19
|
+
if (b)
|
|
20
|
+
for (var e of b(t))
|
|
21
|
+
H.call(t, e) && E(n, e, t[e]);
|
|
22
|
+
return n;
|
|
23
|
+
}, R = (n, t) => U(n, L(t)), J = (n, t, e) => E(n, typeof t != "symbol" ? t + "" : t, e), o = (n, t, e) => new Promise((r, s) => {
|
|
24
|
+
var u = (a) => {
|
|
25
|
+
try {
|
|
26
|
+
l(e.next(a));
|
|
27
|
+
} catch (m) {
|
|
28
|
+
s(m);
|
|
29
|
+
}
|
|
30
|
+
}, c = (a) => {
|
|
31
|
+
try {
|
|
32
|
+
l(e.throw(a));
|
|
33
|
+
} catch (m) {
|
|
34
|
+
s(m);
|
|
35
|
+
}
|
|
36
|
+
}, l = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(u, c);
|
|
37
|
+
l((e = e.apply(n, t)).next());
|
|
38
|
+
});
|
|
39
|
+
const h = {
|
|
40
|
+
createGenericFields() {
|
|
41
|
+
return {
|
|
42
|
+
id: S(),
|
|
43
|
+
isDel: !1,
|
|
44
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
45
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
applyPlugins(n, t) {
|
|
49
|
+
t.filter((e) => typeof e == "function").forEach((e) => n.plugin(e));
|
|
50
|
+
},
|
|
51
|
+
applyMiddlewares(n, t) {
|
|
52
|
+
t.forEach(({ method: e, pre: r, post: s }) => {
|
|
53
|
+
e && r && n.pre(e, r), e && s && n.post(e, s);
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
createGenericSchema(n) {
|
|
57
|
+
return new n.Schema(
|
|
58
|
+
{
|
|
59
|
+
id: { type: String, default: S, unique: !0 },
|
|
60
|
+
isDel: { type: Boolean, default: !1 }
|
|
61
|
+
},
|
|
62
|
+
{ timestamps: !0 }
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
createSchema({
|
|
66
|
+
mongoose: n,
|
|
67
|
+
schema: t,
|
|
68
|
+
virtuals: e = [],
|
|
69
|
+
standalone: r = !1
|
|
70
|
+
}) {
|
|
71
|
+
const s = new n.Schema(t);
|
|
72
|
+
return e.forEach(({ name: u, options: c, get: l }) => {
|
|
73
|
+
const a = s.virtual(u, c);
|
|
74
|
+
l && a.get(l);
|
|
75
|
+
}), r || s.add(h.createGenericSchema(n)), s;
|
|
76
|
+
},
|
|
77
|
+
createModel({
|
|
78
|
+
mongoose: n,
|
|
79
|
+
name: t,
|
|
80
|
+
schema: e,
|
|
81
|
+
pagination: r = !1,
|
|
82
|
+
aggregate: s = !1,
|
|
83
|
+
virtuals: u = [],
|
|
84
|
+
middlewares: c = []
|
|
85
|
+
}) {
|
|
86
|
+
if (!t)
|
|
87
|
+
throw new Error("Model name is required.");
|
|
88
|
+
if (n.models[t])
|
|
89
|
+
return n.models[t];
|
|
90
|
+
const l = h.createSchema({ mongoose: n, schema: e, virtuals: u });
|
|
91
|
+
return h.applyPlugins(l, [
|
|
92
|
+
r && I,
|
|
93
|
+
s && C
|
|
94
|
+
]), h.applyMiddlewares(l, c), n.model(t, l);
|
|
95
|
+
},
|
|
96
|
+
validator: {
|
|
97
|
+
isRequired() {
|
|
98
|
+
return function(n) {
|
|
99
|
+
return o(this, null, function* () {
|
|
100
|
+
return !$.isEmpty(n);
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
isUnique(n) {
|
|
105
|
+
return function(t) {
|
|
106
|
+
return o(this, null, function* () {
|
|
107
|
+
if (!Array.isArray(n) || n.length === 0)
|
|
108
|
+
throw new Error("Fields must be a non-empty array of strings.");
|
|
109
|
+
const e = { $or: n.map((s) => ({ [s]: t })) };
|
|
110
|
+
return !(yield this.constructor.exists(e));
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
matchesRegex(n) {
|
|
115
|
+
return function(t) {
|
|
116
|
+
return o(this, null, function* () {
|
|
117
|
+
if (!Array.isArray(n) || n.some((e) => !(e instanceof RegExp)))
|
|
118
|
+
throw new Error("regexArray must be an array of valid RegExp objects.");
|
|
119
|
+
return n.every((e) => e.test(t));
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
migrate: R(f({}, v), {
|
|
125
|
+
setConfig: (n) => {
|
|
126
|
+
const t = `// This file is automatically generated by the Cyberskill CLI.
|
|
127
|
+
module.exports = ${JSON.stringify(n, null, 4)}`;
|
|
128
|
+
D(g.MIGRATE_MONGO_CONFIG, t);
|
|
129
|
+
const e = `
|
|
130
|
+
${x}
|
|
131
|
+
`;
|
|
132
|
+
j(g.GIT_IGNORE) ? F(g.GIT_IGNORE, "utf-8").split(`
|
|
133
|
+
`).includes(x) || G(g.GIT_IGNORE, e) : D(g.GIT_IGNORE, e);
|
|
134
|
+
}
|
|
135
|
+
}),
|
|
136
|
+
regexify(n, t) {
|
|
137
|
+
if (!n)
|
|
138
|
+
return {};
|
|
139
|
+
let e = P(n);
|
|
140
|
+
if (!t || t.length === 0)
|
|
141
|
+
return e;
|
|
142
|
+
for (const r of t) {
|
|
143
|
+
const s = r.toString().split("."), u = M(e, s);
|
|
144
|
+
if (typeof u == "string" && u.length > 0) {
|
|
145
|
+
const c = {
|
|
146
|
+
$regex: `.*${T(u)}.*`,
|
|
147
|
+
$options: "i"
|
|
148
|
+
};
|
|
149
|
+
e = A(e, s, c);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return e;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
class ue {
|
|
156
|
+
constructor(t, e) {
|
|
157
|
+
J(this, "collection"), this.collection = t.collection(e);
|
|
158
|
+
}
|
|
159
|
+
createOne(t) {
|
|
160
|
+
return o(this, null, function* () {
|
|
161
|
+
try {
|
|
162
|
+
const e = f(f({}, h.createGenericFields()), t);
|
|
163
|
+
return (yield this.collection.insertOne(e)).acknowledged ? {
|
|
164
|
+
success: !0,
|
|
165
|
+
message: "Document created successfully",
|
|
166
|
+
result: e
|
|
167
|
+
} : {
|
|
168
|
+
success: !1,
|
|
169
|
+
message: "Document creation failed",
|
|
170
|
+
code: d.INTERNAL_SERVER_ERROR.CODE
|
|
171
|
+
};
|
|
172
|
+
} catch (e) {
|
|
173
|
+
return i(e);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
createMany(t) {
|
|
178
|
+
return o(this, null, function* () {
|
|
179
|
+
try {
|
|
180
|
+
const e = t.map((s) => f(f({}, h.createGenericFields()), s)), r = yield this.collection.insertMany(e);
|
|
181
|
+
return r.insertedCount === 0 ? {
|
|
182
|
+
success: !1,
|
|
183
|
+
message: "No documents were inserted",
|
|
184
|
+
code: d.INTERNAL_SERVER_ERROR.CODE
|
|
185
|
+
} : {
|
|
186
|
+
success: !0,
|
|
187
|
+
message: `${r.insertedCount} documents created successfully`,
|
|
188
|
+
result: e
|
|
189
|
+
};
|
|
190
|
+
} catch (e) {
|
|
191
|
+
return i(e);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
findOne(t) {
|
|
196
|
+
return o(this, null, function* () {
|
|
197
|
+
try {
|
|
198
|
+
const e = yield this.collection.findOne(t);
|
|
199
|
+
return e ? { success: !0, message: "Document found", result: e } : { success: !1, message: "Document not found", code: d.NOT_FOUND.CODE };
|
|
200
|
+
} catch (e) {
|
|
201
|
+
return i(e);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
findAll() {
|
|
206
|
+
return o(this, arguments, function* (t = {}) {
|
|
207
|
+
try {
|
|
208
|
+
return {
|
|
209
|
+
success: !0,
|
|
210
|
+
message: "Documents retrieved successfully",
|
|
211
|
+
result: yield this.collection.find(t).toArray()
|
|
212
|
+
};
|
|
213
|
+
} catch (e) {
|
|
214
|
+
return i(e);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
count() {
|
|
219
|
+
return o(this, arguments, function* (t = {}) {
|
|
220
|
+
try {
|
|
221
|
+
return {
|
|
222
|
+
success: !0,
|
|
223
|
+
message: "Count retrieved successfully",
|
|
224
|
+
result: yield this.collection.countDocuments(t)
|
|
225
|
+
};
|
|
226
|
+
} catch (e) {
|
|
227
|
+
return i(e);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
updateOne(t, e) {
|
|
232
|
+
return o(this, null, function* () {
|
|
233
|
+
try {
|
|
234
|
+
const r = yield this.collection.updateOne(t, {
|
|
235
|
+
$set: e
|
|
236
|
+
});
|
|
237
|
+
return r.matchedCount === 0 ? {
|
|
238
|
+
success: !1,
|
|
239
|
+
message: "No documents matched the filter",
|
|
240
|
+
code: d.INTERNAL_SERVER_ERROR.CODE
|
|
241
|
+
} : {
|
|
242
|
+
success: !0,
|
|
243
|
+
message: "Document updated successfully",
|
|
244
|
+
result: r
|
|
245
|
+
};
|
|
246
|
+
} catch (r) {
|
|
247
|
+
return i(r);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
updateMany(t, e) {
|
|
252
|
+
return o(this, null, function* () {
|
|
253
|
+
try {
|
|
254
|
+
const r = yield this.collection.updateMany(t, {
|
|
255
|
+
$set: e
|
|
256
|
+
});
|
|
257
|
+
return r.matchedCount === 0 ? {
|
|
258
|
+
success: !1,
|
|
259
|
+
message: "No documents matched the filter",
|
|
260
|
+
code: d.INTERNAL_SERVER_ERROR.CODE
|
|
261
|
+
} : {
|
|
262
|
+
success: !0,
|
|
263
|
+
message: "Documents updated successfully",
|
|
264
|
+
result: r
|
|
265
|
+
};
|
|
266
|
+
} catch (r) {
|
|
267
|
+
return i(r);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
deleteOne(t) {
|
|
272
|
+
return o(this, null, function* () {
|
|
273
|
+
try {
|
|
274
|
+
const e = yield this.collection.deleteOne(t);
|
|
275
|
+
return e.deletedCount === 0 ? {
|
|
276
|
+
success: !1,
|
|
277
|
+
message: "No documents matched the filter",
|
|
278
|
+
code: d.INTERNAL_SERVER_ERROR.CODE
|
|
279
|
+
} : {
|
|
280
|
+
success: !0,
|
|
281
|
+
message: "Document deleted successfully",
|
|
282
|
+
result: e
|
|
283
|
+
};
|
|
284
|
+
} catch (e) {
|
|
285
|
+
return i(e);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
deleteMany(t) {
|
|
290
|
+
return o(this, null, function* () {
|
|
291
|
+
try {
|
|
292
|
+
const e = yield this.collection.deleteMany(t);
|
|
293
|
+
return e.deletedCount === 0 ? {
|
|
294
|
+
success: !1,
|
|
295
|
+
message: "No documents matched the filter",
|
|
296
|
+
code: d.INTERNAL_SERVER_ERROR.CODE
|
|
297
|
+
} : {
|
|
298
|
+
success: !0,
|
|
299
|
+
message: "Documents deleted successfully",
|
|
300
|
+
result: e
|
|
301
|
+
};
|
|
302
|
+
} catch (e) {
|
|
303
|
+
return i(e);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
class ce {
|
|
309
|
+
constructor(t) {
|
|
310
|
+
this.model = t;
|
|
311
|
+
}
|
|
312
|
+
getModelName() {
|
|
313
|
+
return this.model.modelName;
|
|
314
|
+
}
|
|
315
|
+
findOne() {
|
|
316
|
+
return o(this, arguments, function* (t = {}, e = {}, r = {}, s) {
|
|
317
|
+
try {
|
|
318
|
+
const u = this.model.findOne(t, e, r);
|
|
319
|
+
s && u.populate(s);
|
|
320
|
+
const c = yield u.exec();
|
|
321
|
+
return c ? { success: !0, result: c } : {
|
|
322
|
+
success: !1,
|
|
323
|
+
message: `No ${this.getModelName()} found.`,
|
|
324
|
+
code: d.NOT_FOUND.CODE
|
|
325
|
+
};
|
|
326
|
+
} catch (u) {
|
|
327
|
+
return i(u);
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
findAll() {
|
|
332
|
+
return o(this, arguments, function* (t = {}, e = {}, r = {}, s) {
|
|
333
|
+
try {
|
|
334
|
+
const u = this.model.find(t, e, r);
|
|
335
|
+
return s && u.populate(s), { success: !0, result: yield u.exec() };
|
|
336
|
+
} catch (u) {
|
|
337
|
+
return i(u);
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
findPaging() {
|
|
342
|
+
return o(this, arguments, function* (t = {}, e = {}) {
|
|
343
|
+
try {
|
|
344
|
+
return { success: !0, result: yield this.model.paginate(t, e) };
|
|
345
|
+
} catch (r) {
|
|
346
|
+
return i(r);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
findPagingAggregate(t) {
|
|
351
|
+
return o(this, arguments, function* (e, r = {}) {
|
|
352
|
+
try {
|
|
353
|
+
return { success: !0, result: yield this.model.aggregatePaginate(
|
|
354
|
+
this.model.aggregate(e),
|
|
355
|
+
r
|
|
356
|
+
) };
|
|
357
|
+
} catch (s) {
|
|
358
|
+
return i(s);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
count() {
|
|
363
|
+
return o(this, arguments, function* (t = {}) {
|
|
364
|
+
try {
|
|
365
|
+
return { success: !0, result: yield this.model.countDocuments(t) };
|
|
366
|
+
} catch (e) {
|
|
367
|
+
return i(e);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
createOne(t) {
|
|
372
|
+
return o(this, null, function* () {
|
|
373
|
+
try {
|
|
374
|
+
return { success: !0, result: yield this.model.create(t) };
|
|
375
|
+
} catch (e) {
|
|
376
|
+
return i(e);
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
createMany(t) {
|
|
381
|
+
return o(this, arguments, function* (e, r = {}) {
|
|
382
|
+
try {
|
|
383
|
+
return { success: !0, result: (yield this.model.insertMany(e, r)).map((c) => c instanceof w ? c.toObject() : null).filter((c) => c !== null) };
|
|
384
|
+
} catch (s) {
|
|
385
|
+
return i(s);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
updateOne() {
|
|
390
|
+
return o(this, arguments, function* (t = {}, e = {}, r = {}) {
|
|
391
|
+
try {
|
|
392
|
+
const s = yield this.model.findOneAndUpdate(t, e, f({
|
|
393
|
+
new: !0
|
|
394
|
+
}, r)).exec();
|
|
395
|
+
return s ? { success: !0, result: s } : {
|
|
396
|
+
success: !1,
|
|
397
|
+
message: `Failed to update ${this.getModelName()}.`,
|
|
398
|
+
code: d.NOT_FOUND.CODE
|
|
399
|
+
};
|
|
400
|
+
} catch (s) {
|
|
401
|
+
return i(s);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
updateMany() {
|
|
406
|
+
return o(this, arguments, function* (t = {}, e = {}, r = {}) {
|
|
407
|
+
try {
|
|
408
|
+
return { success: !0, result: yield this.model.updateMany(t, e, r).exec() };
|
|
409
|
+
} catch (s) {
|
|
410
|
+
return i(s);
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
deleteOne() {
|
|
415
|
+
return o(this, arguments, function* (t = {}, e = {}) {
|
|
416
|
+
try {
|
|
417
|
+
const r = yield this.model.findOneAndDelete(t, e).exec();
|
|
418
|
+
return r ? { success: !0, result: r } : {
|
|
419
|
+
success: !1,
|
|
420
|
+
message: `No ${this.getModelName()} found to delete.`,
|
|
421
|
+
code: d.NOT_FOUND.CODE
|
|
422
|
+
};
|
|
423
|
+
} catch (r) {
|
|
424
|
+
return i(r);
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
deleteMany() {
|
|
429
|
+
return o(this, arguments, function* (t = {}, e = {}) {
|
|
430
|
+
try {
|
|
431
|
+
const r = yield this.model.deleteMany(t, e).exec();
|
|
432
|
+
return r.deletedCount === 0 ? {
|
|
433
|
+
success: !1,
|
|
434
|
+
message: "No documents found to delete.",
|
|
435
|
+
code: d.NOT_FOUND.CODE
|
|
436
|
+
} : { success: !0, result: r };
|
|
437
|
+
} catch (r) {
|
|
438
|
+
return i(r);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
createShortId(t, e = 4) {
|
|
443
|
+
return o(this, null, function* () {
|
|
444
|
+
try {
|
|
445
|
+
const s = /* @__PURE__ */ new Set();
|
|
446
|
+
for (let u = 0; u < 10; u++) {
|
|
447
|
+
const c = q(t, u + e);
|
|
448
|
+
if (!s.has(c) && (s.add(c), !(yield this.model.exists({ shortId: c }))))
|
|
449
|
+
return { success: !0, result: c };
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
success: !1,
|
|
453
|
+
message: "Failed to create a unique shortId",
|
|
454
|
+
code: d.INTERNAL_SERVER_ERROR.CODE
|
|
455
|
+
};
|
|
456
|
+
} catch (r) {
|
|
457
|
+
return i(r);
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
createSlugQuery({ slug: t, field: e, isObject: r, filter: s }) {
|
|
462
|
+
const u = f({}, s != null ? s : {});
|
|
463
|
+
return r ? R(f({}, u), {
|
|
464
|
+
$or: [
|
|
465
|
+
{ [`slug.${e}`]: t },
|
|
466
|
+
{ slugHistory: { $elemMatch: { [`slug.${e}`]: t } } }
|
|
467
|
+
]
|
|
468
|
+
}) : R(f({}, u), {
|
|
469
|
+
$or: [
|
|
470
|
+
{ slug: t },
|
|
471
|
+
{ slugHistory: t }
|
|
472
|
+
]
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
createUniqueSlug(t) {
|
|
476
|
+
return o(this, arguments, function* ({ slug: e, field: r, isObject: s, filter: u }) {
|
|
477
|
+
const c = O(e);
|
|
478
|
+
let l = c, a = 1;
|
|
479
|
+
for (; yield this.model.exists(this.createSlugQuery({ slug: l, field: r, isObject: s, filter: u })); )
|
|
480
|
+
l = `${c}-${a++}`;
|
|
481
|
+
return l;
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
createSlug(t) {
|
|
485
|
+
return o(this, arguments, function* ({ field: e, from: r, filter: s }) {
|
|
486
|
+
try {
|
|
487
|
+
const u = r[e];
|
|
488
|
+
return N(u) ? { success: !0, result: Object.fromEntries(
|
|
489
|
+
yield Promise.all(
|
|
490
|
+
Object.entries(u).map((m) => o(this, [m], function* ([y, p]) {
|
|
491
|
+
const _ = yield this.createUniqueSlug({
|
|
492
|
+
slug: p,
|
|
493
|
+
field: y,
|
|
494
|
+
isObject: !0,
|
|
495
|
+
filter: s
|
|
496
|
+
});
|
|
497
|
+
return [y, _];
|
|
498
|
+
}))
|
|
499
|
+
)
|
|
500
|
+
) } : { success: !0, result: yield this.createUniqueSlug({
|
|
501
|
+
slug: u,
|
|
502
|
+
field: e,
|
|
503
|
+
isObject: !1,
|
|
504
|
+
filter: s
|
|
505
|
+
}) };
|
|
506
|
+
} catch (u) {
|
|
507
|
+
return i(u);
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
checkSlug(t) {
|
|
512
|
+
return o(this, arguments, function* ({ slug: e, field: r, from: s, filter: u }) {
|
|
513
|
+
try {
|
|
514
|
+
const c = s[r];
|
|
515
|
+
if (N(c)) {
|
|
516
|
+
for (const y of Object.values(c)) {
|
|
517
|
+
const p = O(y);
|
|
518
|
+
if (yield this.model.exists(this.createSlugQuery({
|
|
519
|
+
slug: p,
|
|
520
|
+
field: r,
|
|
521
|
+
isObject: !0,
|
|
522
|
+
filter: u
|
|
523
|
+
})))
|
|
524
|
+
return { success: !0, result: !0 };
|
|
525
|
+
}
|
|
526
|
+
return { success: !0, result: !1 };
|
|
527
|
+
}
|
|
528
|
+
const a = O(e);
|
|
529
|
+
return { success: !0, result: (yield this.model.exists(this.createSlugQuery({
|
|
530
|
+
slug: a,
|
|
531
|
+
field: r,
|
|
532
|
+
isObject: !1,
|
|
533
|
+
filter: u
|
|
534
|
+
}))) !== null };
|
|
535
|
+
} catch (c) {
|
|
536
|
+
return i(c);
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
aggregate(t) {
|
|
541
|
+
return o(this, null, function* () {
|
|
542
|
+
try {
|
|
543
|
+
return { success: !0, result: yield this.model.aggregate(t) };
|
|
544
|
+
} catch (e) {
|
|
545
|
+
return i(e);
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
export {
|
|
551
|
+
ue as MongoController,
|
|
552
|
+
ce as MongooseController,
|
|
553
|
+
le as aggregatePaginate,
|
|
554
|
+
h as mongo,
|
|
555
|
+
de as mongoosePaginate
|
|
556
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./package.type.cjs"),e=require("./package.util.cjs");Object.defineProperty(exports,"E_PackageType",{enumerable:!0,get:()=>a.E_PackageType});exports.getLatestPackageVersion=e.getLatestPackageVersion;exports.getPackage=e.getPackage;exports.installDependencies=e.installDependencies;exports.setupPackages=e.setupPackages;exports.updatePackage=e.updatePackage;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { E_PackageType as t } from "./package.type.js";
|
|
2
|
+
import { getLatestPackageVersion as c, getPackage as p, installDependencies as s, setupPackages as k, updatePackage as o } from "./package.util.js";
|
|
3
|
+
export {
|
|
4
|
+
t as E_PackageType,
|
|
5
|
+
c as getLatestPackageVersion,
|
|
6
|
+
p as getPackage,
|
|
7
|
+
s as installDependencies,
|
|
8
|
+
k as setupPackages,
|
|
9
|
+
o as updatePackage
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.E_PackageType=(e=>(e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e))(exports.E_PackageType||{});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var D = /* @__PURE__ */ ((e) => (e.DEPENDENCY = "dependencies", e.DEV_DEPENDENCY = "devDependencies", e.PEER_DEPENDENCY = "peerDependencies", e.BUNDLE_DEPENDENCY = "bundleDependencies", e.OPTIONAL_DEPENDENCY = "optionalDependencies", e))(D || {});
|
|
2
|
+
export {
|
|
3
|
+
D as E_PackageType
|
|
4
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("node-fetch"),f=require("./package.type.cjs"),u=require("../fs/fs.util.cjs"),a=require("../path/path.constant.cjs"),J=require("../path/path.util.cjs"),d=require("../log/log.util.cjs"),C=require("../command/command.util.cjs"),j=require("../../config/env/env.util.cjs");var p=(e,t,r)=>new Promise((n,i)=>{var c=s=>{try{l(r.next(s))}catch(o){i(o)}},m=s=>{try{l(r.throw(s))}catch(o){i(o)}},l=s=>s.done?n(s.value):Promise.resolve(s.value).then(c,m);l((r=r.apply(e,t)).next())});const O=j.getEnv();function T(e){return p(this,null,function*(){try{const t=yield N(`https://registry.npmjs.org/${e}/latest`);if(!t.ok)throw new Error(`Failed to fetch latest version: ${t.status} ${t.statusText}`);const{version:r}=yield t.json();return{success:!0,result:r}}catch(t){return d.catchError(t)}})}function V(e){return p(this,null,function*(){var t,r;try{if(!e){if(u.pathExistsSync(a.PATH.PACKAGE_JSON)){const _=u.readJsonSync(a.PATH.PACKAGE_JSON),{name:S="",version:A=""}=_;return{success:!0,result:{name:S,currentVersion:A,latestVersion:A,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:a.PATH.PACKAGE_JSON,file:_}}}return{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}}if(!u.pathExistsSync(a.PATH.PACKAGE_JSON))return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===f.E_PackageType.DEPENDENCY,isDevDependency:e.type===f.E_PackageType.DEV_DEPENDENCY,installedPath:"",file:{}}};const n=u.readJsonSync(a.PATH.PACKAGE_JSON),{name:i,version:c="",dependencies:m={},devDependencies:l={}}=n;if(e.name===i)return{success:!0,result:{name:i,currentVersion:c,latestVersion:c,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===f.E_PackageType.DEPENDENCY,isDevDependency:e.type===f.E_PackageType.DEV_DEPENDENCY,installedPath:a.PATH.PACKAGE_JSON,file:n}};const s=e.name in m,o=e.name in l,y=yield T(e.name);if(!y.success)return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:s,isDevDependency:o,installedPath:"",file:{}}};if(!s&&!o)return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:y.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===f.E_PackageType.DEPENDENCY,isDevDependency:e.type===f.E_PackageType.DEV_DEPENDENCY,installedPath:"",file:{}}};const D=(r=(t=m[e.name])!=null?t:l[e.name])!=null?r:"",E=J.join(O.CWD,a.NODE_MODULES,e.name,a.PACKAGE_JSON);if(!u.pathExistsSync(E))return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:y.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:s,isDevDependency:o,installedPath:"",file:{}}};const h=u.readJsonSync(E),{version:v=""}=h;return D!==v?{success:!0,result:{name:e.name,currentVersion:v||D,latestVersion:y.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:s,isDevDependency:o,installedPath:E,file:h}}:{success:!0,result:{name:e.name,currentVersion:D,latestVersion:y.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:D===y.result,isDependency:s,isDevDependency:o,installedPath:E,file:h}}}catch(n){return d.catchError(n)}})}function P(e){return p(this,null,function*(){var t,r;try{const n=u.readJsonSync(a.PATH.PACKAGE_JSON),i=(t=n.dependencies)!=null?t:{},c=(r=n.devDependencies)!=null?r:{};e.isDependency?i[e.name]=e.latestVersion:e.isDevDependency&&(c[e.name]=e.latestVersion),u.writeFileSync(a.PATH.PACKAGE_JSON,JSON.stringify(n,null,4)),d.log.info(`Updated "${e.name}" to version ${e.latestVersion}`)}catch(n){d.catchError(n)}})}function g(){return p(this,null,function*(){try{const e=[{command:()=>a.command.pnpmInstallStandard(),message:"Installing dependencies (standard)"},{command:()=>a.command.pnpmInstallLegacy(),message:"Retrying with legacy peer dependencies"},{command:()=>a.command.pnpmInstallForce(),message:"Retrying with force install"}];for(const{command:t,message:r}of e)try{const n=yield t();yield C.runCommand(`${r} using: ${n}`,n);return}catch(n){d.catchError(n)}}catch(e){d.catchError(e)}})}function U(e,t){return p(this,null,function*(){var r;try{if(!u.pathExistsSync(a.PATH.PACKAGE_JSON)){d.log.error("package.json not found. Aborting setup.");return}const i=(yield Promise.all(e.map(V))).filter(s=>s.success&&!!s.result&&!s.result.isCurrentProject).map(s=>s.result),c=i.filter(s=>!s.isInstalled),m=i.filter(s=>!s.isUpToDate),l=[];t!=null&&t.install&&c.length>0&&l.push(...c.map(P)),t!=null&&t.update&&m.length>0&&l.push(...m.map(P)),l.length>0&&(yield Promise.all(l),yield g(),yield C.runCommand("Running ESLint with auto-fix",yield a.command.eslintFix()));for(const s of(r=t==null?void 0:t.callbacks)!=null?r:[])yield s()}catch(n){d.catchError(n)}})}exports.getLatestPackageVersion=T;exports.getPackage=V;exports.installDependencies=g;exports.setupPackages=U;exports.updatePackage=P;
|