@znight/graphql 0.0.0 → 0.2.1
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/LICENSE +21 -0
- package/README.md +1346 -0
- package/dist/compiler.d.mts +114 -0
- package/dist/compiler.mjs +4599 -0
- package/dist/compiler.mjs.map +1 -0
- package/dist/index.d.mts +583 -0
- package/dist/index.mjs +134 -0
- package/dist/index.mjs.map +1 -0
- package/dist/names-BlzDM5cF.mjs +111 -0
- package/dist/names-BlzDM5cF.mjs.map +1 -0
- package/dist/plugin-CR_wVfRU.mjs +3445 -0
- package/dist/plugin-CR_wVfRU.mjs.map +1 -0
- package/dist/testing.d.mts +101 -0
- package/dist/testing.mjs +306 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/types-DQ713UgI.d.mts +266 -0
- package/package.json +97 -1
- package/src/compiler/analyze.ts +727 -0
- package/src/compiler/builder.ts +1561 -0
- package/src/compiler/checks.ts +105 -0
- package/src/compiler/conformance.ts +1068 -0
- package/src/compiler/constants.ts +80 -0
- package/src/compiler/data.ts +83 -0
- package/src/compiler/defaults.ts +92 -0
- package/src/compiler/discriminators.ts +53 -0
- package/src/compiler/docs.ts +55 -0
- package/src/compiler/generate.ts +419 -0
- package/src/compiler/graphql-js.ts +42 -0
- package/src/compiler/ids.ts +128 -0
- package/src/compiler/index.ts +98 -0
- package/src/compiler/locate.ts +82 -0
- package/src/compiler/model.ts +137 -0
- package/src/compiler/options.ts +85 -0
- package/src/compiler/scalars.ts +138 -0
- package/src/compiler/schema-first.ts +595 -0
- package/src/compiler/sdl-source.ts +529 -0
- package/src/compiler/sdl-view.ts +61 -0
- package/src/compiler/suggest.ts +39 -0
- package/src/context.ts +181 -0
- package/src/decisions.ts +169 -0
- package/src/decorators.ts +202 -0
- package/src/errors.ts +89 -0
- package/src/execution.ts +1064 -0
- package/src/format.ts +285 -0
- package/src/index.ts +89 -0
- package/src/limits.ts +177 -0
- package/src/loaders.ts +149 -0
- package/src/memory-pubsub.ts +133 -0
- package/src/metadata.ts +222 -0
- package/src/names.ts +47 -0
- package/src/options.ts +331 -0
- package/src/pipeline.ts +338 -0
- package/src/plugin.ts +579 -0
- package/src/pubsub.ts +36 -0
- package/src/results.ts +206 -0
- package/src/scalars.ts +138 -0
- package/src/schema-hash.ts +18 -0
- package/src/schema.ts +635 -0
- package/src/sdl.ts +530 -0
- package/src/testing.ts +454 -0
- package/src/tokens.ts +22 -0
- package/src/transport/abort.ts +80 -0
- package/src/transport/accept.ts +155 -0
- package/src/transport/graphiql.ts +106 -0
- package/src/transport/http.ts +373 -0
- package/src/transport/sse.ts +45 -0
- package/src/type-ref.ts +89 -0
- package/src/types.ts +225 -0
- package/src/validate-args.ts +48 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { Token } from "@znight/core";
|
|
2
|
+
import { GuardEnforcement, HttpContext, RouteMetaCarrier } from "@znight/http";
|
|
3
|
+
import { ConstValueNode, DocumentNode, GraphQLResolveInfo } from "graphql";
|
|
4
|
+
/**
|
|
5
|
+
* GraphQL errors shown to clients (RFC 0005 §5.10, §8.8): `GraphQLException` and the
|
|
6
|
+
* `extensions.code` values the plugin produces (Apollo conventions, which clients already know).
|
|
7
|
+
*
|
|
8
|
+
* Import-free: the exception is a plain `Error` subclass, rendered by the runtime as
|
|
9
|
+
* `{ message, locations, path, extensions: { code, ...extensions } }`.
|
|
10
|
+
*/
|
|
11
|
+
/** `extensions.code` values produced by `@znight/graphql`. Applications may use their own codes too. */
|
|
12
|
+
declare const GraphQLErrorCode: {
|
|
13
|
+
/** The document does not parse (syntax error, `limits.maxTokens`). */
|
|
14
|
+
readonly ParseFailed: "GRAPHQL_PARSE_FAILED";
|
|
15
|
+
/** The document is not valid against the schema. */
|
|
16
|
+
readonly ValidationFailed: "GRAPHQL_VALIDATION_FAILED";
|
|
17
|
+
/** Invalid variables or arguments (Standard Schema issues in `extensions.issues`), HTTP 400. */
|
|
18
|
+
readonly BadUserInput: "BAD_USER_INPUT";
|
|
19
|
+
/** The document exceeds `limits.maxDepth`, `maxAliases` or `maxDirectives`. */
|
|
20
|
+
readonly QueryTooComplex: "QUERY_TOO_COMPLEX";
|
|
21
|
+
/** HTTP 401. */
|
|
22
|
+
readonly Unauthenticated: "UNAUTHENTICATED";
|
|
23
|
+
/** A guard returned `false`, or HTTP 403. */
|
|
24
|
+
readonly Forbidden: "FORBIDDEN";
|
|
25
|
+
/** HTTP 404, or a key missing from `orderByKeys`. */
|
|
26
|
+
readonly NotFound: "NOT_FOUND";
|
|
27
|
+
/** HTTP 409. */
|
|
28
|
+
readonly Conflict: "CONFLICT";
|
|
29
|
+
/** HTTP 429. */
|
|
30
|
+
readonly TooManyRequests: "TOO_MANY_REQUESTS";
|
|
31
|
+
/** Any other HTTP 4xx. */
|
|
32
|
+
readonly BadRequest: "BAD_REQUEST";
|
|
33
|
+
/** A subscriber fell behind its buffer: its stream ends with this error. */
|
|
34
|
+
readonly SubscriptionOverflow: "SUBSCRIPTION_OVERFLOW";
|
|
35
|
+
/** Too many active subscriptions (`subscriptions.maxActive`), HTTP 503. */
|
|
36
|
+
readonly ServiceUnavailable: "SERVICE_UNAVAILABLE";
|
|
37
|
+
/** An unexpected error, masked (`Unexpected error.`) unless `exposeErrors`. */
|
|
38
|
+
readonly InternalServerError: "INTERNAL_SERVER_ERROR";
|
|
39
|
+
};
|
|
40
|
+
/** One of the {@link GraphQLErrorCode} values. */
|
|
41
|
+
type GraphQLErrorCodeValue = (typeof GraphQLErrorCode)[keyof typeof GraphQLErrorCode];
|
|
42
|
+
/** Options of {@link GraphQLException}. */
|
|
43
|
+
interface GraphQLExceptionOptions {
|
|
44
|
+
/** `extensions.code` (`'NOT_FOUND'`, `'CONFLICT'`, or an application code). */
|
|
45
|
+
readonly code: GraphQLErrorCodeValue | (string & Record<never, never>);
|
|
46
|
+
/** Extra `extensions` entries, sent to the client (`code` always wins). */
|
|
47
|
+
readonly extensions?: Readonly<Record<string, unknown>>;
|
|
48
|
+
/**
|
|
49
|
+
* The original error: never sent, logged once at `error` level with the request id, the schema
|
|
50
|
+
* coordinate and the path when the exception is shown for a field.
|
|
51
|
+
*/
|
|
52
|
+
readonly cause?: unknown;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* An error whose message and extensions are sent to the client as they are (§5.10): throw it from a
|
|
56
|
+
* resolver or return it from a `GraphQLErrorMapper`.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* throw new GraphQLException(`No book ${id}`, { code: 'NOT_FOUND', extensions: { bookId: id } })
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare class GraphQLException extends Error {
|
|
63
|
+
/** `extensions.code`. */
|
|
64
|
+
readonly code: string;
|
|
65
|
+
/** Extra `extensions` entries. */
|
|
66
|
+
readonly extensions: Readonly<Record<string, unknown>> | undefined;
|
|
67
|
+
constructor(message: string, options: GraphQLExceptionOptions);
|
|
68
|
+
}
|
|
69
|
+
/** Arguments of a field, after GraphQL coercion (and null handling, §7.3), by argument name. */
|
|
70
|
+
type GraphQLArgs = Readonly<Record<string, unknown>>;
|
|
71
|
+
/** Kind of a GraphQL operation. */
|
|
72
|
+
type GraphQLOperationKind = "query" | "mutation" | "subscription";
|
|
73
|
+
/** How an operation reached the server: GraphQL over HTTP, GraphQL over SSE, or `plugin.execute()`. */
|
|
74
|
+
type GraphQLTransport = "http" | "sse" | "direct";
|
|
75
|
+
/**
|
|
76
|
+
* Options of a loader (§5.5), read once per loader class: the `options` property of a
|
|
77
|
+
* {@link BatchLoad} provider. They are DataLoader's, except `batchScheduleFn` (Znight batches per
|
|
78
|
+
* tick of the execution).
|
|
79
|
+
*/
|
|
80
|
+
interface LoaderOptions<K = unknown> {
|
|
81
|
+
/** Largest number of keys passed to one `load()` call. Default: unlimited. */
|
|
82
|
+
readonly maxBatchSize?: number;
|
|
83
|
+
/** Cache values per execution (by key). Default `true`. */
|
|
84
|
+
readonly cache?: boolean;
|
|
85
|
+
/** Cache key of a key, for object keys (`key => key.id`). Default: the key itself. */
|
|
86
|
+
cacheKeyFn?(key: K): unknown;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A batch loader (§5.5): a provider that loads many keys at once. Inject its per-execution
|
|
90
|
+
* DataLoader with `@Loader() authors: Loader<AuthorsById>`.
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* @Injectable()
|
|
94
|
+
* export class AuthorsById implements BatchLoad<ID, Author> {
|
|
95
|
+
* constructor(private readonly authors: AuthorRepository) {}
|
|
96
|
+
*
|
|
97
|
+
* async load(ids: readonly ID[]): Promise<readonly (Author | Error)[]> {
|
|
98
|
+
* return orderByKeys(ids, await this.authors.findMany(ids), author => author.id)
|
|
99
|
+
* }
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
interface BatchLoad<K, V> {
|
|
104
|
+
/**
|
|
105
|
+
* Loads the values of `keys`: one value (or an `Error` failing that key only) per key, in the
|
|
106
|
+
* order of the keys. Another number of values fails every key of the batch (ZNIGHT065).
|
|
107
|
+
*/
|
|
108
|
+
load(keys: readonly K[]): Promise<readonly (V | Error)[]>;
|
|
109
|
+
/** DataLoader options, read once per loader class. */
|
|
110
|
+
readonly options?: LoaderOptions<K>;
|
|
111
|
+
}
|
|
112
|
+
/** Key type of a {@link BatchLoad} provider. */
|
|
113
|
+
type LoaderKey<L> = L extends {
|
|
114
|
+
load(keys: readonly (infer K)[]): unknown;
|
|
115
|
+
} ? K : never;
|
|
116
|
+
/** Value type of a {@link BatchLoad} provider (`Error`s excluded). */
|
|
117
|
+
type LoaderValue<L> = L extends {
|
|
118
|
+
load(keys: never): Promise<readonly (infer V)[]>;
|
|
119
|
+
} ? Exclude<V, Error> : never;
|
|
120
|
+
/**
|
|
121
|
+
* The DataLoader of one execution for a loader (§5.5): the part of the `dataloader` API resolvers
|
|
122
|
+
* use. `Loader<L>` (exported with the `@Loader()` decorator) is this view for the provider `L`.
|
|
123
|
+
*/
|
|
124
|
+
interface BatchLoader<K, V> {
|
|
125
|
+
/** The value of `key`, batched with the other keys requested in the same tick. */
|
|
126
|
+
load(key: K): Promise<V>;
|
|
127
|
+
/** The values of `keys`: a value or an `Error` per key, never a rejection. */
|
|
128
|
+
loadMany(keys: readonly K[]): Promise<(V | Error)[]>;
|
|
129
|
+
/** Forgets the cached value of `key`. */
|
|
130
|
+
clear(key: K): this;
|
|
131
|
+
/** Forgets every cached value. */
|
|
132
|
+
clearAll(): this;
|
|
133
|
+
/** Caches a value for `key` (no effect when `key` is already cached). */
|
|
134
|
+
prime(key: K, value: V | PromiseLike<V> | Error): this;
|
|
135
|
+
}
|
|
136
|
+
/** A class of {@link BatchLoad} providers. */
|
|
137
|
+
type BatchLoadClass<L extends BatchLoad<unknown, unknown> = BatchLoad<unknown, unknown>> = abstract new (...args: never[]) => L;
|
|
138
|
+
/**
|
|
139
|
+
* The context of one GraphQL operation (§5.8): a request-scoped external
|
|
140
|
+
* (`@znight/graphql#GraphQLContext`), injected with `@Ctx()` in resolvers, in request-scoped
|
|
141
|
+
* providers, or as `Lazy<GraphQLContext>` in singletons. It is not a bag for user data: the
|
|
142
|
+
* authenticated user is a request-scoped provider filled by a guard.
|
|
143
|
+
*/
|
|
144
|
+
interface GraphQLContext {
|
|
145
|
+
/** Id of the request carrying the operation (`HttpContext.requestId` over HTTP). */
|
|
146
|
+
readonly requestId: string;
|
|
147
|
+
readonly transport: GraphQLTransport;
|
|
148
|
+
/** The HTTP request carrying the operation; `undefined` for `plugin.execute()`. */
|
|
149
|
+
readonly http: HttpContext | undefined;
|
|
150
|
+
readonly operationType: GraphQLOperationKind;
|
|
151
|
+
readonly operationName: string | undefined;
|
|
152
|
+
/** The parsed (and validated) document, shared through the document cache: never mutate it. */
|
|
153
|
+
readonly document: DocumentNode;
|
|
154
|
+
readonly variables: Readonly<Record<string, unknown>>;
|
|
155
|
+
/**
|
|
156
|
+
* Over HTTP, the request's `ctx.signal` (RFC 0006): client gone, SSE stream closed on shutdown or
|
|
157
|
+
* `maxDuration`. Passed to graphql-js as `abortSignal`. Direct executions get the plugin's own.
|
|
158
|
+
* A subscription's also aborts when its stream ends (the source ended, or `return()`).
|
|
159
|
+
*/
|
|
160
|
+
readonly signal: AbortSignal;
|
|
161
|
+
/** Per-operation storage. */
|
|
162
|
+
readonly state: Map<string | symbol, unknown>;
|
|
163
|
+
/** The DataLoader of the current execution for a loader class (`ctx.loader(AuthorsById)`). */
|
|
164
|
+
loader<L extends BatchLoad<unknown, unknown>>(loader: BatchLoadClass<L>): BatchLoader<LoaderKey<L>, LoaderValue<L>>;
|
|
165
|
+
/**
|
|
166
|
+
* The DataLoader of the current execution for a loader provider token: what the generated
|
|
167
|
+
* `invoke` functions call (`c.loader('src/a.loader.ts#AuthorsById')`), with no class lookup.
|
|
168
|
+
*/
|
|
169
|
+
loader(token: Token): BatchLoader<unknown, unknown>;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* What a {@link GraphQLGuard} receives for one resolver call (§5.9). It satisfies the
|
|
173
|
+
* `RouteMetaCarrier` of `@znight/http`, so route decorators read it: `Roles.get(ctx)`.
|
|
174
|
+
*/
|
|
175
|
+
interface ResolverContext<TParent = unknown, TArgs extends GraphQLArgs = GraphQLArgs> extends RouteMetaCarrier {
|
|
176
|
+
/** Effective metadata of the field (method decisions over class decisions) and its schema coordinate. */
|
|
177
|
+
readonly route: {
|
|
178
|
+
readonly meta: Readonly<Record<string, unknown>>;
|
|
179
|
+
/** `Query.books`, `Book.author`. */
|
|
180
|
+
readonly coordinate: string;
|
|
181
|
+
};
|
|
182
|
+
/** The operation. */
|
|
183
|
+
readonly operation: GraphQLContext;
|
|
184
|
+
/** Name of the type owning the field (`Query`, `Book`). */
|
|
185
|
+
readonly parentType: string;
|
|
186
|
+
/** Name of the field. */
|
|
187
|
+
readonly field: string;
|
|
188
|
+
readonly args: TArgs;
|
|
189
|
+
/** The parent object (`undefined` for root fields, unless a root value is configured). */
|
|
190
|
+
readonly parent: TParent;
|
|
191
|
+
readonly info: GraphQLResolveInfo;
|
|
192
|
+
/** `operation.http`. */
|
|
193
|
+
readonly http: HttpContext | undefined;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* A guard of GraphQL fields (§5.9). Guards run global (plugin option) → class `@UseGuard` → method
|
|
197
|
+
* `@UseGuard`; `false` fails the field with a `FORBIDDEN` error, a thrown error is mapped (§5.10).
|
|
198
|
+
* One class may also implement `CanActivate` (HTTP routes).
|
|
199
|
+
*/
|
|
200
|
+
interface GraphQLGuard {
|
|
201
|
+
canResolve(ctx: ResolverContext): boolean | Promise<boolean>;
|
|
202
|
+
}
|
|
203
|
+
/** A class producing {@link GraphQLGuard}s, with the route decorators it enforces (`static enforces`). */
|
|
204
|
+
type GraphQLGuardClass = (abstract new (...args: never[]) => GraphQLGuard) & GuardEnforcement;
|
|
205
|
+
/**
|
|
206
|
+
* Converts application errors to GraphQL errors (§5.10). Mappers are tried in order for every
|
|
207
|
+
* error of `errors[]` that is not a `GraphQLException` already; the first one returning an
|
|
208
|
+
* exception wins, `undefined` passes. Synchronous: errors are formatted once the execution
|
|
209
|
+
* finished, without an extra await per error.
|
|
210
|
+
*/
|
|
211
|
+
interface GraphQLErrorMapper {
|
|
212
|
+
map(error: unknown, ctx: GraphQLContext): GraphQLException | undefined;
|
|
213
|
+
}
|
|
214
|
+
/** A class producing {@link GraphQLErrorMapper}s. */
|
|
215
|
+
type GraphQLErrorMapperClass = abstract new (...args: never[]) => GraphQLErrorMapper;
|
|
216
|
+
/**
|
|
217
|
+
* Turns the errors of a field into values of the field (errors as data, RFC 0008). It applies to
|
|
218
|
+
* the resolver-backed fields whose type is a union holding one of the object types it declares
|
|
219
|
+
* (`static types`), decided at boot; every other field keeps its errors in `errors[]`.
|
|
220
|
+
*
|
|
221
|
+
* ```ts
|
|
222
|
+
* @Injectable()
|
|
223
|
+
* export class Rejections implements GraphQLResultMapper {
|
|
224
|
+
* static readonly types = ['NotFoundRejection']
|
|
225
|
+
*
|
|
226
|
+
* toResult(error: unknown): NotFoundRejection | undefined {
|
|
227
|
+
* if (error instanceof NotFoundException) return { __typename: 'NotFoundRejection', message: error.message }
|
|
228
|
+
* return undefined
|
|
229
|
+
* }
|
|
230
|
+
* }
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
interface GraphQLResultMapper {
|
|
234
|
+
/**
|
|
235
|
+
* The value of the field for `error`: an object of a member of the field's union, or `undefined`
|
|
236
|
+
* to leave the error to the next mapper, then to `errors[]`. Synchronous. `error` is the raw
|
|
237
|
+
* error, a `GraphQLException` included (a guard returning `false` is `FORBIDDEN`, a Standard
|
|
238
|
+
* Schema failure of the arguments `BAD_USER_INPUT` with `extensions.issues`).
|
|
239
|
+
*/
|
|
240
|
+
toResult(error: unknown, ctx: ResolverContext): unknown;
|
|
241
|
+
}
|
|
242
|
+
/** The object types a result mapper may produce: names of object types of the schema. */
|
|
243
|
+
interface GraphQLResultTypes {
|
|
244
|
+
readonly types: readonly string[];
|
|
245
|
+
}
|
|
246
|
+
/** A class producing {@link GraphQLResultMapper}s, with the object types it produces (`static types`). */
|
|
247
|
+
type GraphQLResultMapperClass = (abstract new (...args: never[]) => GraphQLResultMapper) & GraphQLResultTypes;
|
|
248
|
+
/**
|
|
249
|
+
* The implementation of a custom scalar (§5.7), given to `scalar<T>(name, definition)`. The
|
|
250
|
+
* runtime maps it to graphql-js 17 `GraphQLScalarType` coercers: `serialize` → `coerceOutputValue`,
|
|
251
|
+
* `parseValue` → `coerceInputValue`, `parseLiteral` → `coerceInputLiteral` (the deprecated
|
|
252
|
+
* graphql-js names are never passed on).
|
|
253
|
+
*/
|
|
254
|
+
interface ScalarDefinition<T> {
|
|
255
|
+
readonly description?: string;
|
|
256
|
+
/** URL of the specification of the scalar (`@specifiedBy`). */
|
|
257
|
+
readonly specifiedByURL?: string;
|
|
258
|
+
/** Internal value → response value. */
|
|
259
|
+
serialize(value: T): unknown;
|
|
260
|
+
/** Variable value (JSON) → internal value; throw to reject it. */
|
|
261
|
+
parseValue(value: unknown): T;
|
|
262
|
+
/** Literal of the document → internal value. Default: `parseValue` of the literal's JSON value. */
|
|
263
|
+
parseLiteral?(literal: ConstValueNode): T;
|
|
264
|
+
}
|
|
265
|
+
export { GraphQLExceptionOptions as C, GraphQLException as S, LoaderValue as _, GraphQLContext as a, GraphQLErrorCode as b, GraphQLGuard as c, GraphQLResultMapper as d, GraphQLResultMapperClass as f, LoaderOptions as g, LoaderKey as h, GraphQLArgs as i, GraphQLGuardClass as l, GraphQLTransport as m, BatchLoadClass as n, GraphQLErrorMapper as o, GraphQLResultTypes as p, BatchLoader as r, GraphQLErrorMapperClass as s, BatchLoad as t, GraphQLOperationKind as u, ResolverContext as v, GraphQLErrorCodeValue as x, ScalarDefinition as y };
|
|
266
|
+
//# sourceMappingURL=types-DQ713UgI.d.mts.map
|
package/package.json
CHANGED
|
@@ -1 +1,97 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@znight/graphql",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Znight GraphQL: code-first GraphQL whose schema is derived from TypeScript types at build time, on graphql-js 17",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Ugho STEPHAN",
|
|
7
|
+
"homepage": "https://github.com/znight-org/znight/tree/main/packages/graphql#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/znight-org/znight.git",
|
|
11
|
+
"directory": "packages/graphql"
|
|
12
|
+
},
|
|
13
|
+
"bugs": "https://github.com/znight-org/znight/issues",
|
|
14
|
+
"keywords": ["znight", "graphql", "code-first", "dataloader", "subscriptions", "sse"],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=24"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"@znight/source": "./src/index.ts",
|
|
23
|
+
"types": "./dist/index.d.mts",
|
|
24
|
+
"default": "./dist/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"./compiler": {
|
|
27
|
+
"@znight/source": "./src/compiler/index.ts",
|
|
28
|
+
"types": "./dist/compiler.d.mts",
|
|
29
|
+
"default": "./dist/compiler.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./testing": {
|
|
32
|
+
"@znight/source": "./src/testing.ts",
|
|
33
|
+
"types": "./dist/testing.d.mts",
|
|
34
|
+
"default": "./dist/testing.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"types": "./dist/index.d.mts",
|
|
39
|
+
"files": ["dist", "src"],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsdown",
|
|
42
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p test",
|
|
43
|
+
"test": "bun test --conditions=@znight/source test"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@znight/core": "0.2.1",
|
|
50
|
+
"dataloader": "^2.2.3"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@znight/http": "^0.2.1",
|
|
54
|
+
"@znight/compiler": "^0.2.1",
|
|
55
|
+
"@znight/testing": "^0.2.1",
|
|
56
|
+
"graphql": "^17.0.2"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"@znight/compiler": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"@znight/testing": {
|
|
63
|
+
"optional": true
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@znight/http": "0.2.1",
|
|
68
|
+
"@znight/compiler": "0.2.1",
|
|
69
|
+
"@znight/testing": "0.2.1",
|
|
70
|
+
"graphql": "17.0.2",
|
|
71
|
+
"graphql-http": "1.23.1",
|
|
72
|
+
"graphql-sse": "2.6.3",
|
|
73
|
+
"valibot": "1.5.0",
|
|
74
|
+
"zod": "4.6.7"
|
|
75
|
+
},
|
|
76
|
+
"znight": {
|
|
77
|
+
"apiVersion": 1,
|
|
78
|
+
"compiler": "@znight/graphql/compiler",
|
|
79
|
+
"provides": [
|
|
80
|
+
{
|
|
81
|
+
"export": "GraphQLContext",
|
|
82
|
+
"plugin": "GraphQLPlugin",
|
|
83
|
+
"scope": "request"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"export": "PubSub",
|
|
87
|
+
"plugin": "GraphQLPlugin",
|
|
88
|
+
"scope": "singleton"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"export": "GraphQLPlugin",
|
|
92
|
+
"plugin": "GraphQLPlugin",
|
|
93
|
+
"scope": "singleton"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|