@gbl-uzh/platform 0.2.12 → 0.2.14

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.
Files changed (34) hide show
  1. package/dist/index.d.ts +5 -3
  2. package/dist/nexus.js +2 -2
  3. package/dist/ops/FGameData.graphql +7 -0
  4. package/dist/ops/FLearningElementData.graphql +10 -0
  5. package/dist/ops/FPeriodData.graphql +14 -0
  6. package/dist/ops/FPlayerActionData.graphql +9 -0
  7. package/dist/ops/FPlayerData.graphql +36 -0
  8. package/dist/ops/FResultData.graphql +17 -0
  9. package/dist/ops/FSegmentData.graphql +15 -0
  10. package/dist/ops/MActivateNextPeriod.graphql +11 -0
  11. package/dist/ops/MActivateNextSegment.graphql +14 -0
  12. package/dist/ops/MAddGamePeriod.graphql +7 -0
  13. package/dist/ops/MAddPeriodSegment.graphql +19 -0
  14. package/dist/ops/MAttemptLearningElement.graphql +18 -0
  15. package/dist/ops/MCreateGame.graphql +7 -0
  16. package/dist/ops/MLoginAsTeam.graphql +7 -0
  17. package/dist/ops/MMarkStoryElement.graphql +6 -0
  18. package/dist/ops/MPerformAction.graphql +7 -0
  19. package/dist/ops/MSaveConsolidationDecision.graphql +8 -0
  20. package/dist/ops/MUpdatePlayerData.graphql +12 -0
  21. package/dist/ops/MUpdateReadyState.graphql +6 -0
  22. package/dist/ops/QGame.graphql +37 -0
  23. package/dist/ops/QGames.graphql +7 -0
  24. package/dist/ops/QLearningElement.graphql +19 -0
  25. package/dist/ops/QLearningElements.graphql +7 -0
  26. package/dist/ops/QPastResults.graphql +40 -0
  27. package/dist/ops/QResult.graphql +53 -0
  28. package/dist/ops/QResults.graphql +12 -0
  29. package/dist/ops/QSelf.graphql +7 -0
  30. package/dist/ops/SGlobalEvents.graphql +5 -0
  31. package/dist/ops/SUserEvents.graphql +5 -0
  32. package/package.json +5 -3
  33. package/dist/generated/ops.d.ts +0 -1555
  34. 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",
@@ -288,6 +285,11 @@ declare namespace GameService {
288
285
  };
289
286
  }
290
287
 
288
+ declare enum PlayerDecisionType {
289
+ Consolidation = "CONSOLIDATION",
290
+ Preparation = "PREPARATION"
291
+ }
292
+
291
293
  type Context = CtxWithPrisma<PrismaClient>;
