@kavo/graphql 0.4.0

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.
@@ -0,0 +1,27 @@
1
+ import type { ClassRef, EntityId } from "@kavo/core";
2
+ import type { GraphQLSchema } from "graphql";
3
+ import type { BoundCrudService } from "./schema.js";
4
+ /** The minimum a host framework needs to hand this package about one `@Crud` entity. */
5
+ export interface CrudEntityRef {
6
+ readonly entity: ClassRef;
7
+ }
8
+ /**
9
+ * The host-agnostic half of "discover every entity that registered
10
+ * GraphQL types and put them all on one schema." Two things stay
11
+ * deliberately outside this package, supplied by the caller instead:
12
+ *
13
+ * - **How to enumerate `@Crud` entities** — `@kavo/nest`'s `getCrudEntities()`,
14
+ * a plain array an Express/Fastify/Next.js app builds by hand, or any
15
+ * other host's own registry.
16
+ * - **How to resolve a bound service for one entity** — `@kavo/nest`'s
17
+ * `ModuleRef` + `getCrudServiceToken`, a plain `Map`, or whatever DI
18
+ * container that host uses.
19
+ *
20
+ * This function only ever touches `@kavo/core` shapes and this package's
21
+ * own type registry — never a host framework — so the same call works
22
+ * from `@kavo/nest`'s `BaseCrudGraphQLController` today and from a future
23
+ * `@kavo/express`/`@kavo/fastify`/`@kavo/nextjs` binding without either
24
+ * package importing the other (ADR-0016).
25
+ */
26
+ export declare function resolveCrudGraphQLSchema(entities: readonly CrudEntityRef[], resolveService: (entity: ClassRef) => BoundCrudService<object, EntityId, unknown, unknown, unknown, unknown, unknown>): GraphQLSchema;
27
+ //# sourceMappingURL=discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AAIxE,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,cAAc,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GACpH,aAAa,CAYf"}
@@ -0,0 +1,32 @@
1
+ import { mergeCrudGraphQLSchemas } from "./schema.js";
2
+ import { getCrudGraphQLTypes } from "./registry.js";
3
+ /**
4
+ * The host-agnostic half of "discover every entity that registered
5
+ * GraphQL types and put them all on one schema." Two things stay
6
+ * deliberately outside this package, supplied by the caller instead:
7
+ *
8
+ * - **How to enumerate `@Crud` entities** — `@kavo/nest`'s `getCrudEntities()`,
9
+ * a plain array an Express/Fastify/Next.js app builds by hand, or any
10
+ * other host's own registry.
11
+ * - **How to resolve a bound service for one entity** — `@kavo/nest`'s
12
+ * `ModuleRef` + `getCrudServiceToken`, a plain `Map`, or whatever DI
13
+ * container that host uses.
14
+ *
15
+ * This function only ever touches `@kavo/core` shapes and this package's
16
+ * own type registry — never a host framework — so the same call works
17
+ * from `@kavo/nest`'s `BaseCrudGraphQLController` today and from a future
18
+ * `@kavo/express`/`@kavo/fastify`/`@kavo/nextjs` binding without either
19
+ * package importing the other (ADR-0016).
20
+ */
21
+ export function resolveCrudGraphQLSchema(entities, resolveService) {
22
+ const bindings = [];
23
+ for (const { entity } of entities) {
24
+ const types = getCrudGraphQLTypes(entity);
25
+ if (types === undefined) {
26
+ continue;
27
+ }
28
+ bindings.push({ name: entity.name, service: resolveService(entity), ...types });
29
+ }
30
+ return mergeCrudGraphQLSchemas(bindings);
31
+ }
32
+ //# sourceMappingURL=discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAkC,EAClC,cAAqH;IAErH,MAAM,QAAQ,GAAwF,EAAE,CAAC;IAEzG,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS;QACX,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { createCrudGraphQLSchema, mergeCrudGraphQLSchemas, type CrudGraphQLOptions, type BoundCrudService, } from "./schema.js";
2
+ export { registerCrudGraphQLTypes, getCrudGraphQLTypes, type CrudGraphQLTypes } from "./registry.js";
3
+ export { resolveCrudGraphQLSchema, type CrudEntityRef } from "./discovery.js";
4
+ export { GraphQLJSON } from "./json-scalar.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,wBAAwB,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { createCrudGraphQLSchema, mergeCrudGraphQLSchemas, } from "./schema.js";
2
+ export { registerCrudGraphQLTypes, getCrudGraphQLTypes } from "./registry.js";
3
+ export { resolveCrudGraphQLSchema } from "./discovery.js";
4
+ export { GraphQLJSON } from "./json-scalar.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GAGxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAyB,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,wBAAwB,EAAsB,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { GraphQLScalarType } from "graphql";
2
+ /**
3
+ * Arbitrary JSON, used for `filter` args until schema-derived
4
+ * `<Entity>FilterInput` types exist (tracked separately — that's the
5
+ * "derive types from entity metadata" work this package's proof-of-concept
6
+ * status has always deferred). The value that reaches a resolver is the
7
+ * raw filter AST (`FilterExpression` from `@kavo/core`) — the same shape
8
+ * any other programmatic caller of `QueryContext.filter` already hands
9
+ * core directly; there is no wire-string grammar to parse here.
10
+ */
11
+ export declare const GraphQLJSON: GraphQLScalarType<unknown, unknown>;
12
+ //# sourceMappingURL=json-scalar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-scalar.d.ts","sourceRoot":"","sources":["../src/json-scalar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6B,MAAM,SAAS,CAAC;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,qCAMtB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { GraphQLScalarType, Kind, valueFromASTUntyped } from "graphql";
2
+ /**
3
+ * Arbitrary JSON, used for `filter` args until schema-derived
4
+ * `<Entity>FilterInput` types exist (tracked separately — that's the
5
+ * "derive types from entity metadata" work this package's proof-of-concept
6
+ * status has always deferred). The value that reaches a resolver is the
7
+ * raw filter AST (`FilterExpression` from `@kavo/core`) — the same shape
8
+ * any other programmatic caller of `QueryContext.filter` already hands
9
+ * core directly; there is no wire-string grammar to parse here.
10
+ */
11
+ export const GraphQLJSON = new GraphQLScalarType({
12
+ name: "JSON",
13
+ description: "Arbitrary JSON value — used here for a raw Kavo filter expression.",
14
+ serialize: (value) => value,
15
+ parseValue: (value) => value,
16
+ parseLiteral: (ast) => (ast.kind === Kind.NULL ? null : valueFromASTUntyped(ast)),
17
+ });
18
+ //# sourceMappingURL=json-scalar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-scalar.js","sourceRoot":"","sources":["../src/json-scalar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAC/C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,oEAAoE;IACjF,SAAS,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK;IACpC,UAAU,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK;IACrC,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;CAClF,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { ClassRef } from "@kavo/core";
2
+ import type { GraphQLInputObjectType, GraphQLObjectType } from "graphql";
3
+ /**
4
+ * GraphQL object/input types (and which mutations to expose) for one
5
+ * entity — the hand-written part `registerCrudGraphQLTypes` attaches to a
6
+ * class. Each mutation flag/input mirrors `CrudGraphQLOptions` in
7
+ * `schema.ts` one for one — omit any of them to leave that mutation off
8
+ * the schema for this entity, same opt-in shape `@Crud`'s own `operations`
9
+ * config uses on the REST side.
10
+ */
11
+ export interface CrudGraphQLTypes {
12
+ readonly itemType: GraphQLObjectType;
13
+ /** Omit to leave the `create<Name>` mutation off the schema for this entity. */
14
+ readonly createInputType?: GraphQLInputObjectType;
15
+ /** Omit to leave the `update<Name>` mutation off the schema for this entity. */
16
+ readonly updateInputType?: GraphQLInputObjectType;
17
+ /** Omit to leave the `patch<Name>` mutation off the schema for this entity. */
18
+ readonly patchInputType?: GraphQLInputObjectType;
19
+ /** Adds `delete<Name>(id): Boolean`. */
20
+ readonly deleteOne?: boolean;
21
+ /** Adds `restore<Name>(id): <Name>` — meaningful only for a soft-deletable entity. */
22
+ readonly restoreOne?: boolean;
23
+ /** Adds `purge<Name>(id): Boolean` — meaningful only for a soft-deletable entity. */
24
+ readonly purgeOne?: boolean;
25
+ }
26
+ /**
27
+ * Attaches GraphQL types to an entity once, next to its DTOs — the
28
+ * counterpart of `@kavo/nest`'s `getCrudEntities()`: a consumer can walk
29
+ * every `@Crud` entity and look up its GraphQL types here, wiring a merged
30
+ * schema with no per-entity list of its own (see `resolveCrudGraphQLSchema`
31
+ * in `discovery.ts`, which does exactly that). An entity with no
32
+ * registration here simply has no GraphQL surface — opt-in, not implied by
33
+ * `@Crud` alone. Process-wide, same scope as `@kavo/nest`'s own registry.
34
+ */
35
+ export declare function registerCrudGraphQLTypes(entity: ClassRef, types: CrudGraphQLTypes): void;
36
+ /** The types `registerCrudGraphQLTypes` attached to `entity`, or `undefined` if it never registered any. */
37
+ export declare function getCrudGraphQLTypes(entity: ClassRef): CrudGraphQLTypes | undefined;
38
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,gFAAgF;IAChF,QAAQ,CAAC,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAClD,gFAAgF;IAChF,QAAQ,CAAC,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAClD,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACjD,wCAAwC;IACxC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAID;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAExF;AAED,4GAA4G;AAC5G,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAElF"}
@@ -0,0 +1,18 @@
1
+ const typeRegistry = new Map();
2
+ /**
3
+ * Attaches GraphQL types to an entity once, next to its DTOs — the
4
+ * counterpart of `@kavo/nest`'s `getCrudEntities()`: a consumer can walk
5
+ * every `@Crud` entity and look up its GraphQL types here, wiring a merged
6
+ * schema with no per-entity list of its own (see `resolveCrudGraphQLSchema`
7
+ * in `discovery.ts`, which does exactly that). An entity with no
8
+ * registration here simply has no GraphQL surface — opt-in, not implied by
9
+ * `@Crud` alone. Process-wide, same scope as `@kavo/nest`'s own registry.
10
+ */
11
+ export function registerCrudGraphQLTypes(entity, types) {
12
+ typeRegistry.set(entity, types);
13
+ }
14
+ /** The types `registerCrudGraphQLTypes` attached to `entity`, or `undefined` if it never registered any. */
15
+ export function getCrudGraphQLTypes(entity) {
16
+ return typeRegistry.get(entity);
17
+ }
18
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AA2BA,MAAM,YAAY,GAAG,IAAI,GAAG,EAA8B,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAgB,EAAE,KAAuB;IAChF,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,4GAA4G;AAC5G,MAAM,UAAU,mBAAmB,CAAC,MAAgB;IAClD,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { GraphQLObjectType, GraphQLSchema, type GraphQLFieldConfig, type GraphQLInputObjectType } from "graphql";
2
+ import type { DefaultCrudService, EntityId } from "@kavo/core";
3
+ /**
4
+ * What a query/mutation resolver in this binding actually calls — the
5
+ * transport-agnostic programmatic surface `createCrud` returns. Kept as a
6
+ * structural type (not `DefaultCrudService` itself) so a caller only has to
7
+ * satisfy the handful of methods a schema actually wires up, the same way
8
+ * `@kavo/nest`'s standard-operation routes bind to it. Exported (not just
9
+ * internal) so `discovery.ts`'s host-agnostic resolver callback can name it.
10
+ *
11
+ * Every standard operation is picked unconditionally — whether a given
12
+ * field actually reaches the schema is decided per entity by which
13
+ * `*InputType`/`include*` options `crudFields` receives, mirroring how
14
+ * `@Crud`'s own `operations` config opts entities in or out on the REST
15
+ * side. Calling `restoreOne`/`purgeOne` against an entity that never
16
+ * declared soft delete still raises `OperationDisabledException` from the
17
+ * engine itself — this binding does not re-check that, same as REST.
18
+ */
19
+ export type BoundCrudService<Entity extends object, Id extends EntityId, CreateDto, UpdateDto, PatchDto, ItemDto, ListDto> = Pick<DefaultCrudService<Entity, Id, CreateDto, UpdateDto, PatchDto, unknown, ItemDto, ListDto>, "findOne" | "findMany" | "createOne" | "updateOne" | "patchOne" | "deleteOne" | "restoreOne" | "purgeOne">;
20
+ /**
21
+ * One entity's GraphQL binding: a query root (`<name>`/`<name>s`) plus
22
+ * whichever mutations its options ask for — every resolver a direct call
23
+ * into the same engine REST routes use, no parallel request pipeline.
24
+ * Each mutation is opt-in per entity: omit the corresponding option and
25
+ * that field never reaches the schema, the same "declare what you want"
26
+ * shape `createInputType` already had.
27
+ */
28
+ export interface CrudGraphQLOptions<Entity extends object, Id extends EntityId, CreateDto, UpdateDto, PatchDto, ItemDto, ListDto> {
29
+ /** Singular, capitalized entity name — becomes `Query.<lowerName>` / `<Name>List` / `createName` / etc. */
30
+ readonly name: string;
31
+ readonly service: BoundCrudService<Entity, Id, CreateDto, UpdateDto, PatchDto, ItemDto, ListDto>;
32
+ readonly itemType: GraphQLObjectType;
33
+ /** Omit to leave the `create<Name>` mutation off the schema. */
34
+ readonly createInputType?: GraphQLInputObjectType;
35
+ /** Omit to leave the `update<Name>` mutation off the schema. */
36
+ readonly updateInputType?: GraphQLInputObjectType;
37
+ /** Omit to leave the `patch<Name>` mutation off the schema. */
38
+ readonly patchInputType?: GraphQLInputObjectType;
39
+ /** Adds `delete<Name>(id): Boolean`. */
40
+ readonly deleteOne?: boolean;
41
+ /** Adds `restore<Name>(id): <Name>` — meaningful only for a soft-deletable entity. */
42
+ readonly restoreOne?: boolean;
43
+ /** Adds `purge<Name>(id): Boolean` — meaningful only for a soft-deletable entity. */
44
+ readonly purgeOne?: boolean;
45
+ }
46
+ /**
47
+ * Field maps for one entity's binding — the unit `createCrudGraphQLSchema`
48
+ * wraps and `mergeCrudGraphQLSchemas`/`resolveCrudGraphQLSchema` combine.
49
+ * Not exported from the barrel: an internal building block, same status as
50
+ * `lowerFirst`.
51
+ */
52
+ export declare function crudFields<Entity extends object, Id extends EntityId, CreateDto, UpdateDto, PatchDto, ItemDto, ListDto>(options: CrudGraphQLOptions<Entity, Id, CreateDto, UpdateDto, PatchDto, ItemDto, ListDto>): {
53
+ query: Record<string, GraphQLFieldConfig<unknown, unknown>>;
54
+ mutation: Record<string, GraphQLFieldConfig<unknown, unknown>>;
55
+ };
56
+ /**
57
+ * Builds a one-entity `GraphQLSchema` over an existing `createCrud`
58
+ * service. Schema derivation from entity metadata, relations, and
59
+ * filtering is still out of scope (ADR-worthy work, tracked separately):
60
+ * the caller supplies the GraphQL object/input types by hand, and every
61
+ * resolver delegates straight to the bound service, which itself is sugar
62
+ * over `engine.execute` — the identical pipeline REST runs.
63
+ *
64
+ * For an app with more than one entity, prefer `mergeCrudGraphQLSchemas` (or
65
+ * `resolveCrudGraphQLSchema` for a framework-driven registry) — they put
66
+ * every entity's fields on one `Query`/`Mutation` root instead of one
67
+ * schema (and one mounted endpoint) per entity.
68
+ */
69
+ export declare function createCrudGraphQLSchema<Entity extends object, Id extends EntityId, CreateDto, UpdateDto, PatchDto, ItemDto, ListDto>(options: CrudGraphQLOptions<Entity, Id, CreateDto, UpdateDto, PatchDto, ItemDto, ListDto>): GraphQLSchema;
70
+ /**
71
+ * Combines several entities' bindings onto one `Query`/`Mutation` root —
72
+ * the shape an app actually wants: one `/graphql` endpoint for every
73
+ * `@Crud` entity, not one per entity. Each entry is the same options shape
74
+ * `createCrudGraphQLSchema` takes; field names are namespaced by each
75
+ * entity's own `name`, so entries never collide with each other.
76
+ */
77
+ export declare function mergeCrudGraphQLSchemas(bindings: readonly CrudGraphQLOptions<object, EntityId, unknown, unknown, unknown, unknown, unknown>[]): GraphQLSchema;
78
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,E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,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAMD;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,MAAM,SAAS,MAAM,EACrB,EAAE,SAAS,QAAQ,EACnB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EAEP,OAAO,EAAE,kBAAkB,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,GACxF;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;CAChE,CAoGA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,SAAS,MAAM,EACrB,EAAE,SAAS,QAAQ,EACnB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EAAE,kBAAkB,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,aAAa,CAO1G;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,SAAS,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GACrG,aAAa,CA8Bf"}
package/dist/schema.js ADDED
@@ -0,0 +1,162 @@
1
+ import { GraphQLBoolean, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLString, } from "graphql";
2
+ import { ConfigurationException } from "@kavo/core";
3
+ import { GraphQLJSON } from "./json-scalar.js";
4
+ /**
5
+ * `sort: ["-createdAt", "name"]` → `[{ field: "createdAt", direction: "desc" }, { field: "name", direction: "asc" }]`
6
+ * — the same leading-`-` convention REST's `?sort=` wire param uses, translated here instead of through core's
7
+ * wire-string parser (this binding calls the programmatic `QueryContext` surface, which takes `Sort[]` objects
8
+ * directly, never wire strings).
9
+ */
10
+ function parseSortArg(tokens) {
11
+ if (tokens === undefined)
12
+ return [];
13
+ return tokens.map((token) => token.startsWith("-")
14
+ ? { field: token.slice(1), direction: "desc" }
15
+ : { field: token, direction: "asc" });
16
+ }
17
+ function lowerFirst(value) {
18
+ return value.charAt(0).toLowerCase() + value.slice(1);
19
+ }
20
+ /**
21
+ * Field maps for one entity's binding — the unit `createCrudGraphQLSchema`
22
+ * wraps and `mergeCrudGraphQLSchemas`/`resolveCrudGraphQLSchema` combine.
23
+ * Not exported from the barrel: an internal building block, same status as
24
+ * `lowerFirst`.
25
+ */
26
+ export function crudFields(options) {
27
+ const { name, service, itemType, createInputType, updateInputType, patchInputType, deleteOne, restoreOne, purgeOne } = options;
28
+ const fieldName = lowerFirst(name);
29
+ const idArgs = { id: { type: new GraphQLNonNull(GraphQLInt) } };
30
+ const listType = new GraphQLObjectType({
31
+ name: `${name}List`,
32
+ fields: {
33
+ items: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(itemType))) },
34
+ total: { type: GraphQLInt },
35
+ limit: { type: new GraphQLNonNull(GraphQLInt) },
36
+ offset: { type: new GraphQLNonNull(GraphQLInt) },
37
+ },
38
+ });
39
+ const query = {
40
+ [fieldName]: {
41
+ type: itemType,
42
+ args: idArgs,
43
+ resolve: (_root, args) => service.findOne(args.id),
44
+ },
45
+ [`${fieldName}s`]: {
46
+ type: new GraphQLNonNull(listType),
47
+ args: {
48
+ limit: { type: GraphQLInt },
49
+ offset: { type: GraphQLInt },
50
+ sort: { type: new GraphQLList(new GraphQLNonNull(GraphQLString)) },
51
+ filter: { type: GraphQLJSON },
52
+ },
53
+ resolve: (_root, args) => service.findMany({
54
+ limit: args.limit,
55
+ offset: args.offset,
56
+ sort: parseSortArg(args.sort),
57
+ filter: args.filter ?? null,
58
+ }),
59
+ },
60
+ };
61
+ const mutation = {};
62
+ if (createInputType !== undefined) {
63
+ mutation[`create${name}`] = {
64
+ type: new GraphQLNonNull(itemType),
65
+ args: { input: { type: new GraphQLNonNull(createInputType) } },
66
+ resolve: (_root, args) => service.createOne(args.input),
67
+ };
68
+ }
69
+ if (updateInputType !== undefined) {
70
+ mutation[`update${name}`] = {
71
+ type: new GraphQLNonNull(itemType),
72
+ args: { ...idArgs, input: { type: new GraphQLNonNull(updateInputType) } },
73
+ resolve: (_root, args) => service.updateOne(args.id, args.input),
74
+ };
75
+ }
76
+ if (patchInputType !== undefined) {
77
+ mutation[`patch${name}`] = {
78
+ type: new GraphQLNonNull(itemType),
79
+ args: { ...idArgs, input: { type: new GraphQLNonNull(patchInputType) } },
80
+ resolve: (_root, args) => service.patchOne(args.id, args.input),
81
+ };
82
+ }
83
+ if (deleteOne === true) {
84
+ mutation[`delete${name}`] = {
85
+ type: new GraphQLNonNull(GraphQLBoolean),
86
+ args: idArgs,
87
+ resolve: async (_root, args) => {
88
+ await service.deleteOne(args.id);
89
+ return true;
90
+ },
91
+ };
92
+ }
93
+ if (restoreOne === true) {
94
+ mutation[`restore${name}`] = {
95
+ type: new GraphQLNonNull(itemType),
96
+ args: idArgs,
97
+ resolve: (_root, args) => service.restoreOne(args.id),
98
+ };
99
+ }
100
+ if (purgeOne === true) {
101
+ mutation[`purge${name}`] = {
102
+ type: new GraphQLNonNull(GraphQLBoolean),
103
+ args: idArgs,
104
+ resolve: async (_root, args) => {
105
+ await service.purgeOne(args.id);
106
+ return true;
107
+ },
108
+ };
109
+ }
110
+ return { query, mutation };
111
+ }
112
+ /**
113
+ * Builds a one-entity `GraphQLSchema` over an existing `createCrud`
114
+ * service. Schema derivation from entity metadata, relations, and
115
+ * filtering is still out of scope (ADR-worthy work, tracked separately):
116
+ * the caller supplies the GraphQL object/input types by hand, and every
117
+ * resolver delegates straight to the bound service, which itself is sugar
118
+ * over `engine.execute` — the identical pipeline REST runs.
119
+ *
120
+ * For an app with more than one entity, prefer `mergeCrudGraphQLSchemas` (or
121
+ * `resolveCrudGraphQLSchema` for a framework-driven registry) — they put
122
+ * every entity's fields on one `Query`/`Mutation` root instead of one
123
+ * schema (and one mounted endpoint) per entity.
124
+ */
125
+ export function createCrudGraphQLSchema(options) {
126
+ const { query, mutation } = crudFields(options);
127
+ return new GraphQLSchema({
128
+ query: new GraphQLObjectType({ name: "Query", fields: query }),
129
+ mutation: Object.keys(mutation).length > 0 ? new GraphQLObjectType({ name: "Mutation", fields: mutation }) : undefined,
130
+ });
131
+ }
132
+ /**
133
+ * Combines several entities' bindings onto one `Query`/`Mutation` root —
134
+ * the shape an app actually wants: one `/graphql` endpoint for every
135
+ * `@Crud` entity, not one per entity. Each entry is the same options shape
136
+ * `createCrudGraphQLSchema` takes; field names are namespaced by each
137
+ * entity's own `name`, so entries never collide with each other.
138
+ */
139
+ export function mergeCrudGraphQLSchemas(bindings) {
140
+ const query = {};
141
+ const mutation = {};
142
+ for (const binding of bindings) {
143
+ const fields = crudFields(binding);
144
+ Object.assign(query, fields.query);
145
+ Object.assign(mutation, fields.mutation);
146
+ }
147
+ if (Object.keys(query).length === 0) {
148
+ // An empty `Query` type is invalid GraphQL (`Type Query must define one
149
+ // or more fields.`) — graphql-js would only report that cryptically, on
150
+ // the first request, deep inside `graphql()`'s own schema validation.
151
+ // Failing fast here, at schema-build time, with a message that names the
152
+ // actual fix, is what `resolveCrudGraphQLSchema` (zero entities
153
+ // discovered) relies on to fail at boot instead of at request time.
154
+ throw new ConfigurationException("GraphQLSchema", "bindings", "no entity registered any GraphQL types — call registerCrudGraphQLTypes(Entity, {...}) " +
155
+ "for at least one @Crud entity before enabling a GraphQL endpoint");
156
+ }
157
+ return new GraphQLSchema({
158
+ query: new GraphQLObjectType({ name: "Query", fields: query }),
159
+ mutation: Object.keys(mutation).length > 0 ? new GraphQLObjectType({ name: "Mutation", fields: mutation }) : undefined,
160
+ });
161
+ }
162
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,GAGd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;GAKG;AACH,SAAS,YAAY,CAAC,MAAqC;IACzD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACpC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC1B,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QACnB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAe,EAAE;QACvD,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAc,EAAE,CAChD,CAAC;AACJ,CAAC;AAkED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CASxB,OAAyF;IAKzF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,GAClH,OAAO,CAAC;IACV,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,MA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AK,EAAE,IAAI,iBAAiB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC9D,QAAQ,EACN,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;KAC/G,CAAC,CAAC;AACL,CAAC"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@kavo/graphql",
3
+ "version": "0.4.0",
4
+ "description": "Kavo GraphQL binding — builds a GraphQL schema over a createCrud service, delegating every resolver to the same engine REST uses.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kavo-labs/kavo.git",
9
+ "directory": "packages/protocols/graphql"
10
+ },
11
+ "homepage": "https://github.com/kavo-labs/kavo/tree/main/packages/protocols/graphql#readme",
12
+ "type": "module",
13
+ "sideEffects": false,
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc -b"
28
+ },
29
+ "dependencies": {
30
+ "@kavo/core": "workspace:^"
31
+ },
32
+ "peerDependencies": {
33
+ "graphql": "^17.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "graphql": "^17.0.0"
37
+ }
38
+ }