@fmsim/api 2.0.0-beta.6 → 2.0.0-beta.61

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.
@@ -27,9 +27,92 @@
27
27
  }
28
28
  ]
29
29
  },
30
+ {
31
+ "kind": "function",
32
+ "name": "reorderBoard",
33
+ "parameters": [
34
+ {
35
+ "name": "id",
36
+ "type": {
37
+ "text": "string"
38
+ }
39
+ },
40
+ {
41
+ "name": "prevId",
42
+ "optional": true,
43
+ "type": {
44
+ "text": "string"
45
+ }
46
+ },
47
+ {
48
+ "name": "nextId",
49
+ "optional": true,
50
+ "type": {
51
+ "text": "string"
52
+ }
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "kind": "function",
58
+ "name": "fetchPlayback",
59
+ "parameters": [
60
+ {
61
+ "name": "startTime",
62
+ "type": {
63
+ "text": "string"
64
+ }
65
+ },
66
+ {
67
+ "name": "endTime",
68
+ "optional": true,
69
+ "type": {
70
+ "text": "string"
71
+ }
72
+ },
73
+ {
74
+ "name": "includeSnapshot",
75
+ "default": "true",
76
+ "type": {
77
+ "text": "boolean"
78
+ }
79
+ },
80
+ {
81
+ "name": "count",
82
+ "optional": true,
83
+ "type": {
84
+ "text": "number"
85
+ }
86
+ }
87
+ ]
88
+ },
30
89
  {
31
90
  "kind": "function",
32
91
  "name": "fetchBoardById",
92
+ "parameters": [
93
+ {
94
+ "name": "id",
95
+ "type": {
96
+ "text": "string"
97
+ }
98
+ },
99
+ {
100
+ "name": "cachedUpdatedAt",
101
+ "optional": true,
102
+ "type": {
103
+ "text": "string"
104
+ }
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ "kind": "function",
110
+ "name": "fetchBoardNameById",
111
+ "return": {
112
+ "type": {
113
+ "text": "Promise<string>"
114
+ }
115
+ },
33
116
  "parameters": [
34
117
  {
35
118
  "name": "id",
@@ -115,6 +198,22 @@
115
198
  "module": "src/index.ts"
116
199
  }
117
200
  },
201
+ {
202
+ "kind": "js",
203
+ "name": "reorderBoard",
204
+ "declaration": {
205
+ "name": "reorderBoard",
206
+ "module": "src/index.ts"
207
+ }
208
+ },
209
+ {
210
+ "kind": "js",
211
+ "name": "fetchPlayback",
212
+ "declaration": {
213
+ "name": "fetchPlayback",
214
+ "module": "src/index.ts"
215
+ }
216
+ },
118
217
  {
119
218
  "kind": "js",
120
219
  "name": "fetchBoardById",
@@ -123,6 +222,14 @@
123
222
  "module": "src/index.ts"
124
223
  }
125
224
  },
225
+ {
226
+ "kind": "js",
227
+ "name": "fetchBoardNameById",
228
+ "declaration": {
229
+ "name": "fetchBoardNameById",
230
+ "module": "src/index.ts"
231
+ }
232
+ },
126
233
  {
127
234
  "kind": "js",
128
235
  "name": "createBoard",
@@ -188,6 +295,49 @@
188
295
  }
189
296
  ]
190
297
  },
298
+ {
299
+ "kind": "function",
300
+ "name": "fetchBoardNameById",
301
+ "return": {
302
+ "type": {
303
+ "text": "Promise<string>"
304
+ }
305
+ },
306
+ "parameters": [
307
+ {
308
+ "name": "id",
309
+ "type": {
310
+ "text": "string"
311
+ }
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "kind": "function",
317
+ "name": "reorderBoard",
318
+ "parameters": [
319
+ {
320
+ "name": "id",
321
+ "type": {
322
+ "text": "string"
323
+ }
324
+ },
325
+ {
326
+ "name": "prevId",
327
+ "optional": true,
328
+ "type": {
329
+ "text": "string"
330
+ }
331
+ },
332
+ {
333
+ "name": "nextId",
334
+ "optional": true,
335
+ "type": {
336
+ "text": "string"
337
+ }
338
+ }
339
+ ]
340
+ },
191
341
  {
192
342
  "kind": "function",
193
343
  "name": "fetchBoardById",
@@ -197,6 +347,13 @@
197
347
  "type": {
198
348
  "text": "string"
199
349
  }
350
+ },
351
+ {
352
+ "name": "cachedUpdatedAt",
353
+ "optional": true,
354
+ "type": {
355
+ "text": "string"
356
+ }
200
357
  }
201
358
  ]
202
359
  },
@@ -258,6 +415,22 @@
258
415
  "module": "src/graphql/board.ts"
259
416
  }
260
417
  },
