@gbl-uzh/platform 0.2.11 → 0.2.13
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.d.ts +11 -9
- package/dist/nexus.d.ts +4 -24
- package/dist/nexus.js +74 -104
- package/dist/ops/FGameData.graphql +7 -0
- package/dist/ops/FLearningElementData.graphql +10 -0
- package/dist/ops/FPeriodData.graphql +14 -0
- package/dist/ops/FPlayerActionData.graphql +9 -0
- package/dist/ops/FPlayerData.graphql +36 -0
- package/dist/ops/FResultData.graphql +17 -0
- package/dist/ops/FSegmentData.graphql +15 -0
- package/dist/ops/MActivateNextPeriod.graphql +11 -0
- package/dist/ops/MActivateNextSegment.graphql +14 -0
- package/dist/ops/MAddGamePeriod.graphql +7 -0
- package/dist/ops/MAddPeriodSegment.graphql +19 -0
- package/dist/ops/MAttemptLearningElement.graphql +18 -0
- package/dist/ops/MCreateGame.graphql +7 -0
- package/dist/ops/MLoginAsTeam.graphql +7 -0
- package/dist/ops/MMarkStoryElement.graphql +6 -0
- package/dist/ops/MPerformAction.graphql +7 -0
- package/dist/ops/MSaveConsolidationDecision.graphql +8 -0
- package/dist/ops/MUpdatePlayerData.graphql +12 -0
- package/dist/ops/MUpdateReadyState.graphql +6 -0
- package/dist/ops/QGame.graphql +37 -0
- package/dist/ops/QGames.graphql +7 -0
- package/dist/ops/QLearningElement.graphql +19 -0
- package/dist/ops/QLearningElements.graphql +7 -0
- package/dist/ops/QPastResults.graphql +40 -0
- package/dist/ops/QResult.graphql +53 -0
- package/dist/ops/QResults.graphql +12 -0
- package/dist/ops/QSelf.graphql +7 -0
- package/dist/ops/SGlobalEvents.graphql +5 -0
- package/dist/ops/SUserEvents.graphql +5 -0
- package/dist/schema.prisma +1 -1
- package/package.json +11 -9
- package/dist/generated/ops.d.ts +0 -1555
- package/dist/generated/ops.js +0 -168
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,6 @@ import { PrismaClient } from '@prisma/client';
|
|
|
3
3
|
import { NextPageContext } from 'next';
|
|
4
4
|
import * as yup from 'yup';
|
|
5
5
|
import yup__default from 'yup';
|
|
6
|
-
import { PlayerDecisionType } from './generated/ops.js';
|
|
7
|
-
import 'graphql';
|
|
8
|
-
import '@graphql-typed-document-node/core';
|
|
9
6
|
|
|
10
7
|
declare enum UserRole {
|
|
11
8
|
PLAYER = "PLAYER",
|
|
@@ -16,17 +13,17 @@ declare enum LearningElementState {
|
|
|
16
13
|
ATTEMPTED = "ATTEMPTED",
|
|
17
14
|
SOLVED = "SOLVED"
|
|
18
15
|
}
|
|
19
|
-
|
|
16
|
+
type Notification<NotificationType> = {
|
|
20
17
|
type: NotificationType;
|
|
21
18
|
sub?: string;
|
|
22
19
|
facts?: any;
|
|
23
20
|
};
|
|
24
|
-
|
|
21
|
+
type Event<EventType> = {
|
|
25
22
|
type: EventType;
|
|
26
23
|
sub?: string;
|
|
27
24
|
facts?: any;
|
|
28
25
|
};
|
|
29
|
-
|
|
26
|
+
type Output<OutputType, NotificationType, EventType> = {
|
|
30
27
|
type: OutputType;
|
|
31
28
|
extras?: any;
|
|
32
29
|
result: any;
|
|
@@ -35,7 +32,7 @@ declare type Output<OutputType, NotificationType, EventType> = {
|
|
|
35
32
|
actions?: any[];
|
|
36
33
|
isDirty: boolean;
|
|
37
34
|
};
|
|
38
|
-
|
|
35
|
+
type Action<ActionType, PayloadType, PrismaType> = {
|
|
39
36
|
type: ActionType;
|
|
40
37
|
payload: PayloadType;
|
|
41
38
|
ctx?: CtxWithPrisma<PrismaType>;
|
|
@@ -130,7 +127,7 @@ declare namespace EventService {
|
|
|
130
127
|
};
|
|
131
128
|
}
|
|
132
129
|
|
|
133
|
-
|
|
130
|
+
type Context$1 = CtxWithPrisma<PrismaClient>;
|
|
134
131
|
interface CreateGameArgs {
|
|
135
132
|
name: string;
|
|
136
133
|
playerCount: number;
|
|
@@ -288,7 +285,12 @@ declare namespace GameService {
|
|
|
288
285
|
};
|
|
289
286
|
}
|
|
290
287
|
|
|
291
|
-
declare
|
|
288
|
+
declare enum PlayerDecisionType {
|
|
289
|
+
Consolidation = "CONSOLIDATION",
|
|
290
|
+
Preparation = "PREPARATION"
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
type Context = CtxWithPrisma<PrismaClient>;
|
|
292
294
|
interface PerformActionArgs<ActionTypes> {
|
|
293
295
|
gameId: number;
|
|
294
296
|
periodIx: number;
|
package/dist/nexus.d.ts
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
import * as nexus_dist_core from 'nexus/dist/core';
|
|
2
|
-
import * as yup from 'yup';
|
|
3
|
-
|
|
4
|
-
declare const PeriodFactsSchema: yup.ObjectSchema<{
|
|
5
|
-
stockTrend: number;
|
|
6
|
-
stockVariance: number;
|
|
7
|
-
stockGap: number;
|
|
8
|
-
}, yup.AnyObject, {
|
|
9
|
-
stockTrend: undefined;
|
|
10
|
-
stockVariance: undefined;
|
|
11
|
-
stockGap: undefined;
|
|
12
|
-
}, "">;
|
|
13
|
-
interface PeriodFacts extends yup.InferType<typeof PeriodFactsSchema> {
|
|
14
|
-
}
|
|
15
|
-
declare const PeriodFactsInput: nexus_dist_core.NexusInputObjectTypeDef<"PeriodFactsInput">;
|
|
16
|
-
declare const PeriodSegmentFactsSchema: yup.ObjectSchema<{
|
|
17
|
-
stockForecast: number | undefined;
|
|
18
|
-
}, yup.AnyObject, {
|
|
19
|
-
stockForecast: undefined;
|
|
20
|
-
}, "">;
|
|
21
|
-
interface PeriodSegmentFacts extends yup.InferType<typeof PeriodSegmentFactsSchema> {
|
|
22
|
-
}
|
|
23
|
-
declare const PeriodSegmentFactsInput: nexus_dist_core.NexusInputObjectTypeDef<"PeriodSegmentFactsInput">;
|
|
24
2
|
|
|
25
3
|
declare const GameStatus: nexus_dist_core.NexusEnumTypeDef<"GameStatus">;
|
|
26
4
|
declare const Game: nexus_dist_core.NexusObjectTypeDef<"Game">;
|
|
@@ -34,9 +12,11 @@ declare const LearningElement: nexus_dist_core.NexusObjectTypeDef<"LearningEleme
|
|
|
34
12
|
|
|
35
13
|
interface GenerateBaseMutationsArgs {
|
|
36
14
|
reducers?: any;
|
|
15
|
+
schemas?: any;
|
|
16
|
+
inputTypes?: any;
|
|
37
17
|
roleAssigner?: (ix: number) => void;
|
|
38
18
|
}
|
|
39
|
-
declare function generateBaseMutations({ reducers, roleAssigner, }?: GenerateBaseMutationsArgs): nexus_dist_core.NexusObjectTypeDef<"Mutation">;
|
|
19
|
+
declare function generateBaseMutations<PeriodFacts, PeriodSegmentFacts>({ reducers, roleAssigner, schemas, inputTypes }?: GenerateBaseMutationsArgs): nexus_dist_core.NexusObjectTypeDef<"Mutation">;
|
|
40
20
|
declare const Mutation: nexus_dist_core.NexusObjectTypeDef<"Mutation">;
|
|
41
21
|
|
|
42
22
|
declare const PlayerDecisionType: nexus_dist_core.NexusEnumTypeDef<"PlayerDecisionType">;
|
|
@@ -59,4 +39,4 @@ declare const DateScalar: nexus_dist_core.AllNexusOutputTypeDefs;
|
|
|
59
39
|
declare const UserRole: nexus_dist_core.NexusEnumTypeDef<"UserRole">;
|
|
60
40
|
declare const Event: nexus_dist_core.NexusObjectTypeDef<"Event">;
|
|
61
41
|
|
|
62
|
-
export { DateScalar, Event, Game, GameStatus, JsonScalar, LearningAnswerOption, LearningElement, LearningElementAttempt, LearningElementState, Mutation, Period,
|
|
42
|
+
export { DateScalar, Event, Game, GameStatus, JsonScalar, LearningAnswerOption, LearningElement, LearningElementAttempt, LearningElementState, Mutation, Period, PeriodSegment, Player, PlayerAction, PlayerDecision, PlayerDecisionType, PlayerLevel, PlayerResult, PlayerResultType, PlayerState, Query, Subscription, UserRole, generateBaseMutations, generateBaseQueries, generateBaseSubscriptions };
|
package/dist/nexus.js
CHANGED
|
@@ -37,11 +37,7 @@ __export(nexus_exports, {
|
|
|
37
37
|
LearningElementState: () => LearningElementState,
|
|
38
38
|
Mutation: () => Mutation,
|
|
39
39
|
Period: () => Period,
|
|
40
|
-
PeriodFactsInput: () => PeriodFactsInput,
|
|
41
|
-
PeriodFactsSchema: () => PeriodFactsSchema,
|
|
42
40
|
PeriodSegment: () => PeriodSegment,
|
|
43
|
-
PeriodSegmentFactsInput: () => PeriodSegmentFactsInput,
|
|
44
|
-
PeriodSegmentFactsSchema: () => PeriodSegmentFactsSchema,
|
|
45
41
|
Player: () => Player,
|
|
46
42
|
PlayerAction: () => PlayerAction,
|
|
47
43
|
PlayerDecision: () => PlayerDecision,
|
|
@@ -60,53 +56,27 @@ __export(nexus_exports, {
|
|
|
60
56
|
module.exports = __toCommonJS(nexus_exports);
|
|
61
57
|
var DB5 = __toESM(require("@prisma/client"));
|
|
62
58
|
var import_graphql_scalars = require("graphql-scalars");
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
// ../../apps/demo-game/src/graphql/types/Period.ts
|
|
66
|
-
var import_nexus = require("nexus");
|
|
67
|
-
var yup = __toESM(require("yup"));
|
|
68
|
-
var PeriodFactsSchema = yup.object({
|
|
69
|
-
stockTrend: yup.number().required(),
|
|
70
|
-
stockVariance: yup.number().required(),
|
|
71
|
-
stockGap: yup.number().required()
|
|
72
|
-
});
|
|
73
|
-
var PeriodFactsInput = (0, import_nexus.inputObjectType)({
|
|
74
|
-
name: "PeriodFactsInput",
|
|
75
|
-
definition(t) {
|
|
76
|
-
t.nonNull.float("stockTrend");
|
|
77
|
-
t.nonNull.float("stockVariance");
|
|
78
|
-
t.nonNull.float("stockGap");
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
var PeriodSegmentFactsSchema = yup.object({
|
|
82
|
-
stockForecast: yup.number()
|
|
83
|
-
});
|
|
84
|
-
var PeriodSegmentFactsInput = (0, import_nexus.inputObjectType)({
|
|
85
|
-
name: "PeriodSegmentFactsInput",
|
|
86
|
-
definition(t) {
|
|
87
|
-
t.float("stockForecast");
|
|
88
|
-
}
|
|
89
|
-
});
|
|
59
|
+
var import_nexus10 = require("nexus");
|
|
90
60
|
|
|
91
61
|
// src/types/Game.ts
|
|
92
62
|
var DB4 = __toESM(require("@prisma/client"));
|
|
93
|
-
var
|
|
63
|
+
var import_nexus5 = require("nexus");
|
|
94
64
|
|
|
95
65
|
// src/types/LearningElement.ts
|
|
96
|
-
var
|
|
66
|
+
var import_nexus4 = require("nexus");
|
|
97
67
|
|
|
98
68
|
// src/types/Player.ts
|
|
99
69
|
var DB3 = __toESM(require("@prisma/client"));
|
|
100
|
-
var
|
|
70
|
+
var import_nexus3 = require("nexus");
|
|
101
71
|
|
|
102
72
|
// src/types/Achievement.ts
|
|
103
73
|
var DB = __toESM(require("@prisma/client"));
|
|
104
|
-
var
|
|
105
|
-
var AchievementFrequency2 = (0,
|
|
74
|
+
var import_nexus = require("nexus");
|
|
75
|
+
var AchievementFrequency2 = (0, import_nexus.enumType)({
|
|
106
76
|
name: "AchievementFrequency",
|
|
107
77
|
members: Object.values(DB.AchievementFrequency)
|
|
108
78
|
});
|
|
109
|
-
var Achievement = (0,
|
|
79
|
+
var Achievement = (0, import_nexus.objectType)({
|
|
110
80
|
name: "Achievement",
|
|
111
81
|
definition(t) {
|
|
112
82
|
t.nonNull.id("id");
|
|
@@ -121,7 +91,7 @@ var Achievement = (0, import_nexus2.objectType)({
|
|
|
121
91
|
});
|
|
122
92
|
}
|
|
123
93
|
});
|
|
124
|
-
var AchievementInstance = (0,
|
|
94
|
+
var AchievementInstance = (0, import_nexus.objectType)({
|
|
125
95
|
name: "AchievementInstance",
|
|
126
96
|
definition(t) {
|
|
127
97
|
t.nonNull.int("id");
|
|
@@ -134,12 +104,12 @@ var AchievementInstance = (0, import_nexus2.objectType)({
|
|
|
134
104
|
|
|
135
105
|
// src/types/StoryElement.ts
|
|
136
106
|
var DB2 = __toESM(require("@prisma/client"));
|
|
137
|
-
var
|
|
138
|
-
var StoryElementType2 = (0,
|
|
107
|
+
var import_nexus2 = require("nexus");
|
|
108
|
+
var StoryElementType2 = (0, import_nexus2.enumType)({
|
|
139
109
|
name: "StoryElementType",
|
|
140
110
|
members: Object.values(DB2.StoryElementType)
|
|
141
111
|
});
|
|
142
|
-
var StoryElement = (0,
|
|
112
|
+
var StoryElement = (0, import_nexus2.objectType)({
|
|
143
113
|
name: "StoryElement",
|
|
144
114
|
definition(t) {
|
|
145
115
|
t.nonNull.id("id");
|
|
@@ -156,15 +126,15 @@ var StoryElement = (0, import_nexus3.objectType)({
|
|
|
156
126
|
});
|
|
157
127
|
|
|
158
128
|
// src/types/Player.ts
|
|
159
|
-
var PlayerDecisionType2 = (0,
|
|
129
|
+
var PlayerDecisionType2 = (0, import_nexus3.enumType)({
|
|
160
130
|
name: "PlayerDecisionType",
|
|
161
131
|
members: Object.values(DB3.PlayerDecisionType)
|
|
162
132
|
});
|
|
163
|
-
var PlayerResultType2 = (0,
|
|
133
|
+
var PlayerResultType2 = (0, import_nexus3.enumType)({
|
|
164
134
|
name: "PlayerResultType",
|
|
165
135
|
members: Object.values(DB3.PlayerResultType)
|
|
166
136
|
});
|
|
167
|
-
var PlayerLevel = (0,
|
|
137
|
+
var PlayerLevel = (0, import_nexus3.objectType)({
|
|
168
138
|
name: "PlayerLevel",
|
|
169
139
|
definition(t) {
|
|
170
140
|
t.nonNull.id("id");
|
|
@@ -173,7 +143,7 @@ var PlayerLevel = (0, import_nexus4.objectType)({
|
|
|
173
143
|
t.nonNull.int("requiredXP");
|
|
174
144
|
}
|
|
175
145
|
});
|
|
176
|
-
var PlayerState = (0,
|
|
146
|
+
var PlayerState = (0, import_nexus3.objectType)({
|
|
177
147
|
name: "PlayerState",
|
|
178
148
|
definition(t) {
|
|
179
149
|
t.field("playerResult", {
|
|
@@ -190,7 +160,7 @@ var PlayerState = (0, import_nexus4.objectType)({
|
|
|
190
160
|
});
|
|
191
161
|
}
|
|
192
162
|
});
|
|
193
|
-
var Player = (0,
|
|
163
|
+
var Player = (0, import_nexus3.objectType)({
|
|
194
164
|
name: "Player",
|
|
195
165
|
definition(t) {
|
|
196
166
|
t.nonNull.id("id");
|
|
@@ -226,7 +196,7 @@ var Player = (0, import_nexus4.objectType)({
|
|
|
226
196
|
t.nonNull.list.nonNull.int("visitedStoryElementIds");
|
|
227
197
|
}
|
|
228
198
|
});
|
|
229
|
-
var PlayerResult = (0,
|
|
199
|
+
var PlayerResult = (0, import_nexus3.objectType)({
|
|
230
200
|
name: "PlayerResult",
|
|
231
201
|
definition(t) {
|
|
232
202
|
t.nonNull.id("id");
|
|
@@ -247,7 +217,7 @@ var PlayerResult = (0, import_nexus4.objectType)({
|
|
|
247
217
|
});
|
|
248
218
|
}
|
|
249
219
|
});
|
|
250
|
-
var PlayerAction = (0,
|
|
220
|
+
var PlayerAction = (0, import_nexus3.objectType)({
|
|
251
221
|
name: "PlayerAction",
|
|
252
222
|
definition(t) {
|
|
253
223
|
t.nonNull.id("id");
|
|
@@ -268,7 +238,7 @@ var PlayerAction = (0, import_nexus4.objectType)({
|
|
|
268
238
|
t.int("segmentIx");
|
|
269
239
|
}
|
|
270
240
|
});
|
|
271
|
-
var PlayerDecision = (0,
|
|
241
|
+
var PlayerDecision = (0, import_nexus3.objectType)({
|
|
272
242
|
name: "PlayerDecision",
|
|
273
243
|
definition(t) {
|
|
274
244
|
t.nonNull.id("id");
|
|
@@ -289,7 +259,7 @@ var PlayerDecision = (0, import_nexus4.objectType)({
|
|
|
289
259
|
});
|
|
290
260
|
|
|
291
261
|
// src/types/LearningElement.ts
|
|
292
|
-
var LearningAnswerOption = (0,
|
|
262
|
+
var LearningAnswerOption = (0, import_nexus4.objectType)({
|
|
293
263
|
name: "LearningAnswerOption",
|
|
294
264
|
definition(t) {
|
|
295
265
|
t.nonNull.id("id");
|
|
@@ -297,7 +267,7 @@ var LearningAnswerOption = (0, import_nexus5.objectType)({
|
|
|
297
267
|
t.nonNull.boolean("correct");
|
|
298
268
|
}
|
|
299
269
|
});
|
|
300
|
-
var LearningElementState = (0,
|
|
270
|
+
var LearningElementState = (0, import_nexus4.objectType)({
|
|
301
271
|
name: "LearningElementState",
|
|
302
272
|
definition(t) {
|
|
303
273
|
t.id("id");
|
|
@@ -308,7 +278,7 @@ var LearningElementState = (0, import_nexus5.objectType)({
|
|
|
308
278
|
t.string("solution");
|
|
309
279
|
}
|
|
310
280
|
});
|
|
311
|
-
var LearningElementAttempt = (0,
|
|
281
|
+
var LearningElementAttempt = (0, import_nexus4.objectType)({
|
|
312
282
|
name: "LearningElementAttempt",
|
|
313
283
|
definition(t) {
|
|
314
284
|
t.id("id");
|
|
@@ -322,7 +292,7 @@ var LearningElementAttempt = (0, import_nexus5.objectType)({
|
|
|
322
292
|
});
|
|
323
293
|
}
|
|
324
294
|
});
|
|
325
|
-
var LearningElement = (0,
|
|
295
|
+
var LearningElement = (0, import_nexus4.objectType)({
|
|
326
296
|
name: "LearningElement",
|
|
327
297
|
definition(t) {
|
|
328
298
|
t.nonNull.id("id");
|
|
@@ -340,11 +310,11 @@ var LearningElement = (0, import_nexus5.objectType)({
|
|
|
340
310
|
});
|
|
341
311
|
|
|
342
312
|
// src/types/Game.ts
|
|
343
|
-
var GameStatus2 = (0,
|
|
313
|
+
var GameStatus2 = (0, import_nexus5.enumType)({
|
|
344
314
|
name: "GameStatus",
|
|
345
315
|
members: Object.values(DB4.GameStatus)
|
|
346
316
|
});
|
|
347
|
-
var Game = (0,
|
|
317
|
+
var Game = (0, import_nexus5.objectType)({
|
|
348
318
|
name: "Game",
|
|
349
319
|
definition(t) {
|
|
350
320
|
t.nonNull.id("id");
|
|
@@ -364,7 +334,7 @@ var Game = (0, import_nexus6.objectType)({
|
|
|
364
334
|
});
|
|
365
335
|
}
|
|
366
336
|
});
|
|
367
|
-
var Period = (0,
|
|
337
|
+
var Period = (0, import_nexus5.objectType)({
|
|
368
338
|
name: "Period",
|
|
369
339
|
definition(t) {
|
|
370
340
|
t.nonNull.id("id");
|
|
@@ -387,7 +357,7 @@ var Period = (0, import_nexus6.objectType)({
|
|
|
387
357
|
});
|
|
388
358
|
}
|
|
389
359
|
});
|
|
390
|
-
var PeriodSegment = (0,
|
|
360
|
+
var PeriodSegment = (0, import_nexus5.objectType)({
|
|
391
361
|
name: "PeriodSegment",
|
|
392
362
|
definition(t) {
|
|
393
363
|
t.nonNull.id("id");
|
|
@@ -412,7 +382,7 @@ var PeriodSegment = (0, import_nexus6.objectType)({
|
|
|
412
382
|
});
|
|
413
383
|
|
|
414
384
|
// src/types/Mutation.ts
|
|
415
|
-
var
|
|
385
|
+
var import_nexus6 = require("nexus");
|
|
416
386
|
|
|
417
387
|
// src/generated/ops.ts
|
|
418
388
|
var GameDataFragmentDoc = { "kind": "Document", "definitions": [{ "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "GameData" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Game" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "activePeriodIx" } }] } }] };
|
|
@@ -525,7 +495,7 @@ var nanoid = (size = 21) => {
|
|
|
525
495
|
|
|
526
496
|
// src/services/GameService.ts
|
|
527
497
|
var import_ramda = require("ramda");
|
|
528
|
-
var
|
|
498
|
+
var yup = __toESM(require("yup"));
|
|
529
499
|
|
|
530
500
|
// src/lib/pubsub.ts
|
|
531
501
|
var import_graphql_yoga = require("graphql-yoga");
|
|
@@ -1314,8 +1284,8 @@ async function activateNextSegment({ gameId }, ctx, { reducers }) {
|
|
|
1314
1284
|
return null;
|
|
1315
1285
|
}
|
|
1316
1286
|
}
|
|
1317
|
-
var PlayerFactsSchema =
|
|
1318
|
-
location:
|
|
1287
|
+
var PlayerFactsSchema = yup.object({
|
|
1288
|
+
location: yup.string().default("Zurich")
|
|
1319
1289
|
});
|
|
1320
1290
|
async function updatePlayerData({ name, avatar, color, facts }, ctx) {
|
|
1321
1291
|
if ((0, import_ramda.none)(Boolean, [name, avatar, color, facts])) {
|
|
@@ -2216,17 +2186,21 @@ async function updateReadyState(args, ctx) {
|
|
|
2216
2186
|
|
|
2217
2187
|
// src/types/Mutation.ts
|
|
2218
2188
|
var defaultReducers = {};
|
|
2189
|
+
var defaultSchemas = {};
|
|
2190
|
+
var defaultInputTypes = {};
|
|
2219
2191
|
function generateBaseMutations({
|
|
2220
2192
|
reducers = defaultReducers,
|
|
2221
|
-
roleAssigner = () => "UNSET"
|
|
2193
|
+
roleAssigner = () => "UNSET",
|
|
2194
|
+
schemas = defaultSchemas,
|
|
2195
|
+
inputTypes = defaultInputTypes
|
|
2222
2196
|
} = {}) {
|
|
2223
|
-
return (0,
|
|
2197
|
+
return (0, import_nexus6.objectType)({
|
|
2224
2198
|
name: "Mutation",
|
|
2225
2199
|
definition(t) {
|
|
2226
2200
|
t.field("updateReadyState", {
|
|
2227
2201
|
type: Player,
|
|
2228
2202
|
args: {
|
|
2229
|
-
isReady: (0,
|
|
2203
|
+
isReady: (0, import_nexus6.nonNull)((0, import_nexus6.booleanArg)())
|
|
2230
2204
|
},
|
|
2231
2205
|
async resolve(_, args, ctx) {
|
|
2232
2206
|
return updateReadyState(args, ctx);
|
|
@@ -2235,7 +2209,7 @@ function generateBaseMutations({
|
|
|
2235
2209
|
t.field("loginAsTeam", {
|
|
2236
2210
|
type: Player,
|
|
2237
2211
|
args: {
|
|
2238
|
-
token: (0,
|
|
2212
|
+
token: (0, import_nexus6.nonNull)((0, import_nexus6.stringArg)())
|
|
2239
2213
|
},
|
|
2240
2214
|
async resolve(_, args, ctx) {
|
|
2241
2215
|
return loginAsTeam(args, ctx);
|
|
@@ -2244,8 +2218,8 @@ function generateBaseMutations({
|
|
|
2244
2218
|
t.field("createGame", {
|
|
2245
2219
|
type: Game,
|
|
2246
2220
|
args: {
|
|
2247
|
-
name: (0,
|
|
2248
|
-
playerCount: (0,
|
|
2221
|
+
name: (0, import_nexus6.nonNull)((0, import_nexus6.stringArg)()),
|
|
2222
|
+
playerCount: (0, import_nexus6.nonNull)((0, import_nexus6.intArg)())
|
|
2249
2223
|
},
|
|
2250
2224
|
async resolve(_, args, ctx) {
|
|
2251
2225
|
return createGame(args, ctx, {
|
|
@@ -2256,14 +2230,14 @@ function generateBaseMutations({
|
|
|
2256
2230
|
t.field("addGamePeriod", {
|
|
2257
2231
|
type: Period,
|
|
2258
2232
|
args: {
|
|
2259
|
-
gameId: (0,
|
|
2260
|
-
facts: (0,
|
|
2261
|
-
type: (0,
|
|
2233
|
+
gameId: (0, import_nexus6.nonNull)((0, import_nexus6.intArg)()),
|
|
2234
|
+
facts: (0, import_nexus6.arg)({
|
|
2235
|
+
type: (0, import_nexus6.nonNull)(inputTypes.PeriodFactsInput)
|
|
2262
2236
|
})
|
|
2263
2237
|
},
|
|
2264
2238
|
async resolve(_, args, ctx) {
|
|
2265
2239
|
return addGamePeriod(args, ctx, {
|
|
2266
|
-
schema: PeriodFactsSchema,
|
|
2240
|
+
schema: schemas.PeriodFactsSchema,
|
|
2267
2241
|
reducers
|
|
2268
2242
|
});
|
|
2269
2243
|
}
|
|
@@ -2271,17 +2245,17 @@ function generateBaseMutations({
|
|
|
2271
2245
|
t.field("addPeriodSegment", {
|
|
2272
2246
|
type: PeriodSegment,
|
|
2273
2247
|
args: {
|
|
2274
|
-
gameId: (0,
|
|
2275
|
-
periodIx: (0,
|
|
2276
|
-
facts: (0,
|
|
2277
|
-
type: (0,
|
|
2248
|
+
gameId: (0, import_nexus6.nonNull)((0, import_nexus6.intArg)()),
|
|
2249
|
+
periodIx: (0, import_nexus6.nonNull)((0, import_nexus6.intArg)()),
|
|
2250
|
+
facts: (0, import_nexus6.arg)({
|
|
2251
|
+
type: (0, import_nexus6.nonNull)(inputTypes.PeriodSegmentFactsInput)
|
|
2278
2252
|
}),
|
|
2279
|
-
storyElements: (0,
|
|
2280
|
-
learningElements: (0,
|
|
2253
|
+
storyElements: (0, import_nexus6.list)((0, import_nexus6.stringArg)()),
|
|
2254
|
+
learningElements: (0, import_nexus6.list)((0, import_nexus6.stringArg)())
|
|
2281
2255
|
},
|
|
2282
2256
|
async resolve(_, args, ctx) {
|
|
2283
2257
|
return addPeriodSegment(args, ctx, {
|
|
2284
|
-
schema: PeriodSegmentFactsSchema,
|
|
2258
|
+
schema: schemas.PeriodSegmentFactsSchema,
|
|
2285
2259
|
reducers
|
|
2286
2260
|
});
|
|
2287
2261
|
}
|
|
@@ -2289,7 +2263,7 @@ function generateBaseMutations({
|
|
|
2289
2263
|
t.field("activateNextPeriod", {
|
|
2290
2264
|
type: Game,
|
|
2291
2265
|
args: {
|
|
2292
|
-
gameId: (0,
|
|
2266
|
+
gameId: (0, import_nexus6.nonNull)((0, import_nexus6.intArg)())
|
|
2293
2267
|
},
|
|
2294
2268
|
async resolve(_, args, ctx) {
|
|
2295
2269
|
const results = await activateNextPeriod(args, ctx, {
|
|
@@ -2303,7 +2277,7 @@ function generateBaseMutations({
|
|
|
2303
2277
|
t.field("activateNextSegment", {
|
|
2304
2278
|
type: Game,
|
|
2305
2279
|
args: {
|
|
2306
|
-
gameId: (0,
|
|
2280
|
+
gameId: (0, import_nexus6.nonNull)((0, import_nexus6.intArg)())
|
|
2307
2281
|
},
|
|
2308
2282
|
async resolve(_, args, ctx) {
|
|
2309
2283
|
const results = await activateNextSegment(args, ctx, {
|
|
@@ -2317,8 +2291,8 @@ function generateBaseMutations({
|
|
|
2317
2291
|
t.field("performAction", {
|
|
2318
2292
|
type: PlayerResult,
|
|
2319
2293
|
args: {
|
|
2320
|
-
type: (0,
|
|
2321
|
-
payload: (0,
|
|
2294
|
+
type: (0, import_nexus6.nonNull)((0, import_nexus6.stringArg)()),
|
|
2295
|
+
payload: (0, import_nexus6.nonNull)((0, import_nexus6.stringArg)())
|
|
2322
2296
|
},
|
|
2323
2297
|
async resolve(_, args, ctx) {
|
|
2324
2298
|
const currentGame = await getGameFromContext(ctx);
|
|
@@ -2343,8 +2317,8 @@ function generateBaseMutations({
|
|
|
2343
2317
|
t.field("attemptLearningElement", {
|
|
2344
2318
|
type: LearningElementAttempt,
|
|
2345
2319
|
args: {
|
|
2346
|
-
elementId: (0,
|
|
2347
|
-
selection: (0,
|
|
2320
|
+
elementId: (0, import_nexus6.nonNull)((0, import_nexus6.idArg)()),
|
|
2321
|
+
selection: (0, import_nexus6.nonNull)((0, import_nexus6.stringArg)())
|
|
2348
2322
|
},
|
|
2349
2323
|
async resolve(_, args, ctx) {
|
|
2350
2324
|
return attemptLearningElement(args, ctx);
|
|
@@ -2353,7 +2327,7 @@ function generateBaseMutations({
|
|
|
2353
2327
|
t.field("markStoryElement", {
|
|
2354
2328
|
type: Player,
|
|
2355
2329
|
args: {
|
|
2356
|
-
elementId: (0,
|
|
2330
|
+
elementId: (0, import_nexus6.nonNull)((0, import_nexus6.idArg)())
|
|
2357
2331
|
},
|
|
2358
2332
|
async resolve(_, args, ctx) {
|
|
2359
2333
|
return markStoryElement(args, ctx);
|
|
@@ -2362,10 +2336,10 @@ function generateBaseMutations({
|
|
|
2362
2336
|
t.field("updatePlayerData", {
|
|
2363
2337
|
type: Player,
|
|
2364
2338
|
args: {
|
|
2365
|
-
name: (0,
|
|
2366
|
-
avatar: (0,
|
|
2367
|
-
color: (0,
|
|
2368
|
-
facts: (0,
|
|
2339
|
+
name: (0, import_nexus6.stringArg)(),
|
|
2340
|
+
avatar: (0, import_nexus6.stringArg)(),
|
|
2341
|
+
color: (0, import_nexus6.stringArg)(),
|
|
2342
|
+
facts: (0, import_nexus6.stringArg)()
|
|
2369
2343
|
},
|
|
2370
2344
|
async resolve(_, args, ctx) {
|
|
2371
2345
|
const facts = args.facts ? JSON.parse(args.facts) : {};
|
|
@@ -2375,7 +2349,7 @@ function generateBaseMutations({
|
|
|
2375
2349
|
t.field("saveConsolidationDecision", {
|
|
2376
2350
|
type: PlayerDecision,
|
|
2377
2351
|
args: {
|
|
2378
|
-
payload: (0,
|
|
2352
|
+
payload: (0, import_nexus6.nonNull)((0, import_nexus6.stringArg)())
|
|
2379
2353
|
},
|
|
2380
2354
|
async resolve(_, args, ctx) {
|
|
2381
2355
|
const facts = JSON.parse(args.payload);
|
|
@@ -2394,9 +2368,9 @@ function generateBaseMutations({
|
|
|
2394
2368
|
var Mutation = generateBaseMutations();
|
|
2395
2369
|
|
|
2396
2370
|
// src/types/Query.ts
|
|
2397
|
-
var
|
|
2371
|
+
var import_nexus7 = require("nexus");
|
|
2398
2372
|
function generateBaseQueries() {
|
|
2399
|
-
return (0,
|
|
2373
|
+
return (0, import_nexus7.objectType)({
|
|
2400
2374
|
name: "Query",
|
|
2401
2375
|
definition(t) {
|
|
2402
2376
|
t.list.nonNull.field("games", {
|
|
@@ -2408,7 +2382,7 @@ function generateBaseQueries() {
|
|
|
2408
2382
|
t.field("game", {
|
|
2409
2383
|
type: Game,
|
|
2410
2384
|
args: {
|
|
2411
|
-
id: (0,
|
|
2385
|
+
id: (0, import_nexus7.intArg)()
|
|
2412
2386
|
},
|
|
2413
2387
|
async resolve(_, args, ctx) {
|
|
2414
2388
|
return getGame(args, ctx);
|
|
@@ -2438,7 +2412,7 @@ function generateBaseQueries() {
|
|
|
2438
2412
|
t.field("learningElement", {
|
|
2439
2413
|
type: LearningElementState,
|
|
2440
2414
|
args: {
|
|
2441
|
-
id: (0,
|
|
2415
|
+
id: (0, import_nexus7.nonNull)((0, import_nexus7.idArg)())
|
|
2442
2416
|
},
|
|
2443
2417
|
async resolve(_, args, ctx) {
|
|
2444
2418
|
return getLearningElement(args, ctx);
|
|
@@ -2462,9 +2436,9 @@ function generateBaseQueries() {
|
|
|
2462
2436
|
var Query = generateBaseQueries();
|
|
2463
2437
|
|
|
2464
2438
|
// src/types/Subscription.ts
|
|
2465
|
-
var
|
|
2439
|
+
var import_nexus8 = require("nexus");
|
|
2466
2440
|
function generateBaseSubscriptions() {
|
|
2467
|
-
return (0,
|
|
2441
|
+
return (0, import_nexus8.subscriptionType)({
|
|
2468
2442
|
definition(t) {
|
|
2469
2443
|
t.list.nonNull.field("eventsGlobal", {
|
|
2470
2444
|
type: Event,
|
|
@@ -2490,13 +2464,13 @@ function generateBaseSubscriptions() {
|
|
|
2490
2464
|
var Subscription = generateBaseSubscriptions();
|
|
2491
2465
|
|
|
2492
2466
|
// src/nexus.ts
|
|
2493
|
-
var JsonScalar = (0,
|
|
2494
|
-
var DateScalar = (0,
|
|
2495
|
-
var UserRole3 = (0,
|
|
2467
|
+
var JsonScalar = (0, import_nexus10.asNexusMethod)(import_graphql_scalars.JSONObjectResolver, "json");
|
|
2468
|
+
var DateScalar = (0, import_nexus10.asNexusMethod)(import_graphql_scalars.DateTimeResolver, "date");
|
|
2469
|
+
var UserRole3 = (0, import_nexus10.enumType)({
|
|
2496
2470
|
name: "UserRole",
|
|
2497
2471
|
members: Object.values(DB5.UserRole)
|
|
2498
2472
|
});
|
|
2499
|
-
var Event = (0,
|
|
2473
|
+
var Event = (0, import_nexus10.objectType)({
|
|
2500
2474
|
name: "Event",
|
|
2501
2475
|
definition(t) {
|
|
2502
2476
|
t.string("type");
|
|
@@ -2515,11 +2489,7 @@ var Event = (0, import_nexus11.objectType)({
|
|
|
2515
2489
|
LearningElementState,
|
|
2516
2490
|
Mutation,
|
|
2517
2491
|
Period,
|
|
2518
|
-
PeriodFactsInput,
|
|
2519
|
-
PeriodFactsSchema,
|
|
2520
2492
|
PeriodSegment,
|
|
2521
|
-
PeriodSegmentFactsInput,
|
|
2522
|
-
PeriodSegmentFactsSchema,
|
|
2523
2493
|
Player,
|
|
2524
2494
|
PlayerAction,
|
|
2525
2495
|
PlayerDecision,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
fragment PlayerData on Player {
|
|
2
|
+
id
|
|
3
|
+
|
|
4
|
+
isReady
|
|
5
|
+
|
|
6
|
+
role
|
|
7
|
+
|
|
8
|
+
name
|
|
9
|
+
avatar
|
|
10
|
+
location
|
|
11
|
+
color
|
|
12
|
+
|
|
13
|
+
facts
|
|
14
|
+
|
|
15
|
+
experience
|
|
16
|
+
experienceToNext
|
|
17
|
+
|
|
18
|
+
achievementKeys
|
|
19
|
+
achievements {
|
|
20
|
+
id
|
|
21
|
+
count
|
|
22
|
+
|
|
23
|
+
achievement {
|
|
24
|
+
id
|
|
25
|
+
name
|
|
26
|
+
description
|
|
27
|
+
image
|
|
28
|
+
reward
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
level {
|
|
33
|
+
id
|
|
34
|
+
index
|
|
35
|
+
}
|
|
36
|
+
}
|