@effect-gql/core 0.1.0 → 1.1.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.
Files changed (164) hide show
  1. package/README.md +100 -0
  2. package/builder/index.cjs +1446 -0
  3. package/builder/index.cjs.map +1 -0
  4. package/builder/index.d.cts +260 -0
  5. package/{dist/builder/pipe-api.d.ts → builder/index.d.ts} +50 -21
  6. package/builder/index.js +1405 -0
  7. package/builder/index.js.map +1 -0
  8. package/index.cjs +3469 -0
  9. package/index.cjs.map +1 -0
  10. package/index.d.cts +529 -0
  11. package/index.d.ts +529 -0
  12. package/index.js +3292 -0
  13. package/index.js.map +1 -0
  14. package/package.json +19 -28
  15. package/schema-builder-DKvkzU_M.d.cts +965 -0
  16. package/schema-builder-DKvkzU_M.d.ts +965 -0
  17. package/server/index.cjs +1579 -0
  18. package/server/index.cjs.map +1 -0
  19. package/server/index.d.cts +682 -0
  20. package/server/index.d.ts +682 -0
  21. package/server/index.js +1548 -0
  22. package/server/index.js.map +1 -0
  23. package/dist/analyzer-extension.d.ts +0 -105
  24. package/dist/analyzer-extension.d.ts.map +0 -1
  25. package/dist/analyzer-extension.js +0 -137
  26. package/dist/analyzer-extension.js.map +0 -1
  27. package/dist/builder/execute.d.ts +0 -26
  28. package/dist/builder/execute.d.ts.map +0 -1
  29. package/dist/builder/execute.js +0 -104
  30. package/dist/builder/execute.js.map +0 -1
  31. package/dist/builder/field-builders.d.ts +0 -30
  32. package/dist/builder/field-builders.d.ts.map +0 -1
  33. package/dist/builder/field-builders.js +0 -200
  34. package/dist/builder/field-builders.js.map +0 -1
  35. package/dist/builder/index.d.ts +0 -7
  36. package/dist/builder/index.d.ts.map +0 -1
  37. package/dist/builder/index.js +0 -31
  38. package/dist/builder/index.js.map +0 -1
  39. package/dist/builder/pipe-api.d.ts.map +0 -1
  40. package/dist/builder/pipe-api.js +0 -151
  41. package/dist/builder/pipe-api.js.map +0 -1
  42. package/dist/builder/schema-builder.d.ts +0 -301
  43. package/dist/builder/schema-builder.d.ts.map +0 -1
  44. package/dist/builder/schema-builder.js +0 -566
  45. package/dist/builder/schema-builder.js.map +0 -1
  46. package/dist/builder/type-registry.d.ts +0 -80
  47. package/dist/builder/type-registry.d.ts.map +0 -1
  48. package/dist/builder/type-registry.js +0 -505
  49. package/dist/builder/type-registry.js.map +0 -1
  50. package/dist/builder/types.d.ts +0 -283
  51. package/dist/builder/types.d.ts.map +0 -1
  52. package/dist/builder/types.js +0 -3
  53. package/dist/builder/types.js.map +0 -1
  54. package/dist/cli/generate-schema.d.ts +0 -29
  55. package/dist/cli/generate-schema.d.ts.map +0 -1
  56. package/dist/cli/generate-schema.js +0 -233
  57. package/dist/cli/generate-schema.js.map +0 -1
  58. package/dist/cli/index.d.ts +0 -19
  59. package/dist/cli/index.d.ts.map +0 -1
  60. package/dist/cli/index.js +0 -24
  61. package/dist/cli/index.js.map +0 -1
  62. package/dist/context.d.ts +0 -18
  63. package/dist/context.d.ts.map +0 -1
  64. package/dist/context.js +0 -11
  65. package/dist/context.js.map +0 -1
  66. package/dist/error.d.ts +0 -45
  67. package/dist/error.d.ts.map +0 -1
  68. package/dist/error.js +0 -29
  69. package/dist/error.js.map +0 -1
  70. package/dist/extensions.d.ts +0 -130
  71. package/dist/extensions.d.ts.map +0 -1
  72. package/dist/extensions.js +0 -78
  73. package/dist/extensions.js.map +0 -1
  74. package/dist/index.d.ts +0 -12
  75. package/dist/index.d.ts.map +0 -1
  76. package/dist/index.js +0 -47
  77. package/dist/index.js.map +0 -1
  78. package/dist/loader.d.ts +0 -169
  79. package/dist/loader.d.ts.map +0 -1
  80. package/dist/loader.js +0 -237
  81. package/dist/loader.js.map +0 -1
  82. package/dist/resolver-context.d.ts +0 -154
  83. package/dist/resolver-context.d.ts.map +0 -1
  84. package/dist/resolver-context.js +0 -184
  85. package/dist/resolver-context.js.map +0 -1
  86. package/dist/schema-mapping.d.ts +0 -30
  87. package/dist/schema-mapping.d.ts.map +0 -1
  88. package/dist/schema-mapping.js +0 -280
  89. package/dist/schema-mapping.js.map +0 -1
  90. package/dist/server/cache-control.d.ts +0 -96
  91. package/dist/server/cache-control.d.ts.map +0 -1
  92. package/dist/server/cache-control.js +0 -308
  93. package/dist/server/cache-control.js.map +0 -1
  94. package/dist/server/complexity.d.ts +0 -165
  95. package/dist/server/complexity.d.ts.map +0 -1
  96. package/dist/server/complexity.js +0 -433
  97. package/dist/server/complexity.js.map +0 -1
  98. package/dist/server/config.d.ts +0 -66
  99. package/dist/server/config.d.ts.map +0 -1
  100. package/dist/server/config.js +0 -104
  101. package/dist/server/config.js.map +0 -1
  102. package/dist/server/graphiql.d.ts +0 -5
  103. package/dist/server/graphiql.d.ts.map +0 -1
  104. package/dist/server/graphiql.js +0 -43
  105. package/dist/server/graphiql.js.map +0 -1
  106. package/dist/server/index.d.ts +0 -18
  107. package/dist/server/index.d.ts.map +0 -1
  108. package/dist/server/index.js +0 -48
  109. package/dist/server/index.js.map +0 -1
  110. package/dist/server/router.d.ts +0 -79
  111. package/dist/server/router.d.ts.map +0 -1
  112. package/dist/server/router.js +0 -232
  113. package/dist/server/router.js.map +0 -1
  114. package/dist/server/schema-builder-extensions.d.ts +0 -42
  115. package/dist/server/schema-builder-extensions.d.ts.map +0 -1
  116. package/dist/server/schema-builder-extensions.js +0 -48
  117. package/dist/server/schema-builder-extensions.js.map +0 -1
  118. package/dist/server/sse-adapter.d.ts +0 -64
  119. package/dist/server/sse-adapter.d.ts.map +0 -1
  120. package/dist/server/sse-adapter.js +0 -227
  121. package/dist/server/sse-adapter.js.map +0 -1
  122. package/dist/server/sse-types.d.ts +0 -192
  123. package/dist/server/sse-types.d.ts.map +0 -1
  124. package/dist/server/sse-types.js +0 -63
  125. package/dist/server/sse-types.js.map +0 -1
  126. package/dist/server/ws-adapter.d.ts +0 -39
  127. package/dist/server/ws-adapter.d.ts.map +0 -1
  128. package/dist/server/ws-adapter.js +0 -247
  129. package/dist/server/ws-adapter.js.map +0 -1
  130. package/dist/server/ws-types.d.ts +0 -169
  131. package/dist/server/ws-types.d.ts.map +0 -1
  132. package/dist/server/ws-types.js +0 -11
  133. package/dist/server/ws-types.js.map +0 -1
  134. package/dist/server/ws-utils.d.ts +0 -42
  135. package/dist/server/ws-utils.d.ts.map +0 -1
  136. package/dist/server/ws-utils.js +0 -99
  137. package/dist/server/ws-utils.js.map +0 -1
  138. package/src/analyzer-extension.ts +0 -254
  139. package/src/builder/execute.ts +0 -153
  140. package/src/builder/field-builders.ts +0 -322
  141. package/src/builder/index.ts +0 -48
  142. package/src/builder/pipe-api.ts +0 -312
  143. package/src/builder/schema-builder.ts +0 -970
  144. package/src/builder/type-registry.ts +0 -670
  145. package/src/builder/types.ts +0 -305
  146. package/src/context.ts +0 -23
  147. package/src/error.ts +0 -32
  148. package/src/extensions.ts +0 -240
  149. package/src/index.ts +0 -32
  150. package/src/loader.ts +0 -363
  151. package/src/resolver-context.ts +0 -253
  152. package/src/schema-mapping.ts +0 -307
  153. package/src/server/cache-control.ts +0 -590
  154. package/src/server/complexity.ts +0 -774
  155. package/src/server/config.ts +0 -174
  156. package/src/server/graphiql.ts +0 -38
  157. package/src/server/index.ts +0 -96
  158. package/src/server/router.ts +0 -432
  159. package/src/server/schema-builder-extensions.ts +0 -51
  160. package/src/server/sse-adapter.ts +0 -327
  161. package/src/server/sse-types.ts +0 -234
  162. package/src/server/ws-adapter.ts +0 -355
  163. package/src/server/ws-types.ts +0 -192
  164. package/src/server/ws-utils.ts +0 -136