418
+ {
419
+ "kind": "js",
420
+ "name": "fetchBoardNameById",
421
+ "declaration": {
422
+ "name": "fetchBoardNameById",
423
+ "module": "src/graphql/board.ts"
424
+ }
425
+ },
426
+ {
427
+ "kind": "js",
428
+ "name": "reorderBoard",
429
+ "declaration": {
430
+ "name": "reorderBoard",
431
+ "module": "src/graphql/board.ts"
432
+ }
433
+ },
261
434
  {
262
435
  "kind": "js",
263
436
  "name": "fetchBoardById",
@@ -309,6 +482,24 @@
309
482
  "description": "",
310
483
  "name": "DataSubscriptionProviderImpl",
311
484
  "members": [
485
+ {
486
+ "kind": "field",
487
+ "name": "_paused",
488
+ "type": {
489
+ "text": "boolean"
490
+ },
491
+ "privacy": "private",
492
+ "default": "false"
493
+ },
494
+ {
495
+ "kind": "field",
496
+ "name": "_subscriptions",
497
+ "type": {
498
+ "text": "Map<Component, { tag: string; unsubscribe: () => void }>"
499
+ },
500
+ "privacy": "private",
501
+ "default": "new Map()"
502
+ },
312
503
  {
313
504
  "kind": "method",
314
505
  "name": "subscribe",
@@ -332,6 +523,16 @@
332
523
  }
333
524
  ]
334
525
  },
526
+ {
527
+ "kind": "method",
528
+ "name": "pause",
529
+ "description": "플레이백 시작: 모든 구독을 실제 해제"
530
+ },
531
+ {
532
+ "kind": "method",
533
+ "name": "resume",
534
+ "description": "플레이백 종료: 보관된 tag 로 재구독"
535
+ },
335
536
  {
336
537
  "kind": "method",
337
538
  "name": "dispose"
@@ -609,6 +810,68 @@
609
810
  "name": "*",
610
811
  "module": "src/graphql/theme"
611
812
  }
813
+ },
814
+ {
815
+ "kind": "js",
816
+ "name": "*",
817
+ "declaration": {
818
+ "name": "*",
819
+ "module": "src/graphql/playback"
820
+ }
821
+ }
822
+ ]
823
+ },
824
+ {
825
+ "kind": "javascript-module",
826
+ "path": "src/graphql/playback.ts",
827
+ "declarations": [
828
+ {
829
+ "kind": "function",
830
+ "name": "fetchPlayback",
831
+ "return": {
832
+ "type": {
833
+ "text": "Promise<PlaybackResult>"
834
+ }
835
+ },
836
+ "parameters": [
837
+ {
838
+ "name": "startTime",
839
+ "type": {
840
+ "text": "string"
841
+ }
842
+ },
843
+ {
844
+ "name": "endTime",
845
+ "optional": true,
846
+ "type": {
847
+ "text": "string"
848
+ }
849
+ },
850
+ {
851
+ "name": "includeSnapshot",
852
+ "default": "true",
853
+ "type": {
854
+ "text": "boolean"
855
+ }
856
+ },
857
+ {
858
+ "name": "count",
859
+ "optional": true,
860
+ "type": {
861
+ "text": "number"
862
+ }
863
+ }
864
+ ]
865
+ }
866
+ ],
867
+ "exports": [
868
+ {
869
+ "kind": "js",
870
+ "name": "fetchPlayback",
871
+ "declaration": {
872
+ "name": "fetchPlayback",
873
+ "module": "src/graphql/playback.ts"
874
+ }
612
875
  }
613
876
  ]
614
877
  },
