@operato/scene-graphql 1.0.0-alpha.9 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -3,7 +3,83 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.0.0-alpha.9](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-04-07)
6
+ ### [1.0.2](https://github.com/things-scene/operato-scene/compare/v1.0.1...v1.0.2) (2022-08-04)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * apply concurrently to serve target ([e777342](https://github.com/things-scene/operato-scene/commit/e777342c9310f722542db9baecf49ef94e77c3a0))
12
+
13
+
14
+
15
+ ### [1.0.1](https://github.com/things-scene/operato-scene/compare/v1.0.0...v1.0.1) (2022-08-01)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * latest dependencies ([0e4cc8c](https://github.com/things-scene/operato-scene/commit/0e4cc8c6087f89412f1b29772656c63653648d5a))
21
+
22
+
23
+
24
+ ## [1.0.0](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.38...v1.0.0) (2022-07-24)
25
+
26
+
27
+ ### :bug: Bug Fix
28
+
29
+ * latest dependencies ([b435b97](https://github.com/things-scene/operato-scene/commit/b435b970f86f7e81d820a7656ecd6e0d4878ec42))
30
+
31
+
32
+
33
+ ## [1.0.0-alpha.38](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2022-07-20)
34
+
35
+
36
+ ### :bug: Bug Fix
37
+
38
+ * latest dependencies ([668aed1](https://github.com/things-scene/operato-scene/commit/668aed12552b08366230dbfab77ac2cbf4785c95))
39
+ * latest dependencies ([8a4cf6b](https://github.com/things-scene/operato-scene/commit/8a4cf6bfc9eed2bdb991eb77df9dba4b42de45e7))
40
+
41
+
42
+
43
+ ## [1.0.0-alpha.37](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-07-17)
44
+
45
+
46
+ ### :bug: Bug Fix
47
+
48
+ * latest dependencies ([cb2e928](https://github.com/things-scene/operato-scene/commit/cb2e92871da17a11ac9c68b3c4ead5df59429973))
49
+ * prevent importing full '@apollo/client' module to avoid loading unn… ([91cad16](https://github.com/things-scene/operato-scene/commit/91cad1689ca726b439ddd3ff99cba5fd09219e03))
50
+
51
+
52
+
53
+ ## [1.0.0-alpha.36](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2022-07-17)
54
+
55
+
56
+ ### :bug: Bug Fix
57
+
58
+ * integration use @operato/graphql client and subscribe ([d184eb3](https://github.com/things-scene/operato-scene/commit/d184eb35c9447ef1ecb6f5abe88ee1677345f487))
59
+
60
+
61
+
62
+ ## [1.0.0-alpha.35](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2022-07-15)
63
+
64
+
65
+ ### :bug: Bug Fix
66
+
67
+ * latest dependencies ([f5ea226](https://github.com/things-scene/operato-scene/commit/f5ea2264cde9ee6a0e20586ce9e86e47a3d8d922))
68
+ * latest dependencies ([7438dd3](https://github.com/things-scene/operato-scene/commit/7438dd3de9bdef939051ff72aad4c1b5608b6ab9))
69
+
70
+
71
+
72
+ ## [1.0.0-alpha.34](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-07-11)
73
+
74
+
75
+ ### :bug: Bug Fix
76
+
77
+ * latest [@things-factory](https://github.com/things-factory) ([03247f1](https://github.com/things-scene/operato-scene/commit/03247f188183fd784721521ff06ef49c440849bf))
78
+ * latest dependencies ([a9f062a](https://github.com/things-scene/operato-scene/commit/a9f062a08e4b3ffc89e7b99f3043520a5caea78b))
79
+
80
+
81
+
82
+ ## [1.0.0-alpha.33](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.32...v1.0.0-alpha.33) (2022-07-09)
7
83
 
8
84
  **Note:** Version bump only for package @operato/scene-graphql
9
85
 
@@ -11,7 +87,67 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
87
 
12
88
 
13
89
 
14
- ## [1.0.0-alpha.8](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-04-07)
90
+ ## [1.0.0-alpha.32](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.31...v1.0.0-alpha.32) (2022-07-09)
91
+
92
+
93
+ ### :bug: Bug Fix
94
+
95
+ * latest [@operato](https://github.com/operato) ([d033339](https://github.com/things-scene/operato-scene/commit/d033339f50bea249cdd9af22b2b9950c72045d7d))
96
+ * latest [@things-factory](https://github.com/things-factory) ([a5ea8ba](https://github.com/things-scene/operato-scene/commit/a5ea8ba70af7ac74e7cdee77fb74a152a0079366))
97
+
98
+
99
+
100
+ ## [1.0.0-alpha.31](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.30...v1.0.0-alpha.31) (2022-07-07)
101
+
102
+
103
+ ### :bug: Bug Fix
104
+
105
+ * latest [@operato](https://github.com/operato) ([b35d293](https://github.com/things-scene/operato-scene/commit/b35d29370478f340e9f450034357697b9263fe10))
106
+
107
+
108
+
109
+ ## [1.0.0-alpha.30](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-07-05)
110
+
111
+
112
+ ### :bug: Bug Fix
113
+
114
+ * latest [@things-factory](https://github.com/things-factory) ([dac17fa](https://github.com/things-scene/operato-scene/commit/dac17faebadfd2bd2efb7192a3b1f3aafdac0cbd))
115
+
116
+
117
+
118
+ ## [1.0.0-alpha.29](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.28...v1.0.0-alpha.29) (2022-07-03)
119
+
120
+
121
+ ### :bug: Bug Fix
122
+
123
+ * latest [@operato](https://github.com/operato) ([b9f14d8](https://github.com/things-scene/operato-scene/commit/b9f14d8838943093e65175b80f515281011089ed))
124
+
125
+
126
+
127
+ ## [1.0.0-alpha.28](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.27...v1.0.0-alpha.28) (2022-07-03)
128
+
129
+
130
+ ### :bug: Bug Fix
131
+
132
+ * latest [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([6ef27eb](https://github.com/things-scene/operato-scene/commit/6ef27eba820d7641e6c7cc3cedf815c0af74a6c7))
133
+ * latest @hatiolab/things-scene [@operato](https://github.com/operato) ([353d090](https://github.com/things-scene/operato-scene/commit/353d0900a24a96aabde48405ee6ec18b1b227e09))
134
+ * latest dependencies ([4ad53db](https://github.com/things-scene/operato-scene/commit/4ad53db21b0f88856f93fcbc3a12b80011d73a1b))
135
+ * latest dependencies ([7328b85](https://github.com/things-scene/operato-scene/commit/7328b85c151feb718ca1bcdaf9ac36f9f721ed57))
136
+
137
+
138
+
139
+ ## [1.0.0-alpha.27](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.26...v1.0.0-alpha.27) (2022-06-22)
140
+
141
+
142
+ ### :bug: Bug Fix
143
+
144
+ * latest @hatiolab/things-scene ([5f7e8b6](https://github.com/things-scene/operato-scene/commit/5f7e8b6f40e7b73ac874be1d473eff847f14afe2))
145
+ * latest @hatiolab/things-scene ([1bb48f0](https://github.com/things-scene/operato-scene/commit/1bb48f0259044085f690c817dbe0383a44b15f9b))
146
+ * latest @hatiolab/things-scene [@operato](https://github.com/operato) ([ed2b7b8](https://github.com/things-scene/operato-scene/commit/ed2b7b83f0fd06780e6b9841cc6a1702b834e4ac))
147
+
148
+
149
+
150
+ ## [1.0.0-alpha.26](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.25...v1.0.0-alpha.26) (2022-06-20)
15
151
 
16
152
  **Note:** Version bump only for package @operato/scene-graphql
17
153
 
@@ -19,7 +155,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
155
 
20
156
 
21
157
 
22
- ## [1.0.0-alpha.7](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-04-06)
158
+ ## [1.0.0-alpha.25](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.24...v1.0.0-alpha.25) (2022-06-20)
23
159
 
24
160
  **Note:** Version bump only for package @operato/scene-graphql
25
161
 
@@ -27,32 +163,175 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
27
163
 
28
164
 
29
165
 
30
- ## [1.0.0-alpha.6](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2022-04-05)
166
+ ## [1.0.0-alpha.24](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.23...v1.0.0-alpha.24) (2022-06-20)
31
167
 
32
168
 
33
169
  ### :bug: Bug Fix
34
170
 
35
- * [@things-factory](https://github.com/things-factory) 5.0.0-alpha.28 ([459ce88](https://github.com/things-scene/operato-scene/commit/459ce884942ab11bcd1e9b9c6af7bf045b580a41))
171
+ * latest [@operato](https://github.com/operato) ([1a59e6f](https://github.com/things-scene/operato-scene/commit/1a59e6f0ced18902fee98b88933650e23f9ad420))
172
+ * latest dependencies ([9ee4519](https://github.com/things-scene/operato-scene/commit/9ee4519adfe49e2eac8433f31ad5dea9257a1fca))
36
173
 
37
174
 
38
175
 
39
- ## [1.0.0-alpha.5](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2022-04-03)
176
+ ## [1.0.0-alpha.23](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-06-16)
40
177
 
41
178
 
42
179
  ### :bug: Bug Fix
43
180
 
44
- * upgrade lit and operato, things-factory ([f056300](https://github.com/things-scene/operato-scene/commit/f056300c0e2f85c41715d3178f12c39bf3110a34))
181
+ * latest [@operato](https://github.com/operato) ([45a542f](https://github.com/things-scene/operato-scene/commit/45a542f484a4fe552533a35eb90f2b100e01249f))
182
+ * latest [@operato](https://github.com/operato) ([d4020ee](https://github.com/things-scene/operato-scene/commit/d4020eefc797da03d43b73708dcfd8541f5b30af))
45
183
 
46
184
 
47
185
 
48
- ## [1.0.0-alpha.4](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2022-03-13)
186
+ ## [1.0.0-alpha.22](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-06-16)
49
187
 
50
188
 
51
189
  ### :bug: Bug Fix
52
190
 
53
- * [@operato](https://github.com/operato) 1.0.0-alpha.17 ([a8a147c](https://github.com/things-scene/operato-scene/commit/a8a147c972ed571e35d210feb3bfbc7cd31f280b))
191
+ * latest @hatiolab/things-scene ([0928090](https://github.com/things-scene/operato-scene/commit/09280903b4b0280ee8a76a4d1c2a0bf8d0997563))
192
+
193
+
194
+
195
+ ## [1.0.0-alpha.21](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.20...v1.0.0-alpha.21) (2022-06-16)
196
+
54
197
 
198
+ ### :bug: Bug Fix
199
+
200
+ * latest [@operato](https://github.com/operato) ([8384a79](https://github.com/things-scene/operato-scene/commit/8384a79c616db7c5fb437a480bb8c8337b75db84))
201
+
202
+
203
+
204
+ ## [1.0.0-alpha.20](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2022-06-10)
205
+
206
+ **Note:** Version bump only for package @operato/scene-graphql
207
+
208
+
209
+
210
+
211
+
212
+ ## [1.0.0-alpha.19](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.18...v1.0.0-alpha.19) (2022-06-09)
213
+
214
+
215
+ ### :bug: Bug Fix
216
+
217
+ * latest [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([c6a5475](https://github.com/things-scene/operato-scene/commit/c6a54751a3af539840fd57d031e09ee1552a7b4c))
218
+
219
+
220
+
221
+ ## [1.0.0-alpha.18](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.17...v1.0.0-alpha.18) (2022-05-30)
222
+
223
+
224
+ ### :bug: Bug Fix
225
+
226
+ * latest dependencies ([5fae24c](https://github.com/things-scene/operato-scene/commit/5fae24ce2e7d17b5e2e85fae4cee04cfca690549))
227
+
228
+
229
+
230
+ ## [1.0.0-alpha.17](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.16...v1.0.0-alpha.17) (2022-05-29)
231
+
232
+
233
+ ### :bug: Bug Fix
234
+
235
+ * default client for graphql ([7d71b73](https://github.com/things-scene/operato-scene/commit/7d71b73d2d66171aee8d8d6a61f1b269b45f0dce))
236
+ * default client for graphql ([d13b1e4](https://github.com/things-scene/operato-scene/commit/d13b1e4a7afecedd72ec0e39827c2bf8b4ef3a1f))
237
+ * help for graphql data ([910abc1](https://github.com/things-scene/operato-scene/commit/910abc1395fdebfa4f50317203aed251af94f702))
238
+ * latest things-scene & [@things-factory](https://github.com/things-factory) ([485bcce](https://github.com/things-scene/operato-scene/commit/485bccead07ccc5065088f1d458175f84083f9a5))
239
+ * update [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([8552127](https://github.com/things-scene/operato-scene/commit/8552127bdda3282ac74e86b936342caa085f6bea))
240
+
241
+
242
+
243
+ ## [1.0.0-alpha.16](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-05-23)
244
+
245
+
246
+ ### :rocket: New Features
247
+
248
+ * migrate data-transform from [@things-factory](https://github.com/things-factory) ([2b7c5d3](https://github.com/things-scene/operato-scene/commit/2b7c5d34027d611c5e8210cada8cd15272944fa5))
249
+
250
+
251
+ ### :bug: Bug Fix
252
+
253
+ * update dependencies ([8ef917f](https://github.com/things-scene/operato-scene/commit/8ef917f41e83126495d3b75ae3042bbd66cf12c3))
254
+
255
+
256
+
257
+ ## [1.0.0-alpha.15](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-05-13)
258
+
259
+ **Note:** Version bump only for package @operato/scene-graphql
260
+
261
+
262
+
263
+
264
+
265
+ ## [1.0.0-alpha.14](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-05-01)
266
+
267
+
268
+ ### :bug: Bug Fix
269
+
270
+ * apply @hatiolab/things-scene 3.0.6 - memory free ([5778610](https://github.com/things-scene/operato-scene/commit/5778610aa6456709cb931a3185b189f1d3bd1ff9))
271
+
272
+
273
+
274
+ ## [1.0.0-alpha.13](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-04-24)
275
+
276
+
277
+ ### :bug: Bug Fix
278
+
279
+ * "@hatiolab/things-scene": "^3.0.2" ([13057dd](https://github.com/things-scene/operato-scene/commit/13057dd2f8bbb3859abb479516c3483bcc15354b))
280
+ * @hatiolab/things-scene 3.0.5 and [@operato](https://github.com/operato) 1.0.0-beta.7 ([bd69bf1](https://github.com/things-scene/operato-scene/commit/bd69bf134c1fe6789f4964f0e6525f728eee8275))
281
+ * things-scene 3.0.1 ([288f953](https://github.com/things-scene/operato-scene/commit/288f953947d73ffa3f6e8743f8326570d1dace80))
282
+
283
+
284
+
285
+ ## [1.0.0-alpha.12](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2022-04-18)
286
+
287
+
288
+ ### :bug: Bug Fix
289
+
290
+ * @hatiolab/things-scene 3.0.0 ([29021a5](https://github.com/things-scene/operato-scene/commit/29021a511e5dc1e91b337b155817d846883ceff7))
291
+
292
+
293
+
294
+ ## [1.0.0-alpha.11](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2022-04-17)
295
+
296
+ **Note:** Version bump only for package @operato/scene-graphql
297
+
298
+
299
+
300
+
301
+
302
+ ## [1.0.0-alpha.10](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-04-10)
303
+
304
+ **Note:** Version bump only for package @operato/scene-graphql
305
+
306
+ ## [1.0.0-alpha.9](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-04-07)
307
+
308
+ **Note:** Version bump only for package @operato/scene-graphql
309
+
310
+ ## [1.0.0-alpha.8](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-04-07)
311
+
312
+ **Note:** Version bump only for package @operato/scene-graphql
313
+
314
+ ## [1.0.0-alpha.7](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-04-06)
315
+
316
+ **Note:** Version bump only for package @operato/scene-graphql
317
+
318
+ ## [1.0.0-alpha.6](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2022-04-05)
319
+
320
+ ### :bug: Bug Fix
321
+
322
+ - [@things-factory](https://github.com/things-factory) 5.0.0-alpha.36 ([459ce88](https://github.com/things-scene/operato-scene/commit/459ce884942ab11bcd1e9b9c6af7bf045b580a41))
323
+
324
+ ## [1.0.0-alpha.5](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2022-04-03)
325
+
326
+ ### :bug: Bug Fix
327
+
328
+ - upgrade lit and operato, things-factory ([f056300](https://github.com/things-scene/operato-scene/commit/f056300c0e2f85c41715d3178f12c39bf3110a34))
329
+
330
+ ## [1.0.0-alpha.4](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2022-03-13)
331
+
332
+ ### :bug: Bug Fix
55
333
 
334
+ - [@operato](https://github.com/operato) 1.0.0-alpha.17 ([a8a147c](https://github.com/things-scene/operato-scene/commit/a8a147c972ed571e35d210feb3bfbc7cd31f280b))
56
335
 
57
336
  ## [1.0.0-alpha.3](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2022-03-13)
58
337
 
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-client.js","sourceRoot":"","sources":["../src/graphql-client.ts"],"names":[],"mappings":"AAAA;;GAEG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QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACxE,CAAC;IAED,YAAY,CAAC,IAAS,EAAE,MAAW;QACjC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { ServerParseError } from '@apollo/client'\nimport {\n ApolloClient,\n DefaultOptions,\n from,\n HttpLink,\n HttpOptions,\n InMemoryCache,\n NormalizedCacheObject\n} from '@apollo/client/core'\nimport { ErrorLink, onError } from '@apollo/client/link/error'\nimport { Component, ComponentNature, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\n\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: 'no-cache',\n errorPolicy: 'ignore'\n },\n query: {\n fetchPolicy: 'no-cache', //'network-only'\n errorPolicy: 'all'\n },\n mutate: {\n errorPolicy: 'all'\n }\n}\n\nconst ERROR_HANDLER: ErrorLink.ErrorHandler = ({ operation, graphQLErrors, networkError }) => {\n if (graphQLErrors) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: graphQLErrors[0].message,\n ex: graphQLErrors\n }\n })\n )\n }\n\n if (networkError) {\n /* networkError가 ServerParseError 이거나 ServerError 인 경우에만 statusCode를 갖는다. */\n switch ((networkError as ServerParseError).statusCode) {\n case undefined /* in case this error is not a server side error */:\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: networkError.message,\n ex: networkError\n }\n })\n )\n break\n\n case 401:\n /* 401 에러가 리턴되면, 인증이 필요하다는 메시지를 dispatch 한다. 이 auth 모듈 등에서 이 메시지를 받아서 signin 프로세스를 진행할 수 있다. */\n document.dispatchEvent(new CustomEvent('auth-required'))\n break\n\n case 403:\n /* 403 에러가 리턴되면, 도메인 정보가 필요하다는 메시지를 dispatch 한다. 이 auth 모듈 등에서 이 메시지를 받아서 domain-register 프로세스 등을 진행할 수 있다. */\n document.dispatchEvent(new CustomEvent('domain-required'))\n break\n\n default:\n var { name, response, statusCode, bodyText, message } = networkError as ServerParseError\n if (name == 'ServerParseError') {\n message = `[ ${statusCode || ''} : ${response.statusText} ] ${bodyText}`\n } else {\n /* in case this error is instanceof ServerError */\n message = `[ ${statusCode || ''} : ${response.statusText} ] ${message}`\n }\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message,\n ex: networkError\n }\n })\n )\n }\n }\n}\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'endpoint',\n name: 'endpoint'\n }\n ],\n help: 'scene/component/graphql'\n}\n\nexport default class GraphqlClient extends DataSource(RectPath(Shape)) {\n private static _image: HTMLImageElement\n private _client?: ApolloClient<NormalizedCacheObject>\n\n static get image() {\n if (!GraphqlClient._image) {\n GraphqlClient._image = new Image()\n GraphqlClient._image.src = new URL('../icons/symbol-graphql-client.png', import.meta.url).href\n }\n\n return GraphqlClient._image\n }\n\n ready() {\n super.ready()\n\n this.init()\n }\n\n init() {\n var { endpoint } = this.state\n\n if (!endpoint) {\n console.warn('endpoint not defined')\n return\n }\n\n var cache = new InMemoryCache()\n const httpOptions: HttpOptions = {\n uri: endpoint,\n credentials: 'include'\n }\n\n const client = new ApolloClient({\n defaultOptions,\n cache,\n link: from([onError(ERROR_HANDLER), new HttpLink(httpOptions)])\n })\n\n this._client = client\n }\n\n get client(): ApolloClient<NormalizedCacheObject> | undefined {\n return this._client\n }\n\n dispose() {\n super.dispose()\n\n try {\n if (this._client) {\n this._client.stop()\n }\n } catch (e) {\n console.error(e)\n }\n delete this._client\n }\n\n render(context: CanvasRenderingContext2D) {\n /*\n * TODO role이 publisher 인지 subscriber 인지에 따라서 구분할 수 있는 표시를 추가할 것.\n */\n\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, GraphqlClient.image, left, top, width, height)\n }\n\n onchangeData(data: any, before: any) {\n super.onchangeData(data, before)\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.register('graphql-client', GraphqlClient)\n"]}
1
+ {"version":3,"file":"graphql-client.js","sourceRoot":"","sources":["../src/graphql-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,YAAY,EAEZ,IAAI,EACJ,QAAQ,EAER,aAAa,EAGd,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAa,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEhG,MAAM,cAAc,GAAmB;IACrC,UAAU,EAAE;QACV,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,QAAQ;KACtB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,KAAK;KACnB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,KAAK;KACnB;CACF,CAAA;AAED,MAAM,aAAa,GAA2B,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,EAAE;IAC3F,IAAI,aAAa,EAAE;QACjB,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE;gBACN,KAAK,EAAE,OAAO;gBACd,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO;gBACjC,EAAE,EAAE,aAAa;aAClB;SACF,CAAC,CACH,CAAA;KACF;IAED,IAAI,YAAY,EAAE;QAChB,4EAA4E;QAC5E,QAAS,YAAiC,CAAC,UAAU,EAAE;YACrD,KAAK,SAAS,CAAC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AChB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;aACpB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;SACjB;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,MAAM,CAAC,OAAiC;QACtC;;WAEG;QAEH,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9C,OAAO,CAAC,SAAS,EAAE,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACxE,CAAC;IAED,YAAY,CAAC,IAAS,EAAE,MAAW;QACjC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport {\n ApolloClient,\n DefaultOptions,\n from,\n HttpLink,\n HttpOptions,\n InMemoryCache,\n NormalizedCacheObject,\n ServerParseError\n} from '@apollo/client/core'\nimport { ErrorLink, onError } from '@apollo/client/link/error'\nimport { Component, ComponentNature, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\n\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: 'no-cache',\n errorPolicy: 'ignore'\n },\n query: {\n fetchPolicy: 'no-cache', //'network-only'\n errorPolicy: 'all'\n },\n mutate: {\n errorPolicy: 'all'\n }\n}\n\nconst ERROR_HANDLER: ErrorLink.ErrorHandler = ({ operation, graphQLErrors, networkError }) => {\n if (graphQLErrors) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: graphQLErrors[0].message,\n ex: graphQLErrors\n }\n })\n )\n }\n\n if (networkError) {\n /* networkError가 ServerParseError 이거나 ServerError 인 경우에만 statusCode를 갖는다. */\n switch ((networkError as ServerParseError).statusCode) {\n case undefined /* in case this error is not a server side error */:\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: networkError.message,\n ex: networkError\n }\n })\n )\n break\n\n case 401:\n /* 401 에러가 리턴되면, 인증이 필요하다는 메시지를 dispatch 한다. 이 auth 모듈 등에서 이 메시지를 받아서 signin 프로세스를 진행할 수 있다. */\n document.dispatchEvent(new CustomEvent('auth-required'))\n break\n\n case 403:\n /* 403 에러가 리턴되면, 도메인 정보가 필요하다는 메시지를 dispatch 한다. 이 auth 모듈 등에서 이 메시지를 받아서 domain-register 프로세스 등을 진행할 수 있다. */\n document.dispatchEvent(new CustomEvent('domain-required'))\n break\n\n default:\n var { name, response, statusCode, bodyText, message } = networkError as ServerParseError\n if (name == 'ServerParseError') {\n message = `[ ${statusCode || ''} : ${response.statusText} ] ${bodyText}`\n } else {\n /* in case this error is instanceof ServerError */\n message = `[ ${statusCode || ''} : ${response.statusText} ] ${message}`\n }\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message,\n ex: networkError\n }\n })\n )\n }\n }\n}\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'endpoint',\n name: 'endpoint'\n }\n ],\n help: 'scene/component/graphql'\n}\n\nexport default class GraphqlClient extends DataSource(RectPath(Shape)) {\n private static _image: HTMLImageElement\n private _client?: ApolloClient<NormalizedCacheObject>\n\n static get image() {\n if (!GraphqlClient._image) {\n GraphqlClient._image = new Image()\n GraphqlClient._image.src = new URL('../icons/symbol-graphql-client.png', import.meta.url).href\n }\n\n return GraphqlClient._image\n }\n\n ready() {\n super.ready()\n\n this.init()\n }\n\n init() {\n var { endpoint } = this.state\n\n if (!endpoint) {\n console.warn('endpoint not defined')\n return\n }\n\n var cache = new InMemoryCache()\n const httpOptions: HttpOptions = {\n uri: endpoint,\n credentials: 'include'\n }\n\n const client = new ApolloClient({\n defaultOptions,\n cache,\n link: from([onError(ERROR_HANDLER), new HttpLink(httpOptions)])\n })\n\n this._client = client\n }\n\n get client(): ApolloClient<NormalizedCacheObject> | undefined {\n return this._client\n }\n\n dispose() {\n super.dispose()\n\n try {\n if (this._client) {\n this._client.stop()\n }\n } catch (e) {\n console.error(e)\n }\n delete this._client\n }\n\n render(context: CanvasRenderingContext2D) {\n /*\n * TODO role이 publisher 인지 subscriber 인지에 따라서 구분할 수 있는 표시를 추가할 것.\n */\n\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, GraphqlClient.image, left, top, width, height)\n }\n\n onchangeData(data: any, before: any) {\n super.onchangeData(data, before)\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.register('graphql-client', GraphqlClient)\n"]}
@@ -1,12 +1,10 @@
1
1
  /// <reference types="node" />
2
- import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
3
2
  import { ComponentNature, Properties, Shape } from '@hatiolab/things-scene';
4
3
  declare const GraphQLQuery_base: (new (...args: any[]) => {
5
4
  isDataSource(): boolean;
6
5
  _convertDataFormat(data: any, format: string): any;
7
6
  }) & typeof Shape;
8
7
  declare class GraphQLQuery extends GraphQLQuery_base {
9
- client?: ApolloClient<NormalizedCacheObject>;
10
8
  private _repeatTimer?;
11
9
  private _isStarted;
12
10
  value: any;
@@ -1,6 +1,6 @@
1
1
  import gql from 'graphql-tag';
2
2
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
3
- import { buildArgs } from '@operato/graphql';
3
+ import { buildArgs, client as localClient } from '@operato/graphql';
4
4
  const NATURE = {
5
5
  mutable: false,
6
6
  resizable: true,
@@ -10,6 +10,7 @@ const NATURE = {
10
10
  type: 'id-input',
11
11
  label: 'client',
12
12
  name: 'client',
13
+ placeholder: 'leave blank to use origin server',
13
14
  property: {
14
15
  component: 'graphql-client' // component의 type (null or undefined이면 모든 컴포넌트)
15
16
  }
@@ -134,30 +135,30 @@ class GraphQLQuery extends DataSource(RectPath(Shape)) {
134
135
  requestAnimationFrame(_);
135
136
  }
136
137
  async requestData() {
137
- var _a, _b, _c;
138
+ var _a;
138
139
  if (!this.app.isViewMode)
139
140
  return;
140
141
  var { client } = this.state;
141
142
  var query = this.query;
142
143
  var variables = this.value;
143
- if (client && query) {
144
- this.client = (_a = this.root.findById(client)) === null || _a === void 0 ? void 0 : _a.client;
144
+ if (query) {
145
+ const graphqlClient = (client && ((_a = this.root.findById(client)) === null || _a === void 0 ? void 0 : _a.client)) || localClient;
145
146
  var response;
146
147
  if (typeof variables === 'object') {
147
- response = await ((_b = this.client) === null || _b === void 0 ? void 0 : _b.query({
148
+ response = await graphqlClient.query({
148
149
  query: gql `
149
150
  ${query}
150
151
  `,
151
152
  variables: variables
152
- }));
153
+ });
153
154
  }
154
155
  else {
155
- response = await ((_c = this.client) === null || _c === void 0 ? void 0 : _c.query({
156
+ response = await graphqlClient.query({
156
157
  query: gql `
157
158
  ${query}
158
159
  `,
159
160
  errorPolicy: 'all'
160
- }));
161
+ });
161
162
  }
162
163
  console.log('response', response);
163
164
  this.data = response;
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-query-and-mutation.js","sourceRoot":"","sources":["../src/graphql-query-and-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAG7B,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAc,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC5G,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAI5C,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,E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AAA;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAChE,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,YAAY;IAGxC,MAAM,KAAK,KAAK;QACd,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,QAAQ,CAAC,MAAM,GAAG,IAAI,KAAK,EAAE,CAAA;YAC7B,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,sCAAsC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;SAC5F;QAED,OAAO,QAAQ,CAAC,MAAM,CAAA;IACxB,CAAC;IAED,MAAM,CAAC,OAAiC;QACtC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9C,OAAO,CAAC,SAAS,EAAE,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACnE,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;AAC1C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { ApolloClient, NormalizedCacheObject } from '@apollo/client/core'\nimport { Component, ComponentNature, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'\nimport { buildArgs } from '@operato/graphql'\n\nimport GraphqlClient from './graphql-client'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'id-input',\n label: 'client',\n name: 'client',\n property: {\n component: 'graphql-client' // component의 type (null or undefined이면 모든 컴포넌트)\n }\n },\n {\n type: 'number',\n label: 'period',\n name: 'period',\n placeholder: 'SECONDS'\n },\n {\n type: 'graphql',\n label: 'query',\n name: 'query'\n },\n {\n type: 'checkbox',\n label: 'auto-start',\n name: 'autoStart'\n }\n ],\n 'value-property': 'value',\n help: 'scene/component/graphql'\n}\n\nclass GraphQLQuery extends DataSource(RectPath(Shape)) {\n public client?: ApolloClient<NormalizedCacheObject>\n\n private _repeatTimer?: NodeJS.Timeout\n private _isStarted: boolean = false\n\n value: any\n\n get nature() {\n return NATURE\n }\n\n onchange(after: Properties, before: Properties) {\n if ('value' in after) {\n if (after.value) this.requestData()\n }\n }\n\n get period() {\n return this.state.period * 1000\n }\n\n set period(period) {\n this.setState('period', period)\n this._initGraphqlQuery()\n }\n\n get repeatTimer() {\n return this._repeatTimer\n }\n\n set repeatTimer(repeatTimer) {\n this._stopRepeater()\n this._repeatTimer = repeatTimer\n }\n\n get autoStart() {\n return this.state.autoStart\n }\n\n set autoStart(autoStart) {\n this.setState('autoStart', autoStart)\n }\n\n get query() {\n var _query = this.state.query\n var objToVal = (exp: any) => {\n if (typeof exp === 'string') return exp\n else return JSON.stringify(exp)\n }\n var changedQuery: string | undefined = (Component.buildSubstitutor(_query, this, objToVal) || (() => _query))()\n try {\n changedQuery = changedQuery!.replace(/\\(.*\\)/gi, params => {\n let paramObject = eval(`({${params.slice(1, -1)}})`)\n return '(' + buildArgs(paramObject) + ')'\n })\n } catch (e) {\n console.log(e)\n }\n\n return changedQuery\n }\n\n get source() {\n return this.getState('source')\n }\n\n set source(source) {\n this.setState('source', source)\n }\n\n dispose() {\n super.dispose()\n this._stopRepeater()\n }\n\n ready() {\n super.ready()\n if (this.autoStart) {\n this._initGraphqlQuery()\n }\n }\n\n _initGraphqlQuery() {\n if (!this.app.isViewMode) return\n\n this._stopRepeater()\n this._startRepeater()\n }\n\n _stopRepeater() {\n if (this.repeatTimer !== undefined) {\n clearTimeout(this._repeatTimer!)\n delete this._repeatTimer\n }\n\n this._isStarted = false\n }\n\n _startRepeater() {\n this._isStarted = true\n\n // requestAnimationFrame 이 호출되지 않을 때는 requestData 호출도 하지 않도록 함.\n var _ = () => {\n if (!this._isStarted) {\n return\n }\n this.requestData()\n if (!Number.isNaN(this.period) && this.period > 0) {\n this._repeatTimer = setTimeout(() => {\n requestAnimationFrame(_)\n }, this.period)\n }\n }\n requestAnimationFrame(_)\n }\n\n async requestData() {\n if (!this.app.isViewMode) return\n var { client } = this.state\n var query = this.query\n var variables = this.value\n\n if (client && query) {\n this.client = (this.root.findById(client) as GraphqlClient)?.client\n var response\n\n if (typeof variables === 'object') {\n response = await this.client?.query({\n query: gql`\n ${query}\n `,\n variables: variables\n })\n } else {\n response = await this.client?.query({\n query: gql`\n ${query}\n `,\n errorPolicy: 'all'\n })\n }\n\n console.log('response', response)\n this.data = response\n }\n }\n}\n\nexport class Query extends GraphQLQuery {\n private static _image: HTMLImageElement\n\n static get image() {\n if (!Query._image) {\n Query._image = new Image()\n Query._image.src = new URL('../icons/symbol-graphql-query.png', import.meta.url).href\n }\n\n return Query._image\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Query.image, left, top, width, height)\n }\n}\n\nexport class Mutation extends GraphQLQuery {\n private static _image: HTMLImageElement\n\n static get image() {\n if (!Mutation._image) {\n Mutation._image = new Image()\n Mutation._image.src = new URL('../icons/symbol-graphql-mutation.png', import.meta.url).href\n }\n\n return Mutation._image\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Mutation.image, left, top, width, height)\n }\n}\n\nComponent.register('graphql-query', Query)\nComponent.register('graphql-mutation', Mutation)\n"]}
1
+ {"version":3,"file":"graphql-query-and-mutation.js","sourceRoot":"","sources":["../src/graphql-query-and-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAG7B,OAAO,EAAE,SAAS,EAAmB,UAAU,EA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from '@apollo/client/core'\nimport { Component, ComponentNature, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'\nimport { buildArgs, client as localClient } from '@operato/graphql'\n\nimport GraphqlClient from './graphql-client'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'id-input',\n label: 'client',\n name: 'client',\n placeholder: 'leave blank to use origin server',\n property: {\n component: 'graphql-client' // component의 type (null or undefined이면 모든 컴포넌트)\n }\n },\n {\n type: 'number',\n label: 'period',\n name: 'period',\n placeholder: 'SECONDS'\n },\n {\n type: 'graphql',\n label: 'query',\n name: 'query'\n },\n {\n type: 'checkbox',\n label: 'auto-start',\n name: 'autoStart'\n }\n ],\n 'value-property': 'value',\n help: 'scene/component/graphql'\n}\n\nclass GraphQLQuery extends DataSource(RectPath(Shape)) {\n private _repeatTimer?: NodeJS.Timeout\n private _isStarted: boolean = false\n\n value: any\n\n get nature() {\n return NATURE\n }\n\n onchange(after: Properties, before: Properties) {\n if ('value' in after) {\n if (after.value) this.requestData()\n }\n }\n\n get period() {\n return this.state.period * 1000\n }\n\n set period(period) {\n this.setState('period', period)\n this._initGraphqlQuery()\n }\n\n get repeatTimer() {\n return this._repeatTimer\n }\n\n set repeatTimer(repeatTimer) {\n this._stopRepeater()\n this._repeatTimer = repeatTimer\n }\n\n get autoStart() {\n return this.state.autoStart\n }\n\n set autoStart(autoStart) {\n this.setState('autoStart', autoStart)\n }\n\n get query() {\n var _query = this.state.query\n var objToVal = (exp: any) => {\n if (typeof exp === 'string') return exp\n else return JSON.stringify(exp)\n }\n var changedQuery: string | undefined = (Component.buildSubstitutor(_query, this, objToVal) || (() => _query))()\n try {\n changedQuery = changedQuery!.replace(/\\(.*\\)/gi, params => {\n let paramObject = eval(`({${params.slice(1, -1)}})`)\n return '(' + buildArgs(paramObject) + ')'\n })\n } catch (e) {\n console.log(e)\n }\n\n return changedQuery\n }\n\n get source() {\n return this.getState('source')\n }\n\n set source(source) {\n this.setState('source', source)\n }\n\n dispose() {\n super.dispose()\n this._stopRepeater()\n }\n\n ready() {\n super.ready()\n if (this.autoStart) {\n this._initGraphqlQuery()\n }\n }\n\n _initGraphqlQuery() {\n if (!this.app.isViewMode) return\n\n this._stopRepeater()\n this._startRepeater()\n }\n\n _stopRepeater() {\n if (this.repeatTimer !== undefined) {\n clearTimeout(this._repeatTimer!)\n delete this._repeatTimer\n }\n\n this._isStarted = false\n }\n\n _startRepeater() {\n this._isStarted = true\n\n // requestAnimationFrame 이 호출되지 않을 때는 requestData 호출도 하지 않도록 함.\n var _ = () => {\n if (!this._isStarted) {\n return\n }\n this.requestData()\n if (!Number.isNaN(this.period) && this.period > 0) {\n this._repeatTimer = setTimeout(() => {\n requestAnimationFrame(_)\n }, this.period)\n }\n }\n requestAnimationFrame(_)\n }\n\n async requestData() {\n if (!this.app.isViewMode) return\n var { client } = this.state\n var query = this.query\n var variables = this.value\n\n if (query) {\n const graphqlClient: ApolloClient<NormalizedCacheObject> =\n (client && (this.root.findById(client) as GraphqlClient)?.client) || localClient\n\n var response\n\n if (typeof variables === 'object') {\n response = await graphqlClient.query({\n query: gql`\n ${query}\n `,\n variables: variables\n })\n } else {\n response = await graphqlClient.query({\n query: gql`\n ${query}\n `,\n errorPolicy: 'all'\n })\n }\n\n console.log('response', response)\n this.data = response\n }\n }\n}\n\nexport class Query extends GraphQLQuery {\n private static _image: HTMLImageElement\n\n static get image() {\n if (!Query._image) {\n Query._image = new Image()\n Query._image.src = new URL('../icons/symbol-graphql-query.png', import.meta.url).href\n }\n\n return Query._image\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Query.image, left, top, width, height)\n }\n}\n\nexport class Mutation extends GraphQLQuery {\n private static _image: HTMLImageElement\n\n static get image() {\n if (!Mutation._image) {\n Mutation._image = new Image()\n Mutation._image.src = new URL('../icons/symbol-graphql-mutation.png', import.meta.url).href\n }\n\n return Mutation._image\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Mutation.image, left, top, width, height)\n }\n}\n\nComponent.register('graphql-query', Query)\nComponent.register('graphql-mutation', Mutation)\n"]}
@@ -5,14 +5,12 @@ declare const GraphqlSubscription_base: (new (...args: any[]) => {
5
5
  }) & typeof Shape;
6
6
  export default class GraphqlSubscription extends GraphqlSubscription_base {
7
7
  private static _image;
8
- private client?;
9
8
  private unsubscribe?;
10
9
  static get image(): HTMLImageElement;
11
10
  dispose(): void;
12
11
  render(context: CanvasRenderingContext2D): void;
13
12
  ready(): void;
14
13
  get nature(): ComponentNature;
15
- _initGraphqlSubscription(): void;
16
14
  requestData(): Promise<void>;
17
15
  }
18
16
  export {};
@@ -1,14 +1,16 @@
1
1
  /*
2
2
  * Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
- import { SubscriptionClient } from 'subscriptions-transport-ws';
4
+ import { gql } from 'graphql-tag';
5
5
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
6
+ import { subscribe } from '@operato/graphql';
6
7
  const NATURE = {
7
8
  mutable: false,
8
9
  resizable: true,
9
10
  rotatable: true,
10
11
  properties: [
11
12
  {
13
+ /* origin의 subscription 만을 허용하므로, 엔드포인트 속성은 무시한다. */
12
14
  type: 'string',
13
15
  label: 'endpoint',
14
16
  name: 'endpoint'
@@ -33,10 +35,6 @@ export default class GraphqlSubscription extends DataSource(RectPath(Shape)) {
33
35
  if (this.unsubscribe) {
34
36
  this.unsubscribe();
35
37
  }
36
- if (this.client) {
37
- this.client.unsubscribeAll();
38
- this.client.close(true);
39
- }
40
38
  super.dispose();
41
39
  }
42
40
  render(context) {
@@ -45,45 +43,28 @@ export default class GraphqlSubscription extends DataSource(RectPath(Shape)) {
45
43
  this.drawImage(context, GraphqlSubscription.image, left, top, width, height);
46
44
  }
47
45
  ready() {
48
- this._initGraphqlSubscription();
46
+ super.ready();
47
+ if (this.app.isViewMode) {
48
+ this.requestData();
49
+ }
49
50
  }
50
51
  get nature() {
51
52
  return NATURE;
52
53
  }
53
- _initGraphqlSubscription() {
54
- if (!this.app.isViewMode)
55
- return;
56
- this.requestData();
57
- }
58
54
  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
55
+ var { query } = this.state;
56
+ const { unsubscribe } = await subscribe({
57
+ query: gql `
58
+ ${query}
59
+ `
60
+ }, {
61
+ next: ({ data }) => {
62
+ if (data) {
63
+ this.data = data;
74
64
  }
75
65
  }
76
66
  });
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
- });
67
+ this.unsubscribe = unsubscribe;
87
68
  }
88
69
  }
89
70
  Component.register('graphql-subscription', GraphqlSubscription);
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-subscription.js","sourceRoot":"","sources":["../src/graphql-subscription.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEhG,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YAC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AC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,wBAAwB;QACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU;YAAE,OAAM;QAEhC,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QACpC,IAAI,IAAI,GAAG,IAAI,CAAA;QAEf,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAkB,CAAC,QAAQ,EAAE;YAC7C,SAAS,EAAE,IAAI;YACf,gBAAgB,EAAE;gBAChB,OAAO,EAAE;oBACP;;;;;;;sBAOE;oBACF,OAAO,EAAE,QAAQ,CAAC,IAAI;iBACvB;aACF;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE;YAC3B,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,MAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC;gBAChE,IAAI,CAAC,EAAE,IAAI,EAAE;oBACX,IAAI,IAAI,EAAE;wBACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;qBACjB;gBACH,CAAC;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAChC,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { SubscriptionClient } from 'subscriptions-transport-ws'\n\nimport { Component, ComponentNature, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\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"]}
1
+ {"version":3,"file":"graphql-subscription.js","sourceRoot":"","sources":["../src/graphql-subscription.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,E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mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAC9E,CAAC;IAED,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAA;QAEb,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE;YACvB,IAAI,CAAC,WAAW,EAAE,CAAA;SACnB;IACH,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAE1B,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,SAAS,CACrC;YACE,KAAK,EAAE,GAAG,CAAA;YACN,KAAK;SACR;SACF,EACD;YACE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAiB,EAAE,EAAE;gBAChC,IAAI,IAAI,EAAE;oBACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;iBACjB;YACH,CAAC;SACF,CACF,CAAA;QAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAChC,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { gql } from 'graphql-tag'\n\nimport { Component, ComponentNature, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\nimport { subscribe } from '@operato/graphql'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n /* origin의 subscription 만을 허용하므로, 엔드포인트 속성은 무시한다. */\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 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\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 super.ready()\n\n if (this.app.isViewMode) {\n this.requestData()\n }\n }\n\n get nature() {\n return NATURE\n }\n\n async requestData() {\n var { query } = this.state\n\n const { unsubscribe } = await subscribe(\n {\n query: gql`\n ${query}\n `\n },\n {\n next: ({ data }: { data: any }) => {\n if (data) {\n this.data = data\n }\n }\n }\n )\n\n this.unsubscribe = unsubscribe\n }\n}\n\nComponent.register('graphql-subscription', GraphqlSubscription)\n"]}