292
294
  interface PerformActionArgs<ActionTypes> {
293
295
  gameId: number;
package/dist/nexus.js CHANGED
@@ -326,10 +326,10 @@ var Game = (0, import_nexus5.objectType)({
326
326
  t.field("activePeriod", {
327
327
  type: Period
328
328
  });
329
- t.nonNull.list.nonNull.field("players", {
329
+ t.list.nonNull.field("players", {
330
330
  type: Player
331
331
  });
332
- t.nonNull.list.nonNull.field("periods", {
332
+ t.list.nonNull.field("periods", {
333
333
  type: Period
334
334
  });
335
335
  }
@@ -0,0 +1,7 @@
1
+ fragment GameData on Game {
2
+ id
3
+
4
+ status
5
+ name
6
+ activePeriodIx
7
+ }
@@ -0,0 +1,10 @@
1
+ fragment LearningElementData on LearningElement {
2
+ id
3
+
4
+ title
5
+ question
6
+ reward
7
+ motivation
8
+
9
+ feedback
10
+ }
@@ -0,0 +1,14 @@
1
+ #import "./FSegmentData.graphql"
2
+
3
+ fragment PeriodData on Period {
4
+ id
5
+
6
+ index
7
+ activeSegmentIx
8
+
9
+ facts
10
+
11
+ segments {
12
+ ...SegmentData
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ fragment PlayerActionData on PlayerAction {
2
+ id
3
+
4
+ periodIx
5
+ segmentIx
6
+
7
+ type
8
+ facts
9
+ }
@@ -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
+ }
@@ -0,0 +1,17 @@
1
+ fragment ResultData on PlayerResult {
2
+ id
3
+
4
+ type
5
+
6
+ facts
7
+
8
+ period {
9
+ id
10
+ index
11
+ }
12
+
13
+ segment {
14
+ id
15
+ index
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ fragment SegmentData on PeriodSegment {
2
+ id
3
+
4
+ index
5
+
6
+ facts
7
+
8
+ learningElements {
9
+ id
10
+ }
11
+
12
+ storyElements {
13
+ id
14
+ }
15
+ }
@@ -0,0 +1,11 @@
1
+ #import "./FGameData.graphql"
2
+ #import "./FPeriodData.graphql"
3
+
4
+ mutation ActivateNextPeriod($gameId: Int!) {
5
+ activateNextPeriod(gameId: $gameId) {
6
+ ...GameData
7
+ periods {
8
+ ...PeriodData
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,14 @@
1
+ #import "./FPeriodData.graphql"
2
+ #import "./FPlayerData.graphql"
3
+
4
+ mutation ActivateNextSegment($gameId: Int!) {
5
+ activateNextSegment(gameId: $gameId) {
6
+ ...GameData
7
+ periods {
8
+ ...PeriodData
9
+ }
10
+ players {
11
+ ...PlayerData
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,7 @@
1
+ #import "./FPeriodData.graphql"
2
+
3
+ mutation AddGamePeriod($gameId: Int!, $facts: PeriodFactsInput!) {
4
+ addGamePeriod(gameId: $gameId, facts: $facts) {
5
+ ...PeriodData
6
+ }
7
+ }
@@ -0,0 +1,19 @@
1
+ #import "./FSegmentData.graphql"
2
+
3
+ mutation AddPeriodSegment(
4
+ $gameId: Int!
5
+ $periodIx: Int!
6
+ $facts: PeriodSegmentFactsInput!
7
+ $storyElements: [String]
8
+ $learningElements: [String]
9
+ ) {
10
+ addPeriodSegment(
11
+ gameId: $gameId
12
+ periodIx: $periodIx
13
+ facts: $facts
14
+ storyElements: $storyElements
15
+ learningElements: $learningElements
16
+ ) {
17
+ ...SegmentData
18
+ }
19
+ }
@@ -0,0 +1,18 @@
1
+ mutation AttemptLearningElement($elementId: ID!, $selection: String!) {
2
+ attemptLearningElement(elementId: $elementId, selection: $selection) {
3
+ id
4
+
5
+ pointsAchieved
6
+ pointsMax
7
+
8
+ element {
9
+ id
10
+ feedback
11
+ }
12
+
13
+ player {
14
+ id
15
+ completedLearningElementIds
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,7 @@
1
+ #import "./FGameData.graphql"
2
+
3
+ mutation CreateGame($name: String!, $playerCount: Int!) {
4
+ createGame(name: $name, playerCount: $playerCount) {
5
+ ...GameData
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ #import "./FPlayerData.graphql"
2
+
3
+ mutation LoginAsTeam($token: String!) {
4
+ loginAsTeam(token: $token) {
5
+ ...PlayerData
6
+ }
7
+ }
@@ -0,0 +1,6 @@
1
+ mutation MarkStoryElement($elementId: ID!) {
2
+ markStoryElement(elementId: $elementId) {
3
+ id
4
+ visitedStoryElementIds
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ #import "./FResultData.graphql"
2
+
3
+ mutation PerformAction($type: String!, $payload: String!) {
4
+ performAction(type: $type, payload: $payload) {
5
+ ...ResultData
6
+ }
7
+ }
@@ -0,0 +1,8 @@
1
+ mutation SaveConsolidationDecision($payload: String!) {
2
+ saveConsolidationDecision(payload: $payload) {
3
+ id
4
+
5
+ type
6
+ facts
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ #import "./FPlayerData.graphql"
2
+
3
+ mutation UpdatePlayerData(
4
+ $name: String
5
+ $avatar: String
6
+ $color: String
7
+ $facts: String
8
+ ) {
9
+ updatePlayerData(name: $name, avatar: $avatar, color: $color, facts: $facts) {
10
+ ...PlayerData
11
+ }
12
+ }
@@ -0,0 +1,6 @@
1
+ mutation UpdateReadyState($isReady: Boolean!) {
2
+ updateReadyState(isReady: $isReady) {
3
+ id
4
+ isReady
5
+ }
6
+ }
@@ -0,0 +1,37 @@
1
+ #import "./FGameData.graphql"
2
+ #import "./FPeriodData.graphql"
3
+ #import "./FPlayerData.graphql"
4
+
5
+ query Game($id: Int) {
6
+ game(id: $id) {
7
+ ...GameData
8
+ activePeriod {
9
+ id
10
+ activeSegmentIx
11
+ segments {
12
+ id
13
+ }
14
+ }
15
+ periods {
16
+ ...PeriodData
17
+ }
18
+ players {
19
+ id
20
+
21
+ isReady
22
+
23
+ role
24
+
25
+ name
26
+ avatar
27
+ location
28
+ color
29
+
30
+ facts
31
+
32
+ experience
33
+ experienceToNext
34
+ token
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,7 @@
1
+ #import "./FGameData.graphql"
2
+
3
+ query Games {
4
+ games {
5
+ ...GameData
6
+ }
7
+ }
@@ -0,0 +1,19 @@
1
+ #import "./FLearningElementData.graphql"
2
+
3
+ query LearningElement($id: ID!) {
4
+ learningElement(id: $id) {
5
+ id
6
+
7
+ element {
8
+ ...LearningElementData
9
+
10
+ options {
11
+ content
12
+ }
13
+ }
14
+
15
+ state
16
+
17
+ solution
18
+ }
19
+ }
@@ -0,0 +1,7 @@
1
+ #import "./FLearningElementData.graphql"
2
+
3
+ query LearningElements {
4
+ learningElements {
5
+ ...LearningElementData
6
+ }
7
+ }
@@ -0,0 +1,40 @@
1
+ #import "./FResultData.graphql"
2
+
3
+ query PastResults {
4
+ result {
5
+ currentGame {
6
+ id
7
+ status
8
+ }
9
+ }
10
+ pastResults {
11
+ ...ResultData
12
+ player {
13
+ id
14
+
15
+ role
16
+
17
+ name
18
+ avatar
19
+ color
20
+
21
+ facts
22
+
23
+ experience
24
+ experienceToNext
25
+
26
+ level {
27
+ id
28
+ index
29
+ }
30
+
31
+ completedLearningElementIds
32
+ visitedStoryElementIds
33
+ }
34
+ period {
35
+ id
36
+ index
37
+ facts
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,53 @@
1
+ #import "./FResultData.graphql"
2
+ #import "./FPeriodData.graphql"
3
+ #import "./FPlayerData.graphql"
4
+ #import "./FPlayerActionData.graphql"
5
+
6
+ query Result {
7
+ result {
8
+ playerResult {
9
+ ...ResultData
10
+ player {
11
+ id
12
+ completedLearningElementIds
13
+ visitedStoryElementIds
14
+ }
15
+ }
16
+ previousResults {
17
+ ...ResultData
18
+ }
19
+ currentGame {
20
+ id
21
+ status
22
+ periods {
23
+ ...PeriodData
24
+ }
25
+ activePeriod {
26
+ ...PeriodData
27
+ activeSegment {
28
+ id
29
+ index
30
+ facts
31
+ learningElements {
32
+ id
33
+ title
34
+ }
35
+ storyElements {
36
+ id
37
+ type
38
+ title
39
+ content
40
+ contentRole
41
+ }
42
+ }
43
+ }
44
+ }
45
+ transactions {
46
+ ...PlayerActionData
47
+ }
48
+ }
49
+
50
+ self {
51
+ ...PlayerData
52
+ }
53
+ }
@@ -0,0 +1,12 @@
1
+ #import "./FResultData.graphql"
2
+
3
+ query Results {
4
+ results {
5
+ ...ResultData
6
+ player {
7
+ id
8
+
9
+ name
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ #import "./FPlayerData.graphql"
2
+
3
+ query Self {
4
+ self {
5
+ ...PlayerData
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ subscription GlobalEvents {
2
+ eventsGlobal {
3
+ type
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ subscription UserEvents {
2
+ eventsUser {
3
+ type
4
+ }
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gbl-uzh/platform",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "license": "AGPL-3.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,9 +12,9 @@
12
12
  "build": "npm-run-all build:nexus build:graphql build:ts build:copy",
13
13
  "build:nexus": "ts-node --esm --transpile-only src/nexus.ts",
14
14
  "build:graphql": "graphql-codegen --config codegen.ts",
15
- "build:ts": "NODE_ENV=production tsup",
15
+ "build:ts": "cross-env NODE_ENV=production tsup",
16
16
  "build:copy": "ts-node src/lib/copy.ts",
17
- "dev": "NODE_ENV=development tsup --watch",
17
+ "dev": "cross-env NODE_ENV=development tsup --watch",
18
18
  "generate": "prisma generate"
19
19
  },
20
20
  "engines": {
@@ -32,6 +32,8 @@
32
32
  "@tsconfig/recommended": "1.0.1",
33
33
  "@types/jest": "^29.2.2",
34
34
  "@types/node": "^18.11.9",
35
+ "cross-env": "7.0.3",
36
+ "fs-extra": "11.1.0",
35
37
  "jest": "29.3.1",
36
38
  "npm-run-all": "4.1.5",
37
39
  "prisma": "4.8.0",