@@ -988,6 +1251,49 @@
988
1251
  }
989
1252
  ]
990
1253
  },
1254
+ {
1255
+ "kind": "function",
1256
+ "name": "fetchBoardNameById",
1257
+ "return": {
1258
+ "type": {
1259
+ "text": "Promise<string>"
1260
+ }
1261
+ },
1262
+ "parameters": [
1263
+ {
1264
+ "name": "id",
1265
+ "type": {
1266
+ "text": "string"
1267
+ }
1268
+ }
1269
+ ]
1270
+ },
1271
+ {
1272
+ "kind": "function",
1273
+ "name": "reorderBoard",
1274
+ "parameters": [
1275
+ {
1276
+ "name": "id",
1277
+ "type": {
1278
+ "text": "string"
1279
+ }
1280
+ },
1281
+ {
1282
+ "name": "prevId",
1283
+ "optional": true,
1284
+ "type": {
1285
+ "text": "string"
1286
+ }
1287
+ },
1288
+ {
1289
+ "name": "nextId",
1290
+ "optional": true,
1291
+ "type": {
1292
+ "text": "string"
1293
+ }
1294
+ }
1295
+ ]
1296
+ },
991
1297
  {
992
1298
  "kind": "function",
993
1299
  "name": "fetchBoardById",
@@ -997,6 +1303,13 @@
997
1303
  "type": {
998
1304
  "text": "string"
999
1305
  }
1306
+ },
1307
+ {
1308
+ "name": "cachedUpdatedAt",
1309
+ "optional": true,
1310
+ "type": {
1311
+ "text": "string"
1312
+ }
1000
1313
  }
1001
1314
  ]
1002
1315
  },
@@ -1065,6 +1378,22 @@
1065
1378
  "module": "src/restful/board.ts"
1066
1379
  }
1067
1380
  },
1381
+ {
1382
+ "kind": "js",
1383
+ "name": "fetchBoardNameById",
1384
+ "declaration": {
1385
+ "name": "fetchBoardNameById",
1386
+ "module": "src/restful/board.ts"
1387
+ }
1388
+ },
1389
+ {
1390
+ "kind": "js",
1391
+ "name": "reorderBoard",
1392
+ "declaration": {
1393
+ "name": "reorderBoard",
1394
+ "module": "src/restful/board.ts"
1395
+ }
1396
+ },
1068
1397
  {
1069
1398
  "kind": "js",
1070
1399
  "name": "fetchBoardById",
@@ -1692,6 +2021,14 @@
1692
2021
  "name": "*",
1693
2022
  "module": "src/restful/theme"
1694
2023
  }
2024
+ },
2025
+ {
2026
+ "kind": "js",
2027
+ "name": "*",
2028
+ "declaration": {
2029
+ "name": "*",
2030
+ "module": "src/restful/playback"
2031
+ }
1695
2032
  }
1696
2033
  ]
1697
2034
  },
@@ -1729,6 +2066,61 @@
1729
2066
  }
1730
2067
  ]
1731
2068
  },
