@jorgebodega/typeorm-seeding 4.0.0-next.1 → 4.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -23
- package/README.md +1 -1
- package/dist/commands/seed.command.js.map +1 -1
- package/dist/factory.d.ts +10 -13
- package/dist/factory.js +42 -36
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/instanceAttribute.d.ts +3 -0
- package/dist/instanceAttribute.js +8 -0
- package/dist/instanceAttribute.js.map +1 -0
- package/dist/lazyAttribute.d.ts +6 -0
- package/dist/lazyAttribute.js +13 -0
- package/dist/lazyAttribute.js.map +1 -0
- package/dist/lazyInstanceAttribute.d.ts +3 -0
- package/dist/lazyInstanceAttribute.js +8 -0
- package/dist/lazyInstanceAttribute.js.map +1 -0
- package/dist/seeder.d.ts +2 -2
- package/dist/seeder.js.map +1 -1
- package/dist/subfactory.d.ts +13 -0
- package/dist/subfactory.js +24 -0
- package/dist/subfactory.js.map +1 -0
- package/dist/types.d.ts +8 -1
- package/dist/useSeeders.d.ts +3 -3
- package/dist/useSeeders.js.map +1 -1
- package/package.json +16 -17
- package/dist/utils/isPromiseLike.d.ts +0 -1
- package/dist/utils/isPromiseLike.js +0 -6
- package/dist/utils/isPromiseLike.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,40 +1,53 @@
|
|
|
1
|
-
# [4.0.0-next.
|
|
1
|
+
# [4.0.0-next.2](https://github.com/jorgebodega/typeorm-seeding/compare/v4.0.0-next.1...v4.0.0-next.2) (2022-02-12)
|
|
2
|
+
|
|
3
|
+
# [4.0.0-next.1](https://github.com/jorgebodega/typeorm-seeding/compare/v3.2.0...v4.0.0-next.1) (2022-02-12)
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
### Bug Fixes
|
|
5
7
|
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* remove factories option from config ([870a23d](https://github.com/jorgebodega/typeorm-seeding/commit/870a23d912a1d18964e52c5c172b38714a8aa042))
|
|
8
|
+
* add type check on subfactories creation ([2b2883b](https://github.com/jorgebodega/typeorm-seeding/commit/2b2883b48ea08173a032b219266b1fece937e753))
|
|
9
|
+
* attrs failing with lazy instances ([c8ddda8](https://github.com/jorgebodega/typeorm-seeding/commit/c8ddda841f9e65d7081e419d2d2e662c6d6a78df))
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
###
|
|
12
|
+
### Features
|
|
12
13
|
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* add factorized attrs ([4a2ce08](https://github.com/jorgebodega/typeorm-seeding/commit/4a2ce08e1be1d79df8f1c0450ba4b315ebca8c46))
|
|
15
|
+
* add lazyattribute and subfactory as options in attribs ([48a3630](https://github.com/jorgebodega/typeorm-seeding/commit/48a3630b8c606ff5189c05dc51908dc09f142184))
|
|
16
|
+
* add subfactory as valid factorized attr ([0f4b37e](https://github.com/jorgebodega/typeorm-seeding/commit/0f4b37e0f8c3e93aedbd109ddb8f33ac0127a2dc))
|
|
17
|
+
* separate different types of lazy attributes ([3efe94e](https://github.com/jorgebodega/typeorm-seeding/commit/3efe94ea140643ccb12dbf8858968a5866fd7577))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### BREAKING CHANGES
|
|
21
|
+
|
|
22
|
+
* definition function has been substituted with attrs
|
|
23
|
+
|
|
24
|
+
# [3.2.0](https://github.com/jorgebodega/typeorm-seeding/compare/v3.1.0...v3.2.0) (2022-02-06)
|
|
15
25
|
|
|
16
26
|
|
|
17
27
|
### Features
|
|
18
28
|
|
|
19
|
-
*
|
|
20
|
-
* move factory definition to new abstract class ([41cf349](https://github.com/jorgebodega/typeorm-seeding/commit/41cf3494e8a97b185d113191c9598e49a4e73ced))
|
|
21
|
-
* remove context from factories ([#23](https://github.com/jorgebodega/typeorm-seeding/issues/23)) ([c030e89](https://github.com/jorgebodega/typeorm-seeding/commit/c030e890add5d41099004f8542a8dd521873d91d))
|
|
22
|
-
* remove deprecated elements ([09006e8](https://github.com/jorgebodega/typeorm-seeding/commit/09006e8655f288ebc318d32136b10f720687449f))
|
|
23
|
-
* remove factory helper methods and test associateds ([#30](https://github.com/jorgebodega/typeorm-seeding/issues/30)) ([a335ca2](https://github.com/jorgebodega/typeorm-seeding/commit/a335ca232410e2d1d93011ceca33068e01a7f16e))
|
|
24
|
-
* remove useFactories helper method ([#29](https://github.com/jorgebodega/typeorm-seeding/issues/29)) ([6fbeaba](https://github.com/jorgebodega/typeorm-seeding/commit/6fbeabaf2988b3d71fa19c2b44e443f58b805495))
|
|
25
|
-
* seed command will execute now default seeder or seed param ([84025f9](https://github.com/jorgebodega/typeorm-seeding/commit/84025f9a948c2d0823c2f95e6fb0193f0e36716a))
|
|
29
|
+
* Allow async map function ([2d2c27b](https://github.com/jorgebodega/typeorm-seeding/commit/2d2c27bfb6d208a4507169a9e9fa41e8e3680072))
|
|
26
30
|
|
|
31
|
+
# [3.1.0](https://github.com/jorgebodega/typeorm-seeding/compare/v3.0.1...v3.1.0) (2022-01-13)
|
|
27
32
|
|
|
28
|
-
### BREAKING CHANGES
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* add support to async definition on factory ([9432089](https://github.com/jorgebodega/typeorm-seeding/commit/9432089394b027552c12dc0a1dcb5f706cb6c107))
|
|
37
|
+
|
|
38
|
+
# [3.1.0-next.1](https://github.com/jorgebodega/typeorm-seeding/compare/v3.0.1...v3.1.0-next.1) (2022-01-09)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* add support to async definition on factory ([5fcca0e](https://github.com/jorgebodega/typeorm-seeding/commit/5fcca0e8d2016c68fda18fe1b202739558b07466))
|
|
44
|
+
|
|
45
|
+
## [3.0.1](https://github.com/jorgebodega/typeorm-seeding/compare/v3.0.0...v3.0.1) (2022-01-08)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
49
|
+
|
|
50
|
+
* update dependencies and add rimraf to dev deps ([504cef2](https://github.com/jorgebodega/typeorm-seeding/commit/504cef2f94b1b8e2e47d6bfa6e0bb1e8325490e2))
|
|
38
51
|
|
|
39
52
|
# [3.0.0](https://github.com/jorgebodega/typeorm-seeding/compare/v2.0.0...v3.0.0) (2022-01-06)
|
|
40
53
|
|
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.command.js","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":";;;;AAAA,iCAA4D;AAC5D,2DAA8B;AAC9B,iCAA4B;AAC5B,8CAAyE;AAEzE,8CAA0C;AAC1C,wDAA0D;AAE1D,6EAAyE;
|
|
1
|
+
{"version":3,"file":"seed.command.js","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":";;;;AAAA,iCAA4D;AAC5D,2DAA8B;AAC9B,iCAA4B;AAC5B,8CAAyE;AAEzE,8CAA0C;AAC1C,wDAA0D;AAE1D,6EAAyE;AASzE,MAAa,WAAW;IAAxB;QACE,YAAO,GAAG,MAAM,CAAA;QAChB,aAAQ,GAAG,gBAAgB,CAAA;IAmF7B,CAAC;IAjFC;;OAEG;IACH,OAAO,CAAC,IAAU;QAChB,OAAO,IAAI;aACR,MAAM,CAAC,GAAG,EAAE;YACX,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,+CAA+C;SAC1D,CAAC;aACD,MAAM,CAAC,GAAG,EAAE;YACX,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,gCAAgC;SAC3C,CAAC;aACD,MAAM,CAAC,GAAG,EAAE;YACX,K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1
|
import type { SaveOptions } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
protected abstract
|
|
5
|
-
|
|
6
|
-
* This function is used to alter the generated values of entity, before it
|
|
7
|
-
* is persist into the database
|
|
8
|
-
*/
|
|
9
|
-
map(mapFunction: (entity: Entity) => void): this;
|
|
2
|
+
import type { Constructable, FactorizedAttrs } from './types';
|
|
3
|
+
export declare abstract class Factory<T> {
|
|
4
|
+
protected abstract entity: Constructable<T>;
|
|
5
|
+
protected abstract attrs: FactorizedAttrs<T>;
|
|
10
6
|
/**
|
|
11
7
|
* Make a new entity without persisting it
|
|
12
8
|
*/
|
|
13
|
-
make(overrideParams?: Partial<
|
|
9
|
+
make(overrideParams?: Partial<FactorizedAttrs<T>>): Promise<T>;
|
|
14
10
|
/**
|
|
15
11
|
* Make many new entities without persisting it
|
|
16
12
|
*/
|
|
17
|
-
makeMany(amount: number, overrideParams?: Partial<
|
|
13
|
+
makeMany(amount: number, overrideParams?: Partial<FactorizedAttrs<T>>): Promise<T[]>;
|
|
18
14
|
/**
|
|
19
15
|
* Create a new entity and persist it
|
|
20
16
|
*/
|
|
21
|
-
create(overrideParams?: Partial<
|
|
17
|
+
create(overrideParams?: Partial<FactorizedAttrs<T>>, saveOptions?: SaveOptions): Promise<T>;
|
|
22
18
|
/**
|
|
23
19
|
* Create many new entities and persist them
|
|
24
20
|
*/
|
|
25
|
-
createMany(amount: number, overrideParams?: Partial<
|
|
21
|
+
createMany(amount: number, overrideParams?: Partial<FactorizedAttrs<T>>, saveOptions?: SaveOptions): Promise<T[]>;
|
|
26
22
|
private makeEntity;
|
|
27
|
-
private
|
|
23
|
+
private applyLazyAttributes;
|
|
24
|
+
private static resolveValue;
|
|
28
25
|
}
|
package/dist/factory.js
CHANGED
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Factory = void 0;
|
|
4
4
|
const connection_1 = require("./connection");
|
|
5
|
-
const
|
|
5
|
+
const instanceAttribute_1 = require("./instanceAttribute");
|
|
6
|
+
const lazyInstanceAttribute_1 = require("./lazyInstanceAttribute");
|
|
7
|
+
const subfactory_1 = require("./subfactory");
|
|
6
8
|
class Factory {
|
|
7
|
-
/**
|
|
8
|
-
* This function is used to alter the generated values of entity, before it
|
|
9
|
-
* is persist into the database
|
|
10
|
-
*/
|
|
11
|
-
map(mapFunction) {
|
|
12
|
-
this.mapFunction = mapFunction;
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
9
|
/**
|
|
16
10
|
* Make a new entity without persisting it
|
|
17
11
|
*/
|
|
18
12
|
async make(overrideParams = {}) {
|
|
19
|
-
|
|
13
|
+
const attrs = { ...this.attrs, ...overrideParams };
|
|
14
|
+
const entity = await this.makeEntity(attrs, false);
|
|
15
|
+
await this.applyLazyAttributes(entity, attrs, false);
|
|
16
|
+
return entity;
|
|
20
17
|
}
|
|
21
18
|
/**
|
|
22
19
|
* Make many new entities without persisting it
|
|
@@ -32,9 +29,13 @@ class Factory {
|
|
|
32
29
|
* Create a new entity and persist it
|
|
33
30
|
*/
|
|
34
31
|
async create(overrideParams = {}, saveOptions) {
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
32
|
+
const attrs = { ...this.attrs, ...overrideParams };
|
|
33
|
+
const preloadedAttrs = Object.entries(attrs).filter(([, value]) => !(value instanceof lazyInstanceAttribute_1.LazyInstanceAttribute));
|
|
34
|
+
const entity = await this.makeEntity(Object.fromEntries(preloadedAttrs), true);
|
|
35
|
+
const em = (await (0, connection_1.fetchConnection)()).createEntityManager();
|
|
36
|
+
const savedEntity = await em.save(entity, saveOptions);
|
|
37
|
+
await this.applyLazyAttributes(savedEntity, attrs, true);
|
|
38
|
+
return em.save(savedEntity, saveOptions);
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Create many new entities and persist them
|
|
@@ -46,32 +47,37 @@ class Factory {
|
|
|
46
47
|
}
|
|
47
48
|
return list;
|
|
48
49
|
}
|
|
49
|
-
async makeEntity(
|
|
50
|
-
const entity = this.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
async resolveEntity(entity, isSeeding) {
|
|
60
|
-
for (const attribute in entity) {
|
|
61
|
-
const attributeValue = entity[attribute];
|
|
62
|
-
if ((0, isPromiseLike_1.isPromiseLike)(attributeValue)) {
|
|
63
|
-
entity[attribute] = await attributeValue;
|
|
50
|
+
async makeEntity(attrs, shouldPersist) {
|
|
51
|
+
const entity = new this.entity();
|
|
52
|
+
await Promise.all(Object.entries(attrs).map(async ([key, value]) => {
|
|
53
|
+
Object.assign(entity, { [key]: await Factory.resolveValue(value, shouldPersist) });
|
|
54
|
+
}));
|
|
55
|
+
await Promise.all(Object.entries(attrs).map(async ([key, value]) => {
|
|
56
|
+
if (value instanceof instanceAttribute_1.InstanceAttribute) {
|
|
57
|
+
const newAttrib = value.resolve(entity);
|
|
58
|
+
Object.assign(entity, { [key]: await Factory.resolveValue(newAttrib, shouldPersist) });
|
|
64
59
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
}));
|
|
61
|
+
return entity;
|
|
62
|
+
}
|
|
63
|
+
async applyLazyAttributes(entity, attrs, shouldPersist) {
|
|
64
|
+
await Promise.all(Object.entries(attrs).map(async ([key, value]) => {
|
|
65
|
+
if (value instanceof lazyInstanceAttribute_1.LazyInstanceAttribute) {
|
|
66
|
+
const newAttrib = value.resolve(entity);
|
|
67
|
+
Object.assign(entity, { [key]: await Factory.resolveValue(newAttrib, shouldPersist) });
|
|
72
68
|
}
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
static resolveValue(value, shouldPersist) {
|
|
72
|
+
if (value instanceof subfactory_1.Subfactory) {
|
|
73
|
+
return shouldPersist ? value.create() : value.make();
|
|
74
|
+
}
|
|
75
|
+
else if (value instanceof Function) {
|
|
76
|
+
return value();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return value;
|
|
73
80
|
}
|
|
74
|
-
return entity;
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
83
|
exports.Factory = Factory;
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":";;;AACA,6CAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":";;;AACA,6CAA8C;AAC9C,2DAAuD;AACvD,mEAA+D;AAC/D,6CAAyC;AAGzC,MAAsB,OAAO;IAI3B;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,iBAA8C,EAAE;QACzD,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,cAAc,EAAE,CAAA;QAElD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAClD,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;QAEpD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,iBAA8C,EAAE;QAC7E,MAAM,IAAI,GAAG,EAAE,CAAA;QACf,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE;YAC3C,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;SAC9C;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,iBAA8C,EAAE,EAAE,WAAyB;QACtF,MAAM,KAAK,GAAG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AAE,aAAsB;QAChE,IAAI,KAAK,YAAY,uBAAU,EAAE;YAC/B,OAAO,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;SACrD;aAAM,IAAI,KAAK,YAAY,QAAQ,EAAE;YACpC,OAAO,KAAK,EAAE,CAAA;SACf;aAAM;YACL,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CACF;AAnGD,0BAmGC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export * from './connection';
|
|
2
2
|
export * from './factory';
|
|
3
|
+
export * from './lazyAttribute';
|
|
4
|
+
export * from './instanceAttribute';
|
|
5
|
+
export * from './lazyInstanceAttribute';
|
|
3
6
|
export * from './seeder';
|
|
7
|
+
export * from './subfactory';
|
|
4
8
|
export * from './types';
|
|
5
9
|
export * from './useSeeders';
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
(0, tslib_1.__exportStar)(require("./connection"), exports);
|
|
5
5
|
(0, tslib_1.__exportStar)(require("./factory"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./lazyAttribute"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./instanceAttribute"), exports);
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./lazyInstanceAttribute"), exports);
|
|
6
9
|
(0, tslib_1.__exportStar)(require("./seeder"), exports);
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./subfactory"), exports);
|
|
7
11
|
(0, tslib_1.__exportStar)(require("./types"), exports);
|
|
8
12
|
(0, tslib_1.__exportStar)(require("./useSeeders"), exports);
|
|
9
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,4DAA4B;AAC5B,yDAAyB;AACzB,wDAAwB;AACxB,uDAAuB;AACvB,4DAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,4DAA4B;AAC5B,yDAAyB;AACzB,+DAA+B;AAC/B,mEAAmC;AACnC,uEAAuC;AACvC,wDAAwB;AACxB,4DAA4B;AAC5B,uDAAuB;AACvB,4DAA4B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstanceAttribute = void 0;
|
|
4
|
+
const lazyAttribute_1 = require("./lazyAttribute");
|
|
5
|
+
class InstanceAttribute extends lazyAttribute_1.LazyAttribute {
|
|
6
|
+
}
|
|
7
|
+
exports.InstanceAttribute = InstanceAttribute;
|
|
8
|
+
//# sourceMappingURL=instanceAttribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instanceAttribute.js","sourceRoot":"","sources":["../src/instanceAttribute.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAE/C,MAAa,iBAAwB,SAAQ,6BAAmB;CAAG;AAAnE,8CAAmE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LazyAttribute = void 0;
|
|
4
|
+
class LazyAttribute {
|
|
5
|
+
constructor(callback) {
|
|
6
|
+
this.callback = callback;
|
|
7
|
+
}
|
|
8
|
+
resolve(entity) {
|
|
9
|
+
return this.callback(entity);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.LazyAttribute = LazyAttribute;
|
|
13
|
+
//# sourceMappingURL=lazyAttribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyAttribute.js","sourceRoot":"","sources":["../src/lazyAttribute.ts"],"names":[],"mappings":";;;AAEA,MAAsB,aAAa;IACjC,YAAoB,QAAqC;QAArC,aAAQ,GAAR,QAAQ,CAA6B;IAAG,CAAC;IAE7D,OAAO,CAAC,MAAS;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC9B,CAAC;CACF;AAND,sCAMC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LazyInstanceAttribute = void 0;
|
|
4
|
+
const lazyAttribute_1 = require("./lazyAttribute");
|
|
5
|
+
class LazyInstanceAttribute extends lazyAttribute_1.LazyAttribute {
|
|
6
|
+
}
|
|
7
|
+
exports.LazyInstanceAttribute = LazyInstanceAttribute;
|
|
8
|
+
//# sourceMappingURL=lazyInstanceAttribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyInstanceAttribute.js","sourceRoot":"","sources":["../src/lazyInstanceAttribute.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAE/C,MAAa,qBAA4B,SAAQ,6BAAmB;CAAG;AAAvE,sDAAuE"}
|
package/dist/seeder.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Connection } from 'typeorm';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Constructable } from './types';
|
|
3
3
|
export declare abstract class Seeder {
|
|
4
4
|
abstract run(connection: Connection): Promise<void>;
|
|
5
|
-
protected call(connection: Connection, seeders:
|
|
5
|
+
protected call(connection: Connection, seeders: Constructable<Seeder>[]): Promise<void>;
|
|
6
6
|
}
|
package/dist/seeder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seeder.js","sourceRoot":"","sources":["../src/seeder.ts"],"names":[],"mappings":";;;AAGA,MAAsB,MAAM;IAGhB,KAAK,CAAC,IAAI,CAAC,UAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"seeder.js","sourceRoot":"","sources":["../src/seeder.ts"],"names":[],"mappings":";;;AAGA,MAAsB,MAAM;IAGhB,KAAK,CAAC,IAAI,CAAC,UAAsB,EAAE,OAAgC;QAC3E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,MAAM,IAAI,MAAM,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;SACnC;IACH,CAAC;CACF;AARD,wBAQC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Factory } from './factory';
|
|
2
|
+
import type { Constructable, FactorizedAttrs } from './types';
|
|
3
|
+
export declare class Subfactory<T> {
|
|
4
|
+
private factoryInstance;
|
|
5
|
+
private values?;
|
|
6
|
+
private count?;
|
|
7
|
+
constructor(factory: Constructable<Factory<T>>);
|
|
8
|
+
constructor(factory: Constructable<Factory<T>>, values?: Partial<FactorizedAttrs<T>>);
|
|
9
|
+
constructor(factory: Constructable<Factory<T>>, count?: number);
|
|
10
|
+
constructor(factory: Constructable<Factory<T>>, values?: Partial<FactorizedAttrs<T>>, count?: number);
|
|
11
|
+
create(): Promise<T[]> | Promise<T>;
|
|
12
|
+
make(): Promise<T[]> | Promise<T>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Subfactory = void 0;
|
|
4
|
+
class Subfactory {
|
|
5
|
+
constructor(factory, countOrValues, count) {
|
|
6
|
+
this.factoryInstance = new factory();
|
|
7
|
+
this.values = typeof countOrValues === 'number' ? undefined : countOrValues;
|
|
8
|
+
this.count = typeof countOrValues === 'number' ? countOrValues : count;
|
|
9
|
+
}
|
|
10
|
+
create() {
|
|
11
|
+
if (this.count !== undefined) {
|
|
12
|
+
return this.factoryInstance.createMany(this.count, this.values);
|
|
13
|
+
}
|
|
14
|
+
return this.factoryInstance.create(this.values);
|
|
15
|
+
}
|
|
16
|
+
make() {
|
|
17
|
+
if (this.count !== undefined) {
|
|
18
|
+
return this.factoryInstance.makeMany(this.count, this.values);
|
|
19
|
+
}
|
|
20
|
+
return this.factoryInstance.make(this.values);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.Subfactory = Subfactory;
|
|
24
|
+
//# sourceMappingURL=subfactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subfactory.js","sourceRoot":"","sources":["../src/subfactory.ts"],"names":[],"mappings":";;;AAGA,MAAa,UAAU;IAUrB,YACE,OAAkC,EAClC,aAAoD,EACpD,KAAc;QAEd,IAAI,CAAC,eAAe,GAAG,IAAI,OAAO,EAAE,CAAA;QACpC,IAAI,CAAC,MAAM,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAA;QAC3E,IAAI,CAAC,KAAK,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAA;IACxE,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC5B,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;SAChE;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACjD,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC5B,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;SAC9D;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;CACF;AAnCD,gCAmCC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ConnectionOptions as TypeORMConnectionOptions } from 'typeorm';
|
|
2
|
-
|
|
2
|
+
import type { LazyAttribute } from './lazyAttribute';
|
|
3
|
+
import type { Subfactory } from './subfactory';
|
|
3
4
|
export declare type ConnectionOptions = TypeORMConnectionOptions & {
|
|
4
5
|
seeders: string[];
|
|
5
6
|
defaultSeeder: string;
|
|
@@ -9,3 +10,9 @@ export declare type ConnectionConfiguration = {
|
|
|
9
10
|
configName?: string;
|
|
10
11
|
connection: string;
|
|
11
12
|
};
|
|
13
|
+
export declare type Constructable<T> = new () => T;
|
|
14
|
+
export declare type FactorizedAttr<V> = V | (() => V | Promise<V>) | Subfactory<V extends Array<infer U> ? U : V>;
|
|
15
|
+
export declare type FactorizedAttrs<T> = {
|
|
16
|
+
[K in keyof Partial<T>]: FactorizedAttr<T[K]> | LazyAttribute<T, FactorizedAttr<T[K]>>;
|
|
17
|
+
};
|
|
18
|
+
export declare type LazyAttributeCallback<T, V> = (entity: T) => V;
|
package/dist/useSeeders.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Seeder } from './seeder';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function useSeeders(entrySeeders:
|
|
4
|
-
export declare function useSeeders(entrySeeders:
|
|
2
|
+
import type { ConnectionConfiguration, Constructable } from './types';
|
|
3
|
+
export declare function useSeeders(entrySeeders: Constructable<Seeder> | Constructable<Seeder>[]): Promise<void>;
|
|
4
|
+
export declare function useSeeders(entrySeeders: Constructable<Seeder> | Constructable<Seeder>[], customOptions: Partial<ConnectionConfiguration>): Promise<void>;
|
package/dist/useSeeders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSeeders.js","sourceRoot":"","sources":["../src/useSeeders.ts"],"names":[],"mappings":";;;AAAA,6CAAmE;AAU5D,KAAK,UAAU,UAAU,CAC9B,
|
|
1
|
+
{"version":3,"file":"useSeeders.js","sourceRoot":"","sources":["../src/useSeeders.ts"],"names":[],"mappings":";;;AAAA,6CAAmE;AAU5D,KAAK,UAAU,UAAU,CAC9B,YAA6D,EAC7D,aAAgD;IAEhD,IAAI,aAAa;QAAE,IAAA,gCAAmB,EAAC,aAAa,CAAC,CAAA;IAErD,MAAM,UAAU,GAAG,MAAM,IAAA,4BAAe,GAAE,CAAA;IAE1C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;IAC3E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,IAAI,MAAM,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;KACnC;AACH,CAAC;AAZD,gCAYC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jorgebodega/typeorm-seeding",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.2",
|
|
4
4
|
"description": "🌱 A delightful way to seed test data into your database.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gery Hirschfeld <gery.hirschfeld@w3tec.ch> (https://github.com/hirsch88)",
|
|
@@ -36,39 +36,38 @@
|
|
|
36
36
|
"typecheck": "tsc --noEmit"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@faker-js/faker": "6.0.0-alpha.6",
|
|
39
40
|
"@semantic-release/changelog": "6.0.1",
|
|
40
41
|
"@semantic-release/git": "10.0.1",
|
|
41
42
|
"@tsconfig/node16": "1.0.2",
|
|
42
43
|
"@types/bcryptjs": "2.4.2",
|
|
43
44
|
"@types/chalk": "2.2.0",
|
|
44
|
-
"@types/faker": "5.5.9",
|
|
45
45
|
"@types/glob": "7.2.0",
|
|
46
46
|
"@types/jest": "27.4.0",
|
|
47
|
-
"@types/node": "
|
|
47
|
+
"@types/node": "17.0.17",
|
|
48
48
|
"@types/yargs": "17.0.8",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
50
|
-
"@typescript-eslint/parser": "5.
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "5.11.0",
|
|
50
|
+
"@typescript-eslint/parser": "5.11.0",
|
|
51
51
|
"bcryptjs": "2.4.3",
|
|
52
|
-
"eslint": "8.
|
|
52
|
+
"eslint": "8.9.0",
|
|
53
53
|
"eslint-config-prettier": "8.3.0",
|
|
54
54
|
"eslint-plugin-import": "2.25.4",
|
|
55
|
-
"
|
|
56
|
-
"jest": "27.4.7",
|
|
55
|
+
"jest": "27.5.1",
|
|
57
56
|
"prettier": "2.5.1",
|
|
58
|
-
"rimraf": "
|
|
57
|
+
"rimraf": "3.0.2",
|
|
59
58
|
"semantic-release": "18.0.1",
|
|
60
59
|
"sqlite3": "5.0.2",
|
|
61
|
-
"ts-jest": "27.1.
|
|
62
|
-
"ts-node": "10.
|
|
60
|
+
"ts-jest": "27.1.3",
|
|
61
|
+
"ts-node": "10.5.0",
|
|
63
62
|
"typeorm": "0.2.41",
|
|
64
|
-
"typescript": "4.5.
|
|
63
|
+
"typescript": "4.5.5"
|
|
65
64
|
},
|
|
66
65
|
"dependencies": {
|
|
67
|
-
"chalk": "
|
|
68
|
-
"glob": "
|
|
69
|
-
"ora": "
|
|
70
|
-
"reflect-metadata": "
|
|
71
|
-
"yargs": "
|
|
66
|
+
"chalk": "4.1.2",
|
|
67
|
+
"glob": "7.2.0",
|
|
68
|
+
"ora": "5.4.1",
|
|
69
|
+
"reflect-metadata": "0.1.13",
|
|
70
|
+
"yargs": "17.3.1"
|
|
72
71
|
},
|
|
73
72
|
"peerDependencies": {
|
|
74
73
|
"typeorm": "^0.2.41"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isPromiseLike: (o: any) => o is Promise<any>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPromiseLike = void 0;
|
|
4
|
-
const isPromiseLike = (o) => o && Object.prototype.toString.call(o) === '[object Promise]';
|
|
5
|
-
exports.isPromiseLike = isPromiseLike;
|
|
6
|
-
//# sourceMappingURL=isPromiseLike.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isPromiseLike.js","sourceRoot":"","sources":["../../src/utils/isPromiseLike.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAAC,CAAM,EAAqB,EAAE,CACzD,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,kBAAkB,CAAA;AADlD,QAAA,aAAa,iBACqC"}
|