joist-test-utils 2.5.0-next.1 → 2.5.0-next.11
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/build/RunPlugin.cjs +1 -2
- package/build/RunPlugin.d.cts +0 -2
- package/build/RunPlugin.d.cts.map +1 -1
- package/build/RunPlugin.d.mts +0 -2
- package/build/RunPlugin.d.mts.map +1 -1
- package/build/RunPlugin.js +1 -2
- package/build/_virtual/_rolldown/runtime.cjs +1 -2
- package/build/context.d.cts +0 -2
- package/build/context.d.cts.map +1 -1
- package/build/context.d.mts +0 -2
- package/build/context.d.mts.map +1 -1
- package/build/index.cjs +2 -3
- package/build/index.d.cts +2 -4
- package/build/index.d.cts.map +1 -1
- package/build/index.d.mts +2 -4
- package/build/index.d.mts.map +1 -1
- package/build/index.js +2 -3
- package/build/run.cjs +2 -3
- package/build/run.d.cts +0 -2
- package/build/run.d.cts.map +1 -1
- package/build/run.d.mts +0 -2
- package/build/run.d.mts.map +1 -1
- package/build/run.js +2 -3
- package/build/seed.cjs +1 -2
- package/build/seed.d.cts +0 -2
- package/build/seed.d.cts.map +1 -1
- package/build/seed.d.mts +0 -2
- package/build/seed.d.mts.map +1 -1
- package/build/seed.js +1 -2
- package/build/toMatchEntity.cjs +1 -2
- package/build/toMatchEntity.d.cts +0 -2
- package/build/toMatchEntity.d.cts.map +1 -1
- package/build/toMatchEntity.d.mts +0 -2
- package/build/toMatchEntity.d.mts.map +1 -1
- package/build/toMatchEntity.js +1 -2
- package/package.json +4 -4
package/build/RunPlugin.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let joist_core = require("joist-core");
|
|
3
|
-
|
|
3
|
+
// src/RunPlugin.ts
|
|
4
4
|
var RunPlugin = class extends joist_core.Plugin {
|
|
5
5
|
em;
|
|
6
6
|
constructor(em) {
|
|
@@ -225,7 +225,6 @@ function getManyToManys(entity) {
|
|
|
225
225
|
function getCollections(entity) {
|
|
226
226
|
return (0, joist_core.getRelations)(entity).values().filter((r) => r instanceof joist_core.ManyToManyCollection || r instanceof joist_core.OneToManyCollection || r instanceof joist_core.OneToOneReferenceImpl || r instanceof joist_core.ReactiveManyToManyImpl || r instanceof joist_core.ReactiveManyToManyOtherSideImpl || r instanceof joist_core.EnumCollectionImpl);
|
|
227
227
|
}
|
|
228
|
-
//#endregion
|
|
229
228
|
exports.RunPlugin = RunPlugin;
|
|
230
229
|
|
|
231
230
|
//# sourceMappingURL=RunPlugin.cjs.map
|
package/build/RunPlugin.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EntityManager, JoinRowTodo, Plugin, Todo } from "joist-core";
|
|
2
|
-
//#region src/RunPlugin.d.ts
|
|
3
2
|
export declare class RunPlugin extends Plugin {
|
|
4
3
|
#private;
|
|
5
4
|
readonly em: EntityManager;
|
|
@@ -7,5 +6,4 @@ export declare class RunPlugin extends Plugin {
|
|
|
7
6
|
maybeCloneForNewEm(): this;
|
|
8
7
|
afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void;
|
|
9
8
|
}
|
|
10
|
-
//#endregion
|
|
11
9
|
//# sourceMappingURL=RunPlugin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunPlugin.d.cts","names":[],"sources":["../src/RunPlugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RunPlugin.d.cts","names":[],"sources":["../src/RunPlugin.ts"],"mappings":";qBAoCa,kBAAkB;;WAGD,IAAI;EAAhC,YAA4B,IAAI;EAIhC;EAIA,WAAW,aAAa,eAAe,OAAO,cAAc,eAAe"}
|
package/build/RunPlugin.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EntityManager, JoinRowTodo, Plugin, Todo } from "joist-core";
|
|
2
|
-
//#region src/RunPlugin.d.ts
|
|
3
2
|
export declare class RunPlugin extends Plugin {
|
|
4
3
|
#private;
|
|
5
4
|
readonly em: EntityManager;
|
|
@@ -7,5 +6,4 @@ export declare class RunPlugin extends Plugin {
|
|
|
7
6
|
maybeCloneForNewEm(): this;
|
|
8
7
|
afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void;
|
|
9
8
|
}
|
|
10
|
-
//#endregion
|
|
11
9
|
//# sourceMappingURL=RunPlugin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunPlugin.d.mts","names":[],"sources":["../src/RunPlugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RunPlugin.d.mts","names":[],"sources":["../src/RunPlugin.ts"],"mappings":";qBAoCa,kBAAkB;;WAGD,IAAI;EAAhC,YAA4B,IAAI;EAIhC;EAIA,WAAW,aAAa,eAAe,OAAO,cAAc,eAAe"}
|
package/build/RunPlugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnumCollectionImpl, ManyToManyCollection, ManyToOneReferenceImpl, OneToManyCollection, OneToOneReferenceImpl, Plugin, PojoRowData, PolymorphicKeySerde, PolymorphicReferenceImpl, ReactiveManyToManyImpl, ReactiveManyToManyOtherSideImpl, ReactiveReferenceImpl, assertNever, createRowFromEntityData, getEmInternalApi, getInstanceData, getMetadata, getRelations, isEntity } from "joist-core";
|
|
2
|
-
|
|
2
|
+
// src/RunPlugin.ts
|
|
3
3
|
var RunPlugin = class extends Plugin {
|
|
4
4
|
em;
|
|
5
5
|
constructor(em) {
|
|
@@ -224,7 +224,6 @@ function getManyToManys(entity) {
|
|
|
224
224
|
function getCollections(entity) {
|
|
225
225
|
return getRelations(entity).values().filter((r) => r instanceof ManyToManyCollection || r instanceof OneToManyCollection || r instanceof OneToOneReferenceImpl || r instanceof ReactiveManyToManyImpl || r instanceof ReactiveManyToManyOtherSideImpl || r instanceof EnumCollectionImpl);
|
|
226
226
|
}
|
|
227
|
-
//#endregion
|
|
228
227
|
export { RunPlugin };
|
|
229
228
|
|
|
230
229
|
//# sourceMappingURL=RunPlugin.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -19,5 +19,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
|
-
//#endregion
|
|
23
22
|
exports.__toESM = __toESM;
|
package/build/context.d.cts
CHANGED
package/build/context.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.cts","names":[],"sources":["../src/context.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.cts","names":[],"sources":["../src/context.ts"],"mappings":";;YAGY;EAAY,IAAI"}
|
package/build/context.d.mts
CHANGED
package/build/context.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.mts","names":[],"sources":["../src/context.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.mts","names":[],"sources":["../src/context.ts"],"mappings":";;YAGY;EAAY,IAAI"}
|
package/build/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_RunPlugin = require("./RunPlugin.cjs");
|
|
3
2
|
const require_toMatchEntity = require("./toMatchEntity.cjs");
|
|
4
3
|
const require_run = require("./run.cjs");
|
|
4
|
+
const require_RunPlugin = require("./RunPlugin.cjs");
|
|
5
5
|
const require_seed = require("./seed.cjs");
|
|
6
6
|
let joist_core = require("joist-core");
|
|
7
|
-
|
|
7
|
+
// src/index.ts
|
|
8
8
|
/**
|
|
9
9
|
* A custom equality tester for Jest, i.e. install it like:
|
|
10
10
|
*
|
|
@@ -24,7 +24,6 @@ function areEntitiesEqual(a, b) {
|
|
|
24
24
|
else if (typeof b === "string" && a instanceof joist_core.BaseEntity) return b === a.id;
|
|
25
25
|
else return;
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
exports.RunPlugin = require_RunPlugin.RunPlugin;
|
|
29
28
|
exports.areEntitiesEqual = areEntitiesEqual;
|
|
30
29
|
exports.makeRun = require_run.makeRun;
|
package/build/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { RunPlugin } from "./RunPlugin.cjs";
|
|
2
|
-
import { Context } from "./context.cjs";
|
|
3
1
|
import { MatchedEntity, toMatchEntity } from "./toMatchEntity.cjs";
|
|
2
|
+
import { Context } from "./context.cjs";
|
|
4
3
|
import { ContextFn, makeRun, makeRunEach, newContext, run, runEach } from "./run.cjs";
|
|
4
|
+
import { RunPlugin } from "./RunPlugin.cjs";
|
|
5
5
|
import { SeedConfig, seed } from "./seed.cjs";
|
|
6
|
-
//#region src/index.d.ts
|
|
7
6
|
export interface CustomMatcherResult {
|
|
8
7
|
pass: boolean;
|
|
9
8
|
message: () => string;
|
|
@@ -47,6 +46,5 @@ declare module "vitest" {
|
|
|
47
46
|
* individual objects left for Jest to see & realize "these are different".
|
|
48
47
|
*/
|
|
49
48
|
export declare function areEntitiesEqual(a: unknown, b: unknown): boolean | undefined;
|
|
50
|
-
//#endregion
|
|
51
49
|
export { type Context, type ContextFn, RunPlugin, type SeedConfig, makeRun, makeRunEach, newContext, run, runEach, seed, toMatchEntity };
|
|
52
50
|
//# sourceMappingURL=index.d.cts.map
|
package/build/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;iBASiB;EACf;EACA;;QAGM;YACI;cACE,SAAS,iBAAiB,eAAe;MACjD,cAAc,UAAU,cAAc,KAAK;;;;;YAMrC,SAAS,iBAAiB,eAAe;IACjD,cAAc,UAAU,cAAc,KAAK;;;;YAMnC,SAAS;IACjB,cAAc,UAAU,cAAc,KAAK;;;;YAMnC,SAAS,GAAG;IACpB,cAAc,UAAU,cAAc,KAAK;;YAEnC;IACR,cAAc,UAAU;;;;;;;;;;;;;;;;wBAiBZ,iBAAiB,YAAY"}
|
package/build/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { RunPlugin } from "./RunPlugin.mjs";
|
|
2
|
-
import { Context } from "./context.mjs";
|
|
3
1
|
import { MatchedEntity, toMatchEntity } from "./toMatchEntity.mjs";
|
|
2
|
+
import { Context } from "./context.mjs";
|
|
4
3
|
import { ContextFn, makeRun, makeRunEach, newContext, run, runEach } from "./run.mjs";
|
|
4
|
+
import { RunPlugin } from "./RunPlugin.mjs";
|
|
5
5
|
import { SeedConfig, seed } from "./seed.mjs";
|
|
6
|
-
//#region src/index.d.ts
|
|
7
6
|
export interface CustomMatcherResult {
|
|
8
7
|
pass: boolean;
|
|
9
8
|
message: () => string;
|
|
@@ -47,6 +46,5 @@ declare module "vitest" {
|
|
|
47
46
|
* individual objects left for Jest to see & realize "these are different".
|
|
48
47
|
*/
|
|
49
48
|
export declare function areEntitiesEqual(a: unknown, b: unknown): boolean | undefined;
|
|
50
|
-
//#endregion
|
|
51
49
|
export { type Context, type ContextFn, RunPlugin, type SeedConfig, makeRun, makeRunEach, newContext, run, runEach, seed, toMatchEntity };
|
|
52
50
|
//# sourceMappingURL=index.d.mts.map
|
package/build/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;iBASiB;EACf;EACA;;QAGM;YACI;cACE,SAAS,iBAAiB,eAAe;MACjD,cAAc,UAAU,cAAc,KAAK;;;;;YAMrC,SAAS,iBAAiB,eAAe;IACjD,cAAc,UAAU,cAAc,KAAK;;;;YAMnC,SAAS;IACjB,cAAc,UAAU,cAAc,KAAK;;;;YAMnC,SAAS,GAAG;IACpB,cAAc,UAAU,cAAc,KAAK;;YAEnC;IACR,cAAc,UAAU;;;;;;;;;;;;;;;;wBAiBZ,iBAAiB,YAAY"}
|
package/build/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RunPlugin } from "./RunPlugin.js";
|
|
2
1
|
import { toMatchEntity } from "./toMatchEntity.js";
|
|
3
2
|
import { makeRun, makeRunEach, newContext, run, runEach } from "./run.js";
|
|
3
|
+
import { RunPlugin } from "./RunPlugin.js";
|
|
4
4
|
import { seed } from "./seed.js";
|
|
5
5
|
import { BaseEntity } from "joist-core";
|
|
6
|
-
|
|
6
|
+
// src/index.ts
|
|
7
7
|
/**
|
|
8
8
|
* A custom equality tester for Jest, i.e. install it like:
|
|
9
9
|
*
|
|
@@ -23,7 +23,6 @@ function areEntitiesEqual(a, b) {
|
|
|
23
23
|
else if (typeof b === "string" && a instanceof BaseEntity) return b === a.id;
|
|
24
24
|
else return;
|
|
25
25
|
}
|
|
26
|
-
//#endregion
|
|
27
26
|
export { RunPlugin, areEntitiesEqual, makeRun, makeRunEach, newContext, run, runEach, seed, toMatchEntity };
|
|
28
27
|
|
|
29
28
|
//# sourceMappingURL=index.js.map
|
package/build/run.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_RunPlugin = require("./RunPlugin.cjs");
|
|
3
2
|
require("./context.cjs");
|
|
3
|
+
const require_RunPlugin = require("./RunPlugin.cjs");
|
|
4
4
|
let joist_core = require("joist-core");
|
|
5
5
|
let joist_utils = require("joist-utils");
|
|
6
|
-
|
|
6
|
+
// src/run.ts
|
|
7
7
|
let flushPromise;
|
|
8
8
|
let flushEm;
|
|
9
9
|
/** Runs the `fn` in a dedicated / non-test Unit of Work . */
|
|
@@ -67,7 +67,6 @@ function mapResultToOriginalEm(em, result) {
|
|
|
67
67
|
return obj;
|
|
68
68
|
} else return result;
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
70
|
exports.makeRun = makeRun;
|
|
72
71
|
exports.makeRunEach = makeRunEach;
|
|
73
72
|
exports.newContext = newContext;
|
package/build/run.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Context } from "./context.cjs";
|
|
2
|
-
//#region src/run.d.ts
|
|
3
2
|
type MaybePromise<T> = T | Promise<T>;
|
|
4
3
|
export type ContextFn<C> = (ctx: C) => MaybePromise<C>;
|
|
5
4
|
/** Runs the `fn` in a dedicated / non-test Unit of Work . */
|
|
@@ -12,6 +11,5 @@ export declare function runEach<C extends Context, T, U>(ctx: C, valuesFn: () =>
|
|
|
12
11
|
export declare function makeRunEach<C extends Context>(contextFn: ContextFn<C>): <T, U>(ctx: C, valuesFn: () => U[], fn: (ctx: C, value: U) => MaybePromise<T>) => Promise<T[]>;
|
|
13
12
|
/** A default `newContext` that assumes `ctx.em` is where the `EntityManager` lives. */
|
|
14
13
|
export declare function newContext<C extends Context>(ctx: C): C;
|
|
15
|
-
//#endregion
|
|
16
14
|
export {};
|
|
17
15
|
//# sourceMappingURL=run.d.cts.map
|
package/build/run.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.cts","names":[],"sources":["../src/run.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.cts","names":[],"sources":["../src/run.ts"],"mappings":";KAMK,aAAa,KAAK,IAAI,QAAQ;YAEvB,UAAU,MAAM,KAAK,MAAM,aAAa;;wBAO9B,IAAI,UAAU,SAAS,GAC3C,KAAK,GACL,KAAK,KAAK,MAAM,aAAa,IAC7B,YAAW,UAAU,KACpB,QAAQ;;wBAsBK,QAAQ,UAAU,SAChC,WAAW,UAAU,MACnB,GAAG,KAAK,GAAG,KAAK,KAAK,MAAM,aAAa,OAAO,QAAQ;;wBAKrC,QAAQ,UAAU,SAAS,GAAG,GAClD,KAAK,GACL,gBAAgB,KAChB,KAAK,KAAK,GAAG,OAAO,MAAM,aAAa,IACvC,YAAW,UAAU,KACpB,QAAQ;;wBAgBK,YAAY,UAAU,SACpC,WAAW,UAAU,MACnB,GAAG,GAAG,KAAK,GAAG,gBAAgB,KAAK,KAAK,KAAK,GAAG,OAAO,MAAM,aAAa,OAAO,QAAQ;;wBAK7E,WAAW,UAAU,SAAS,KAAK,IAAI"}
|
package/build/run.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Context } from "./context.mjs";
|
|
2
|
-
//#region src/run.d.ts
|
|
3
2
|
type MaybePromise<T> = T | Promise<T>;
|
|
4
3
|
export type ContextFn<C> = (ctx: C) => MaybePromise<C>;
|
|
5
4
|
/** Runs the `fn` in a dedicated / non-test Unit of Work . */
|
|
@@ -12,6 +11,5 @@ export declare function runEach<C extends Context, T, U>(ctx: C, valuesFn: () =>
|
|
|
12
11
|
export declare function makeRunEach<C extends Context>(contextFn: ContextFn<C>): <T, U>(ctx: C, valuesFn: () => U[], fn: (ctx: C, value: U) => MaybePromise<T>) => Promise<T[]>;
|
|
13
12
|
/** A default `newContext` that assumes `ctx.em` is where the `EntityManager` lives. */
|
|
14
13
|
export declare function newContext<C extends Context>(ctx: C): C;
|
|
15
|
-
//#endregion
|
|
16
14
|
export {};
|
|
17
15
|
//# sourceMappingURL=run.d.mts.map
|
package/build/run.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.mts","names":[],"sources":["../src/run.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.mts","names":[],"sources":["../src/run.ts"],"mappings":";KAMK,aAAa,KAAK,IAAI,QAAQ;YAEvB,UAAU,MAAM,KAAK,MAAM,aAAa;;wBAO9B,IAAI,UAAU,SAAS,GAC3C,KAAK,GACL,KAAK,KAAK,MAAM,aAAa,IAC7B,YAAW,UAAU,KACpB,QAAQ;;wBAsBK,QAAQ,UAAU,SAChC,WAAW,UAAU,MACnB,GAAG,KAAK,GAAG,KAAK,KAAK,MAAM,aAAa,OAAO,QAAQ;;wBAKrC,QAAQ,UAAU,SAAS,GAAG,GAClD,KAAK,GACL,gBAAgB,KAChB,KAAK,KAAK,GAAG,OAAO,MAAM,aAAa,IACvC,YAAW,UAAU,KACpB,QAAQ;;wBAgBK,YAAY,UAAU,SACpC,WAAW,UAAU,MACnB,GAAG,GAAG,KAAK,GAAG,gBAAgB,KAAK,KAAK,KAAK,GAAG,OAAO,MAAM,aAAa,OAAO,QAAQ;;wBAK7E,WAAW,UAAU,SAAS,KAAK,IAAI"}
|
package/build/run.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RunPlugin } from "./RunPlugin.js";
|
|
2
1
|
import "./context.js";
|
|
2
|
+
import { RunPlugin } from "./RunPlugin.js";
|
|
3
3
|
import { EntityManager, isEntity } from "joist-core";
|
|
4
4
|
import { fail } from "joist-utils";
|
|
5
|
-
|
|
5
|
+
// src/run.ts
|
|
6
6
|
let flushPromise;
|
|
7
7
|
let flushEm;
|
|
8
8
|
/** Runs the `fn` in a dedicated / non-test Unit of Work . */
|
|
@@ -66,7 +66,6 @@ function mapResultToOriginalEm(em, result) {
|
|
|
66
66
|
return obj;
|
|
67
67
|
} else return result;
|
|
68
68
|
}
|
|
69
|
-
//#endregion
|
|
70
69
|
export { makeRun, makeRunEach, newContext, run, runEach };
|
|
71
70
|
|
|
72
71
|
//# sourceMappingURL=run.js.map
|
package/build/seed.cjs
CHANGED
|
@@ -4,7 +4,7 @@ let joist_core = require("joist-core");
|
|
|
4
4
|
require("dotenv/config");
|
|
5
5
|
let pg = require("pg");
|
|
6
6
|
pg = require_runtime.__toESM(pg, 1);
|
|
7
|
-
|
|
7
|
+
// src/seed.ts
|
|
8
8
|
/**
|
|
9
9
|
* Allows easily seeding your local database with test data from the factories.
|
|
10
10
|
*
|
|
@@ -48,7 +48,6 @@ function seed(config, fn) {
|
|
|
48
48
|
process.exit(1);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
//#endregion
|
|
52
51
|
exports.seed = seed;
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=seed.cjs.map
|
package/build/seed.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Driver, EntityManager } from "joist-core";
|
|
2
2
|
import "dotenv/config";
|
|
3
3
|
import pg from "pg";
|
|
4
|
-
//#region src/seed.d.ts
|
|
5
4
|
export interface SeedConfig {
|
|
6
5
|
/** A factory function to create a Driver from a pg Pool. */
|
|
7
6
|
createDriver: (pool: pg.Pool) => Driver;
|
|
@@ -30,5 +29,4 @@ export interface SeedConfig {
|
|
|
30
29
|
* ```
|
|
31
30
|
*/
|
|
32
31
|
export declare function seed<E extends EntityManager = EntityManager>(config: SeedConfig, fn: (em: E) => Promise<void>): void;
|
|
33
|
-
//#endregion
|
|
34
32
|
//# sourceMappingURL=seed.d.cts.map
|
package/build/seed.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.d.cts","names":[],"sources":["../src/seed.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"seed.d.cts","names":[],"sources":["../src/seed.ts"],"mappings":";;;iBAIiB;;EAEf,eAAe,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BnB,KAAK,UAAU,gBAAgB,eAAe,QAAQ,YAAY,KAAK,IAAI,MAAM"}
|
package/build/seed.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Driver, EntityManager } from "joist-core";
|
|
2
2
|
import "dotenv/config";
|
|
3
3
|
import pg from "pg";
|
|
4
|
-
//#region src/seed.d.ts
|
|
5
4
|
export interface SeedConfig {
|
|
6
5
|
/** A factory function to create a Driver from a pg Pool. */
|
|
7
6
|
createDriver: (pool: pg.Pool) => Driver;
|
|
@@ -30,5 +29,4 @@ export interface SeedConfig {
|
|
|
30
29
|
* ```
|
|
31
30
|
*/
|
|
32
31
|
export declare function seed<E extends EntityManager = EntityManager>(config: SeedConfig, fn: (em: E) => Promise<void>): void;
|
|
33
|
-
//#endregion
|
|
34
32
|
//# sourceMappingURL=seed.d.mts.map
|
package/build/seed.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.d.mts","names":[],"sources":["../src/seed.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"seed.d.mts","names":[],"sources":["../src/seed.ts"],"mappings":";;;iBAIiB;;EAEf,eAAe,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BnB,KAAK,UAAU,gBAAgB,eAAe,QAAQ,YAAY,KAAK,IAAI,MAAM"}
|
package/build/seed.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EntityManager, newPgConnectionConfig } from "joist-core";
|
|
2
2
|
import "dotenv/config";
|
|
3
3
|
import pg from "pg";
|
|
4
|
-
|
|
4
|
+
// src/seed.ts
|
|
5
5
|
/**
|
|
6
6
|
* Allows easily seeding your local database with test data from the factories.
|
|
7
7
|
*
|
|
@@ -45,7 +45,6 @@ function seed(config, fn) {
|
|
|
45
45
|
process.exit(1);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
//#endregion
|
|
49
48
|
export { seed };
|
|
50
49
|
|
|
51
50
|
//# sourceMappingURL=seed.js.map
|
package/build/toMatchEntity.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
require("./index.cjs");
|
|
3
3
|
let joist_core = require("joist-core");
|
|
4
4
|
let joist_utils = require("joist-utils");
|
|
5
|
-
|
|
5
|
+
// src/toMatchEntity.ts
|
|
6
6
|
const isVitest = typeof process !== "undefined" && process.env?.VITEST === "true";
|
|
7
7
|
/**
|
|
8
8
|
* Provides convenient `toMatchObject`-style matching for Joist entities.
|
|
@@ -88,7 +88,6 @@ function getWithSoftDeleted(relation) {
|
|
|
88
88
|
const r = "getWithDeleted" in relation ? relation.getWithDeleted : relation.get;
|
|
89
89
|
return Array.isArray(r) ? r.filter((e) => !e.isDeletedEntity) : r;
|
|
90
90
|
}
|
|
91
|
-
//#endregion
|
|
92
91
|
exports.toMatchEntity = toMatchEntity;
|
|
93
92
|
|
|
94
93
|
//# sourceMappingURL=toMatchEntity.cjs.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CustomMatcherResult } from "./index.cjs";
|
|
2
2
|
import { Entity, Property, ReadOnlyCollection, Reference } from "joist-core";
|
|
3
|
-
//#region src/toMatchEntity.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Provides convenient `toMatchObject`-style matching for Joist entities.
|
|
6
5
|
*
|
|
@@ -23,5 +22,4 @@ export declare function toMatchEntity<T>(this: any, actual: unknown, expected: M
|
|
|
23
22
|
*/
|
|
24
23
|
export type MatchedEntity<T> = T extends ReadonlyArray<infer U> ? ReadonlyArray<MatchedEntity<U>> : undefined | T | { [K in keyof T]?: T[K] extends Reference<any, infer U, any> ? MatchedEntity<U> | U : T[K] extends ReadOnlyCollection<any, infer U> ? Array<MatchedEntity<U> | U> : T[K] extends Property<any, infer V> ? V : T[K] extends Entity | null | undefined ? MatchedEntity<T[K]> | T[K] | null | undefined : T[K] extends ReadonlyArray<(infer U) | undefined> ? readonly (MatchedEntity<U> | U | undefined)[] : T[K] extends ReadonlyArray<infer U> | null ? readonly (MatchedEntity<U> | U | null)[] // We recurse similar to a DeepPartial
|
|
25
24
|
: MatchedEntity<T[K]> | null; };
|
|
26
|
-
//#endregion
|
|
27
25
|
//# sourceMappingURL=toMatchEntity.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toMatchEntity.d.cts","names":[],"sources":["../src/toMatchEntity.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toMatchEntity.d.cts","names":[],"sources":["../src/toMatchEntity.ts"],"mappings":";;;;;;;;;;;;wBAoCgB,cAAc,GAAG,WAAW,iBAAiB,UAAU,cAAc,KAAK;;;;;;;;;;YAmE9E,cAAc,KACxB,UAAU,oBAAoB,KAC1B,cAAc,cAAc,kBAGxB,OAEG,WAAW,KAAK,EAAE,WAAW,qBAAqB,UAC/C,cAAc,KAAK,IACnB,EAAE,WAAW,8BAA8B,KACzC,MAAM,cAAc,KAAK,KACzB,EAAE,WAAW,oBAAoB,KAC/B,IACA,EAAE,WAAW,4BACX,cAAc,EAAE,MAAM,EAAE,wBACxB,EAAE,WAAW,qBAAqB,4BACtB,cAAc,KAAK,mBAC7B,EAAE,WAAW,oBAAoB,sBACrB,cAAc,KAAK;GAE7B,cAAc,EAAE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CustomMatcherResult } from "./index.mjs";
|
|
2
2
|
import { Entity, Property, ReadOnlyCollection, Reference } from "joist-core";
|
|
3
|
-
//#region src/toMatchEntity.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Provides convenient `toMatchObject`-style matching for Joist entities.
|
|
6
5
|
*
|
|
@@ -23,5 +22,4 @@ export declare function toMatchEntity<T>(this: any, actual: unknown, expected: M
|
|
|
23
22
|
*/
|
|
24
23
|
export type MatchedEntity<T> = T extends ReadonlyArray<infer U> ? ReadonlyArray<MatchedEntity<U>> : undefined | T | { [K in keyof T]?: T[K] extends Reference<any, infer U, any> ? MatchedEntity<U> | U : T[K] extends ReadOnlyCollection<any, infer U> ? Array<MatchedEntity<U> | U> : T[K] extends Property<any, infer V> ? V : T[K] extends Entity | null | undefined ? MatchedEntity<T[K]> | T[K] | null | undefined : T[K] extends ReadonlyArray<(infer U) | undefined> ? readonly (MatchedEntity<U> | U | undefined)[] : T[K] extends ReadonlyArray<infer U> | null ? readonly (MatchedEntity<U> | U | null)[] // We recurse similar to a DeepPartial
|
|
25
24
|
: MatchedEntity<T[K]> | null; };
|
|
26
|
-
//#endregion
|
|
27
25
|
//# sourceMappingURL=toMatchEntity.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toMatchEntity.d.mts","names":[],"sources":["../src/toMatchEntity.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toMatchEntity.d.mts","names":[],"sources":["../src/toMatchEntity.ts"],"mappings":";;;;;;;;;;;;wBAoCgB,cAAc,GAAG,WAAW,iBAAiB,UAAU,cAAc,KAAK;;;;;;;;;;YAmE9E,cAAc,KACxB,UAAU,oBAAoB,KAC1B,cAAc,cAAc,kBAGxB,OAEG,WAAW,KAAK,EAAE,WAAW,qBAAqB,UAC/C,cAAc,KAAK,IACnB,EAAE,WAAW,8BAA8B,KACzC,MAAM,cAAc,KAAK,KACzB,EAAE,WAAW,oBAAoB,KAC/B,IACA,EAAE,WAAW,4BACX,cAAc,EAAE,MAAM,EAAE,wBACxB,EAAE,WAAW,qBAAqB,4BACtB,cAAc,KAAK,mBAC7B,EAAE,WAAW,oBAAoB,sBACrB,cAAc,KAAK;GAE7B,cAAc,EAAE"}
|
package/build/toMatchEntity.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./index.js";
|
|
2
2
|
import { BaseEntity, isAsyncProperty, isCollection, isDefined, isEntity, isLazyField, isProperty, isReactiveField, isReference } from "joist-core";
|
|
3
3
|
import { isPlainObject } from "joist-utils";
|
|
4
|
-
|
|
4
|
+
// src/toMatchEntity.ts
|
|
5
5
|
const isVitest = typeof process !== "undefined" && process.env?.VITEST === "true";
|
|
6
6
|
/**
|
|
7
7
|
* Provides convenient `toMatchObject`-style matching for Joist entities.
|
|
@@ -87,7 +87,6 @@ function getWithSoftDeleted(relation) {
|
|
|
87
87
|
const r = "getWithDeleted" in relation ? relation.getWithDeleted : relation.get;
|
|
88
88
|
return Array.isArray(r) ? r.filter((e) => !e.isDeletedEntity) : r;
|
|
89
89
|
}
|
|
90
|
-
//#endregion
|
|
91
90
|
export { toMatchEntity };
|
|
92
91
|
|
|
93
92
|
//# sourceMappingURL=toMatchEntity.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "joist-test-utils",
|
|
3
|
-
"version": "2.5.0-next.
|
|
3
|
+
"version": "2.5.0-next.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.cjs",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"dotenv": "^18.0.9"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"joist-core": "2.5.0-next.
|
|
38
|
-
"joist-utils": "2.5.0-next.
|
|
37
|
+
"joist-core": "2.5.0-next.11",
|
|
38
|
+
"joist-utils": "2.5.0-next.11",
|
|
39
39
|
"pg": "^8.23.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@swc/core": "1.16.
|
|
42
|
+
"@swc/core": "1.16.21",
|
|
43
43
|
"@swc/jest": "^0.2.39",
|
|
44
44
|
"@types/jest": "^30.0.0",
|
|
45
45
|
"jest": "30.4.2",
|