2069
+ {
2070
+ "kind": "javascript-module",
2071
+ "path": "src/restful/playback.ts",
2072
+ "declarations": [
2073
+ {
2074
+ "kind": "function",
2075
+ "name": "fetchPlayback",
2076
+ "return": {
2077
+ "type": {
2078
+ "text": "Promise<PlaybackResult>"
2079
+ }
2080
+ },
2081
+ "parameters": [
2082
+ {
2083
+ "name": "startTime",
2084
+ "type": {
2085
+ "text": "string"
2086
+ }
2087
+ },
2088
+ {
2089
+ "name": "endTime",
2090
+ "optional": true,
2091
+ "type": {
2092
+ "text": "string"
2093
+ }
2094
+ },
2095
+ {
2096
+ "name": "includeSnapshot",
2097
+ "default": "true",
2098
+ "type": {
2099
+ "text": "boolean"
2100
+ }
2101
+ },
2102
+ {
2103
+ "name": "count",
2104
+ "optional": true,
2105
+ "type": {
2106
+ "text": "number"
2107
+ }
2108
+ }
2109
+ ],
2110
+ "description": "RESTful 플레이백 데이터 조회\nGET /mcs/lv/playback?startTime=...&endTime=...&count=...&includeSnapshot=..."
2111
+ }
2112
+ ],
2113
+ "exports": [
2114
+ {
2115
+ "kind": "js",
2116
+ "name": "fetchPlayback",
2117
+ "declaration": {
2118
+ "name": "fetchPlayback",
2119
+ "module": "src/restful/playback.ts"
2120
+ }
2121
+ }
2122
+ ]
2123
+ },
1732
2124
  {
1733
2125
  "kind": "javascript-module",
1734
2126
  "path": "src/restful/scenario.ts",
@@ -1,6 +1,8 @@
1
1
  import { Board } from '../types';
2
2
  export declare function fetchBoardList(listParam?: any): Promise<any>;
3
- export declare function fetchBoardById(id: string): Promise<any>;
3
+ export declare function fetchBoardNameById(id: string): Promise<string>;
4
+ export declare function reorderBoard(id: string, prevId?: string, nextId?: string): Promise<any>;
5
+ export declare function fetchBoardById(id: string, cachedUpdatedAt?: string): Promise<any>;
4
6
  export declare function createBoard(board: Board): Promise<any>;
5
7
  export declare function updateBoard(board: Board): Promise<any>;
6
8
  export declare function deleteBoard(id: string): Promise<any>;
@@ -10,6 +10,7 @@ export async function fetchBoardList(listParam = {}) {
10
10
  name
11
11
  description
12
12
  thumbnail
13
+ sortOrder
13
14
  createdAt
14
15
  updatedAt
15
16
  }
@@ -20,13 +21,39 @@ export async function fetchBoardList(listParam = {}) {
20
21
  });
21
22
  return response.data;
22
23
  }
