mm-share-lib 0.0.14 → 0.0.15
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/.eslintrc.js +25 -25
- package/.prettierrc +3 -3
- package/README.md +73 -73
- package/index.ts +1 -1
- package/nest-cli.json +8 -8
- package/package.json +91 -91
- package/src/constant/entity-state.constant.ts +4 -4
- package/src/constant/index.ts +1 -1
- package/src/dto/index.ts +2 -2
- package/src/exception/bad-request-error.exception.spec.ts +24 -24
- package/src/exception/bad-request-error.exception.ts +8 -8
- package/src/exception/base.exception.ts +36 -36
- package/src/exception/conflict-error.exception.spec.ts +23 -23
- package/src/exception/conflict-error.exception.ts +8 -8
- package/src/exception/forbidden-error.exception.spec.ts +23 -23
- package/src/exception/forbidden-error.exception.ts +8 -8
- package/src/exception/index.ts +7 -7
- package/src/exception/internal-server-error.exception.spec.ts +23 -23
- package/src/exception/internal-server-error.exception.ts +12 -12
- package/src/exception/not-found-error.exception.spec.ts +23 -23
- package/src/exception/not-found-error.exception.ts +8 -8
- package/src/exception/unauthorized-error.exception.spec.ts +23 -23
- package/src/exception/unauthorized-error.exception.ts +12 -12
- package/src/filter/http-exception.filter.ts +23 -23
- package/src/filter/index.ts +1 -1
- package/src/filter/rpc-exception.filter.ts +15 -15
- package/src/generic/entity/entity.generic.ts +34 -34
- package/src/generic/entity/index.ts +1 -1
- package/src/generic/index.ts +2 -2
- package/src/generic/service/index.ts +1 -1
- package/src/generic/service/service.generic.ts +112 -112
- package/src/lib/datasource-mapper/datasource-mapper.ts +38 -0
- package/src/lib/datasource-mapper/index.ts +1 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/search-engine/interface/index.ts +1 -1
- package/src/lib/search-engine/interface/search-document.interface.ts +13 -13
- package/src/lib/search-engine/interface/transform-service.interface.ts +10 -10
- package/src/lib/search-engine/typesense/service/client.service.ts +37 -24
- package/src/setup/index.ts +1 -1
- package/src/util/app.utils.ts +18 -18
- package/src/util/date.util.spec.ts +49 -49
- package/src/util/date.util.ts +10 -10
- package/src/util/generator.util.spec.ts +79 -79
- package/src/util/generator.util.ts +34 -34
- package/src/util/index.ts +4 -4
- package/test/app.e2e-spec.ts +24 -24
- package/test/jest-e2e.json +9 -9
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +22 -21
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +0 -1
- package/dist/src/auth/apple/apple.module.d.ts +0 -2
- package/dist/src/auth/apple/apple.module.js +0 -22
- package/dist/src/auth/apple/apple.module.js.map +0 -1
- package/dist/src/auth/apple/apple.service.d.ts +0 -9
- package/dist/src/auth/apple/apple.service.js +0 -38
- package/dist/src/auth/apple/apple.service.js.map +0 -1
- package/dist/src/auth/apple/dto/apple-login.dto.d.ts +0 -5
- package/dist/src/auth/apple/dto/apple-login.dto.js +0 -33
- package/dist/src/auth/apple/dto/apple-login.dto.js.map +0 -1
- package/dist/src/auth/apple/dto/index.d.ts +0 -1
- package/dist/src/auth/apple/dto/index.js +0 -18
- package/dist/src/auth/apple/dto/index.js.map +0 -1
- package/dist/src/auth/apple/index.d.ts +0 -3
- package/dist/src/auth/apple/index.js +0 -20
- package/dist/src/auth/apple/index.js.map +0 -1
- package/dist/src/auth/config/apple.config.d.ts +0 -3
- package/dist/src/auth/config/apple.config.js +0 -29
- package/dist/src/auth/config/apple.config.js.map +0 -1
- package/dist/src/auth/config/auth.config.d.ts +0 -3
- package/dist/src/auth/config/auth.config.js +0 -42
- package/dist/src/auth/config/auth.config.js.map +0 -1
- package/dist/src/auth/config/facebook.config.d.ts +0 -3
- package/dist/src/auth/config/facebook.config.js +0 -34
- package/dist/src/auth/config/facebook.config.js.map +0 -1
- package/dist/src/auth/config/file.config.d.ts +0 -3
- package/dist/src/auth/config/file.config.js +0 -66
- package/dist/src/auth/config/file.config.js.map +0 -1
- package/dist/src/auth/config/google.config.d.ts +0 -3
- package/dist/src/auth/config/google.config.js +0 -34
- package/dist/src/auth/config/google.config.js.map +0 -1
- package/dist/src/auth/config/index.d.ts +0 -6
- package/dist/src/auth/config/index.js +0 -23
- package/dist/src/auth/config/index.js.map +0 -1
- package/dist/src/auth/config/twitter.config.d.ts +0 -8
- package/dist/src/auth/config/twitter.config.js +0 -34
- package/dist/src/auth/config/twitter.config.js.map +0 -1
- package/dist/src/auth/facebook/dto/facebook-login.dto.d.ts +0 -3
- package/dist/src/auth/facebook/dto/facebook-login.dto.js +0 -23
- package/dist/src/auth/facebook/dto/facebook-login.dto.js.map +0 -1
- package/dist/src/auth/facebook/dto/index.d.ts +0 -1
- package/dist/src/auth/facebook/dto/index.js +0 -18
- package/dist/src/auth/facebook/dto/index.js.map +0 -1
- package/dist/src/auth/facebook/facebook.module.d.ts +0 -2
- package/dist/src/auth/facebook/facebook.module.js +0 -23
- package/dist/src/auth/facebook/facebook.module.js.map +0 -1
- package/dist/src/auth/facebook/facebook.service.d.ts +0 -10
- package/dist/src/auth/facebook/facebook.service.js +0 -50
- package/dist/src/auth/facebook/facebook.service.js.map +0 -1
- package/dist/src/auth/facebook/index.d.ts +0 -4
- package/dist/src/auth/facebook/index.js +0 -21
- package/dist/src/auth/facebook/index.js.map +0 -1
- package/dist/src/auth/facebook/interface/facebook.interface.d.ts +0 -6
- package/dist/src/auth/facebook/interface/facebook.interface.js +0 -3
- package/dist/src/auth/facebook/interface/facebook.interface.js.map +0 -1
- package/dist/src/auth/facebook/interface/index.d.ts +0 -1
- package/dist/src/auth/facebook/interface/index.js +0 -18
- package/dist/src/auth/facebook/interface/index.js.map +0 -1
- package/dist/src/auth/google/dto/google-login.dto.d.ts +0 -3
- package/dist/src/auth/google/dto/google-login.dto.js +0 -23
- package/dist/src/auth/google/dto/google-login.dto.js.map +0 -1
- package/dist/src/auth/google/dto/index.d.ts +0 -1
- package/dist/src/auth/google/dto/index.js +0 -18
- package/dist/src/auth/google/dto/index.js.map +0 -1
- package/dist/src/auth/google/google.module.d.ts +0 -2
- package/dist/src/auth/google/google.module.js +0 -22
- package/dist/src/auth/google/google.module.js.map +0 -1
- package/dist/src/auth/google/google.service.d.ts +0 -10
- package/dist/src/auth/google/google.service.js +0 -49
- package/dist/src/auth/google/google.service.js.map +0 -1
- package/dist/src/auth/google/index.d.ts +0 -3
- package/dist/src/auth/google/index.js +0 -20
- package/dist/src/auth/google/index.js.map +0 -1
- package/dist/src/auth/index.d.ts +0 -5
- package/dist/src/auth/index.js +0 -22
- package/dist/src/auth/index.js.map +0 -1
- package/dist/src/auth/twitter/dto/index.d.ts +0 -1
- package/dist/src/auth/twitter/dto/index.js +0 -18
- package/dist/src/auth/twitter/dto/index.js.map +0 -1
- package/dist/src/auth/twitter/dto/twitter-login.dto.d.ts +0 -4
- package/dist/src/auth/twitter/dto/twitter-login.dto.js +0 -28
- package/dist/src/auth/twitter/dto/twitter-login.dto.js.map +0 -1
- package/dist/src/auth/twitter/index.d.ts +0 -3
- package/dist/src/auth/twitter/index.js +0 -20
- package/dist/src/auth/twitter/index.js.map +0 -1
- package/dist/src/auth/twitter/twitter.module.d.ts +0 -2
- package/dist/src/auth/twitter/twitter.module.js +0 -23
- package/dist/src/auth/twitter/twitter.module.js.map +0 -1
- package/dist/src/auth/twitter/twitter.service.d.ts +0 -9
- package/dist/src/auth/twitter/twitter.service.js +0 -49
- package/dist/src/auth/twitter/twitter.service.js.map +0 -1
- package/dist/src/config/index.d.ts +0 -1
- package/dist/src/config/index.js +0 -18
- package/dist/src/config/index.js.map +0 -1
- package/dist/src/config/type.config.d.ts +0 -79
- package/dist/src/config/type.config.js +0 -3
- package/dist/src/config/type.config.js.map +0 -1
- package/dist/src/constant/entity-state.constant.d.ts +0 -4
- package/dist/src/constant/entity-state.constant.js +0 -9
- package/dist/src/constant/entity-state.constant.js.map +0 -1
- package/dist/src/constant/index.d.ts +0 -1
- package/dist/src/constant/index.js +0 -18
- package/dist/src/constant/index.js.map +0 -1
- package/dist/src/dto/base-filter.dto.d.ts +0 -4
- package/dist/src/dto/base-filter.dto.js +0 -11
- package/dist/src/dto/base-filter.dto.js.map +0 -1
- package/dist/src/dto/index.d.ts +0 -2
- package/dist/src/dto/index.js +0 -19
- package/dist/src/dto/index.js.map +0 -1
- package/dist/src/dto/pagination.dto.d.ts +0 -5
- package/dist/src/dto/pagination.dto.js +0 -37
- package/dist/src/dto/pagination.dto.js.map +0 -1
- package/dist/src/exception/bad-request-error.exception.d.ts +0 -4
- package/dist/src/exception/bad-request-error.exception.js +0 -12
- package/dist/src/exception/bad-request-error.exception.js.map +0 -1
- package/dist/src/exception/base.exception.d.ts +0 -21
- package/dist/src/exception/base.exception.js +0 -16
- package/dist/src/exception/base.exception.js.map +0 -1
- package/dist/src/exception/conflict-error.exception.d.ts +0 -4
- package/dist/src/exception/conflict-error.exception.js +0 -12
- package/dist/src/exception/conflict-error.exception.js.map +0 -1
- package/dist/src/exception/forbidden-error.exception.d.ts +0 -4
- package/dist/src/exception/forbidden-error.exception.js +0 -12
- package/dist/src/exception/forbidden-error.exception.js.map +0 -1
- package/dist/src/exception/index.d.ts +0 -7
- package/dist/src/exception/index.js +0 -24
- package/dist/src/exception/index.js.map +0 -1
- package/dist/src/exception/internal-server-error.exception.d.ts +0 -4
- package/dist/src/exception/internal-server-error.exception.js +0 -12
- package/dist/src/exception/internal-server-error.exception.js.map +0 -1
- package/dist/src/exception/not-found-error.exception.d.ts +0 -4
- package/dist/src/exception/not-found-error.exception.js +0 -12
- package/dist/src/exception/not-found-error.exception.js.map +0 -1
- package/dist/src/exception/unauthorized-error.exception.d.ts +0 -4
- package/dist/src/exception/unauthorized-error.exception.js +0 -12
- package/dist/src/exception/unauthorized-error.exception.js.map +0 -1
- package/dist/src/filter/http-exception.filter.d.ts +0 -4
- package/dist/src/filter/http-exception.filter.js +0 -27
- package/dist/src/filter/http-exception.filter.js.map +0 -1
- package/dist/src/filter/index.d.ts +0 -1
- package/dist/src/filter/index.js +0 -18
- package/dist/src/filter/index.js.map +0 -1
- package/dist/src/filter/rpc-exception.filter.d.ts +0 -6
- package/dist/src/filter/rpc-exception.filter.js +0 -21
- package/dist/src/filter/rpc-exception.filter.js.map +0 -1
- package/dist/src/generic/entity/entity.generic.d.ts +0 -10
- package/dist/src/generic/entity/entity.generic.js +0 -48
- package/dist/src/generic/entity/entity.generic.js.map +0 -1
- package/dist/src/generic/entity/index.d.ts +0 -1
- package/dist/src/generic/entity/index.js +0 -18
- package/dist/src/generic/entity/index.js.map +0 -1
- package/dist/src/generic/index.d.ts +0 -2
- package/dist/src/generic/index.js +0 -19
- package/dist/src/generic/index.js.map +0 -1
- package/dist/src/generic/service/index.d.ts +0 -1
- package/dist/src/generic/service/index.js +0 -18
- package/dist/src/generic/service/index.js.map +0 -1
- package/dist/src/generic/service/service.generic.d.ts +0 -18
- package/dist/src/generic/service/service.generic.js +0 -85
- package/dist/src/generic/service/service.generic.js.map +0 -1
- package/dist/src/index.d.ts +0 -11
- package/dist/src/index.js +0 -28
- package/dist/src/index.js.map +0 -1
- package/dist/src/interface/index.d.ts +0 -1
- package/dist/src/interface/index.js +0 -18
- package/dist/src/interface/index.js.map +0 -1
- package/dist/src/interface/social.interface.d.ts +0 -6
- package/dist/src/interface/social.interface.js +0 -3
- package/dist/src/interface/social.interface.js.map +0 -1
- package/dist/src/lib/index.d.ts +0 -4
- package/dist/src/lib/index.js +0 -21
- package/dist/src/lib/index.js.map +0 -1
- package/dist/src/lib/mailer/config/index.d.ts +0 -1
- package/dist/src/lib/mailer/config/index.js +0 -18
- package/dist/src/lib/mailer/config/index.js.map +0 -1
- package/dist/src/lib/mailer/config/mailer.config.d.ts +0 -3
- package/dist/src/lib/mailer/config/mailer.config.js +0 -72
- package/dist/src/lib/mailer/config/mailer.config.js.map +0 -1
- package/dist/src/lib/mailer/index.d.ts +0 -2
- package/dist/src/lib/mailer/index.js +0 -19
- package/dist/src/lib/mailer/index.js.map +0 -1
- package/dist/src/lib/mailer/mailer.module.d.ts +0 -2
- package/dist/src/lib/mailer/mailer.module.js +0 -20
- package/dist/src/lib/mailer/mailer.module.js.map +0 -1
- package/dist/src/lib/mailer/mailer.service.d.ts +0 -12
- package/dist/src/lib/mailer/mailer.service.js +0 -66
- package/dist/src/lib/mailer/mailer.service.js.map +0 -1
- package/dist/src/lib/redis/index.d.ts +0 -2
- package/dist/src/lib/redis/index.js +0 -7
- package/dist/src/lib/redis/index.js.map +0 -1
- package/dist/src/lib/search-engine/document/base.document.d.ts +0 -3
- package/dist/src/lib/search-engine/document/base.document.js +0 -7
- package/dist/src/lib/search-engine/document/base.document.js.map +0 -1
- package/dist/src/lib/search-engine/document/index.d.ts +0 -1
- package/dist/src/lib/search-engine/document/index.js +0 -18
- package/dist/src/lib/search-engine/document/index.js.map +0 -1
- package/dist/src/lib/search-engine/index.d.ts +0 -3
- package/dist/src/lib/search-engine/index.js +0 -20
- package/dist/src/lib/search-engine/index.js.map +0 -1
- package/dist/src/lib/search-engine/interface/index.d.ts +0 -2
- package/dist/src/lib/search-engine/interface/index.js +0 -19
- package/dist/src/lib/search-engine/interface/index.js.map +0 -1
- package/dist/src/lib/search-engine/interface/search-document.interface.d.ts +0 -4
- package/dist/src/lib/search-engine/interface/search-document.interface.js +0 -3
- package/dist/src/lib/search-engine/interface/search-document.interface.js.map +0 -1
- package/dist/src/lib/search-engine/interface/transform-service.interface.d.ts +0 -6
- package/dist/src/lib/search-engine/interface/transform-service.interface.js +0 -3
- package/dist/src/lib/search-engine/interface/transform-service.interface.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/collection/index.d.ts +0 -1
- package/dist/src/lib/search-engine/typesense/collection/index.js +0 -18
- package/dist/src/lib/search-engine/typesense/collection/index.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/document/index.d.ts +0 -1
- package/dist/src/lib/search-engine/typesense/document/index.js +0 -18
- package/dist/src/lib/search-engine/typesense/document/index.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/index.d.ts +0 -4
- package/dist/src/lib/search-engine/typesense/index.js +0 -21
- package/dist/src/lib/search-engine/typesense/index.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/metadata/index.d.ts +0 -2
- package/dist/src/lib/search-engine/typesense/metadata/index.js +0 -19
- package/dist/src/lib/search-engine/typesense/metadata/index.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/metadata/schema.metadata.d.ts +0 -13
- package/dist/src/lib/search-engine/typesense/metadata/schema.metadata.js +0 -3
- package/dist/src/lib/search-engine/typesense/metadata/schema.metadata.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/metadata/typesense.metadata-registry.d.ts +0 -10
- package/dist/src/lib/search-engine/typesense/metadata/typesense.metadata-registry.js +0 -33
- package/dist/src/lib/search-engine/typesense/metadata/typesense.metadata-registry.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/service/client.service.d.ts +0 -34
- package/dist/src/lib/search-engine/typesense/service/client.service.js +0 -200
- package/dist/src/lib/search-engine/typesense/service/client.service.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/service/index.d.ts +0 -1
- package/dist/src/lib/search-engine/typesense/service/index.js +0 -18
- package/dist/src/lib/search-engine/typesense/service/index.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/typesense-module.interface.d.ts +0 -27
- package/dist/src/lib/search-engine/typesense/typesense-module.interface.js +0 -3
- package/dist/src/lib/search-engine/typesense/typesense-module.interface.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/typesense.constants.d.ts +0 -1
- package/dist/src/lib/search-engine/typesense/typesense.constants.js +0 -5
- package/dist/src/lib/search-engine/typesense/typesense.constants.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/typesense.module.d.ts +0 -8
- package/dist/src/lib/search-engine/typesense/typesense.module.js +0 -68
- package/dist/src/lib/search-engine/typesense/typesense.module.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/typesense.module.test.d.ts +0 -1
- package/dist/src/lib/search-engine/typesense/typesense.module.test.js +0 -89
- package/dist/src/lib/search-engine/typesense/typesense.module.test.js.map +0 -1
- package/dist/src/lib/search-engine/typesense/typesense.providers.d.ts +0 -4
- package/dist/src/lib/search-engine/typesense/typesense.providers.js +0 -40
- package/dist/src/lib/search-engine/typesense/typesense.providers.js.map +0 -1
- package/dist/src/lib/storage/index.d.ts +0 -2
- package/dist/src/lib/storage/index.js +0 -7
- package/dist/src/lib/storage/index.js.map +0 -1
- package/dist/src/response/base-entity.response.d.ts +0 -3
- package/dist/src/response/base-entity.response.js +0 -23
- package/dist/src/response/base-entity.response.js.map +0 -1
- package/dist/src/response/index.d.ts +0 -2
- package/dist/src/response/index.js +0 -19
- package/dist/src/response/index.js.map +0 -1
- package/dist/src/response/login.response.d.ts +0 -0
- package/dist/src/response/login.response.js +0 -1
- package/dist/src/response/login.response.js.map +0 -1
- package/dist/src/response/pagination.response.d.ts +0 -17
- package/dist/src/response/pagination.response.js +0 -68
- package/dist/src/response/pagination.response.js.map +0 -1
- package/dist/src/setup/index.d.ts +0 -1
- package/dist/src/setup/index.js +0 -18
- package/dist/src/setup/index.js.map +0 -1
- package/dist/src/setup/microservice.setup.d.ts +0 -2
- package/dist/src/setup/microservice.setup.js +0 -25
- package/dist/src/setup/microservice.setup.js.map +0 -1
- package/dist/src/setup/swagger.setup.d.ts +0 -0
- package/dist/src/setup/swagger.setup.js +0 -1
- package/dist/src/setup/swagger.setup.js.map +0 -1
- package/dist/src/type/index.d.ts +0 -1
- package/dist/src/type/index.js +0 -18
- package/dist/src/type/index.js.map +0 -1
- package/dist/src/type/unknown.type.d.ts +0 -1
- package/dist/src/type/unknown.type.js +0 -3
- package/dist/src/type/unknown.type.js.map +0 -1
- package/dist/src/util/app.utils.d.ts +0 -4
- package/dist/src/util/app.utils.js +0 -21
- package/dist/src/util/app.utils.js.map +0 -1
- package/dist/src/util/date.util.d.ts +0 -2
- package/dist/src/util/date.util.js +0 -14
- package/dist/src/util/date.util.js.map +0 -1
- package/dist/src/util/generator.util.d.ts +0 -4
- package/dist/src/util/generator.util.js +0 -29
- package/dist/src/util/generator.util.js.map +0 -1
- package/dist/src/util/index.d.ts +0 -4
- package/dist/src/util/index.js +0 -21
- package/dist/src/util/index.js.map +0 -1
- package/dist/src/util/validate-config.d.ts +0 -2
- package/dist/src/util/validate-config.js +0 -19
- package/dist/src/util/validate-config.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1,79 +1,79 @@
|
|
1
|
-
import * as bcrypt from 'bcrypt';
|
2
|
-
import {
|
3
|
-
generateKey,
|
4
|
-
generateDigitCode,
|
5
|
-
generatePassword,
|
6
|
-
} from './generator.util';
|
7
|
-
|
8
|
-
describe('Utils', () => {
|
9
|
-
describe('generateKey', () => {
|
10
|
-
it('should generate a key of the specified length', () => {
|
11
|
-
const keyLength = 10;
|
12
|
-
const key = generateKey(keyLength);
|
13
|
-
expect(key).toHaveLength(keyLength);
|
14
|
-
});
|
15
|
-
|
16
|
-
it('should generate a key with default length if not specified', () => {
|
17
|
-
const defaultKeyLength = 36;
|
18
|
-
const key = generateKey();
|
19
|
-
expect(key).toHaveLength(defaultKeyLength);
|
20
|
-
});
|
21
|
-
});
|
22
|
-
|
23
|
-
describe('generateDigitCode', () => {
|
24
|
-
it('should generate a digit code of the specified length', () => {
|
25
|
-
const codeLength = 6;
|
26
|
-
const code = generateDigitCode(codeLength);
|
27
|
-
expect(code).toHaveLength(codeLength);
|
28
|
-
expect(Number(code)).toBeGreaterThanOrEqual(100000);
|
29
|
-
expect(Number(code)).toBeLessThanOrEqual(999999);
|
30
|
-
});
|
31
|
-
|
32
|
-
it('should generate a digit code with default length if not specified', () => {
|
33
|
-
const defaultCodeLength = 4;
|
34
|
-
const code = generateDigitCode();
|
35
|
-
expect(code).toHaveLength(defaultCodeLength);
|
36
|
-
expect(Number(code)).toBeGreaterThanOrEqual(1000);
|
37
|
-
expect(Number(code)).toBeLessThanOrEqual(9999);
|
38
|
-
});
|
39
|
-
});
|
40
|
-
|
41
|
-
describe('Utility Functions', () => {
|
42
|
-
test('generatePassword should return a hashed password with the specified salt rounds', async () => {
|
43
|
-
// Arrange
|
44
|
-
const password = 'password123';
|
45
|
-
const saltRounds = 12;
|
46
|
-
|
47
|
-
// Act
|
48
|
-
const hashedPassword = await generatePassword(password, saltRounds);
|
49
|
-
|
50
|
-
// Assert
|
51
|
-
expect(typeof hashedPassword).toBe('string');
|
52
|
-
expect(hashedPassword).not.toBe(password);
|
53
|
-
expect(await bcrypt.compare(password, hashedPassword)).toBeTruthy();
|
54
|
-
});
|
55
|
-
|
56
|
-
test('generatePassword should use the default salt rounds when no value is provided', async () => {
|
57
|
-
// Arrange
|
58
|
-
const password = 'password123';
|
59
|
-
const defaultSaltRounds = 10;
|
60
|
-
|
61
|
-
// Act
|
62
|
-
const hashedPassword = await generatePassword(password);
|
63
|
-
|
64
|
-
// Assert
|
65
|
-
expect(typeof hashedPassword).toBe('string');
|
66
|
-
expect(hashedPassword).not.toBe(password);
|
67
|
-
expect(await bcrypt.compare(password, hashedPassword)).toBeTruthy();
|
68
|
-
expect(bcrypt.getRounds(hashedPassword)).toBe(defaultSaltRounds);
|
69
|
-
});
|
70
|
-
|
71
|
-
test('generatePassword should throw an error when an invalid password is provided', async () => {
|
72
|
-
// Arrange
|
73
|
-
const invalidPassword = '';
|
74
|
-
|
75
|
-
// Act and Assert
|
76
|
-
await expect(generatePassword(invalidPassword)).rejects.toThrow();
|
77
|
-
});
|
78
|
-
});
|
79
|
-
});
|
1
|
+
import * as bcrypt from 'bcrypt';
|
2
|
+
import {
|
3
|
+
generateKey,
|
4
|
+
generateDigitCode,
|
5
|
+
generatePassword,
|
6
|
+
} from './generator.util';
|
7
|
+
|
8
|
+
describe('Utils', () => {
|
9
|
+
describe('generateKey', () => {
|
10
|
+
it('should generate a key of the specified length', () => {
|
11
|
+
const keyLength = 10;
|
12
|
+
const key = generateKey(keyLength);
|
13
|
+
expect(key).toHaveLength(keyLength);
|
14
|
+
});
|
15
|
+
|
16
|
+
it('should generate a key with default length if not specified', () => {
|
17
|
+
const defaultKeyLength = 36;
|
18
|
+
const key = generateKey();
|
19
|
+
expect(key).toHaveLength(defaultKeyLength);
|
20
|
+
});
|
21
|
+
});
|
22
|
+
|
23
|
+
describe('generateDigitCode', () => {
|
24
|
+
it('should generate a digit code of the specified length', () => {
|
25
|
+
const codeLength = 6;
|
26
|
+
const code = generateDigitCode(codeLength);
|
27
|
+
expect(code).toHaveLength(codeLength);
|
28
|
+
expect(Number(code)).toBeGreaterThanOrEqual(100000);
|
29
|
+
expect(Number(code)).toBeLessThanOrEqual(999999);
|
30
|
+
});
|
31
|
+
|
32
|
+
it('should generate a digit code with default length if not specified', () => {
|
33
|
+
const defaultCodeLength = 4;
|
34
|
+
const code = generateDigitCode();
|
35
|
+
expect(code).toHaveLength(defaultCodeLength);
|
36
|
+
expect(Number(code)).toBeGreaterThanOrEqual(1000);
|
37
|
+
expect(Number(code)).toBeLessThanOrEqual(9999);
|
38
|
+
});
|
39
|
+
});
|
40
|
+
|
41
|
+
describe('Utility Functions', () => {
|
42
|
+
test('generatePassword should return a hashed password with the specified salt rounds', async () => {
|
43
|
+
// Arrange
|
44
|
+
const password = 'password123';
|
45
|
+
const saltRounds = 12;
|
46
|
+
|
47
|
+
// Act
|
48
|
+
const hashedPassword = await generatePassword(password, saltRounds);
|
49
|
+
|
50
|
+
// Assert
|
51
|
+
expect(typeof hashedPassword).toBe('string');
|
52
|
+
expect(hashedPassword).not.toBe(password);
|
53
|
+
expect(await bcrypt.compare(password, hashedPassword)).toBeTruthy();
|
54
|
+
});
|
55
|
+
|
56
|
+
test('generatePassword should use the default salt rounds when no value is provided', async () => {
|
57
|
+
// Arrange
|
58
|
+
const password = 'password123';
|
59
|
+
const defaultSaltRounds = 10;
|
60
|
+
|
61
|
+
// Act
|
62
|
+
const hashedPassword = await generatePassword(password);
|
63
|
+
|
64
|
+
// Assert
|
65
|
+
expect(typeof hashedPassword).toBe('string');
|
66
|
+
expect(hashedPassword).not.toBe(password);
|
67
|
+
expect(await bcrypt.compare(password, hashedPassword)).toBeTruthy();
|
68
|
+
expect(bcrypt.getRounds(hashedPassword)).toBe(defaultSaltRounds);
|
69
|
+
});
|
70
|
+
|
71
|
+
test('generatePassword should throw an error when an invalid password is provided', async () => {
|
72
|
+
// Arrange
|
73
|
+
const invalidPassword = '';
|
74
|
+
|
75
|
+
// Act and Assert
|
76
|
+
await expect(generatePassword(invalidPassword)).rejects.toThrow();
|
77
|
+
});
|
78
|
+
});
|
79
|
+
});
|
@@ -1,34 +1,34 @@
|
|
1
|
-
import * as bcrypt from 'bcrypt';
|
2
|
-
|
3
|
-
export const generateKey = (length = 36) => {
|
4
|
-
const chars =
|
5
|
-
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
6
|
-
let result = '';
|
7
|
-
for (let i = length; i > 0; i--) {
|
8
|
-
result += chars[Math.floor(Math.random() * chars.length)];
|
9
|
-
}
|
10
|
-
return result;
|
11
|
-
};
|
12
|
-
|
13
|
-
export const generateDigitCode = (length = 4): string => {
|
14
|
-
const startAt = 1 + '0'.repeat(length - 1);
|
15
|
-
const endAt = 9 + '0'.repeat(length - 1);
|
16
|
-
const generateCode = `${Math.floor(
|
17
|
-
Number(startAt) + Math.random() * Number(endAt),
|
18
|
-
)}`;
|
19
|
-
return generateCode;
|
20
|
-
};
|
21
|
-
|
22
|
-
export const generatePassword = async (
|
23
|
-
password: string,
|
24
|
-
saltOrRounds = 10,
|
25
|
-
): Promise<string> => {
|
26
|
-
return await bcrypt.hash(password, saltOrRounds);
|
27
|
-
};
|
28
|
-
|
29
|
-
export const comparePassword = (
|
30
|
-
password: string,
|
31
|
-
hashPassword: string,
|
32
|
-
): Promise<boolean> => {
|
33
|
-
return bcrypt.compare(password, hashPassword);
|
34
|
-
};
|
1
|
+
import * as bcrypt from 'bcrypt';
|
2
|
+
|
3
|
+
export const generateKey = (length = 36) => {
|
4
|
+
const chars =
|
5
|
+
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
6
|
+
let result = '';
|
7
|
+
for (let i = length; i > 0; i--) {
|
8
|
+
result += chars[Math.floor(Math.random() * chars.length)];
|
9
|
+
}
|
10
|
+
return result;
|
11
|
+
};
|
12
|
+
|
13
|
+
export const generateDigitCode = (length = 4): string => {
|
14
|
+
const startAt = 1 + '0'.repeat(length - 1);
|
15
|
+
const endAt = 9 + '0'.repeat(length - 1);
|
16
|
+
const generateCode = `${Math.floor(
|
17
|
+
Number(startAt) + Math.random() * Number(endAt),
|
18
|
+
)}`;
|
19
|
+
return generateCode;
|
20
|
+
};
|
21
|
+
|
22
|
+
export const generatePassword = async (
|
23
|
+
password: string,
|
24
|
+
saltOrRounds = 10,
|
25
|
+
): Promise<string> => {
|
26
|
+
return await bcrypt.hash(password, saltOrRounds);
|
27
|
+
};
|
28
|
+
|
29
|
+
export const comparePassword = (
|
30
|
+
password: string,
|
31
|
+
hashPassword: string,
|
32
|
+
): Promise<boolean> => {
|
33
|
+
return bcrypt.compare(password, hashPassword);
|
34
|
+
};
|
package/src/util/index.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export * from './date.util';
|
2
|
-
export * from './generator.util';
|
3
|
-
export * from './app.utils';
|
4
|
-
export * from './validate-config';
|
1
|
+
export * from './date.util';
|
2
|
+
export * from './generator.util';
|
3
|
+
export * from './app.utils';
|
4
|
+
export * from './validate-config';
|
package/test/app.e2e-spec.ts
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
import { Test, TestingModule } from '@nestjs/testing';
|
2
|
-
import { INestApplication } from '@nestjs/common';
|
3
|
-
import * as request from 'supertest';
|
4
|
-
import { AppModule } from './../src/app.module';
|
5
|
-
|
6
|
-
describe('AppController (e2e)', () => {
|
7
|
-
let app: INestApplication;
|
8
|
-
|
9
|
-
beforeEach(async () => {
|
10
|
-
const moduleFixture: TestingModule = await Test.createTestingModule({
|
11
|
-
imports: [AppModule],
|
12
|
-
}).compile();
|
13
|
-
|
14
|
-
app = moduleFixture.createNestApplication();
|
15
|
-
await app.init();
|
16
|
-
});
|
17
|
-
|
18
|
-
it('/ (GET)', () => {
|
19
|
-
return request(app.getHttpServer())
|
20
|
-
.get('/')
|
21
|
-
.expect(200)
|
22
|
-
.expect('Hello World!');
|
23
|
-
});
|
24
|
-
});
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
2
|
+
import { INestApplication } from '@nestjs/common';
|
3
|
+
import * as request from 'supertest';
|
4
|
+
import { AppModule } from './../src/app.module';
|
5
|
+
|
6
|
+
describe('AppController (e2e)', () => {
|
7
|
+
let app: INestApplication;
|
8
|
+
|
9
|
+
beforeEach(async () => {
|
10
|
+
const moduleFixture: TestingModule = await Test.createTestingModule({
|
11
|
+
imports: [AppModule],
|
12
|
+
}).compile();
|
13
|
+
|
14
|
+
app = moduleFixture.createNestApplication();
|
15
|
+
await app.init();
|
16
|
+
});
|
17
|
+
|
18
|
+
it('/ (GET)', () => {
|
19
|
+
return request(app.getHttpServer())
|
20
|
+
.get('/')
|
21
|
+
.expect(200)
|
22
|
+
.expect('Hello World!');
|
23
|
+
});
|
24
|
+
});
|
package/test/jest-e2e.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
{
|
2
|
-
"moduleFileExtensions": ["js", "json", "ts"],
|
3
|
-
"rootDir": ".",
|
4
|
-
"testEnvironment": "node",
|
5
|
-
"testRegex": ".e2e-spec.ts$",
|
6
|
-
"transform": {
|
7
|
-
"^.+\\.(t|j)s$": "ts-jest"
|
8
|
-
}
|
9
|
-
}
|
1
|
+
{
|
2
|
+
"moduleFileExtensions": ["js", "json", "ts"],
|
3
|
+
"rootDir": ".",
|
4
|
+
"testEnvironment": "node",
|
5
|
+
"testRegex": ".e2e-spec.ts$",
|
6
|
+
"transform": {
|
7
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
8
|
+
}
|
9
|
+
}
|
package/tsconfig.build.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
{
|
2
|
-
"extends": "./tsconfig.json",
|
3
|
-
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
4
|
-
}
|
1
|
+
{
|
2
|
+
"extends": "./tsconfig.json",
|
3
|
+
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
4
|
+
}
|
package/tsconfig.json
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"module": "commonjs",
|
4
|
-
"declaration": true,
|
5
|
-
"removeComments": true,
|
6
|
-
"emitDecoratorMetadata": true,
|
7
|
-
"experimentalDecorators": true,
|
8
|
-
"allowSyntheticDefaultImports": true,
|
9
|
-
"target": "es2017",
|
10
|
-
"sourceMap": true,
|
11
|
-
"outDir": "./dist",
|
12
|
-
"baseUrl": "./",
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"
|
16
|
-
"
|
17
|
-
"
|
18
|
-
"
|
19
|
-
"
|
20
|
-
|
21
|
-
}
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"module": "commonjs",
|
4
|
+
"declaration": true,
|
5
|
+
"removeComments": true,
|
6
|
+
"emitDecoratorMetadata": true,
|
7
|
+
"experimentalDecorators": true,
|
8
|
+
"allowSyntheticDefaultImports": true,
|
9
|
+
"target": "es2017",
|
10
|
+
"sourceMap": true,
|
11
|
+
"outDir": "./dist",
|
12
|
+
"baseUrl": "./",
|
13
|
+
"newLine": "LF",
|
14
|
+
"incremental": true,
|
15
|
+
"skipLibCheck": true,
|
16
|
+
"strictNullChecks": false,
|
17
|
+
"noImplicitAny": false,
|
18
|
+
"strictBindCallApply": false,
|
19
|
+
"forceConsistentCasingInFileNames": false,
|
20
|
+
"noFallthroughCasesInSwitch": false
|
21
|
+
}
|
22
|
+
}
|
package/dist/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './src';
|
package/dist/index.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./src"), exports);
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB"}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
-
exports.AppleModule = void 0;
|
10
|
-
const common_1 = require("@nestjs/common");
|
11
|
-
const apple_service_1 = require("./apple.service");
|
12
|
-
const config_1 = require("@nestjs/config");
|
13
|
-
let AppleModule = exports.AppleModule = class AppleModule {
|
14
|
-
};
|
15
|
-
exports.AppleModule = AppleModule = __decorate([
|
16
|
-
(0, common_1.Module)({
|
17
|
-
imports: [config_1.ConfigModule],
|
18
|
-
providers: [apple_service_1.AppleService],
|
19
|
-
exports: [apple_service_1.AppleService],
|
20
|
-
})
|
21
|
-
], AppleModule);
|
22
|
-
//# sourceMappingURL=apple.module.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"apple.module.js","sourceRoot":"","sources":["../../../../src/auth/apple/apple.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAA+C;AAC/C,2CAA8C;AAOvC,IAAM,WAAW,yBAAjB,MAAM,WAAW;CAAG,CAAA;sBAAd,WAAW;IALvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,CAAC;QACvB,SAAS,EAAE,CAAC,4BAAY,CAAC;QACzB,OAAO,EAAE,CAAC,4BAAY,CAAC;KACxB,CAAC;GACW,WAAW,CAAG"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { ConfigService } from '@nestjs/config';
|
2
|
-
import { SocialInterface } from '../../interface';
|
3
|
-
import { AppleLoginDto } from './dto';
|
4
|
-
import { AllConfigType } from '../../config';
|
5
|
-
export declare class AppleService {
|
6
|
-
private configService;
|
7
|
-
constructor(configService: ConfigService<AllConfigType>);
|
8
|
-
getProfileByToken(loginDto: AppleLoginDto): Promise<SocialInterface>;
|
9
|
-
}
|
@@ -1,38 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.AppleService = void 0;
|
13
|
-
const common_1 = require("@nestjs/common");
|
14
|
-
const apple_signin_auth_1 = require("apple-signin-auth");
|
15
|
-
const config_1 = require("@nestjs/config");
|
16
|
-
let AppleService = exports.AppleService = class AppleService {
|
17
|
-
constructor(configService) {
|
18
|
-
this.configService = configService;
|
19
|
-
}
|
20
|
-
async getProfileByToken(loginDto) {
|
21
|
-
const { idToken, firstName, lastName } = loginDto;
|
22
|
-
const data = await apple_signin_auth_1.default.verifyIdToken(idToken, {
|
23
|
-
audience: this.configService.get('apple.appAudience', { infer: true }),
|
24
|
-
});
|
25
|
-
const { sub, email } = data;
|
26
|
-
return {
|
27
|
-
id: sub,
|
28
|
-
email: email,
|
29
|
-
firstName: firstName,
|
30
|
-
lastName: lastName,
|
31
|
-
};
|
32
|
-
}
|
33
|
-
};
|
34
|
-
exports.AppleService = AppleService = __decorate([
|
35
|
-
(0, common_1.Injectable)(),
|
36
|
-
__metadata("design:paramtypes", [config_1.ConfigService])
|
37
|
-
], AppleService);
|
38
|
-
//# sourceMappingURL=apple.service.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"apple.service.js","sourceRoot":"","sources":["../../../../src/auth/apple/apple.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yDAAgD;AAChD,2CAA+C;AAMxC,IAAM,YAAY,0BAAlB,MAAM,YAAY;IACvB,YAAoB,aAA2C;QAA3C,kBAAa,GAAb,aAAa,CAA8B;IAAG,CAAC;IAEnE,KAAK,CAAC,iBAAiB,CAAC,QAAuB;QAC7C,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC;QAElD,MAAM,IAAI,GAAG,MAAM,2BAAe,CAAC,aAAa,CAAC,OAAO,EAAE;YACxD,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACvE,CAAC,CAAC;QAEH,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAE5B,OAAO;YACL,EAAE,EAAE,GAAG;YACP,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,SAAS;YACpB,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC;CACF,CAAA;uBAnBY,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAEwB,sBAAa;GADrC,YAAY,CAmBxB"}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.AppleLoginDto = void 0;
|
13
|
-
const swagger_1 = require("@nestjs/swagger");
|
14
|
-
const class_validator_1 = require("class-validator");
|
15
|
-
class AppleLoginDto {
|
16
|
-
}
|
17
|
-
exports.AppleLoginDto = AppleLoginDto;
|
18
|
-
__decorate([
|
19
|
-
(0, swagger_1.ApiProperty)({ example: 'abc' }),
|
20
|
-
(0, class_validator_1.IsNotEmpty)(),
|
21
|
-
__metadata("design:type", String)
|
22
|
-
], AppleLoginDto.prototype, "idToken", void 0);
|
23
|
-
__decorate([
|
24
|
-
(0, class_validator_1.Allow)(),
|
25
|
-
(0, swagger_1.ApiProperty)({ required: false }),
|
26
|
-
__metadata("design:type", String)
|
27
|
-
], AppleLoginDto.prototype, "firstName", void 0);
|
28
|
-
__decorate([
|
29
|
-
(0, class_validator_1.Allow)(),
|
30
|
-
(0, swagger_1.ApiProperty)({ required: false }),
|
31
|
-
__metadata("design:type", String)
|
32
|
-
], AppleLoginDto.prototype, "lastName", void 0);
|
33
|
-
//# sourceMappingURL=apple-login.dto.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"apple-login.dto.js","sourceRoot":"","sources":["../../../../../src/auth/apple/dto/apple-login.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAAoD;AAEpD,MAAa,aAAa;CAYzB;AAZD,sCAYC;AATC;IAFC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC/B,IAAA,4BAAU,GAAE;;8CACG;AAIhB;IAFC,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;gDACd;AAInB;IAFC,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;+CACf"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './apple-login.dto';
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./apple-login.dto"), exports);
|
18
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/auth/apple/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./dto"), exports);
|
18
|
-
__exportStar(require("./apple.module"), exports);
|
19
|
-
__exportStar(require("./apple.service"), exports);
|
20
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/auth/apple/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,iDAA+B;AAC/B,kDAAgC"}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const config_1 = require("@nestjs/config");
|
13
|
-
const class_validator_1 = require("class-validator");
|
14
|
-
const util_1 = require("../../util");
|
15
|
-
class EnvironmentVariablesValidator {
|
16
|
-
}
|
17
|
-
__decorate([
|
18
|
-
(0, class_validator_1.IsJSON)(),
|
19
|
-
(0, class_validator_1.IsOptional)(),
|
20
|
-
__metadata("design:type", String)
|
21
|
-
], EnvironmentVariablesValidator.prototype, "APPLE_APP_AUDIENCE", void 0);
|
22
|
-
exports.default = (0, config_1.registerAs)('apple', () => {
|
23
|
-
var _a;
|
24
|
-
(0, util_1.validateConfig)(process.env, EnvironmentVariablesValidator);
|
25
|
-
return {
|
26
|
-
appAudience: JSON.parse((_a = process.env.APPLE_APP_AUDIENCE) !== null && _a !== void 0 ? _a : '[]'),
|
27
|
-
};
|
28
|
-
});
|
29
|
-
//# sourceMappingURL=apple.config.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"apple.config.js","sourceRoot":"","sources":["../../../../src/auth/config/apple.config.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAA4C;AAE5C,qDAAqD;AACrD,qCAA4C;AAE5C,MAAM,6BAA6B;CAIlC;AADC;IAFC,IAAA,wBAAM,GAAE;IACR,IAAA,4BAAU,GAAE;;yEACc;AAG7B,kBAAe,IAAA,mBAAU,EAAc,OAAO,EAAE,GAAG,EAAE;;IACnD,IAAA,qBAAc,EAAC,OAAO,CAAC,GAAG,EAAE,6BAA6B,CAAC,CAAC;IAE3D,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB,mCAAI,IAAI,CAAC;KAChE,CAAC;AACJ,CAAC,CAAC,CAAC"}
|