@ttoss/graphql-api 0.10.2 → 0.10.3
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/dist/index.cjs +146 -0
- package/dist/index.d.cts +27 -21
- package/dist/index.d.mts +53 -0
- package/dist/index.mjs +129 -0
- package/dist/shield.cjs +10 -0
- package/dist/shield.d.cts +4 -2
- package/dist/shield.d.mts +4 -0
- package/dist/{esm/shield.js → shield.mjs} +2 -3
- package/package.json +5 -5
- package/dist/esm/index.js +0 -166
- package/dist/index.d.ts +0 -47
- package/dist/index.js +0 -205
- package/dist/shield.d.ts +0 -2
- package/dist/shield.js +0 -29
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
3
|
+
value: 'Module'
|
|
4
|
+
});
|
|
5
|
+
let graphql_middleware = require("graphql-middleware");
|
|
6
|
+
let graphql_compose = require("graphql-compose");
|
|
7
|
+
let _ttoss_ids = require("@ttoss/ids");
|
|
8
|
+
let graphql_compose_connection = require("graphql-compose-connection");
|
|
9
|
+
|
|
10
|
+
//#region src/buildSchema.ts
|
|
11
|
+
const buildSchema = ({
|
|
12
|
+
schemaComposer,
|
|
13
|
+
middlewares
|
|
14
|
+
}) => {
|
|
15
|
+
if (!schemaComposer) throw new Error("No schemaComposer provided");
|
|
16
|
+
const schema = schemaComposer.buildSchema();
|
|
17
|
+
if (middlewares) return (0, graphql_middleware.applyMiddleware)(schema, ...middlewares.map(middleware => {
|
|
18
|
+
/**
|
|
19
|
+
* https://github.com/dimatill/graphql-middleware/issues/433#issuecomment-1170187160
|
|
20
|
+
*/
|
|
21
|
+
if (middleware.generate) return middleware.generate(schema);
|
|
22
|
+
return middleware;
|
|
23
|
+
}));
|
|
24
|
+
return schema;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/composeWithRelay/nodeFieldConfig.ts
|
|
29
|
+
const getNodeFieldConfig = (typeMapForRelayNode, nodeInterface) => {
|
|
30
|
+
return {
|
|
31
|
+
description: "Fetches an object that has globally unique ID among all types",
|
|
32
|
+
type: nodeInterface,
|
|
33
|
+
args: {
|
|
34
|
+
id: {
|
|
35
|
+
type: "ID!",
|
|
36
|
+
description: "The globally unique ID among all types"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
resolve: (source, args, context, info) => {
|
|
40
|
+
if (!args.id || !(typeof args.id === "string")) return null;
|
|
41
|
+
const {
|
|
42
|
+
type
|
|
43
|
+
} = (0, _ttoss_ids.fromGlobalId)(args.id);
|
|
44
|
+
if (!typeMapForRelayNode[type]) return null;
|
|
45
|
+
const {
|
|
46
|
+
tc,
|
|
47
|
+
resolver: findById
|
|
48
|
+
} = typeMapForRelayNode[type];
|
|
49
|
+
if (findById && findById.resolve && tc) {
|
|
50
|
+
const graphqlType = tc.getType();
|
|
51
|
+
let projection;
|
|
52
|
+
if (info) projection = (0, graphql_compose.getProjectionFromAST)({
|
|
53
|
+
...info,
|
|
54
|
+
returnType: graphqlType
|
|
55
|
+
});else projection = {};
|
|
56
|
+
const idArgName = Object.keys(findById.args)[0];
|
|
57
|
+
return findById.resolve({
|
|
58
|
+
source,
|
|
59
|
+
args: {
|
|
60
|
+
[idArgName]: args.id
|
|
61
|
+
},
|
|
62
|
+
context,
|
|
63
|
+
info,
|
|
64
|
+
projection
|
|
65
|
+
}).then(res => {
|
|
66
|
+
if (!res) return res;
|
|
67
|
+
res.__nodeType = graphqlType;
|
|
68
|
+
return res;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/composeWithRelay/nodeInterface.ts
|
|
78
|
+
const NodeTC = graphql_compose.InterfaceTypeComposer.createTemp({
|
|
79
|
+
name: "Node",
|
|
80
|
+
description: "An object, that can be fetched by the globally unique ID among all types.",
|
|
81
|
+
fields: {
|
|
82
|
+
id: {
|
|
83
|
+
type: "ID!",
|
|
84
|
+
description: "The globally unique ID among all types."
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
resolveType: payload => {
|
|
88
|
+
return payload.__nodeType.name ? payload.__nodeType.name : null;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
const NodeInterface = NodeTC.getType();
|
|
92
|
+
const getNodeInterface = sc => {
|
|
93
|
+
if (sc.hasInstance("Node", graphql_compose.InterfaceTypeComposer)) return sc.get("Node");
|
|
94
|
+
sc.set("Node", NodeTC);
|
|
95
|
+
return NodeTC;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/composeWithRelay/composeWithRelay.ts
|
|
100
|
+
const TypeMapForRelayNode = {};
|
|
101
|
+
const composeWithRelay = tc => {
|
|
102
|
+
if (!(tc instanceof graphql_compose.ObjectTypeComposer)) throw new Error("You should provide ObjectTypeComposer instance to composeWithRelay method");
|
|
103
|
+
const nodeInterface = getNodeInterface(tc.schemaComposer);
|
|
104
|
+
const nodeFieldConfig = getNodeFieldConfig(TypeMapForRelayNode, nodeInterface);
|
|
105
|
+
if (tc.getTypeName() === "Query" || tc.getTypeName() === "RootQuery") {
|
|
106
|
+
tc.setField("node", nodeFieldConfig);
|
|
107
|
+
return tc;
|
|
108
|
+
}
|
|
109
|
+
if (tc.getTypeName() === "Mutation" || tc.getTypeName() === "RootMutation") return tc;
|
|
110
|
+
if (!tc.hasRecordIdFn()) throw new Error(`ObjectTypeComposer(${tc.getTypeName()}) should have recordIdFn. This function returns ID from provided object.`);
|
|
111
|
+
const findById = tc.getResolver("findById");
|
|
112
|
+
if (!findById) throw new Error(`ObjectTypeComposer(${tc.getTypeName()}) provided to composeWithRelay should have findById resolver.`);
|
|
113
|
+
TypeMapForRelayNode[tc.getTypeName()] = {
|
|
114
|
+
resolver: findById,
|
|
115
|
+
tc
|
|
116
|
+
};
|
|
117
|
+
tc.addFields({
|
|
118
|
+
id: {
|
|
119
|
+
type: "ID!",
|
|
120
|
+
description: "The globally unique ID among all types",
|
|
121
|
+
resolve: source => {
|
|
122
|
+
return (0, _ttoss_ids.toGlobalId)(tc.getTypeName(), tc.getRecordId(source).toString());
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
tc.addInterface(nodeInterface);
|
|
127
|
+
return tc;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
exports.buildSchema = buildSchema;
|
|
132
|
+
Object.defineProperty(exports, 'composeWithConnection', {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return graphql_compose_connection.composeWithConnection;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
exports.composeWithRelay = composeWithRelay;
|
|
139
|
+
Object.keys(graphql_compose).forEach(function (k) {
|
|
140
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
get: function () {
|
|
143
|
+
return graphql_compose[k];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { SchemaComposer, ObjectTypeComposer } from 'graphql-compose';
|
|
3
|
-
export * from 'graphql-compose';
|
|
4
|
-
import { IMiddleware, IMiddlewareGenerator } from 'graphql-middleware';
|
|
5
|
-
export { IMiddleware as Middleware } from 'graphql-middleware';
|
|
6
|
-
export { composeWithConnection } from 'graphql-compose-connection';
|
|
7
1
|
|
|
2
|
+
import { GraphQLSchema } from "graphql";
|
|
3
|
+
import { ObjectTypeComposer, SchemaComposer } from "graphql-compose";
|
|
4
|
+
import { IMiddleware as Middleware, IMiddlewareGenerator as MiddlewareGenerator } from "graphql-middleware";
|
|
5
|
+
import { composeWithConnection } from "graphql-compose-connection";
|
|
6
|
+
export * from "graphql-compose";
|
|
7
|
+
|
|
8
|
+
//#region src/buildSchema.d.ts
|
|
8
9
|
type BuildSchemaInput<TContext = unknown> = {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
schemaComposer: SchemaComposer<TContext>;
|
|
11
|
+
middlewares?: (Middleware | MiddlewareGenerator<unknown, TContext, unknown>)[];
|
|
11
12
|
};
|
|
12
|
-
declare const buildSchema: ({
|
|
13
|
-
|
|
13
|
+
declare const buildSchema: ({
|
|
14
|
+
schemaComposer,
|
|
15
|
+
middlewares
|
|
16
|
+
}: BuildSchemaInput) => GraphQLSchema;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/composeWithRelay/composeWithRelay.d.ts
|
|
14
19
|
declare const composeWithRelay: <TContext>(tc: ObjectTypeComposer<any, TContext>) => ObjectTypeComposer<any, TContext>;
|
|
15
|
-
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/index.d.ts
|
|
16
22
|
/**
|
|
17
23
|
* Standard connection arguments used by resolvers created with `composeWithConnection`.
|
|
18
24
|
*
|
|
@@ -34,14 +40,14 @@ declare const composeWithRelay: <TContext>(tc: ObjectTypeComposer<any, TContext>
|
|
|
34
40
|
* ```
|
|
35
41
|
*/
|
|
36
42
|
type ConnectionArgs<TFilter = unknown, TSort = unknown> = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
first?: number | null;
|
|
44
|
+
after?: string | null;
|
|
45
|
+
last?: number | null;
|
|
46
|
+
before?: string | null;
|
|
47
|
+
limit?: number | null;
|
|
48
|
+
skip?: number | null;
|
|
49
|
+
sort?: TSort;
|
|
50
|
+
filter?: TFilter | null;
|
|
45
51
|
};
|
|
46
|
-
|
|
47
|
-
export { type BuildSchemaInput, type
|
|
52
|
+
//#endregion
|
|
53
|
+
export { type BuildSchemaInput, ConnectionArgs, type Middleware, buildSchema, composeWithConnection, composeWithRelay };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { IMiddleware as Middleware, IMiddlewareGenerator as MiddlewareGenerator } from "graphql-middleware";
|
|
3
|
+
import { ObjectTypeComposer, SchemaComposer } from "graphql-compose";
|
|
4
|
+
import { composeWithConnection } from "graphql-compose-connection";
|
|
5
|
+
import { GraphQLSchema } from "graphql";
|
|
6
|
+
export * from "graphql-compose";
|
|
7
|
+
|
|
8
|
+
//#region src/buildSchema.d.ts
|
|
9
|
+
type BuildSchemaInput<TContext = unknown> = {
|
|
10
|
+
schemaComposer: SchemaComposer<TContext>;
|
|
11
|
+
middlewares?: (Middleware | MiddlewareGenerator<unknown, TContext, unknown>)[];
|
|
12
|
+
};
|
|
13
|
+
declare const buildSchema: ({
|
|
14
|
+
schemaComposer,
|
|
15
|
+
middlewares
|
|
16
|
+
}: BuildSchemaInput) => GraphQLSchema;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/composeWithRelay/composeWithRelay.d.ts
|
|
19
|
+
declare const composeWithRelay: <TContext>(tc: ObjectTypeComposer<any, TContext>) => ObjectTypeComposer<any, TContext>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/index.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* Standard connection arguments used by resolvers created with `composeWithConnection`.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam TFilter - Shape of the connection-specific filter object. Defaults to `unknown`.
|
|
26
|
+
* @typeParam TSort - Shape of the sort value. Defaults to `unknown`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { type ConnectionArgs, type ResolverResolveParams } from '@ttoss/graphql-api';
|
|
31
|
+
*
|
|
32
|
+
* type NotificationFilter = { isRead?: boolean | null };
|
|
33
|
+
*
|
|
34
|
+
* NotificationTC.addResolver({
|
|
35
|
+
* name: 'findMany',
|
|
36
|
+
* resolve: async ({ args }: ResolverResolveParams<unknown, Context, ConnectionArgs<NotificationFilter>>) => {
|
|
37
|
+
* return findMany({ first: args.first, after: args.after, filter: args.filter });
|
|
38
|
+
* },
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
type ConnectionArgs<TFilter = unknown, TSort = unknown> = {
|
|
43
|
+
first?: number | null;
|
|
44
|
+
after?: string | null;
|
|
45
|
+
last?: number | null;
|
|
46
|
+
before?: string | null;
|
|
47
|
+
limit?: number | null;
|
|
48
|
+
skip?: number | null;
|
|
49
|
+
sort?: TSort;
|
|
50
|
+
filter?: TFilter | null;
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { type BuildSchemaInput, ConnectionArgs, type Middleware, buildSchema, composeWithConnection, composeWithRelay };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { applyMiddleware } from "graphql-middleware";
|
|
3
|
+
import { InterfaceTypeComposer, ObjectTypeComposer, getProjectionFromAST } from "graphql-compose";
|
|
4
|
+
import { fromGlobalId, toGlobalId } from "@ttoss/ids";
|
|
5
|
+
import { composeWithConnection } from "graphql-compose-connection";
|
|
6
|
+
export * from "graphql-compose";
|
|
7
|
+
|
|
8
|
+
//#region src/buildSchema.ts
|
|
9
|
+
const buildSchema = ({
|
|
10
|
+
schemaComposer,
|
|
11
|
+
middlewares
|
|
12
|
+
}) => {
|
|
13
|
+
if (!schemaComposer) throw new Error("No schemaComposer provided");
|
|
14
|
+
const schema = schemaComposer.buildSchema();
|
|
15
|
+
if (middlewares) return applyMiddleware(schema, ...middlewares.map(middleware => {
|
|
16
|
+
/**
|
|
17
|
+
* https://github.com/dimatill/graphql-middleware/issues/433#issuecomment-1170187160
|
|
18
|
+
*/
|
|
19
|
+
if (middleware.generate) return middleware.generate(schema);
|
|
20
|
+
return middleware;
|
|
21
|
+
}));
|
|
22
|
+
return schema;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/composeWithRelay/nodeFieldConfig.ts
|
|
27
|
+
const getNodeFieldConfig = (typeMapForRelayNode, nodeInterface) => {
|
|
28
|
+
return {
|
|
29
|
+
description: "Fetches an object that has globally unique ID among all types",
|
|
30
|
+
type: nodeInterface,
|
|
31
|
+
args: {
|
|
32
|
+
id: {
|
|
33
|
+
type: "ID!",
|
|
34
|
+
description: "The globally unique ID among all types"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
resolve: (source, args, context, info) => {
|
|
38
|
+
if (!args.id || !(typeof args.id === "string")) return null;
|
|
39
|
+
const {
|
|
40
|
+
type
|
|
41
|
+
} = fromGlobalId(args.id);
|
|
42
|
+
if (!typeMapForRelayNode[type]) return null;
|
|
43
|
+
const {
|
|
44
|
+
tc,
|
|
45
|
+
resolver: findById
|
|
46
|
+
} = typeMapForRelayNode[type];
|
|
47
|
+
if (findById && findById.resolve && tc) {
|
|
48
|
+
const graphqlType = tc.getType();
|
|
49
|
+
let projection;
|
|
50
|
+
if (info) projection = getProjectionFromAST({
|
|
51
|
+
...info,
|
|
52
|
+
returnType: graphqlType
|
|
53
|
+
});else projection = {};
|
|
54
|
+
const idArgName = Object.keys(findById.args)[0];
|
|
55
|
+
return findById.resolve({
|
|
56
|
+
source,
|
|
57
|
+
args: {
|
|
58
|
+
[idArgName]: args.id
|
|
59
|
+
},
|
|
60
|
+
context,
|
|
61
|
+
info,
|
|
62
|
+
projection
|
|
63
|
+
}).then(res => {
|
|
64
|
+
if (!res) return res;
|
|
65
|
+
res.__nodeType = graphqlType;
|
|
66
|
+
return res;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/composeWithRelay/nodeInterface.ts
|
|
76
|
+
const NodeTC = InterfaceTypeComposer.createTemp({
|
|
77
|
+
name: "Node",
|
|
78
|
+
description: "An object, that can be fetched by the globally unique ID among all types.",
|
|
79
|
+
fields: {
|
|
80
|
+
id: {
|
|
81
|
+
type: "ID!",
|
|
82
|
+
description: "The globally unique ID among all types."
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
resolveType: payload => {
|
|
86
|
+
return payload.__nodeType.name ? payload.__nodeType.name : null;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const NodeInterface = NodeTC.getType();
|
|
90
|
+
const getNodeInterface = sc => {
|
|
91
|
+
if (sc.hasInstance("Node", InterfaceTypeComposer)) return sc.get("Node");
|
|
92
|
+
sc.set("Node", NodeTC);
|
|
93
|
+
return NodeTC;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/composeWithRelay/composeWithRelay.ts
|
|
98
|
+
const TypeMapForRelayNode = {};
|
|
99
|
+
const composeWithRelay = tc => {
|
|
100
|
+
if (!(tc instanceof ObjectTypeComposer)) throw new Error("You should provide ObjectTypeComposer instance to composeWithRelay method");
|
|
101
|
+
const nodeInterface = getNodeInterface(tc.schemaComposer);
|
|
102
|
+
const nodeFieldConfig = getNodeFieldConfig(TypeMapForRelayNode, nodeInterface);
|
|
103
|
+
if (tc.getTypeName() === "Query" || tc.getTypeName() === "RootQuery") {
|
|
104
|
+
tc.setField("node", nodeFieldConfig);
|
|
105
|
+
return tc;
|
|
106
|
+
}
|
|
107
|
+
if (tc.getTypeName() === "Mutation" || tc.getTypeName() === "RootMutation") return tc;
|
|
108
|
+
if (!tc.hasRecordIdFn()) throw new Error(`ObjectTypeComposer(${tc.getTypeName()}) should have recordIdFn. This function returns ID from provided object.`);
|
|
109
|
+
const findById = tc.getResolver("findById");
|
|
110
|
+
if (!findById) throw new Error(`ObjectTypeComposer(${tc.getTypeName()}) provided to composeWithRelay should have findById resolver.`);
|
|
111
|
+
TypeMapForRelayNode[tc.getTypeName()] = {
|
|
112
|
+
resolver: findById,
|
|
113
|
+
tc
|
|
114
|
+
};
|
|
115
|
+
tc.addFields({
|
|
116
|
+
id: {
|
|
117
|
+
type: "ID!",
|
|
118
|
+
description: "The globally unique ID among all types",
|
|
119
|
+
resolve: source => {
|
|
120
|
+
return toGlobalId(tc.getTypeName(), tc.getRecordId(source).toString());
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
tc.addInterface(nodeInterface);
|
|
125
|
+
return tc;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
//#endregion
|
|
129
|
+
export { buildSchema, composeWithConnection, composeWithRelay };
|
package/dist/shield.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
var graphql_shield = require("graphql-shield");
|
|
3
|
+
Object.keys(graphql_shield).forEach(function (k) {
|
|
4
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function () {
|
|
7
|
+
return graphql_shield[k];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
package/dist/shield.d.cts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
import { IMiddleware, IMiddlewareFieldMap, IMiddlewareFunction, IMiddlewareGenerator, IMiddlewareGeneratorConstructor, IMiddlewareTypeMap } from "graphql-middleware";
|
|
3
|
+
export * from "graphql-shield";
|
|
4
|
+
export type { IMiddleware, IMiddlewareFieldMap, IMiddlewareFunction, IMiddlewareGenerator, IMiddlewareGeneratorConstructor, IMiddlewareTypeMap };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
import { IMiddleware, IMiddlewareFieldMap, IMiddlewareFunction, IMiddlewareGenerator, IMiddlewareGeneratorConstructor, IMiddlewareTypeMap } from "graphql-middleware";
|
|
3
|
+
export * from "graphql-shield";
|
|
4
|
+
export type { IMiddleware, IMiddlewareFieldMap, IMiddlewareFunction, IMiddlewareGenerator, IMiddlewareGeneratorConstructor, IMiddlewareTypeMap };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/graphql-api",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "A library for building GraphQL APIs using ttoss ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"graphql-middleware": "^6.1.35",
|
|
40
40
|
"graphql-shield": "^7.6.5",
|
|
41
41
|
"npmlog": "^7.0.1",
|
|
42
|
-
"@ttoss/ids": "^0.4.
|
|
42
|
+
"@ttoss/ids": "^0.4.13"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"graphql": "^16.11.0",
|
|
46
46
|
"jest": "^30.3.0",
|
|
47
|
-
"
|
|
48
|
-
"@ttoss/config": "^1.37.
|
|
47
|
+
"tsdown": "^0.22.0",
|
|
48
|
+
"@ttoss/config": "^1.37.13"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"graphql": "^16.6.0"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"provenance": true
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
|
-
"build": "
|
|
58
|
+
"build": "tsdown",
|
|
59
59
|
"test": "jest --projects tests/unit"
|
|
60
60
|
}
|
|
61
61
|
}
|
package/dist/esm/index.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
4
|
-
value,
|
|
5
|
-
configurable: true
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
// src/buildSchema.ts
|
|
9
|
-
import { applyMiddleware } from "graphql-middleware";
|
|
10
|
-
var buildSchema = /* @__PURE__ */__name(({
|
|
11
|
-
schemaComposer: schemaComposer2,
|
|
12
|
-
middlewares
|
|
13
|
-
}) => {
|
|
14
|
-
if (!schemaComposer2) {
|
|
15
|
-
throw new Error("No schemaComposer provided");
|
|
16
|
-
}
|
|
17
|
-
const schema = schemaComposer2.buildSchema();
|
|
18
|
-
if (middlewares) {
|
|
19
|
-
return applyMiddleware(schema, ...middlewares.map(middleware => {
|
|
20
|
-
if (middleware.generate) {
|
|
21
|
-
return middleware.generate(schema);
|
|
22
|
-
}
|
|
23
|
-
return middleware;
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
return schema;
|
|
27
|
-
}, "buildSchema");
|
|
28
|
-
|
|
29
|
-
// src/composeWithRelay/index.ts
|
|
30
|
-
import { schemaComposer } from "graphql-compose";
|
|
31
|
-
|
|
32
|
-
// src/composeWithRelay/composeWithRelay.ts
|
|
33
|
-
import { toGlobalId } from "@ttoss/ids";
|
|
34
|
-
import { ObjectTypeComposer } from "graphql-compose";
|
|
35
|
-
|
|
36
|
-
// src/composeWithRelay/nodeFieldConfig.ts
|
|
37
|
-
import { fromGlobalId } from "@ttoss/ids";
|
|
38
|
-
import { getProjectionFromAST } from "graphql-compose";
|
|
39
|
-
var getNodeFieldConfig = /* @__PURE__ */__name((typeMapForRelayNode, nodeInterface) => {
|
|
40
|
-
return {
|
|
41
|
-
description: "Fetches an object that has globally unique ID among all types",
|
|
42
|
-
type: nodeInterface,
|
|
43
|
-
args: {
|
|
44
|
-
id: {
|
|
45
|
-
type: "ID!",
|
|
46
|
-
description: "The globally unique ID among all types"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
// eslint-disable-next-line max-params
|
|
50
|
-
resolve: /* @__PURE__ */__name((source, args, context, info) => {
|
|
51
|
-
if (!args.id || !(typeof args.id === "string")) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
const {
|
|
55
|
-
type
|
|
56
|
-
} = fromGlobalId(args.id);
|
|
57
|
-
if (!typeMapForRelayNode[type]) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
const {
|
|
61
|
-
tc,
|
|
62
|
-
resolver: findById
|
|
63
|
-
} = typeMapForRelayNode[type];
|
|
64
|
-
if (findById && findById.resolve && tc) {
|
|
65
|
-
const graphqlType = tc.getType();
|
|
66
|
-
let projection;
|
|
67
|
-
if (info) {
|
|
68
|
-
projection = getProjectionFromAST({
|
|
69
|
-
...info,
|
|
70
|
-
returnType: graphqlType
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
projection = {};
|
|
74
|
-
}
|
|
75
|
-
const idArgName = Object.keys(findById.args)[0];
|
|
76
|
-
return findById.resolve({
|
|
77
|
-
source,
|
|
78
|
-
args: {
|
|
79
|
-
[idArgName]: args.id
|
|
80
|
-
},
|
|
81
|
-
context,
|
|
82
|
-
info,
|
|
83
|
-
projection
|
|
84
|
-
}).then(res => {
|
|
85
|
-
if (!res) {
|
|
86
|
-
return res;
|
|
87
|
-
}
|
|
88
|
-
res.__nodeType = graphqlType;
|
|
89
|
-
return res;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
return null;
|
|
93
|
-
}, "resolve")
|
|
94
|
-
};
|
|
95
|
-
}, "getNodeFieldConfig");
|
|
96
|
-
|
|
97
|
-
// src/composeWithRelay/nodeInterface.ts
|
|
98
|
-
import { InterfaceTypeComposer } from "graphql-compose";
|
|
99
|
-
var NodeTC = InterfaceTypeComposer.createTemp({
|
|
100
|
-
name: "Node",
|
|
101
|
-
description: "An object, that can be fetched by the globally unique ID among all types.",
|
|
102
|
-
fields: {
|
|
103
|
-
id: {
|
|
104
|
-
type: "ID!",
|
|
105
|
-
description: "The globally unique ID among all types."
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
resolveType: /* @__PURE__ */__name(payload => {
|
|
109
|
-
return payload.__nodeType.name ? payload.__nodeType.name : null;
|
|
110
|
-
}, "resolveType")
|
|
111
|
-
});
|
|
112
|
-
var NodeInterface = NodeTC.getType();
|
|
113
|
-
var getNodeInterface = /* @__PURE__ */__name(sc => {
|
|
114
|
-
if (sc.hasInstance("Node", InterfaceTypeComposer)) {
|
|
115
|
-
return sc.get("Node");
|
|
116
|
-
}
|
|
117
|
-
sc.set("Node", NodeTC);
|
|
118
|
-
return NodeTC;
|
|
119
|
-
}, "getNodeInterface");
|
|
120
|
-
|
|
121
|
-
// src/composeWithRelay/composeWithRelay.ts
|
|
122
|
-
var TypeMapForRelayNode = {};
|
|
123
|
-
var composeWithRelay = /* @__PURE__ */__name(tc => {
|
|
124
|
-
if (!(tc instanceof ObjectTypeComposer)) {
|
|
125
|
-
throw new Error("You should provide ObjectTypeComposer instance to composeWithRelay method");
|
|
126
|
-
}
|
|
127
|
-
const nodeInterface = getNodeInterface(tc.schemaComposer);
|
|
128
|
-
const nodeFieldConfig = getNodeFieldConfig(TypeMapForRelayNode, nodeInterface);
|
|
129
|
-
if (tc.getTypeName() === "Query" || tc.getTypeName() === "RootQuery") {
|
|
130
|
-
tc.setField("node", nodeFieldConfig);
|
|
131
|
-
return tc;
|
|
132
|
-
}
|
|
133
|
-
if (tc.getTypeName() === "Mutation" || tc.getTypeName() === "RootMutation") {
|
|
134
|
-
return tc;
|
|
135
|
-
}
|
|
136
|
-
if (!tc.hasRecordIdFn()) {
|
|
137
|
-
throw new Error(`ObjectTypeComposer(${tc.getTypeName()}) should have recordIdFn. This function returns ID from provided object.`);
|
|
138
|
-
}
|
|
139
|
-
const findById = tc.getResolver("findById");
|
|
140
|
-
if (!findById) {
|
|
141
|
-
throw new Error(`ObjectTypeComposer(${tc.getTypeName()}) provided to composeWithRelay should have findById resolver.`);
|
|
142
|
-
}
|
|
143
|
-
TypeMapForRelayNode[tc.getTypeName()] = {
|
|
144
|
-
resolver: findById,
|
|
145
|
-
tc
|
|
146
|
-
};
|
|
147
|
-
tc.addFields({
|
|
148
|
-
id: {
|
|
149
|
-
type: "ID!",
|
|
150
|
-
description: "The globally unique ID among all types",
|
|
151
|
-
resolve: /* @__PURE__ */__name(source => {
|
|
152
|
-
return toGlobalId(tc.getTypeName(), tc.getRecordId(source).toString());
|
|
153
|
-
}, "resolve")
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
tc.addInterface(nodeInterface);
|
|
157
|
-
return tc;
|
|
158
|
-
}, "composeWithRelay");
|
|
159
|
-
|
|
160
|
-
// src/composeWithRelay/index.ts
|
|
161
|
-
composeWithRelay(schemaComposer.Query);
|
|
162
|
-
|
|
163
|
-
// src/index.ts
|
|
164
|
-
export * from "graphql-compose";
|
|
165
|
-
import { composeWithConnection } from "graphql-compose-connection";
|
|
166
|
-
export { buildSchema, composeWithConnection, composeWithRelay };
|
package/dist/index.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { SchemaComposer, ObjectTypeComposer } from 'graphql-compose';
|
|
3
|
-
export * from 'graphql-compose';
|
|
4
|
-
import { IMiddleware, IMiddlewareGenerator } from 'graphql-middleware';
|
|
5
|
-
export { IMiddleware as Middleware } from 'graphql-middleware';
|
|
6
|
-
export { composeWithConnection } from 'graphql-compose-connection';
|
|
7
|
-
|
|
8
|
-
type BuildSchemaInput<TContext = unknown> = {
|
|
9
|
-
schemaComposer: SchemaComposer<TContext>;
|
|
10
|
-
middlewares?: (IMiddleware | IMiddlewareGenerator<unknown, TContext, unknown>)[];
|
|
11
|
-
};
|
|
12
|
-
declare const buildSchema: ({ schemaComposer, middlewares, }: BuildSchemaInput) => GraphQLSchema;
|
|
13
|
-
|
|
14
|
-
declare const composeWithRelay: <TContext>(tc: ObjectTypeComposer<any, TContext>) => ObjectTypeComposer<any, TContext>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Standard connection arguments used by resolvers created with `composeWithConnection`.
|
|
18
|
-
*
|
|
19
|
-
* @typeParam TFilter - Shape of the connection-specific filter object. Defaults to `unknown`.
|
|
20
|
-
* @typeParam TSort - Shape of the sort value. Defaults to `unknown`.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* import { type ConnectionArgs, type ResolverResolveParams } from '@ttoss/graphql-api';
|
|
25
|
-
*
|
|
26
|
-
* type NotificationFilter = { isRead?: boolean | null };
|
|
27
|
-
*
|
|
28
|
-
* NotificationTC.addResolver({
|
|
29
|
-
* name: 'findMany',
|
|
30
|
-
* resolve: async ({ args }: ResolverResolveParams<unknown, Context, ConnectionArgs<NotificationFilter>>) => {
|
|
31
|
-
* return findMany({ first: args.first, after: args.after, filter: args.filter });
|
|
32
|
-
* },
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
type ConnectionArgs<TFilter = unknown, TSort = unknown> = {
|
|
37
|
-
first?: number | null;
|
|
38
|
-
after?: string | null;
|
|
39
|
-
last?: number | null;
|
|
40
|
-
before?: string | null;
|
|
41
|
-
limit?: number | null;
|
|
42
|
-
skip?: number | null;
|
|
43
|
-
sort?: TSort;
|
|
44
|
-
filter?: TFilter | null;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export { type BuildSchemaInput, type ConnectionArgs, buildSchema, composeWithRelay };
|
package/dist/index.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
9
|
-
value,
|
|
10
|
-
configurable: true
|
|
11
|
-
});
|
|
12
|
-
var __export = (target, all) => {
|
|
13
|
-
for (var name in all) __defProp(target, name, {
|
|
14
|
-
get: all[name],
|
|
15
|
-
enumerable: true
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
-
get: () => from[key],
|
|
22
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
28
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
29
|
-
value: true
|
|
30
|
-
}), mod);
|
|
31
|
-
|
|
32
|
-
// src/index.ts
|
|
33
|
-
var index_exports = {};
|
|
34
|
-
__export(index_exports, {
|
|
35
|
-
buildSchema: () => buildSchema,
|
|
36
|
-
composeWithConnection: () => import_graphql_compose_connection.composeWithConnection,
|
|
37
|
-
composeWithRelay: () => composeWithRelay
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(index_exports);
|
|
40
|
-
|
|
41
|
-
// src/buildSchema.ts
|
|
42
|
-
var import_graphql_middleware = require("graphql-middleware");
|
|
43
|
-
var buildSchema = /* @__PURE__ */__name(({
|
|
44
|
-
schemaComposer: schemaComposer2,
|
|
45
|
-
middlewares
|
|
46
|
-
}) => {
|
|
47
|
-
if (!schemaComposer2) {
|
|
48
|
-
throw new Error("No schemaComposer provided");
|
|
49
|
-
}
|
|
50
|
-
const schema = schemaComposer2.buildSchema();
|
|
51
|
-
if (middlewares) {
|
|
52
|
-
return (0, import_graphql_middleware.applyMiddleware)(schema, ...middlewares.map(middleware => {
|
|
53
|
-
if (middleware.generate) {
|
|
54
|
-
return middleware.generate(schema);
|
|
55
|
-
}
|
|
56
|
-
return middleware;
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
return schema;
|
|
60
|
-
}, "buildSchema");
|
|
61
|
-
|
|
62
|
-
// src/composeWithRelay/index.ts
|
|
63
|
-
var import_graphql_compose4 = require("graphql-compose");
|
|
64
|
-
|
|
65
|
-
// src/composeWithRelay/composeWithRelay.ts
|
|
66
|
-
var import_ids2 = require("@ttoss/ids");
|
|
67
|
-
var import_graphql_compose3 = require("graphql-compose");
|
|
68
|
-
|
|
69
|
-
// src/composeWithRelay/nodeFieldConfig.ts
|
|
70
|
-
var import_ids = require("@ttoss/ids");
|
|
71
|
-
var import_graphql_compose = require("graphql-compose");
|
|
72
|
-
var getNodeFieldConfig = /* @__PURE__ */__name((typeMapForRelayNode, nodeInterface) => {
|
|
73
|
-
return {
|
|
74
|
-
description: "Fetches an object that has globally unique ID among all types",
|
|
75
|
-
type: nodeInterface,
|
|
76
|
-
args: {
|
|
77
|
-
id: {
|
|
78
|
-
type: "ID!",
|
|
79
|
-
description: "The globally unique ID among all types"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
// eslint-disable-next-line max-params
|
|
83
|
-
resolve: /* @__PURE__ */__name((source, args, context, info) => {
|
|
84
|
-
if (!args.id || !(typeof args.id === "string")) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const {
|
|
88
|
-
type
|
|
89
|
-
} = (0, import_ids.fromGlobalId)(args.id);
|
|
90
|
-
if (!typeMapForRelayNode[type]) {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
const {
|
|
94
|
-
tc,
|
|
95
|
-
resolver: findById
|
|
96
|
-
} = typeMapForRelayNode[type];
|
|
97
|
-
if (findById && findById.resolve && tc) {
|
|
98
|
-
const graphqlType = tc.getType();
|
|
99
|
-
let projection;
|
|
100
|
-
if (info) {
|
|
101
|
-
projection = (0, import_graphql_compose.getProjectionFromAST)({
|
|
102
|
-
...info,
|
|
103
|
-
returnType: graphqlType
|
|
104
|
-
});
|
|
105
|
-
} else {
|
|
106
|
-
projection = {};
|
|
107
|
-
}
|
|
108
|
-
const idArgName = Object.keys(findById.args)[0];
|
|
109
|
-
return findById.resolve({
|
|
110
|
-
source,
|
|
111
|
-
args: {
|
|
112
|
-
[idArgName]: args.id
|
|
113
|
-
},
|
|
114
|
-
context,
|
|
115
|
-
info,
|
|
116
|
-
projection
|
|
117
|
-
}).then(res => {
|
|
118
|
-
if (!res) {
|
|
119
|
-
return res;
|
|
120
|
-
}
|
|
121
|
-
res.__nodeType = graphqlType;
|
|
122
|
-
return res;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
return null;
|
|
126
|
-
}, "resolve")
|
|
127
|
-
};
|
|
128
|
-
}, "getNodeFieldConfig");
|
|
129
|
-
|
|
130
|
-
// src/composeWithRelay/nodeInterface.ts
|
|
131
|
-
var import_graphql_compose2 = require("graphql-compose");
|
|
132
|
-
var NodeTC = import_graphql_compose2.InterfaceTypeComposer.createTemp({
|
|
133
|
-
name: "Node",
|
|
134
|
-
description: "An object, that can be fetched by the globally unique ID among all types.",
|
|
135
|
-
fields: {
|
|
136
|
-
id: {
|
|
137
|
-
type: "ID!",
|
|
138
|
-
description: "The globally unique ID among all types."
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
resolveType: /* @__PURE__ */__name(payload => {
|
|
142
|
-
return payload.__nodeType.name ? payload.__nodeType.name : null;
|
|
143
|
-
}, "resolveType")
|
|
144
|
-
});
|
|
145
|
-
var NodeInterface = NodeTC.getType();
|
|
146
|
-
var getNodeInterface = /* @__PURE__ */__name(sc => {
|
|
147
|
-
if (sc.hasInstance("Node", import_graphql_compose2.InterfaceTypeComposer)) {
|
|
148
|
-
return sc.get("Node");
|
|
149
|
-
}
|
|
150
|
-
sc.set("Node", NodeTC);
|
|
151
|
-
return NodeTC;
|
|
152
|
-
}, "getNodeInterface");
|
|
153
|
-
|
|
154
|
-
// src/composeWithRelay/composeWithRelay.ts
|
|
155
|
-
var TypeMapForRelayNode = {};
|
|
156
|
-
var composeWithRelay = /* @__PURE__ */__name(tc => {
|
|
157
|
-
if (!(tc instanceof import_graphql_compose3.ObjectTypeComposer)) {
|
|
158
|
-
throw new Error("You should provide ObjectTypeComposer instance to composeWithRelay method");
|
|
159
|
-
}
|
|
160
|
-
const nodeInterface = getNodeInterface(tc.schemaComposer);
|
|
161
|
-
const nodeFieldConfig = getNodeFieldConfig(TypeMapForRelayNode, nodeInterface);
|
|
162
|
-
if (tc.getTypeName() === "Query" || tc.getTypeName() === "RootQuery") {
|
|
163
|
-
tc.setField("node", nodeFieldConfig);
|
|
164
|
-
return tc;
|
|
165
|
-
}
|
|
166
|
-
if (tc.getTypeName() === "Mutation" || tc.getTypeName() === "RootMutation") {
|
|
167
|
-
return tc;
|
|
168
|
-
}
|
|
169
|
-
if (!tc.hasRecordIdFn()) {
|
|
170
|
-
throw new Error(`ObjectTypeComposer(${tc.getTypeName()}) should have recordIdFn. This function returns ID from provided object.`);
|
|
171
|
-
}
|
|
172
|
-
const findById = tc.getResolver("findById");
|
|
173
|
-
if (!findById) {
|
|
174
|
-
throw new Error(`ObjectTypeComposer(${tc.getTypeName()}) provided to composeWithRelay should have findById resolver.`);
|
|
175
|
-
}
|
|
176
|
-
TypeMapForRelayNode[tc.getTypeName()] = {
|
|
177
|
-
resolver: findById,
|
|
178
|
-
tc
|
|
179
|
-
};
|
|
180
|
-
tc.addFields({
|
|
181
|
-
id: {
|
|
182
|
-
type: "ID!",
|
|
183
|
-
description: "The globally unique ID among all types",
|
|
184
|
-
resolve: /* @__PURE__ */__name(source => {
|
|
185
|
-
return (0, import_ids2.toGlobalId)(tc.getTypeName(), tc.getRecordId(source).toString());
|
|
186
|
-
}, "resolve")
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
tc.addInterface(nodeInterface);
|
|
190
|
-
return tc;
|
|
191
|
-
}, "composeWithRelay");
|
|
192
|
-
|
|
193
|
-
// src/composeWithRelay/index.ts
|
|
194
|
-
composeWithRelay(import_graphql_compose4.schemaComposer.Query);
|
|
195
|
-
|
|
196
|
-
// src/index.ts
|
|
197
|
-
__reExport(index_exports, require("graphql-compose"), module.exports);
|
|
198
|
-
var import_graphql_compose_connection = require("graphql-compose-connection");
|
|
199
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
200
|
-
0 && (module.exports = {
|
|
201
|
-
buildSchema,
|
|
202
|
-
composeWithConnection,
|
|
203
|
-
composeWithRelay,
|
|
204
|
-
...require("graphql-compose")
|
|
205
|
-
});
|
package/dist/shield.d.ts
DELETED
package/dist/shield.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
-
get: () => from[key],
|
|
12
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value: true
|
|
20
|
-
}), mod);
|
|
21
|
-
|
|
22
|
-
// src/shield.ts
|
|
23
|
-
var shield_exports = {};
|
|
24
|
-
module.exports = __toCommonJS(shield_exports);
|
|
25
|
-
__reExport(shield_exports, require("graphql-shield"), module.exports);
|
|
26
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
-
0 && (module.exports = {
|
|
28
|
-
...require("graphql-shield")
|
|
29
|
-
});
|