23
- export async function fetchBoardById(id) {
24
- const response = await client.query({
24
+ export async function fetchBoardNameById(id) {
25
+ var _a;
26
+ const { data } = await client.query({
25
27
  query: gql `
26
- query FetchBoardById($id: String!, $filters: [Filter!]) {
28
+ query FetchBoardName($id: String!) {
27
29
  board(id: $id) {
28
30
  id
29
31
  name
32
+ }
33
+ }
34
+ `,
35
+ variables: { id }
36
+ });
37
+ return ((_a = data.board) === null || _a === void 0 ? void 0 : _a.name) || id;
38
+ }
39
+ export async function reorderBoard(id, prevId, nextId) {
40
+ const response = await client.mutate({
41
+ mutation: gql `
42
+ mutation ReorderBoard($id: String!, $prevId: String, $nextId: String) {
43
+ reorderBoard(id: $id, prevId: $prevId, nextId: $nextId)
44
+ }
45
+ `,
46
+ variables: { id, prevId, nextId }
47
+ });
48
+ return response.data;
49
+ }
50
+ export async function fetchBoardById(id, cachedUpdatedAt) {
51
+ const response = await client.query({
52
+ query: gql `
53
+ query FetchBoardById($id: String!, $cachedUpdatedAt: String, $filters: [Filter!]) {
54
+ board(id: $id, cachedUpdatedAt: $cachedUpdatedAt) {
55
+ id
56
+ name
30
57
  description
31
58
  group {
32
59
  id
@@ -59,6 +86,7 @@ export async function fetchBoardById(id) {
59
86
  `,
60
87
  variables: {
61
88
  id,
89
+ cachedUpdatedAt,
62
90
  filters: [
63
91
  {
64
92
  name: 'active',
@@ -1 +1 @@
1
- {"version":3,"file":"board.js","sourceRoot":"","sources":["../../../src/graphql/board.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGpD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,YAAiB,EAAE;IACtD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;iBAEG,SAAS,CAAC,SAAS,CAAC;;;;;;;;;;;;KAYhC;KACF,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAU;IAC7C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCT;QACD,SAAS,EAAE;YACT,EAAE;YACF,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,IAAI;iBACZ;aACF;SACF;KACF,CAAC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IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BT;QACD,SAAS,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;KAC3B,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { buildArgs, client } from '@operato/graphql'\n\nimport { Board } from '../types'\nimport gql from 'graphql-tag'\n\nexport async function fetchBoardList(listParam: any = {}) {\n const response = await client.query({\n query: gql`\n {\n boards(${buildArgs(listParam)}) {\n items {\n id\n name\n description\n thumbnail\n createdAt\n updatedAt\n }\n total\n }\n }\n `\n })\n\n return response.data\n}\n\nexport async function fetchBoardById(id: string) {\n const response = await client.query({\n query: gql`\n query FetchBoardById($id: String!, $filters: [Filter!]) {\n board(id: $id) {\n id\n name\n description\n group {\n id\n name\n }\n thumbnail\n model\n createdAt\n creator {\n id\n name\n }\n updatedAt\n updater {\n id\n name\n }\n }\n\n themes(filters: $filters) {\n items {\n name\n description\n active\n type\n value\n }\n }\n }\n `,\n variables: {\n id,\n filters: [\n {\n name: 'active',\n operator: 'eq',\n value: true\n }\n ]\n }\n })\n\n return response.data\n}\n\nexport async function createBoard(board: Board) {\n /*\n input NewBoard {\n name : String!\n description : String\n model : String!\n groupId : String!\n }\n */\n\n board.model = JSON.stringify(board.model)\n\n const response = await client.mutate({\n mutation: gql`\n mutation CreateBoard($board: NewBoard!) {\n createBoard(board: $board) {\n id\n name\n description\n model\n createdAt\n updatedAt\n }\n }\n `,\n variables: {\n board\n }\n })\n\n return response.data\n}\n\nexport async function updateBoard(board: Board) {\n /*\n input BoardPatch {\n name : String\n description : String\n model : String\n }\n */\n var { id, name, description, model, groupId } = board\n model = JSON.stringify(model)\n\n const response = await client.mutate({\n mutation: gql`\n mutation UpdateBoard($id: String!, $patch: BoardPatch!) {\n updateBoard(id: $id, patch: $patch) {\n id\n name\n description\n model\n group {\n id\n name\n }\n createdAt\n updatedAt\n }\n }\n `,\n variables: {\n id,\n patch: { name, description, model, groupId }\n }\n })\n\n return response.data\n}\n\nexport async function deleteBoard(id: string) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteBoard(id: $id)\n }\n `,\n variables: {\n id\n }\n })\n\n return response.data\n}\n\nexport async function fetchBoardInfoById(boardId: string) {\n const { data } = await client.query({\n query: gql`\n query FetchBoardById($id: String!) {\n board(id: $id) {\n id\n name\n description\n group {\n id\n name\n }\n thumbnail\n createdAt\n creator {\n id\n name\n }\n updatedAt\n updater {\n id\n name\n }\n }\n\n groups {\n items {\n id\n name\n description\n }\n }\n }\n `,\n variables: { id: boardId }\n })\n\n return data\n}\n"]}
1
+ {"version":3,"file":"board.js","sourceRoot":"","sources":["../../../src/graphql/board.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGpD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,YAAiB,EAAE;IACtD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;iBAEG,SAAS,CAAC,SAAS,CAAC;;;;;;;;;;;;;KAahC;KACF,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EAAU;;IACjD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;KAOT;QACD,SAAS,EAAE,EAAE,EAAE,EAAE;KAClB,CAAC,CAAA;IACF,OAAO,CAAA,MAAC,IAAY,CAAC,KAAK,0CAAE,IAAI,KAAI,EAAE,CAAA;AACxC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAU,EAAE,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;IAE7B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;QACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;KAeZ;QACD,SAAS,EAAE;YACT,EAAE;YACF,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE;SAC7C;KACF,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAU;IAC1C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;QACnC,QAAQ,EAAE,GAAG,CAAA;;;;KAIZ;QACD,SAAS,EAAE;YACT,EAAE;SACH;KACF,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAe;IACtD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BT;QACD,SAAS,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;KAC3B,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { buildArgs, client } from '@operato/graphql'\n\nimport { Board } from '../types'\nimport gql from 'graphql-tag'\n\nexport async function fetchBoardList(listParam: any = {}) {\n const response = await client.query({\n query: gql`\n {\n boards(${buildArgs(listParam)}) {\n items {\n id\n name\n description\n thumbnail\n sortOrder\n createdAt\n updatedAt\n }\n total\n }\n }\n `\n })\n\n return response.data\n}\n\nexport async function fetchBoardNameById(id: string): Promise<string> {\n const { data } = await client.query({\n query: gql`\n query FetchBoardName($id: String!) {\n board(id: $id) {\n id\n name\n }\n }\n `,\n variables: { id }\n })\n return (data as any).board?.name || id\n}\n\nexport async function reorderBoard(id: string, prevId?: string, nextId?: string) {\n const response = await client.mutate({\n mutation: gql`\n mutation ReorderBoard($id: String!, $prevId: String, $nextId: String) {\n reorderBoard(id: $id, prevId: $prevId, nextId: $nextId)\n }\n `,\n variables: { id, prevId, nextId }\n })\n return response.data\n}\n\nexport async function fetchBoardById(id: string, cachedUpdatedAt?: string) {\n const response = await client.query({\n query: gql`\n query FetchBoardById($id: String!, $cachedUpdatedAt: String, $filters: [Filter!]) {\n board(id: $id, cachedUpdatedAt: $cachedUpdatedAt) {\n id\n name\n description\n group {\n id\n name\n }\n thumbnail\n model\n createdAt\n creator {\n id\n name\n }\n updatedAt\n updater {\n id\n name\n }\n }\n\n themes(filters: $filters) {\n items {\n name\n description\n active\n type\n value\n }\n }\n }\n `,\n variables: {\n id,\n cachedUpdatedAt,\n filters: [\n {\n name: 'active',\n operator: 'eq',\n value: true\n }\n ]\n }\n })\n\n return response.data\n}\n\nexport async function createBoard(board: Board) {\n /*\n input NewBoard {\n name : String!\n description : String\n model : String!\n groupId : String!\n }\n */\n\n board.model = JSON.stringify(board.model)\n\n const response = await client.mutate({\n mutation: gql`\n mutation CreateBoard($board: NewBoard!) {\n createBoard(board: $board) {\n id\n name\n description\n model\n createdAt\n updatedAt\n }\n }\n `,\n variables: {\n board\n }\n })\n\n return response.data\n}\n\nexport async function updateBoard(board: Board) {\n /*\n input BoardPatch {\n name : String\n description : String\n model : String\n }\n */\n var { id, name, description, model, groupId } = board\n model = JSON.stringify(model)\n\n const response = await client.mutate({\n mutation: gql`\n mutation UpdateBoard($id: String!, $patch: BoardPatch!) {\n updateBoard(id: $id, patch: $patch) {\n id\n name\n description\n model\n group {\n id\n name\n }\n createdAt\n updatedAt\n }\n }\n `,\n variables: {\n id,\n patch: { name, description, model, groupId }\n }\n })\n\n return response.data\n}\n\nexport async function deleteBoard(id: string) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteBoard(id: $id)\n }\n `,\n variables: {\n id\n }\n })\n\n return response.data\n}\n\nexport async function fetchBoardInfoById(boardId: string) {\n const { data } = await client.query({\n query: gql`\n query FetchBoardById($id: String!) {\n board(id: $id) {\n id\n name\n description\n group {\n id\n name\n }\n thumbnail\n createdAt\n creator {\n id\n name\n }\n updatedAt\n updater {\n id\n name\n }\n }\n\n groups {\n items {\n id\n name\n description\n }\n }\n }\n `,\n variables: { id: boardId }\n })\n\n return data\n}\n"]}
@@ -1,7 +1,13 @@
1
1
  import { Component, DataSubscriptionProvider } from '@hatiolab/things-scene';
2
2
  export declare class DataSubscriptionProviderImpl implements DataSubscriptionProvider {
3
+ private _paused;
4
+ private _subscriptions;
3
5
  subscribe(tag: string, component: Component): Promise<{
4
6
  unsubscribe: () => void;
5
7
  }>;
8
+ /** 플레이백 시작: 모든 구독을 실제 해제 */
9
+ pause(): void;
10
+ /** 플레이백 종료: 보관된 tag 로 재구독 */
11
+ resume(): Promise<void>;
6
12
  dispose(): void;
7
13
  }
@@ -1,8 +1,12 @@
1
1
  import gql from 'graphql-tag';
2
2
  import { subscribe } from '@operato/graphql';
3
3
  export class DataSubscriptionProviderImpl {
4
+ constructor() {
5
+ this._paused = false;
6
+ this._subscriptions = new Map();
7
+ }
4
8
  async subscribe(tag, component) {
5
- return await subscribe({
9
+ const sub = await subscribe({
6
10
  query: gql `
7
11
  subscription {
8
12
  data(tag: "${tag}") {
@@ -13,12 +17,41 @@ export class DataSubscriptionProviderImpl {
13
17
  `
14
18
  }, {
15
19
  next: async ({ data }) => {
16
- if (data) {
20
+ if (data && !this._paused) {
17
21
  component.data = data.data.data;
18
22
  }
19
23
  }
20
24
  });
25
+ this._subscriptions.set(component, { tag, unsubscribe: sub.unsubscribe });
26
+ return {
27
+ unsubscribe: () => {
28
+ sub.unsubscribe();
29
+ this._subscriptions.delete(component);
30
+ }
31
+ };
32
+ }
33
+ /** 플레이백 시작: 모든 구독을 실제 해제 */
34
+ pause() {
35
+ this._paused = true;
36
+ for (const [, { unsubscribe }] of this._subscriptions) {
37
+ try {
38
+ unsubscribe();
39
+ }
40
+ catch (_a) { }
41
+ }
42
+ }
43
+ /** 플레이백 종료: 보관된 tag 로 재구독 */
44
+ async resume() {
45
+ const entries = [...this._subscriptions.entries()];
46
+ this._subscriptions.clear();
47
+ this._paused = false;
48
+ for (const [component, { tag }] of entries) {
49
+ await this.subscribe(tag, component);
50
+ }
51
+ }
52
+ dispose() {
53
+ this.pause();
54
+ this._subscriptions.clear();
21
55
  }
22
- dispose() { }
23
56
  }
24
57
  //# sourceMappingURL=data-subscription.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-subscription.js","sourceRoot":"","sources":["../../../src/graphql/data-subscription.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,MAAM,OAAO,4BAA4B;IACvC,KAAK,CAAC,SAAS,CAAC,GAAW,EAAE,SAAoB;QAC/C,OAAO,MAAM,SAAS,CACpB;YACE,KAAK,EAAE,GAAG,CAAA;;iCAEe,GAAG;;;;;iBAKnB;SACV,EACD;YACE,IAAI,EAAE,KAAK,EAAE,EAAE,IAAI,EAAiB,EAAE,EAAE;gBACtC,IAAI,IAAI,EAAE,CAAC;oBACT,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;gBACjC,CAAC;YACH,CAAC;SACF,CACF,CAAA;IACH,CAAC;IAED,OAAO,KAAI,CAAC;CACb","sourcesContent":["import { Component, DataSubscriptionProvider } from '@hatiolab/things-scene'\n\nimport gql from 'graphql-tag'\nimport { subscribe } from '@operato/graphql'\n\nexport class DataSubscriptionProviderImpl implements DataSubscriptionProvider {\n async subscribe(tag: string, component: Component): Promise<{ unsubscribe: () => void }> {\n return await subscribe(\n {\n query: gql`\n subscription {\n data(tag: \"${tag}\") {\n tag\n data\n }\n }\n `\n },\n {\n next: async ({ data }: { data: any }) => {\n if (data) {\n component.data = data.data.data\n }\n }\n }\n )\n }\n\n dispose() {}\n}\n"]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,CAAC;IAED,6BAA6B;IAC7B,KAAK,CAAC,MAAM;QACV,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAA;QAClD,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QAEpB,KAAK,MAAM,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;IAC7B,CAAC;CACF","sourcesContent":["import { Component, DataSubscriptionProvider } from '@hatiolab/things-scene'\n\nimport gql from 'graphql-tag'\nimport { subscribe } from '@operato/graphql'\n\nexport class DataSubscriptionProviderImpl implements DataSubscriptionProvider {\n private _paused = false\n private _subscriptions: Map<Component, { tag: string; unsubscribe: () => void }> = new Map()\n\n async subscribe(tag: string, component: Component): Promise<{ unsubscribe: () => void }> {\n const sub = await subscribe(\n {\n query: gql`\n subscription {\n data(tag: \"${tag}\") {\n tag\n data\n }\n }\n `\n },\n {\n next: async ({ data }: { data: any }) => {\n if (data && !this._paused) {\n component.data = data.data.data\n }\n }\n }\n )\n\n this._subscriptions.set(component, { tag, unsubscribe: sub.unsubscribe })\n\n return {\n unsubscribe: () => {\n sub.unsubscribe()\n this._subscriptions.delete(component)\n }\n }\n }\n\n /** 플레이백 시작: 모든 구독을 실제 해제 */\n pause() {\n this._paused = true\n for (const [, { unsubscribe }] of this._subscriptions) {\n try { unsubscribe() } catch {}\n }\n }\n\n /** 플레이백 종료: 보관된 tag 로 재구독 */\n async resume() {\n const entries = [...this._subscriptions.entries()]\n this._subscriptions.clear()\n this._paused = false\n\n for (const [component, { tag }] of entries) {\n await this.subscribe(tag, component)\n }\n }\n\n dispose() {\n this.pause()\n this._subscriptions.clear()\n }\n}\n"]}
@@ -4,3 +4,4 @@ export * from './favorite-board';
4
4
  export * from './group';
5
5
  export * from './scenario';
6
6
  export * from './theme';
7
+ export * from './playback';
@@ -4,4 +4,5 @@ export * from './favorite-board';
4
4
  export * from './group';
5
5
  export * from './scenario';
6
6
  export * from './theme';
7
+ export * from './playback';
7
8
  //# sourceMappingURL=index.js.map