├── .codeclimate.yml ├── .commitlintrc.json ├── .eslintignore ├── .eslintrc.js ├── .github └── workflows │ ├── codeql-analysis.yml │ ├── major-release.yml │ ├── minor-release.yml │ ├── patch-release.yml │ └── test.yml ├── .gitignore ├── .huskyrc.json ├── .prettierignore ├── .prettierrc.js ├── .vscode ├── extensions.json └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── docker-compose.yaml ├── jest.config.base.js ├── lerna.json ├── lint-staged.config.js ├── package-lock.json ├── package.json ├── packages ├── decorators │ ├── .eslintrc.js │ ├── .npmignore │ ├── .prettierrc.js │ ├── CHANGELOG.md │ ├── README.md │ ├── jest-e2e.config.js │ ├── jest.config.js │ ├── package.json │ ├── src │ │ ├── boolean-colum.spec-e2e.ts │ │ ├── boolean-colum.spec.ts │ │ ├── boolean-column.ts │ │ ├── encrypt-column.spec-e2e.ts │ │ ├── encrypt-column.spec.ts │ │ ├── encrypt-column.ts │ │ ├── hmac-column.spec-e2e.ts │ │ ├── hmac-column.spec.ts │ │ ├── hmac-column.ts │ │ ├── index.ts │ │ ├── json-column.spec-e2e.ts │ │ ├── json-column.spec.ts │ │ ├── json-column.ts │ │ ├── static-file-colum.spec-e2e.ts │ │ ├── static-file-colum.spec.ts │ │ ├── static-file-column.ts │ │ ├── ulid-column.spec-e2e.ts │ │ ├── ulid-column.spec.ts │ │ └── ulid-column.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── testing │ ├── CHANGELOG.md │ ├── package.json │ └── src │ │ └── index.ts └── transformers │ ├── .eslintrc.js │ ├── .npmignore │ ├── .prettierrc.js │ ├── CHANGELOG.md │ ├── README.md │ ├── jest-e2e.config.js │ ├── jest.config.js │ ├── package.json │ ├── src │ ├── boolean.spec-e2e.ts │ ├── boolean.spec.ts │ ├── boolean.ts │ ├── encrypt.spec.ts │ ├── encrypt.ts │ ├── hmac.spec-e2e.ts │ ├── hmac.spec.ts │ ├── hmac.ts │ ├── index.ts │ ├── json.spec-e2e.ts │ ├── json.spec.ts │ ├── json.ts │ ├── null-to-undefined.spec-e2e.ts │ ├── null-to-undefined.spec.ts │ ├── null-to-undefined.ts │ ├── static-file.spec-e2e.ts │ ├── static-file.spec.ts │ ├── static-file.ts │ └── utils.ts │ ├── test-files │ └── image.png │ ├── tsconfig.build.json │ └── tsconfig.json ├── renovate.json ├── tsconfig.base.json ├── tsconfig.eslint.json └── turbo.json /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | plugins: 3 | eslint: 4 | enabled: true 5 | channel: "eslint-5" 6 | checks: 7 | similar-code: 8 | enabled: false 9 | exclude_patterns: 10 | - "**/coverage/" 11 | - "**/node_modules/" 12 | - "**/dist/" 13 | -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@commitlint/config-conventional"] 3 | } 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | coverage 2 | dist 3 | node_modules -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | module.exports = { 3 | env: { 4 | node: true, 5 | jest: true, 6 | }, 7 | extends: ["plugin:@typescript-eslint/recommended", "prettier"], 8 | parser: "@typescript-eslint/parser", 9 | parserOptions: { 10 | sourceType: "module", 11 | project: path.resolve(__dirname, "tsconfig.eslint.json"), 12 | }, 13 | plugins: ["@typescript-eslint"], 14 | rules: { 15 | "no-unused-vars": "off", 16 | "@typescript-eslint/ban-types": "off", 17 | "@typescript-eslint/no-unused-vars": "error", 18 | "no-useless-constructor": "off", 19 | "@typescript-eslint/no-useless-constructor": "error", 20 | "@typescript-eslint/no-explicit-any": "off", 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | name: "CodeQL" 7 | 8 | on: 9 | push: 10 | branches: [master] 11 | pull_request: 12 | # The branches below must be a subset of the branches above 13 | branches: [master] 14 | schedule: 15 | - cron: "0 16 * * 1" 16 | 17 | jobs: 18 | analyze: 19 | name: Analyze 20 | runs-on: ubuntu-latest 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | # Override automatic language detection by changing the below list 26 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] 27 | language: ["javascript"] 28 | # Learn more... 29 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection 30 | 31 | steps: 32 | - name: Checkout repository 33 | uses: actions/checkout@v4 34 | with: 35 | # We must fetch at least the immediate parents so that if this is 36 | # a pull request then we can checkout the head. 37 | fetch-depth: 2 38 | 39 | # Initializes the CodeQL tools for scanning. 40 | - name: Initialize CodeQL 41 | uses: github/codeql-action/init@v3 42 | with: 43 | languages: ${{ matrix.language }} 44 | # If you wish to specify custom queries, you can do so here or in a config file. 45 | # By default, queries listed here will override any specified in a config file. 46 | # Prefix the list here with "+" to use these queries and those in the config file. 47 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 48 | 49 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 50 | # If this step fails, then you should remove it and run the build manually (see below) 51 | - name: Autobuild 52 | uses: github/codeql-action/autobuild@v3 53 | 54 | # ℹ️ Command-line programs to run using the OS shell. 55 | # 📚 https://git.io/JvXDl 56 | 57 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 58 | # and modify them (or add more) to build your code if your project 59 | # uses a compiled language 60 | 61 | #- run: | 62 | # make bootstrap 63 | # make release 64 | 65 | - name: Perform CodeQL Analysis 66 | uses: github/codeql-action/analyze@v3 67 | -------------------------------------------------------------------------------- /.github/workflows/major-release.yml: -------------------------------------------------------------------------------- 1 | name: Major Release 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | publish: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@master 11 | - name: Checkout master 12 | run: git checkout master 13 | - uses: actions/setup-node@v4 14 | with: 15 | node-version: 20 16 | cache: npm 17 | - name: Install npm packages 18 | run: npm ci 19 | - name: Publish monorepo packages 20 | run: | 21 | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc 22 | git config --global user.name 'github-actions[bot]' 23 | git config --global user.email 'github-actions[bot]@users.noreply.github.com' 24 | git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY 25 | npx lerna publish --yes major 26 | -------------------------------------------------------------------------------- /.github/workflows/minor-release.yml: -------------------------------------------------------------------------------- 1 | name: Minor Release 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | publish: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@master 11 | - name: Checkout master 12 | run: git checkout master 13 | - uses: actions/setup-node@v4 14 | with: 15 | node-version: 20 16 | cache: npm 17 | - name: Install npm packages 18 | run: npm ci 19 | - name: Publish monorepo packages 20 | run: | 21 | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc 22 | git config --global user.name 'github-actions[bot]' 23 | git config --global user.email 'github-actions[bot]@users.noreply.github.com' 24 | git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY 25 | npx lerna publish --yes minor 26 | -------------------------------------------------------------------------------- /.github/workflows/patch-release.yml: -------------------------------------------------------------------------------- 1 | name: Patch Release 2 | 3 | on: 4 | schedule: 5 | - cron: "0 4 * * 0" 6 | branches: 7 | - master 8 | workflow_dispatch: 9 | 10 | jobs: 11 | publish: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@master 15 | - name: Checkout master 16 | run: git checkout master 17 | - uses: actions/setup-node@v4 18 | with: 19 | node-version: 20 20 | cache: npm 21 | - name: Install npm packages 22 | run: npm ci 23 | - name: Publish monorepo packages 24 | run: | 25 | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc 26 | git config --global user.name 'github-actions[bot]' 27 | git config --global user.email 'github-actions[bot]@users.noreply.github.com' 28 | git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY 29 | npx lerna publish --yes patch 30 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | env: 10 | TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} 11 | TURBO_TEAM: anchan828 12 | 13 | jobs: 14 | test: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@master 18 | - name: Run database 19 | run: docker-compose up -d 20 | - uses: actions/setup-node@v4 21 | with: 22 | node-version: 20 23 | cache: npm 24 | - name: Install npm packages 25 | run: npm ci 26 | - name: Lint 27 | run: npm run lint 28 | - name: Test monorepo packages 29 | run: npm test 30 | - name: Upload coverage to Codecov 31 | uses: codecov/codecov-action@v4 32 | - name: e2e test monorepo packages 33 | run: | 34 | npm run test:e2e -- --filter=@anchan828/typeorm-transformers 35 | npm run test:e2e -- --filter=@anchan828/typeorm-decorators 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | **/dist 3 | **/e2e-coverage 4 | **/coverage 5 | .DS_Store 6 | packages/*/LICENSE 7 | .turbo 8 | -------------------------------------------------------------------------------- /.huskyrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "pre-commit": "lint-staged", 4 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | coverage 2 | dist 3 | node_modules -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 120, 3 | trailingComma: "all", 4 | bracketSpacing: true, 5 | }; 6 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[typescript]": { 3 | "editor.codeActionsOnSave": { 4 | "source.organizeImports": "explicit" 5 | }, 6 | "editor.defaultFormatter": "esbenp.prettier-vscode" 7 | }, 8 | "editor.codeActionsOnSave": { 9 | "source.fixAll.eslint": "explicit" 10 | }, 11 | "editor.defaultFormatter": "esbenp.prettier-vscode", 12 | "editor.formatOnSave": true, 13 | "eslint.options": { 14 | "extensions": [".js", ".ts"] 15 | }, 16 | "eslint.validate": ["javascript", "typescript"], 17 | "eslint.workingDirectories": [ 18 | { 19 | "mode": "auto" 20 | } 21 | ], 22 | "typescript.preferences.importModuleSpecifier": "relative", 23 | "typescript.tsdk": "node_modules/typescript/lib" 24 | } 25 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## 1.0.100 (2024-03-17) 7 | 8 | **Note:** Version bump only for package @anchan828/typeorm-helpers 9 | 10 | ## 1.0.99 (2024-03-10) 11 | 12 | **Note:** Version bump only for package @anchan828/typeorm-helpers 13 | 14 | ## 1.0.98 (2024-03-03) 15 | 16 | **Note:** Version bump only for package @anchan828/typeorm-helpers 17 | 18 | ## 1.0.97 (2024-02-25) 19 | 20 | **Note:** Version bump only for package @anchan828/typeorm-helpers 21 | 22 | ## 1.0.96 (2024-02-18) 23 | 24 | **Note:** Version bump only for package @anchan828/typeorm-helpers 25 | 26 | ## 1.0.95 (2024-02-11) 27 | 28 | **Note:** Version bump only for package @anchan828/typeorm-helpers 29 | 30 | ## 1.0.94 (2024-02-04) 31 | 32 | **Note:** Version bump only for package @anchan828/typeorm-helpers 33 | 34 | ## 1.0.93 (2024-01-28) 35 | 36 | **Note:** Version bump only for package @anchan828/typeorm-helpers 37 | 38 | ## 1.0.92 (2024-01-21) 39 | 40 | **Note:** Version bump only for package @anchan828/typeorm-helpers 41 | 42 | ## 1.0.91 (2024-01-14) 43 | 44 | **Note:** Version bump only for package @anchan828/typeorm-helpers 45 | 46 | ## 1.0.90 (2024-01-07) 47 | 48 | **Note:** Version bump only for package @anchan828/typeorm-helpers 49 | 50 | ## 1.0.89 (2023-12-31) 51 | 52 | **Note:** Version bump only for package @anchan828/typeorm-helpers 53 | 54 | ## 1.0.88 (2023-12-24) 55 | 56 | **Note:** Version bump only for package @anchan828/typeorm-helpers 57 | 58 | ## 1.0.87 (2023-12-17) 59 | 60 | **Note:** Version bump only for package @anchan828/typeorm-helpers 61 | 62 | ## 1.0.86 (2023-12-10) 63 | 64 | **Note:** Version bump only for package @anchan828/typeorm-helpers 65 | 66 | ## 1.0.85 (2023-12-03) 67 | 68 | **Note:** Version bump only for package @anchan828/typeorm-helpers 69 | 70 | ## 1.0.84 (2023-11-26) 71 | 72 | **Note:** Version bump only for package @anchan828/typeorm-helpers 73 | 74 | ## 1.0.83 (2023-11-19) 75 | 76 | **Note:** Version bump only for package @anchan828/typeorm-helpers 77 | 78 | ## 1.0.82 (2023-11-12) 79 | 80 | **Note:** Version bump only for package @anchan828/typeorm-helpers 81 | 82 | ## 1.0.81 (2023-11-05) 83 | 84 | **Note:** Version bump only for package @anchan828/typeorm-helpers 85 | 86 | ## 1.0.80 (2023-10-29) 87 | 88 | **Note:** Version bump only for package @anchan828/typeorm-helpers 89 | 90 | ## 1.0.79 (2023-10-22) 91 | 92 | **Note:** Version bump only for package @anchan828/typeorm-helpers 93 | 94 | ## 1.0.78 (2023-10-15) 95 | 96 | **Note:** Version bump only for package @anchan828/typeorm-helpers 97 | 98 | ## 1.0.77 (2023-10-08) 99 | 100 | **Note:** Version bump only for package @anchan828/typeorm-helpers 101 | 102 | ## 1.0.76 (2023-10-01) 103 | 104 | **Note:** Version bump only for package @anchan828/typeorm-helpers 105 | 106 | ## 1.0.75 (2023-09-24) 107 | 108 | **Note:** Version bump only for package @anchan828/typeorm-helpers 109 | 110 | ## 1.0.74 (2023-09-17) 111 | 112 | **Note:** Version bump only for package @anchan828/typeorm-helpers 113 | 114 | ## 1.0.73 (2023-09-10) 115 | 116 | **Note:** Version bump only for package @anchan828/typeorm-helpers 117 | 118 | ## 1.0.72 (2023-09-03) 119 | 120 | **Note:** Version bump only for package @anchan828/typeorm-helpers 121 | 122 | ## 1.0.71 (2023-08-27) 123 | 124 | **Note:** Version bump only for package @anchan828/typeorm-helpers 125 | 126 | ## 1.0.70 (2023-08-20) 127 | 128 | **Note:** Version bump only for package @anchan828/typeorm-helpers 129 | 130 | ## 1.0.69 (2023-08-13) 131 | 132 | **Note:** Version bump only for package @anchan828/typeorm-helpers 133 | 134 | ## 1.0.68 (2023-08-06) 135 | 136 | **Note:** Version bump only for package @anchan828/typeorm-helpers 137 | 138 | ## 1.0.67 (2023-07-30) 139 | 140 | **Note:** Version bump only for package @anchan828/typeorm-helpers 141 | 142 | ## 1.0.66 (2023-07-23) 143 | 144 | **Note:** Version bump only for package @anchan828/typeorm-helpers 145 | 146 | ## 1.0.65 (2023-07-16) 147 | 148 | **Note:** Version bump only for package @anchan828/typeorm-helpers 149 | 150 | ## 1.0.64 (2023-07-09) 151 | 152 | **Note:** Version bump only for package @anchan828/typeorm-helpers 153 | 154 | ## 1.0.63 (2023-07-02) 155 | 156 | **Note:** Version bump only for package @anchan828/typeorm-helpers 157 | 158 | ## 1.0.62 (2023-06-25) 159 | 160 | **Note:** Version bump only for package @anchan828/typeorm-helpers 161 | 162 | ## 1.0.61 (2023-06-11) 163 | 164 | **Note:** Version bump only for package @anchan828/typeorm-helpers 165 | 166 | ## 1.0.60 (2023-06-04) 167 | 168 | **Note:** Version bump only for package @anchan828/typeorm-helpers 169 | 170 | ## 1.0.59 (2023-05-28) 171 | 172 | **Note:** Version bump only for package @anchan828/typeorm-helpers 173 | 174 | ## 1.0.58 (2023-05-21) 175 | 176 | **Note:** Version bump only for package @anchan828/typeorm-helpers 177 | 178 | ## 1.0.57 (2023-04-16) 179 | 180 | **Note:** Version bump only for package @anchan828/typeorm-helpers 181 | 182 | ## 1.0.56 (2023-04-09) 183 | 184 | **Note:** Version bump only for package @anchan828/typeorm-helpers 185 | 186 | ## 1.0.55 (2023-04-02) 187 | 188 | **Note:** Version bump only for package @anchan828/typeorm-helpers 189 | 190 | ## 1.0.54 (2023-03-26) 191 | 192 | **Note:** Version bump only for package @anchan828/typeorm-helpers 193 | 194 | ## 1.0.53 (2023-03-19) 195 | 196 | **Note:** Version bump only for package @anchan828/typeorm-helpers 197 | 198 | ## 1.0.52 (2023-03-12) 199 | 200 | **Note:** Version bump only for package @anchan828/typeorm-helpers 201 | 202 | ## 1.0.51 (2023-03-05) 203 | 204 | **Note:** Version bump only for package @anchan828/typeorm-helpers 205 | 206 | ## 1.0.50 (2023-02-26) 207 | 208 | **Note:** Version bump only for package @anchan828/typeorm-helpers 209 | 210 | ## 1.0.49 (2023-02-19) 211 | 212 | **Note:** Version bump only for package @anchan828/typeorm-helpers 213 | 214 | ## 1.0.48 (2023-02-12) 215 | 216 | **Note:** Version bump only for package @anchan828/typeorm-helpers 217 | 218 | ## 1.0.47 (2023-02-05) 219 | 220 | **Note:** Version bump only for package @anchan828/typeorm-helpers 221 | 222 | ## 1.0.46 (2023-01-29) 223 | 224 | **Note:** Version bump only for package @anchan828/typeorm-helpers 225 | 226 | ## 1.0.45 (2023-01-22) 227 | 228 | **Note:** Version bump only for package @anchan828/typeorm-helpers 229 | 230 | ## 1.0.44 (2023-01-15) 231 | 232 | **Note:** Version bump only for package @anchan828/typeorm-helpers 233 | 234 | ## 1.0.43 (2023-01-08) 235 | 236 | **Note:** Version bump only for package @anchan828/typeorm-helpers 237 | 238 | ## 1.0.42 (2023-01-01) 239 | 240 | ### Bug Fixes 241 | 242 | * **deps:** update dependency ulidx to ^0.4.0 ([02250b8](https://github.com/anchan828/typeorm-helpers/commit/02250b8f1c89beb2d90d8145b1ed40ac72b90647)) 243 | 244 | ## 1.0.41 (2022-12-25) 245 | 246 | **Note:** Version bump only for package @anchan828/typeorm-helpers 247 | 248 | ## 1.0.40 (2022-12-18) 249 | 250 | **Note:** Version bump only for package @anchan828/typeorm-helpers 251 | 252 | ## 1.0.39 (2022-12-11) 253 | 254 | **Note:** Version bump only for package @anchan828/typeorm-helpers 255 | 256 | ## 1.0.38 (2022-12-04) 257 | 258 | **Note:** Version bump only for package @anchan828/typeorm-helpers 259 | 260 | ## 1.0.37 (2022-11-27) 261 | 262 | **Note:** Version bump only for package @anchan828/typeorm-helpers 263 | 264 | ## 1.0.36 (2022-11-20) 265 | 266 | **Note:** Version bump only for package @anchan828/typeorm-helpers 267 | 268 | ## 1.0.35 (2022-11-13) 269 | 270 | **Note:** Version bump only for package @anchan828/typeorm-helpers 271 | 272 | ## 1.0.34 (2022-11-06) 273 | 274 | **Note:** Version bump only for package @anchan828/typeorm-helpers 275 | 276 | ## 1.0.33 (2022-10-30) 277 | 278 | **Note:** Version bump only for package @anchan828/typeorm-helpers 279 | 280 | ## 1.0.32 (2022-10-23) 281 | 282 | **Note:** Version bump only for package @anchan828/typeorm-helpers 283 | 284 | ## 1.0.31 (2022-10-16) 285 | 286 | **Note:** Version bump only for package @anchan828/typeorm-helpers 287 | 288 | ## 1.0.30 (2022-10-09) 289 | 290 | **Note:** Version bump only for package @anchan828/typeorm-helpers 291 | 292 | ## 1.0.29 (2022-10-02) 293 | 294 | **Note:** Version bump only for package @anchan828/typeorm-helpers 295 | 296 | ## 1.0.28 (2022-09-25) 297 | 298 | **Note:** Version bump only for package @anchan828/typeorm-helpers 299 | 300 | ## 1.0.27 (2022-09-18) 301 | 302 | **Note:** Version bump only for package @anchan828/typeorm-helpers 303 | 304 | ## 1.0.26 (2022-09-11) 305 | 306 | **Note:** Version bump only for package @anchan828/typeorm-helpers 307 | 308 | ## 1.0.25 (2022-09-04) 309 | 310 | **Note:** Version bump only for package @anchan828/typeorm-helpers 311 | 312 | ## 1.0.24 (2022-08-28) 313 | 314 | **Note:** Version bump only for package @anchan828/typeorm-helpers 315 | 316 | ## 1.0.23 (2022-08-21) 317 | 318 | **Note:** Version bump only for package @anchan828/typeorm-helpers 319 | 320 | ## 1.0.22 (2022-08-14) 321 | 322 | **Note:** Version bump only for package @anchan828/typeorm-helpers 323 | 324 | ## 1.0.21 (2022-08-07) 325 | 326 | **Note:** Version bump only for package @anchan828/typeorm-helpers 327 | 328 | ## 1.0.20 (2022-07-31) 329 | 330 | **Note:** Version bump only for package @anchan828/typeorm-helpers 331 | 332 | ## 1.0.19 (2022-07-24) 333 | 334 | **Note:** Version bump only for package @anchan828/typeorm-helpers 335 | 336 | ## 1.0.18 (2022-07-17) 337 | 338 | **Note:** Version bump only for package @anchan828/typeorm-helpers 339 | 340 | ## 1.0.17 (2022-07-10) 341 | 342 | **Note:** Version bump only for package @anchan828/typeorm-helpers 343 | 344 | ## 1.0.16 (2022-07-03) 345 | 346 | **Note:** Version bump only for package @anchan828/typeorm-helpers 347 | 348 | ## 1.0.15 (2022-06-26) 349 | 350 | **Note:** Version bump only for package @anchan828/typeorm-helpers 351 | 352 | ## 1.0.14 (2022-06-19) 353 | 354 | **Note:** Version bump only for package @anchan828/typeorm-helpers 355 | 356 | ## 1.0.13 (2022-06-12) 357 | 358 | **Note:** Version bump only for package @anchan828/typeorm-helpers 359 | 360 | ## 1.0.12 (2022-06-05) 361 | 362 | **Note:** Version bump only for package @anchan828/typeorm-helpers 363 | 364 | ## 1.0.11 (2022-05-29) 365 | 366 | **Note:** Version bump only for package @anchan828/typeorm-helpers 367 | 368 | ## 1.0.10 (2022-05-22) 369 | 370 | **Note:** Version bump only for package @anchan828/typeorm-helpers 371 | 372 | ## 1.0.9 (2022-05-15) 373 | 374 | **Note:** Version bump only for package @anchan828/typeorm-helpers 375 | 376 | ## 1.0.8 (2022-05-08) 377 | 378 | **Note:** Version bump only for package @anchan828/typeorm-helpers 379 | 380 | ## 1.0.7 (2022-05-01) 381 | 382 | **Note:** Version bump only for package @anchan828/typeorm-helpers 383 | 384 | ## 1.0.6 (2022-04-24) 385 | 386 | **Note:** Version bump only for package @anchan828/typeorm-helpers 387 | 388 | ## 1.0.5 (2022-04-17) 389 | 390 | **Note:** Version bump only for package @anchan828/typeorm-helpers 391 | 392 | ## 1.0.4 (2022-04-11) 393 | 394 | ### Bug Fixes 395 | 396 | * export ulid functions ([fa46697](https://github.com/anchan828/typeorm-helpers/commit/fa466976b5d3e2ec6e5b75b948da2de6b8f968eb)) 397 | 398 | ## 1.0.3 (2022-04-10) 399 | 400 | **Note:** Version bump only for package @anchan828/typeorm-helpers 401 | 402 | ## 1.0.2 (2022-04-03) 403 | 404 | **Note:** Version bump only for package @anchan828/typeorm-helpers 405 | 406 | ## 1.0.1 (2022-03-27) 407 | 408 | **Note:** Version bump only for package @anchan828/typeorm-helpers 409 | 410 | # 1.0.0 (2022-03-24) 411 | 412 | **Note:** Version bump only for package @anchan828/typeorm-helpers 413 | 414 | # 0.9.0 (2022-03-24) 415 | 416 | ### Features 417 | 418 | * Add undefined transformer ([#867](https://github.com/anchan828/typeorm-helpers/issues/867)) ([eaa37fb](https://github.com/anchan828/typeorm-helpers/commit/eaa37fb16ab523d2e394e9c56c36c58bbf06364b)) 419 | 420 | ## 0.8.11 (2022-03-20) 421 | 422 | **Note:** Version bump only for package @anchan828/typeorm-helpers 423 | 424 | ## 0.8.10 (2022-03-13) 425 | 426 | **Note:** Version bump only for package @anchan828/typeorm-helpers 427 | 428 | ## 0.8.9 (2022-03-06) 429 | 430 | **Note:** Version bump only for package @anchan828/typeorm-helpers 431 | 432 | ## 0.8.8 (2022-02-27) 433 | 434 | **Note:** Version bump only for package @anchan828/typeorm-helpers 435 | 436 | ## 0.8.7 (2022-02-20) 437 | 438 | **Note:** Version bump only for package @anchan828/typeorm-helpers 439 | 440 | ## 0.8.6 (2022-02-06) 441 | 442 | **Note:** Version bump only for package @anchan828/typeorm-helpers 443 | 444 | ## 0.8.5 (2022-01-30) 445 | 446 | **Note:** Version bump only for package @anchan828/typeorm-helpers 447 | 448 | ## 0.8.4 (2022-01-23) 449 | 450 | **Note:** Version bump only for package @anchan828/typeorm-helpers 451 | 452 | ## 0.8.3 (2022-01-16) 453 | 454 | **Note:** Version bump only for package @anchan828/typeorm-helpers 455 | 456 | ## 0.8.2 (2022-01-13) 457 | 458 | ### Features 459 | 460 | * improve HistoryEntityInterface ([#800](https://github.com/anchan828/typeorm-helpers/issues/800)) ([e89e8cc](https://github.com/anchan828/typeorm-helpers/commit/e89e8cc1fae2e0a3b101e7986ec6f672f07cf23a)) 461 | 462 | ## 0.8.1 (2022-01-09) 463 | 464 | **Note:** Version bump only for package @anchan828/typeorm-helpers 465 | 466 | # 0.8.0 (2022-01-07) 467 | 468 | ### Features 469 | 470 | * stop entity class inheritance ([#794](https://github.com/anchan828/typeorm-helpers/issues/794)) ([8108e3c](https://github.com/anchan828/typeorm-helpers/commit/8108e3c7f2835f44f2b04f862486353c9ff7ac4a)) 471 | 472 | ## 0.7.20 (2022-01-02) 473 | 474 | **Note:** Version bump only for package @anchan828/typeorm-helpers 475 | 476 | ## 0.7.19 (2021-12-26) 477 | 478 | **Note:** Version bump only for package @anchan828/typeorm-helpers 479 | 480 | ## 0.7.18 (2021-12-19) 481 | 482 | **Note:** Version bump only for package @anchan828/typeorm-helpers 483 | 484 | ## 0.7.17 (2021-12-12) 485 | 486 | **Note:** Version bump only for package @anchan828/typeorm-helpers 487 | 488 | ## 0.7.16 (2021-12-05) 489 | 490 | **Note:** Version bump only for package @anchan828/typeorm-helpers 491 | 492 | ## 0.7.15 (2021-11-28) 493 | 494 | **Note:** Version bump only for package @anchan828/typeorm-helpers 495 | 496 | ## 0.7.14 (2021-11-21) 497 | 498 | **Note:** Version bump only for package @anchan828/typeorm-helpers 499 | 500 | ## 0.7.13 (2021-11-14) 501 | 502 | **Note:** Version bump only for package @anchan828/typeorm-helpers 503 | 504 | ## 0.7.12 (2021-11-07) 505 | 506 | **Note:** Version bump only for package @anchan828/typeorm-helpers 507 | 508 | ## 0.7.11 (2021-10-28) 509 | 510 | ### Bug Fixes 511 | 512 | * should not use create function on manager to cast to EntityType ([#729](https://github.com/anchan828/typeorm-helpers/issues/729)) ([56f15a2](https://github.com/anchan828/typeorm-helpers/commit/56f15a25c65ab7a16023da9b0619c62822e0d203)) 513 | 514 | ## 0.7.10 (2021-10-24) 515 | 516 | **Note:** Version bump only for package @anchan828/typeorm-helpers 517 | 518 | ## 0.7.9 (2021-10-17) 519 | 520 | **Note:** Version bump only for package @anchan828/typeorm-helpers 521 | 522 | ## 0.7.8 (2021-10-10) 523 | 524 | **Note:** Version bump only for package @anchan828/typeorm-helpers 525 | 526 | ## 0.7.7 (2021-10-03) 527 | 528 | **Note:** Version bump only for package @anchan828/typeorm-helpers 529 | 530 | ## 0.7.6 (2021-09-26) 531 | 532 | **Note:** Version bump only for package @anchan828/typeorm-helpers 533 | 534 | ## 0.7.5 (2021-09-19) 535 | 536 | **Note:** Version bump only for package @anchan828/typeorm-helpers 537 | 538 | ## 0.7.4 (2021-09-12) 539 | 540 | **Note:** Version bump only for package @anchan828/typeorm-helpers 541 | 542 | ## 0.7.3 (2021-09-05) 543 | 544 | **Note:** Version bump only for package @anchan828/typeorm-helpers 545 | 546 | ## 0.7.2 (2021-08-29) 547 | 548 | **Note:** Version bump only for package @anchan828/typeorm-helpers 549 | 550 | ## 0.7.1 (2021-08-22) 551 | 552 | **Note:** Version bump only for package @anchan828/typeorm-helpers 553 | 554 | # 0.7.0 (2021-08-20) 555 | 556 | ### Features 557 | 558 | * support postgres and sqlite ([#682](https://github.com/anchan828/typeorm-helpers/issues/682)) ([160a21f](https://github.com/anchan828/typeorm-helpers/commit/160a21fab224757e1db59eaedb8dd92993167157)) 559 | 560 | ## 0.6.6 (2021-08-18) 561 | 562 | ### Features 563 | 564 | * overwrite action column type ([#680](https://github.com/anchan828/typeorm-helpers/issues/680)) ([b845c6b](https://github.com/anchan828/typeorm-helpers/commit/b845c6b5aef099fe8db90a91043b9cb22fc951ae)) 565 | 566 | ## 0.6.5 (2021-08-15) 567 | 568 | **Note:** Version bump only for package @anchan828/typeorm-helpers 569 | 570 | ## 0.6.4 (2021-08-08) 571 | 572 | **Note:** Version bump only for package @anchan828/typeorm-helpers 573 | 574 | ## 0.6.3 (2021-08-01) 575 | 576 | **Note:** Version bump only for package @anchan828/typeorm-helpers 577 | 578 | ## 0.6.2 (2021-07-25) 579 | 580 | **Note:** Version bump only for package @anchan828/typeorm-helpers 581 | 582 | ## 0.6.1 (2021-07-18) 583 | 584 | **Note:** Version bump only for package @anchan828/typeorm-helpers 585 | 586 | ## 0.5.3 (2021-07-15) 587 | 588 | ### Bug Fixes 589 | 590 | * should remove one-to-one foreign key (key is unique) ([#658](https://github.com/anchan828/typeorm-helpers/issues/658)) ([c1994f3](https://github.com/anchan828/typeorm-helpers/commit/c1994f3729eb1136fade91e100b2bec9a21f22ab)) 591 | 592 | ## 0.5.2 (2021-07-13) 593 | 594 | ### Bug Fixes 595 | 596 | * export dropUniqueIndices ([3b53fe9](https://github.com/anchan828/typeorm-helpers/commit/3b53fe94debdcf94b2a33d84e202c727be537cc1)) 597 | 598 | ## 0.5.1 (2021-07-13) 599 | 600 | ### Features 601 | 602 | * add dropUniqueIndices function (helper function for migration ([#657](https://github.com/anchan828/typeorm-helpers/issues/657)) ([92e7721](https://github.com/anchan828/typeorm-helpers/commit/92e77211e7f2cdc9390a9d512ae4c88613e1c866)) 603 | 604 | # 0.5.0 (2021-07-12) 605 | 606 | **Note:** Version bump only for package @anchan828/typeorm-helpers 607 | 608 | # 0.5.0 (2021-07-12) 609 | 610 | **Note:** Version bump only for package @anchan828/typeorm-helpers 611 | 612 | ## 0.4.39 (2021-07-12) 613 | 614 | **Note:** Version bump only for package @anchan828/typeorm-helpers 615 | 616 | ## 0.4.38 (2021-07-11) 617 | 618 | **Note:** Version bump only for package @anchan828/typeorm-helpers 619 | 620 | ## 0.4.37 (2021-06-27) 621 | 622 | **Note:** Version bump only for package @anchan828/typeorm-helpers 623 | 624 | ## 0.4.36 (2021-06-20) 625 | 626 | **Note:** Version bump only for package @anchan828/typeorm-helpers 627 | 628 | ## 0.4.35 (2021-06-13) 629 | 630 | **Note:** Version bump only for package @anchan828/typeorm-helpers 631 | 632 | ## 0.4.34 (2021-06-06) 633 | 634 | **Note:** Version bump only for package @anchan828/typeorm-helpers 635 | 636 | ## 0.4.33 (2021-05-30) 637 | 638 | **Note:** Version bump only for package @anchan828/typeorm-helpers 639 | 640 | ## 0.4.32 (2021-05-23) 641 | 642 | **Note:** Version bump only for package @anchan828/typeorm-helpers 643 | 644 | ## 0.4.31 (2021-05-16) 645 | 646 | **Note:** Version bump only for package @anchan828/typeorm-helpers 647 | 648 | ## 0.4.30 (2021-05-09) 649 | 650 | **Note:** Version bump only for package @anchan828/typeorm-helpers 651 | 652 | ## 0.4.29 (2021-05-02) 653 | 654 | **Note:** Version bump only for package @anchan828/typeorm-helpers 655 | 656 | ## 0.4.28 (2021-04-25) 657 | 658 | **Note:** Version bump only for package @anchan828/typeorm-helpers 659 | 660 | ## 0.4.27 (2021-04-18) 661 | 662 | **Note:** Version bump only for package @anchan828/typeorm-helpers 663 | 664 | ## 0.4.26 (2021-04-11) 665 | 666 | **Note:** Version bump only for package @anchan828/typeorm-helpers 667 | 668 | ## 0.4.25 (2021-04-04) 669 | 670 | **Note:** Version bump only for package @anchan828/typeorm-helpers 671 | 672 | ## 0.4.24 (2021-03-28) 673 | 674 | **Note:** Version bump only for package @anchan828/typeorm-helpers 675 | 676 | ## 0.4.23 (2021-03-21) 677 | 678 | **Note:** Version bump only for package @anchan828/typeorm-helpers 679 | 680 | ## 0.4.22 (2021-02-28) 681 | 682 | **Note:** Version bump only for package @anchan828/typeorm-helpers 683 | 684 | ## 0.4.21 (2021-02-21) 685 | 686 | **Note:** Version bump only for package @anchan828/typeorm-helpers 687 | 688 | ## 0.4.20 (2021-02-14) 689 | 690 | **Note:** Version bump only for package @anchan828/typeorm-helpers 691 | 692 | ## 0.4.19 (2021-02-07) 693 | 694 | **Note:** Version bump only for package @anchan828/typeorm-helpers 695 | 696 | ## 0.4.18 (2021-01-31) 697 | 698 | **Note:** Version bump only for package @anchan828/typeorm-helpers 699 | 700 | ## 0.4.17 (2021-01-24) 701 | 702 | **Note:** Version bump only for package @anchan828/typeorm-helpers 703 | 704 | ## 0.4.16 (2021-01-17) 705 | 706 | **Note:** Version bump only for package @anchan828/typeorm-helpers 707 | 708 | ## 0.4.15 (2020-12-20) 709 | 710 | **Note:** Version bump only for package @anchan828/typeorm-helpers 711 | 712 | ## 0.4.14 (2020-12-13) 713 | 714 | **Note:** Version bump only for package @anchan828/typeorm-helpers 715 | 716 | ## 0.4.13 (2020-12-06) 717 | 718 | **Note:** Version bump only for package @anchan828/typeorm-helpers 719 | 720 | ## 0.4.12 (2020-11-29) 721 | 722 | **Note:** Version bump only for package @anchan828/typeorm-helpers 723 | 724 | ## 0.4.11 (2020-11-22) 725 | 726 | **Note:** Version bump only for package @anchan828/typeorm-helpers 727 | 728 | ## 0.4.10 (2020-11-15) 729 | 730 | **Note:** Version bump only for package @anchan828/typeorm-helpers 731 | 732 | ## 0.4.9 (2020-11-08) 733 | 734 | **Note:** Version bump only for package @anchan828/typeorm-helpers 735 | 736 | ## 0.4.8 (2020-11-01) 737 | 738 | **Note:** Version bump only for package @anchan828/typeorm-helpers 739 | 740 | ## 0.4.7 (2020-10-25) 741 | 742 | **Note:** Version bump only for package @anchan828/typeorm-helpers 743 | 744 | ## 0.4.6 (2020-10-18) 745 | 746 | **Note:** Version bump only for package @anchan828/typeorm-helpers 747 | 748 | ## 0.4.5 (2020-10-11) 749 | 750 | **Note:** Version bump only for package @anchan828/typeorm-helpers 751 | 752 | ## 0.4.4 (2020-10-04) 753 | 754 | **Note:** Version bump only for package @anchan828/typeorm-helpers 755 | 756 | ## 0.4.3 (2020-09-27) 757 | 758 | **Note:** Version bump only for package @anchan828/typeorm-helpers 759 | 760 | ## 0.4.2 (2020-09-20) 761 | 762 | **Note:** Version bump only for package @anchan828/typeorm-helpers 763 | 764 | ## 0.4.1 (2020-09-13) 765 | 766 | **Note:** Version bump only for package @anchan828/typeorm-helpers 767 | 768 | # [0.4.0](https://github.com/anchan828/typeorm-helpers/compare/v0.3.65...v0.4.0) (2020-09-04) 769 | 770 | ### Features 771 | 772 | - json culumn uses text type as default. and supported date string ([22e1ee9](https://github.com/anchan828/typeorm-helpers/commit/22e1ee9a8966378b3a5e346ca972b9ac53f4751f)) 773 | 774 | ## 0.3.65 (2020-08-30) 775 | 776 | **Note:** Version bump only for package @anchan828/typeorm-helpers 777 | 778 | ## 0.3.64 (2020-08-23) 779 | 780 | **Note:** Version bump only for package @anchan828/typeorm-helpers 781 | 782 | ## 0.3.63 (2020-08-16) 783 | 784 | **Note:** Version bump only for package @anchan828/typeorm-helpers 785 | 786 | ## [0.3.62](https://github.com/anchan828/typeorm-helpers/compare/v0.3.61...v0.3.62) (2020-08-12) 787 | 788 | ### Bug Fixes 789 | 790 | - **decorators:** export JsonColumn ([03e11ad](https://github.com/anchan828/typeorm-helpers/commit/03e11ad303db3069079c17b6b07c9aa89f90edf6)) 791 | 792 | ## 0.3.61 (2020-08-09) 793 | 794 | **Note:** Version bump only for package @anchan828/typeorm-helpers 795 | 796 | ## 0.3.60 (2020-08-02) 797 | 798 | **Note:** Version bump only for package @anchan828/typeorm-helpers 799 | 800 | ## 0.3.59 (2020-07-26) 801 | 802 | **Note:** Version bump only for package @anchan828/typeorm-helpers 803 | 804 | ## 0.3.58 (2020-07-19) 805 | 806 | **Note:** Version bump only for package @anchan828/typeorm-helpers 807 | 808 | ## 0.3.57 (2020-07-12) 809 | 810 | **Note:** Version bump only for package @anchan828/typeorm-helpers 811 | 812 | ## 0.3.56 (2020-07-05) 813 | 814 | **Note:** Version bump only for package @anchan828/typeorm-helpers 815 | 816 | ## 0.3.55 (2020-06-28) 817 | 818 | **Note:** Version bump only for package @anchan828/typeorm-helpers 819 | 820 | ## 0.3.54 (2020-06-21) 821 | 822 | **Note:** Version bump only for package @anchan828/typeorm-helpers 823 | 824 | ## 0.3.53 (2020-06-14) 825 | 826 | **Note:** Version bump only for package @anchan828/typeorm-helpers 827 | 828 | ## 0.3.52 (2020-06-07) 829 | 830 | **Note:** Version bump only for package @anchan828/typeorm-helpers 831 | 832 | ## 0.3.51 (2020-05-31) 833 | 834 | **Note:** Version bump only for package @anchan828/typeorm-helpers 835 | 836 | ## 0.3.50 (2020-05-24) 837 | 838 | **Note:** Version bump only for package @anchan828/typeorm-helpers 839 | 840 | ## 0.3.49 (2020-05-17) 841 | 842 | **Note:** Version bump only for package @anchan828/typeorm-helpers 843 | 844 | ## 0.3.48 (2020-05-10) 845 | 846 | **Note:** Version bump only for package @anchan828/typeorm-helpers 847 | 848 | ## 0.3.47 (2020-05-03) 849 | 850 | **Note:** Version bump only for package @anchan828/typeorm-helpers 851 | 852 | ## 0.3.46 (2020-04-26) 853 | 854 | **Note:** Version bump only for package @anchan828/typeorm-helpers 855 | 856 | ## 0.3.45 (2020-04-19) 857 | 858 | **Note:** Version bump only for package @anchan828/typeorm-helpers 859 | 860 | ## 0.3.44 (2020-04-05) 861 | 862 | **Note:** Version bump only for package @anchan828/typeorm-helpers 863 | 864 | ## 0.3.43 (2020-03-29) 865 | 866 | **Note:** Version bump only for package @anchan828/typeorm-helpers 867 | 868 | ## 0.3.42 (2020-03-15) 869 | 870 | **Note:** Version bump only for package @anchan828/typeorm-helpers 871 | 872 | ## 0.3.41 (2020-03-08) 873 | 874 | **Note:** Version bump only for package @anchan828/typeorm-helpers 875 | 876 | ## 0.3.40 (2020-03-01) 877 | 878 | **Note:** Version bump only for package @anchan828/typeorm-helpers 879 | 880 | ## 0.3.39 (2020-02-23) 881 | 882 | **Note:** Version bump only for package @anchan828/typeorm-helpers 883 | 884 | ## 0.3.38 (2020-02-16) 885 | 886 | **Note:** Version bump only for package @anchan828/typeorm-helpers 887 | 888 | ## 0.3.37 (2020-02-09) 889 | 890 | **Note:** Version bump only for package @anchan828/typeorm-helpers 891 | 892 | ## 0.3.36 (2020-02-02) 893 | 894 | **Note:** Version bump only for package @anchan828/typeorm-helpers 895 | 896 | ## 0.3.35 (2020-01-26) 897 | 898 | **Note:** Version bump only for package @anchan828/typeorm-helpers 899 | 900 | ## 0.3.34 (2020-01-19) 901 | 902 | **Note:** Version bump only for package @anchan828/typeorm-helpers 903 | 904 | ## 0.3.33 (2020-01-12) 905 | 906 | **Note:** Version bump only for package @anchan828/typeorm-helpers 907 | 908 | ## 0.3.32 (2020-01-05) 909 | 910 | **Note:** Version bump only for package @anchan828/typeorm-helpers 911 | 912 | ## 0.3.31 (2019-12-29) 913 | 914 | **Note:** Version bump only for package @anchan828/typeorm-helpers 915 | 916 | ## 0.3.30 (2019-12-22) 917 | 918 | **Note:** Version bump only for package @anchan828/typeorm-helpers 919 | 920 | ## 0.3.29 (2019-12-15) 921 | 922 | **Note:** Version bump only for package @anchan828/typeorm-helpers 923 | 924 | ## 0.3.28 (2019-12-08) 925 | 926 | **Note:** Version bump only for package @anchan828/typeorm-helpers 927 | 928 | ## [0.3.27](https://github.com/anchan828/typeorm-helpers/compare/v0.3.26...v0.3.27) (2019-11-03) 929 | 930 | ### Bug Fixes 931 | 932 | - **deps:** update dependency deepmerge to v4.2.2 ([761aa9a](https://github.com/anchan828/typeorm-helpers/commit/761aa9a695eff60f121376e8d76e323fc9cc2520)) 933 | 934 | ## [0.3.26](https://github.com/anchan828/typeorm-helpers/compare/v0.3.25...v0.3.26) (2019-10-27) 935 | 936 | ### Bug Fixes 937 | 938 | - **deps:** update dependency deepmerge to v4.2.0 ([a404b8f](https://github.com/anchan828/typeorm-helpers/commit/a404b8f7a1e5f80ceea57874187eeb95c3003e04)) 939 | - **deps:** update dependency deepmerge to v4.2.1 ([d617c06](https://github.com/anchan828/typeorm-helpers/commit/d617c063edabe2be9f4756b0ce11651fe9ad1628)) 940 | 941 | ## [0.3.25](https://github.com/anchan828/typeorm-helpers/compare/v0.3.24...v0.3.25) (2019-10-20) 942 | 943 | **Note:** Version bump only for package @anchan828/typeorm-helpers 944 | 945 | ## [0.3.24](https://github.com/anchan828/typeorm-helpers/compare/v0.3.23...v0.3.24) (2019-10-13) 946 | 947 | ### Bug Fixes 948 | 949 | - **deps:** update dependency deepmerge to v4.1.1 ([a1b6d1f](https://github.com/anchan828/typeorm-helpers/commit/a1b6d1f1e68941719b981d735b4d86cd3086574d)) 950 | 951 | ## [0.3.23](https://github.com/anchan828/typeorm-helpers/compare/v0.3.22...v0.3.23) (2019-10-08) 952 | 953 | ### Bug Fixes 954 | 955 | - export EncryptColumn ([2db116c](https://github.com/anchan828/typeorm-helpers/commit/2db116c)) 956 | 957 | ## [0.3.22](https://github.com/anchan828/typeorm-helpers/compare/v0.3.21...v0.3.22) (2019-10-08) 958 | 959 | ### Bug Fixes 960 | 961 | - **deps:** update dependency deepmerge to v4.1.0 ([c08847d](https://github.com/anchan828/typeorm-helpers/commit/c08847d)) 962 | 963 | ### Features 964 | 965 | - add EncryptTransformer ([aa12938](https://github.com/anchan828/typeorm-helpers/commit/aa12938)) 966 | 967 | ## [0.3.21](https://github.com/anchan828/typeorm-helpers/compare/v0.3.20...v0.3.21) (2019-10-06) 968 | 969 | **Note:** Version bump only for package @anchan828/typeorm-helpers 970 | 971 | ## [0.3.20](https://github.com/anchan828/typeorm-helpers/compare/v0.3.19...v0.3.20) (2019-09-29) 972 | 973 | **Note:** Version bump only for package @anchan828/typeorm-helpers 974 | 975 | ## [0.3.19](https://github.com/anchan828/typeorm-helpers/compare/v0.3.18...v0.3.19) (2019-09-22) 976 | 977 | **Note:** Version bump only for package @anchan828/typeorm-helpers 978 | 979 | ## [0.3.18](https://github.com/anchan828/typeorm-helpers/compare/v0.3.17...v0.3.18) (2019-09-15) 980 | 981 | **Note:** Version bump only for package @anchan828/typeorm-helpers 982 | 983 | ## [0.3.17](https://github.com/anchan828/typeorm-helpers/compare/v0.3.16...v0.3.17) (2019-09-08) 984 | 985 | **Note:** Version bump only for package @anchan828/typeorm-helpers 986 | 987 | ## [0.3.16](https://github.com/anchan828/typeorm-helpers/compare/v0.3.15...v0.3.16) (2019-09-01) 988 | 989 | **Note:** Version bump only for package @anchan828/typeorm-helpers 990 | 991 | ## [0.3.15](https://github.com/anchan828/typeorm-helpers/compare/v0.3.14...v0.3.15) (2019-08-25) 992 | 993 | **Note:** Version bump only for package @anchan828/typeorm-helpers 994 | 995 | ## [0.3.14](https://github.com/anchan828/typeorm-helpers/compare/v0.3.13...v0.3.14) (2019-08-18) 996 | 997 | **Note:** Version bump only for package @anchan828/typeorm-helpers 998 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 anchan828 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # @anchan828/typeorm-helpers 2 | 3 | [![Maintainability](https://api.codeclimate.com/v1/badges/db743ab5c9ca21876ae8/maintainability)](https://codeclimate.com/github/anchan828/typeorm-helpers/maintainability) 4 | 5 | [![Test Coverage](https://api.codeclimate.com/v1/badges/db743ab5c9ca21876ae8/test_coverage)](https://codeclimate.com/github/anchan828/typeorm-helpers/test_coverage) 6 | 7 | ## License 8 | 9 | [MIT](LICENSE) 10 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3.4" 2 | 3 | services: 4 | mysql: 5 | image: mysql:8 6 | ports: 7 | - "3306:3306" 8 | environment: 9 | MYSQL_ROOT_PASSWORD: root 10 | MYSQL_DATABASE: test 11 | command: 12 | [ 13 | "mysqld", 14 | "--character-set-server=utf8mb4", 15 | "--collation-server=utf8mb4_bin", 16 | "--default-authentication-plugin=mysql_native_password", 17 | "--sync-binlog=0", 18 | "--innodb-flush-log-at-trx-commit=2", 19 | "--innodb-use-native-aio=0", 20 | ] 21 | postgres: 22 | image: postgres:16 23 | ports: 24 | - "5432:5432" 25 | environment: 26 | POSTGRES_USER: root 27 | POSTGRES_PASSWORD: root 28 | POSTGRES_DB: test 29 | -------------------------------------------------------------------------------- /jest.config.base.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "ts-jest", 3 | rootDir: "src", 4 | coverageDirectory: "../coverage", 5 | coverageReporters: ["text-summary", "json-summary", "lcov", "text", "clover"], 6 | testEnvironment: "node", 7 | verbose: true, 8 | silent: false, 9 | testMatch: ["/**/*.spec.ts"], 10 | }; 11 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "packages/*" 4 | ], 5 | "command": { 6 | "publish": { 7 | "ignoreChanges": [ 8 | "dist/**/*" 9 | ], 10 | "message": "chore(release): publish %s", 11 | "conventionalCommits": true, 12 | "graphType": "dependencies" 13 | } 14 | }, 15 | "version": "1.0.100" 16 | } 17 | -------------------------------------------------------------------------------- /lint-staged.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "*.{ts}": ["eslint --fix", "prettier --write", "git add"], 3 | "*.{js,json,yml,yaml,md}": ["prettier --write", "git add"], 4 | }; 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@anchan828/typeorm-helpers", 3 | "private": true, 4 | "workspaces": [ 5 | "packages/*" 6 | ], 7 | "scripts": { 8 | "build": "turbo run build", 9 | "format": "prettier --write '**/*.{js,json,yml,yaml,md}'", 10 | "postinstall": "husky install", 11 | "lint": "turbo run lint", 12 | "lint:fix": "turbo run lint:fix", 13 | "publish": "lerna publish --yes patch", 14 | "publish:major": "lerna publish --yes major", 15 | "publish:minor": "lerna publish --yes minor", 16 | "test": "turbo run test", 17 | "test:e2e": "turbo run test:e2e" 18 | }, 19 | "devDependencies": { 20 | "@commitlint/cli": "19.2.1", 21 | "@commitlint/config-conventional": "19.1.0", 22 | "@lerna-lite/cli": "3.3.1", 23 | "@lerna-lite/publish": "3.3.1", 24 | "@types/jest": "29.5.12", 25 | "@types/node": "20.11.30", 26 | "@typescript-eslint/eslint-plugin": "7.3.1", 27 | "@typescript-eslint/parser": "7.3.1", 28 | "eslint": "8.57.0", 29 | "eslint-config-prettier": "9.1.0", 30 | "eslint-plugin-prettier": "5.1.3", 31 | "fast-glob": "3.3.2", 32 | "husky": "9.0.11", 33 | "jest": "29.7.0", 34 | "lint-staged": "15.2.2", 35 | "mysql": "2.18.1", 36 | "pg": "8.11.3", 37 | "prettier": "3.2.5", 38 | "sqlite3": "5.1.7", 39 | "ts-jest": "29.1.2", 40 | "ts-node": "10.9.2", 41 | "turbo": "1.13.0", 42 | "typeorm": "0.3.20", 43 | "typescript": "5.4.3" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /packages/decorators/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const baseESLintConfig = require("../../.eslintrc"); 2 | 3 | module.exports = { ...baseESLintConfig }; 4 | -------------------------------------------------------------------------------- /packages/decorators/.npmignore: -------------------------------------------------------------------------------- 1 | * 2 | !dist/**/* 3 | dist/**/*.tsbuildinfo 4 | dist/**/*.js.map 5 | dist/**/*.ts.map 6 | -------------------------------------------------------------------------------- /packages/decorators/.prettierrc.js: -------------------------------------------------------------------------------- 1 | const basePrettierConfig = require("../../.prettierrc"); 2 | 3 | module.exports = { 4 | ...basePrettierConfig, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/decorators/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## 1.0.100 (2024-03-17) 7 | 8 | **Note:** Version bump only for package @anchan828/typeorm-decorators 9 | 10 | ## 1.0.99 (2024-03-10) 11 | 12 | **Note:** Version bump only for package @anchan828/typeorm-decorators 13 | 14 | ## 1.0.98 (2024-03-03) 15 | 16 | **Note:** Version bump only for package @anchan828/typeorm-decorators 17 | 18 | ## 1.0.97 (2024-02-25) 19 | 20 | **Note:** Version bump only for package @anchan828/typeorm-decorators 21 | 22 | ## 1.0.96 (2024-02-18) 23 | 24 | **Note:** Version bump only for package @anchan828/typeorm-decorators 25 | 26 | ## 1.0.95 (2024-02-11) 27 | 28 | **Note:** Version bump only for package @anchan828/typeorm-decorators 29 | 30 | ## 1.0.94 (2024-02-04) 31 | 32 | **Note:** Version bump only for package @anchan828/typeorm-decorators 33 | 34 | ## 1.0.93 (2024-01-28) 35 | 36 | **Note:** Version bump only for package @anchan828/typeorm-decorators 37 | 38 | ## 1.0.92 (2024-01-21) 39 | 40 | **Note:** Version bump only for package @anchan828/typeorm-decorators 41 | 42 | ## 1.0.91 (2024-01-14) 43 | 44 | **Note:** Version bump only for package @anchan828/typeorm-decorators 45 | 46 | ## 1.0.90 (2024-01-07) 47 | 48 | **Note:** Version bump only for package @anchan828/typeorm-decorators 49 | 50 | ## 1.0.89 (2023-12-31) 51 | 52 | **Note:** Version bump only for package @anchan828/typeorm-decorators 53 | 54 | ## 1.0.88 (2023-12-24) 55 | 56 | **Note:** Version bump only for package @anchan828/typeorm-decorators 57 | 58 | ## 1.0.87 (2023-12-17) 59 | 60 | **Note:** Version bump only for package @anchan828/typeorm-decorators 61 | 62 | ## 1.0.86 (2023-12-10) 63 | 64 | **Note:** Version bump only for package @anchan828/typeorm-decorators 65 | 66 | ## 1.0.85 (2023-12-03) 67 | 68 | **Note:** Version bump only for package @anchan828/typeorm-decorators 69 | 70 | ## 1.0.84 (2023-11-26) 71 | 72 | **Note:** Version bump only for package @anchan828/typeorm-decorators 73 | 74 | ## 1.0.83 (2023-11-19) 75 | 76 | **Note:** Version bump only for package @anchan828/typeorm-decorators 77 | 78 | ## 1.0.82 (2023-11-12) 79 | 80 | **Note:** Version bump only for package @anchan828/typeorm-decorators 81 | 82 | ## 1.0.81 (2023-11-05) 83 | 84 | **Note:** Version bump only for package @anchan828/typeorm-decorators 85 | 86 | ## 1.0.80 (2023-10-29) 87 | 88 | **Note:** Version bump only for package @anchan828/typeorm-decorators 89 | 90 | ## 1.0.79 (2023-10-22) 91 | 92 | **Note:** Version bump only for package @anchan828/typeorm-decorators 93 | 94 | ## 1.0.78 (2023-10-15) 95 | 96 | **Note:** Version bump only for package @anchan828/typeorm-decorators 97 | 98 | ## 1.0.77 (2023-10-08) 99 | 100 | **Note:** Version bump only for package @anchan828/typeorm-decorators 101 | 102 | ## 1.0.76 (2023-10-01) 103 | 104 | **Note:** Version bump only for package @anchan828/typeorm-decorators 105 | 106 | ## 1.0.75 (2023-09-24) 107 | 108 | **Note:** Version bump only for package @anchan828/typeorm-decorators 109 | 110 | ## 1.0.74 (2023-09-17) 111 | 112 | **Note:** Version bump only for package @anchan828/typeorm-decorators 113 | 114 | ## 1.0.73 (2023-09-10) 115 | 116 | **Note:** Version bump only for package @anchan828/typeorm-decorators 117 | 118 | ## 1.0.72 (2023-09-03) 119 | 120 | **Note:** Version bump only for package @anchan828/typeorm-decorators 121 | 122 | ## 1.0.71 (2023-08-27) 123 | 124 | **Note:** Version bump only for package @anchan828/typeorm-decorators 125 | 126 | ## 1.0.70 (2023-08-20) 127 | 128 | **Note:** Version bump only for package @anchan828/typeorm-decorators 129 | 130 | ## 1.0.69 (2023-08-13) 131 | 132 | **Note:** Version bump only for package @anchan828/typeorm-decorators 133 | 134 | ## 1.0.68 (2023-08-06) 135 | 136 | **Note:** Version bump only for package @anchan828/typeorm-decorators 137 | 138 | ## 1.0.67 (2023-07-30) 139 | 140 | **Note:** Version bump only for package @anchan828/typeorm-decorators 141 | 142 | ## 1.0.66 (2023-07-23) 143 | 144 | **Note:** Version bump only for package @anchan828/typeorm-decorators 145 | 146 | ## 1.0.65 (2023-07-16) 147 | 148 | **Note:** Version bump only for package @anchan828/typeorm-decorators 149 | 150 | ## 1.0.64 (2023-07-09) 151 | 152 | **Note:** Version bump only for package @anchan828/typeorm-decorators 153 | 154 | ## 1.0.63 (2023-07-02) 155 | 156 | **Note:** Version bump only for package @anchan828/typeorm-decorators 157 | 158 | ## 1.0.62 (2023-06-25) 159 | 160 | **Note:** Version bump only for package @anchan828/typeorm-decorators 161 | 162 | ## 1.0.61 (2023-06-11) 163 | 164 | **Note:** Version bump only for package @anchan828/typeorm-decorators 165 | 166 | ## 1.0.60 (2023-06-04) 167 | 168 | **Note:** Version bump only for package @anchan828/typeorm-decorators 169 | 170 | ## 1.0.59 (2023-05-28) 171 | 172 | **Note:** Version bump only for package @anchan828/typeorm-decorators 173 | 174 | ## 1.0.58 (2023-05-21) 175 | 176 | **Note:** Version bump only for package @anchan828/typeorm-decorators 177 | 178 | ## 1.0.57 (2023-04-16) 179 | 180 | **Note:** Version bump only for package @anchan828/typeorm-decorators 181 | 182 | ## 1.0.56 (2023-04-09) 183 | 184 | **Note:** Version bump only for package @anchan828/typeorm-decorators 185 | 186 | ## 1.0.55 (2023-04-02) 187 | 188 | **Note:** Version bump only for package @anchan828/typeorm-decorators 189 | 190 | ## 1.0.54 (2023-03-26) 191 | 192 | **Note:** Version bump only for package @anchan828/typeorm-decorators 193 | 194 | ## 1.0.53 (2023-03-19) 195 | 196 | **Note:** Version bump only for package @anchan828/typeorm-decorators 197 | 198 | ## 1.0.52 (2023-03-12) 199 | 200 | **Note:** Version bump only for package @anchan828/typeorm-decorators 201 | 202 | ## 1.0.51 (2023-03-05) 203 | 204 | **Note:** Version bump only for package @anchan828/typeorm-decorators 205 | 206 | ## 1.0.50 (2023-02-26) 207 | 208 | **Note:** Version bump only for package @anchan828/typeorm-decorators 209 | 210 | ## 1.0.49 (2023-02-19) 211 | 212 | **Note:** Version bump only for package @anchan828/typeorm-decorators 213 | 214 | ## 1.0.48 (2023-02-12) 215 | 216 | **Note:** Version bump only for package @anchan828/typeorm-decorators 217 | 218 | ## 1.0.47 (2023-02-05) 219 | 220 | **Note:** Version bump only for package @anchan828/typeorm-decorators 221 | 222 | ## 1.0.46 (2023-01-29) 223 | 224 | **Note:** Version bump only for package @anchan828/typeorm-decorators 225 | 226 | ## 1.0.45 (2023-01-22) 227 | 228 | **Note:** Version bump only for package @anchan828/typeorm-decorators 229 | 230 | ## 1.0.44 (2023-01-15) 231 | 232 | **Note:** Version bump only for package @anchan828/typeorm-decorators 233 | 234 | ## 1.0.43 (2023-01-08) 235 | 236 | **Note:** Version bump only for package @anchan828/typeorm-decorators 237 | 238 | ## 1.0.42 (2023-01-01) 239 | 240 | ### Bug Fixes 241 | 242 | * **deps:** update dependency ulidx to ^0.4.0 ([02250b8](https://github.com/anchan828/typeorm-helpers/commit/02250b8f1c89beb2d90d8145b1ed40ac72b90647)) 243 | 244 | ## 1.0.41 (2022-12-25) 245 | 246 | **Note:** Version bump only for package @anchan828/typeorm-decorators 247 | 248 | ## 1.0.40 (2022-12-18) 249 | 250 | **Note:** Version bump only for package @anchan828/typeorm-decorators 251 | 252 | ## 1.0.39 (2022-12-11) 253 | 254 | **Note:** Version bump only for package @anchan828/typeorm-decorators 255 | 256 | ## 1.0.38 (2022-12-04) 257 | 258 | **Note:** Version bump only for package @anchan828/typeorm-decorators 259 | 260 | ## 1.0.37 (2022-11-27) 261 | 262 | **Note:** Version bump only for package @anchan828/typeorm-decorators 263 | 264 | ## 1.0.36 (2022-11-20) 265 | 266 | **Note:** Version bump only for package @anchan828/typeorm-decorators 267 | 268 | ## 1.0.35 (2022-11-13) 269 | 270 | **Note:** Version bump only for package @anchan828/typeorm-decorators 271 | 272 | ## 1.0.34 (2022-11-06) 273 | 274 | **Note:** Version bump only for package @anchan828/typeorm-decorators 275 | 276 | ## 1.0.33 (2022-10-30) 277 | 278 | **Note:** Version bump only for package @anchan828/typeorm-decorators 279 | 280 | ## 1.0.32 (2022-10-23) 281 | 282 | **Note:** Version bump only for package @anchan828/typeorm-decorators 283 | 284 | ## 1.0.31 (2022-10-16) 285 | 286 | **Note:** Version bump only for package @anchan828/typeorm-decorators 287 | 288 | ## 1.0.30 (2022-10-09) 289 | 290 | **Note:** Version bump only for package @anchan828/typeorm-decorators 291 | 292 | ## 1.0.29 (2022-10-02) 293 | 294 | **Note:** Version bump only for package @anchan828/typeorm-decorators 295 | 296 | ## 1.0.28 (2022-09-25) 297 | 298 | **Note:** Version bump only for package @anchan828/typeorm-decorators 299 | 300 | ## 1.0.27 (2022-09-18) 301 | 302 | **Note:** Version bump only for package @anchan828/typeorm-decorators 303 | 304 | ## 1.0.26 (2022-09-11) 305 | 306 | **Note:** Version bump only for package @anchan828/typeorm-decorators 307 | 308 | ## 1.0.25 (2022-09-04) 309 | 310 | **Note:** Version bump only for package @anchan828/typeorm-decorators 311 | 312 | ## 1.0.24 (2022-08-28) 313 | 314 | **Note:** Version bump only for package @anchan828/typeorm-decorators 315 | 316 | ## 1.0.23 (2022-08-21) 317 | 318 | **Note:** Version bump only for package @anchan828/typeorm-decorators 319 | 320 | ## 1.0.22 (2022-08-14) 321 | 322 | **Note:** Version bump only for package @anchan828/typeorm-decorators 323 | 324 | ## 1.0.21 (2022-08-07) 325 | 326 | **Note:** Version bump only for package @anchan828/typeorm-decorators 327 | 328 | ## 1.0.20 (2022-07-31) 329 | 330 | **Note:** Version bump only for package @anchan828/typeorm-decorators 331 | 332 | ## 1.0.19 (2022-07-24) 333 | 334 | **Note:** Version bump only for package @anchan828/typeorm-decorators 335 | 336 | ## 1.0.18 (2022-07-17) 337 | 338 | **Note:** Version bump only for package @anchan828/typeorm-decorators 339 | 340 | ## 1.0.17 (2022-07-10) 341 | 342 | **Note:** Version bump only for package @anchan828/typeorm-decorators 343 | 344 | ## 1.0.16 (2022-07-03) 345 | 346 | **Note:** Version bump only for package @anchan828/typeorm-decorators 347 | 348 | ## 1.0.15 (2022-06-26) 349 | 350 | **Note:** Version bump only for package @anchan828/typeorm-decorators 351 | 352 | ## 1.0.14 (2022-06-19) 353 | 354 | **Note:** Version bump only for package @anchan828/typeorm-decorators 355 | 356 | ## 1.0.13 (2022-06-12) 357 | 358 | **Note:** Version bump only for package @anchan828/typeorm-decorators 359 | 360 | ## 1.0.12 (2022-06-05) 361 | 362 | **Note:** Version bump only for package @anchan828/typeorm-decorators 363 | 364 | ## 1.0.11 (2022-05-29) 365 | 366 | **Note:** Version bump only for package @anchan828/typeorm-decorators 367 | 368 | ## 1.0.10 (2022-05-22) 369 | 370 | **Note:** Version bump only for package @anchan828/typeorm-decorators 371 | 372 | ## 1.0.9 (2022-05-15) 373 | 374 | **Note:** Version bump only for package @anchan828/typeorm-decorators 375 | 376 | ## 1.0.8 (2022-05-08) 377 | 378 | **Note:** Version bump only for package @anchan828/typeorm-decorators 379 | 380 | ## 1.0.7 (2022-05-01) 381 | 382 | **Note:** Version bump only for package @anchan828/typeorm-decorators 383 | 384 | ## 1.0.6 (2022-04-24) 385 | 386 | **Note:** Version bump only for package @anchan828/typeorm-decorators 387 | 388 | ## 1.0.5 (2022-04-17) 389 | 390 | **Note:** Version bump only for package @anchan828/typeorm-decorators 391 | 392 | ## 1.0.4 (2022-04-11) 393 | 394 | ### Bug Fixes 395 | 396 | * export ulid functions ([fa46697](https://github.com/anchan828/typeorm-helpers/commit/fa466976b5d3e2ec6e5b75b948da2de6b8f968eb)) 397 | 398 | ## 1.0.3 (2022-04-10) 399 | 400 | **Note:** Version bump only for package @anchan828/typeorm-decorators 401 | 402 | ## 1.0.2 (2022-04-03) 403 | 404 | **Note:** Version bump only for package @anchan828/typeorm-decorators 405 | 406 | ## 1.0.1 (2022-03-27) 407 | 408 | **Note:** Version bump only for package @anchan828/typeorm-decorators 409 | 410 | # 1.0.0 (2022-03-24) 411 | 412 | **Note:** Version bump only for package @anchan828/typeorm-decorators 413 | 414 | # 0.9.0 (2022-03-24) 415 | 416 | ### Features 417 | 418 | * Add undefined transformer ([#867](https://github.com/anchan828/typeorm-helpers/issues/867)) ([eaa37fb](https://github.com/anchan828/typeorm-helpers/commit/eaa37fb16ab523d2e394e9c56c36c58bbf06364b)) 419 | 420 | ## 0.8.11 (2022-03-20) 421 | 422 | **Note:** Version bump only for package @anchan828/typeorm-decorators 423 | 424 | ## 0.8.10 (2022-03-13) 425 | 426 | **Note:** Version bump only for package @anchan828/typeorm-decorators 427 | 428 | ## 0.8.9 (2022-03-06) 429 | 430 | **Note:** Version bump only for package @anchan828/typeorm-decorators 431 | 432 | ## 0.8.8 (2022-02-27) 433 | 434 | **Note:** Version bump only for package @anchan828/typeorm-decorators 435 | 436 | ## 0.8.7 (2022-02-20) 437 | 438 | **Note:** Version bump only for package @anchan828/typeorm-decorators 439 | 440 | ## 0.8.6 (2022-02-06) 441 | 442 | **Note:** Version bump only for package @anchan828/typeorm-decorators 443 | 444 | ## 0.8.5 (2022-01-30) 445 | 446 | **Note:** Version bump only for package @anchan828/typeorm-decorators 447 | 448 | ## 0.8.4 (2022-01-23) 449 | 450 | **Note:** Version bump only for package @anchan828/typeorm-decorators 451 | 452 | ## 0.8.3 (2022-01-16) 453 | 454 | **Note:** Version bump only for package @anchan828/typeorm-decorators 455 | 456 | ## 0.8.2 (2022-01-13) 457 | 458 | ### Features 459 | 460 | * improve HistoryEntityInterface ([#800](https://github.com/anchan828/typeorm-helpers/issues/800)) ([e89e8cc](https://github.com/anchan828/typeorm-helpers/commit/e89e8cc1fae2e0a3b101e7986ec6f672f07cf23a)) 461 | 462 | ## 0.8.1 (2022-01-09) 463 | 464 | **Note:** Version bump only for package @anchan828/typeorm-decorators 465 | 466 | # 0.8.0 (2022-01-07) 467 | 468 | ### Features 469 | 470 | * stop entity class inheritance ([#794](https://github.com/anchan828/typeorm-helpers/issues/794)) ([8108e3c](https://github.com/anchan828/typeorm-helpers/commit/8108e3c7f2835f44f2b04f862486353c9ff7ac4a)) 471 | 472 | ## 0.7.20 (2022-01-02) 473 | 474 | **Note:** Version bump only for package @anchan828/typeorm-decorators 475 | 476 | ## 0.7.19 (2021-12-26) 477 | 478 | **Note:** Version bump only for package @anchan828/typeorm-decorators 479 | 480 | ## 0.7.18 (2021-12-19) 481 | 482 | **Note:** Version bump only for package @anchan828/typeorm-decorators 483 | 484 | ## 0.7.17 (2021-12-12) 485 | 486 | **Note:** Version bump only for package @anchan828/typeorm-decorators 487 | 488 | ## 0.7.16 (2021-12-05) 489 | 490 | **Note:** Version bump only for package @anchan828/typeorm-decorators 491 | 492 | ## 0.7.15 (2021-11-28) 493 | 494 | **Note:** Version bump only for package @anchan828/typeorm-decorators 495 | 496 | ## 0.7.14 (2021-11-21) 497 | 498 | **Note:** Version bump only for package @anchan828/typeorm-decorators 499 | 500 | ## 0.7.13 (2021-11-14) 501 | 502 | **Note:** Version bump only for package @anchan828/typeorm-decorators 503 | 504 | ## 0.7.12 (2021-11-07) 505 | 506 | **Note:** Version bump only for package @anchan828/typeorm-decorators 507 | 508 | ## 0.7.11 (2021-10-28) 509 | 510 | ### Bug Fixes 511 | 512 | * should not use create function on manager to cast to EntityType ([#729](https://github.com/anchan828/typeorm-helpers/issues/729)) ([56f15a2](https://github.com/anchan828/typeorm-helpers/commit/56f15a25c65ab7a16023da9b0619c62822e0d203)) 513 | 514 | ## 0.7.10 (2021-10-24) 515 | 516 | **Note:** Version bump only for package @anchan828/typeorm-decorators 517 | 518 | ## 0.7.9 (2021-10-17) 519 | 520 | **Note:** Version bump only for package @anchan828/typeorm-decorators 521 | 522 | ## 0.7.8 (2021-10-10) 523 | 524 | **Note:** Version bump only for package @anchan828/typeorm-decorators 525 | 526 | ## 0.7.7 (2021-10-03) 527 | 528 | **Note:** Version bump only for package @anchan828/typeorm-decorators 529 | 530 | ## 0.7.6 (2021-09-26) 531 | 532 | **Note:** Version bump only for package @anchan828/typeorm-decorators 533 | 534 | ## 0.7.5 (2021-09-19) 535 | 536 | **Note:** Version bump only for package @anchan828/typeorm-decorators 537 | 538 | ## 0.7.4 (2021-09-12) 539 | 540 | **Note:** Version bump only for package @anchan828/typeorm-decorators 541 | 542 | ## 0.7.3 (2021-09-05) 543 | 544 | **Note:** Version bump only for package @anchan828/typeorm-decorators 545 | 546 | ## 0.7.2 (2021-08-29) 547 | 548 | **Note:** Version bump only for package @anchan828/typeorm-decorators 549 | 550 | ## 0.7.1 (2021-08-22) 551 | 552 | **Note:** Version bump only for package @anchan828/typeorm-decorators 553 | 554 | # 0.7.0 (2021-08-20) 555 | 556 | ### Features 557 | 558 | * support postgres and sqlite ([#682](https://github.com/anchan828/typeorm-helpers/issues/682)) ([160a21f](https://github.com/anchan828/typeorm-helpers/commit/160a21fab224757e1db59eaedb8dd92993167157)) 559 | 560 | ## 0.6.6 (2021-08-18) 561 | 562 | ### Features 563 | 564 | * overwrite action column type ([#680](https://github.com/anchan828/typeorm-helpers/issues/680)) ([b845c6b](https://github.com/anchan828/typeorm-helpers/commit/b845c6b5aef099fe8db90a91043b9cb22fc951ae)) 565 | 566 | ## 0.6.5 (2021-08-15) 567 | 568 | **Note:** Version bump only for package @anchan828/typeorm-decorators 569 | 570 | ## 0.6.4 (2021-08-08) 571 | 572 | **Note:** Version bump only for package @anchan828/typeorm-decorators 573 | 574 | ## 0.6.3 (2021-08-01) 575 | 576 | **Note:** Version bump only for package @anchan828/typeorm-decorators 577 | 578 | ## 0.6.2 (2021-07-25) 579 | 580 | **Note:** Version bump only for package @anchan828/typeorm-decorators 581 | 582 | ## 0.6.1 (2021-07-18) 583 | 584 | **Note:** Version bump only for package @anchan828/typeorm-decorators 585 | 586 | ## 0.5.3 (2021-07-15) 587 | 588 | ### Bug Fixes 589 | 590 | * should remove one-to-one foreign key (key is unique) ([#658](https://github.com/anchan828/typeorm-helpers/issues/658)) ([c1994f3](https://github.com/anchan828/typeorm-helpers/commit/c1994f3729eb1136fade91e100b2bec9a21f22ab)) 591 | 592 | ## 0.5.2 (2021-07-13) 593 | 594 | ### Bug Fixes 595 | 596 | * export dropUniqueIndices ([3b53fe9](https://github.com/anchan828/typeorm-helpers/commit/3b53fe94debdcf94b2a33d84e202c727be537cc1)) 597 | 598 | ## 0.5.1 (2021-07-13) 599 | 600 | ### Features 601 | 602 | * add dropUniqueIndices function (helper function for migration ([#657](https://github.com/anchan828/typeorm-helpers/issues/657)) ([92e7721](https://github.com/anchan828/typeorm-helpers/commit/92e77211e7f2cdc9390a9d512ae4c88613e1c866)) 603 | 604 | # 0.5.0 (2021-07-12) 605 | 606 | **Note:** Version bump only for package @anchan828/typeorm-decorators 607 | 608 | ## 0.4.39 (2021-07-12) 609 | 610 | **Note:** Version bump only for package @anchan828/typeorm-decorators 611 | 612 | ## 0.4.38 (2021-07-11) 613 | 614 | **Note:** Version bump only for package @anchan828/typeorm-decorators 615 | 616 | ## 0.4.37 (2021-06-27) 617 | 618 | **Note:** Version bump only for package @anchan828/typeorm-decorators 619 | 620 | ## 0.4.36 (2021-06-20) 621 | 622 | **Note:** Version bump only for package @anchan828/typeorm-decorators 623 | 624 | ## 0.4.35 (2021-06-13) 625 | 626 | **Note:** Version bump only for package @anchan828/typeorm-decorators 627 | 628 | ## 0.4.34 (2021-06-06) 629 | 630 | **Note:** Version bump only for package @anchan828/typeorm-decorators 631 | 632 | ## 0.4.33 (2021-05-30) 633 | 634 | **Note:** Version bump only for package @anchan828/typeorm-decorators 635 | 636 | ## 0.4.32 (2021-05-23) 637 | 638 | **Note:** Version bump only for package @anchan828/typeorm-decorators 639 | 640 | ## 0.4.31 (2021-05-16) 641 | 642 | **Note:** Version bump only for package @anchan828/typeorm-decorators 643 | 644 | ## 0.4.30 (2021-05-09) 645 | 646 | **Note:** Version bump only for package @anchan828/typeorm-decorators 647 | 648 | ## 0.4.29 (2021-05-02) 649 | 650 | **Note:** Version bump only for package @anchan828/typeorm-decorators 651 | 652 | ## 0.4.28 (2021-04-25) 653 | 654 | **Note:** Version bump only for package @anchan828/typeorm-decorators 655 | 656 | ## 0.4.27 (2021-04-18) 657 | 658 | **Note:** Version bump only for package @anchan828/typeorm-decorators 659 | 660 | ## 0.4.26 (2021-04-11) 661 | 662 | **Note:** Version bump only for package @anchan828/typeorm-decorators 663 | 664 | ## 0.4.25 (2021-04-04) 665 | 666 | **Note:** Version bump only for package @anchan828/typeorm-decorators 667 | 668 | ## 0.4.24 (2021-03-28) 669 | 670 | **Note:** Version bump only for package @anchan828/typeorm-decorators 671 | 672 | ## 0.4.23 (2021-03-21) 673 | 674 | **Note:** Version bump only for package @anchan828/typeorm-decorators 675 | 676 | ## 0.4.22 (2021-02-28) 677 | 678 | **Note:** Version bump only for package @anchan828/typeorm-decorators 679 | 680 | ## 0.4.21 (2021-02-21) 681 | 682 | **Note:** Version bump only for package @anchan828/typeorm-decorators 683 | 684 | ## 0.4.20 (2021-02-14) 685 | 686 | **Note:** Version bump only for package @anchan828/typeorm-decorators 687 | 688 | ## 0.4.19 (2021-02-07) 689 | 690 | **Note:** Version bump only for package @anchan828/typeorm-decorators 691 | 692 | ## 0.4.18 (2021-01-31) 693 | 694 | **Note:** Version bump only for package @anchan828/typeorm-decorators 695 | 696 | ## 0.4.17 (2021-01-24) 697 | 698 | **Note:** Version bump only for package @anchan828/typeorm-decorators 699 | 700 | ## 0.4.16 (2021-01-17) 701 | 702 | **Note:** Version bump only for package @anchan828/typeorm-decorators 703 | 704 | ## 0.4.15 (2020-12-20) 705 | 706 | **Note:** Version bump only for package @anchan828/typeorm-decorators 707 | 708 | ## 0.4.14 (2020-12-13) 709 | 710 | **Note:** Version bump only for package @anchan828/typeorm-decorators 711 | 712 | ## 0.4.13 (2020-12-06) 713 | 714 | **Note:** Version bump only for package @anchan828/typeorm-decorators 715 | 716 | ## 0.4.12 (2020-11-29) 717 | 718 | **Note:** Version bump only for package @anchan828/typeorm-decorators 719 | 720 | ## 0.4.11 (2020-11-22) 721 | 722 | **Note:** Version bump only for package @anchan828/typeorm-decorators 723 | 724 | ## 0.4.10 (2020-11-15) 725 | 726 | **Note:** Version bump only for package @anchan828/typeorm-decorators 727 | 728 | ## 0.4.9 (2020-11-08) 729 | 730 | **Note:** Version bump only for package @anchan828/typeorm-decorators 731 | 732 | ## 0.4.8 (2020-11-01) 733 | 734 | **Note:** Version bump only for package @anchan828/typeorm-decorators 735 | 736 | ## 0.4.7 (2020-10-25) 737 | 738 | **Note:** Version bump only for package @anchan828/typeorm-decorators 739 | 740 | ## 0.4.6 (2020-10-18) 741 | 742 | **Note:** Version bump only for package @anchan828/typeorm-decorators 743 | 744 | ## 0.4.5 (2020-10-11) 745 | 746 | **Note:** Version bump only for package @anchan828/typeorm-decorators 747 | 748 | ## 0.4.4 (2020-10-04) 749 | 750 | **Note:** Version bump only for package @anchan828/typeorm-decorators 751 | 752 | ## 0.4.3 (2020-09-27) 753 | 754 | **Note:** Version bump only for package @anchan828/typeorm-decorators 755 | 756 | ## 0.4.2 (2020-09-20) 757 | 758 | **Note:** Version bump only for package @anchan828/typeorm-decorators 759 | 760 | ## 0.4.1 (2020-09-13) 761 | 762 | **Note:** Version bump only for package @anchan828/typeorm-decorators 763 | 764 | # [0.4.0](https://github.com/anchan828/typeorm-helpers/compare/v0.3.65...v0.4.0) (2020-09-04) 765 | 766 | ### Features 767 | 768 | - json culumn uses text type as default. and supported date string ([22e1ee9](https://github.com/anchan828/typeorm-helpers/commit/22e1ee9a8966378b3a5e346ca972b9ac53f4751f)) 769 | 770 | ## 0.3.65 (2020-08-30) 771 | 772 | **Note:** Version bump only for package @anchan828/typeorm-decorators 773 | 774 | ## 0.3.64 (2020-08-23) 775 | 776 | **Note:** Version bump only for package @anchan828/typeorm-decorators 777 | 778 | ## 0.3.63 (2020-08-16) 779 | 780 | **Note:** Version bump only for package @anchan828/typeorm-decorators 781 | 782 | ## [0.3.62](https://github.com/anchan828/typeorm-helpers/compare/v0.3.61...v0.3.62) (2020-08-12) 783 | 784 | ### Bug Fixes 785 | 786 | - **decorators:** export JsonColumn ([03e11ad](https://github.com/anchan828/typeorm-helpers/commit/03e11ad303db3069079c17b6b07c9aa89f90edf6)) 787 | 788 | ## 0.3.61 (2020-08-09) 789 | 790 | **Note:** Version bump only for package @anchan828/typeorm-decorators 791 | 792 | ## 0.3.60 (2020-08-02) 793 | 794 | **Note:** Version bump only for package @anchan828/typeorm-decorators 795 | 796 | ## 0.3.59 (2020-07-26) 797 | 798 | **Note:** Version bump only for package @anchan828/typeorm-decorators 799 | 800 | ## 0.3.58 (2020-07-19) 801 | 802 | **Note:** Version bump only for package @anchan828/typeorm-decorators 803 | 804 | ## 0.3.57 (2020-07-12) 805 | 806 | **Note:** Version bump only for package @anchan828/typeorm-decorators 807 | 808 | ## 0.3.56 (2020-07-05) 809 | 810 | **Note:** Version bump only for package @anchan828/typeorm-decorators 811 | 812 | ## 0.3.55 (2020-06-28) 813 | 814 | **Note:** Version bump only for package @anchan828/typeorm-decorators 815 | 816 | ## 0.3.54 (2020-06-21) 817 | 818 | **Note:** Version bump only for package @anchan828/typeorm-decorators 819 | 820 | ## 0.3.53 (2020-06-14) 821 | 822 | **Note:** Version bump only for package @anchan828/typeorm-decorators 823 | 824 | ## 0.3.52 (2020-06-07) 825 | 826 | **Note:** Version bump only for package @anchan828/typeorm-decorators 827 | 828 | ## 0.3.51 (2020-05-31) 829 | 830 | **Note:** Version bump only for package @anchan828/typeorm-decorators 831 | 832 | ## 0.3.50 (2020-05-24) 833 | 834 | **Note:** Version bump only for package @anchan828/typeorm-decorators 835 | 836 | ## 0.3.49 (2020-05-17) 837 | 838 | **Note:** Version bump only for package @anchan828/typeorm-decorators 839 | 840 | ## 0.3.48 (2020-05-10) 841 | 842 | **Note:** Version bump only for package @anchan828/typeorm-decorators 843 | 844 | ## 0.3.47 (2020-05-03) 845 | 846 | **Note:** Version bump only for package @anchan828/typeorm-decorators 847 | 848 | ## 0.3.46 (2020-04-26) 849 | 850 | **Note:** Version bump only for package @anchan828/typeorm-decorators 851 | 852 | ## 0.3.45 (2020-04-19) 853 | 854 | **Note:** Version bump only for package @anchan828/typeorm-decorators 855 | 856 | ## 0.3.44 (2020-04-05) 857 | 858 | **Note:** Version bump only for package @anchan828/typeorm-decorators 859 | 860 | ## 0.3.43 (2020-03-29) 861 | 862 | **Note:** Version bump only for package @anchan828/typeorm-decorators 863 | 864 | ## 0.3.42 (2020-03-15) 865 | 866 | **Note:** Version bump only for package @anchan828/typeorm-decorators 867 | 868 | ## 0.3.41 (2020-03-08) 869 | 870 | **Note:** Version bump only for package @anchan828/typeorm-decorators 871 | 872 | ## 0.3.40 (2020-03-01) 873 | 874 | **Note:** Version bump only for package @anchan828/typeorm-decorators 875 | 876 | ## 0.3.39 (2020-02-23) 877 | 878 | **Note:** Version bump only for package @anchan828/typeorm-decorators 879 | 880 | ## 0.3.38 (2020-02-16) 881 | 882 | **Note:** Version bump only for package @anchan828/typeorm-decorators 883 | 884 | ## 0.3.37 (2020-02-09) 885 | 886 | **Note:** Version bump only for package @anchan828/typeorm-decorators 887 | 888 | ## 0.3.36 (2020-02-02) 889 | 890 | **Note:** Version bump only for package @anchan828/typeorm-decorators 891 | 892 | ## 0.3.35 (2020-01-26) 893 | 894 | **Note:** Version bump only for package @anchan828/typeorm-decorators 895 | 896 | ## 0.3.34 (2020-01-19) 897 | 898 | **Note:** Version bump only for package @anchan828/typeorm-decorators 899 | 900 | ## 0.3.33 (2020-01-12) 901 | 902 | **Note:** Version bump only for package @anchan828/typeorm-decorators 903 | 904 | ## 0.3.32 (2020-01-05) 905 | 906 | **Note:** Version bump only for package @anchan828/typeorm-decorators 907 | 908 | ## 0.3.31 (2019-12-29) 909 | 910 | **Note:** Version bump only for package @anchan828/typeorm-decorators 911 | 912 | ## 0.3.30 (2019-12-22) 913 | 914 | **Note:** Version bump only for package @anchan828/typeorm-decorators 915 | 916 | ## 0.3.29 (2019-12-15) 917 | 918 | **Note:** Version bump only for package @anchan828/typeorm-decorators 919 | 920 | ## 0.3.28 (2019-12-08) 921 | 922 | **Note:** Version bump only for package @anchan828/typeorm-decorators 923 | 924 | ## [0.3.27](https://github.com/anchan828/typeorm-helpers/compare/v0.3.26...v0.3.27) (2019-11-03) 925 | 926 | ### Bug Fixes 927 | 928 | - **deps:** update dependency deepmerge to v4.2.2 ([761aa9a](https://github.com/anchan828/typeorm-helpers/commit/761aa9a695eff60f121376e8d76e323fc9cc2520)) 929 | 930 | ## [0.3.26](https://github.com/anchan828/typeorm-helpers/compare/v0.3.25...v0.3.26) (2019-10-27) 931 | 932 | ### Bug Fixes 933 | 934 | - **deps:** update dependency deepmerge to v4.2.0 ([a404b8f](https://github.com/anchan828/typeorm-helpers/commit/a404b8f7a1e5f80ceea57874187eeb95c3003e04)) 935 | - **deps:** update dependency deepmerge to v4.2.1 ([d617c06](https://github.com/anchan828/typeorm-helpers/commit/d617c063edabe2be9f4756b0ce11651fe9ad1628)) 936 | 937 | ## [0.3.25](https://github.com/anchan828/typeorm-helpers/compare/v0.3.24...v0.3.25) (2019-10-20) 938 | 939 | **Note:** Version bump only for package @anchan828/typeorm-decorators 940 | 941 | ## [0.3.24](https://github.com/anchan828/typeorm-helpers/compare/v0.3.23...v0.3.24) (2019-10-13) 942 | 943 | ### Bug Fixes 944 | 945 | - **deps:** update dependency deepmerge to v4.1.1 ([a1b6d1f](https://github.com/anchan828/typeorm-helpers/commit/a1b6d1f1e68941719b981d735b4d86cd3086574d)) 946 | 947 | ## [0.3.23](https://github.com/anchan828/typeorm-helpers/compare/v0.3.22...v0.3.23) (2019-10-08) 948 | 949 | ### Bug Fixes 950 | 951 | - export EncryptColumn ([2db116c](https://github.com/anchan828/typeorm-helpers/commit/2db116c)) 952 | 953 | ## [0.3.22](https://github.com/anchan828/typeorm-helpers/compare/v0.3.21...v0.3.22) (2019-10-08) 954 | 955 | ### Bug Fixes 956 | 957 | - **deps:** update dependency deepmerge to v4.1.0 ([c08847d](https://github.com/anchan828/typeorm-helpers/commit/c08847d)) 958 | 959 | ### Features 960 | 961 | - add EncryptTransformer ([aa12938](https://github.com/anchan828/typeorm-helpers/commit/aa12938)) 962 | 963 | ## [0.3.21](https://github.com/anchan828/typeorm-helpers/compare/v0.3.20...v0.3.21) (2019-10-06) 964 | 965 | **Note:** Version bump only for package @anchan828/typeorm-decorators 966 | 967 | ## [0.3.20](https://github.com/anchan828/typeorm-helpers/compare/v0.3.19...v0.3.20) (2019-09-29) 968 | 969 | **Note:** Version bump only for package @anchan828/typeorm-decorators 970 | 971 | ## [0.3.19](https://github.com/anchan828/typeorm-helpers/compare/v0.3.18...v0.3.19) (2019-09-22) 972 | 973 | **Note:** Version bump only for package @anchan828/typeorm-decorators 974 | 975 | ## [0.3.18](https://github.com/anchan828/typeorm-helpers/compare/v0.3.17...v0.3.18) (2019-09-15) 976 | 977 | **Note:** Version bump only for package @anchan828/typeorm-decorators 978 | 979 | ## [0.3.17](https://github.com/anchan828/typeorm-helpers/compare/v0.3.16...v0.3.17) (2019-09-08) 980 | 981 | **Note:** Version bump only for package @anchan828/typeorm-decorators 982 | 983 | ## [0.3.16](https://github.com/anchan828/typeorm-helpers/compare/v0.3.15...v0.3.16) (2019-09-01) 984 | 985 | **Note:** Version bump only for package @anchan828/typeorm-decorators 986 | 987 | ## [0.3.15](https://github.com/anchan828/typeorm-helpers/compare/v0.3.14...v0.3.15) (2019-08-25) 988 | 989 | **Note:** Version bump only for package @anchan828/typeorm-decorators 990 | 991 | ## [0.3.14](https://github.com/anchan828/typeorm-helpers/compare/v0.3.13...v0.3.14) (2019-08-18) 992 | 993 | **Note:** Version bump only for package @anchan828/typeorm-decorators 994 | -------------------------------------------------------------------------------- /packages/decorators/README.md: -------------------------------------------------------------------------------- 1 | # @anchan828/typeorm-decorators 2 | 3 | ![npm](https://img.shields.io/npm/v/@anchan828/typeorm-decorators.svg) 4 | ![NPM](https://img.shields.io/npm/l/@anchan828/typeorm-decorators.svg) 5 | 6 | ## Description 7 | 8 | Decorator collection for [TypeORM](http://typeorm.io) 9 | 10 | ## Installation 11 | 12 | ```bash 13 | $ npm i --save typeorm @anchan828/typeorm-decorators 14 | ``` 15 | 16 | ## Quick Start 17 | 18 | ```ts 19 | @Entity() 20 | class UlidColumnTest extends BaseEntity { 21 | @PrimaryGeneratedColumn() 22 | public id!: number; 23 | 24 | @UlidColumn() 25 | public ulid!: string; 26 | } 27 | ``` 28 | 29 | ```ts 30 | @Entity() 31 | class StaticFileColumnTest extends BaseEntity { 32 | @PrimaryGeneratedColumn() 33 | public id!: number; 34 | 35 | @StaticFileColumn({ dirname: "/path/to/" }) 36 | public file!: BinaryLike; 37 | } 38 | ``` 39 | 40 | ```ts 41 | @Entity() 42 | class EncryptTransformerTest extends BaseEntity { 43 | @PrimaryGeneratedColumn() 44 | public id!: number; 45 | 46 | // key is createHash("sha256").update("test").digest("hex") 47 | @EncryptColumn({ key: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" }) 48 | public password!: string; 49 | } 50 | ``` 51 | 52 | ## License 53 | 54 | [MIT](LICENSE) 55 | -------------------------------------------------------------------------------- /packages/decorators/jest-e2e.config.js: -------------------------------------------------------------------------------- 1 | const base = require("../../jest.config.base"); 2 | module.exports = { 3 | ...base, 4 | coverageDirectory: "../e2e-coverage", 5 | testMatch: ["/*.spec-e2e.ts"], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/decorators/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require("../../jest.config.base"); 2 | module.exports = { 3 | ...base, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/decorators/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@anchan828/typeorm-decorators", 3 | "version": "1.0.100", 4 | "description": "[TypeORM](https://github.com/typeorm/typeorm) decorators", 5 | "homepage": "https://github.com/anchan828/typeorm-helpers/tree/master/packages/decorators#readme", 6 | "bugs": { 7 | "url": "https://github.com/anchan828/typeorm-helpers/issues" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/anchan828/typeorm-helpers.git" 12 | }, 13 | "license": "MIT", 14 | "author": "anchan828 ", 15 | "main": "dist/index.js", 16 | "types": "dist/index.d.ts", 17 | "scripts": { 18 | "build": "tsc -p tsconfig.build.json", 19 | "copy:license": "cp ../../LICENSE ./", 20 | "lint": "TIMING=1 eslint --ignore-path ../../.eslintignore '**/*.ts'", 21 | "lint:fix": "npm run lint -- --fix", 22 | "prepublishOnly": "npm run build && rm -f dist/*.tsbuildinfo && npm run copy:license", 23 | "test": "jest --coverage", 24 | "test:e2e": "jest --coverage --runInBand --config=jest-e2e.config.js", 25 | "test:e2e:watch": "npm run test:e2e -- --watch", 26 | "test:watch": "npm run test -- --watch", 27 | "watch": "tsc --watch" 28 | }, 29 | "dependencies": { 30 | "@anchan828/typeorm-transformers": "^1.0.100", 31 | "ulidx": "^2.1.0" 32 | }, 33 | "devDependencies": { 34 | "testing": "^1.0.100" 35 | }, 36 | "publishConfig": { 37 | "access": "public" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/decorators/src/boolean-colum.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 2 | import { BaseEntity, Entity, PrimaryGeneratedColumn } from "typeorm"; 3 | import { BooleanColumn } from "./boolean-column"; 4 | 5 | e2eDatabaseTypeSetUp("BooleanColumn", (options) => { 6 | @Entity({ name: "test" }) 7 | class BooleanColumnTest extends BaseEntity { 8 | @PrimaryGeneratedColumn() 9 | public id!: number; 10 | 11 | @BooleanColumn({ default: false, type: "int" }) 12 | public test!: boolean; 13 | 14 | @BooleanColumn({ default: true, type: "int" }) 15 | public test2!: boolean; 16 | 17 | @BooleanColumn({ type: "int" }) 18 | public test3!: boolean; 19 | } 20 | 21 | e2eSetUp({ entities: [BooleanColumnTest], ...options }); 22 | 23 | it("should save entity", async () => { 24 | await BooleanColumnTest.create({ 25 | test: true, 26 | test2: true, 27 | test3: true, 28 | }).save(); 29 | }); 30 | 31 | it("should use default value", async () => { 32 | const { id } = await BooleanColumnTest.create({ test3: true }).save(); 33 | const entity = await BooleanColumnTest.findOneBy({ id }); 34 | 35 | expect(entity).toEqual({ 36 | id: 1, 37 | test: false, 38 | test2: true, 39 | test3: true, 40 | }); 41 | 42 | const rawEntity = await BooleanColumnTest.createQueryBuilder("test").whereInIds([id]).getRawOne(); 43 | expect(rawEntity).toEqual({ 44 | test_id: 1, 45 | test_test: 0, 46 | test_test2: 1, 47 | test_test3: 1, 48 | }); 49 | }); 50 | }); 51 | -------------------------------------------------------------------------------- /packages/decorators/src/boolean-colum.spec.ts: -------------------------------------------------------------------------------- 1 | import { BooleanColumn } from "./boolean-column"; 2 | 3 | describe("BooleanColumn", () => { 4 | it("should be defined", () => { 5 | expect(BooleanColumn).toBeDefined(); 6 | }); 7 | 8 | it("should be defined", () => { 9 | class Test { 10 | @BooleanColumn({ default: false }) 11 | public test!: boolean; 12 | 13 | @BooleanColumn() 14 | public test2!: boolean; 15 | } 16 | expect(new Test()).toBeDefined(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/decorators/src/boolean-column.ts: -------------------------------------------------------------------------------- 1 | import { BooleanTransformer } from "@anchan828/typeorm-transformers"; 2 | import { Column, ColumnOptions } from "typeorm"; 3 | export function BooleanColumn(options?: ColumnOptions): Function { 4 | const columnOptions = { 5 | type: "tinyint", 6 | width: 1, 7 | ...options, 8 | } as ColumnOptions; 9 | columnOptions.transformer = new BooleanTransformer(); 10 | 11 | if (columnOptions.default !== undefined) { 12 | columnOptions.default = columnOptions.default ? 1 : 0; 13 | } 14 | 15 | return Column(columnOptions); 16 | } 17 | -------------------------------------------------------------------------------- /packages/decorators/src/encrypt-column.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 2 | import { BaseEntity, Column, DataSource, Entity, PrimaryGeneratedColumn } from "typeorm"; 3 | import { EncryptColumn } from "./encrypt-column"; 4 | e2eDatabaseTypeSetUp("EncryptColumn", (options) => { 5 | @Entity({ name: "encrypt_test" }) 6 | class EncryptTransformerTest extends BaseEntity { 7 | @PrimaryGeneratedColumn() 8 | public id!: number; 9 | 10 | @EncryptColumn({ key: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" }) 11 | public password!: string; 12 | 13 | @Column({ nullable: true }) 14 | public test!: string; 15 | } 16 | let dataSource: DataSource; 17 | e2eSetUp({ entities: [EncryptTransformerTest], ...options }, (source) => { 18 | dataSource = source; 19 | }); 20 | 21 | it("should return hash", async () => { 22 | let test = await EncryptTransformerTest.create({ 23 | password: "test", 24 | }).save(); 25 | 26 | await expect(EncryptTransformerTest.findOneBy({ id: test.id })).resolves.toEqual({ 27 | id: 1, 28 | test: null, 29 | }); 30 | 31 | const { password } = await dataSource 32 | .createQueryBuilder(EncryptTransformerTest, "test") 33 | .whereInIds([test.id]) 34 | .select("password") 35 | .getRawOne(); 36 | 37 | expect(password).toEqual(expect.any(String)); 38 | test = await EncryptTransformerTest.findOneByOrFail({ id: test.id }); 39 | test.test = "added"; 40 | 41 | await test.save(); 42 | 43 | const { password2 } = await dataSource 44 | .createQueryBuilder(EncryptTransformerTest, "test") 45 | .whereInIds([test.id]) 46 | .select("password as password2") 47 | .getRawOne(); 48 | 49 | expect(password).toBe(password2); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /packages/decorators/src/encrypt-column.spec.ts: -------------------------------------------------------------------------------- 1 | import { EncryptColumn } from "./encrypt-column"; 2 | 3 | describe("EncryptColumn", () => { 4 | it("should be defined", () => { 5 | expect(EncryptColumn).toBeDefined(); 6 | }); 7 | 8 | it("should be defined", () => { 9 | class Test { 10 | @EncryptColumn({ key: "test" }) 11 | public test!: string; 12 | } 13 | 14 | expect(new Test()).toBeDefined(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/decorators/src/encrypt-column.ts: -------------------------------------------------------------------------------- 1 | import { EncryptTransformer, EncryptTransformerOptions } from "@anchan828/typeorm-transformers"; 2 | import { Column, ColumnOptions } from "typeorm"; 3 | export function EncryptColumn(trasformerOptions: EncryptTransformerOptions, options?: ColumnOptions): Function { 4 | const columnOptions = { 5 | select: false, 6 | type: "text", 7 | ...options, 8 | } as ColumnOptions; 9 | columnOptions.transformer = new EncryptTransformer(trasformerOptions); 10 | return Column(columnOptions); 11 | } 12 | -------------------------------------------------------------------------------- /packages/decorators/src/hmac-column.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 2 | import { BaseEntity, Entity, PrimaryGeneratedColumn } from "typeorm"; 3 | import { HmacColumn } from "./hmac-column"; 4 | e2eDatabaseTypeSetUp("HmacColumn", (options) => { 5 | @Entity() 6 | class HmacTransformerTest extends BaseEntity { 7 | @PrimaryGeneratedColumn() 8 | public id!: number; 9 | 10 | @HmacColumn() 11 | public password!: string; 12 | 13 | @HmacColumn({ algorithm: "sha512", key: "key" }) 14 | public password2!: string; 15 | } 16 | 17 | e2eSetUp({ entities: [HmacTransformerTest], ...options }); 18 | 19 | it("should return hash", async () => { 20 | const test = await HmacTransformerTest.create({ 21 | password: "test", 22 | password2: "test", 23 | }).save(); 24 | 25 | await expect(HmacTransformerTest.findOneBy({ id: test.id })).resolves.toEqual({ 26 | id: 1, 27 | }); 28 | await expect( 29 | HmacTransformerTest.findOne({ where: { id: test.id }, select: { password: true, password2: true } }), 30 | ).resolves.toEqual({ 31 | password: "88cd2108b5347d973cf39cdf9053d7dd42704876d8c9a9bd8e2d168259d3ddf7", 32 | password2: 33 | "287a0fb89a7fbdfa5b5538636918e537a5b83065e4ff331268b7aaa115dde047a9b0f4fb5b828608fc0b6327f10055f7637b058e9e0dbb9e698901a3e6dd461c", 34 | }); 35 | }); 36 | 37 | it("should find entity by password", async () => { 38 | await HmacTransformerTest.create({ 39 | password: "test", 40 | password2: "test", 41 | }).save(); 42 | 43 | await expect(HmacTransformerTest.findOne({ where: { password: "test" } })).resolves.toEqual({ 44 | id: 1, 45 | }); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /packages/decorators/src/hmac-column.spec.ts: -------------------------------------------------------------------------------- 1 | import { HmacColumn } from "./hmac-column"; 2 | 3 | describe("HmacColumn", () => { 4 | it("should be defined", () => { 5 | expect(HmacColumn).toBeDefined(); 6 | }); 7 | 8 | it("should be defined", () => { 9 | class Test { 10 | @HmacColumn() 11 | public test!: string; 12 | } 13 | 14 | expect(new Test()).toBeDefined(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/decorators/src/hmac-column.ts: -------------------------------------------------------------------------------- 1 | import { HmacTransformer, HmacTransformerOptions } from "@anchan828/typeorm-transformers"; 2 | import { Column, ColumnOptions } from "typeorm"; 3 | export function HmacColumn(trasformerOptions?: HmacTransformerOptions, options?: ColumnOptions): Function { 4 | const columnOptions = { 5 | select: false, 6 | type: "varchar", 7 | ...options, 8 | } as ColumnOptions; 9 | columnOptions.transformer = new HmacTransformer(trasformerOptions); 10 | return Column(columnOptions); 11 | } 12 | -------------------------------------------------------------------------------- /packages/decorators/src/index.ts: -------------------------------------------------------------------------------- 1 | export { BooleanColumn } from "./boolean-column"; 2 | export { EncryptColumn } from "./encrypt-column"; 3 | export { HmacColumn } from "./hmac-column"; 4 | export { JsonColumn } from "./json-column"; 5 | export { StaticFileColumn } from "./static-file-column"; 6 | export { PrimaryUlidColumn, UlidColumn, UlidColumnOptions } from "./ulid-column"; 7 | -------------------------------------------------------------------------------- /packages/decorators/src/json-column.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 2 | import { BaseEntity, Entity, PrimaryGeneratedColumn } from "typeorm"; 3 | import { JsonColumn } from "./json-column"; 4 | 5 | interface TestInterface { 6 | hoge: string; 7 | foo: number; 8 | } 9 | 10 | e2eDatabaseTypeSetUp("JsonColumn", (options) => { 11 | @Entity({ name: "test" }) 12 | class JsonColumnTest extends BaseEntity { 13 | @PrimaryGeneratedColumn() 14 | public id!: number; 15 | 16 | @JsonColumn<{ tags: number[]; date: Date }>({ default: { tags: [], date: new Date() } }) 17 | public test!: { tags: number[]; date: Date }; 18 | 19 | @JsonColumn({ nullable: true }) 20 | public test2!: TestInterface; 21 | 22 | @JsonColumn({ nullable: true }) 23 | public test3!: string; 24 | } 25 | 26 | e2eSetUp({ entities: [JsonColumnTest], ...options }); 27 | 28 | it("should save entity", async () => { 29 | await JsonColumnTest.create({ 30 | test: { tags: [1, 2, 3], date: new Date() }, 31 | }).save(); 32 | 33 | await expect(JsonColumnTest.find({})).resolves.toEqual([ 34 | { 35 | id: 1, 36 | test: { 37 | date: expect.any(Date), 38 | tags: [1, 2, 3], 39 | }, 40 | }, 41 | ]); 42 | }); 43 | }); 44 | -------------------------------------------------------------------------------- /packages/decorators/src/json-column.spec.ts: -------------------------------------------------------------------------------- 1 | import { JsonColumn } from "./json-column"; 2 | 3 | interface TestInterface { 4 | hoge: string; 5 | foo: number; 6 | } 7 | 8 | describe("JsonColumn", () => { 9 | it("should be defined", () => { 10 | expect(JsonColumn).toBeDefined(); 11 | }); 12 | 13 | it("should be defined", () => { 14 | class Test { 15 | @JsonColumn({ default: [] }) 16 | public test!: string[]; 17 | 18 | @JsonColumn() 19 | public test2!: TestInterface; 20 | } 21 | expect(new Test()).toBeDefined(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/decorators/src/json-column.ts: -------------------------------------------------------------------------------- 1 | import { JsonTransformer } from "@anchan828/typeorm-transformers"; 2 | import { Column, ColumnOptions } from "typeorm"; 3 | export function JsonColumn(options?: ColumnOptions): Function { 4 | const columnOptions = { 5 | type: "text", 6 | ...options, 7 | } as ColumnOptions; 8 | const defaultValue = columnOptions.default; 9 | 10 | if (columnOptions.default) { 11 | columnOptions.default = undefined; 12 | } 13 | 14 | columnOptions.transformer = new JsonTransformer(defaultValue); 15 | 16 | return Column(columnOptions); 17 | } 18 | -------------------------------------------------------------------------------- /packages/decorators/src/static-file-colum.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { BinaryLike } from "crypto"; 2 | import { tmpdir } from "os"; 3 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 4 | import { BaseEntity, Entity, PrimaryGeneratedColumn } from "typeorm"; 5 | import { StaticFileColumn } from "./static-file-column"; 6 | 7 | e2eDatabaseTypeSetUp("StaticFileColumn", (options) => { 8 | @Entity() 9 | class StaticFileColumnTest extends BaseEntity { 10 | @PrimaryGeneratedColumn() 11 | public id!: number; 12 | 13 | @StaticFileColumn({ dirname: tmpdir() }) 14 | public file!: BinaryLike; 15 | } 16 | 17 | e2eSetUp({ entities: [StaticFileColumnTest], ...options }); 18 | 19 | it("should be defined", async () => { 20 | await StaticFileColumnTest.create({ file: "test" }).save(); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /packages/decorators/src/static-file-colum.spec.ts: -------------------------------------------------------------------------------- 1 | import { BinaryLike } from "crypto"; 2 | import { tmpdir } from "os"; 3 | import { StaticFileColumn } from "./static-file-column"; 4 | 5 | describe("StaticFileColumn", () => { 6 | it("should be defined", () => { 7 | expect(StaticFileColumn).toBeDefined(); 8 | }); 9 | 10 | it("should be defined", () => { 11 | class Test { 12 | @StaticFileColumn({ dirname: tmpdir() }) 13 | public test!: BinaryLike; 14 | } 15 | expect(new Test()).toBeDefined(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/decorators/src/static-file-column.ts: -------------------------------------------------------------------------------- 1 | import { StaticFileTransformer, StaticFileTransformerOptions } from "@anchan828/typeorm-transformers"; 2 | import { Column, ColumnOptions } from "typeorm"; 3 | 4 | export function StaticFileColumn(trasformerOptions: StaticFileTransformerOptions, options?: ColumnOptions): Function { 5 | const columnOptions = { 6 | type: "varchar", 7 | width: 255, 8 | ...options, 9 | } as ColumnOptions; 10 | columnOptions.transformer = new StaticFileTransformer(trasformerOptions); 11 | return Column(columnOptions); 12 | } 13 | -------------------------------------------------------------------------------- /packages/decorators/src/ulid-column.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-non-null-assertion */ 2 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 3 | import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm"; 4 | import { PrimaryUlidColumn, UlidColumn } from "./ulid-column"; 5 | 6 | e2eDatabaseTypeSetUp("UlidColumn", (options) => { 7 | @Entity() 8 | class UlidColumnMonotonicTest extends BaseEntity { 9 | @PrimaryGeneratedColumn() 10 | public id!: number; 11 | 12 | @UlidColumn() 13 | public text!: string; 14 | 15 | @Column({ nullable: true }) 16 | public text2!: string; 17 | } 18 | 19 | @Entity() 20 | class UlidColumnNotMonotonicTest extends BaseEntity { 21 | @PrimaryGeneratedColumn() 22 | public id!: number; 23 | 24 | @UlidColumn({ isMonotonic: false }) 25 | public text!: string; 26 | } 27 | 28 | @Entity() 29 | class PrimaryUlidColumnTest extends BaseEntity { 30 | @PrimaryUlidColumn() 31 | public id!: string; 32 | } 33 | 34 | e2eSetUp({ entities: [UlidColumnMonotonicTest, UlidColumnNotMonotonicTest, PrimaryUlidColumnTest], ...options }); 35 | 36 | it("should be defined", async () => { 37 | await UlidColumnMonotonicTest.create().save(); 38 | await UlidColumnNotMonotonicTest.create().save(); 39 | await PrimaryUlidColumnTest.create().save(); 40 | }); 41 | 42 | it("should set ulid", async () => { 43 | await UlidColumnMonotonicTest.create().save(); 44 | const test = await UlidColumnMonotonicTest.find(); 45 | test[0].text2 = "a"; 46 | await test[0].save(); 47 | const test2 = await UlidColumnMonotonicTest.find(); 48 | 49 | expect(test[0].text).toBe(test2[0].text); 50 | test2[0].text = "a"; 51 | await test2[0].save(); 52 | const test3 = await UlidColumnMonotonicTest.find(); 53 | expect(test3[0].text).toBe("a"); 54 | 55 | await PrimaryUlidColumnTest.create().save(); 56 | const test4 = await PrimaryUlidColumnTest.find(); 57 | expect(test4[0].id.length).toEqual(26); 58 | }); 59 | 60 | it("should not set ulid when set to text", async () => { 61 | await UlidColumnMonotonicTest.create().save(); 62 | const test = await UlidColumnMonotonicTest.find(); 63 | test[0].text = "a"; 64 | await test[0].save(); 65 | const test2 = await UlidColumnMonotonicTest.find(); 66 | expect(test2[0].text).toBe("a"); 67 | }); 68 | }); 69 | -------------------------------------------------------------------------------- /packages/decorators/src/ulid-column.spec.ts: -------------------------------------------------------------------------------- 1 | import { PrimaryUlidColumn, UlidColumn } from "./ulid-column"; 2 | 3 | describe("UlidColumn", () => { 4 | it("should be defined", () => { 5 | expect(UlidColumn).toBeDefined(); 6 | }); 7 | 8 | it("should be defined", () => { 9 | class Test { 10 | @PrimaryUlidColumn({ isMonotonic: true, prng: () => 0.96, seedTime: 1000 }) 11 | public test1!: string; 12 | 13 | @UlidColumn() 14 | public test2!: string; 15 | } 16 | 17 | expect(new Test()).toBeDefined(); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/decorators/src/ulid-column.ts: -------------------------------------------------------------------------------- 1 | import { Column, ColumnOptions, ValueTransformer } from "typeorm"; 2 | import { monotonicFactory, PRNG, ulid, ULIDFactory } from "ulidx"; 3 | 4 | export interface UlidColumnOptions { 5 | isMonotonic?: boolean; 6 | prng?: PRNG | undefined; 7 | seedTime?: number | undefined; 8 | } 9 | class UlidTransformer implements ValueTransformer { 10 | private readonly monotonic: ULIDFactory | undefined; 11 | constructor(private readonly options: UlidColumnOptions) { 12 | if (options.isMonotonic) { 13 | this.monotonic = monotonicFactory(options.prng); 14 | } 15 | } 16 | public from(value: string): string { 17 | return value; 18 | } 19 | public to(value: string | undefined): string { 20 | if (value) { 21 | return value; 22 | } 23 | 24 | return this.options.isMonotonic && this.monotonic 25 | ? this.monotonic(this.options.seedTime) 26 | : ulid(this.options.seedTime); 27 | } 28 | } 29 | export function UlidColumn(trasformerOptions?: UlidColumnOptions, options?: ColumnOptions) { 30 | const columnTrasformerOptions = { 31 | isMonotonic: true, 32 | ...trasformerOptions, 33 | }; 34 | 35 | const columnOptions = { 36 | length: "26", 37 | type: "varchar", 38 | ...options, 39 | } as ColumnOptions; 40 | 41 | columnOptions.transformer = new UlidTransformer(columnTrasformerOptions); 42 | return Column(columnOptions); 43 | } 44 | 45 | export function PrimaryUlidColumn(trasformerOptions?: UlidColumnOptions, options?: ColumnOptions) { 46 | const columnOptions = { 47 | primary: true, 48 | ...options, 49 | } as ColumnOptions; 50 | 51 | return UlidColumn(trasformerOptions, columnOptions); 52 | } 53 | -------------------------------------------------------------------------------- /packages/decorators/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "**/*spec.ts", "**/*spec-e2e.ts", "dist", "src/test-utils.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/decorators/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "baseUrl": "./", 6 | "declarationMap": true 7 | }, 8 | "exclude": ["node_modules", "dist", "scripts", "src/test-utils.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/testing/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## 1.0.100 (2024-03-17) 7 | 8 | **Note:** Version bump only for package testing 9 | 10 | ## 1.0.99 (2024-03-10) 11 | 12 | **Note:** Version bump only for package testing 13 | 14 | ## 1.0.98 (2024-03-03) 15 | 16 | **Note:** Version bump only for package testing 17 | 18 | ## 1.0.97 (2024-02-25) 19 | 20 | **Note:** Version bump only for package testing 21 | 22 | ## 1.0.96 (2024-02-18) 23 | 24 | **Note:** Version bump only for package testing 25 | 26 | ## 1.0.95 (2024-02-11) 27 | 28 | **Note:** Version bump only for package testing 29 | 30 | ## 1.0.94 (2024-02-04) 31 | 32 | **Note:** Version bump only for package testing 33 | 34 | ## 1.0.93 (2024-01-28) 35 | 36 | **Note:** Version bump only for package testing 37 | 38 | ## 1.0.92 (2024-01-21) 39 | 40 | **Note:** Version bump only for package testing 41 | 42 | ## 1.0.91 (2024-01-14) 43 | 44 | **Note:** Version bump only for package testing 45 | 46 | ## 1.0.90 (2024-01-07) 47 | 48 | **Note:** Version bump only for package testing 49 | 50 | ## 1.0.89 (2023-12-31) 51 | 52 | **Note:** Version bump only for package testing 53 | 54 | ## 1.0.88 (2023-12-24) 55 | 56 | **Note:** Version bump only for package testing 57 | 58 | ## 1.0.87 (2023-12-17) 59 | 60 | **Note:** Version bump only for package testing 61 | 62 | ## 1.0.86 (2023-12-10) 63 | 64 | **Note:** Version bump only for package testing 65 | 66 | ## 1.0.85 (2023-12-03) 67 | 68 | **Note:** Version bump only for package testing 69 | 70 | ## 1.0.84 (2023-11-26) 71 | 72 | **Note:** Version bump only for package testing 73 | 74 | ## 1.0.83 (2023-11-19) 75 | 76 | **Note:** Version bump only for package testing 77 | 78 | ## 1.0.82 (2023-11-12) 79 | 80 | **Note:** Version bump only for package testing 81 | 82 | ## 1.0.81 (2023-11-05) 83 | 84 | **Note:** Version bump only for package testing 85 | 86 | ## 1.0.80 (2023-10-29) 87 | 88 | **Note:** Version bump only for package testing 89 | 90 | ## 1.0.79 (2023-10-22) 91 | 92 | **Note:** Version bump only for package testing 93 | 94 | ## 1.0.78 (2023-10-15) 95 | 96 | **Note:** Version bump only for package testing 97 | 98 | ## 1.0.77 (2023-10-08) 99 | 100 | **Note:** Version bump only for package testing 101 | 102 | ## 1.0.76 (2023-10-01) 103 | 104 | **Note:** Version bump only for package testing 105 | 106 | ## 1.0.75 (2023-09-24) 107 | 108 | **Note:** Version bump only for package testing 109 | 110 | ## 1.0.74 (2023-09-17) 111 | 112 | **Note:** Version bump only for package testing 113 | 114 | ## 1.0.73 (2023-09-10) 115 | 116 | **Note:** Version bump only for package testing 117 | 118 | ## 1.0.72 (2023-09-03) 119 | 120 | **Note:** Version bump only for package testing 121 | 122 | ## 1.0.71 (2023-08-27) 123 | 124 | **Note:** Version bump only for package testing 125 | 126 | ## 1.0.70 (2023-08-20) 127 | 128 | **Note:** Version bump only for package testing 129 | 130 | ## 1.0.69 (2023-08-13) 131 | 132 | **Note:** Version bump only for package testing 133 | 134 | ## 1.0.68 (2023-08-06) 135 | 136 | **Note:** Version bump only for package testing 137 | 138 | ## 1.0.67 (2023-07-30) 139 | 140 | **Note:** Version bump only for package testing 141 | 142 | ## 1.0.66 (2023-07-23) 143 | 144 | **Note:** Version bump only for package testing 145 | 146 | ## 1.0.65 (2023-07-16) 147 | 148 | **Note:** Version bump only for package testing 149 | 150 | ## 1.0.64 (2023-07-09) 151 | 152 | **Note:** Version bump only for package testing 153 | 154 | ## 1.0.63 (2023-07-02) 155 | 156 | **Note:** Version bump only for package testing 157 | 158 | ## 1.0.62 (2023-06-25) 159 | 160 | **Note:** Version bump only for package testing 161 | 162 | ## 1.0.61 (2023-06-11) 163 | 164 | **Note:** Version bump only for package testing 165 | 166 | ## 1.0.60 (2023-06-04) 167 | 168 | **Note:** Version bump only for package testing 169 | 170 | ## 1.0.59 (2023-05-28) 171 | 172 | **Note:** Version bump only for package testing 173 | 174 | ## 1.0.58 (2023-05-21) 175 | 176 | **Note:** Version bump only for package testing 177 | 178 | ## 1.0.57 (2023-04-16) 179 | 180 | **Note:** Version bump only for package testing 181 | 182 | ## 1.0.56 (2023-04-09) 183 | 184 | **Note:** Version bump only for package testing 185 | 186 | ## 1.0.55 (2023-04-02) 187 | 188 | **Note:** Version bump only for package testing 189 | 190 | ## 1.0.54 (2023-03-26) 191 | 192 | **Note:** Version bump only for package testing 193 | 194 | ## 1.0.53 (2023-03-19) 195 | 196 | **Note:** Version bump only for package testing 197 | 198 | ## 1.0.52 (2023-03-12) 199 | 200 | **Note:** Version bump only for package testing 201 | 202 | ## 1.0.51 (2023-03-05) 203 | 204 | **Note:** Version bump only for package testing 205 | 206 | ## 1.0.50 (2023-02-26) 207 | 208 | **Note:** Version bump only for package testing 209 | 210 | ## 1.0.49 (2023-02-19) 211 | 212 | **Note:** Version bump only for package testing 213 | 214 | ## 1.0.48 (2023-02-12) 215 | 216 | **Note:** Version bump only for package testing 217 | 218 | ## 1.0.47 (2023-02-05) 219 | 220 | **Note:** Version bump only for package testing 221 | 222 | ## 1.0.46 (2023-01-29) 223 | 224 | **Note:** Version bump only for package testing 225 | 226 | ## 1.0.45 (2023-01-22) 227 | 228 | **Note:** Version bump only for package testing 229 | 230 | ## 1.0.44 (2023-01-15) 231 | 232 | **Note:** Version bump only for package testing 233 | 234 | ## 1.0.43 (2023-01-08) 235 | 236 | **Note:** Version bump only for package testing 237 | 238 | ## 1.0.42 (2023-01-01) 239 | 240 | ### Bug Fixes 241 | 242 | * **deps:** update dependency ulidx to ^0.4.0 ([02250b8](https://github.com/anchan828/typeorm-helpers/commit/02250b8f1c89beb2d90d8145b1ed40ac72b90647)) 243 | 244 | ## 1.0.41 (2022-12-25) 245 | 246 | **Note:** Version bump only for package testing 247 | 248 | ## 1.0.40 (2022-12-18) 249 | 250 | **Note:** Version bump only for package testing 251 | 252 | ## 1.0.39 (2022-12-11) 253 | 254 | **Note:** Version bump only for package testing 255 | 256 | ## 1.0.38 (2022-12-04) 257 | 258 | **Note:** Version bump only for package testing 259 | 260 | ## 1.0.37 (2022-11-27) 261 | 262 | **Note:** Version bump only for package testing 263 | 264 | ## 1.0.36 (2022-11-20) 265 | 266 | **Note:** Version bump only for package testing 267 | 268 | ## 1.0.35 (2022-11-13) 269 | 270 | **Note:** Version bump only for package testing 271 | 272 | ## 1.0.34 (2022-11-06) 273 | 274 | **Note:** Version bump only for package testing 275 | 276 | ## 1.0.33 (2022-10-30) 277 | 278 | **Note:** Version bump only for package testing 279 | 280 | ## 1.0.32 (2022-10-23) 281 | 282 | **Note:** Version bump only for package testing 283 | 284 | ## 1.0.31 (2022-10-16) 285 | 286 | **Note:** Version bump only for package testing 287 | 288 | ## 1.0.30 (2022-10-09) 289 | 290 | **Note:** Version bump only for package testing 291 | 292 | ## 1.0.29 (2022-10-02) 293 | 294 | **Note:** Version bump only for package testing 295 | 296 | ## 1.0.28 (2022-09-25) 297 | 298 | **Note:** Version bump only for package testing 299 | 300 | ## 1.0.27 (2022-09-18) 301 | 302 | **Note:** Version bump only for package testing 303 | 304 | ## 1.0.26 (2022-09-11) 305 | 306 | **Note:** Version bump only for package testing 307 | 308 | ## 1.0.25 (2022-09-04) 309 | 310 | **Note:** Version bump only for package testing 311 | 312 | ## 1.0.24 (2022-08-28) 313 | 314 | **Note:** Version bump only for package testing 315 | 316 | ## 1.0.23 (2022-08-21) 317 | 318 | **Note:** Version bump only for package testing 319 | 320 | ## 1.0.22 (2022-08-14) 321 | 322 | **Note:** Version bump only for package testing 323 | 324 | ## 1.0.21 (2022-08-07) 325 | 326 | **Note:** Version bump only for package testing 327 | 328 | ## 1.0.20 (2022-07-31) 329 | 330 | **Note:** Version bump only for package testing 331 | 332 | ## 1.0.19 (2022-07-24) 333 | 334 | **Note:** Version bump only for package testing 335 | 336 | ## 1.0.18 (2022-07-17) 337 | 338 | **Note:** Version bump only for package testing 339 | 340 | ## 1.0.17 (2022-07-10) 341 | 342 | **Note:** Version bump only for package testing 343 | 344 | ## 1.0.16 (2022-07-03) 345 | 346 | **Note:** Version bump only for package testing 347 | 348 | ## 1.0.15 (2022-06-26) 349 | 350 | **Note:** Version bump only for package testing 351 | 352 | ## 1.0.14 (2022-06-19) 353 | 354 | **Note:** Version bump only for package testing 355 | 356 | ## 1.0.13 (2022-06-12) 357 | 358 | **Note:** Version bump only for package testing 359 | 360 | ## 1.0.12 (2022-06-05) 361 | 362 | **Note:** Version bump only for package testing 363 | 364 | ## 1.0.11 (2022-05-29) 365 | 366 | **Note:** Version bump only for package testing 367 | 368 | ## 1.0.10 (2022-05-22) 369 | 370 | **Note:** Version bump only for package testing 371 | 372 | ## 1.0.9 (2022-05-15) 373 | 374 | **Note:** Version bump only for package testing 375 | 376 | ## 1.0.8 (2022-05-08) 377 | 378 | **Note:** Version bump only for package testing 379 | 380 | ## 1.0.7 (2022-05-01) 381 | 382 | **Note:** Version bump only for package testing 383 | 384 | ## 1.0.6 (2022-04-24) 385 | 386 | **Note:** Version bump only for package testing 387 | 388 | ## 1.0.5 (2022-04-17) 389 | 390 | **Note:** Version bump only for package testing 391 | 392 | ## 1.0.4 (2022-04-11) 393 | 394 | ### Bug Fixes 395 | 396 | * export ulid functions ([fa46697](https://github.com/anchan828/typeorm-helpers/commit/fa466976b5d3e2ec6e5b75b948da2de6b8f968eb)) 397 | 398 | ## 1.0.3 (2022-04-10) 399 | 400 | **Note:** Version bump only for package testing 401 | 402 | ## 1.0.2 (2022-04-03) 403 | 404 | **Note:** Version bump only for package testing 405 | 406 | ## 1.0.1 (2022-03-27) 407 | 408 | **Note:** Version bump only for package testing 409 | 410 | # 1.0.0 (2022-03-24) 411 | 412 | **Note:** Version bump only for package testing 413 | 414 | # 0.9.0 (2022-03-24) 415 | 416 | ### Features 417 | 418 | * Add undefined transformer ([#867](https://github.com/anchan828/typeorm-helpers/issues/867)) ([eaa37fb](https://github.com/anchan828/typeorm-helpers/commit/eaa37fb16ab523d2e394e9c56c36c58bbf06364b)) 419 | 420 | ## 0.8.11 (2022-03-20) 421 | 422 | **Note:** Version bump only for package testing 423 | 424 | ## 0.8.10 (2022-03-13) 425 | 426 | **Note:** Version bump only for package testing 427 | 428 | ## 0.8.9 (2022-03-06) 429 | 430 | **Note:** Version bump only for package testing 431 | 432 | ## 0.8.8 (2022-02-27) 433 | 434 | **Note:** Version bump only for package testing 435 | 436 | ## 0.8.7 (2022-02-20) 437 | 438 | **Note:** Version bump only for package testing 439 | 440 | ## 0.8.6 (2022-02-06) 441 | 442 | **Note:** Version bump only for package testing 443 | 444 | ## 0.8.5 (2022-01-30) 445 | 446 | **Note:** Version bump only for package testing 447 | 448 | ## 0.8.4 (2022-01-23) 449 | 450 | **Note:** Version bump only for package testing 451 | 452 | ## 0.8.3 (2022-01-16) 453 | 454 | **Note:** Version bump only for package testing 455 | 456 | ## 0.8.2 (2022-01-13) 457 | 458 | ### Features 459 | 460 | * improve HistoryEntityInterface ([#800](https://github.com/anchan828/typeorm-helpers/issues/800)) ([e89e8cc](https://github.com/anchan828/typeorm-helpers/commit/e89e8cc1fae2e0a3b101e7986ec6f672f07cf23a)) 461 | 462 | ## 0.8.1 (2022-01-09) 463 | 464 | **Note:** Version bump only for package testing 465 | 466 | # 0.8.0 (2022-01-07) 467 | 468 | ### Features 469 | 470 | * stop entity class inheritance ([#794](https://github.com/anchan828/typeorm-helpers/issues/794)) ([8108e3c](https://github.com/anchan828/typeorm-helpers/commit/8108e3c7f2835f44f2b04f862486353c9ff7ac4a)) 471 | 472 | ## 0.7.20 (2022-01-02) 473 | 474 | **Note:** Version bump only for package testing 475 | 476 | ## 0.7.19 (2021-12-26) 477 | 478 | **Note:** Version bump only for package testing 479 | 480 | ## 0.7.18 (2021-12-19) 481 | 482 | **Note:** Version bump only for package testing 483 | 484 | ## 0.7.17 (2021-12-12) 485 | 486 | **Note:** Version bump only for package testing 487 | 488 | ## 0.7.16 (2021-12-05) 489 | 490 | **Note:** Version bump only for package testing 491 | 492 | ## 0.7.15 (2021-11-28) 493 | 494 | **Note:** Version bump only for package testing 495 | 496 | ## 0.7.14 (2021-11-21) 497 | 498 | **Note:** Version bump only for package testing 499 | 500 | ## 0.7.13 (2021-11-14) 501 | 502 | **Note:** Version bump only for package testing 503 | 504 | ## 0.7.12 (2021-11-07) 505 | 506 | **Note:** Version bump only for package testing 507 | 508 | ## 0.7.11 (2021-10-28) 509 | 510 | ### Bug Fixes 511 | 512 | * should not use create function on manager to cast to EntityType ([#729](https://github.com/anchan828/typeorm-helpers/issues/729)) ([56f15a2](https://github.com/anchan828/typeorm-helpers/commit/56f15a25c65ab7a16023da9b0619c62822e0d203)) 513 | 514 | ## 0.7.10 (2021-10-24) 515 | 516 | **Note:** Version bump only for package testing 517 | 518 | ## 0.7.9 (2021-10-17) 519 | 520 | **Note:** Version bump only for package testing 521 | 522 | ## 0.7.8 (2021-10-10) 523 | 524 | **Note:** Version bump only for package testing 525 | 526 | ## 0.7.7 (2021-10-03) 527 | 528 | **Note:** Version bump only for package testing 529 | 530 | ## 0.7.6 (2021-09-26) 531 | 532 | **Note:** Version bump only for package testing 533 | 534 | ## 0.7.5 (2021-09-19) 535 | 536 | **Note:** Version bump only for package testing 537 | 538 | ## 0.7.4 (2021-09-12) 539 | 540 | **Note:** Version bump only for package testing 541 | 542 | ## 0.7.3 (2021-09-05) 543 | 544 | **Note:** Version bump only for package testing 545 | 546 | ## 0.7.2 (2021-08-29) 547 | 548 | **Note:** Version bump only for package testing 549 | 550 | ## 0.7.1 (2021-08-22) 551 | 552 | **Note:** Version bump only for package testing 553 | 554 | # 0.7.0 (2021-08-20) 555 | 556 | ### Features 557 | 558 | * support postgres and sqlite ([#682](https://github.com/anchan828/typeorm-helpers/issues/682)) ([160a21f](https://github.com/anchan828/typeorm-helpers/commit/160a21fab224757e1db59eaedb8dd92993167157)) 559 | -------------------------------------------------------------------------------- /packages/testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "testing", 3 | "version": "1.0.100", 4 | "private": true, 5 | "description": "This is pacakge is for testing.", 6 | "homepage": "https://github.com/anchan828/typeorm-helpers/tree/master/packages/testing#readme", 7 | "bugs": { 8 | "url": "https://github.com/anchan828/typeorm-helpers/issues" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/anchan828/typeorm-helpers.git" 13 | }, 14 | "license": "MIT", 15 | "author": "anchan828 ", 16 | "main": "src/index.ts" 17 | } 18 | -------------------------------------------------------------------------------- /packages/testing/src/index.ts: -------------------------------------------------------------------------------- 1 | import { DataSource, DataSourceOptions } from "typeorm"; 2 | 3 | export function e2eDatabaseTypeSetUp(name: string, callback: (options: Partial) => void): void; 4 | export function e2eDatabaseTypeSetUp( 5 | name: string, 6 | ignoreTypes: string[], 7 | callback: (options: Partial) => void, 8 | ): void; 9 | export function e2eDatabaseTypeSetUp( 10 | name: string, 11 | callbackOrIgnoreTypes: string[] | Function, 12 | callbackFunction?: (options: Partial) => void, 13 | ): void { 14 | const ignoreTypes: string[] = []; 15 | let callback: Function | undefined; 16 | if (Array.isArray(callbackOrIgnoreTypes)) { 17 | ignoreTypes.push(...callbackOrIgnoreTypes); 18 | callback = callbackFunction; 19 | } else { 20 | callback = callbackOrIgnoreTypes; 21 | } 22 | 23 | const options: Array> = [ 24 | { type: "mysql", database: "test" }, 25 | { type: "postgres", database: "test" }, 26 | { type: "sqlite", database: ":memory:" }, 27 | ].filter((x) => !ignoreTypes.includes(x.type + "")) as Array>; 28 | 29 | describe.each>(options)(`[$type] ${name}`, (options) => { 30 | jest.retryTimes(5); 31 | callback?.(options); 32 | }); 33 | } 34 | 35 | export async function e2eSetUp( 36 | options?: Partial, 37 | callback?: (dataSource: DataSource) => void | Promise, 38 | ): Promise { 39 | let dataSource: DataSource; 40 | beforeEach(async () => { 41 | const opt = Object.assign>( 42 | { 43 | database: "test", 44 | dropSchema: true, 45 | entities: [], 46 | host: "localhost", 47 | password: "root", 48 | subscribers: [], 49 | synchronize: true, 50 | type: "mysql", 51 | username: "root", 52 | }, 53 | options || {}, 54 | ); 55 | 56 | dataSource = await new DataSource(opt).initialize(); 57 | 58 | await callback?.(dataSource); 59 | }); 60 | 61 | afterEach(async () => { 62 | await dataSource.destroy(); 63 | }); 64 | } 65 | -------------------------------------------------------------------------------- /packages/transformers/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const baseESLintConfig = require("../../.eslintrc"); 2 | 3 | module.exports = { ...baseESLintConfig }; 4 | -------------------------------------------------------------------------------- /packages/transformers/.npmignore: -------------------------------------------------------------------------------- 1 | * 2 | !dist/**/* 3 | dist/**/*.tsbuildinfo 4 | dist/**/*.js.map 5 | dist/**/*.ts.map 6 | -------------------------------------------------------------------------------- /packages/transformers/.prettierrc.js: -------------------------------------------------------------------------------- 1 | const basePrettierConfig = require("../../.prettierrc"); 2 | 3 | module.exports = { 4 | ...basePrettierConfig, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/transformers/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## 1.0.100 (2024-03-17) 7 | 8 | **Note:** Version bump only for package @anchan828/typeorm-transformers 9 | 10 | ## 1.0.99 (2024-03-10) 11 | 12 | **Note:** Version bump only for package @anchan828/typeorm-transformers 13 | 14 | ## 1.0.98 (2024-03-03) 15 | 16 | **Note:** Version bump only for package @anchan828/typeorm-transformers 17 | 18 | ## 1.0.97 (2024-02-25) 19 | 20 | **Note:** Version bump only for package @anchan828/typeorm-transformers 21 | 22 | ## 1.0.96 (2024-02-18) 23 | 24 | **Note:** Version bump only for package @anchan828/typeorm-transformers 25 | 26 | ## 1.0.95 (2024-02-11) 27 | 28 | **Note:** Version bump only for package @anchan828/typeorm-transformers 29 | 30 | ## 1.0.94 (2024-02-04) 31 | 32 | **Note:** Version bump only for package @anchan828/typeorm-transformers 33 | 34 | ## 1.0.93 (2024-01-28) 35 | 36 | **Note:** Version bump only for package @anchan828/typeorm-transformers 37 | 38 | ## 1.0.92 (2024-01-21) 39 | 40 | **Note:** Version bump only for package @anchan828/typeorm-transformers 41 | 42 | ## 1.0.91 (2024-01-14) 43 | 44 | **Note:** Version bump only for package @anchan828/typeorm-transformers 45 | 46 | ## 1.0.90 (2024-01-07) 47 | 48 | **Note:** Version bump only for package @anchan828/typeorm-transformers 49 | 50 | ## 1.0.89 (2023-12-31) 51 | 52 | **Note:** Version bump only for package @anchan828/typeorm-transformers 53 | 54 | ## 1.0.88 (2023-12-24) 55 | 56 | **Note:** Version bump only for package @anchan828/typeorm-transformers 57 | 58 | ## 1.0.87 (2023-12-17) 59 | 60 | **Note:** Version bump only for package @anchan828/typeorm-transformers 61 | 62 | ## 1.0.86 (2023-12-10) 63 | 64 | **Note:** Version bump only for package @anchan828/typeorm-transformers 65 | 66 | ## 1.0.85 (2023-12-03) 67 | 68 | **Note:** Version bump only for package @anchan828/typeorm-transformers 69 | 70 | ## 1.0.84 (2023-11-26) 71 | 72 | **Note:** Version bump only for package @anchan828/typeorm-transformers 73 | 74 | ## 1.0.83 (2023-11-19) 75 | 76 | **Note:** Version bump only for package @anchan828/typeorm-transformers 77 | 78 | ## 1.0.82 (2023-11-12) 79 | 80 | **Note:** Version bump only for package @anchan828/typeorm-transformers 81 | 82 | ## 1.0.81 (2023-11-05) 83 | 84 | **Note:** Version bump only for package @anchan828/typeorm-transformers 85 | 86 | ## 1.0.80 (2023-10-29) 87 | 88 | **Note:** Version bump only for package @anchan828/typeorm-transformers 89 | 90 | ## 1.0.79 (2023-10-22) 91 | 92 | **Note:** Version bump only for package @anchan828/typeorm-transformers 93 | 94 | ## 1.0.78 (2023-10-15) 95 | 96 | **Note:** Version bump only for package @anchan828/typeorm-transformers 97 | 98 | ## 1.0.77 (2023-10-08) 99 | 100 | **Note:** Version bump only for package @anchan828/typeorm-transformers 101 | 102 | ## 1.0.76 (2023-10-01) 103 | 104 | **Note:** Version bump only for package @anchan828/typeorm-transformers 105 | 106 | ## 1.0.75 (2023-09-24) 107 | 108 | **Note:** Version bump only for package @anchan828/typeorm-transformers 109 | 110 | ## 1.0.74 (2023-09-17) 111 | 112 | **Note:** Version bump only for package @anchan828/typeorm-transformers 113 | 114 | ## 1.0.73 (2023-09-10) 115 | 116 | **Note:** Version bump only for package @anchan828/typeorm-transformers 117 | 118 | ## 1.0.72 (2023-09-03) 119 | 120 | **Note:** Version bump only for package @anchan828/typeorm-transformers 121 | 122 | ## 1.0.71 (2023-08-27) 123 | 124 | **Note:** Version bump only for package @anchan828/typeorm-transformers 125 | 126 | ## 1.0.70 (2023-08-20) 127 | 128 | **Note:** Version bump only for package @anchan828/typeorm-transformers 129 | 130 | ## 1.0.69 (2023-08-13) 131 | 132 | **Note:** Version bump only for package @anchan828/typeorm-transformers 133 | 134 | ## 1.0.68 (2023-08-06) 135 | 136 | **Note:** Version bump only for package @anchan828/typeorm-transformers 137 | 138 | ## 1.0.67 (2023-07-30) 139 | 140 | **Note:** Version bump only for package @anchan828/typeorm-transformers 141 | 142 | ## 1.0.66 (2023-07-23) 143 | 144 | **Note:** Version bump only for package @anchan828/typeorm-transformers 145 | 146 | ## 1.0.65 (2023-07-16) 147 | 148 | **Note:** Version bump only for package @anchan828/typeorm-transformers 149 | 150 | ## 1.0.64 (2023-07-09) 151 | 152 | **Note:** Version bump only for package @anchan828/typeorm-transformers 153 | 154 | ## 1.0.63 (2023-07-02) 155 | 156 | **Note:** Version bump only for package @anchan828/typeorm-transformers 157 | 158 | ## 1.0.62 (2023-06-25) 159 | 160 | **Note:** Version bump only for package @anchan828/typeorm-transformers 161 | 162 | ## 1.0.61 (2023-06-11) 163 | 164 | **Note:** Version bump only for package @anchan828/typeorm-transformers 165 | 166 | ## 1.0.60 (2023-06-04) 167 | 168 | **Note:** Version bump only for package @anchan828/typeorm-transformers 169 | 170 | ## 1.0.59 (2023-05-28) 171 | 172 | **Note:** Version bump only for package @anchan828/typeorm-transformers 173 | 174 | ## 1.0.58 (2023-05-21) 175 | 176 | **Note:** Version bump only for package @anchan828/typeorm-transformers 177 | 178 | ## 1.0.57 (2023-04-16) 179 | 180 | **Note:** Version bump only for package @anchan828/typeorm-transformers 181 | 182 | ## 1.0.56 (2023-04-09) 183 | 184 | **Note:** Version bump only for package @anchan828/typeorm-transformers 185 | 186 | ## 1.0.55 (2023-04-02) 187 | 188 | **Note:** Version bump only for package @anchan828/typeorm-transformers 189 | 190 | ## 1.0.54 (2023-03-26) 191 | 192 | **Note:** Version bump only for package @anchan828/typeorm-transformers 193 | 194 | ## 1.0.53 (2023-03-19) 195 | 196 | **Note:** Version bump only for package @anchan828/typeorm-transformers 197 | 198 | ## 1.0.52 (2023-03-12) 199 | 200 | **Note:** Version bump only for package @anchan828/typeorm-transformers 201 | 202 | ## 1.0.51 (2023-03-05) 203 | 204 | **Note:** Version bump only for package @anchan828/typeorm-transformers 205 | 206 | ## 1.0.50 (2023-02-26) 207 | 208 | **Note:** Version bump only for package @anchan828/typeorm-transformers 209 | 210 | ## 1.0.49 (2023-02-19) 211 | 212 | **Note:** Version bump only for package @anchan828/typeorm-transformers 213 | 214 | ## 1.0.48 (2023-02-12) 215 | 216 | **Note:** Version bump only for package @anchan828/typeorm-transformers 217 | 218 | ## 1.0.47 (2023-02-05) 219 | 220 | **Note:** Version bump only for package @anchan828/typeorm-transformers 221 | 222 | ## 1.0.46 (2023-01-29) 223 | 224 | **Note:** Version bump only for package @anchan828/typeorm-transformers 225 | 226 | ## 1.0.45 (2023-01-22) 227 | 228 | **Note:** Version bump only for package @anchan828/typeorm-transformers 229 | 230 | ## 1.0.44 (2023-01-15) 231 | 232 | **Note:** Version bump only for package @anchan828/typeorm-transformers 233 | 234 | ## 1.0.43 (2023-01-08) 235 | 236 | **Note:** Version bump only for package @anchan828/typeorm-transformers 237 | 238 | ## 1.0.42 (2023-01-01) 239 | 240 | ### Bug Fixes 241 | 242 | * **deps:** update dependency ulidx to ^0.4.0 ([02250b8](https://github.com/anchan828/typeorm-helpers/commit/02250b8f1c89beb2d90d8145b1ed40ac72b90647)) 243 | 244 | ## 1.0.41 (2022-12-25) 245 | 246 | **Note:** Version bump only for package @anchan828/typeorm-transformers 247 | 248 | ## 1.0.40 (2022-12-18) 249 | 250 | **Note:** Version bump only for package @anchan828/typeorm-transformers 251 | 252 | ## 1.0.39 (2022-12-11) 253 | 254 | **Note:** Version bump only for package @anchan828/typeorm-transformers 255 | 256 | ## 1.0.38 (2022-12-04) 257 | 258 | **Note:** Version bump only for package @anchan828/typeorm-transformers 259 | 260 | ## 1.0.37 (2022-11-27) 261 | 262 | **Note:** Version bump only for package @anchan828/typeorm-transformers 263 | 264 | ## 1.0.36 (2022-11-20) 265 | 266 | **Note:** Version bump only for package @anchan828/typeorm-transformers 267 | 268 | ## 1.0.35 (2022-11-13) 269 | 270 | **Note:** Version bump only for package @anchan828/typeorm-transformers 271 | 272 | ## 1.0.34 (2022-11-06) 273 | 274 | **Note:** Version bump only for package @anchan828/typeorm-transformers 275 | 276 | ## 1.0.33 (2022-10-30) 277 | 278 | **Note:** Version bump only for package @anchan828/typeorm-transformers 279 | 280 | ## 1.0.32 (2022-10-23) 281 | 282 | **Note:** Version bump only for package @anchan828/typeorm-transformers 283 | 284 | ## 1.0.31 (2022-10-16) 285 | 286 | **Note:** Version bump only for package @anchan828/typeorm-transformers 287 | 288 | ## 1.0.30 (2022-10-09) 289 | 290 | **Note:** Version bump only for package @anchan828/typeorm-transformers 291 | 292 | ## 1.0.29 (2022-10-02) 293 | 294 | **Note:** Version bump only for package @anchan828/typeorm-transformers 295 | 296 | ## 1.0.28 (2022-09-25) 297 | 298 | **Note:** Version bump only for package @anchan828/typeorm-transformers 299 | 300 | ## 1.0.27 (2022-09-18) 301 | 302 | **Note:** Version bump only for package @anchan828/typeorm-transformers 303 | 304 | ## 1.0.26 (2022-09-11) 305 | 306 | **Note:** Version bump only for package @anchan828/typeorm-transformers 307 | 308 | ## 1.0.25 (2022-09-04) 309 | 310 | **Note:** Version bump only for package @anchan828/typeorm-transformers 311 | 312 | ## 1.0.24 (2022-08-28) 313 | 314 | **Note:** Version bump only for package @anchan828/typeorm-transformers 315 | 316 | ## 1.0.23 (2022-08-21) 317 | 318 | **Note:** Version bump only for package @anchan828/typeorm-transformers 319 | 320 | ## 1.0.22 (2022-08-14) 321 | 322 | **Note:** Version bump only for package @anchan828/typeorm-transformers 323 | 324 | ## 1.0.21 (2022-08-07) 325 | 326 | **Note:** Version bump only for package @anchan828/typeorm-transformers 327 | 328 | ## 1.0.20 (2022-07-31) 329 | 330 | **Note:** Version bump only for package @anchan828/typeorm-transformers 331 | 332 | ## 1.0.19 (2022-07-24) 333 | 334 | **Note:** Version bump only for package @anchan828/typeorm-transformers 335 | 336 | ## 1.0.18 (2022-07-17) 337 | 338 | **Note:** Version bump only for package @anchan828/typeorm-transformers 339 | 340 | ## 1.0.17 (2022-07-10) 341 | 342 | **Note:** Version bump only for package @anchan828/typeorm-transformers 343 | 344 | ## 1.0.16 (2022-07-03) 345 | 346 | **Note:** Version bump only for package @anchan828/typeorm-transformers 347 | 348 | ## 1.0.15 (2022-06-26) 349 | 350 | **Note:** Version bump only for package @anchan828/typeorm-transformers 351 | 352 | ## 1.0.14 (2022-06-19) 353 | 354 | **Note:** Version bump only for package @anchan828/typeorm-transformers 355 | 356 | ## 1.0.13 (2022-06-12) 357 | 358 | **Note:** Version bump only for package @anchan828/typeorm-transformers 359 | 360 | ## 1.0.12 (2022-06-05) 361 | 362 | **Note:** Version bump only for package @anchan828/typeorm-transformers 363 | 364 | ## 1.0.11 (2022-05-29) 365 | 366 | **Note:** Version bump only for package @anchan828/typeorm-transformers 367 | 368 | ## 1.0.10 (2022-05-22) 369 | 370 | **Note:** Version bump only for package @anchan828/typeorm-transformers 371 | 372 | ## 1.0.9 (2022-05-15) 373 | 374 | **Note:** Version bump only for package @anchan828/typeorm-transformers 375 | 376 | ## 1.0.8 (2022-05-08) 377 | 378 | **Note:** Version bump only for package @anchan828/typeorm-transformers 379 | 380 | ## 1.0.7 (2022-05-01) 381 | 382 | **Note:** Version bump only for package @anchan828/typeorm-transformers 383 | 384 | ## 1.0.6 (2022-04-24) 385 | 386 | **Note:** Version bump only for package @anchan828/typeorm-transformers 387 | 388 | ## 1.0.5 (2022-04-17) 389 | 390 | **Note:** Version bump only for package @anchan828/typeorm-transformers 391 | 392 | ## 1.0.4 (2022-04-11) 393 | 394 | ### Bug Fixes 395 | 396 | * export ulid functions ([fa46697](https://github.com/anchan828/typeorm-helpers/commit/fa466976b5d3e2ec6e5b75b948da2de6b8f968eb)) 397 | 398 | ## 1.0.3 (2022-04-10) 399 | 400 | **Note:** Version bump only for package @anchan828/typeorm-transformers 401 | 402 | ## 1.0.2 (2022-04-03) 403 | 404 | **Note:** Version bump only for package @anchan828/typeorm-transformers 405 | 406 | ## 1.0.1 (2022-03-27) 407 | 408 | **Note:** Version bump only for package @anchan828/typeorm-transformers 409 | 410 | # 1.0.0 (2022-03-24) 411 | 412 | **Note:** Version bump only for package @anchan828/typeorm-transformers 413 | 414 | # 0.9.0 (2022-03-24) 415 | 416 | ### Features 417 | 418 | * Add undefined transformer ([#867](https://github.com/anchan828/typeorm-helpers/issues/867)) ([eaa37fb](https://github.com/anchan828/typeorm-helpers/commit/eaa37fb16ab523d2e394e9c56c36c58bbf06364b)) 419 | 420 | ## 0.8.11 (2022-03-20) 421 | 422 | **Note:** Version bump only for package @anchan828/typeorm-transformers 423 | 424 | ## 0.8.10 (2022-03-13) 425 | 426 | **Note:** Version bump only for package @anchan828/typeorm-transformers 427 | 428 | ## 0.8.9 (2022-03-06) 429 | 430 | **Note:** Version bump only for package @anchan828/typeorm-transformers 431 | 432 | ## 0.8.8 (2022-02-27) 433 | 434 | **Note:** Version bump only for package @anchan828/typeorm-transformers 435 | 436 | ## 0.8.7 (2022-02-20) 437 | 438 | **Note:** Version bump only for package @anchan828/typeorm-transformers 439 | 440 | ## 0.8.6 (2022-02-06) 441 | 442 | **Note:** Version bump only for package @anchan828/typeorm-transformers 443 | 444 | ## 0.8.5 (2022-01-30) 445 | 446 | **Note:** Version bump only for package @anchan828/typeorm-transformers 447 | 448 | ## 0.8.4 (2022-01-23) 449 | 450 | **Note:** Version bump only for package @anchan828/typeorm-transformers 451 | 452 | ## 0.8.3 (2022-01-16) 453 | 454 | **Note:** Version bump only for package @anchan828/typeorm-transformers 455 | 456 | ## 0.8.2 (2022-01-13) 457 | 458 | ### Features 459 | 460 | * improve HistoryEntityInterface ([#800](https://github.com/anchan828/typeorm-helpers/issues/800)) ([e89e8cc](https://github.com/anchan828/typeorm-helpers/commit/e89e8cc1fae2e0a3b101e7986ec6f672f07cf23a)) 461 | 462 | ## 0.8.1 (2022-01-09) 463 | 464 | **Note:** Version bump only for package @anchan828/typeorm-transformers 465 | 466 | # 0.8.0 (2022-01-07) 467 | 468 | ### Features 469 | 470 | * stop entity class inheritance ([#794](https://github.com/anchan828/typeorm-helpers/issues/794)) ([8108e3c](https://github.com/anchan828/typeorm-helpers/commit/8108e3c7f2835f44f2b04f862486353c9ff7ac4a)) 471 | 472 | ## 0.7.20 (2022-01-02) 473 | 474 | **Note:** Version bump only for package @anchan828/typeorm-transformers 475 | 476 | ## 0.7.19 (2021-12-26) 477 | 478 | **Note:** Version bump only for package @anchan828/typeorm-transformers 479 | 480 | ## 0.7.18 (2021-12-19) 481 | 482 | **Note:** Version bump only for package @anchan828/typeorm-transformers 483 | 484 | ## 0.7.17 (2021-12-12) 485 | 486 | **Note:** Version bump only for package @anchan828/typeorm-transformers 487 | 488 | ## 0.7.16 (2021-12-05) 489 | 490 | **Note:** Version bump only for package @anchan828/typeorm-transformers 491 | 492 | ## 0.7.15 (2021-11-28) 493 | 494 | **Note:** Version bump only for package @anchan828/typeorm-transformers 495 | 496 | ## 0.7.14 (2021-11-21) 497 | 498 | **Note:** Version bump only for package @anchan828/typeorm-transformers 499 | 500 | ## 0.7.13 (2021-11-14) 501 | 502 | **Note:** Version bump only for package @anchan828/typeorm-transformers 503 | 504 | ## 0.7.12 (2021-11-07) 505 | 506 | **Note:** Version bump only for package @anchan828/typeorm-transformers 507 | 508 | ## 0.7.11 (2021-10-28) 509 | 510 | ### Bug Fixes 511 | 512 | * should not use create function on manager to cast to EntityType ([#729](https://github.com/anchan828/typeorm-helpers/issues/729)) ([56f15a2](https://github.com/anchan828/typeorm-helpers/commit/56f15a25c65ab7a16023da9b0619c62822e0d203)) 513 | 514 | ## 0.7.10 (2021-10-24) 515 | 516 | **Note:** Version bump only for package @anchan828/typeorm-transformers 517 | 518 | ## 0.7.9 (2021-10-17) 519 | 520 | **Note:** Version bump only for package @anchan828/typeorm-transformers 521 | 522 | ## 0.7.8 (2021-10-10) 523 | 524 | **Note:** Version bump only for package @anchan828/typeorm-transformers 525 | 526 | ## 0.7.7 (2021-10-03) 527 | 528 | **Note:** Version bump only for package @anchan828/typeorm-transformers 529 | 530 | ## 0.7.6 (2021-09-26) 531 | 532 | **Note:** Version bump only for package @anchan828/typeorm-transformers 533 | 534 | ## 0.7.5 (2021-09-19) 535 | 536 | **Note:** Version bump only for package @anchan828/typeorm-transformers 537 | 538 | ## 0.7.4 (2021-09-12) 539 | 540 | **Note:** Version bump only for package @anchan828/typeorm-transformers 541 | 542 | ## 0.7.3 (2021-09-05) 543 | 544 | **Note:** Version bump only for package @anchan828/typeorm-transformers 545 | 546 | ## 0.7.2 (2021-08-29) 547 | 548 | **Note:** Version bump only for package @anchan828/typeorm-transformers 549 | 550 | ## 0.7.1 (2021-08-22) 551 | 552 | **Note:** Version bump only for package @anchan828/typeorm-transformers 553 | 554 | # 0.7.0 (2021-08-20) 555 | 556 | ### Features 557 | 558 | * support postgres and sqlite ([#682](https://github.com/anchan828/typeorm-helpers/issues/682)) ([160a21f](https://github.com/anchan828/typeorm-helpers/commit/160a21fab224757e1db59eaedb8dd92993167157)) 559 | 560 | ## 0.6.6 (2021-08-18) 561 | 562 | ### Features 563 | 564 | * overwrite action column type ([#680](https://github.com/anchan828/typeorm-helpers/issues/680)) ([b845c6b](https://github.com/anchan828/typeorm-helpers/commit/b845c6b5aef099fe8db90a91043b9cb22fc951ae)) 565 | 566 | ## 0.6.5 (2021-08-15) 567 | 568 | **Note:** Version bump only for package @anchan828/typeorm-transformers 569 | 570 | ## 0.6.4 (2021-08-08) 571 | 572 | **Note:** Version bump only for package @anchan828/typeorm-transformers 573 | 574 | ## 0.6.3 (2021-08-01) 575 | 576 | **Note:** Version bump only for package @anchan828/typeorm-transformers 577 | 578 | ## 0.6.2 (2021-07-25) 579 | 580 | **Note:** Version bump only for package @anchan828/typeorm-transformers 581 | 582 | ## 0.6.1 (2021-07-18) 583 | 584 | **Note:** Version bump only for package @anchan828/typeorm-transformers 585 | 586 | ## 0.5.3 (2021-07-15) 587 | 588 | ### Bug Fixes 589 | 590 | * should remove one-to-one foreign key (key is unique) ([#658](https://github.com/anchan828/typeorm-helpers/issues/658)) ([c1994f3](https://github.com/anchan828/typeorm-helpers/commit/c1994f3729eb1136fade91e100b2bec9a21f22ab)) 591 | 592 | ## 0.5.2 (2021-07-13) 593 | 594 | ### Bug Fixes 595 | 596 | * export dropUniqueIndices ([3b53fe9](https://github.com/anchan828/typeorm-helpers/commit/3b53fe94debdcf94b2a33d84e202c727be537cc1)) 597 | 598 | ## 0.5.1 (2021-07-13) 599 | 600 | ### Features 601 | 602 | * add dropUniqueIndices function (helper function for migration ([#657](https://github.com/anchan828/typeorm-helpers/issues/657)) ([92e7721](https://github.com/anchan828/typeorm-helpers/commit/92e77211e7f2cdc9390a9d512ae4c88613e1c866)) 603 | 604 | # 0.5.0 (2021-07-12) 605 | 606 | **Note:** Version bump only for package @anchan828/typeorm-transformers 607 | 608 | ## 0.4.39 (2021-07-12) 609 | 610 | **Note:** Version bump only for package @anchan828/typeorm-transformers 611 | 612 | ## 0.4.38 (2021-07-11) 613 | 614 | **Note:** Version bump only for package @anchan828/typeorm-transformers 615 | 616 | ## 0.4.37 (2021-06-27) 617 | 618 | **Note:** Version bump only for package @anchan828/typeorm-transformers 619 | 620 | ## 0.4.36 (2021-06-20) 621 | 622 | **Note:** Version bump only for package @anchan828/typeorm-transformers 623 | 624 | ## 0.4.35 (2021-06-13) 625 | 626 | **Note:** Version bump only for package @anchan828/typeorm-transformers 627 | 628 | ## 0.4.34 (2021-06-06) 629 | 630 | **Note:** Version bump only for package @anchan828/typeorm-transformers 631 | 632 | ## 0.4.33 (2021-05-30) 633 | 634 | **Note:** Version bump only for package @anchan828/typeorm-transformers 635 | 636 | ## 0.4.32 (2021-05-23) 637 | 638 | **Note:** Version bump only for package @anchan828/typeorm-transformers 639 | 640 | ## 0.4.31 (2021-05-16) 641 | 642 | **Note:** Version bump only for package @anchan828/typeorm-transformers 643 | 644 | ## 0.4.30 (2021-05-09) 645 | 646 | **Note:** Version bump only for package @anchan828/typeorm-transformers 647 | 648 | ## 0.4.29 (2021-05-02) 649 | 650 | **Note:** Version bump only for package @anchan828/typeorm-transformers 651 | 652 | ## 0.4.28 (2021-04-25) 653 | 654 | **Note:** Version bump only for package @anchan828/typeorm-transformers 655 | 656 | ## 0.4.27 (2021-04-18) 657 | 658 | **Note:** Version bump only for package @anchan828/typeorm-transformers 659 | 660 | ## 0.4.26 (2021-04-11) 661 | 662 | **Note:** Version bump only for package @anchan828/typeorm-transformers 663 | 664 | ## 0.4.25 (2021-04-04) 665 | 666 | **Note:** Version bump only for package @anchan828/typeorm-transformers 667 | 668 | ## 0.4.24 (2021-03-28) 669 | 670 | **Note:** Version bump only for package @anchan828/typeorm-transformers 671 | 672 | ## 0.4.23 (2021-03-21) 673 | 674 | **Note:** Version bump only for package @anchan828/typeorm-transformers 675 | 676 | ## 0.4.22 (2021-02-28) 677 | 678 | **Note:** Version bump only for package @anchan828/typeorm-transformers 679 | 680 | ## 0.4.21 (2021-02-21) 681 | 682 | **Note:** Version bump only for package @anchan828/typeorm-transformers 683 | 684 | ## 0.4.20 (2021-02-14) 685 | 686 | **Note:** Version bump only for package @anchan828/typeorm-transformers 687 | 688 | ## 0.4.19 (2021-02-07) 689 | 690 | **Note:** Version bump only for package @anchan828/typeorm-transformers 691 | 692 | ## 0.4.18 (2021-01-31) 693 | 694 | **Note:** Version bump only for package @anchan828/typeorm-transformers 695 | 696 | ## 0.4.17 (2021-01-24) 697 | 698 | **Note:** Version bump only for package @anchan828/typeorm-transformers 699 | 700 | ## 0.4.16 (2021-01-17) 701 | 702 | **Note:** Version bump only for package @anchan828/typeorm-transformers 703 | 704 | ## 0.4.15 (2020-12-20) 705 | 706 | **Note:** Version bump only for package @anchan828/typeorm-transformers 707 | 708 | ## 0.4.14 (2020-12-13) 709 | 710 | **Note:** Version bump only for package @anchan828/typeorm-transformers 711 | 712 | ## 0.4.13 (2020-12-06) 713 | 714 | **Note:** Version bump only for package @anchan828/typeorm-transformers 715 | 716 | ## 0.4.12 (2020-11-29) 717 | 718 | **Note:** Version bump only for package @anchan828/typeorm-transformers 719 | 720 | ## 0.4.11 (2020-11-22) 721 | 722 | **Note:** Version bump only for package @anchan828/typeorm-transformers 723 | 724 | ## 0.4.10 (2020-11-15) 725 | 726 | **Note:** Version bump only for package @anchan828/typeorm-transformers 727 | 728 | ## 0.4.9 (2020-11-08) 729 | 730 | **Note:** Version bump only for package @anchan828/typeorm-transformers 731 | 732 | ## 0.4.8 (2020-11-01) 733 | 734 | **Note:** Version bump only for package @anchan828/typeorm-transformers 735 | 736 | ## 0.4.7 (2020-10-25) 737 | 738 | **Note:** Version bump only for package @anchan828/typeorm-transformers 739 | 740 | ## 0.4.6 (2020-10-18) 741 | 742 | **Note:** Version bump only for package @anchan828/typeorm-transformers 743 | 744 | ## 0.4.5 (2020-10-11) 745 | 746 | **Note:** Version bump only for package @anchan828/typeorm-transformers 747 | 748 | ## 0.4.4 (2020-10-04) 749 | 750 | **Note:** Version bump only for package @anchan828/typeorm-transformers 751 | 752 | ## 0.4.3 (2020-09-27) 753 | 754 | **Note:** Version bump only for package @anchan828/typeorm-transformers 755 | 756 | ## 0.4.2 (2020-09-20) 757 | 758 | **Note:** Version bump only for package @anchan828/typeorm-transformers 759 | 760 | ## 0.4.1 (2020-09-13) 761 | 762 | **Note:** Version bump only for package @anchan828/typeorm-transformers 763 | 764 | # [0.4.0](https://github.com/anchan828/typeorm-helpers/compare/v0.3.65...v0.4.0) (2020-09-04) 765 | 766 | ### Features 767 | 768 | - json culumn uses text type as default. and supported date string ([22e1ee9](https://github.com/anchan828/typeorm-helpers/commit/22e1ee9a8966378b3a5e346ca972b9ac53f4751f)) 769 | 770 | ## 0.3.65 (2020-08-30) 771 | 772 | **Note:** Version bump only for package @anchan828/typeorm-transformers 773 | 774 | ## 0.3.64 (2020-08-23) 775 | 776 | **Note:** Version bump only for package @anchan828/typeorm-transformers 777 | 778 | ## 0.3.63 (2020-08-16) 779 | 780 | **Note:** Version bump only for package @anchan828/typeorm-transformers 781 | 782 | ## 0.3.61 (2020-08-09) 783 | 784 | **Note:** Version bump only for package @anchan828/typeorm-transformers 785 | 786 | ## 0.3.60 (2020-08-02) 787 | 788 | **Note:** Version bump only for package @anchan828/typeorm-transformers 789 | 790 | ## 0.3.59 (2020-07-26) 791 | 792 | **Note:** Version bump only for package @anchan828/typeorm-transformers 793 | 794 | ## 0.3.58 (2020-07-19) 795 | 796 | **Note:** Version bump only for package @anchan828/typeorm-transformers 797 | 798 | ## 0.3.57 (2020-07-12) 799 | 800 | **Note:** Version bump only for package @anchan828/typeorm-transformers 801 | 802 | ## 0.3.56 (2020-07-05) 803 | 804 | **Note:** Version bump only for package @anchan828/typeorm-transformers 805 | 806 | ## 0.3.55 (2020-06-28) 807 | 808 | **Note:** Version bump only for package @anchan828/typeorm-transformers 809 | 810 | ## 0.3.54 (2020-06-21) 811 | 812 | **Note:** Version bump only for package @anchan828/typeorm-transformers 813 | 814 | ## 0.3.53 (2020-06-14) 815 | 816 | **Note:** Version bump only for package @anchan828/typeorm-transformers 817 | 818 | ## 0.3.52 (2020-06-07) 819 | 820 | **Note:** Version bump only for package @anchan828/typeorm-transformers 821 | 822 | ## 0.3.51 (2020-05-31) 823 | 824 | **Note:** Version bump only for package @anchan828/typeorm-transformers 825 | 826 | ## 0.3.50 (2020-05-24) 827 | 828 | **Note:** Version bump only for package @anchan828/typeorm-transformers 829 | 830 | ## 0.3.49 (2020-05-17) 831 | 832 | **Note:** Version bump only for package @anchan828/typeorm-transformers 833 | 834 | ## 0.3.48 (2020-05-10) 835 | 836 | **Note:** Version bump only for package @anchan828/typeorm-transformers 837 | 838 | ## 0.3.47 (2020-05-03) 839 | 840 | **Note:** Version bump only for package @anchan828/typeorm-transformers 841 | 842 | ## 0.3.46 (2020-04-26) 843 | 844 | **Note:** Version bump only for package @anchan828/typeorm-transformers 845 | 846 | ## 0.3.45 (2020-04-19) 847 | 848 | **Note:** Version bump only for package @anchan828/typeorm-transformers 849 | 850 | ## 0.3.44 (2020-04-05) 851 | 852 | **Note:** Version bump only for package @anchan828/typeorm-transformers 853 | 854 | ## 0.3.43 (2020-03-29) 855 | 856 | **Note:** Version bump only for package @anchan828/typeorm-transformers 857 | 858 | ## 0.3.42 (2020-03-15) 859 | 860 | **Note:** Version bump only for package @anchan828/typeorm-transformers 861 | 862 | ## 0.3.41 (2020-03-08) 863 | 864 | **Note:** Version bump only for package @anchan828/typeorm-transformers 865 | 866 | ## 0.3.40 (2020-03-01) 867 | 868 | **Note:** Version bump only for package @anchan828/typeorm-transformers 869 | 870 | ## 0.3.39 (2020-02-23) 871 | 872 | **Note:** Version bump only for package @anchan828/typeorm-transformers 873 | 874 | ## 0.3.38 (2020-02-16) 875 | 876 | **Note:** Version bump only for package @anchan828/typeorm-transformers 877 | 878 | ## 0.3.37 (2020-02-09) 879 | 880 | **Note:** Version bump only for package @anchan828/typeorm-transformers 881 | 882 | ## 0.3.36 (2020-02-02) 883 | 884 | **Note:** Version bump only for package @anchan828/typeorm-transformers 885 | 886 | ## 0.3.35 (2020-01-26) 887 | 888 | **Note:** Version bump only for package @anchan828/typeorm-transformers 889 | 890 | ## 0.3.34 (2020-01-19) 891 | 892 | **Note:** Version bump only for package @anchan828/typeorm-transformers 893 | 894 | ## 0.3.33 (2020-01-12) 895 | 896 | **Note:** Version bump only for package @anchan828/typeorm-transformers 897 | 898 | ## 0.3.32 (2020-01-05) 899 | 900 | **Note:** Version bump only for package @anchan828/typeorm-transformers 901 | 902 | ## 0.3.31 (2019-12-29) 903 | 904 | **Note:** Version bump only for package @anchan828/typeorm-transformers 905 | 906 | ## 0.3.30 (2019-12-22) 907 | 908 | **Note:** Version bump only for package @anchan828/typeorm-transformers 909 | 910 | ## 0.3.29 (2019-12-15) 911 | 912 | **Note:** Version bump only for package @anchan828/typeorm-transformers 913 | 914 | ## 0.3.28 (2019-12-08) 915 | 916 | **Note:** Version bump only for package @anchan828/typeorm-transformers 917 | 918 | ## [0.3.27](https://github.com/anchan828/typeorm-helpers/compare/v0.3.26...v0.3.27) (2019-11-03) 919 | 920 | ### Bug Fixes 921 | 922 | - **deps:** update dependency deepmerge to v4.2.2 ([761aa9a](https://github.com/anchan828/typeorm-helpers/commit/761aa9a695eff60f121376e8d76e323fc9cc2520)) 923 | 924 | ## [0.3.26](https://github.com/anchan828/typeorm-helpers/compare/v0.3.25...v0.3.26) (2019-10-27) 925 | 926 | ### Bug Fixes 927 | 928 | - **deps:** update dependency deepmerge to v4.2.0 ([a404b8f](https://github.com/anchan828/typeorm-helpers/commit/a404b8f7a1e5f80ceea57874187eeb95c3003e04)) 929 | - **deps:** update dependency deepmerge to v4.2.1 ([d617c06](https://github.com/anchan828/typeorm-helpers/commit/d617c063edabe2be9f4756b0ce11651fe9ad1628)) 930 | 931 | ## [0.3.25](https://github.com/anchan828/typeorm-helpers/compare/v0.3.24...v0.3.25) (2019-10-20) 932 | 933 | **Note:** Version bump only for package @anchan828/typeorm-transformers 934 | 935 | ## [0.3.24](https://github.com/anchan828/typeorm-helpers/compare/v0.3.23...v0.3.24) (2019-10-13) 936 | 937 | ### Bug Fixes 938 | 939 | - **deps:** update dependency deepmerge to v4.1.1 ([a1b6d1f](https://github.com/anchan828/typeorm-helpers/commit/a1b6d1f1e68941719b981d735b4d86cd3086574d)) 940 | 941 | ## [0.3.22](https://github.com/anchan828/typeorm-helpers/compare/v0.3.21...v0.3.22) (2019-10-08) 942 | 943 | ### Bug Fixes 944 | 945 | - **deps:** update dependency deepmerge to v4.1.0 ([c08847d](https://github.com/anchan828/typeorm-helpers/commit/c08847d)) 946 | 947 | ### Features 948 | 949 | - add EncryptTransformer ([aa12938](https://github.com/anchan828/typeorm-helpers/commit/aa12938)) 950 | 951 | ## [0.3.21](https://github.com/anchan828/typeorm-helpers/compare/v0.3.20...v0.3.21) (2019-10-06) 952 | 953 | **Note:** Version bump only for package @anchan828/typeorm-transformers 954 | 955 | ## [0.3.20](https://github.com/anchan828/typeorm-helpers/compare/v0.3.19...v0.3.20) (2019-09-29) 956 | 957 | **Note:** Version bump only for package @anchan828/typeorm-transformers 958 | 959 | ## [0.3.19](https://github.com/anchan828/typeorm-helpers/compare/v0.3.18...v0.3.19) (2019-09-22) 960 | 961 | **Note:** Version bump only for package @anchan828/typeorm-transformers 962 | 963 | ## [0.3.18](https://github.com/anchan828/typeorm-helpers/compare/v0.3.17...v0.3.18) (2019-09-15) 964 | 965 | **Note:** Version bump only for package @anchan828/typeorm-transformers 966 | 967 | ## [0.3.17](https://github.com/anchan828/typeorm-helpers/compare/v0.3.16...v0.3.17) (2019-09-08) 968 | 969 | **Note:** Version bump only for package @anchan828/typeorm-transformers 970 | 971 | ## [0.3.16](https://github.com/anchan828/typeorm-helpers/compare/v0.3.15...v0.3.16) (2019-09-01) 972 | 973 | **Note:** Version bump only for package @anchan828/typeorm-transformers 974 | 975 | ## [0.3.15](https://github.com/anchan828/typeorm-helpers/compare/v0.3.14...v0.3.15) (2019-08-25) 976 | 977 | **Note:** Version bump only for package @anchan828/typeorm-transformers 978 | 979 | ## [0.3.14](https://github.com/anchan828/typeorm-helpers/compare/v0.3.13...v0.3.14) (2019-08-18) 980 | 981 | **Note:** Version bump only for package @anchan828/typeorm-transformers 982 | -------------------------------------------------------------------------------- /packages/transformers/README.md: -------------------------------------------------------------------------------- 1 | # @anchan828/typeorm-transformers 2 | 3 | ![npm](https://img.shields.io/npm/v/@anchan828/typeorm-transformers.svg) 4 | ![NPM](https://img.shields.io/npm/l/@anchan828/typeorm-transformers.svg) 5 | 6 | ## Description 7 | 8 | Transformer collection for [TypeORM](http://typeorm.io) 9 | 10 | ## Installation 11 | 12 | ```bash 13 | $ npm i --save typeorm @anchan828/typeorm-transformers 14 | ``` 15 | 16 | ## Transformers 17 | 18 | ### BooleanTransformer 19 | 20 | Transform value between integer and boolean. 21 | 22 | ```ts 23 | @Entity() 24 | class BooleanTransformerTest extends BaseEntity { 25 | @PrimaryGeneratedColumn() 26 | public id!: number; 27 | 28 | @Column({ 29 | type: "tinyint", 30 | width: 1, 31 | nullable: true, 32 | transformer: new BooleanTransformer(), 33 | }) 34 | public bool!: boolean; 35 | } 36 | ``` 37 | 38 | ### JsonTransformer 39 | 40 | Transform value between object and json. 41 | 42 | Note: The JsonTransformer stores JSON as a string, not as a JSON type. 43 | 44 | ```ts 45 | class TestJson { 46 | name!: string; 47 | } 48 | @Entity() 49 | class JsonTransformerTest extends BaseEntity { 50 | @PrimaryGeneratedColumn() 51 | public id!: number; 52 | 53 | @Column({ 54 | type: "varchar", 55 | width: 255, 56 | nullable: true, 57 | transformer: new JsonTransformer({ name: "test" }), 58 | }) 59 | public data!: TestJson; 60 | } 61 | ``` 62 | 63 | ### StaticFileTransformer 64 | 65 | Transform value between data and filePath. 66 | 67 | ```ts 68 | @Entity() 69 | class StaticFileTransformerTest extends BaseEntity { 70 | @PrimaryGeneratedColumn() 71 | public id!: number; 72 | 73 | @Column({ 74 | transformer: new StaticFileTransformer({ dirname: tmpdir() }), 75 | type: "varchar", 76 | }) 77 | public file!: BinaryLike; 78 | } 79 | ``` 80 | 81 | ## License 82 | 83 | [MIT](LICENSE) 84 | -------------------------------------------------------------------------------- /packages/transformers/jest-e2e.config.js: -------------------------------------------------------------------------------- 1 | const base = require("../../jest.config.base"); 2 | module.exports = { 3 | ...base, 4 | coverageDirectory: "../e2e-coverage", 5 | testMatch: ["/*.spec-e2e.ts"], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/transformers/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require("../../jest.config.base"); 2 | module.exports = { 3 | ...base, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/transformers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@anchan828/typeorm-transformers", 3 | "version": "1.0.100", 4 | "description": "[TypeORM](https://github.com/typeorm/typeorm) transformers", 5 | "homepage": "https://github.com/anchan828/typeorm-helpers/tree/master/packages/transformers#readme", 6 | "bugs": { 7 | "url": "https://github.com/anchan828/typeorm-helpers/issues" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/anchan828/typeorm-helpers.git" 12 | }, 13 | "license": "MIT", 14 | "author": "anchan828 ", 15 | "main": "dist/index.js", 16 | "types": "dist/index.d.ts", 17 | "scripts": { 18 | "build": "tsc -p tsconfig.build.json", 19 | "copy:license": "cp ../../LICENSE ./", 20 | "lint": "TIMING=1 eslint --ignore-path ../../.eslintignore '**/*.ts'", 21 | "lint:fix": "npm run lint -- --fix", 22 | "prepublishOnly": "npm run build && rm -f dist/*.tsbuildinfo && npm run copy:license", 23 | "test": "jest --coverage", 24 | "test:e2e": "jest --coverage --runInBand --config=jest-e2e.config.js", 25 | "test:e2e:watch": "npm run test:e2e -- --watch", 26 | "test:watch": "npm run test -- --watch", 27 | "watch": "tsc --watch" 28 | }, 29 | "devDependencies": { 30 | "testing": "^1.0.100" 31 | }, 32 | "publishConfig": { 33 | "access": "public" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/transformers/src/boolean.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 2 | import { BaseEntity, Column, DataSource, Entity, PrimaryGeneratedColumn } from "typeorm"; 3 | import { BooleanTransformer } from "./boolean"; 4 | e2eDatabaseTypeSetUp("BooleanTransformer", (options) => { 5 | @Entity() 6 | class BooleanTransformerTest extends BaseEntity { 7 | @PrimaryGeneratedColumn() 8 | public id!: number; 9 | 10 | @Column({ 11 | nullable: true, 12 | transformer: new BooleanTransformer(), 13 | type: "int", 14 | width: 1, 15 | }) 16 | public bool!: boolean; 17 | } 18 | 19 | let dataSource: DataSource; 20 | 21 | e2eSetUp({ entities: [BooleanTransformerTest], ...options }, (source) => { 22 | dataSource = source; 23 | }); 24 | 25 | it("should return undefined", async () => { 26 | const test = await BooleanTransformerTest.create({}).save(); 27 | 28 | expect(await BooleanTransformerTest.findOneBy({ id: test.id })).toEqual({ 29 | bool: undefined, 30 | id: 1, 31 | }); 32 | }); 33 | it("should return true", async () => { 34 | const test = await BooleanTransformerTest.create({ 35 | bool: true, 36 | }).save(); 37 | 38 | expect(await BooleanTransformerTest.findOneBy({ id: test.id })).toEqual({ 39 | bool: true, 40 | id: 1, 41 | }); 42 | 43 | const rawQuery = await dataSource 44 | .createQueryBuilder(BooleanTransformerTest, "entity") 45 | .whereInIds(test.id) 46 | .getRawOne(); 47 | 48 | expect(rawQuery).toEqual({ entity_bool: 1, entity_id: 1 }); 49 | }); 50 | 51 | it("should return false", async () => { 52 | const test = await BooleanTransformerTest.create({ 53 | bool: false, 54 | }).save(); 55 | 56 | expect(await BooleanTransformerTest.findOneBy({ id: test.id })).toEqual({ 57 | bool: false, 58 | id: 1, 59 | }); 60 | 61 | const rawQuery = await dataSource 62 | .createQueryBuilder(BooleanTransformerTest, "entity") 63 | .whereInIds(test.id) 64 | .getRawOne(); 65 | 66 | expect(rawQuery).toEqual({ entity_bool: 0, entity_id: 1 }); 67 | }); 68 | }); 69 | -------------------------------------------------------------------------------- /packages/transformers/src/boolean.spec.ts: -------------------------------------------------------------------------------- 1 | import { BooleanTransformer } from "./boolean"; 2 | 3 | describe("BooleanTransformer", () => { 4 | const booleanTransformer = new BooleanTransformer(); 5 | 6 | it("should be defined", () => { 7 | expect(booleanTransformer).toBeDefined(); 8 | }); 9 | 10 | describe("from", () => { 11 | it("should return undefined", () => { 12 | expect(booleanTransformer.from(null)).toBeUndefined(); 13 | }); 14 | it("should return undefined", () => { 15 | expect(booleanTransformer.from(undefined)).toBeUndefined(); 16 | }); 17 | 18 | it("should return false", () => { 19 | expect(booleanTransformer.from(0)).toBeFalsy(); 20 | }); 21 | 22 | it("should return true", () => { 23 | expect(booleanTransformer.from(1)).toBeTruthy(); 24 | expect(booleanTransformer.from(10)).toBeTruthy(); 25 | }); 26 | }); 27 | 28 | describe("to", () => { 29 | it("should return undefined", () => { 30 | expect(booleanTransformer.to(null)).toBeUndefined(); 31 | }); 32 | it("should return undefined", () => { 33 | expect(booleanTransformer.to(undefined)).toBeUndefined(); 34 | }); 35 | 36 | it("should return false", () => { 37 | expect(booleanTransformer.to(false)).toBe(0); 38 | }); 39 | 40 | it("should return true", () => { 41 | expect(booleanTransformer.to(true)).toBe(1); 42 | }); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /packages/transformers/src/boolean.ts: -------------------------------------------------------------------------------- 1 | import { ValueTransformer } from "typeorm"; 2 | import { isNullOrUndefined } from "./utils"; 3 | 4 | /** 5 | * Transform value between integer and boolean. 6 | */ 7 | export class BooleanTransformer implements ValueTransformer { 8 | public from(value?: number | null): boolean | undefined { 9 | if (isNullOrUndefined(value)) { 10 | return; 11 | } 12 | return value ? true : false; 13 | } 14 | 15 | public to(value?: boolean | null): number | undefined { 16 | if (isNullOrUndefined(value)) { 17 | return; 18 | } 19 | return value ? 1 : 0; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/transformers/src/encrypt.spec.ts: -------------------------------------------------------------------------------- 1 | import { EncryptTransformer } from "./encrypt"; 2 | 3 | describe("EncryptTransformer", () => { 4 | const encryptTransformer = new EncryptTransformer({ 5 | key: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", 6 | }); 7 | 8 | it("should be defined", () => { 9 | expect(encryptTransformer).toBeDefined(); 10 | }); 11 | 12 | describe("to", () => { 13 | it("should return undefined", () => { 14 | expect(encryptTransformer.to(null)).toBeUndefined(); 15 | }); 16 | it("should return undefined", () => { 17 | expect(encryptTransformer.to(undefined)).toBeUndefined(); 18 | }); 19 | 20 | it("should return encrypted data", () => { 21 | expect(encryptTransformer.to("test")).toEqual(expect.any(String)); 22 | }); 23 | }); 24 | 25 | describe("from", () => { 26 | it("should return undefined", () => { 27 | expect(encryptTransformer.from(null)).toBeUndefined(); 28 | }); 29 | it("should return undefined", () => { 30 | expect(encryptTransformer.from(undefined)).toBeUndefined(); 31 | }); 32 | 33 | it("should return decrypted data", () => { 34 | expect(encryptTransformer.from("h5Tg0GlO/724pWGcXNGdDiXEICWJnGeHsr9pfpFOgs8=")).toBe("test"); 35 | }); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /packages/transformers/src/encrypt.ts: -------------------------------------------------------------------------------- 1 | import { createCipheriv, createDecipheriv, randomBytes } from "crypto"; 2 | import { ValueTransformer } from "typeorm"; 3 | import { isNullOrUndefined } from "./utils"; 4 | export interface EncryptTransformerOptions { 5 | /** 6 | * The algorithm is dependent on the available algorithms supported by the version of OpenSSL on the platform. 7 | */ 8 | algorithm?: string; 9 | 10 | /** 11 | * iv length 12 | */ 13 | ivLength?: number; 14 | 15 | /** 16 | * The key is the key used to generate the encrypt value. 17 | */ 18 | key: string; 19 | } 20 | 21 | /** 22 | * Transform value to encrypt value by crypto.createDecipheriv 23 | */ 24 | export class EncryptTransformer implements ValueTransformer { 25 | constructor(private options: EncryptTransformerOptions) { 26 | this.options = { algorithm: "aes-256-cbc", ivLength: 16, ...options }; 27 | } 28 | 29 | public from(value?: string | null): string | undefined { 30 | if (isNullOrUndefined(value)) { 31 | return; 32 | } 33 | const { algorithm, key, ivLength } = this.options as Required; 34 | const data = Buffer.from(value, "base64"); 35 | const iv = data.slice(0, ivLength); 36 | const decipher = createDecipheriv(algorithm, Buffer.from(key, "hex"), iv); 37 | const start = decipher.update(data.slice(ivLength)); 38 | const final = decipher.final(); 39 | return Buffer.concat([start, final]).toString("utf8"); 40 | } 41 | 42 | public to(value?: string | null): string | undefined { 43 | if (isNullOrUndefined(value)) { 44 | return; 45 | } 46 | 47 | const { algorithm, key, ivLength } = this.options as Required; 48 | const iv = randomBytes(ivLength); 49 | const cipher = createCipheriv(algorithm, Buffer.from(key, "hex"), iv); 50 | const start = cipher.update(value); 51 | const end = cipher.final(); 52 | return Buffer.concat([iv, start, end]).toString("base64"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /packages/transformers/src/hmac.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 2 | import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm"; 3 | import { HmacTransformer } from "./hmac"; 4 | e2eDatabaseTypeSetUp("HmacTransformer", (options) => { 5 | @Entity() 6 | class HmacTransformerTest extends BaseEntity { 7 | @PrimaryGeneratedColumn() 8 | public id!: number; 9 | 10 | @Column({ 11 | nullable: true, 12 | transformer: new HmacTransformer(), 13 | type: "varchar", 14 | }) 15 | public password!: string; 16 | 17 | @Column({ 18 | nullable: true, 19 | transformer: new HmacTransformer({ algorithm: "sha512", key: "key" }), 20 | type: "varchar", 21 | }) 22 | public password2!: string; 23 | } 24 | e2eSetUp({ entities: [HmacTransformerTest], ...options }); 25 | it("should return undefined", async () => { 26 | const test = await HmacTransformerTest.create({}).save(); 27 | 28 | expect(await HmacTransformerTest.findOneBy({ id: test.id })).toEqual({ 29 | password: undefined, 30 | id: 1, 31 | }); 32 | }); 33 | it("should return hash", async () => { 34 | const test = await HmacTransformerTest.create({ 35 | password: "test", 36 | password2: "test", 37 | }).save(); 38 | 39 | expect(await HmacTransformerTest.findOneBy({ id: test.id })).toEqual({ 40 | password: "88cd2108b5347d973cf39cdf9053d7dd42704876d8c9a9bd8e2d168259d3ddf7", 41 | password2: 42 | "287a0fb89a7fbdfa5b5538636918e537a5b83065e4ff331268b7aaa115dde047a9b0f4fb5b828608fc0b6327f10055f7637b058e9e0dbb9e698901a3e6dd461c", 43 | id: 1, 44 | }); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /packages/transformers/src/hmac.spec.ts: -------------------------------------------------------------------------------- 1 | import { HmacTransformer } from "./hmac"; 2 | 3 | describe("HmacTransformer", () => { 4 | const hmacTransformer = new HmacTransformer(); 5 | 6 | it("should be defined", () => { 7 | expect(hmacTransformer).toBeDefined(); 8 | }); 9 | 10 | describe("to", () => { 11 | it("should return undefined", () => { 12 | expect(hmacTransformer.to(null)).toBeUndefined(); 13 | }); 14 | it("should return undefined", () => { 15 | expect(hmacTransformer.to(undefined)).toBeUndefined(); 16 | }); 17 | 18 | it("should return hash", () => { 19 | expect(hmacTransformer.to("test")).toBe("88cd2108b5347d973cf39cdf9053d7dd42704876d8c9a9bd8e2d168259d3ddf7"); 20 | }); 21 | 22 | it("should return hash by key", () => { 23 | expect(new HmacTransformer({ key: "key" }).to("test")).toBe( 24 | "02afb56304902c656fcb737cdd03de6205bb6d401da2812efd9b2d36a08af159", 25 | ); 26 | }); 27 | }); 28 | 29 | describe("from", () => { 30 | it("should return undefined", () => { 31 | expect(hmacTransformer.from(null)).toBeUndefined(); 32 | }); 33 | it("should return undefined", () => { 34 | expect(hmacTransformer.from(undefined)).toBeUndefined(); 35 | }); 36 | 37 | it("should return same value", () => { 38 | expect(hmacTransformer.from("test")).toBe("test"); 39 | }); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /packages/transformers/src/hmac.ts: -------------------------------------------------------------------------------- 1 | import { BinaryLike, createHmac } from "crypto"; 2 | import { ValueTransformer } from "typeorm"; 3 | import { isNullOrUndefined } from "./utils"; 4 | export interface HmacTransformerOptions { 5 | /** 6 | * The algorithm is dependent on the available algorithms supported by the version of OpenSSL on the platform. 7 | */ 8 | algorithm?: string; 9 | 10 | /** 11 | * The key is the HMAC key used to generate the cryptographic HMAC hash. If it is undefined, use value argument. 12 | */ 13 | key?: BinaryLike; 14 | } 15 | /** 16 | * Transform value to hashed value by crypto.createHmac 17 | */ 18 | export class HmacTransformer implements ValueTransformer { 19 | private transformerOptions: Pick & Required>; 20 | 21 | constructor(private options?: HmacTransformerOptions) { 22 | this.transformerOptions = { algorithm: "sha256", ...options }; 23 | } 24 | public from(value?: string | null): string | undefined { 25 | if (isNullOrUndefined(value)) { 26 | return; 27 | } 28 | 29 | return value; 30 | } 31 | 32 | public to(value?: string | null): string | undefined { 33 | if (isNullOrUndefined(value)) { 34 | return; 35 | } 36 | 37 | const { algorithm, key } = this.transformerOptions; 38 | return createHmac(algorithm, key ? key : value) 39 | .update(value) 40 | .digest("hex"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/transformers/src/index.ts: -------------------------------------------------------------------------------- 1 | export { BooleanTransformer } from "./boolean"; 2 | export { EncryptTransformer, EncryptTransformerOptions } from "./encrypt"; 3 | export { HmacTransformer, HmacTransformerOptions } from "./hmac"; 4 | export { JsonTransformer } from "./json"; 5 | export { StaticFileTransformer, StaticFileTransformerOptions } from "./static-file"; 6 | export { NullToUndefinedTransformer } from "./null-to-undefined"; 7 | -------------------------------------------------------------------------------- /packages/transformers/src/json.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 2 | import { BaseEntity, Column, DataSource, Entity, PrimaryGeneratedColumn } from "typeorm"; 3 | import { JsonTransformer } from "./json"; 4 | e2eDatabaseTypeSetUp("JsonTransformer", (options) => { 5 | class TestJson { 6 | public name!: string; 7 | } 8 | 9 | @Entity() 10 | class JsonTransformerTest extends BaseEntity { 11 | @PrimaryGeneratedColumn() 12 | public id!: number; 13 | 14 | @Column({ 15 | nullable: true, 16 | transformer: new JsonTransformer({ name: "test" }), 17 | type: "varchar", 18 | width: 255, 19 | }) 20 | public data!: TestJson; 21 | } 22 | 23 | @Entity() 24 | class NoDefaultValueTest extends BaseEntity { 25 | @PrimaryGeneratedColumn() 26 | public id!: number; 27 | 28 | @Column({ 29 | nullable: true, 30 | transformer: new JsonTransformer(), 31 | type: "varchar", 32 | width: 255, 33 | }) 34 | public data!: TestJson; 35 | } 36 | 37 | let dataSource: DataSource; 38 | 39 | e2eSetUp({ entities: [JsonTransformerTest, NoDefaultValueTest], ...options }, (source) => { 40 | dataSource = source; 41 | }); 42 | 43 | it("should return undefined", async () => { 44 | const test = await NoDefaultValueTest.create({}).save(); 45 | 46 | expect(await NoDefaultValueTest.findOneBy({ id: test.id })).toEqual({ 47 | data: undefined, 48 | id: 1, 49 | }); 50 | }); 51 | 52 | it("should return defaultValue", async () => { 53 | const test = await JsonTransformerTest.create().save(); 54 | 55 | expect(await JsonTransformerTest.findOneBy({ id: test.id })).toEqual({ 56 | data: { 57 | name: "test", 58 | }, 59 | id: test.id, 60 | }); 61 | 62 | const rawQuery = await dataSource.createQueryBuilder(JsonTransformerTest, "entity").whereInIds(test.id).getRawOne(); 63 | 64 | expect(rawQuery).toEqual({ 65 | entity_data: JSON.stringify({ name: "test" }), 66 | entity_id: 1, 67 | }); 68 | }); 69 | 70 | it("should return defaultValue", async () => { 71 | await JsonTransformerTest.create({ 72 | data: "{" as any, 73 | }).save(); 74 | 75 | expect(await JsonTransformerTest.findOneBy({ id: 1 })).toEqual({ 76 | data: { 77 | name: "test", 78 | }, 79 | id: 1, 80 | }); 81 | }); 82 | }); 83 | -------------------------------------------------------------------------------- /packages/transformers/src/json.spec.ts: -------------------------------------------------------------------------------- 1 | import { JsonTransformer } from "./json"; 2 | 3 | describe("JsonTransformer", () => { 4 | const jsonTransformer = new JsonTransformer({ test: "defaultValue" }); 5 | 6 | it("should be defined", () => { 7 | expect(jsonTransformer).toBeDefined(); 8 | }); 9 | 10 | describe("from", () => { 11 | it("should return undefined", () => { 12 | expect(new JsonTransformer().from(null)).toBeUndefined(); 13 | expect(new JsonTransformer().from(undefined)).toBeUndefined(); 14 | }); 15 | it("should return defaultValue", () => { 16 | expect(jsonTransformer.from(null)).toStrictEqual({ 17 | test: "defaultValue", 18 | }); 19 | expect(jsonTransformer.from(undefined)).toStrictEqual({ 20 | test: "defaultValue", 21 | }); 22 | }); 23 | 24 | it("should return object", () => { 25 | expect(jsonTransformer.from(JSON.stringify({ test: "test" }))).toStrictEqual({ 26 | test: "test", 27 | }); 28 | }); 29 | 30 | it("should return defaultValue", () => { 31 | expect(jsonTransformer.from("invalid")).toStrictEqual({ 32 | test: "defaultValue", 33 | }); 34 | }); 35 | }); 36 | 37 | describe("to", () => { 38 | it("should return undefined", () => { 39 | expect(new JsonTransformer().to(null)).toBeUndefined(); 40 | }); 41 | it("should return undefined", () => { 42 | expect(new JsonTransformer().to(undefined)).toBeUndefined(); 43 | }); 44 | it("should return defaultValue", () => { 45 | expect(jsonTransformer.to(null)).toStrictEqual( 46 | JSON.stringify({ 47 | test: "defaultValue", 48 | }), 49 | ); 50 | expect(jsonTransformer.to(undefined)).toStrictEqual( 51 | JSON.stringify({ 52 | test: "defaultValue", 53 | }), 54 | ); 55 | }); 56 | 57 | it("should return json", () => { 58 | const transformer = new JsonTransformer(); 59 | const date = new Date(); 60 | expect(transformer.from(transformer.to({ test: "test", date }))).toStrictEqual({ test: "test", date }); 61 | }); 62 | }); 63 | }); 64 | -------------------------------------------------------------------------------- /packages/transformers/src/json.ts: -------------------------------------------------------------------------------- 1 | import { ValueTransformer } from "typeorm"; 2 | import { isNullOrUndefined } from "./utils"; 3 | 4 | /** 5 | * parse json string to javascript object. 6 | * JSON.parse has receiver for Date.parse. 7 | */ 8 | export const parseJSON = (json: string): T | undefined => { 9 | return JSON.parse(json, (_: string, value: any): any => { 10 | if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(value)) { 11 | const date = Date.parse(value); 12 | if (!isNaN(date)) { 13 | return new Date(date); 14 | } 15 | } 16 | return value; 17 | }); 18 | }; 19 | 20 | /** 21 | * Transform value between object and json. 22 | */ 23 | export class JsonTransformer implements ValueTransformer { 24 | constructor(private readonly defaultValue?: T) {} 25 | 26 | public from(value?: string | null): T | undefined { 27 | if (isNullOrUndefined(value)) { 28 | return this.defaultValue; 29 | } 30 | 31 | try { 32 | return parseJSON(value); 33 | } catch (e: any) { 34 | return this.defaultValue; 35 | } 36 | } 37 | 38 | public to(value?: T | null): string | undefined { 39 | if (isNullOrUndefined(value)) { 40 | value = this.defaultValue; 41 | } 42 | 43 | if (isNullOrUndefined(value)) { 44 | return; 45 | } 46 | 47 | if (typeof value === "string") { 48 | value = this.defaultValue; 49 | } 50 | 51 | return JSON.stringify(value); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /packages/transformers/src/null-to-undefined.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 2 | import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm"; 3 | import { NullToUndefinedTransformer } from "./null-to-undefined"; 4 | e2eDatabaseTypeSetUp("NullToUndefinedTransformer", (options) => { 5 | @Entity() 6 | class NullToUndefinedTransformerTest extends BaseEntity { 7 | @PrimaryGeneratedColumn() 8 | public id!: number; 9 | 10 | @Column({ 11 | nullable: true, 12 | transformer: new NullToUndefinedTransformer(), 13 | type: "varchar", 14 | }) 15 | public test?: string; 16 | } 17 | 18 | e2eSetUp({ entities: [NullToUndefinedTransformerTest], ...options }); 19 | 20 | it("should return undefined", async () => { 21 | const test = await NullToUndefinedTransformerTest.create({}).save(); 22 | 23 | expect(await NullToUndefinedTransformerTest.findOneBy({ id: test.id })).toEqual({ 24 | test: undefined, 25 | id: 1, 26 | }); 27 | }); 28 | 29 | it("should return string", async () => { 30 | const test = await NullToUndefinedTransformerTest.create({ 31 | test: "test", 32 | }).save(); 33 | 34 | expect(await NullToUndefinedTransformerTest.findOneBy({ id: test.id })).toEqual({ test: "test", id: 1 }); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /packages/transformers/src/null-to-undefined.spec.ts: -------------------------------------------------------------------------------- 1 | import { NullToUndefinedTransformer } from "./null-to-undefined"; 2 | 3 | describe("NullToUndefinedTransformer", () => { 4 | const undefinedTransformer = new NullToUndefinedTransformer(); 5 | 6 | it("should be defined", () => { 7 | expect(undefinedTransformer).toBeDefined(); 8 | }); 9 | 10 | describe("from", () => { 11 | it("should return undefined", () => { 12 | expect(undefinedTransformer.from(null)).toBeUndefined(); 13 | }); 14 | it("should return undefined", () => { 15 | expect(undefinedTransformer.from(undefined)).toBeUndefined(); 16 | }); 17 | 18 | it("should return 0", () => { 19 | expect(undefinedTransformer.from(0)).toEqual(0); 20 | }); 21 | 22 | it("should return string", () => { 23 | expect(undefinedTransformer.from("test")).toEqual("test"); 24 | }); 25 | 26 | it("should return true", () => { 27 | expect(undefinedTransformer.from(true)).toBeTruthy(); 28 | }); 29 | }); 30 | 31 | describe("to", () => { 32 | it("should return null", () => { 33 | expect(undefinedTransformer.to(null)).toBeNull(); 34 | }); 35 | it("should return undefined", () => { 36 | expect(undefinedTransformer.to(undefined)).toBeUndefined(); 37 | }); 38 | 39 | it("should return false", () => { 40 | expect(undefinedTransformer.to(false)).toBeFalsy(); 41 | }); 42 | 43 | it("should return true", () => { 44 | expect(undefinedTransformer.to(true)).toBeTruthy(); 45 | }); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /packages/transformers/src/null-to-undefined.ts: -------------------------------------------------------------------------------- 1 | import { ValueTransformer } from "typeorm"; 2 | import { isNullOrUndefined } from "./utils"; 3 | 4 | /** 5 | * Transform converts null to undefined. 6 | */ 7 | export class NullToUndefinedTransformer implements ValueTransformer { 8 | public from(value?: any | null): any | undefined { 9 | if (isNullOrUndefined(value)) { 10 | return undefined; 11 | } 12 | return value; 13 | } 14 | 15 | public to(value?: any | null): any | undefined { 16 | return value; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/transformers/src/static-file.spec-e2e.ts: -------------------------------------------------------------------------------- 1 | import { BinaryLike } from "crypto"; 2 | import { readFileSync } from "fs"; 3 | import { tmpdir } from "os"; 4 | import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; 5 | import { BaseEntity, Column, DataSource, Entity, PrimaryGeneratedColumn } from "typeorm"; 6 | import { StaticFileTransformer } from "./static-file"; 7 | 8 | e2eDatabaseTypeSetUp("StaticFileTransformer", (options) => { 9 | const transformer = new StaticFileTransformer({ dirname: tmpdir() }); 10 | @Entity() 11 | class StaticFileTransformerTest extends BaseEntity { 12 | @PrimaryGeneratedColumn() 13 | public id!: number; 14 | 15 | @Column({ 16 | transformer, 17 | type: "varchar", 18 | }) 19 | public file!: BinaryLike; 20 | } 21 | 22 | let dataSource: DataSource; 23 | 24 | e2eSetUp({ entities: [StaticFileTransformerTest], ...options }, (source) => { 25 | dataSource = source; 26 | }); 27 | 28 | it("should store text", async () => { 29 | const test = await StaticFileTransformerTest.create({ 30 | file: "test", 31 | }).save(); 32 | expect(test.file).toBe("test"); 33 | 34 | const rawQuery = await dataSource 35 | .createQueryBuilder(StaticFileTransformerTest, "entity") 36 | .whereInIds(test.id) 37 | .getRawOne(); 38 | expect(rawQuery.entity_file.startsWith(tmpdir())).toBeTruthy(); 39 | }); 40 | 41 | it("should store image", async () => { 42 | const test = await StaticFileTransformerTest.create({ 43 | file: readFileSync("test-files/image.png"), 44 | }).save(); 45 | expect(test.file).toEqual(readFileSync("test-files/image.png")); 46 | 47 | const rawQuery = await dataSource 48 | .createQueryBuilder(StaticFileTransformerTest, "entity") 49 | .whereInIds(test.id) 50 | .getRawOne(); 51 | expect(rawQuery.entity_file.startsWith(tmpdir())).toBeTruthy(); 52 | }); 53 | 54 | it("should not called when not select static file column", async () => { 55 | await StaticFileTransformerTest.create({ 56 | file: readFileSync("test-files/image.png"), 57 | }).save(); 58 | const mock = jest.spyOn(transformer, "from").mockReturnValueOnce(undefined); 59 | await StaticFileTransformerTest.createQueryBuilder("test").getOne(); 60 | expect(mock).toBeCalled(); 61 | mock.mockReset(); 62 | 63 | await StaticFileTransformerTest.createQueryBuilder("test").select("test.id").getOne(); 64 | expect(mock).not.toBeCalled(); 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /packages/transformers/src/static-file.spec.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-non-null-assertion */ 2 | import { readFileSync } from "fs"; 3 | import { tmpdir } from "os"; 4 | import { join } from "path"; 5 | import { StaticFileTransformer } from "./static-file"; 6 | describe("StaticFileTransformer", () => { 7 | it("should throw error when dirname is undefined", () => { 8 | expect(() => { 9 | return new StaticFileTransformer({ 10 | dirname: undefined as any, 11 | }); 12 | }).toThrowError("Required dirname path or dirname function"); 13 | }); 14 | 15 | it("should create instance", () => { 16 | expect( 17 | new StaticFileTransformer({ 18 | dirname: tmpdir(), 19 | filename: "test", 20 | }), 21 | ).toBeDefined(); 22 | 23 | expect( 24 | new StaticFileTransformer({ 25 | dirname: tmpdir(), 26 | filename: (filename: string): string => filename, 27 | }), 28 | ).toBeDefined(); 29 | }); 30 | 31 | describe("from", () => { 32 | const createFilePath = (value: string): string | undefined => { 33 | return new StaticFileTransformer({ 34 | dirname: tmpdir(), 35 | }).to(value); 36 | }; 37 | 38 | it("should return undefined", () => { 39 | expect( 40 | new StaticFileTransformer({ 41 | dirname: tmpdir(), 42 | }).from(undefined), 43 | ).toBeUndefined(); 44 | }); 45 | 46 | it("should return text", () => { 47 | expect( 48 | new StaticFileTransformer({ 49 | dirname: tmpdir(), 50 | encoding: "utf8", 51 | }).from(createFilePath("text")), 52 | ).toBe("text"); 53 | }); 54 | 55 | it("should return filePath when writeOnly is true", () => { 56 | const filePath = createFilePath("text"); 57 | expect( 58 | new StaticFileTransformer({ 59 | dirname: tmpdir(), 60 | writeOnly: true, 61 | }).from(filePath), 62 | ).toBe(filePath); 63 | }); 64 | 65 | it("should throw error when filePath not under dirname", () => { 66 | const filePath = createFilePath("text"); 67 | expect(() => { 68 | new StaticFileTransformer({ 69 | dirname: `${tmpdir()}/hoge/`, 70 | }).from(filePath); 71 | }).toThrowError(`${tmpdir()}/372ea08cab33e71c02c651dbc83a474d32c676ea is not under the directory.`); 72 | }); 73 | 74 | it("should throw error when filePath not exists", () => { 75 | const filePath = createFilePath("text"); 76 | expect(() => { 77 | new StaticFileTransformer({ 78 | dirname: `${tmpdir()}`, 79 | }).from(`${filePath}a`); 80 | }).toThrowError(`${filePath}a not found.`); 81 | }); 82 | }); 83 | 84 | describe("to", () => { 85 | it("should return filePath", () => { 86 | const dirname = tmpdir(); 87 | const transformer = new StaticFileTransformer({ 88 | dirname, 89 | }); 90 | expect(transformer.to(undefined)).toBeUndefined(); 91 | }); 92 | it("should return filePath", () => { 93 | const dirname = tmpdir(); 94 | const transformer = new StaticFileTransformer({ 95 | dirname, 96 | }); 97 | const filePath = transformer.to("test"); 98 | expect(filePath).toBeDefined(); 99 | expect(filePath!.startsWith(dirname)).toBeTruthy(); 100 | expect(filePath).toBe(join(dirname, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3")); 101 | }); 102 | 103 | it("should return filePath with txt extension", () => { 104 | const dirname = tmpdir(); 105 | const transformer = new StaticFileTransformer({ 106 | dirname, 107 | filename: (filename: string): string => `${filename}.txt`, 108 | }); 109 | const filePath = transformer.to("test")!; 110 | expect(filePath.startsWith(dirname)).toBeTruthy(); 111 | expect(filePath).toBe(join(dirname, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3.txt")); 112 | }); 113 | 114 | it("should return same filePath", () => { 115 | const dirname = tmpdir(); 116 | const transformer = new StaticFileTransformer({ 117 | dirname, 118 | filename: `test.txt`, 119 | }); 120 | const filePath1 = transformer.to("A")!; 121 | const filePath2 = transformer.to("B")!; 122 | expect(filePath1).toBe(filePath2); 123 | expect(filePath1).toBe(join(dirname, "test.txt")); 124 | }); 125 | 126 | it("should create sub directory", () => { 127 | const dirname = tmpdir(); 128 | const transformer = new StaticFileTransformer({ 129 | dirname, 130 | filename: (filename: string): string => `sub/${filename}`, 131 | }); 132 | expect(transformer.to("test")).toBe(join(dirname, "sub/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3")); 133 | }); 134 | 135 | it("should create new filePath when pass wrong one", () => { 136 | const dirname = tmpdir(); 137 | const transformer = new StaticFileTransformer({ 138 | dirname, 139 | }); 140 | expect(transformer.to(`/path/to/text.txt`)).toBe(join(dirname, "de4ef8b5be48a7fe65ace20f202dcf1db27ab6ed")); 141 | }); 142 | 143 | it("should return filePath when pass one", () => { 144 | const dirname = tmpdir(); 145 | const transformer = new StaticFileTransformer({ 146 | dirname, 147 | }); 148 | expect(transformer.to(join(dirname, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"))).toBe( 149 | join(dirname, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"), 150 | ); 151 | }); 152 | }); 153 | 154 | describe("image test", () => { 155 | it("should return buffer", () => { 156 | const transformer = new StaticFileTransformer({ 157 | dirname: tmpdir(), 158 | filename: (filename: string): string => `${filename}.png`, 159 | }); 160 | const buffer = readFileSync("test-files/image.png"); 161 | const filePath = transformer.to(buffer); 162 | expect(filePath).toBe(join(tmpdir(), "83a0d2a74f0352bed191dbf96fb20b7591c744e3.png")); 163 | expect(buffer).toEqual(transformer.from(filePath)); 164 | }); 165 | 166 | it("should return base64", () => { 167 | const transformer = new StaticFileTransformer({ 168 | dirname: tmpdir(), 169 | encoding: "base64", 170 | filename: (filename: string): string => `${filename}.png`, 171 | }); 172 | const base64 = readFileSync("test-files/image.png", "base64"); 173 | const filePath = transformer.to(readFileSync("test-files/image.png")); 174 | expect(filePath).toBe(join(tmpdir(), "83a0d2a74f0352bed191dbf96fb20b7591c744e3.png")); 175 | expect(base64).toEqual(transformer.from(filePath)); 176 | }); 177 | }); 178 | }); 179 | -------------------------------------------------------------------------------- /packages/transformers/src/static-file.ts: -------------------------------------------------------------------------------- 1 | import { BinaryLike, createHash } from "crypto"; 2 | import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs"; 3 | import { dirname, join } from "path"; 4 | import { ValueTransformer } from "typeorm"; 5 | 6 | type FilenameFunction = (filename: string) => string; 7 | 8 | export interface StaticFileTransformerOptions { 9 | /** 10 | * Overwrite filename. 11 | */ 12 | filename?: string | FilenameFunction; 13 | 14 | dirname: string; 15 | 16 | /** 17 | * Don't read data from file path. (Default: false) 18 | * Returns filePath when writeOnly is true. 19 | * Returns file data when writeOnly is false. 20 | */ 21 | writeOnly?: boolean; 22 | 23 | encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"; 24 | } 25 | 26 | /** 27 | * Write/Read buffer/string/base64 file data 28 | */ 29 | export class StaticFileTransformer implements ValueTransformer { 30 | constructor(private options: Readonly) { 31 | if (!options.dirname) { 32 | throw new Error("Required dirname path or dirname function"); 33 | } 34 | } 35 | public from(value?: string | null): BinaryLike | undefined { 36 | if (!value) { 37 | return; 38 | } 39 | if (value.startsWith(this.options.dirname)) { 40 | if (this.options.writeOnly) { 41 | return value; 42 | } 43 | } else { 44 | throw new Error(`${value} is not under the directory.`); 45 | } 46 | 47 | if (!existsSync(value)) { 48 | throw new Error(`${value} not found.`); 49 | } 50 | 51 | return readFileSync(value, this.options.encoding); 52 | } 53 | public to(value?: BinaryLike | null): string | undefined { 54 | if (!value) { 55 | return; 56 | } 57 | 58 | if (typeof value === "string" && value.startsWith(this.options.dirname)) { 59 | return value; 60 | } 61 | 62 | let filename = this.createSHA1(value); 63 | 64 | if (this.options.filename) { 65 | if (typeof this.options.filename === "string") { 66 | filename = this.options.filename; 67 | } else if (typeof this.options.filename === "function") { 68 | filename = this.options.filename(filename); 69 | } 70 | } 71 | 72 | const filePath = join(this.options.dirname, filename); 73 | mkdirSync(dirname(filePath), { recursive: true }); 74 | writeFileSync(filePath, value, this.options.encoding); 75 | 76 | return filePath; 77 | } 78 | 79 | private createSHA1(value: BinaryLike): string { 80 | const shasum = createHash("sha1"); 81 | return shasum.update(value).digest("hex"); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /packages/transformers/src/utils.ts: -------------------------------------------------------------------------------- 1 | export function isNullOrUndefined(obj: T | null | undefined): obj is null | undefined { 2 | return typeof obj === "undefined" || obj === null; 3 | } 4 | -------------------------------------------------------------------------------- /packages/transformers/test-files/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anchan828/typeorm-helpers/e25442bffb615e205db9d7f9c03cc7225e751b65/packages/transformers/test-files/image.png -------------------------------------------------------------------------------- /packages/transformers/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "**/*spec.ts", "**/*spec-e2e.ts", "dist", "src/test-utils.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/transformers/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "baseUrl": "./", 6 | "declarationMap": true 7 | }, 8 | "exclude": ["node_modules", "dist", "scripts", "src/test-utils.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["github>anchan828/renovate-config"] 3 | } 4 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": false, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2021", 9 | "sourceMap": true, 10 | "strict": true, 11 | "incremental": true, 12 | "skipLibCheck": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { "allowJs": true }, 4 | "include": ["packages/*/src/**/*.ts", "scripts/**/*.ts"], 5 | "exclude": ["node_modules", "dist"] 6 | } 7 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "pipeline": { 4 | "build": { 5 | "dependsOn": ["^build"], 6 | "outputs": ["dist/**"] 7 | }, 8 | "lint": { 9 | "outputs": [] 10 | }, 11 | "lint:fix": { 12 | "outputs": [] 13 | }, 14 | "watch": { 15 | "outputs": [] 16 | }, 17 | "test": { 18 | "dependsOn": ["^build"], 19 | "outputs": ["coverage/**"] 20 | }, 21 | "test:e2e": { 22 | "dependsOn": ["^build"], 23 | "outputs": ["e2e-coverage/**"] 24 | } 25 | } 26 | } 27 | --------------------------------------------------------------------------------