@@ -1,17 +1,20 @@
1
- import { Effect, Stream } from "effect";
2
- import * as S from "effect/Schema";
3
- import { DirectiveLocation, GraphQLResolveInfo, DocumentNode, ExecutionResult, GraphQLError } from "graphql";
4
- import type { DirectiveApplication, MiddlewareContext, CacheHint } from "./types";
5
- import type { ExecutionArgs } from "../extensions";
6
- import { GraphQLSchemaBuilder } from "./schema-builder";
7
- import type { FieldComplexity } from "../server/complexity";
1
+ import { D as DirectiveApplication, C as CacheHint, o as FieldComplexity, i as GraphQLSchemaBuilder, M as MiddlewareContext, K as ExecutionArgs, G as GraphQLExtension, F as FieldComplexityMap } from '../schema-builder-DKvkzU_M.js';
2
+ export { h as CacheControlScope, d as DirectiveRegistration, b as EnumRegistration, a as FieldRegistration, f as GraphQLEffectContext, c as InputTypeRegistration, I as InterfaceRegistration, e as MiddlewareRegistration, O as ObjectFieldRegistration, S as SubscriptionFieldRegistration, T as TypeRegistration, g as TypeRegistries, U as UnionRegistration } from '../schema-builder-DKvkzU_M.js';
3
+ import { DirectiveLocation, GraphQLResolveInfo, DocumentNode, GraphQLError, ExecutionResult, GraphQLSchema } from 'graphql';
4
+ export { DirectiveLocation } from 'graphql';
5
+ import { Effect, Stream, Layer } from 'effect';
6
+ import * as S from 'effect/Schema';
7
+ import 'effect/Cause';
8
+ import 'effect/Types';
9
+
8
10
  /**
9
11
  * Add an object type to the schema builder (pipe-able)
10
12
  * Name is optional if schema is TaggedStruct, TaggedClass, or Schema.Class
11
13
  */
