@fmsim/api 2.0.0-beta.7 → 2.0.0-beta.75
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/custom-elements.json +392 -0
- package/dist/src/graphql/board.d.ts +3 -1
- package/dist/src/graphql/board.js +31 -3
- package/dist/src/graphql/board.js.map +1 -1
- package/dist/src/graphql/data-subscription.d.ts +6 -0
- package/dist/src/graphql/data-subscription.js +36 -3
- package/dist/src/graphql/data-subscription.js.map +1 -1
- package/dist/src/graphql/index.d.ts +1 -0
- package/dist/src/graphql/index.js +1 -0
- package/dist/src/graphql/index.js.map +1 -1
- package/dist/src/graphql/playback.d.ts +17 -0
- package/dist/src/graphql/playback.js +44 -0
- package/dist/src/graphql/playback.js.map +1 -0
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.js +29 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/restful/board.d.ts +3 -1
- package/dist/src/restful/board.js +12 -2
- package/dist/src/restful/board.js.map +1 -1
- package/dist/src/restful/index.d.ts +1 -0
- package/dist/src/restful/index.js +1 -0
- package/dist/src/restful/index.js.map +1 -1
- package/dist/src/restful/playback.d.ts +25 -0
- package/dist/src/restful/playback.js +50 -0
- package/dist/src/restful/playback.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA","sourcesContent":["export * from './board'\nexport * from './data-subscription'\nexport * from './favorite-board'\nexport * from './group'\nexport * from './scenario'\nexport * from './theme'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA","sourcesContent":["export * from './board'\nexport * from './data-subscription'\nexport * from './favorite-board'\nexport * from './group'\nexport * from './scenario'\nexport * from './theme'\nexport * from './playback'\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface PlaybackFrame {
|
|
2
|
+
type: 'snapshot' | 'diff';
|
|
3
|
+
time: string;
|
|
4
|
+
data: any[];
|
|
5
|
+
}
|
|
6
|
+
export interface PlaybackScenario {
|
|
7
|
+
scenarioName: string;
|
|
8
|
+
snapshots: PlaybackFrame[];
|
|
9
|
+
}
|
|
10
|
+
export interface PlaybackResult {
|
|
11
|
+
status: boolean;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
playback?: {
|
|
14
|
+
scenarios: PlaybackScenario[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function fetchPlayback(startTime: string, endTime?: string, includeSnapshot?: boolean, count?: number): Promise<PlaybackResult>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import gql from 'graphql-tag';
|
|
2
|
+
import { client } from '@operato/graphql';
|
|
3
|
+
export async function fetchPlayback(startTime, endTime, includeSnapshot = true, count) {
|
|
4
|
+
var _a;
|
|
5
|
+
const { data } = await client.query({
|
|
6
|
+
query: gql `
|
|
7
|
+
query ($startTime: String!, $endTime: String, $count: Int, $includeSnapshot: Boolean) {
|
|
8
|
+
playback(startTime: $startTime, endTime: $endTime, count: $count, includeSnapshot: $includeSnapshot) {
|
|
9
|
+
status
|
|
10
|
+
errorMessage
|
|
11
|
+
playback {
|
|
12
|
+
scenarios {
|
|
13
|
+
scenarioName
|
|
14
|
+
snapshots {
|
|
15
|
+
type
|
|
16
|
+
time
|
|
17
|
+
data
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`,
|
|
24
|
+
variables: { startTime, endTime, count, includeSnapshot }
|
|
25
|
+
});
|
|
26
|
+
const result = data.playback;
|
|
27
|
+
// data가 JSON string으로 전달되므로 파싱
|
|
28
|
+
if ((_a = result === null || result === void 0 ? void 0 : result.playback) === null || _a === void 0 ? void 0 : _a.scenarios) {
|
|
29
|
+
for (const scenario of result.playback.scenarios) {
|
|
30
|
+
for (const frame of scenario.snapshots) {
|
|
31
|
+
if (typeof frame.data === 'string') {
|
|
32
|
+
try {
|
|
33
|
+
frame.data = JSON.parse(frame.data);
|
|
34
|
+
}
|
|
35
|
+
catch (_b) {
|
|
36
|
+
frame.data = [];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=playback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback.js","sourceRoot":"","sources":["../../../src/graphql/playback.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAqBzC,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,SAAiB,EACjB,OAAgB,EAChB,kBAA2B,IAAI,EAC/B,KAAc;;IAEd,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;KAiBT;QACD,SAAS,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE;KAC1D,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,IAAI,CAAC,QAA0B,CAAA;IAE9C,+BAA+B;IAC/B,IAAI,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,0CAAE,SAAS,EAAE,CAAC;QAChC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACjD,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;gBACvC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACnC,IAAI,CAAC;wBAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;oBAAC,CAAC;oBAAC,WAAM,CAAC;wBAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAA;oBAAC,CAAC;gBACvE,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import gql from 'graphql-tag'\nimport { client } from '@operato/graphql'\n\nexport interface PlaybackFrame {\n type: 'snapshot' | 'diff'\n time: string\n data: any[]\n}\n\nexport interface PlaybackScenario {\n scenarioName: string\n snapshots: PlaybackFrame[]\n}\n\nexport interface PlaybackResult {\n status: boolean\n errorMessage?: string\n playback?: {\n scenarios: PlaybackScenario[]\n }\n}\n\nexport async function fetchPlayback(\n startTime: string,\n endTime?: string,\n includeSnapshot: boolean = true,\n count?: number\n): Promise<PlaybackResult> {\n const { data } = await client.query({\n query: gql`\n query ($startTime: String!, $endTime: String, $count: Int, $includeSnapshot: Boolean) {\n playback(startTime: $startTime, endTime: $endTime, count: $count, includeSnapshot: $includeSnapshot) {\n status\n errorMessage\n playback {\n scenarios {\n scenarioName\n snapshots {\n type\n time\n data\n }\n }\n }\n }\n }\n `,\n variables: { startTime, endTime, count, includeSnapshot }\n })\n\n const result = data.playback as PlaybackResult\n\n // data가 JSON string으로 전달되므로 파싱\n if (result?.playback?.scenarios) {\n for (const scenario of result.playback.scenarios) {\n for (const frame of scenario.snapshots) {\n if (typeof frame.data === 'string') {\n try { frame.data = JSON.parse(frame.data) } catch { frame.data = [] }\n }\n }\n }\n }\n\n return result\n}\n"]}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,7 +3,10 @@ import { Board } from './types';
|
|
|
3
3
|
export declare function isRestfulAvailable(): string | null;
|
|
4
4
|
export declare function fetchGroupList(): Promise<any>;
|
|
5
5
|
export declare function fetchBoardList(listParam?: any): Promise<any>;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function reorderBoard(id: string, prevId?: string, nextId?: string): Promise<any>;
|
|
7
|
+
export declare function fetchPlayback(startTime: string, endTime?: string, includeSnapshot?: boolean, count?: number): Promise<import("./graphql").PlaybackResult>;
|
|
8
|
+
export declare function fetchBoardById(id: string, cachedUpdatedAt?: string): Promise<any>;
|
|
9
|
+
export declare function fetchBoardNameById(id: string): Promise<string>;
|
|
7
10
|
export declare function createBoard(board: Board): Promise<any>;
|
|
8
11
|
export declare function themesColorMap(): Promise<string[]>;
|
|
9
12
|
export declare function themesColorRange(): Promise<string[]>;
|
package/dist/src/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './graphql';
|
|
2
2
|
import { themesColorMap as graphqlThemesColorMap, themesColorRange as graphqlThemesColorRange, themesAnimationMap as graphqlThemesAnimationMap } from './graphql';
|
|
3
3
|
import { getPopupData as restfulGetPopupData, themesColorMap as restfulThemesColorMap, themesColorRange as restfulThemesColorRange, themesAnimationMap as restfulThemesAnimationMap } from './restful';
|
|
4
|
-
import { fetchGroupList as restfulFetchGroupList, fetchBoardList as restfulFetchBoardList, createBoard as restfulCreateBoard, fetchBoardById as restfulFetchBoardById } from './restful';
|
|
5
|
-
import { fetchGroupList as graphqlFetchGroupList, fetchBoardList as graphqlFetchBoardList, createBoard as graphqlCreateBoard, fetchBoardById as graphqlFetchBoardById } from './graphql';
|
|
4
|
+
import { fetchGroupList as restfulFetchGroupList, fetchBoardList as restfulFetchBoardList, createBoard as restfulCreateBoard, fetchBoardById as restfulFetchBoardById, fetchBoardNameById as restfulFetchBoardNameById, reorderBoard as restfulReorderBoard, fetchPlayback as restfulFetchPlayback } from './restful';
|
|
5
|
+
import { fetchGroupList as graphqlFetchGroupList, fetchBoardList as graphqlFetchBoardList, createBoard as graphqlCreateBoard, fetchBoardById as graphqlFetchBoardById, fetchBoardNameById as graphqlFetchBoardNameById, reorderBoard as graphqlReorderBoard, fetchPlayback as graphqlFetchPlayback } from './graphql';
|
|
6
6
|
export function isRestfulAvailable() {
|
|
7
7
|
return sessionStorage.getItem('lv_server_ip_port');
|
|
8
8
|
}
|
|
@@ -22,12 +22,36 @@ export async function fetchBoardList(listParam = {}) {
|
|
|
22
22
|
return await graphqlFetchBoardList(listParam);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
export async function
|
|
25
|
+
export async function reorderBoard(id, prevId, nextId) {
|
|
26
26
|
if (isRestfulAvailable()) {
|
|
27
|
-
return await
|
|
27
|
+
return await restfulReorderBoard(id, prevId, nextId);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
return await
|
|
30
|
+
return await graphqlReorderBoard(id, prevId, nextId);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export async function fetchPlayback(startTime, endTime, includeSnapshot = true, count) {
|
|
34
|
+
if (isRestfulAvailable()) {
|
|
35
|
+
return await restfulFetchPlayback(startTime, endTime, includeSnapshot, count);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return await graphqlFetchPlayback(startTime, endTime, includeSnapshot, count);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function fetchBoardById(id, cachedUpdatedAt) {
|
|
42
|
+
if (isRestfulAvailable()) {
|
|
43
|
+
return await restfulFetchBoardById(id, cachedUpdatedAt);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return await graphqlFetchBoardById(id, cachedUpdatedAt);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export async function fetchBoardNameById(id) {
|
|
50
|
+
if (isRestfulAvailable()) {
|
|
51
|
+
return await restfulFetchBoardNameById(id);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return await graphqlFetchBoardNameById(id);
|
|
31
55
|
}
|
|
32
56
|
}
|
|
33
57
|
export async function createBoard(board) {
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AAEzB,OAAO,EACL,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,IAAI,uBAAuB,EAC3C,kBAAkB,IAAI,yBAAyB,EAChD,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,IAAI,uBAAuB,EAC3C,kBAAkB,IAAI,yBAAyB,EAChD,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,cAAc,IAAI,qBAAqB,EACvC,cAAc,IAAI,qBAAqB,EACvC,WAAW,IAAI,kBAAkB,EACjC,cAAc,IAAI,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AAEzB,OAAO,EACL,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,IAAI,uBAAuB,EAC3C,kBAAkB,IAAI,yBAAyB,EAChD,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,IAAI,uBAAuB,EAC3C,kBAAkB,IAAI,yBAAyB,EAChD,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,cAAc,IAAI,qBAAqB,EACvC,cAAc,IAAI,qBAAqB,EACvC,WAAW,IAAI,kBAAkB,EACjC,cAAc,IAAI,qBAAqB,EACvC,kBAAkB,IAAI,yBAAyB,EAC/C,YAAY,IAAI,mBAAmB,EACnC,aAAa,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AAC;QACzB,OAAO,MAAM,uBAAuB,EAAE,CAAA;IACxC,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,uBAAuB,EAAE,CAAA;IACxC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,IAAI,kBAAkB,EAAE,EAAE,CAAC;QACzB,OAAO,MAAM,yBAAyB,EAAE,CAAA;IAC1C,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,yBAAyB,EAAE,CAAA;IAC1C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,EAAU;;IACzD,IAAI,kBAAkB,EAAE,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,MAAA,CAAC,MAAM,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,0CAAE,IAAI,CAAA;QAE5D,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAClC,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,KAAK,EAAE,OAAO;oBACd,OAAO,EAAE,sBAAsB;iBAChC;aACF,CAAC,CACH,CAAA;YACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;QAED,OAAO,QAAQ,CAAC,SAAS,CAAA;IAC3B,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;IACzD,CAAC;AACH,CAAC","sourcesContent":["export * from './graphql'\n\nimport {\n themesColorMap as graphqlThemesColorMap,\n themesColorRange as graphqlThemesColorRange,\n themesAnimationMap as graphqlThemesAnimationMap\n} from './graphql'\n\nimport {\n getPopupData as restfulGetPopupData,\n themesColorMap as restfulThemesColorMap,\n themesColorRange as restfulThemesColorRange,\n themesAnimationMap as restfulThemesAnimationMap\n} from './restful'\n\nimport {\n fetchGroupList as restfulFetchGroupList,\n fetchBoardList as restfulFetchBoardList,\n createBoard as restfulCreateBoard,\n fetchBoardById as restfulFetchBoardById,\n fetchBoardNameById as restfulFetchBoardNameById,\n reorderBoard as restfulReorderBoard,\n fetchPlayback as restfulFetchPlayback\n} from './restful'\n\nimport {\n fetchGroupList as graphqlFetchGroupList,\n fetchBoardList as graphqlFetchBoardList,\n createBoard as graphqlCreateBoard,\n fetchBoardById as graphqlFetchBoardById,\n fetchBoardNameById as graphqlFetchBoardNameById,\n reorderBoard as graphqlReorderBoard,\n fetchPlayback as graphqlFetchPlayback\n} from './graphql'\n\nimport { Board } from './types'\n\nexport function isRestfulAvailable() {\n return sessionStorage.getItem('lv_server_ip_port')\n}\n\nexport async function fetchGroupList() {\n if (isRestfulAvailable()) {\n return await restfulFetchGroupList()\n } else {\n return await graphqlFetchGroupList()\n }\n}\n\nexport async function fetchBoardList(listParam: any = {}) {\n if (isRestfulAvailable()) {\n return await restfulFetchBoardList(listParam)\n } else {\n return await graphqlFetchBoardList(listParam)\n }\n}\n\nexport async function reorderBoard(id: string, prevId?: string, nextId?: string) {\n if (isRestfulAvailable()) {\n return await restfulReorderBoard(id, prevId, nextId)\n } else {\n return await graphqlReorderBoard(id, prevId, nextId)\n }\n}\n\nexport async function fetchPlayback(\n startTime: string,\n endTime?: string,\n includeSnapshot: boolean = true,\n count?: number\n) {\n if (isRestfulAvailable()) {\n return await restfulFetchPlayback(startTime, endTime, includeSnapshot, count)\n } else {\n return await graphqlFetchPlayback(startTime, endTime, includeSnapshot, count)\n }\n}\n\nexport async function fetchBoardById(id: string, cachedUpdatedAt?: string) {\n if (isRestfulAvailable()) {\n return await restfulFetchBoardById(id, cachedUpdatedAt)\n } else {\n return await graphqlFetchBoardById(id, cachedUpdatedAt)\n }\n}\n\nexport async function fetchBoardNameById(id: string): Promise<string> {\n if (isRestfulAvailable()) {\n return await restfulFetchBoardNameById(id)\n } else {\n return await graphqlFetchBoardNameById(id)\n }\n}\n\nexport async function createBoard(board: Board) {\n if (isRestfulAvailable()) {\n return await restfulCreateBoard(board)\n } else {\n return await graphqlCreateBoard(board)\n }\n}\n\nexport async function themesColorMap() {\n if (isRestfulAvailable()) {\n return await restfulThemesColorMap()\n } else {\n return await graphqlThemesColorMap()\n }\n}\n\nexport async function themesColorRange() {\n if (isRestfulAvailable()) {\n return await restfulThemesColorRange()\n } else {\n return await graphqlThemesColorRange()\n }\n}\n\nexport async function themesAnimationMap() {\n if (isRestfulAvailable()) {\n return await restfulThemesAnimationMap()\n } else {\n return await graphqlThemesAnimationMap()\n }\n}\n\nexport async function getPopupData(type: string, id: string) {\n if (isRestfulAvailable()) {\n const response = (await restfulGetPopupData(type, id))?.data\n\n if (!response || !response.status) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: 'Error : getPopupData'\n }\n })\n )\n throw new Error('Error : getPopupData')\n }\n\n return response.popupData\n } else {\n await new Promise(resolve => setTimeout(resolve, 1000))\n }\n}\n"]}
|
|
@@ -3,6 +3,8 @@ export declare function fetchBoardList(listParam?: any): Promise<import("./commo
|
|
|
3
3
|
export declare function getBoardByUseMcsAutoConfigAndId(id: string): Promise<import("./common").RestfulReturnType | undefined>;
|
|
4
4
|
export declare function createBoard(board: Board): Promise<import("./common").RestfulReturnType | undefined>;
|
|
5
5
|
export declare function deleteBoard(id: string): Promise<import("./common").RestfulReturnType | undefined>;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function fetchBoardNameById(id: string): Promise<string>;
|
|
7
|
+
export declare function reorderBoard(id: string, prevId?: string, nextId?: string): Promise<import("./common").RestfulReturnType | undefined>;
|
|
8
|
+
export declare function fetchBoardById(id: string, cachedUpdatedAt?: string): Promise<import("./common").RestfulReturnType | undefined>;
|
|
7
9
|
export declare function fetchBoardInfoById(id: string): Promise<import("./common").RestfulReturnType | undefined>;
|
|
8
10
|
export declare function updateBoard(board: any, from?: string): Promise<import("./common").RestfulReturnType | undefined>;
|
|
@@ -12,8 +12,18 @@ export function createBoard(board) {
|
|
|
12
12
|
export function deleteBoard(id) {
|
|
13
13
|
return callApi(getRestServiceFullPath() + '/deleteBoard/' + id, 'delete', null, null);
|
|
14
14
|
}
|
|
15
|
-
export function
|
|
16
|
-
|
|
15
|
+
export async function fetchBoardNameById(id) {
|
|
16
|
+
var _a;
|
|
17
|
+
const data = await callApi(getRestServiceFullPath() + '/fetchBoardById/' + id, 'get', null, null);
|
|
18
|
+
return ((_a = data === null || data === void 0 ? void 0 : data.board) === null || _a === void 0 ? void 0 : _a.name) || id;
|
|
19
|
+
}
|
|
20
|
+
export async function reorderBoard(id, prevId, nextId) {
|
|
21
|
+
return callApi(getRestServiceFullPath() + '/reorderBoard', 'post', null, { id, prevId, nextId });
|
|
22
|
+
}
|
|
23
|
+
export function fetchBoardById(id, cachedUpdatedAt) {
|
|
24
|
+
const url = getRestServiceFullPath() + '/fetchBoardById/' + id
|
|
25
|
+
+ (cachedUpdatedAt ? `?cachedUpdatedAt=${encodeURIComponent(cachedUpdatedAt)}` : '');
|
|
26
|
+
return callApi(url, 'get', null, null);
|
|
17
27
|
}
|
|
18
28
|
export async function fetchBoardInfoById(id) {
|
|
19
29
|
/* TODO implement me */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board.js","sourceRoot":"","sources":["../../../src/restful/board.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE1D,MAAM,UAAU,cAAc,CAAC,YAAiB,EAAE;IAChD,OAAO,OAAO,CAAC,sBAAsB,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AACvF,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,EAAU;IACxD,OAAO,OAAO,CAAC,sBAAsB,EAAE,GAAG,mCAAmC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,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,CAAC;IACD,OAAO,OAAO,CAAC,sBAAsB,EAAE,GAAG,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;AAC/E,CAAC","sourcesContent":["import { Board } from '../types'\nimport { callApi, getRestServiceFullPath } from './common'\n\nexport function fetchBoardList(listParam: any = {}) {\n return callApi(getRestServiceFullPath() + '/fetchBoardList', 'post', null, listParam)\n}\n\nexport function getBoardByUseMcsAutoConfigAndId(id: string) {\n return callApi(getRestServiceFullPath() + '/getBoardByUseMcsAutoConfigAndId/' + id, 'get', null, null)\n}\n\nexport function createBoard(board: Board) {\n board.model = JSON.stringify(board.model)\n return callApi(getRestServiceFullPath() + '/createBoard', 'post', null, board)\n}\n\nexport function deleteBoard(id: string) {\n return callApi(getRestServiceFullPath() + '/deleteBoard/' + id, 'delete', null, null)\n}\n\nexport async function fetchBoardNameById(id: string): Promise<string> {\n const data: any = await callApi(getRestServiceFullPath() + '/fetchBoardById/' + id, 'get', null, null)\n return data?.board?.name || id\n}\n\nexport async function reorderBoard(id: string, prevId?: string, nextId?: string) {\n return callApi(getRestServiceFullPath() + '/reorderBoard', 'post', null, { id, prevId, nextId })\n}\n\nexport function fetchBoardById(id: string, cachedUpdatedAt?: string) {\n const url = getRestServiceFullPath() + '/fetchBoardById/' + id\n + (cachedUpdatedAt ? `?cachedUpdatedAt=${encodeURIComponent(cachedUpdatedAt)}` : '')\n return callApi(url, 'get', null, null)\n}\n\nexport async function fetchBoardInfoById(id: string) {\n /* TODO implement me */\n return callApi(getRestServiceFullPath() + '/fetchBoardInfoById/' + id, 'get', null, null)\n}\n\nexport function updateBoard(board: any, from?: string) {\n if (!from) {\n board.model = JSON.stringify(board.model)\n }\n return callApi(getRestServiceFullPath() + '/updateBoard', 'put', null, board)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/restful/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA","sourcesContent":["export * from './board'\nexport * from './authHeader'\nexport * from './favorite-board'\nexport * from './group'\nexport * from './font'\nexport * from './attachment'\nexport * from './connection'\nexport * from './scenario'\nexport * from './common'\nexport * from './machine'\nexport * from './theme'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/restful/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA","sourcesContent":["export * from './board'\nexport * from './authHeader'\nexport * from './favorite-board'\nexport * from './group'\nexport * from './font'\nexport * from './attachment'\nexport * from './connection'\nexport * from './scenario'\nexport * from './common'\nexport * from './machine'\nexport * from './theme'\nexport * from './playback'\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PlaybackResult } from '../graphql/playback';
|
|
2
|
+
export interface PlaybackParams {
|
|
3
|
+
/** 시작 시점 "YYYY-MM-DD HH:mm:ss" */
|
|
4
|
+
startTime: string;
|
|
5
|
+
/** 종료 시점 (범위 조회) */
|
|
6
|
+
endTime?: string;
|
|
7
|
+
/** 시작 시점부터 조회할 프레임 수 (개수 조회) */
|
|
8
|
+
count?: number;
|
|
9
|
+
/** 시작 시점의 전체 상태(snapshot) 포함 여부 */
|
|
10
|
+
includeSnapshot?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* RESTful 플레이백 데이터 조회 — 명세에 따라 URL 이 2가지로 분리됨.
|
|
14
|
+
*
|
|
15
|
+
* v1 범위 조회:
|
|
16
|
+
* GET /mcs/lv/playback?startTime=...&endTime=...&includeSnapshot=...
|
|
17
|
+
*
|
|
18
|
+
* v2 개수 조회:
|
|
19
|
+
* GET /mcs/lv/playback/count?startTime=...&count=...&includeSnapshot=...
|
|
20
|
+
*
|
|
21
|
+
* endTime 이 주어지면 v1, count 가 주어지면 v2 로 라우팅.
|
|
22
|
+
* 둘 다 주어지면 endTime 우선 (범위 우선 원칙).
|
|
23
|
+
* 둘 다 없으면 파라미터 에러지만 서버가 처리.
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchPlayback(startTime: string, endTime?: string, includeSnapshot?: boolean, count?: number): Promise<PlaybackResult>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { callApi } from './common';
|
|
2
|
+
import { getRestServiceFullPath } from './common';
|
|
3
|
+
/**
|
|
4
|
+
* RESTful 플레이백 데이터 조회 — 명세에 따라 URL 이 2가지로 분리됨.
|
|
5
|
+
*
|
|
6
|
+
* v1 범위 조회:
|
|
7
|
+
* GET /mcs/lv/playback?startTime=...&endTime=...&includeSnapshot=...
|
|
8
|
+
*
|
|
9
|
+
* v2 개수 조회:
|
|
10
|
+
* GET /mcs/lv/playback/count?startTime=...&count=...&includeSnapshot=...
|
|
11
|
+
*
|
|
12
|
+
* endTime 이 주어지면 v1, count 가 주어지면 v2 로 라우팅.
|
|
13
|
+
* 둘 다 주어지면 endTime 우선 (범위 우선 원칙).
|
|
14
|
+
* 둘 다 없으면 파라미터 에러지만 서버가 처리.
|
|
15
|
+
*/
|
|
16
|
+
export async function fetchPlayback(startTime, endTime, includeSnapshot = true, count) {
|
|
17
|
+
var _a;
|
|
18
|
+
const query = new URLSearchParams();
|
|
19
|
+
query.set('startTime', startTime);
|
|
20
|
+
const useCount = !endTime && count != null;
|
|
21
|
+
const pathSuffix = useCount ? '/playback/count' : '/playback';
|
|
22
|
+
if (useCount) {
|
|
23
|
+
query.set('count', String(count));
|
|
24
|
+
}
|
|
25
|
+
else if (endTime) {
|
|
26
|
+
query.set('endTime', endTime);
|
|
27
|
+
}
|
|
28
|
+
if (includeSnapshot != null)
|
|
29
|
+
query.set('includeSnapshot', String(includeSnapshot));
|
|
30
|
+
const url = getRestServiceFullPath() + pathSuffix + '?' + query.toString();
|
|
31
|
+
const response = await callApi(url, 'get', null, null);
|
|
32
|
+
const result = ((response === null || response === void 0 ? void 0 : response.data) || { status: false });
|
|
33
|
+
// data가 JSON string으로 전달되면 파싱 (서버 호환)
|
|
34
|
+
if ((_a = result === null || result === void 0 ? void 0 : result.playback) === null || _a === void 0 ? void 0 : _a.scenarios) {
|
|
35
|
+
for (const scenario of result.playback.scenarios) {
|
|
36
|
+
for (const frame of scenario.snapshots) {
|
|
37
|
+
if (typeof frame.data === 'string') {
|
|
38
|
+
try {
|
|
39
|
+
frame.data = JSON.parse(frame.data);
|
|
40
|
+
}
|
|
41
|
+
catch (_b) {
|
|
42
|
+
frame.data = [];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=playback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback.js","sourceRoot":"","sources":["../../../src/restful/playback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAcjD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,SAAiB,EACjB,OAAgB,EAChB,kBAA2B,IAAI,EAC/B,KAAc;;IAEd,MA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,IAAI,CAAC;wBAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;oBAAC,CAAC;oBAAC,WAAM,CAAC;wBAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAA;oBAAC,CAAC;gBACvE,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { callApi } from './common'\nimport { getRestServiceFullPath } from './common'\nimport type { PlaybackResult } from '../graphql/playback'\n\nexport interface PlaybackParams {\n /** 시작 시점 \"YYYY-MM-DD HH:mm:ss\" */\n startTime: string\n /** 종료 시점 (범위 조회) */\n endTime?: string\n /** 시작 시점부터 조회할 프레임 수 (개수 조회) */\n count?: number\n /** 시작 시점의 전체 상태(snapshot) 포함 여부 */\n includeSnapshot?: boolean\n}\n\n/**\n * RESTful 플레이백 데이터 조회 — 명세에 따라 URL 이 2가지로 분리됨.\n *\n * v1 범위 조회:\n * GET /mcs/lv/playback?startTime=...&endTime=...&includeSnapshot=...\n *\n * v2 개수 조회:\n * GET /mcs/lv/playback/count?startTime=...&count=...&includeSnapshot=...\n *\n * endTime 이 주어지면 v1, count 가 주어지면 v2 로 라우팅.\n * 둘 다 주어지면 endTime 우선 (범위 우선 원칙).\n * 둘 다 없으면 파라미터 에러지만 서버가 처리.\n */\nexport async function fetchPlayback(\n startTime: string,\n endTime?: string,\n includeSnapshot: boolean = true,\n count?: number\n): Promise<PlaybackResult> {\n const query = new URLSearchParams()\n query.set('startTime', startTime)\n\n const useCount = !endTime && count != null\n const pathSuffix = useCount ? '/playback/count' : '/playback'\n\n if (useCount) {\n query.set('count', String(count))\n } else if (endTime) {\n query.set('endTime', endTime)\n }\n if (includeSnapshot != null) query.set('includeSnapshot', String(includeSnapshot))\n\n const url = getRestServiceFullPath() + pathSuffix + '?' + query.toString()\n const response = await callApi(url, 'get', null, null)\n\n const result = (response?.data || { status: false }) as PlaybackResult\n\n // data가 JSON string으로 전달되면 파싱 (서버 호환)\n if (result?.playback?.scenarios) {\n for (const scenario of result.playback.scenarios) {\n for (const frame of scenario.snapshots) {\n if (typeof frame.data === 'string') {\n try { frame.data = JSON.parse(frame.data) } catch { frame.data = [] }\n }\n }\n }\n }\n\n return result\n}\n"]}
|