@smartive/graphql-magic 16.3.7 → 16.3.8
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 +2 -2
- package/dist/bin/gqm.cjs +37 -35
- package/dist/cjs/index.cjs +51 -48
- package/dist/esm/api/execute.d.ts +1 -5
- package/dist/esm/api/execute.js.map +1 -1
- package/dist/esm/client/queries.d.ts +4 -4
- package/dist/esm/client/queries.js.map +1 -1
- package/dist/esm/db/generate.js +2 -0
- package/dist/esm/db/generate.js.map +1 -1
- package/dist/esm/migrations/generate.js +1 -1
- package/dist/esm/migrations/generate.js.map +1 -1
- package/dist/esm/models/models.d.ts +1 -1
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/models/utils.d.ts +8 -12
- package/dist/esm/models/utils.js +3 -5
- package/dist/esm/models/utils.js.map +1 -1
- package/dist/esm/permissions/check.js +0 -15
- package/dist/esm/permissions/check.js.map +1 -1
- package/dist/esm/permissions/generate.d.ts +5 -19
- package/dist/esm/permissions/generate.js.map +1 -1
- package/dist/esm/resolvers/arguments.js.map +1 -1
- package/dist/esm/resolvers/filters.js +0 -2
- package/dist/esm/resolvers/filters.js.map +1 -1
- package/dist/esm/resolvers/mutations.js +5 -4
- package/dist/esm/resolvers/mutations.js.map +1 -1
- package/dist/esm/resolvers/node.js.map +1 -1
- package/dist/esm/resolvers/resolver.d.ts +2 -2
- package/dist/esm/resolvers/resolver.js +1 -1
- package/dist/esm/resolvers/resolver.js.map +1 -1
- package/dist/esm/resolvers/selects.js.map +1 -1
- package/dist/esm/resolvers/utils.d.ts +2 -6
- package/dist/esm/resolvers/utils.js +4 -2
- package/dist/esm/resolvers/utils.js.map +1 -1
- package/dist/esm/schema/utils.d.ts +4 -4
- package/dist/esm/schema/utils.js +31 -30
- package/dist/esm/schema/utils.js.map +1 -1
- package/dist/esm/utils/dates.d.ts +2 -4
- package/dist/esm/utils/dates.js +1 -3
- package/dist/esm/utils/dates.js.map +1 -1
- package/docs/docs/1-tutorial.md +1 -1
- package/eslint.config.mjs +42 -0
- package/migrations/20230912185644_setup.ts +1 -1
- package/package.json +6 -11
- package/src/api/execute.ts +1 -0
- package/src/bin/gqm/codegen.ts +1 -1
- package/src/client/gql.ts +1 -1
- package/src/client/mutations.ts +8 -8
- package/src/client/queries.ts +15 -14
- package/src/db/generate.ts +8 -5
- package/src/migrations/generate.ts +26 -22
- package/src/models/models.ts +24 -9
- package/src/models/mutation-hook.ts +1 -1
- package/src/models/utils.ts +8 -7
- package/src/permissions/check.ts +22 -30
- package/src/permissions/generate.ts +8 -25
- package/src/resolvers/arguments.ts +7 -2
- package/src/resolvers/filters.ts +8 -10
- package/src/resolvers/mutations.ts +19 -16
- package/src/resolvers/node.ts +3 -2
- package/src/resolvers/resolver.ts +11 -10
- package/src/resolvers/selects.ts +4 -3
- package/src/resolvers/utils.ts +15 -10
- package/src/schema/generate.ts +11 -11
- package/src/schema/utils.ts +84 -82
- package/src/utils/dates.ts +3 -3
- package/tests/generated/api/index.ts +2 -2
- package/tests/generated/client/index.ts +1 -193
- package/tests/generated/db/index.ts +4 -4
- package/tests/generated/models.json +2 -1
- package/tests/generated/schema.graphql +1 -1
- package/tests/utils/graphql-client.ts +49 -0
- package/tests/utils/models.ts +1 -0
- package/tests/utils/server.ts +4 -5
- package/tsconfig.eslint.json +18 -3
- package/tsconfig.json +3 -1
- package/.eslintrc +0 -13
|
@@ -675,7 +675,7 @@ export type User = {
|
|
|
675
675
|
deletedReactions: Array<Reaction>;
|
|
676
676
|
deletedReviews: Array<Review>;
|
|
677
677
|
id: Scalars['ID']['output'];
|
|
678
|
-
role:
|
|
678
|
+
role: Role;
|
|
679
679
|
updatedAnswers: Array<Answer>;
|
|
680
680
|
updatedManyObjects: Array<SomeObject>;
|
|
681
681
|
updatedQuestions: Array<Question>;
|
|
@@ -1025,195 +1025,3 @@ export type RestoreAnswerMutationMutationVariables = Exact<{
|
|
|
1025
1025
|
|
|
1026
1026
|
|
|
1027
1027
|
export type RestoreAnswerMutationMutation = { restoreAnswer: string };
|
|
1028
|
-
|
|
1029
|
-
type DiscriminateUnion<T, U> = T extends U ? T : never;
|
|
1030
|
-
|
|
1031
|
-
export namespace DeleteAnotherObject {
|
|
1032
|
-
export type Variables = DeleteAnotherObjectMutationVariables;
|
|
1033
|
-
export type mutation = DeleteAnotherObjectMutation;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
export namespace GetAnotherObject {
|
|
1037
|
-
export type Variables = GetAnotherObjectQueryVariables;
|
|
1038
|
-
export type query = GetAnotherObjectQuery;
|
|
1039
|
-
export type anotherObjects = NonNullable<(NonNullable<GetAnotherObjectQuery['anotherObjects']>)[number]>;
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
export namespace GetReactions {
|
|
1043
|
-
export type Variables = GetReactionsQueryVariables;
|
|
1044
|
-
export type query = GetReactionsQuery;
|
|
1045
|
-
export type reactions = NonNullable<(NonNullable<GetReactionsQuery['reactions']>)[number]>;
|
|
1046
|
-
export type ReviewInlineFragment = (DiscriminateUnion<NonNullable<(NonNullable<GetReactionsQuery['reactions']>)[number]>, { __typename: 'Review' }>);
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
export namespace GetReaction {
|
|
1050
|
-
export type Variables = GetReactionQueryVariables;
|
|
1051
|
-
export type query = GetReactionQuery;
|
|
1052
|
-
export type reaction = (NonNullable<GetReactionQuery['reaction']>);
|
|
1053
|
-
export type ReviewInlineFragment = (DiscriminateUnion<(NonNullable<GetReactionQuery['reaction']>), { __typename: 'Review' }>);
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
export namespace GetReviews {
|
|
1057
|
-
export type Variables = GetReviewsQueryVariables;
|
|
1058
|
-
export type query = GetReviewsQuery;
|
|
1059
|
-
export type reviews = NonNullable<(NonNullable<GetReviewsQuery['reviews']>)[number]>;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
export namespace GetReview {
|
|
1063
|
-
export type Variables = GetReviewQueryVariables;
|
|
1064
|
-
export type query = GetReviewQuery;
|
|
1065
|
-
export type review = (NonNullable<GetReviewQuery['review']>);
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
export namespace CreateReview {
|
|
1069
|
-
export type Variables = CreateReviewMutationVariables;
|
|
1070
|
-
export type mutation = CreateReviewMutation;
|
|
1071
|
-
export type createReview = (NonNullable<CreateReviewMutation['createReview']>);
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
export namespace UpdateReview {
|
|
1075
|
-
export type Variables = UpdateReviewMutationVariables;
|
|
1076
|
-
export type mutation = UpdateReviewMutation;
|
|
1077
|
-
export type updateReview = (NonNullable<UpdateReviewMutation['updateReview']>);
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
export namespace SomeQuery {
|
|
1081
|
-
export type Variables = SomeQueryQueryVariables;
|
|
1082
|
-
export type query = SomeQueryQuery;
|
|
1083
|
-
export type manyObjects = NonNullable<(NonNullable<SomeQueryQuery['manyObjects']>)[number]>;
|
|
1084
|
-
export type another = (NonNullable<NonNullable<(NonNullable<SomeQueryQuery['manyObjects']>)[number]>['another']>);
|
|
1085
|
-
export type _manyObjects = NonNullable<(NonNullable<(NonNullable<NonNullable<(NonNullable<SomeQueryQuery['manyObjects']>)[number]>['another']>)['manyObjects']>)[number]>;
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
export namespace ReverseFiltersQuery {
|
|
1089
|
-
export type Variables = ReverseFiltersQueryQueryVariables;
|
|
1090
|
-
export type query = ReverseFiltersQueryQuery;
|
|
1091
|
-
export type all = NonNullable<(NonNullable<ReverseFiltersQueryQuery['all']>)[number]>;
|
|
1092
|
-
export type manyObjects = NonNullable<(NonNullable<NonNullable<(NonNullable<ReverseFiltersQueryQuery['all']>)[number]>['manyObjects']>)[number]>;
|
|
1093
|
-
export type withFloat0 = NonNullable<(NonNullable<ReverseFiltersQueryQuery['withFloat0']>)[number]>;
|
|
1094
|
-
export type _manyObjects = NonNullable<(NonNullable<NonNullable<(NonNullable<ReverseFiltersQueryQuery['withFloat0']>)[number]>['manyObjects']>)[number]>;
|
|
1095
|
-
export type withFloat0_5 = NonNullable<(NonNullable<ReverseFiltersQueryQuery['withFloat0_5']>)[number]>;
|
|
1096
|
-
export type __manyObjects = NonNullable<(NonNullable<NonNullable<(NonNullable<ReverseFiltersQueryQuery['withFloat0_5']>)[number]>['manyObjects']>)[number]>;
|
|
1097
|
-
export type noneFloat0 = NonNullable<(NonNullable<ReverseFiltersQueryQuery['noneFloat0']>)[number]>;
|
|
1098
|
-
export type ___manyObjects = NonNullable<(NonNullable<NonNullable<(NonNullable<ReverseFiltersQueryQuery['noneFloat0']>)[number]>['manyObjects']>)[number]>;
|
|
1099
|
-
export type noneFloat0_5 = NonNullable<(NonNullable<ReverseFiltersQueryQuery['noneFloat0_5']>)[number]>;
|
|
1100
|
-
export type ____manyObjects = NonNullable<(NonNullable<NonNullable<(NonNullable<ReverseFiltersQueryQuery['noneFloat0_5']>)[number]>['manyObjects']>)[number]>;
|
|
1101
|
-
export type noneFloat2 = NonNullable<(NonNullable<ReverseFiltersQueryQuery['noneFloat2']>)[number]>;
|
|
1102
|
-
export type _____manyObjects = NonNullable<(NonNullable<NonNullable<(NonNullable<ReverseFiltersQueryQuery['noneFloat2']>)[number]>['manyObjects']>)[number]>;
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
export namespace NotQuery {
|
|
1106
|
-
export type Variables = NotQueryQueryVariables;
|
|
1107
|
-
export type query = NotQueryQuery;
|
|
1108
|
-
export type manyObjects = NonNullable<(NonNullable<NotQueryQuery['manyObjects']>)[number]>;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
export namespace AndQuery {
|
|
1112
|
-
export type Variables = AndQueryQueryVariables;
|
|
1113
|
-
export type query = AndQueryQuery;
|
|
1114
|
-
export type manyObjects = NonNullable<(NonNullable<AndQueryQuery['manyObjects']>)[number]>;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
export namespace OrQuery {
|
|
1118
|
-
export type Variables = OrQueryQueryVariables;
|
|
1119
|
-
export type query = OrQueryQuery;
|
|
1120
|
-
export type manyObjects = NonNullable<(NonNullable<OrQueryQuery['manyObjects']>)[number]>;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
export namespace DeleteAnotherObjectMutation {
|
|
1124
|
-
export type Variables = DeleteAnotherObjectMutationMutationVariables;
|
|
1125
|
-
export type mutation = DeleteAnotherObjectMutationMutation;
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
export namespace RestoreAnotherObjectMutation {
|
|
1129
|
-
export type Variables = RestoreAnotherObjectMutationMutationVariables;
|
|
1130
|
-
export type mutation = RestoreAnotherObjectMutationMutation;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
export namespace CreateSomeObjectMutation {
|
|
1134
|
-
export type Variables = CreateSomeObjectMutationMutationVariables;
|
|
1135
|
-
export type mutation = CreateSomeObjectMutationMutation;
|
|
1136
|
-
export type createSomeObject = (NonNullable<CreateSomeObjectMutationMutation['createSomeObject']>);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
export namespace UpdateSomeObjectMutation {
|
|
1140
|
-
export type Variables = UpdateSomeObjectMutationMutationVariables;
|
|
1141
|
-
export type mutation = UpdateSomeObjectMutationMutation;
|
|
1142
|
-
export type updateSomeObject = (NonNullable<UpdateSomeObjectMutationMutation['updateSomeObject']>);
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
export namespace DeleteSomeObjectMutation {
|
|
1146
|
-
export type Variables = DeleteSomeObjectMutationMutationVariables;
|
|
1147
|
-
export type mutation = DeleteSomeObjectMutationMutation;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
export namespace RestoreSomeObjectMutation {
|
|
1151
|
-
export type Variables = RestoreSomeObjectMutationMutationVariables;
|
|
1152
|
-
export type mutation = RestoreSomeObjectMutationMutation;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
export namespace CreateReviewMutation {
|
|
1156
|
-
export type Variables = CreateReviewMutationMutationVariables;
|
|
1157
|
-
export type mutation = CreateReviewMutationMutation;
|
|
1158
|
-
export type createReview = (NonNullable<CreateReviewMutationMutation['createReview']>);
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
export namespace UpdateReviewMutation {
|
|
1162
|
-
export type Variables = UpdateReviewMutationMutationVariables;
|
|
1163
|
-
export type mutation = UpdateReviewMutationMutation;
|
|
1164
|
-
export type updateReview = (NonNullable<UpdateReviewMutationMutation['updateReview']>);
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
export namespace DeleteReviewMutation {
|
|
1168
|
-
export type Variables = DeleteReviewMutationMutationVariables;
|
|
1169
|
-
export type mutation = DeleteReviewMutationMutation;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
export namespace RestoreReviewMutation {
|
|
1173
|
-
export type Variables = RestoreReviewMutationMutationVariables;
|
|
1174
|
-
export type mutation = RestoreReviewMutationMutation;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
export namespace CreateQuestionMutation {
|
|
1178
|
-
export type Variables = CreateQuestionMutationMutationVariables;
|
|
1179
|
-
export type mutation = CreateQuestionMutationMutation;
|
|
1180
|
-
export type createQuestion = (NonNullable<CreateQuestionMutationMutation['createQuestion']>);
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
export namespace UpdateQuestionMutation {
|
|
1184
|
-
export type Variables = UpdateQuestionMutationMutationVariables;
|
|
1185
|
-
export type mutation = UpdateQuestionMutationMutation;
|
|
1186
|
-
export type updateQuestion = (NonNullable<UpdateQuestionMutationMutation['updateQuestion']>);
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
export namespace DeleteQuestionMutation {
|
|
1190
|
-
export type Variables = DeleteQuestionMutationMutationVariables;
|
|
1191
|
-
export type mutation = DeleteQuestionMutationMutation;
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
export namespace RestoreQuestionMutation {
|
|
1195
|
-
export type Variables = RestoreQuestionMutationMutationVariables;
|
|
1196
|
-
export type mutation = RestoreQuestionMutationMutation;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
export namespace CreateAnswerMutation {
|
|
1200
|
-
export type Variables = CreateAnswerMutationMutationVariables;
|
|
1201
|
-
export type mutation = CreateAnswerMutationMutation;
|
|
1202
|
-
export type createAnswer = (NonNullable<CreateAnswerMutationMutation['createAnswer']>);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
export namespace UpdateAnswerMutation {
|
|
1206
|
-
export type Variables = UpdateAnswerMutationMutationVariables;
|
|
1207
|
-
export type mutation = UpdateAnswerMutationMutation;
|
|
1208
|
-
export type updateAnswer = (NonNullable<UpdateAnswerMutationMutation['updateAnswer']>);
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
export namespace DeleteAnswerMutation {
|
|
1212
|
-
export type Variables = DeleteAnswerMutationMutationVariables;
|
|
1213
|
-
export type mutation = DeleteAnswerMutationMutation;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
export namespace RestoreAnswerMutation {
|
|
1217
|
-
export type Variables = RestoreAnswerMutationMutationVariables;
|
|
1218
|
-
export type mutation = RestoreAnswerMutationMutation;
|
|
1219
|
-
}
|
|
@@ -9,25 +9,25 @@ export type ReactionType = 'Review' | 'Question' | 'Answer';
|
|
|
9
9
|
export type User = {
|
|
10
10
|
'id': string;
|
|
11
11
|
'username': string | null;
|
|
12
|
-
'role': Role
|
|
12
|
+
'role': Role;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export type UserInitializer = {
|
|
16
16
|
'id': string;
|
|
17
17
|
'username'?: string | null;
|
|
18
|
-
'role'
|
|
18
|
+
'role': Role;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export type UserMutator = {
|
|
22
22
|
'id'?: string;
|
|
23
23
|
'username'?: string | null;
|
|
24
|
-
'role'?: Role
|
|
24
|
+
'role'?: Role;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export type UserSeed = {
|
|
28
28
|
'id': string;
|
|
29
29
|
'username'?: string | null;
|
|
30
|
-
'role'
|
|
30
|
+
'role': string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export type AnotherObject = {
|
|
@@ -319,7 +319,7 @@ scalar Upload
|
|
|
319
319
|
type User {
|
|
320
320
|
id: ID!
|
|
321
321
|
username: String
|
|
322
|
-
role: Role
|
|
322
|
+
role: Role!
|
|
323
323
|
deletedAnotherObjects(where: AnotherObjectWhere, orderBy: [AnotherObjectOrderBy!], limit: Int, offset: Int): [AnotherObject!]!
|
|
324
324
|
createdManyObjects(where: SomeObjectWhere, search: String, orderBy: [SomeObjectOrderBy!], limit: Int, offset: Int): [SomeObject!]!
|
|
325
325
|
updatedManyObjects(where: SomeObjectWhere, search: String, orderBy: [SomeObjectOrderBy!], limit: Int, offset: Int): [SomeObject!]!
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
type Variables = Record<string, unknown>;
|
|
2
|
+
|
|
3
|
+
interface GraphQLResponse<T = any> {
|
|
4
|
+
data?: T;
|
|
5
|
+
errors?: {
|
|
6
|
+
message: string;
|
|
7
|
+
locations?: { line: number; column: number }[];
|
|
8
|
+
path?: string[];
|
|
9
|
+
extensions?: Record<string, unknown>;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Simple GraphQL client using native fetch
|
|
15
|
+
*/
|
|
16
|
+
export const graphqlRequest = async <T = any>(
|
|
17
|
+
url: string,
|
|
18
|
+
query: string,
|
|
19
|
+
variables?: Variables,
|
|
20
|
+
headers?: HeadersInit,
|
|
21
|
+
): Promise<T> => {
|
|
22
|
+
const response = await fetch(url, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
...headers,
|
|
27
|
+
},
|
|
28
|
+
body: JSON.stringify({
|
|
29
|
+
query,
|
|
30
|
+
variables,
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
throw new Error(`HTTP error! Status: ${response.status}.`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const result = (await response.json()) as GraphQLResponse<T>;
|
|
39
|
+
|
|
40
|
+
if (result.errors?.length) {
|
|
41
|
+
throw new Error(`GraphQL Error: ${result.errors.map((e) => e.message).join(', ')}.`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!result.data) {
|
|
45
|
+
throw new Error('No data returned from GraphQL request.');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return result.data;
|
|
49
|
+
};
|
package/tests/utils/models.ts
CHANGED
package/tests/utils/server.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { TypedQueryDocumentNode } from 'graphql';
|
|
2
|
-
import graphqlRequest, { RequestDocument, Variables } from 'graphql-request';
|
|
3
1
|
import { RequestListener, createServer } from 'http';
|
|
4
2
|
import { Knex } from 'knex';
|
|
5
3
|
import { up } from '../../migrations/20230912185644_setup';
|
|
6
4
|
import { execute } from '../../src';
|
|
7
5
|
import { getKnex } from './database/knex';
|
|
8
6
|
import { ADMIN_ID, setupSeed } from './database/seed';
|
|
7
|
+
import { graphqlRequest } from './graphql-client';
|
|
9
8
|
import { models, permissions } from './models';
|
|
10
9
|
|
|
11
10
|
export const withServer = async (
|
|
12
11
|
cb: (
|
|
13
|
-
request: (document:
|
|
12
|
+
request: (document: string, ...variablesAndRequestHeaders: any) => Promise<any>,
|
|
14
13
|
knex: Knex
|
|
15
14
|
) => Promise<void>
|
|
16
15
|
) => {
|
|
@@ -66,8 +65,8 @@ export const withServer = async (
|
|
|
66
65
|
res.end(JSON.stringify(result));
|
|
67
66
|
};
|
|
68
67
|
|
|
69
|
-
const request = <T, V
|
|
70
|
-
document:
|
|
68
|
+
const request = <T, V>(
|
|
69
|
+
document: string,
|
|
71
70
|
...variablesAndRequestHeaders: any
|
|
72
71
|
) => graphqlRequest(`http://localhost:${port}`, document, ...variablesAndRequestHeaders);
|
|
73
72
|
|
package/tsconfig.eslint.json
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"include": [
|
|
3
|
+
"src/**/*",
|
|
4
|
+
],
|
|
5
|
+
"exclude": [
|
|
6
|
+
"node_modules",
|
|
7
|
+
"dist",
|
|
8
|
+
"build"
|
|
9
|
+
],
|
|
10
|
+
"compilerOptions": {
|
|
11
|
+
"outDir": "./dist/esm",
|
|
12
|
+
"rootDir": "./src",
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"target": "esnext",
|
|
16
|
+
"moduleResolution": "bundler",
|
|
17
|
+
"strictNullChecks": true,
|
|
18
|
+
"allowSyntheticDefaultImports": true
|
|
19
|
+
},
|
|
5
20
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"include": [
|
|
3
3
|
"./src/**/*.ts",
|
|
4
|
-
"./src/**/*.tsx"
|
|
4
|
+
"./src/**/*.tsx",
|
|
5
5
|
],
|
|
6
6
|
"exclude": [
|
|
7
7
|
"node_modules",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"declaration": true,
|
|
16
16
|
"target": "esnext",
|
|
17
17
|
"moduleResolution": "bundler",
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"strictNullChecks": true,
|
|
18
20
|
"allowSyntheticDefaultImports": true
|
|
19
21
|
},
|
|
20
22
|
}
|
package/.eslintrc
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["@smartive/eslint-config"],
|
|
3
|
-
"parser": "@typescript-eslint/parser",
|
|
4
|
-
"parserOptions": {
|
|
5
|
-
"project": "./tsconfig.eslint.json"
|
|
6
|
-
},
|
|
7
|
-
"rules": {
|
|
8
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
9
|
-
"@typescript-eslint/no-floating-promises": ["error"],
|
|
10
|
-
"no-constant-binary-expression": "error",
|
|
11
|
-
"no-console": ["error", { "allow": ["info", "warn", "error", "trace", "time", "timeEnd"] }]
|
|
12
|
-
}
|
|
13
|
-
}
|