@chillicream/nitro-express-middleware 33.0.0-insider.5 → 33.0.0-insider.7
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/index.cjs +5 -2
- package/index.d.cts +2 -4
- package/index.d.mts +2 -4
- package/index.mjs +5 -2
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -34,15 +34,18 @@ const Paths = {
|
|
|
34
34
|
function resolveUrl(target) {
|
|
35
35
|
return typeof target === "string"
|
|
36
36
|
? target
|
|
37
|
-
: `${target?.baseUrl
|
|
37
|
+
: `${orDefault(target?.baseUrl, Defaults.CDN_URL)}/${orDefault(target?.version, Defaults.VERSION)}`;
|
|
38
38
|
}
|
|
39
39
|
function resolvePath(target) {
|
|
40
40
|
const require$1 = module$1.createRequire(require('url').pathToFileURL(__filename).toString());
|
|
41
|
-
return path.dirname(require$1.resolve(target
|
|
41
|
+
return path.dirname(require$1.resolve(orDefault(target, Defaults.EMBEDDED_ID)));
|
|
42
42
|
}
|
|
43
43
|
function resolveOptions(options) {
|
|
44
44
|
return Object.assign({}, Defaults.OPTIONS, options);
|
|
45
45
|
}
|
|
46
|
+
function orDefault(value, fallback) {
|
|
47
|
+
return value !== undefined && value !== "" ? value : fallback;
|
|
48
|
+
}
|
|
46
49
|
|
|
47
50
|
function combineMiddlewares(...middlewares) {
|
|
48
51
|
return middlewares.reduce((a, b) => (req, res, next) => {
|
package/index.d.cts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="express" />
|
|
2
|
-
|
|
3
|
-
readonly [key: string]: string | string[];
|
|
4
|
-
}
|
|
2
|
+
type HttpHeaderDictionary = Readonly<Record<string, string | string[]>>;
|
|
5
3
|
type SubscriptionProtocol = "auto" | "graphql-transport-ws" | "graphql-ws" | "graphql-sse";
|
|
6
4
|
interface Options {
|
|
7
5
|
readonly title?: string;
|
|
@@ -16,7 +14,7 @@ interface Options {
|
|
|
16
14
|
readonly endpoint?: string;
|
|
17
15
|
readonly httpHeaders?: HttpHeaderDictionary;
|
|
18
16
|
readonly graphQLDocument?: string;
|
|
19
|
-
readonly variables?: Record<string,
|
|
17
|
+
readonly variables?: Record<string, unknown>;
|
|
20
18
|
readonly organization?: {
|
|
21
19
|
readonly serverUrl?: string;
|
|
22
20
|
readonly name?: string;
|
package/index.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="express" />
|
|
2
|
-
|
|
3
|
-
readonly [key: string]: string | string[];
|
|
4
|
-
}
|
|
2
|
+
type HttpHeaderDictionary = Readonly<Record<string, string | string[]>>;
|
|
5
3
|
type SubscriptionProtocol = "auto" | "graphql-transport-ws" | "graphql-ws" | "graphql-sse";
|
|
6
4
|
interface Options {
|
|
7
5
|
readonly title?: string;
|
|
@@ -16,7 +14,7 @@ interface Options {
|
|
|
16
14
|
readonly endpoint?: string;
|
|
17
15
|
readonly httpHeaders?: HttpHeaderDictionary;
|
|
18
16
|
readonly graphQLDocument?: string;
|
|
19
|
-
readonly variables?: Record<string,
|
|
17
|
+
readonly variables?: Record<string, unknown>;
|
|
20
18
|
readonly organization?: {
|
|
21
19
|
readonly serverUrl?: string;
|
|
22
20
|
readonly name?: string;
|
package/index.mjs
CHANGED
|
@@ -30,15 +30,18 @@ const Paths = {
|
|
|
30
30
|
function resolveUrl(target) {
|
|
31
31
|
return typeof target === "string"
|
|
32
32
|
? target
|
|
33
|
-
: `${target?.baseUrl
|
|
33
|
+
: `${orDefault(target?.baseUrl, Defaults.CDN_URL)}/${orDefault(target?.version, Defaults.VERSION)}`;
|
|
34
34
|
}
|
|
35
35
|
function resolvePath(target) {
|
|
36
36
|
const require = module.createRequire(import.meta.url);
|
|
37
|
-
return path.dirname(require.resolve(target
|
|
37
|
+
return path.dirname(require.resolve(orDefault(target, Defaults.EMBEDDED_ID)));
|
|
38
38
|
}
|
|
39
39
|
function resolveOptions(options) {
|
|
40
40
|
return Object.assign({}, Defaults.OPTIONS, options);
|
|
41
41
|
}
|
|
42
|
+
function orDefault(value, fallback) {
|
|
43
|
+
return value !== undefined && value !== "" ? value : fallback;
|
|
44
|
+
}
|
|
42
45
|
|
|
43
46
|
function combineMiddlewares(...middlewares) {
|
|
44
47
|
return middlewares.reduce((a, b) => (req, res, next) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chillicream/nitro-express-middleware",
|
|
3
|
-
"version": "33.0.0-insider.
|
|
3
|
+
"version": "33.0.0-insider.7",
|
|
4
4
|
"description": "Express middleware for Nitro GraphQL IDE",
|
|
5
5
|
"homepage": "https://chillicream.com",
|
|
6
6
|
"repository": "github:ChilliCream/graphql-platform",
|