joist-graphql-resolver-utils 2.4.0 → 2.5.0-next.10
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/context.d.cts +2 -5
- package/build/context.d.cts.map +1 -1
- package/build/context.d.mts +2 -5
- package/build/context.d.mts.map +1 -1
- package/build/cursorPagination.cjs +1 -2
- package/build/cursorPagination.cjs.map +1 -1
- package/build/cursorPagination.d.cts +4 -6
- package/build/cursorPagination.d.cts.map +1 -1
- package/build/cursorPagination.d.mts +4 -6
- package/build/cursorPagination.d.mts.map +1 -1
- package/build/cursorPagination.js +1 -2
- package/build/cursorPagination.js.map +1 -1
- package/build/entityResolver.cjs +1 -2
- package/build/entityResolver.d.cts +3 -5
- package/build/entityResolver.d.cts.map +1 -1
- package/build/entityResolver.d.mts +3 -5
- package/build/entityResolver.d.mts.map +1 -1
- package/build/entityResolver.js +1 -2
- package/build/hint.cjs +1 -2
- package/build/hint.d.cts +3 -6
- package/build/hint.d.cts.map +1 -1
- package/build/hint.d.mts +3 -6
- package/build/hint.d.mts.map +1 -1
- package/build/hint.js +1 -2
- package/build/index.cjs +1 -1
- package/build/index.js +1 -1
- package/build/limitPagination.cjs +1 -2
- package/build/limitPagination.cjs.map +1 -1
- package/build/limitPagination.d.cts +4 -6
- package/build/limitPagination.d.cts.map +1 -1
- package/build/limitPagination.d.mts +4 -6
- package/build/limitPagination.d.mts.map +1 -1
- package/build/limitPagination.js +1 -2
- package/build/limitPagination.js.map +1 -1
- package/build/makeRunInputMutation.cjs +1 -2
- package/build/makeRunInputMutation.d.cts +3 -5
- package/build/makeRunInputMutation.d.cts.map +1 -1
- package/build/makeRunInputMutation.d.mts +3 -5
- package/build/makeRunInputMutation.d.mts.map +1 -1
- package/build/makeRunInputMutation.js +1 -2
- package/build/makeRunObjectField.cjs +1 -2
- package/build/makeRunObjectField.d.cts +3 -5
- package/build/makeRunObjectField.d.cts.map +1 -1
- package/build/makeRunObjectField.d.mts +3 -5
- package/build/makeRunObjectField.d.mts.map +1 -1
- package/build/makeRunObjectField.js +1 -2
- package/build/makeRunObjectFields.cjs +1 -2
- package/build/makeRunObjectFields.d.cts +3 -5
- package/build/makeRunObjectFields.d.cts.map +1 -1
- package/build/makeRunObjectFields.d.mts +3 -5
- package/build/makeRunObjectFields.d.mts.map +1 -1
- package/build/makeRunObjectFields.js +1 -2
- package/build/makeRunQuery.cjs +1 -2
- package/build/makeRunQuery.d.cts +3 -5
- package/build/makeRunQuery.d.cts.map +1 -1
- package/build/makeRunQuery.d.mts +3 -5
- package/build/makeRunQuery.d.mts.map +1 -1
- package/build/makeRunQuery.js +1 -2
- package/build/paginationUtils.cjs +1 -2
- package/build/paginationUtils.d.cts +6 -9
- package/build/paginationUtils.d.cts.map +1 -1
- package/build/paginationUtils.d.mts +6 -9
- package/build/paginationUtils.d.mts.map +1 -1
- package/build/paginationUtils.js +1 -2
- package/build/saveEntity.cjs +1 -2
- package/build/saveEntity.d.cts +2 -5
- package/build/saveEntity.d.cts.map +1 -1
- package/build/saveEntity.d.mts +2 -5
- package/build/saveEntity.d.mts.map +1 -1
- package/build/saveEntity.js +1 -2
- package/build/tests.d.cts +1 -1
- package/build/tests.d.mts +1 -1
- package/build/typeUtils.d.cts +4 -7
- package/build/typeUtils.d.cts.map +1 -1
- package/build/typeUtils.d.mts +4 -7
- package/build/typeUtils.d.mts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitPagination.js","names":[
|
|
1
|
+
{"version":3,"file":"limitPagination.js","names":[],"sources":["../src/limitPagination.ts"],"sourcesContent":["import { type Entity, type MaybeAbstractEntityConstructor } from \"joist-core\";\n\nimport {\n type ContextWithEm,\n type PaginationFilter,\n type PaginationQuery,\n countQuery,\n defaultLimit,\n queryEntities,\n} from \"./paginationUtils.ts\";\n\ntype LimitArgs<T extends Entity, F extends object = PaginationFilter<T>> = {\n filter?: F | null;\n limit?: number | null;\n offset?: number | null;\n};\ntype Page = { offset: number; limit: number };\n\n/** Returns a limit/offset page shape for a resolver, preserving the entity query's ordering. */\nexport function paginateLimit<T extends Entity>(\n ctx: ContextWithEm,\n query: PaginationQuery<T>,\n args: Omit<LimitArgs<T>, \"filter\">,\n): Promise<{ entities: T[]; pageInfo: LimitPageInfo<T> }>;\nexport function paginateLimit<T extends Entity, F extends object = PaginationFilter<T>>(\n ctx: ContextWithEm,\n type: MaybeAbstractEntityConstructor<T>,\n args: LimitArgs<T, F>,\n): Promise<{ entities: T[]; pageInfo: LimitPageInfo<T> }>;\nexport async function paginateLimit<T extends Entity, F extends object = PaginationFilter<T>>(\n ctx: ContextWithEm,\n type: MaybeAbstractEntityConstructor<T> | PaginationQuery<T>,\n args: LimitArgs<T, F>,\n): Promise<{ entities: T[]; pageInfo: LimitPageInfo<T> }> {\n const limit = args.limit ?? defaultLimit;\n const offset = args.offset ?? 0;\n const filter = (args.filter ?? {}) as PaginationFilter<T>;\n const entities =\n typeof type === \"function\"\n ? await ctx.em.findGql(type, filter, { limit, offset })\n : await queryEntities<T>(ctx, { ...type, limit, offset });\n return { entities, pageInfo: new LimitPageInfo(ctx, type, filter, { limit, offset }) };\n}\n\n/** Lazily computes limit/offset page fields. */\nexport class LimitPageInfo<T extends Entity = Entity> {\n #ctx: ContextWithEm;\n #filter: PaginationFilter<T>;\n #page: Page;\n #totalCountPromise: Promise<number> | undefined;\n #type: MaybeAbstractEntityConstructor<T> | PaginationQuery<T>;\n\n constructor(\n ctx: ContextWithEm,\n type: MaybeAbstractEntityConstructor<T> | PaginationQuery<T>,\n filter: PaginationFilter<T>,\n page: Page,\n ) {\n this.#ctx = ctx;\n this.#type = type;\n this.#filter = filter;\n this.#page = page;\n }\n\n get hasNextPage(): Promise<boolean> {\n return this.#hasNextPage();\n }\n\n get hasPreviousPage(): boolean {\n return this.#page.offset > 0;\n }\n\n get totalCount(): Promise<number> {\n return (this.#totalCountPromise ??=\n typeof this.#type === \"function\"\n ? this.#ctx.em.findCount(this.#type, this.#filter)\n : countQuery(this.#ctx, this.#type));\n }\n\n get nextPage(): Promise<number | undefined> {\n return this.#nextPage();\n }\n\n get currentPage(): number {\n return Math.floor(this.#page.offset / this.#page.limit) + 1;\n }\n\n /** Returns whether another page exists after this page. */\n async #hasNextPage(): Promise<boolean> {\n const total = await this.totalCount;\n const { offset, limit } = this.#page;\n return offset + limit < total;\n }\n\n /** Returns the next limit/offset page if there is one. */\n async #nextPage(): Promise<number | undefined> {\n if (!(await this.hasNextPage)) return undefined;\n return this.currentPage + 1;\n }\n}\n"],"mappings":";;;AA6BA,eAAsB,cACpB,KACA,MACA,MACwD;CACxD,MAAM,QAAQ,KAAK,SAAA;CACnB,MAAM,SAAS,KAAK,UAAU;CAC9B,MAAM,SAAU,KAAK,UAAU,CAAC;CAKhC,OAAO;EAAE,UAHP,OAAO,SAAS,aACZ,MAAM,IAAI,GAAG,QAAQ,MAAM,QAAQ;GAAE;GAAO;EAAO,CAAC,IACpD,MAAM,cAAiB,KAAK;GAAE,GAAG;GAAM;GAAO;EAAO,CAAC;EACzC,UAAU,IAAI,cAAc,KAAK,MAAM,QAAQ;GAAE;GAAO;EAAO,CAAC;CAAE;AACvF;;AAGA,IAAa,gBAAb,MAAsD;CACpD;CACA;CACA;CACA;CACA;CAEA,YACE,KACA,MACA,QACA,MACA;EACA,KAAK,OAAO;EACZ,KAAK,QAAQ;EACb,KAAK,UAAU;EACf,KAAK,QAAQ;CACf;CAEA,IAAI,cAAgC;EAClC,OAAO,KAAK,aAAa;CAC3B;CAEA,IAAI,kBAA2B;EAC7B,OAAO,KAAK,MAAM,SAAS;CAC7B;CAEA,IAAI,aAA8B;EAChC,OAAQ,KAAK,uBACX,OAAO,KAAK,UAAU,aAClB,KAAK,KAAK,GAAG,UAAU,KAAK,OAAO,KAAK,OAAO,IAC/C,WAAW,KAAK,MAAM,KAAK,KAAK;CACxC;CAEA,IAAI,WAAwC;EAC1C,OAAO,KAAK,UAAU;CACxB;CAEA,IAAI,cAAsB;EACxB,OAAO,KAAK,MAAM,KAAK,MAAM,SAAS,KAAK,MAAM,KAAK,IAAI;CAC5D;;CAGA,MAAM,eAAiC;EACrC,MAAM,QAAQ,MAAM,KAAK;EACzB,MAAM,EAAE,QAAQ,UAAU,KAAK;EAC/B,OAAO,SAAS,QAAQ;CAC1B;;CAGA,MAAM,YAAyC;EAC7C,IAAI,CAAE,MAAM,KAAK,aAAc,OAAO,KAAA;EACtC,OAAO,KAAK,cAAc;CAC5B;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./context.cjs");
|
|
3
3
|
require("./typeUtils.cjs");
|
|
4
|
-
|
|
4
|
+
// src/makeRunInputMutation.ts
|
|
5
5
|
/**
|
|
6
6
|
* Creates a `makeRunInputMutation` function for each project's `testUtils` file.
|
|
7
7
|
*
|
|
@@ -15,7 +15,6 @@ function makeMakeRunInputMutation(runFn) {
|
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
exports.makeMakeRunInputMutation = makeMakeRunInputMutation;
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=makeRunInputMutation.cjs.map
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { Resolver } from "./context.cjs";
|
|
2
2
|
import { ResolverResult, RunFn } from "./typeUtils.cjs";
|
|
3
|
-
//#region src/makeRunInputMutation.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Creates a `makeRunInputMutation` function for each project's `testUtils` file.
|
|
6
5
|
*
|
|
7
6
|
* This is called `makeMake` because it's a factory for each project's `testUtils` to make its own factory
|
|
8
7
|
* that is customized (basically curried) to their own `newContext` function.
|
|
9
8
|
*/
|
|
10
|
-
declare function makeMakeRunInputMutation<C>(runFn: RunFn<C>): MakeRunInputMutation<C>;
|
|
9
|
+
export declare function makeMakeRunInputMutation<C>(runFn: RunFn<C>): MakeRunInputMutation<C>;
|
|
11
10
|
/**
|
|
12
11
|
* Creates a `run` method to invoke a mutation resolver that uses the `input` convention.
|
|
13
12
|
*
|
|
14
13
|
* Following our `mutation / foo` conventions, `resolver` will have a single `fooResolver.foo` method.
|
|
15
14
|
*/
|
|
16
|
-
type MakeRunInputMutation<C> = <T extends object>(resolver: T) => RunInputMutationMethod<C, T>;
|
|
15
|
+
export type MakeRunInputMutation<C> = <T extends object>(resolver: T) => RunInputMutationMethod<C, T>;
|
|
17
16
|
type RunInputMutationMethod<C, T> = <I extends MutationInput<T>, R = ResolverResult<T, keyof T>>(ctx: C, input: I | (() => I)) => Promise<R>;
|
|
18
17
|
/** Matches a mutation resolver that has a single `input` field. */
|
|
19
18
|
type MutationInput<T> = T[keyof T] extends Resolver<any, {
|
|
20
19
|
input: infer I;
|
|
21
20
|
}, any> ? I : never;
|
|
22
|
-
|
|
23
|
-
export { MakeRunInputMutation, makeMakeRunInputMutation };
|
|
21
|
+
export {};
|
|
24
22
|
//# sourceMappingURL=makeRunInputMutation.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeRunInputMutation.d.cts","names":[],"sources":["../src/makeRunInputMutation.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeRunInputMutation.d.cts","names":[],"sources":["../src/makeRunInputMutation.ts"],"mappings":";;;;;;;;wBASgB,yBAAyB,GAAG,OAAO,MAAM,KAAK,qBAAqB;;;;;;YAoBvE,qBAAqB,MAAM,kBAAkB,UAAU,MAAM,uBAAuB,GAAG;KAE9F,uBAAuB,GAAG,MAAM,UAAU,cAAc,IAAI,IAAI,eAAe,SAAS,IAC3F,KAAK,GACL,OAAO,WAAW,OACf,QAAQ;;KAGR,cAAc,KAAK,QAAQ,WAAW;EAAgB,aAAa;UAAY"}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { Resolver } from "./context.mjs";
|
|
2
2
|
import { ResolverResult, RunFn } from "./typeUtils.mjs";
|
|
3
|
-
//#region src/makeRunInputMutation.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Creates a `makeRunInputMutation` function for each project's `testUtils` file.
|
|
6
5
|
*
|
|
7
6
|
* This is called `makeMake` because it's a factory for each project's `testUtils` to make its own factory
|
|
8
7
|
* that is customized (basically curried) to their own `newContext` function.
|
|
9
8
|
*/
|
|
10
|
-
declare function makeMakeRunInputMutation<C>(runFn: RunFn<C>): MakeRunInputMutation<C>;
|
|
9
|
+
export declare function makeMakeRunInputMutation<C>(runFn: RunFn<C>): MakeRunInputMutation<C>;
|
|
11
10
|
/**
|
|
12
11
|
* Creates a `run` method to invoke a mutation resolver that uses the `input` convention.
|
|
13
12
|
*
|
|
14
13
|
* Following our `mutation / foo` conventions, `resolver` will have a single `fooResolver.foo` method.
|
|
15
14
|
*/
|
|
16
|
-
type MakeRunInputMutation<C> = <T extends object>(resolver: T) => RunInputMutationMethod<C, T>;
|
|
15
|
+
export type MakeRunInputMutation<C> = <T extends object>(resolver: T) => RunInputMutationMethod<C, T>;
|
|
17
16
|
type RunInputMutationMethod<C, T> = <I extends MutationInput<T>, R = ResolverResult<T, keyof T>>(ctx: C, input: I | (() => I)) => Promise<R>;
|
|
18
17
|
/** Matches a mutation resolver that has a single `input` field. */
|
|
19
18
|
type MutationInput<T> = T[keyof T] extends Resolver<any, {
|
|
20
19
|
input: infer I;
|
|
21
20
|
}, any> ? I : never;
|
|
22
|
-
|
|
23
|
-
export { MakeRunInputMutation, makeMakeRunInputMutation };
|
|
21
|
+
export {};
|
|
24
22
|
//# sourceMappingURL=makeRunInputMutation.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeRunInputMutation.d.mts","names":[],"sources":["../src/makeRunInputMutation.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeRunInputMutation.d.mts","names":[],"sources":["../src/makeRunInputMutation.ts"],"mappings":";;;;;;;;wBASgB,yBAAyB,GAAG,OAAO,MAAM,KAAK,qBAAqB;;;;;;YAoBvE,qBAAqB,MAAM,kBAAkB,UAAU,MAAM,uBAAuB,GAAG;KAE9F,uBAAuB,GAAG,MAAM,UAAU,cAAc,IAAI,IAAI,eAAe,SAAS,IAC3F,KAAK,GACL,OAAO,WAAW,OACf,QAAQ;;KAGR,cAAc,KAAK,QAAQ,WAAW;EAAgB,aAAa;UAAY"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./context.js";
|
|
2
2
|
import "./typeUtils.js";
|
|
3
|
-
|
|
3
|
+
// src/makeRunInputMutation.ts
|
|
4
4
|
/**
|
|
5
5
|
* Creates a `makeRunInputMutation` function for each project's `testUtils` file.
|
|
6
6
|
*
|
|
@@ -14,7 +14,6 @@ function makeMakeRunInputMutation(runFn) {
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { makeMakeRunInputMutation };
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=makeRunInputMutation.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./typeUtils.cjs");
|
|
3
3
|
let joist_core = require("joist-core");
|
|
4
|
-
|
|
4
|
+
// src/makeRunObjectField.ts
|
|
5
5
|
/**
|
|
6
6
|
* Creates a `makeRunObjectField` function for each project's `testUtils` file.
|
|
7
7
|
*
|
|
@@ -16,7 +16,6 @@ function makeMakeRunObjectField(runFn) {
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
exports.makeMakeRunObjectField = makeMakeRunObjectField;
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=makeRunObjectField.cjs.map
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { ResolverArgs, ResolverResult, ResolverRoot, RunFn } from "./typeUtils.cjs";
|
|
2
|
-
//#region src/makeRunObjectField.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a `makeRunObjectField` function for each project's `testUtils` file.
|
|
5
4
|
*
|
|
6
5
|
* This is called `makeMake` because it's a factory for each project's `testUtils` to make its own factory
|
|
7
6
|
* that is customized (basically curried) to their own `newContext` function.
|
|
8
7
|
*/
|
|
9
|
-
declare function makeMakeRunObjectField<C>(runFn: RunFn<C>): MakeRunObjectField<C>;
|
|
8
|
+
export declare function makeMakeRunObjectField<C>(runFn: RunFn<C>): MakeRunObjectField<C>;
|
|
10
9
|
/** Creates a `run` method to invoke a single field resolver with that field's args. */
|
|
11
|
-
type MakeRunObjectField<C> = <T extends object, R extends ResolverRoot<T>>(resolvers: T) => RunObjectFieldMethod<C, T, R>;
|
|
10
|
+
export type MakeRunObjectField<C> = <T extends object, R extends ResolverRoot<T>>(resolvers: T) => RunObjectFieldMethod<C, T, R>;
|
|
12
11
|
/** The return type of `makeRunObject`. */
|
|
13
12
|
type RunObjectFieldMethod<C, T, R> = <K extends keyof T, A extends ResolverArgs<T, K>>(ctx: C, root: R, key: K, args?: A | ((root: R) => A)) => Promise<ResolverResult<T, K>>;
|
|
14
|
-
|
|
15
|
-
export { MakeRunObjectField, makeMakeRunObjectField };
|
|
13
|
+
export {};
|
|
16
14
|
//# sourceMappingURL=makeRunObjectField.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeRunObjectField.d.cts","names":[],"sources":["../src/makeRunObjectField.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeRunObjectField.d.cts","names":[],"sources":["../src/makeRunObjectField.ts"],"mappings":";;;;;;;wBAUgB,uBAAuB,GAAG,OAAO,MAAM,KAAK,mBAAmB;;YAYnE,mBAAmB,MAAM,kBAAkB,UAAU,aAAa,IAC5E,WAAW,MACR,qBAAqB,GAAG,GAAG;;KAG3B,qBAAqB,GAAG,GAAG,MAAM,gBAAgB,GAAG,UAAU,aAAa,GAAG,IACjF,KAAK,GACL,MAAM,GACN,KAAK,GAEL,OAAO,MAAM,MAAM,MAAM,OACtB,QAAQ,eAAe,GAAG"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { ResolverArgs, ResolverResult, ResolverRoot, RunFn } from "./typeUtils.mjs";
|
|
2
|
-
//#region src/makeRunObjectField.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a `makeRunObjectField` function for each project's `testUtils` file.
|
|
5
4
|
*
|
|
6
5
|
* This is called `makeMake` because it's a factory for each project's `testUtils` to make its own factory
|
|
7
6
|
* that is customized (basically curried) to their own `newContext` function.
|
|
8
7
|
*/
|
|
9
|
-
declare function makeMakeRunObjectField<C>(runFn: RunFn<C>): MakeRunObjectField<C>;
|
|
8
|
+
export declare function makeMakeRunObjectField<C>(runFn: RunFn<C>): MakeRunObjectField<C>;
|
|
10
9
|
/** Creates a `run` method to invoke a single field resolver with that field's args. */
|
|
11
|
-
type MakeRunObjectField<C> = <T extends object, R extends ResolverRoot<T>>(resolvers: T) => RunObjectFieldMethod<C, T, R>;
|
|
10
|
+
export type MakeRunObjectField<C> = <T extends object, R extends ResolverRoot<T>>(resolvers: T) => RunObjectFieldMethod<C, T, R>;
|
|
12
11
|
/** The return type of `makeRunObject`. */
|
|
13
12
|
type RunObjectFieldMethod<C, T, R> = <K extends keyof T, A extends ResolverArgs<T, K>>(ctx: C, root: R, key: K, args?: A | ((root: R) => A)) => Promise<ResolverResult<T, K>>;
|
|
14
|
-
|
|
15
|
-
export { MakeRunObjectField, makeMakeRunObjectField };
|
|
13
|
+
export {};
|
|
16
14
|
//# sourceMappingURL=makeRunObjectField.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeRunObjectField.d.mts","names":[],"sources":["../src/makeRunObjectField.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeRunObjectField.d.mts","names":[],"sources":["../src/makeRunObjectField.ts"],"mappings":";;;;;;;wBAUgB,uBAAuB,GAAG,OAAO,MAAM,KAAK,mBAAmB;;YAYnE,mBAAmB,MAAM,kBAAkB,UAAU,aAAa,IAC5E,WAAW,MACR,qBAAqB,GAAG,GAAG;;KAG3B,qBAAqB,GAAG,GAAG,MAAM,gBAAgB,GAAG,UAAU,aAAa,GAAG,IACjF,KAAK,GACL,MAAM,GACN,KAAK,GAEL,OAAO,MAAM,MAAM,MAAM,OACtB,QAAQ,eAAe,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./typeUtils.js";
|
|
2
2
|
import { isEntity } from "joist-core";
|
|
3
|
-
|
|
3
|
+
// src/makeRunObjectField.ts
|
|
4
4
|
/**
|
|
5
5
|
* Creates a `makeRunObjectField` function for each project's `testUtils` file.
|
|
6
6
|
*
|
|
@@ -15,7 +15,6 @@ function makeMakeRunObjectField(runFn) {
|
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { makeMakeRunObjectField };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=makeRunObjectField.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./typeUtils.cjs");
|
|
3
3
|
let joist_core = require("joist-core");
|
|
4
|
-
|
|
4
|
+
// src/makeRunObjectFields.ts
|
|
5
5
|
/**
|
|
6
6
|
* Creates a `makeRunObjectFields` function for each project's `testUtils` file.
|
|
7
7
|
*
|
|
@@ -18,7 +18,6 @@ function makeMakeRunObjectFields(runFn) {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
exports.makeMakeRunObjectFields = makeMakeRunObjectFields;
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=makeRunObjectFields.cjs.map
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { ResolverResult, ResolverRoot, RunFn } from "./typeUtils.cjs";
|
|
2
|
-
//#region src/makeRunObjectFields.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a `makeRunObjectFields` function for each project's `testUtils` file.
|
|
5
4
|
*
|
|
6
5
|
* This is called `makeMake` because it's a factory for each project's `testUtils` to make its own factory
|
|
7
6
|
* that is customized (basically curried) to their own `newContext` function.
|
|
8
7
|
*/
|
|
9
|
-
declare function makeMakeRunObjectFields<C, T>(runFn: RunFn<C>): MakeRunObjectFields<C>;
|
|
8
|
+
export declare function makeMakeRunObjectFields<C, T>(runFn: RunFn<C>): MakeRunObjectFields<C>;
|
|
10
9
|
/** Creates a `run` method that can invoke multiple fields against an object resolver. */
|
|
11
|
-
type MakeRunObjectFields<C> = <T, R extends ResolverRoot<T>>(resolvers: T) => RunFieldsResolverMethod<C, T, R>;
|
|
10
|
+
export type MakeRunObjectFields<C> = <T, R extends ResolverRoot<T>>(resolvers: T) => RunFieldsResolverMethod<C, T, R>;
|
|
12
11
|
type RunFieldsResolverMethod<C, T, R extends ResolverRoot<T>> = <K extends (keyof T)[]>(ctx: C, root: R, keys: K) => Promise<{ [k in K[number]]: ResolverResult<T, k>; }>;
|
|
13
|
-
|
|
14
|
-
export { MakeRunObjectFields, makeMakeRunObjectFields };
|
|
12
|
+
export {};
|
|
15
13
|
//# sourceMappingURL=makeRunObjectFields.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeRunObjectFields.d.cts","names":[],"sources":["../src/makeRunObjectFields.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeRunObjectFields.d.cts","names":[],"sources":["../src/makeRunObjectFields.ts"],"mappings":";;;;;;;wBAUgB,wBAAwB,GAAG,GAAG,OAAO,MAAM,KAAK,oBAAoB;;YAgBxE,oBAAoB,MAAM,GAAG,UAAU,aAAa,IAAI,WAAW,MAAM,wBAAwB,GAAG,GAAG;KAG9G,wBAAwB,GAAG,GAAG,UAAU,aAAa,OAAO,iBAAiB,MAChF,KAAK,GACL,MAAM,GACN,MAAM,MACH,WAAW,KAAK,YAAY,eAAe,GAAG"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { ResolverResult, ResolverRoot, RunFn } from "./typeUtils.mjs";
|
|
2
|
-
//#region src/makeRunObjectFields.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a `makeRunObjectFields` function for each project's `testUtils` file.
|
|
5
4
|
*
|
|
6
5
|
* This is called `makeMake` because it's a factory for each project's `testUtils` to make its own factory
|
|
7
6
|
* that is customized (basically curried) to their own `newContext` function.
|
|
8
7
|
*/
|
|
9
|
-
declare function makeMakeRunObjectFields<C, T>(runFn: RunFn<C>): MakeRunObjectFields<C>;
|
|
8
|
+
export declare function makeMakeRunObjectFields<C, T>(runFn: RunFn<C>): MakeRunObjectFields<C>;
|
|
10
9
|
/** Creates a `run` method that can invoke multiple fields against an object resolver. */
|
|
11
|
-
type MakeRunObjectFields<C> = <T, R extends ResolverRoot<T>>(resolvers: T) => RunFieldsResolverMethod<C, T, R>;
|
|
10
|
+
export type MakeRunObjectFields<C> = <T, R extends ResolverRoot<T>>(resolvers: T) => RunFieldsResolverMethod<C, T, R>;
|
|
12
11
|
type RunFieldsResolverMethod<C, T, R extends ResolverRoot<T>> = <K extends (keyof T)[]>(ctx: C, root: R, keys: K) => Promise<{ [k in K[number]]: ResolverResult<T, k>; }>;
|
|
13
|
-
|
|
14
|
-
export { MakeRunObjectFields, makeMakeRunObjectFields };
|
|
12
|
+
export {};
|
|
15
13
|
//# sourceMappingURL=makeRunObjectFields.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeRunObjectFields.d.mts","names":[],"sources":["../src/makeRunObjectFields.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeRunObjectFields.d.mts","names":[],"sources":["../src/makeRunObjectFields.ts"],"mappings":";;;;;;;wBAUgB,wBAAwB,GAAG,GAAG,OAAO,MAAM,KAAK,oBAAoB;;YAgBxE,oBAAoB,MAAM,GAAG,UAAU,aAAa,IAAI,WAAW,MAAM,wBAAwB,GAAG,GAAG;KAG9G,wBAAwB,GAAG,GAAG,UAAU,aAAa,OAAO,iBAAiB,MAChF,KAAK,GACL,MAAM,GACN,MAAM,MACH,WAAW,KAAK,YAAY,eAAe,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./typeUtils.js";
|
|
2
2
|
import { isEntity } from "joist-core";
|
|
3
|
-
|
|
3
|
+
// src/makeRunObjectFields.ts
|
|
4
4
|
/**
|
|
5
5
|
* Creates a `makeRunObjectFields` function for each project's `testUtils` file.
|
|
6
6
|
*
|
|
@@ -17,7 +17,6 @@ function makeMakeRunObjectFields(runFn) {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { makeMakeRunObjectFields };
|
|
22
21
|
|
|
23
22
|
//# sourceMappingURL=makeRunObjectFields.js.map
|
package/build/makeRunQuery.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./typeUtils.cjs");
|
|
3
|
-
|
|
3
|
+
// src/makeRunQuery.ts
|
|
4
4
|
/**
|
|
5
5
|
* Creates a `makeRunQuery` function for each project's `testUtils` file.
|
|
6
6
|
*
|
|
@@ -14,7 +14,6 @@ function makeMakeRunQuery(runFn) {
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
exports.makeMakeRunQuery = makeMakeRunQuery;
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=makeRunQuery.cjs.map
|
package/build/makeRunQuery.d.cts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { ResolverArgs, ResolverResult, RunFn } from "./typeUtils.cjs";
|
|
2
|
-
//#region src/makeRunQuery.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a `makeRunQuery` function for each project's `testUtils` file.
|
|
5
4
|
*
|
|
6
5
|
* This is called `makeMake` because it's a factory for each project's `testUtils` to make its own factory
|
|
7
6
|
* that is customized (basically curried) to their own `newContext` function.
|
|
8
7
|
*/
|
|
9
|
-
declare function makeMakeRunQuery<C>(runFn: RunFn<C>): MakeRunQuery<C>;
|
|
8
|
+
export declare function makeMakeRunQuery<C>(runFn: RunFn<C>): MakeRunQuery<C>;
|
|
10
9
|
/**
|
|
11
10
|
* Creates a `run` method that invokes the query resolver's single query.
|
|
12
11
|
*
|
|
13
12
|
* Following our `query / foo` conventions, query resolver will have a single `fooResolver.foo` method.
|
|
14
13
|
*/
|
|
15
|
-
type MakeRunQuery<C> = <T extends object>(resolver: T) => RunQueryMethod<C, T>;
|
|
14
|
+
export type MakeRunQuery<C> = <T extends object>(resolver: T) => RunQueryMethod<C, T>;
|
|
16
15
|
/** The return type of `makeRunQuery`. */
|
|
17
16
|
type RunQueryMethod<C, T> = <A extends ResolverArgs<T, keyof T>>(ctx: C, args?: A | (() => A)) => Promise<ResolverResult<T, keyof T>>;
|
|
18
|
-
|
|
19
|
-
export { MakeRunQuery, makeMakeRunQuery };
|
|
17
|
+
export {};
|
|
20
18
|
//# sourceMappingURL=makeRunQuery.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeRunQuery.d.cts","names":[],"sources":["../src/makeRunQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeRunQuery.d.cts","names":[],"sources":["../src/makeRunQuery.ts"],"mappings":";;;;;;;wBAQgB,iBAAiB,GAAG,OAAO,MAAM,KAAK,aAAa;;;;;;YAevD,aAAa,MAAM,kBAAkB,UAAU,MAAM,eAAe,GAAG;;KAG9E,eAAe,GAAG,MAAM,UAAU,aAAa,SAAS,IAC3D,KAAK,GAEL,OAAO,WAAW,OACf,QAAQ,eAAe,SAAS"}
|
package/build/makeRunQuery.d.mts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { ResolverArgs, ResolverResult, RunFn } from "./typeUtils.mjs";
|
|
2
|
-
//#region src/makeRunQuery.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a `makeRunQuery` function for each project's `testUtils` file.
|
|
5
4
|
*
|
|
6
5
|
* This is called `makeMake` because it's a factory for each project's `testUtils` to make its own factory
|
|
7
6
|
* that is customized (basically curried) to their own `newContext` function.
|
|
8
7
|
*/
|
|
9
|
-
declare function makeMakeRunQuery<C>(runFn: RunFn<C>): MakeRunQuery<C>;
|
|
8
|
+
export declare function makeMakeRunQuery<C>(runFn: RunFn<C>): MakeRunQuery<C>;
|
|
10
9
|
/**
|
|
11
10
|
* Creates a `run` method that invokes the query resolver's single query.
|
|
12
11
|
*
|
|
13
12
|
* Following our `query / foo` conventions, query resolver will have a single `fooResolver.foo` method.
|
|
14
13
|
*/
|
|
15
|
-
type MakeRunQuery<C> = <T extends object>(resolver: T) => RunQueryMethod<C, T>;
|
|
14
|
+
export type MakeRunQuery<C> = <T extends object>(resolver: T) => RunQueryMethod<C, T>;
|
|
16
15
|
/** The return type of `makeRunQuery`. */
|
|
17
16
|
type RunQueryMethod<C, T> = <A extends ResolverArgs<T, keyof T>>(ctx: C, args?: A | (() => A)) => Promise<ResolverResult<T, keyof T>>;
|
|
18
|
-
|
|
19
|
-
export { MakeRunQuery, makeMakeRunQuery };
|
|
17
|
+
export {};
|
|
20
18
|
//# sourceMappingURL=makeRunQuery.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeRunQuery.d.mts","names":[],"sources":["../src/makeRunQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeRunQuery.d.mts","names":[],"sources":["../src/makeRunQuery.ts"],"mappings":";;;;;;;wBAQgB,iBAAiB,GAAG,OAAO,MAAM,KAAK,aAAa;;;;;;YAevD,aAAa,MAAM,kBAAkB,UAAU,MAAM,eAAe,GAAG;;KAG9E,eAAe,GAAG,MAAM,UAAU,aAAa,SAAS,IAC3D,KAAK,GAEL,OAAO,WAAW,OACf,QAAQ,eAAe,SAAS"}
|
package/build/makeRunQuery.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./typeUtils.js";
|
|
2
|
-
|
|
2
|
+
// src/makeRunQuery.ts
|
|
3
3
|
/**
|
|
4
4
|
* Creates a `makeRunQuery` function for each project's `testUtils` file.
|
|
5
5
|
*
|
|
@@ -13,7 +13,6 @@ function makeMakeRunQuery(runFn) {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { makeMakeRunQuery };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=makeRunQuery.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let joist_core = require("joist-core");
|
|
3
|
-
|
|
3
|
+
// src/paginationUtils.ts
|
|
4
4
|
const defaultLimit = 100;
|
|
5
5
|
/** Executes an entity selection after pagination has been applied. */
|
|
6
6
|
function queryEntities(ctx, base) {
|
|
@@ -26,7 +26,6 @@ async function countQuery(ctx, base) {
|
|
|
26
26
|
});
|
|
27
27
|
return result.count;
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
exports.countQuery = countQuery;
|
|
31
30
|
exports.defaultLimit = defaultLimit;
|
|
32
31
|
exports.queryEntities = queryEntities;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { Entity, EntityColumn, EntityManager, GraphQLFilterWithAlias, Query, QueryJoinList, TableFor } from "joist-core";
|
|
2
|
-
|
|
3
|
-
type ContextWithEm = {
|
|
2
|
+
export type ContextWithEm = {
|
|
4
3
|
em: EntityManager;
|
|
5
4
|
};
|
|
6
|
-
type PaginationFilter<T extends Entity> = GraphQLFilterWithAlias<T>;
|
|
7
|
-
type PaginationQuery<T extends Entity> = Query<TableFor<T> & {
|
|
5
|
+
export type PaginationFilter<T extends Entity> = GraphQLFilterWithAlias<T>;
|
|
6
|
+
export type PaginationQuery<T extends Entity> = Query<TableFor<T> & {
|
|
8
7
|
readonly id: EntityColumn<T, never, string>;
|
|
9
8
|
}, QueryJoinList>;
|
|
10
|
-
declare const defaultLimit = 100;
|
|
9
|
+
export declare const defaultLimit = 100;
|
|
11
10
|
/** Executes an entity selection after pagination has been applied. */
|
|
12
|
-
declare function queryEntities<T extends Entity>(ctx: ContextWithEm, base: PaginationQuery<T>): Promise<T[]>;
|
|
11
|
+
export declare function queryEntities<T extends Entity>(ctx: ContextWithEm, base: PaginationQuery<T>): Promise<T[]>;
|
|
13
12
|
/** Counts the unpaginated rows, preserving distinct, grouping, and join semantics. */
|
|
14
|
-
declare function countQuery<T extends Entity>(ctx: ContextWithEm, base: PaginationQuery<T>): Promise<number>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { ContextWithEm, PaginationFilter, PaginationQuery, countQuery, defaultLimit, queryEntities };
|
|
13
|
+
export declare function countQuery<T extends Entity>(ctx: ContextWithEm, base: PaginationQuery<T>): Promise<number>;
|
|
17
14
|
//# sourceMappingURL=paginationUtils.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginationUtils.d.cts","names":[],"sources":["../src/paginationUtils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"paginationUtils.d.cts","names":[],"sources":["../src/paginationUtils.ts"],"mappings":";YAYY;EAAkB,IAAI;;YACtB,iBAAiB,UAAU,UAAU,uBAAuB;YAC5D,gBAAgB,UAAU,UAAU,MAC9C,SAAS;WAAgB,IAAI,aAAa;GAC1C;qBAGW;;wBAGG,cAAc,UAAU,QAAQ,KAAK,eAAe,MAAM,gBAAgB,KAAK,QAAQ;;wBAMjF,WAAW,UAAU,QAAQ,KAAK,eAAe,MAAM,gBAAgB,KAAK"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { Entity, EntityColumn, EntityManager, GraphQLFilterWithAlias, Query, QueryJoinList, TableFor } from "joist-core";
|
|
2
|
-
|
|
3
|
-
type ContextWithEm = {
|
|
2
|
+
export type ContextWithEm = {
|
|
4
3
|
em: EntityManager;
|
|
5
4
|
};
|
|
6
|
-
type PaginationFilter<T extends Entity> = GraphQLFilterWithAlias<T>;
|
|
7
|
-
type PaginationQuery<T extends Entity> = Query<TableFor<T> & {
|
|
5
|
+
export type PaginationFilter<T extends Entity> = GraphQLFilterWithAlias<T>;
|
|
6
|
+
export type PaginationQuery<T extends Entity> = Query<TableFor<T> & {
|
|
8
7
|
readonly id: EntityColumn<T, never, string>;
|
|
9
8
|
}, QueryJoinList>;
|
|
10
|
-
declare const defaultLimit = 100;
|
|
9
|
+
export declare const defaultLimit = 100;
|
|
11
10
|
/** Executes an entity selection after pagination has been applied. */
|
|
12
|
-
declare function queryEntities<T extends Entity>(ctx: ContextWithEm, base: PaginationQuery<T>): Promise<T[]>;
|
|
11
|
+
export declare function queryEntities<T extends Entity>(ctx: ContextWithEm, base: PaginationQuery<T>): Promise<T[]>;
|
|
13
12
|
/** Counts the unpaginated rows, preserving distinct, grouping, and join semantics. */
|
|
14
|
-
declare function countQuery<T extends Entity>(ctx: ContextWithEm, base: PaginationQuery<T>): Promise<number>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { ContextWithEm, PaginationFilter, PaginationQuery, countQuery, defaultLimit, queryEntities };
|
|
13
|
+
export declare function countQuery<T extends Entity>(ctx: ContextWithEm, base: PaginationQuery<T>): Promise<number>;
|
|
17
14
|
//# sourceMappingURL=paginationUtils.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginationUtils.d.mts","names":[],"sources":["../src/paginationUtils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"paginationUtils.d.mts","names":[],"sources":["../src/paginationUtils.ts"],"mappings":";YAYY;EAAkB,IAAI;;YACtB,iBAAiB,UAAU,UAAU,uBAAuB;YAC5D,gBAAgB,UAAU,UAAU,MAC9C,SAAS;WAAgB,IAAI,aAAa;GAC1C;qBAGW;;wBAGG,cAAc,UAAU,QAAQ,KAAK,eAAe,MAAM,gBAAgB,KAAK,QAAQ;;wBAMjF,WAAW,UAAU,QAAQ,KAAK,eAAe,MAAM,gBAAgB,KAAK"}
|
package/build/paginationUtils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { query } from "joist-core";
|
|
2
|
-
|
|
2
|
+
// src/paginationUtils.ts
|
|
3
3
|
const defaultLimit = 100;
|
|
4
4
|
/** Executes an entity selection after pagination has been applied. */
|
|
5
5
|
function queryEntities(ctx, base) {
|
|
@@ -25,7 +25,6 @@ async function countQuery(ctx, base) {
|
|
|
25
25
|
});
|
|
26
26
|
return result.count;
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { countQuery, defaultLimit, queryEntities };
|
|
30
29
|
|
|
31
30
|
//# sourceMappingURL=paginationUtils.js.map
|
package/build/saveEntity.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let joist_core = require("joist-core");
|
|
3
3
|
require("joist-test-utils");
|
|
4
|
-
|
|
4
|
+
// src/saveEntity.ts
|
|
5
5
|
/** Given an GraphQL input, creates-or-updates an entity of `type`. */
|
|
6
6
|
async function saveEntity(ctx, type, input, opts = {}) {
|
|
7
7
|
return saveEntities(ctx, type, [input], opts).then((r) => r[0]);
|
|
@@ -17,7 +17,6 @@ async function saveEntities(ctx, type, input, opts = {}) {
|
|
|
17
17
|
if (flush) await ctx.em.flush();
|
|
18
18
|
return (0, joist_core.failIfAnyRejected)(results);
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
exports.saveEntities = saveEntities;
|
|
22
21
|
exports.saveEntity = saveEntity;
|
|
23
22
|
|
package/build/saveEntity.d.cts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { DeepPartialOrNull, Entity, EntityConstructor, OptsOf } from "joist-core";
|
|
2
2
|
import { Context } from "joist-test-utils";
|
|
3
|
-
//#region src/saveEntity.d.ts
|
|
4
3
|
/** Given an GraphQL input, creates-or-updates an entity of `type`. */
|
|
5
|
-
declare function saveEntity<T extends Entity>(ctx: Context, type: EntityConstructor<T>, input: DeepPartialOrNull<T>, opts?: {
|
|
4
|
+
export declare function saveEntity<T extends Entity>(ctx: Context, type: EntityConstructor<T>, input: DeepPartialOrNull<T>, opts?: {
|
|
6
5
|
flush?: boolean;
|
|
7
6
|
}): Promise<T>;
|
|
8
7
|
/** Given GraphQL inputs, creates-or-updates multiple entities of `type`. */
|
|
9
|
-
declare function saveEntities<T extends Entity>(ctx: Context, type: EntityConstructor<T>, input: readonly DeepPartialOrNull<T>[], opts?: {
|
|
8
|
+
export declare function saveEntities<T extends Entity>(ctx: Context, type: EntityConstructor<T>, input: readonly DeepPartialOrNull<T>[], opts?: {
|
|
10
9
|
flush?: boolean;
|
|
11
10
|
opts?: Partial<OptsOf<T>>;
|
|
12
11
|
}): Promise<T[]>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { saveEntities, saveEntity };
|
|
15
12
|
//# sourceMappingURL=saveEntity.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveEntity.d.cts","names":[],"sources":["../src/saveEntity.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"saveEntity.d.cts","names":[],"sources":["../src/saveEntity.ts"],"mappings":";;;wBAUsB,WAAW,UAAU,QACzC,KAAK,SACL,MAAM,kBAAkB,IACxB,OAAO,kBAAkB,IACzB;EAAQ;IACP,QAAQ;;wBAKW,aAAa,UAAU,QAC3C,KAAK,SACL,MAAM,kBAAkB,IACxB,gBAAgB,kBAAkB,MAClC;EAAQ;EAAiB,OAAO,QAAQ,OAAO;IAC9C,QAAQ"}
|
package/build/saveEntity.d.mts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { DeepPartialOrNull, Entity, EntityConstructor, OptsOf } from "joist-core";
|
|
2
2
|
import { Context } from "joist-test-utils";
|
|
3
|
-
//#region src/saveEntity.d.ts
|
|
4
3
|
/** Given an GraphQL input, creates-or-updates an entity of `type`. */
|
|
5
|
-
declare function saveEntity<T extends Entity>(ctx: Context, type: EntityConstructor<T>, input: DeepPartialOrNull<T>, opts?: {
|
|
4
|
+
export declare function saveEntity<T extends Entity>(ctx: Context, type: EntityConstructor<T>, input: DeepPartialOrNull<T>, opts?: {
|
|
6
5
|
flush?: boolean;
|
|
7
6
|
}): Promise<T>;
|
|
8
7
|
/** Given GraphQL inputs, creates-or-updates multiple entities of `type`. */
|
|
9
|
-
declare function saveEntities<T extends Entity>(ctx: Context, type: EntityConstructor<T>, input: readonly DeepPartialOrNull<T>[], opts?: {
|
|
8
|
+
export declare function saveEntities<T extends Entity>(ctx: Context, type: EntityConstructor<T>, input: readonly DeepPartialOrNull<T>[], opts?: {
|
|
10
9
|
flush?: boolean;
|
|
11
10
|
opts?: Partial<OptsOf<T>>;
|
|
12
11
|
}): Promise<T[]>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { saveEntities, saveEntity };
|
|
15
12
|
//# sourceMappingURL=saveEntity.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveEntity.d.mts","names":[],"sources":["../src/saveEntity.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"saveEntity.d.mts","names":[],"sources":["../src/saveEntity.ts"],"mappings":";;;wBAUsB,WAAW,UAAU,QACzC,KAAK,SACL,MAAM,kBAAkB,IACxB,OAAO,kBAAkB,IACzB;EAAQ;IACP,QAAQ;;wBAKW,aAAa,UAAU,QAC3C,KAAK,SACL,MAAM,kBAAkB,IACxB,gBAAgB,kBAAkB,MAClC;EAAQ;EAAiB,OAAO,QAAQ,OAAO;IAC9C,QAAQ"}
|
package/build/saveEntity.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { failIfAnyRejected } from "joist-core";
|
|
2
2
|
import "joist-test-utils";
|
|
3
|
-
|
|
3
|
+
// src/saveEntity.ts
|
|
4
4
|
/** Given an GraphQL input, creates-or-updates an entity of `type`. */
|
|
5
5
|
async function saveEntity(ctx, type, input, opts = {}) {
|
|
6
6
|
return saveEntities(ctx, type, [input], opts).then((r) => r[0]);
|
|
@@ -16,7 +16,6 @@ async function saveEntities(ctx, type, input, opts = {}) {
|
|
|
16
16
|
if (flush) await ctx.em.flush();
|
|
17
17
|
return failIfAnyRejected(results);
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { saveEntities, saveEntity };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=saveEntity.js.map
|
package/build/tests.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ResolverArgs, ResolverResult, ResolverRoot, RunFn } from "./typeUtils.cjs";
|
|
2
1
|
import { MakeRunInputMutation, makeMakeRunInputMutation } from "./makeRunInputMutation.cjs";
|
|
3
2
|
import { MakeRunObjectField, makeMakeRunObjectField } from "./makeRunObjectField.cjs";
|
|
4
3
|
import { MakeRunObjectFields, makeMakeRunObjectFields } from "./makeRunObjectFields.cjs";
|
|
5
4
|
import { MakeRunQuery, makeMakeRunQuery } from "./makeRunQuery.cjs";
|
|
5
|
+
import { ResolverArgs, ResolverResult, ResolverRoot, RunFn } from "./typeUtils.cjs";
|
|
6
6
|
export { type MakeRunInputMutation, type MakeRunObjectField, type MakeRunObjectFields, type MakeRunQuery, type ResolverArgs, type ResolverResult, type ResolverRoot, type RunFn, makeMakeRunInputMutation, makeMakeRunObjectField, makeMakeRunObjectFields, makeMakeRunQuery };
|
package/build/tests.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ResolverArgs, ResolverResult, ResolverRoot, RunFn } from "./typeUtils.mjs";
|
|
2
1
|
import { MakeRunInputMutation, makeMakeRunInputMutation } from "./makeRunInputMutation.mjs";
|
|
3
2
|
import { MakeRunObjectField, makeMakeRunObjectField } from "./makeRunObjectField.mjs";
|
|
4
3
|
import { MakeRunObjectFields, makeMakeRunObjectFields } from "./makeRunObjectFields.mjs";
|
|
5
4
|
import { MakeRunQuery, makeMakeRunQuery } from "./makeRunQuery.mjs";
|
|
5
|
+
import { ResolverArgs, ResolverResult, ResolverRoot, RunFn } from "./typeUtils.mjs";
|
|
6
6
|
export { type MakeRunInputMutation, type MakeRunObjectField, type MakeRunObjectFields, type MakeRunQuery, type ResolverArgs, type ResolverResult, type ResolverRoot, type RunFn, makeMakeRunInputMutation, makeMakeRunObjectField, makeMakeRunObjectFields, makeMakeRunQuery };
|
package/build/typeUtils.d.cts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Resolver } from "./context.cjs";
|
|
2
|
-
|
|
3
|
-
type RunFn<C> = <T>(ctx: C, fn: (ctx: C) => Promise<T>) => Promise<T>;
|
|
2
|
+
export type RunFn<C> = <T>(ctx: C, fn: (ctx: C) => Promise<T>) => Promise<T>;
|
|
4
3
|
/** Infers the root type of the given resolver, by assuming it's always the first arg. */
|
|
5
|
-
type ResolverRoot<T> = T extends { [key in keyof T]: infer F; } ? F extends Resolver<infer R, any, any> ? R : never : never;
|
|
6
|
-
type ResolverArgs<T, K extends keyof T> = T[K] extends Resolver<any, infer U, any> ? U : never;
|
|
4
|
+
export type ResolverRoot<T> = T extends { [key in keyof T]: infer F; } ? F extends Resolver<infer R, any, any> ? R : never : never;
|
|
5
|
+
export type ResolverArgs<T, K extends keyof T> = T[K] extends Resolver<any, infer U, any> ? U : never;
|
|
7
6
|
/** Infers the return type of key `K` in the resolver object `T`. */
|
|
8
|
-
type ResolverResult<T, K extends keyof T> = T[K] extends Resolver<any, any, infer U> ? U : never;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { ResolverArgs, ResolverResult, ResolverRoot, RunFn };
|
|
7
|
+
export type ResolverResult<T, K extends keyof T> = T[K] extends Resolver<any, any, infer U> ? U : never;
|
|
11
8
|
//# sourceMappingURL=typeUtils.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeUtils.d.cts","names":[],"sources":["../src/typeUtils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeUtils.d.cts","names":[],"sources":["../src/typeUtils.ts"],"mappings":";YAEY,MAAM,MAAM,GAAG,KAAK,GAAG,KAAK,KAAK,MAAM,QAAQ,OAAO,QAAQ;;YAG9D,aAAa,KAAK,aAAa,aAAa,UAAU,OAC9D,UAAU,eAAe,eACvB;YAIM,aAAa,GAAG,gBAAgB,KAAK,EAAE,WAAW,oBAAoB,UAAU;;YAGhF,eAAe,GAAG,gBAAgB,KAAK,EAAE,WAAW,yBAAyB,KAAK"}
|