@operato/scene-graphql 0.1.3

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 (62) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +59 -0
  4. package/dist/graphql-client.d.ts +29 -0
  5. package/dist/graphql-client.js +143 -0
  6. package/dist/graphql-client.js.map +1 -0
  7. package/dist/graphql-query-and-mutation.d.ts +68 -0
  8. package/dist/graphql-query-and-mutation.js +197 -0
  9. package/dist/graphql-query-and-mutation.js.map +1 -0
  10. package/dist/graphql-subscription.d.ts +28 -0
  11. package/dist/graphql-subscription.js +90 -0
  12. package/dist/graphql-subscription.js.map +1 -0
  13. package/dist/index.d.ts +5 -0
  14. package/dist/index.js +5 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/templates/graphql-client.d.ts +17 -0
  17. package/dist/templates/graphql-client.js +19 -0
  18. package/dist/templates/graphql-client.js.map +1 -0
  19. package/dist/templates/graphql-mutation.d.ts +17 -0
  20. package/dist/templates/graphql-mutation.js +23 -0
  21. package/dist/templates/graphql-mutation.js.map +1 -0
  22. package/dist/templates/graphql-query.d.ts +17 -0
  23. package/dist/templates/graphql-query.js +31 -0
  24. package/dist/templates/graphql-query.js.map +1 -0
  25. package/dist/templates/graphql-subscription.d.ts +18 -0
  26. package/dist/templates/graphql-subscription.js +26 -0
  27. package/dist/templates/graphql-subscription.js.map +1 -0
  28. package/dist/templates/index.d.ts +48 -0
  29. package/dist/templates/index.js +6 -0
  30. package/dist/templates/index.js.map +1 -0
  31. package/helps/scene/component/graphql-subscription.ko.md +19 -0
  32. package/helps/scene/component/graphql-subscription.md +19 -0
  33. package/helps/scene/component/graphql-subscription.zh.md +19 -0
  34. package/helps/scene/component/graphql.ko.md +35 -0
  35. package/helps/scene/component/graphql.md +35 -0
  36. package/helps/scene/component/graphql.zh.md +35 -0
  37. package/icons/icon-graphql-client.png +0 -0
  38. package/icons/icon-graphql-mutation.png +0 -0
  39. package/icons/icon-graphql-query-input.png +0 -0
  40. package/icons/icon-graphql-query.png +0 -0
  41. package/icons/icon-graphql-subscription.png +0 -0
  42. package/icons/no-image.png +0 -0
  43. package/icons/symbol-graphql-client.png +0 -0
  44. package/icons/symbol-graphql-mutation.png +0 -0
  45. package/icons/symbol-graphql-query.png +0 -0
  46. package/icons/symbol-graphql-subscription.png +0 -0
  47. package/package.json +65 -0
  48. package/src/graphql-client.ts +185 -0
  49. package/src/graphql-query-and-mutation.ts +233 -0
  50. package/src/graphql-subscription.ts +110 -0
  51. package/src/index.ts +5 -0
  52. package/src/templates/graphql-client.ts +19 -0
  53. package/src/templates/graphql-mutation.ts +23 -0
  54. package/src/templates/graphql-query.ts +31 -0
  55. package/src/templates/graphql-subscription.ts +26 -0
  56. package/src/templates/index.ts +6 -0
  57. package/things-scene.config.js +5 -0
  58. package/translations/en.json +7 -0
  59. package/translations/ko.json +7 -0
  60. package/translations/zh.json +7 -0
  61. package/tsconfig.json +22 -0
  62. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,90 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { SubscriptionClient } from 'subscriptions-transport-ws';
