Skip to content

Commit

Permalink
fix(sequelize): remove default export of sequelize repository (#136)
Browse files Browse the repository at this point in the history
and add directory import syntax when using sequelize

GH-135
  • Loading branch information
shubhamp-sf authored Mar 1, 2023
1 parent d32dc71 commit d81d7fe
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sonar.sources=src

# Ignoring transaction and sequelize soft crud repository as the duplication of the code is a compulsion in it.
# These will be removed in a next major release in favor of universal mixin usage.
sonar.exclusions=src/__tests__/**,src/repositories/default-transaction-soft-crud.repository.base.ts,src/repositories/sequelize.soft-crud.repository.base.ts
sonar.exclusions=src/__tests__/**,src/repositories/default-transaction-soft-crud.repository.base.ts,src/repositories/sequelize/sequelize.soft-crud.repository.base.ts
#sonar.inclusions=

# Path to tests
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If not, then please add these columns to the DB table.
### SequelizeSoftCrudRepository

An abstract base class providing soft delete capabilities for projects using [loopback4-sequelize](https://www.npmjs.com/package/loopback4-sequelize) package.
All the other workings are similar to [SoftCrudRepository](#softcrudrepository).
All the other workings are similar to [SoftCrudRepository](#softcrudrepository). except it's imported using directory import syntax from `loopback4-soft-delete/sequelize`.

### SoftCrudRepository

Expand Down
1 change: 0 additions & 1 deletion index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion index.js

This file was deleted.

1 change: 0 additions & 1 deletion index.ts

This file was deleted.

47 changes: 18 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,24 @@
"loopback-extension",
"loopback"
],
"main": "index.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": "./dist/index.js",
"./sequelize": {
"types": "./dist/repositories/sequelize/index.d.ts",
"default": "./dist/repositories/sequelize/index.js"
}
},
"typesVersions": {
"*": {
"sequelize": [
"./dist/repositories/sequelize/index.d.ts"
]
}
},
"engines": {
"node": ">=8.9"
"node": ">=14"
},
"scripts": {
"build": "npm run clean && lb-tsc",
Expand Down Expand Up @@ -86,6 +101,7 @@
"husky": "^7.0.4",
"jsdom": "^21.0.0",
"loopback-datasource-juggler": "^4.28.1",
"loopback4-sequelize": "^2.1.0",
"minimist": ">=1.2.6",
"semantic-release": "^19.0.3",
"simple-git": "^3.15.1",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/unit/sequelize/sequelize-soft-crud.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {fail} from 'assert';
import {SoftDeleteEntity} from '../../../models';
import {IUser} from '../../../types';
import {SequelizeDataSource} from 'loopback4-sequelize';
import {SequelizeSoftCrudRepository} from '../../../repositories/sequelize.soft-crud.repository.base';
import {SequelizeSoftCrudRepository} from '../../../repositories/sequelize/sequelize.soft-crud.repository.base';

/**
* A mock up model class
Expand Down
1 change: 0 additions & 1 deletion src/repositories/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './soft-crud.repository.base';
export * from './sequelize.soft-crud.repository.base';
export * from './default-transaction-soft-crud.repository.base';
1 change: 1 addition & 0 deletions src/repositories/sequelize/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './sequelize.soft-crud.repository.base';
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
SequelizeDataSource,
} from 'loopback4-sequelize';

import {ErrorKeys} from '../error-keys';
import {SoftDeleteEntity} from '../models';
import {IUser} from '../types';
import {SoftFilterBuilder} from '../utils/soft-filter-builder';
import {ErrorKeys} from '../../error-keys';
import {SoftDeleteEntity} from '../../models';
import {IUser} from '../../types';
import {SoftFilterBuilder} from '../../utils/soft-filter-builder';

export abstract class SequelizeSoftCrudRepository<
E extends SoftDeleteEntity,
Expand Down

0 comments on commit d81d7fe

Please sign in to comment.