grafserv 0.0.0 → 0.0.1-0.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/CHANGELOG.md +103 -0
- package/README.md +248 -1
- package/dist/accept.d.ts +8 -0
- package/dist/accept.d.ts.map +1 -0
- package/dist/accept.js +419 -0
- package/dist/accept.js.map +1 -0
- package/dist/core/base.d.ts +35 -0
- package/dist/core/base.d.ts.map +1 -0
- package/dist/core/base.js +381 -0
- package/dist/core/base.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces.d.ts +177 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +6 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/mapIterator.d.ts +2 -0
- package/dist/mapIterator.d.ts.map +1 -0
- package/dist/mapIterator.js +65 -0
- package/dist/mapIterator.js.map +1 -0
- package/dist/middleware/graphiql.d.ts +4 -0
- package/dist/middleware/graphiql.d.ts.map +1 -0
- package/dist/middleware/graphiql.js +31 -0
- package/dist/middleware/graphiql.js.map +1 -0
- package/dist/middleware/graphql.d.ts +9 -0
- package/dist/middleware/graphql.d.ts.map +1 -0
- package/dist/middleware/graphql.js +415 -0
- package/dist/middleware/graphql.js.map +1 -0
- package/dist/options.d.ts +14 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +23 -0
- package/dist/options.js.map +1 -0
- package/dist/servers/express/v4/index.d.ts +20 -0
- package/dist/servers/express/v4/index.d.ts.map +1 -0
- package/dist/servers/express/v4/index.js +43 -0
- package/dist/servers/express/v4/index.js.map +1 -0
- package/dist/servers/fastify/v4/index.d.ts +21 -0
- package/dist/servers/fastify/v4/index.d.ts.map +1 -0
- package/dist/servers/fastify/v4/index.js +179 -0
- package/dist/servers/fastify/v4/index.js.map +1 -0
- package/dist/servers/koa/v2/index.d.ts +21 -0
- package/dist/servers/koa/v2/index.d.ts.map +1 -0
- package/dist/servers/koa/v2/index.js +110 -0
- package/dist/servers/koa/v2/index.js.map +1 -0
- package/dist/servers/node/index.d.ts +22 -0
- package/dist/servers/node/index.d.ts.map +1 -0
- package/dist/servers/node/index.js +173 -0
- package/dist/servers/node/index.js.map +1 -0
- package/dist/utils.d.ts +16 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +121 -0
- package/dist/utils.js.map +1 -0
- package/package.json +76 -5
- package/index.js +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grafserv = exports.ExpressGrafserv = void 0;
|
|
4
|
+
const utils_js_1 = require("../../../utils.js");
|
|
5
|
+
const index_js_1 = require("../../node/index.js");
|
|
6
|
+
class ExpressGrafserv extends index_js_1.NodeGrafserv {
|
|
7
|
+
getDigest(dynamicOptions, req, res) {
|
|
8
|
+
return {
|
|
9
|
+
httpVersionMajor: req.httpVersionMajor,
|
|
10
|
+
httpVersionMinor: req.httpVersionMinor,
|
|
11
|
+
isSecure: req.secure,
|
|
12
|
+
method: req.method,
|
|
13
|
+
path: req.path,
|
|
14
|
+
headers: (0, utils_js_1.processHeaders)(req.headers),
|
|
15
|
+
getQueryParams() {
|
|
16
|
+
return req.query;
|
|
17
|
+
},
|
|
18
|
+
getBody() {
|
|
19
|
+
if (req.body != null) {
|
|
20
|
+
return (0, utils_js_1.getBodyFromFrameworkBody)(req.body);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return (0, utils_js_1.getBodyFromRequest)(req, dynamicOptions.maxRequestLength);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
requestContext: {
|
|
27
|
+
expressv4: {
|
|
28
|
+
req,
|
|
29
|
+
res,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
addTo(app) {
|
|
35
|
+
app.use(this.createHandler());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ExpressGrafserv = ExpressGrafserv;
|
|
39
|
+
function grafserv(config) {
|
|
40
|
+
return new ExpressGrafserv(config);
|
|
41
|
+
}
|
|
42
|
+
exports.grafserv = grafserv;
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/servers/express/v4/index.ts"],"names":[],"mappings":";;;AAIA,gDAI2B;AAC3B,kDAAmD;AAanD,MAAa,eAAgB,SAAQ,uBAAY;IACrC,SAAS,CACjB,cAAiC,EACjC,GAAY,EACZ,GAAa;QAEb,OAAO;YACL,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,QAAQ,EAAE,GAAG,CAAC,MAAM;YACpB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,IAAA,yBAAc,EAAC,GAAG,CAAC,OAAO,CAAC;YACpC,cAAc;gBACZ,OAAO,GAAG,CAAC,KAA0C,CAAC;YACxD,CAAC;YACD,OAAO;gBACL,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE;oBACpB,OAAO,IAAA,mCAAwB,EAAC,GAAG,CAAC,IAAI,CAAC,CAAC;iBAC3C;qBAAM;oBACL,OAAO,IAAA,6BAAkB,EAAC,GAAG,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;iBACjE;YACH,CAAC;YACD,cAAc,EAAE;gBACd,SAAS,EAAE;oBACT,GAAG;oBACH,GAAG;iBACJ;aACF;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAY;QAChB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAChC,CAAC;CACF;AAnCD,0CAmCC;AAED,SAAgB,QAAQ,CAAC,MAAsB;IAC7C,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAFD,4BAEC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
|
3
|
+
import { GrafservBase } from "../../../core/base.js";
|
|
4
|
+
import type { GrafservConfig, Result } from "../../../interfaces.js";
|
|
5
|
+
declare global {
|
|
6
|
+
namespace GraphileConfig {
|
|
7
|
+
interface GraphQLRequestContext {
|
|
8
|
+
fastifyv4: {
|
|
9
|
+
request: FastifyRequest;
|
|
10
|
+
reply: FastifyReply;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare class FastifyGrafserv extends GrafservBase {
|
|
16
|
+
constructor(config: GrafservConfig);
|
|
17
|
+
send(request: FastifyRequest, reply: FastifyReply, result: Result | null): Promise<Buffer | import("../../../interfaces.js").JSONValue>;
|
|
18
|
+
addTo(app: FastifyInstance): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function grafserv(config: GrafservConfig): FastifyGrafserv;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/servers/fastify/v4/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG7E,OAAO,EAEL,YAAY,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,cAAc,EAEd,MAAM,EACP,MAAM,wBAAwB,CAAC;AAOhC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,cAAc,CAAC;QACvB,UAAU,qBAAqB;YAC7B,SAAS,EAAE;gBACT,OAAO,EAAE,cAAc,CAAC;gBACxB,KAAK,EAAE,YAAY,CAAC;aACrB,CAAC;SACH;KACF;CACF;AA8BD,qBAAa,eAAgB,SAAQ,YAAY;gBACnC,MAAM,EAAE,cAAc;IAIrB,IAAI,CACf,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,GAAG,IAAI;IAgFvB,KAAK,CAAC,GAAG,EAAE,eAAe;CAqE3B;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,mBAE9C"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grafserv = exports.FastifyGrafserv = void 0;
|
|
4
|
+
const node_stream_1 = require("node:stream");
|
|
5
|
+
const base_js_1 = require("../../../core/base.js");
|
|
6
|
+
const utils_js_1 = require("../../../utils.js");
|
|
7
|
+
function getDigest(request, reply) {
|
|
8
|
+
return {
|
|
9
|
+
httpVersionMajor: request.raw.httpVersionMajor,
|
|
10
|
+
httpVersionMinor: request.raw.httpVersionMinor,
|
|
11
|
+
// TODO: check Fastify respects X-Forwarded-Proto when configured to trust the proxy
|
|
12
|
+
isSecure: request.protocol === "https",
|
|
13
|
+
method: request.method,
|
|
14
|
+
path: request.url,
|
|
15
|
+
headers: (0, utils_js_1.processHeaders)(request.headers),
|
|
16
|
+
getQueryParams() {
|
|
17
|
+
return request.query;
|
|
18
|
+
},
|
|
19
|
+
getBody() {
|
|
20
|
+
return (0, utils_js_1.getBodyFromFrameworkBody)(request.body);
|
|
21
|
+
},
|
|
22
|
+
requestContext: {
|
|
23
|
+
fastifyv4: {
|
|
24
|
+
request,
|
|
25
|
+
reply,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
preferJSON: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
class FastifyGrafserv extends base_js_1.GrafservBase {
|
|
32
|
+
constructor(config) {
|
|
33
|
+
super(config);
|
|
34
|
+
}
|
|
35
|
+
async send(request, reply, result) {
|
|
36
|
+
if (result === null) {
|
|
37
|
+
// 404
|
|
38
|
+
reply.statusCode = 404;
|
|
39
|
+
return "¯\\_(ツ)_/¯";
|
|
40
|
+
}
|
|
41
|
+
switch (result.type) {
|
|
42
|
+
case "error": {
|
|
43
|
+
const { statusCode, headers } = result;
|
|
44
|
+
reply.headers(headers);
|
|
45
|
+
reply.statusCode = statusCode;
|
|
46
|
+
// TODO: mutating the error is probably bad form...
|
|
47
|
+
const errorWithStatus = Object.assign(result.error, {
|
|
48
|
+
status: statusCode,
|
|
49
|
+
});
|
|
50
|
+
throw errorWithStatus;
|
|
51
|
+
}
|
|
52
|
+
case "buffer": {
|
|
53
|
+
const { statusCode, headers, buffer } = result;
|
|
54
|
+
reply.headers(headers);
|
|
55
|
+
reply.statusCode = statusCode;
|
|
56
|
+
return buffer;
|
|
57
|
+
}
|
|
58
|
+
case "json": {
|
|
59
|
+
const { statusCode, headers, json } = result;
|
|
60
|
+
reply.headers(headers);
|
|
61
|
+
reply.statusCode = statusCode;
|
|
62
|
+
return json;
|
|
63
|
+
}
|
|
64
|
+
case "bufferStream": {
|
|
65
|
+
const { statusCode, headers, lowLatency, bufferIterator } = result;
|
|
66
|
+
if (lowLatency) {
|
|
67
|
+
request.raw.socket.setTimeout(0);
|
|
68
|
+
request.raw.socket.setNoDelay(true);
|
|
69
|
+
request.raw.socket.setKeepAlive(true);
|
|
70
|
+
}
|
|
71
|
+
reply.headers(headers);
|
|
72
|
+
reply.statusCode = statusCode;
|
|
73
|
+
const stream = new node_stream_1.PassThrough();
|
|
74
|
+
reply.send(stream);
|
|
75
|
+
// Fork off and convert bufferIterator to
|
|
76
|
+
try {
|
|
77
|
+
for await (const buffer of bufferIterator) {
|
|
78
|
+
stream.write(buffer);
|
|
79
|
+
}
|
|
80
|
+
stream.end();
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
try {
|
|
84
|
+
stream.end();
|
|
85
|
+
}
|
|
86
|
+
catch (e2) {
|
|
87
|
+
/* nom nom nom */
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
// TODO: what should we really do here?
|
|
91
|
+
if (bufferIterator.return) {
|
|
92
|
+
bufferIterator.return();
|
|
93
|
+
}
|
|
94
|
+
else if (bufferIterator.throw) {
|
|
95
|
+
bufferIterator.throw(e);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (e2) {
|
|
99
|
+
/* nom nom nom */
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return reply;
|
|
103
|
+
}
|
|
104
|
+
default: {
|
|
105
|
+
const never = result;
|
|
106
|
+
console.log("Unhandled:");
|
|
107
|
+
console.dir(never);
|
|
108
|
+
reply.type("text/plain");
|
|
109
|
+
reply.statusCode = 503;
|
|
110
|
+
return "Server hasn't implemented this yet";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
addTo(app) {
|
|
115
|
+
// application/graphql-request+json isn't currently an official serialization format:
|
|
116
|
+
// https://graphql.github.io/graphql-over-http/draft/#sec-Media-Types
|
|
117
|
+
/*
|
|
118
|
+
app.addContentTypeParser(
|
|
119
|
+
"application/graphql-request+json",
|
|
120
|
+
{ parseAs: "string" },
|
|
121
|
+
app.getDefaultJsonParser("ignore", "ignore"),
|
|
122
|
+
);
|
|
123
|
+
*/
|
|
124
|
+
const dynamicOptions = this.dynamicOptions;
|
|
125
|
+
app.route({
|
|
126
|
+
method: this.dynamicOptions.graphqlOverGET ||
|
|
127
|
+
this.dynamicOptions.graphiqlOnGraphQLGET
|
|
128
|
+
? ["GET", "POST"]
|
|
129
|
+
: ["POST"],
|
|
130
|
+
url: this.dynamicOptions.graphqlPath,
|
|
131
|
+
bodyLimit: this.dynamicOptions.maxRequestLength,
|
|
132
|
+
handler: async (request, reply) => {
|
|
133
|
+
const digest = getDigest(request, reply);
|
|
134
|
+
const handlerResult = await this.graphqlHandler((0, utils_js_1.normalizeRequest)(digest), this.graphiqlHandler);
|
|
135
|
+
const result = await (0, base_js_1.convertHandlerResultToResult)(handlerResult);
|
|
136
|
+
return this.send(request, reply, result);
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
if (dynamicOptions.graphiql) {
|
|
140
|
+
app.route({
|
|
141
|
+
method: "GET",
|
|
142
|
+
url: this.dynamicOptions.graphiqlPath,
|
|
143
|
+
bodyLimit: this.dynamicOptions.maxRequestLength,
|
|
144
|
+
handler: async (request, reply) => {
|
|
145
|
+
const digest = getDigest(request, reply);
|
|
146
|
+
const handlerResult = await this.graphiqlHandler((0, utils_js_1.normalizeRequest)(digest));
|
|
147
|
+
const result = await (0, base_js_1.convertHandlerResultToResult)(handlerResult);
|
|
148
|
+
return this.send(request, reply, result);
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (dynamicOptions.watch) {
|
|
153
|
+
app.route({
|
|
154
|
+
method: "GET",
|
|
155
|
+
url: this.dynamicOptions.eventStreamRoute,
|
|
156
|
+
bodyLimit: this.dynamicOptions.maxRequestLength,
|
|
157
|
+
handler: async (request, reply) => {
|
|
158
|
+
const digest = getDigest(request, reply);
|
|
159
|
+
// TODO: refactor this to use the eventStreamHandler once we write that...
|
|
160
|
+
const handlerResult = {
|
|
161
|
+
type: "event-stream",
|
|
162
|
+
request: (0, utils_js_1.normalizeRequest)(digest),
|
|
163
|
+
dynamicOptions,
|
|
164
|
+
payload: this.makeStream(),
|
|
165
|
+
statusCode: 200,
|
|
166
|
+
};
|
|
167
|
+
const result = await (0, base_js_1.convertHandlerResultToResult)(handlerResult);
|
|
168
|
+
return this.send(request, reply, result);
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.FastifyGrafserv = FastifyGrafserv;
|
|
175
|
+
function grafserv(config) {
|
|
176
|
+
return new FastifyGrafserv(config);
|
|
177
|
+
}
|
|
178
|
+
exports.grafserv = grafserv;
|
|
179
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @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,CAAC,gBAAgB;gBACzC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,gBAAgB;gBAC/C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;oBAChC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;oBACzC,0EAA0E;oBAC1E,MAAM,aAAa,GAA8B;wBAC/C,IAAI,EAAE,cAAc;wBACpB,OAAO,EAAE,IAAA,2BAAgB,EAAC,MAAM,CAAC;wBACjC,cAAc;wBACd,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;wBAC1B,UAAU,EAAE,GAAG;qBAChB,CAAC;oBACF,MAAM,MAAM,GAAG,MAAM,IAAA,sCAA4B,EAAC,aAAa,CAAC,CAAC;oBACjE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC3C,CAAC;aACF,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AA7JD,0CA6JC;AAED,SAAgB,QAAQ,CAAC,MAAsB;IAC7C,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAFD,4BAEC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="koa-bodyparser" />
|
|
2
|
+
import type { Context } from "koa";
|
|
3
|
+
import type Koa from "koa";
|
|
4
|
+
import { GrafservBase } from "../../../core/base.js";
|
|
5
|
+
import type { GrafservConfig } from "../../../interfaces.js";
|
|
6
|
+
declare global {
|
|
7
|
+
namespace GraphileConfig {
|
|
8
|
+
interface GraphQLRequestContext {
|
|
9
|
+
koav2: {
|
|
10
|
+
ctx: Context;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare class KoaGrafserv extends GrafservBase {
|
|
16
|
+
constructor(config: GrafservConfig);
|
|
17
|
+
createHandler(): (ctx: Context, next: (err?: Error) => void) => void;
|
|
18
|
+
addTo(app: Koa): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function grafserv(config: GrafservConfig): KoaGrafserv;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/servers/koa/v2/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,wBAAwB,CAAC;AAQ5E,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,cAAc,CAAC;QACvB,UAAU,qBAAqB;YAC7B,KAAK,EAAE;gBACL,GAAG,EAAE,OAAO,CAAC;aACd,CAAC;SACH;KACF;CACF;AAkCD,qBAAa,WAAY,SAAQ,YAAY;gBAC/B,MAAM,EAAE,cAAc;IAI3B,aAAa,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,KAAK,IAAI;IAiE3E,KAAK,CAAC,GAAG,EAAE,GAAG;CAGf;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,eAE9C"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grafserv = exports.KoaGrafserv = void 0;
|
|
4
|
+
const node_stream_1 = require("node:stream");
|
|
5
|
+
const base_js_1 = require("../../../core/base.js");
|
|
6
|
+
const utils_js_1 = require("../../../utils.js");
|
|
7
|
+
function getDigest(dynamicOptions, ctx) {
|
|
8
|
+
return {
|
|
9
|
+
httpVersionMajor: ctx.req.httpVersionMajor,
|
|
10
|
+
httpVersionMinor: ctx.req.httpVersionMinor,
|
|
11
|
+
// TODO: check Koa respects X-Forwarded-Proto when configured to trust the proxy
|
|
12
|
+
isSecure: ctx.secure,
|
|
13
|
+
method: ctx.request.method,
|
|
14
|
+
path: ctx.request.url,
|
|
15
|
+
headers: (0, utils_js_1.processHeaders)(ctx.request.headers),
|
|
16
|
+
getQueryParams() {
|
|
17
|
+
return ctx.request.query;
|
|
18
|
+
},
|
|
19
|
+
getBody() {
|
|
20
|
+
if ("body" in ctx.request) {
|
|
21
|
+
return (0, utils_js_1.getBodyFromFrameworkBody)(ctx.request.body);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// No koa-bodyparser, let's just read the body ourself
|
|
25
|
+
return (0, utils_js_1.getBodyFromRequest)(ctx.req, dynamicOptions.maxRequestLength);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
requestContext: {
|
|
29
|
+
koav2: {
|
|
30
|
+
ctx,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
preferJSON: true,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
class KoaGrafserv extends base_js_1.GrafservBase {
|
|
37
|
+
constructor(config) {
|
|
38
|
+
super(config);
|
|
39
|
+
}
|
|
40
|
+
createHandler() {
|
|
41
|
+
const dynamicOptions = this.dynamicOptions;
|
|
42
|
+
return async (ctx, next) => {
|
|
43
|
+
const request = getDigest(dynamicOptions, ctx);
|
|
44
|
+
const result = await this.processRequest(request);
|
|
45
|
+
if (result === null) {
|
|
46
|
+
return next();
|
|
47
|
+
}
|
|
48
|
+
switch (result.type) {
|
|
49
|
+
case "error": {
|
|
50
|
+
const { statusCode, headers } = result;
|
|
51
|
+
ctx.response.set(headers);
|
|
52
|
+
ctx.response.status = statusCode;
|
|
53
|
+
// TODO: mutating the error is probably bad form...
|
|
54
|
+
const errorWithStatus = Object.assign(result.error, {
|
|
55
|
+
status: statusCode,
|
|
56
|
+
});
|
|
57
|
+
throw errorWithStatus;
|
|
58
|
+
}
|
|
59
|
+
case "buffer": {
|
|
60
|
+
const { statusCode, headers, buffer } = result;
|
|
61
|
+
ctx.response.set(headers);
|
|
62
|
+
ctx.response.status = statusCode;
|
|
63
|
+
ctx.response.body = buffer;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
case "json": {
|
|
67
|
+
const { statusCode, headers, json } = result;
|
|
68
|
+
ctx.response.set(headers);
|
|
69
|
+
ctx.response.status = statusCode;
|
|
70
|
+
ctx.response.body = json;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
case "bufferStream": {
|
|
74
|
+
const { statusCode, headers, lowLatency, bufferIterator } = result;
|
|
75
|
+
if (lowLatency) {
|
|
76
|
+
ctx.req.socket.setTimeout(0);
|
|
77
|
+
ctx.req.socket.setNoDelay(true);
|
|
78
|
+
ctx.req.socket.setKeepAlive(true);
|
|
79
|
+
}
|
|
80
|
+
ctx.response.set(headers);
|
|
81
|
+
ctx.response.status = statusCode;
|
|
82
|
+
const stream = new node_stream_1.PassThrough();
|
|
83
|
+
ctx.response.body = stream;
|
|
84
|
+
for await (const buffer of bufferIterator) {
|
|
85
|
+
stream.write(buffer);
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
default: {
|
|
90
|
+
const never = result;
|
|
91
|
+
console.log("Unhandled:");
|
|
92
|
+
console.dir(never);
|
|
93
|
+
ctx.response.type = "text/plain";
|
|
94
|
+
ctx.response.status = 503;
|
|
95
|
+
ctx.response.body = "Server hasn't implemented this yet";
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
addTo(app) {
|
|
102
|
+
app.use(this.createHandler());
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.KoaGrafserv = KoaGrafserv;
|
|
106
|
+
function grafserv(config) {
|
|
107
|
+
return new KoaGrafserv(config);
|
|
108
|
+
}
|
|
109
|
+
exports.grafserv = grafserv;
|
|
110
|
+
//# sourceMappingURL=index.js.map
|
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IAC7C,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAFD,4BAEC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
3
|
+
import { GrafservBase } from "../../core/base.js";
|
|
4
|
+
import type { GrafservConfig, RequestDigest } from "../../interfaces.js";
|
|
5
|
+
import type { OptionsFromConfig } from "../../options.js";
|
|
6
|
+
declare global {
|
|
7
|
+
namespace GraphileConfig {
|
|
8
|
+
interface GraphQLRequestContext {
|
|
9
|
+
node: {
|
|
10
|
+
req: IncomingMessage;
|
|
11
|
+
res: ServerResponse;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export declare class NodeGrafserv extends GrafservBase {
|
|
17
|
+
constructor(config: GrafservConfig);
|
|
18
|
+
protected getDigest(dynamicOptions: OptionsFromConfig, req: IncomingMessage, res: ServerResponse, isHTTPS: boolean): RequestDigest;
|
|
19
|
+
createHandler(isHTTPS?: boolean): (req: IncomingMessage, res: ServerResponse, next?: (err?: Error) => void) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function grafserv(config: GrafservConfig): NodeGrafserv;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/servers/node/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,cAAc,CAAC;QACvB,UAAU,qBAAqB;YAC7B,IAAI,EAAE;gBACJ,GAAG,EAAE,eAAe,CAAC;gBACrB,GAAG,EAAE,cAAc,CAAC;aACrB,CAAC;SACH;KACF;CACF;AAED,qBAAa,YAAa,SAAQ,YAAY;gBAChC,MAAM,EAAE,cAAc;IAIlC,SAAS,CAAC,SAAS,CACjB,cAAc,EAAE,iBAAiB,EACjC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,OAAO,GACf,aAAa;IA8BT,aAAa,CAClB,OAAO,UAAQ,GACd,CACD,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,KACzB,IAAI;CAuIV;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,gBAE9C"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grafserv = exports.NodeGrafserv = void 0;
|
|
4
|
+
const node_querystring_1 = require("node:querystring");
|
|
5
|
+
const base_js_1 = require("../../core/base.js");
|
|
6
|
+
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
class NodeGrafserv extends base_js_1.GrafservBase {
|
|
8
|
+
constructor(config) {
|
|
9
|
+
super(config);
|
|
10
|
+
}
|
|
11
|
+
getDigest(dynamicOptions, req, res, isHTTPS) {
|
|
12
|
+
const reqUrl = req.url;
|
|
13
|
+
const qi = reqUrl.indexOf("?");
|
|
14
|
+
const path = qi >= 0 ? reqUrl.substring(0, qi) : reqUrl;
|
|
15
|
+
const search = qi >= 0 ? reqUrl.substring(qi + 1) : null;
|
|
16
|
+
return {
|
|
17
|
+
httpVersionMajor: req.httpVersionMajor,
|
|
18
|
+
httpVersionMinor: req.httpVersionMinor,
|
|
19
|
+
isSecure: isHTTPS,
|
|
20
|
+
method: req.method,
|
|
21
|
+
path,
|
|
22
|
+
headers: (0, utils_js_1.processHeaders)(req.headers),
|
|
23
|
+
getQueryParams() {
|
|
24
|
+
const queryParams = search
|
|
25
|
+
? (0, node_querystring_1.parse)(search)
|
|
26
|
+
: Object.create(null);
|
|
27
|
+
return queryParams;
|
|
28
|
+
},
|
|
29
|
+
getBody() {
|
|
30
|
+
return (0, utils_js_1.getBodyFromRequest)(req, dynamicOptions.maxRequestLength);
|
|
31
|
+
},
|
|
32
|
+
requestContext: {
|
|
33
|
+
node: {
|
|
34
|
+
req,
|
|
35
|
+
res,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
createHandler(isHTTPS = false) {
|
|
41
|
+
const dynamicOptions = this.dynamicOptions;
|
|
42
|
+
// FIXME: 'async' here is risky
|
|
43
|
+
return async (req, res, next) => {
|
|
44
|
+
try {
|
|
45
|
+
const request = this.getDigest(dynamicOptions, req, res, isHTTPS);
|
|
46
|
+
const result = await this.processRequest(request);
|
|
47
|
+
if (result === null) {
|
|
48
|
+
if (typeof next === "function") {
|
|
49
|
+
return next();
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const payload = Buffer.from(`Could not process ${req.method} request to ${req.url} ─ please POST requests to ${dynamicOptions.graphqlPath}`, "utf8");
|
|
53
|
+
res.writeHead(404, {
|
|
54
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
55
|
+
"Content-Length": payload.length,
|
|
56
|
+
});
|
|
57
|
+
res.end(payload);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
switch (result.type) {
|
|
62
|
+
case "error": {
|
|
63
|
+
if (typeof next === "function") {
|
|
64
|
+
return next(result.error);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const payload = Buffer.from("An error occurred", "utf8");
|
|
68
|
+
res.writeHead(500, {
|
|
69
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
70
|
+
"Content-Length": payload.length,
|
|
71
|
+
});
|
|
72
|
+
res.end(payload);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
case "buffer": {
|
|
77
|
+
const { statusCode, headers, buffer } = result;
|
|
78
|
+
res.writeHead(statusCode, headers);
|
|
79
|
+
res.end(buffer);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
case "json": {
|
|
83
|
+
const { statusCode, headers, json } = result;
|
|
84
|
+
const buffer = Buffer.from(JSON.stringify(json), "utf8");
|
|
85
|
+
headers["Content-Length"] = String(buffer.length);
|
|
86
|
+
res.writeHead(statusCode, headers);
|
|
87
|
+
res.end(buffer);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
case "bufferStream": {
|
|
91
|
+
const { statusCode, headers, lowLatency, bufferIterator } = result;
|
|
92
|
+
if (lowLatency) {
|
|
93
|
+
req.socket.setTimeout(0);
|
|
94
|
+
req.socket.setNoDelay(true);
|
|
95
|
+
req.socket.setKeepAlive(true);
|
|
96
|
+
}
|
|
97
|
+
res.writeHead(statusCode, headers);
|
|
98
|
+
// Clean up when connection closes.
|
|
99
|
+
const cleanup = () => {
|
|
100
|
+
try {
|
|
101
|
+
bufferIterator.return?.();
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
/* nom nom nom */
|
|
105
|
+
}
|
|
106
|
+
req.removeListener("close", cleanup);
|
|
107
|
+
req.removeListener("finish", cleanup);
|
|
108
|
+
req.removeListener("error", cleanup);
|
|
109
|
+
};
|
|
110
|
+
req.on("close", cleanup);
|
|
111
|
+
req.on("finish", cleanup);
|
|
112
|
+
req.on("error", cleanup);
|
|
113
|
+
// https://github.com/expressjs/compression#server-sent-events
|
|
114
|
+
const flush = lowLatency
|
|
115
|
+
? typeof res.flush === "function"
|
|
116
|
+
? res.flush.bind(res)
|
|
117
|
+
: typeof res.flushHeaders === "function"
|
|
118
|
+
? res.flushHeaders.bind(res)
|
|
119
|
+
: null
|
|
120
|
+
: null;
|
|
121
|
+
try {
|
|
122
|
+
for await (const buffer of bufferIterator) {
|
|
123
|
+
res.write(buffer);
|
|
124
|
+
// FIXME: Technically we should see if `.write()` returned
|
|
125
|
+
// false, and if so we should pause the stream.
|
|
126
|
+
if (flush) {
|
|
127
|
+
flush();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
console.error(`Error occurred during stream; swallowing error.`, e);
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
res.end();
|
|
136
|
+
}
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
default: {
|
|
140
|
+
const never = result;
|
|
141
|
+
console.log("Unhandled:");
|
|
142
|
+
console.dir(never);
|
|
143
|
+
const payload = Buffer.from("Server hasn't implemented this yet", "utf8");
|
|
144
|
+
res.writeHead(503, { "Content-Length": payload.length });
|
|
145
|
+
res.end(payload);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
console.error("Unexpected error occurred:");
|
|
152
|
+
console.error(e);
|
|
153
|
+
if (typeof next === "function") {
|
|
154
|
+
next(e);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const text = "Unknown error occurred";
|
|
158
|
+
res.writeHead(500, {
|
|
159
|
+
"Content-Type": "text/plain",
|
|
160
|
+
"Content-Length": text.length,
|
|
161
|
+
});
|
|
162
|
+
res.end(text);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.NodeGrafserv = NodeGrafserv;
|
|
169
|
+
function grafserv(config) {
|
|
170
|
+
return new NodeGrafserv(config);
|
|
171
|
+
}
|
|
172
|
+
exports.grafserv = grafserv;
|
|
173
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/servers/node/index.ts"],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;wBAC5B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;wBAC1B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;wBACnB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CACzB,oCAAoC,EACpC,MAAM,CACP,CAAC;wBACF,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;wBACzD,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;wBACjB,OAAO;qBACR;iBACF;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;gBAC5C,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;oBAC9B,IAAI,CAAC,CAAC,CAAC,CAAC;iBACT;qBAAM;oBACL,MAAM,IAAI,GAAG,wBAAwB,CAAC;oBACtC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;wBACjB,cAAc,EAAE,YAAY;wBAC5B,gBAAgB,EAAE,IAAI,CAAC,MAAM;qBAC9B,CAAC,CAAC;oBACH,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;iBACf;aACF;QACH,CAAC,CAAC;IACJ,CAAC;CACF;AArLD,oCAqLC;AAED,SAAgB,QAAQ,CAAC,MAAsB;IAC7C,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AAFD,4BAEC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { AsyncExecutionResult, ExecutionResult } from "graphql";
|
|
3
|
+
import type { Readable } from "node:stream";
|
|
4
|
+
import type { GrafservBody, NormalizedRequestDigest, RequestDigest } from "./interfaces.js";
|
|
5
|
+
export declare function handleErrors(payload: ExecutionResult | AsyncExecutionResult): void;
|
|
6
|
+
declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
7
|
+
export declare function processHeaders(headers: IncomingHttpHeaders): Record<string, string>;
|
|
8
|
+
export declare function getBodyFromRequest(req: Readable, maxLength: number): Promise<GrafservBody>;
|
|
9
|
+
export declare function getBodyFromFrameworkBody(body: unknown): GrafservBody;
|
|
10
|
+
export declare function memo<T>(fn: () => T): () => T;
|
|
11
|
+
export declare function normalizeRequest(request: RequestDigest | NormalizedRequestDigest): NormalizedRequestDigest;
|
|
12
|
+
export declare function httpError(statusCode: number, message: string): Error & {
|
|
13
|
+
statusCode: number;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,KAAK,EACV,YAAY,EAEZ,uBAAuB,EACvB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAGzB,wBAAgB,YAAY,CAC1B,OAAO,EAAE,eAAe,GAAG,oBAAoB,GAC9C,IAAI,CAaN;AAGD,aAAK,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAEzE,wBAAgB,cAAc,CAC5B,OAAO,EAAE,mBAAmB,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcxB;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,YAAY,CAAC,CAsBvB;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAqBpE;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,CAY5C;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,aAAa,GAAG,uBAAuB,GAC/C,uBAAuB,CAczB;AAED,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,KAAK,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAEhC"}
|