5
+ import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
6
+ const NATURE = {
7
+ mutable: false,
8
+ resizable: true,
9
+ rotatable: true,
10
+ properties: [
11
+ {
12
+ type: 'string',
13
+ label: 'endpoint',
14
+ name: 'endpoint'
15
+ },
16
+ {
17
+ type: 'graphql',
18
+ label: 'query',
19
+ name: 'query'
20
+ }
21
+ ],
22
+ help: 'scene/component/graphql-subscription'
23
+ };
24
+ export default class GraphqlSubscription extends DataSource(RectPath(Shape)) {
25
+ static get image() {
26
+ if (!GraphqlSubscription._image) {
27
+ GraphqlSubscription._image = new Image();
28
+ GraphqlSubscription._image.src = new URL('../icons/symbol-graphql-subscription.png', import.meta.url).href;
29
+ }
30
+ return GraphqlSubscription._image;
31
+ }
32
+ dispose() {
33
+ if (this.unsubscribe) {
34
+ this.unsubscribe();
35
+ }
36
+ if (this.client) {
37
+ this.client.unsubscribeAll();
38
+ this.client.close(true);
39
+ }
40
+ super.dispose();
41
+ }
42
+ render(context) {
43
+ var { left, top, width, height } = this.bounds;
44
+ context.beginPath();
45
+ this.drawImage(context, GraphqlSubscription.image, left, top, width, height);
46
+ }
47
+ ready() {
48
+ this._initGraphqlSubscription();
49
+ }
50
+ get nature() {
51
+ return NATURE;
52
+ }
53
+ _initGraphqlSubscription() {
54
+ if (!this.app.isViewMode)
55
+ return;
56
+ this.requestData();
57
+ }
58
+ async requestData() {
59
+ var { endpoint, query } = this.state;
60
+ var self = this;
61
+ this.client = new SubscriptionClient(endpoint, {
62
+ reconnect: true,
63
+ connectionParams: {
64
+ headers: {
65
+ /*
66
+ 특정 도메인의 데이타만 받고자 하는 경우에, referer 정보를 제공해서 서버에서 서브도메인 정보를 취득하도록 한다.
67
+ referer: location.href
68
+ 또는, 이미 서브도메인 정보를 알고 있다면,
69
+ 'x-things-factory-domain': '[subdomain]'
70
+ 을 보낼 수 있다.
71
+ 관련 정보를 보내지 않는다면, 사용자가 권한을 가진 모든 도메인의 데이타를 수신하게 된다.
72
+ */
73
+ referer: location.href
74
+ }
75
+ }
76
+ });
77
+ this.client.onConnected(() => {
78
+ const { unsubscribe } = this.client.request({ query }).subscribe({
79
+ next({ data }) {
80
+ if (data) {
81
+ self.data = data;
82
+ }
83
+ }
84
+ });
85
+ this.unsubscribe = unsubscribe;
86
+ });
87
+ }
88
+ }
89
+ Component.register('graphql-subscription', GraphqlSubscription);
90
+ //# sourceMappingURL=graphql-subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-subscription.js","sourceRoot":"","sources":["../src/graphql-subscription.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { SubscriptionClient } from 'subscriptions-transport-ws'\n\nimport { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'endpoint',\n name: 'endpoint'\n },\n {\n type: 'graphql',\n label: 'query',\n name: 'query'\n }\n ],\n help: 'scene/component/graphql-subscription'\n}\n\nexport default class GraphqlSubscription extends DataSource(RectPath(Shape)) {\n private static _image: HTMLImageElement\n private client?: SubscriptionClient\n private unsubscribe?: () => void\n\n static get image() {\n if (!GraphqlSubscription._image) {\n GraphqlSubscription._image = new Image()\n GraphqlSubscription._image.src = new URL('../icons/symbol-graphql-subscription.png', import.meta.url).href\n }\n\n return GraphqlSubscription._image\n }\n\n dispose() {\n if (this.unsubscribe) {\n this.unsubscribe()\n }\n if (this.client) {\n this.client.unsubscribeAll()\n this.client.close(true)\n }\n\n super.dispose()\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, GraphqlSubscription.image, left, top, width, height)\n }\n\n ready() {\n this._initGraphqlSubscription()\n }\n\n get nature() {\n return NATURE\n }\n\n _initGraphqlSubscription() {\n if (!this.app.isViewMode) return\n\n this.requestData()\n }\n\n async requestData() {\n var { endpoint, query } = this.state\n var self = this\n\n this.client = new SubscriptionClient(endpoint, {\n reconnect: true,\n connectionParams: {\n headers: {\n /* \n 특정 도메인의 데이타만 받고자 하는 경우에, referer 정보를 제공해서 서버에서 서브도메인 정보를 취득하도록 한다.\n referer: location.href\n 또는, 이미 서브도메인 정보를 알고 있다면,\n 'x-things-factory-domain': '[subdomain]'\n 을 보낼 수 있다.\n 관련 정보를 보내지 않는다면, 사용자가 권한을 가진 모든 도메인의 데이타를 수신하게 된다.\n */\n referer: location.href\n }\n }\n })\n\n this.client.onConnected(() => {\n const { unsubscribe } = this.client!.request({ query }).subscribe({\n next({ data }) {\n if (data) {\n self.data = data\n }\n }\n })\n\n this.unsubscribe = unsubscribe\n })\n }\n}\n\nComponent.register('graphql-subscription', GraphqlSubscription)\n"]}
@@ -0,0 +1,5 @@
1
+ import Client from './graphql-client';
2
+ import { Mutation, Query } from './graphql-query-and-mutation';
3
+ import Subscription from './graphql-subscription';
4
+ declare const _default: (typeof Client | typeof Query | typeof Mutation | typeof Subscription)[];
5
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import Client from './graphql-client';
2
+ import { Mutation, Query } from './graphql-query-and-mutation';
3
+ import Subscription from './graphql-subscription';
4
+ export default [Client, Query, Mutation, Subscription];
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,YAAY,MAAM,wBAAwB,CAAA;AAEjD,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA","sourcesContent":["import Client from './graphql-client'\nimport { Mutation, Query } from './graphql-query-and-mutation'\nimport Subscription from './graphql-subscription'\n\nexport default [Client, Query, Mutation, Subscription]\n"]}
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ type: string;
3
+ description: string;
4
+ group: string;
5
+ icon: string;
6
+ model: {
7
+ type: string;
8
+ left: number;
9
+ top: number;
10
+ width: number;
11
+ height: number;
12
+ fillStyle: string;
13
+ strokeStyle: string;
14
+ endpoint: string;
15
+ };
16
+ };
17
+ export default _default;
@@ -0,0 +1,19 @@
1
+ const icon = new URL('../../icons/icon-graphql-client.png', import.meta.url).href;
2
+ export default {
3
+ type: 'graphql-client',
4
+ description: 'graphql-client',
5
+ group: 'dataSource',
6
+ /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
7
+ icon,
8
+ model: {
9
+ type: 'graphql-client',
10
+ left: 10,
11
+ top: 10,
12
+ width: 100,
13
+ height: 100,
14
+ fillStyle: 'cyan',
15
+ strokeStyle: 'darkgray',
16
+ endpoint: '/'
17
+ }
18
+ };
19
+ //# sourceMappingURL=graphql-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-client.js","sourceRoot":"","sources":["../../src/templates/graphql-client.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,qCAAqC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEjF,eAAe;IACb,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE,YAAY;IACnB,gGAAgG;IAChG,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,MAAM;QACjB,WAAW,EAAE,UAAU;QACvB,QAAQ,EAAE,GAAG;KACd;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/icon-graphql-client.png', import.meta.url).href\n\nexport default {\n type: 'graphql-client',\n description: 'graphql-client',\n group: 'dataSource',\n /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */\n icon,\n model: {\n type: 'graphql-client',\n left: 10,\n top: 10,\n width: 100,\n height: 100,\n fillStyle: 'cyan',\n strokeStyle: 'darkgray',\n endpoint: '/'\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ type: string;
3
+ description: string;
4
+ group: string;
5
+ icon: string;
6
+ model: {
7
+ type: string;
8
+ left: number;
9
+ top: number;
10
+ width: number;
11
+ height: number;
12
+ autoStart: boolean;
13
+ period: number;
14
+ query: string;
15
+ };
16
+ };
17
+ export default _default;
@@ -0,0 +1,23 @@
1
+ const icon = new URL('../../icons/icon-graphql-mutation.png', import.meta.url).href;
2
+ export default {
3
+ type: 'graphql-mutation',
4
+ description: 'graphql-mutation',
5
+ group: 'dataSource',
6
+ /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
7
+ icon,
8
+ model: {
9
+ type: 'graphql-mutation',
10
+ left: 10,
11
+ top: 10,
12
+ width: 100,
13
+ height: 100,
14
+ autoStart: false,
15
+ period: 0,
16
+ query: `mutation {
17
+ resolverName ( patches:[] ) {
18
+ id
19
+ }
20
+ }`
21
+ }
22
+ };
23
+ //# sourceMappingURL=graphql-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-mutation.js","sourceRoot":"","sources":["../../src/templates/graphql-mutation.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,uCAAuC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEnF,eAAe;IACb,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,KAAK,EAAE,YAAY;IACnB,gGAAgG;IAChG,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;;;;EAIT;KACC;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/icon-graphql-mutation.png', import.meta.url).href\n\nexport default {\n type: 'graphql-mutation',\n description: 'graphql-mutation',\n group: 'dataSource',\n /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */\n icon,\n model: {\n type: 'graphql-mutation',\n left: 10,\n top: 10,\n width: 100,\n height: 100,\n autoStart: false,\n period: 0,\n query: `mutation {\n resolverName ( patches:[] ) {\n id\n }\n}`\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ type: string;
3
+ description: string;
4
+ group: string;
5
+ icon: string;
6
+ model: {
7
+ type: string;
8
+ left: number;
9
+ top: number;
10
+ width: number;
11
+ height: number;
12
+ autoStart: boolean;
13
+ period: number;
14
+ query: string;
15
+ };
16
+ };
17
+ export default _default;
@@ -0,0 +1,31 @@
1
+ const icon = new URL('../../icons/icon-graphql-query.png', import.meta.url).href;
2
+ export default {
3
+ type: 'graphql-query',
4
+ description: 'graphql-query',
5
+ group: 'dataSource',
6
+ /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
7
+ icon,
8
+ model: {
9
+ type: 'graphql-query',
10
+ left: 10,
11
+ top: 10,
12
+ width: 100,
13
+ height: 100,
14
+ autoStart: true,
15
+ period: 0,
16
+ query: `query {
17
+ boards {
18
+ items {
19
+ id
20
+ name
21
+ description
22
+ thumbnail
23
+ createdAt
24
+ updatedAt
25
+ }
26
+ total
27
+ }
28
+ }`
29
+ }
30
+ };
31
+ //# sourceMappingURL=graphql-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-query.js","sourceRoot":"","sources":["../../src/templates/graphql-query.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,oCAAoC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEhF,eAAe;IACb,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,KAAK,EAAE,YAAY;IACnB,gGAAgG;IAChG,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;;;;;;;;;;;;EAYT;KACC;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/icon-graphql-query.png', import.meta.url).href\n\nexport default {\n type: 'graphql-query',\n description: 'graphql-query',\n group: 'dataSource',\n /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */\n icon,\n model: {\n type: 'graphql-query',\n left: 10,\n top: 10,\n width: 100,\n height: 100,\n autoStart: true,\n period: 0,\n query: `query {\n boards {\n items {\n id\n name\n description\n thumbnail\n createdAt\n updatedAt\n }\n total\n }\n}`\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ declare const _default: {
2
+ type: string;
3
+ description: string;
4
+ group: string;
5
+ icon: string;
6
+ model: {
7
+ type: string;
8
+ left: number;
9
+ top: number;
10
+ width: number;
11
+ height: number;
12
+ lineWidth: number;
13
+ endpoint: string;
14
+ requestType: string;
15
+ query: string;
16
+ };
17
+ };
18
+ export default _default;
@@ -0,0 +1,26 @@
1
+ const icon = new URL('../../icons/icon-graphql-subscription.png', import.meta.url).href;
2
+ export default {
3
+ type: 'graphql-subscription',
4
+ description: 'graphql-subscription',
5
+ group: 'dataSource',
6
+ /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
7
+ icon,
8
+ model: {
9
+ type: 'graphql-subscription',
10
+ left: 10,
11
+ top: 10,
12
+ width: 100,
13
+ height: 100,
14
+ lineWidth: 1,
15
+ endpoint: 'ws://localhost:3000/subscriptions',
16
+ requestType: 'mutation',
17
+ query: `subscription {
18
+ systemRebooted {
19
+ name
20
+ version
21
+ description
22
+ }
23
+ }`
24
+ }
25
+ };
26
+ //# sourceMappingURL=graphql-subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-subscription.js","sourceRoot":"","sources":["../../src/templates/graphql-subscription.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,2CAA2C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEvF,eAAe;IACb,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,KAAK,EAAE,YAAY;IACnB,gGAAgG;IAChG,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,mCAAmC;QAC7C,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE;;;;;;EAMT;KACC;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/icon-graphql-subscription.png', import.meta.url).href\n\nexport default {\n type: 'graphql-subscription',\n description: 'graphql-subscription',\n group: 'dataSource',\n /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */\n icon,\n model: {\n type: 'graphql-subscription',\n left: 10,\n top: 10,\n width: 100,\n height: 100,\n lineWidth: 1,\n endpoint: 'ws://localhost:3000/subscriptions',\n requestType: 'mutation',\n query: `subscription {\n systemRebooted {\n name\n version\n description\n }\n}`\n }\n}\n"]}
@@ -0,0 +1,48 @@
1
+ declare const _default: ({
2
+ type: string;
3
+ description: string;
4
+ group: string;
5
+ icon: string;
6
+ model: {
7
+ type: string;
8
+ left: number;
9
+ top: number;
10
+ width: number;
11
+ height: number;
12
+ fillStyle: string;
13
+ strokeStyle: string;
14
+ endpoint: string;
15
+ };
16
+ } | {
17
+ type: string;
18
+ description: string;
19
+ group: string;
20
+ icon: string;
21
+ model: {
22
+ type: string;
23
+ left: number;
24
+ top: number;
25
+ width: number;
26
+ height: number;
27
+ autoStart: boolean;
28
+ period: number;
29
+ query: string;
30
+ };
31
+ } | {
32
+ type: string;
33
+ description: string;
34
+ group: string;
35
+ icon: string;
36
+ model: {
37
+ type: string;
38
+ left: number;
39
+ top: number;
40
+ width: number;
41
+ height: number;
42
+ lineWidth: number;
43
+ endpoint: string;
44
+ requestType: string;
45
+ query: string;
46
+ };
47
+ })[];
48
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import graphqlClient from './graphql-client';
2
+ import graphqlMutation from './graphql-mutation';
3
+ import graphqlQuery from './graphql-query';
4
+ import graphqlSubscription from './graphql-subscription';
5
+ export default [graphqlClient, graphqlQuery, graphqlMutation, graphqlSubscription];
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAC5C,OAAO,eAAe,MAAM,oBAAoB,CAAA;AAChD,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAC1C,OAAO,mBAAmB,MAAM,wBAAwB,CAAA;AAExD,eAAe,CAAC,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAAA","sourcesContent":["import graphqlClient from './graphql-client'\nimport graphqlMutation from './graphql-mutation'\nimport graphqlQuery from './graphql-query'\nimport graphqlSubscription from './graphql-subscription'\n\nexport default [graphqlClient, graphqlQuery, graphqlMutation, graphqlSubscription]\n"]}
@@ -0,0 +1,19 @@
1
+ # graphql subscription
2
+
3
+ Graphql publish 서비스로부터 푸시되는 메시지를 수신하고자하는 데이타소스 컴포넌트이다.
4
+
5
+ ## properties
6
+
7
+ - endpoint
8
+ - Graphql Service를 제공하는 서버의 접속 정보를 입력한다.
9
+ - graphql-client 컴포넌트에서 설정한다.
10
+ - 현재는 서버 인증에 대한 기능이 없으므로, 인증을 요구하지 않는 서비스나 이미 인증을 통과한 경우에 사용한다.(Origin 서버 등)
11
+ - eg. 'ws://localhost:3000/subscriptions'
12
+ - query
13
+ - subscription query를 설정한다.
14
+
15
+ ## chrome 브라우저에서 데이타 수신 확인하기
16
+
17
+ - subscription 데이타는 바로 이 컴포넌트의 data속성이 되므로, 그 결과를 데이터바인딩에 적용할 수 있다.
18
+ - subscription 데이타의 형태는 query에 의해서 결정된다.
19
+ - 실제 subscription 데이터의 형태는 크롬 브라우저의 개발자 도구의 'Network' - 'WS'에서 확인할 수 있다.
@@ -0,0 +1,19 @@
1
+ # graphql subscription
2
+
3
+ It is a data source component that wants to receive messages pushed from the Graphql publish service.
4
+
5
+ ## properties
6
+
7
+ - endpoint
8
+ - Enter the connection information of the server providing the Graphql Service.
9
+ - Configured in the graphql-client component.
10
+ - Currently, there is no function for server authentication, so it is used for services that do not require authentication or when authentication has already passed (Origin server, etc.).
11
+ - eg. 'ws://localhost:3000/subscriptions'
12
+ - query
13
+ - Set the subscription query.
14
+
15
+ ## Confirm receipt of data in the chrome browser
16
+
17
+ - Since the subscription data becomes the data property of this component, the result can be applied to data binding.
18
+ - The type of subscription data is determined by query.
19
+ - You can check the actual subscription data type in'Network'-'WS' of the developer tool of Chrome browser.
@@ -0,0 +1,19 @@
1
+ # graphql subscription
2
+
3
+ 它是一个数据源组件,接收从Graphql发布服务推送的消息。
4
+
5
+ ## properties
6
+
7
+ - endpoint
8
+ - 输入提供Graphql服务的服务器的连接信息。
9
+ - 在graphql-client组件中配置。
10
+ - 当前,尚无用于服务器身份验证的功能,因此它用于不需要身份验证或已通过身份验证的服务(原始服务器等)。
11
+ - eg. 'ws://localhost:3000/subscriptions'
12
+ - query
13
+ - subscription query를 설정한다.
14
+
15
+ ## 在Chrome浏览器中确认收到数据
16
+
17
+ - 由于订阅数据成为该组件的数据属性,因此可以将结果应用于数据绑定。
18
+ - 订阅数据的类型由graphql query确定。
19
+ - 您可以在Chrome浏览器的开发人员工具的“网络”-“ WS”中检查实际的订阅数据形态。
@@ -0,0 +1,35 @@
1
+ # graphql
2
+
3
+ Graphql API를 사용할 수 있는 데이타소스 컴포넌트 패미리이다.
4
+
5
+ - graphql-client
6
+ - Graphql 컴포넌트 패미리에서 사용할 서버를 연결하는 컴포넌트이다.
7
+ - graphql-query
8
+ - graphql-mutation
9
+
10
+ ## properties for graphql-client
11
+
12
+ - endpoint
13
+ - Graphql Service를 제공하는 서버의 접속 정보를 입력한다.
14
+ - graphql-client 컴포넌트에서 설정한다.
15
+ - 현재는 서버 인증에 대한 기능이 없으므로, 인증을 요구하지 않는 서비스나 이미 인증을 통과한 경우에 사용한다.(Origin 서버 등)
16
+ - '/graphql'
17
+ - 'http://localhost:3000/graphql'
18
+ - 이 컴포넌트는 graphql-query 또는 graphql-mutation 컴포넌트의 client component ID 속성에 설정되는 용도이다.
19
+
20
+ ## properties for graphql-query/mutation
21
+
22
+ - client component ID
23
+ - endpoint가 설정된 graphql-client의 ID를 설정한다.
24
+ - period
25
+ - 주기적인 query/mutation 호출이 필요한 경우에 그 주기를 second 단위로 설정한다.
26
+ - query
27
+ - 호출하고자 하는 graphql query를 설정한다.
28
+ - auto start
29
+ - 보드가 시작될 때 자동으로 호출할 지 여부를 설정한다.
30
+
31
+ ## chrome 브라우저에서 데이타 수신 확인하기
32
+
33
+ - query/mutation 결과는 바로 이 컴포넌트의 data속성이 되므로, 그 결과를 데이터바인딩에 적용할 수 있다.
34
+ - 데이타의 형태는 query에 의해서 결정된다.
35
+ - 실제 데이터의 형태는 크롬 브라우저의 개발자 도구의 'Network' - 'XHR'에서 확인할 수 있다.
@@ -0,0 +1,35 @@
1
+ # graphql
2
+
3
+ It is a family of data source components that can use Graphql API.
4
+
5
+ - graphql-client
6
+ - Graphql component This is a component that connects the server to be used in the family.
7
+ - graphql-query
8
+ - graphql-mutation
9
+
10
+ ## properties for graphql-client
11
+
12
+ - endpoint
13
+ - Enter the connection information of the server providing the Graphql Service.
14
+ - Configured in the graphql-client component.
15
+ - Currently, there is no function for server authentication, so it is used for services that do not require authentication or when authentication has already passed (Origin server, etc.).
16
+ - '/graphql'
17
+ - 'http://localhost:3000/graphql'
18
+ - This component is for setting in the client component ID property of the graphql-query or graphql-mutation component.
19
+
20
+ ## properties for graphql-query/mutation
21
+
22
+ - client component ID
23
+ - Set the ID of the graphql-client where the endpoint is configured.
24
+ - period
25
+ - When periodic query/mutation call is needed, set the period in second unit.
26
+ - query
27
+ - Set the graphql query to be called.
28
+ - auto start
29
+ - Set whether to call automatically when the board starts.
30
+
31
+ ## Confirm receipt of data in the chrome browser
32
+
33
+ - Since the query/mutation result becomes the data property of this component, the result can be applied to data binding.
34
+ - The type of data is determined by query.
35
+ - The actual data format can be checked in'Network'-'XHR' of the developer tools of the Chrome browser.
@@ -0,0 +1,35 @@
1
+ # graphql
2
+
3
+ 它是可以使用Graphql API的一系列数据源组件。
4
+
5
+ - graphql-client
6
+ - Graphql组件这是连接要在系列中使用的服务器的组件。
7
+ - graphql-query
8
+ - graphql-mutation
9
+
10
+ ## properties for graphql-client
11
+
12
+ - endpoint
13
+ - 输入提供Graphql服务的服务器的连接信息。
14
+ - 在graphql-client组件中配置。
15
+ - 当前,尚无用于服务器身份验证的功能,因此它用于不需要身份验证或已通过身份验证的服务(原始服务器等)。
16
+ - '/graphql'
17
+ - 'http://localhost:3000/graphql'
18
+ - 该组件用于在graphql-query或graphql-mutation组件的客户端组件ID属性中进行设置。
19
+
20
+ ## properties for graphql-query/mutation
21
+
22
+ - client component ID
23
+ - 设置配置端点的graphql-client的ID。
24
+ - period
25
+ - 需要定期执行query/mutation时,请以秒为单位设置周期。
26
+ - query
27
+ - 设置要调用的graphql查询。
28
+ - auto start
29
+ - 看板启动时是否自动调用。
30
+
31
+ ## 在Chrome浏览器中确认收到数据
32
+
33
+ - 由于`query/mutation`结果成为该组件的数据属性,因此该结果可以应用于数据绑定。
34
+ - 数据类型由查询确定。
35
+ - 实际数据形态可以在Chrome浏览器的开发人员工具的“network”-“ XHR”中查看。
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@operato/scene-graphql",
3
+ "description": "Graphql datasource component for things-scene",
4
+ "version": "0.1.3",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "author": "heartyoh",
9
+ "things-scene": true,
10
+ "publishConfig": {
11
+ "access": "public",
12
+ "@operato:registry": "https://registry.npmjs.org"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/things-scene/operato-scene.git",
17
+ "directory": "packages/graphql"
18
+ },
19
+ "scripts": {
20
+ "serve": "tsc && things-factory-dev",
21
+ "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
22
+ "build": "tsc",
23
+ "prepublish": "tsc",
24
+ "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
25
+ "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
26
+ "migration": "things-factory-migration"
27
+ },
28
+ "dependencies": {
29
+ "@apollo/client": "^3.5.6",
30
+ "@hatiolab/things-scene": "^2.7.33",
31
+ "@operato/graphql": "^0.3.20",
32
+ "jsonwebtoken": "^8.5.1",
33
+ "subscriptions-transport-ws": "^0.11.0"
34
+ },
35
+ "devDependencies": {
36
+ "@hatiolab/prettier-config": "^1.0.0",
37
+ "@operato/board": "^0.3.20",
38
+ "@things-factory/builder": "^4.0.38",
39
+ "@things-factory/operato-board": "^4.0.38",
40
+ "@typescript-eslint/eslint-plugin": "^4.33.0",
41
+ "@typescript-eslint/parser": "^4.33.0",
42
+ "@web/dev-server": "^0.1.28",
43
+ "concurrently": "^5.3.0",
44
+ "eslint": "^7.32.0",
45
+ "eslint-config-prettier": "^8.3.0",
46
+ "husky": "^4.3.8",
47
+ "lint-staged": "^10.5.4",
48
+ "prettier": "^2.4.1",
49
+ "tslib": "^2.3.1",
50
+ "typescript": "^4.5.2"
51
+ },
52
+ "prettier": "@hatiolab/prettier-config",
53
+ "husky": {
54
+ "hooks": {
55
+ "pre-commit": "lint-staged"
56
+ }
57
+ },
58
+ "lint-staged": {
59
+ "*.ts": [
60
+ "eslint --fix",
61
+ "prettier --write"
62
+ ]
63
+ },
64
+ "gitHead": "f3275af95afaf8389224e1e507df6155cbf39382"
65
+ }