12
- export declare const objectType: <A, R2 = never>(config: {
14
+ declare const objectType: <A, R2 = never>(config: {
13
15
  name?: string;
14
16
  schema: S.Schema<A, any, any>;
17
+ description?: string;
15
18
  implements?: readonly string[];
16
19
  directives?: readonly DirectiveApplication[];
17
20
  /**
@@ -33,7 +36,7 @@ export declare const objectType: <A, R2 = never>(config: {
33
36
  * Add an interface type to the schema builder (pipe-able)
34
37
  * Name is optional if schema is TaggedStruct, TaggedClass, or Schema.Class
35
38
  */
36
- export declare const interfaceType: (config: {
39
+ declare const interfaceType: (config: {
37
40
  name?: string;
38
41
  schema: S.Schema<any, any, any>;
39
42
  resolveType?: (value: any) => string;
@@ -42,7 +45,7 @@ export declare const interfaceType: (config: {
42
45
  /**
43
46
  * Add an enum type to the schema builder (pipe-able)
44
47
  */
45
- export declare const enumType: (config: {
48
+ declare const enumType: (config: {
46
49
  name: string;
47
50
  values: readonly string[];
48
51
  description?: string;
@@ -51,7 +54,7 @@ export declare const enumType: (config: {
51
54
  /**
52
55
  * Add a union type to the schema builder (pipe-able)
53
56
  */
54
- export declare const unionType: (config: {
57
+ declare const unionType: (config: {
55
58
  name: string;
56
59
  types: readonly string[];
57
60
  resolveType?: (value: any) => string;
@@ -61,7 +64,7 @@ export declare const unionType: (config: {
61
64
  * Add an input type to the schema builder (pipe-able)
62
65
  * Name is optional if schema is TaggedStruct, TaggedClass, or Schema.Class
63
66
  */
64
- export declare const inputType: (config: {
67
+ declare const inputType: (config: {
65
68
  name?: string;
66
69
  schema: S.Schema<any, any, any>;
67
70
  description?: string;
@@ -77,7 +80,7 @@ export declare const inputType: (config: {
77
80
  * @param config.args - Optional Effect Schema for directive arguments
78
81
  * @param config.apply - Optional function to transform resolver Effects (for executable directives)
79
82
  */
80
- export declare const directive: <Args = void, R2 = never>(config: {
83
+ declare const directive: <Args = void, R2 = never>(config: {
81
84
  name: string;
82
85
  description?: string;
83
86
  locations: readonly DirectiveLocation[];
@@ -117,7 +120,7 @@ export declare const directive: <Args = void, R2 = never>(config: {
117
120
  * )
118
121
  * ```
119
122
  */
120
- export declare const middleware: <R2 = never>(config: {
123
+ declare const middleware: <R2 = never>(config: {
121
124
  name: string;
122
125
  description?: string;
123
126
  match?: (info: GraphQLResolveInfo) => boolean;
@@ -153,7 +156,7 @@ export declare const middleware: <R2 = never>(config: {
153
156
  * )
154
157
  * ```
155
158
  */
156
- export declare const extension: <R2 = never>(config: {
159
+ declare const extension: <R2 = never>(config: {
157
160
  name: string;
158
161
  description?: string;
159
162
  onParse?: (source: string, document: DocumentNode) => Effect.Effect<void, never, R2>;
@@ -164,7 +167,7 @@ export declare const extension: <R2 = never>(config: {
164
167
  /**
165
168
  * Add a query field to the schema builder (pipe-able)
166
169
  */
167
- export declare const query: <A, E, R2, Args = void>(name: string, config: {
170
+ declare const query: <A, E, R2, Args = void>(name: string, config: {
168
171
  type: S.Schema<A, any, any>;
169
172
  args?: S.Schema<Args, any, any>;
170
173
  description?: string;
@@ -176,7 +179,7 @@ export declare const query: <A, E, R2, Args = void>(name: string, config: {
176
179
  /**
177
180
  * Add a mutation field to the schema builder (pipe-able)
178
181
  */
179
- export declare const mutation: <A, E, R2, Args = void>(name: string, config: {
182
+ declare const mutation: <A, E, R2, Args = void>(name: string, config: {
180
183
  type: S.Schema<A, any, any>;
181
184
  args?: S.Schema<Args, any, any>;
182
185
  description?: string;
@@ -202,7 +205,7 @@ export declare const mutation: <A, E, R2, Args = void>(name: string, config: {
202
205
  * )
203
206
  * ```
204
207
  */
205
- export declare const subscription: <A, E, R2, Args = void>(name: string, config: {
208
+ declare const subscription: <A, E, R2, Args = void>(name: string, config: {
206
209
  type: S.Schema<A, any, any>;
207
210
  args?: S.Schema<Args, any, any>;
208
211
  description?: string;
@@ -215,7 +218,7 @@ export declare const subscription: <A, E, R2, Args = void>(name: string, config:
215
218
  /**
216
219
  * Add a field to an existing object type (pipe-able)
217
220
  */
218
- export declare const field: <Parent, A, E, R2, Args = void>(typeName: string, fieldName: string, config: {
221
+ declare const field: <Parent, A, E, R2, Args = void>(typeName: string, fieldName: string, config: {
219
222
  type: S.Schema<A, any, any>;
220
223
  args?: S.Schema<Args, any, any>;
221
224
  description?: string;
@@ -227,5 +230,31 @@ export declare const field: <Parent, A, E, R2, Args = void>(typeName: string, fi
227
230
  /**
228
231
  * Compose multiple schema operations (helper for arrays)
229
232
  */
230
- export declare const compose: <R>(...operations: Array<(builder: GraphQLSchemaBuilder<any>) => GraphQLSchemaBuilder<any>>) => (builder: GraphQLSchemaBuilder<R>) => GraphQLSchemaBuilder<any>;
231
- //# sourceMappingURL=pipe-api.d.ts.map
233
+ declare const compose: <R>(...operations: Array<(builder: GraphQLSchemaBuilder<any>) => GraphQLSchemaBuilder<any>>) => (builder: GraphQLSchemaBuilder<R>) => GraphQLSchemaBuilder<any>;
234
+
235
+ /**
236
+ * Execute a GraphQL query with a service layer
237
+ *
238
+ * This is the layer-per-request execution model. Build the schema once,
239
+ * then execute each request with its own layer (including request-scoped services).
240
+ *
241
+ * The execution follows these phases:
242
+ * 1. Parse - Convert source string to DocumentNode
243
+ * 2. Validate - Check document against schema
244
+ * 3. Execute - Run resolvers and return result
245
+ *
246
+ * Extensions can hook into each phase via onParse, onValidate, onExecuteStart, onExecuteEnd.
247
+ * Extension data is automatically merged into the response's extensions field.
248
+ */
249
+ declare const execute: <R>(schema: GraphQLSchema, layer: Layer.Layer<R>, extensions?: readonly GraphQLExtension<any>[], fieldComplexities?: FieldComplexityMap) => (source: string, variableValues?: Record<string, unknown>, operationName?: string) => Effect.Effect<ExecutionResult, Error>;
250
+
251
+ /**
252
+ * Extract type name from a schema if it has one.
253
+ * Supports:
254
+ * - S.TaggedStruct("Name", {...}) - extracts from _tag literal
255
+ * - S.TaggedClass()("Name", {...}) - extracts from identifier annotation
256
+ * - S.Class<T>("Name")({...}) - extracts from identifier annotation
257
+ */
258
+ declare function getSchemaName(schema: S.Schema<any, any, any>): string | undefined;
259
+
260
+ export { CacheHint, DirectiveApplication, GraphQLSchemaBuilder, MiddlewareContext, compose, directive, enumType, execute, extension, field, getSchemaName, inputType, interfaceType, middleware, mutation, objectType, query, subscription, unionType };