@things-factory/shell 4.0.0-y.0 → 4.0.0
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/bin/things-factory-dev +5 -11
- package/client/graphql-client.js +14 -15
- package/config/config.development.js +12 -1
- package/dist-server/pubsub.js +14 -12
- package/dist-server/pubsub.js.map +1 -1
- package/dist-server/schema.js +4 -4
- package/dist-server/schema.js.map +1 -1
- package/dist-server/server-dev.js +61 -42
- package/dist-server/server-dev.js.map +1 -1
- package/dist-server/server.js +53 -38
- package/dist-server/server.js.map +1 -1
- package/dist-server/service/domain/domain-resolver.js +5 -5
- package/dist-server/service/domain/domain-resolver.js.map +1 -1
- package/dist-server/service/index.js +7 -6
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/utils/condition-builder.js +23 -25
- package/dist-server/utils/condition-builder.js.map +1 -1
- package/dist-server/utils/list-query-builder.js +1 -1
- package/dist-server/utils/list-query-builder.js.map +1 -1
- package/package.json +25 -29
- package/server/pubsub.ts +16 -15
- package/server/schema.ts +5 -5
- package/server/server-dev.ts +55 -36
- package/server/server.ts +47 -31
- package/server/service/domain/domain-resolver.ts +8 -6
- package/server/service/index.ts +12 -5
- package/server/utils/condition-builder.ts +23 -25
- package/server/utils/list-query-builder.ts +1 -1
@@ -11,17 +11,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
11
11
|
};
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
exports.schema = exports.entities = void 0;
|
14
|
+
const directive_transaction_1 = require("./directive-transaction");
|
15
|
+
const domain_1 = require("./domain");
|
16
|
+
const subscription_data_1 = require("./subscription-data");
|
14
17
|
__exportStar(require("./common-types"), exports);
|
15
18
|
__exportStar(require("./domain/domain"), exports);
|
19
|
+
/* EXPORT TYPES */
|
16
20
|
__exportStar(require("./domain/domain-types"), exports);
|
17
|
-
|
18
|
-
const domain_2 = require("./domain");
|
19
|
-
const subscription_data_1 = require("./subscription-data");
|
20
|
-
const directive_transaction_1 = require("./directive-transaction");
|
21
|
+
__exportStar(require("./subscription-data/data-types"), exports);
|
21
22
|
exports.entities = [
|
22
23
|
/* Entities */
|
23
24
|
...domain_1.entities,
|
24
|
-
...
|
25
|
+
...domain_1.entities
|
25
26
|
];
|
26
27
|
exports.schema = {
|
27
28
|
typeDefs: {
|
@@ -30,7 +31,7 @@ exports.schema = {
|
|
30
31
|
resolverClasses: [
|
31
32
|
/* Resolvers */
|
32
33
|
...domain_1.resolvers,
|
33
|
-
...
|
34
|
+
...domain_1.resolvers,
|
34
35
|
...subscription_data_1.resolvers
|
35
36
|
],
|
36
37
|
directives: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,kDAA+B;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mEAAoG;AACpG,qCAKiB;AACjB,2DAA4E;AAE5E,iDAA8B;AAC9B,kDAA+B;AAE/B,kBAAkB;AAClB,wDAAqC;AACrC,iEAA8C;AAEjC,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,iBAAY;IACf,GAAG,iBAAc;CAClB,CAAA;AACY,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,4BAA4B,EAA5B,oDAA4B;KAC7B;IACD,eAAe,EAAE;QACf,eAAe;QACf,GAAG,kBAAa;QAChB,GAAG,kBAAe;QAClB,GAAG,6BAAyB;KAC7B;IACD,UAAU,EAAE;QACV,WAAW,EAAE,oDAA4B;KAC1C;CACF,CAAA"}
|
@@ -11,58 +11,56 @@ const buildCondition = function (alias, fieldName, operator, value, relation, se
|
|
11
11
|
switch (operator) {
|
12
12
|
case 'eq':
|
13
13
|
return {
|
14
|
-
clause:
|
14
|
+
clause: `${alias}.${fieldName} = :args${seq}`,
|
15
15
|
parameters: { [`args${seq}`]: value }
|
16
16
|
};
|
17
17
|
case 'like':
|
18
18
|
return {
|
19
|
-
clause:
|
19
|
+
clause: `${alias}.${fieldName} LIKE :args${seq}`,
|
20
20
|
parameters: { [`args${seq}`]: `${value}` }
|
21
21
|
};
|
22
22
|
case 'i_like':
|
23
23
|
return {
|
24
|
-
clause: `LOWER(
|
24
|
+
clause: `LOWER(${alias}.${fieldName}) LIKE :args${seq}`,
|
25
25
|
parameters: { [`args${seq}`]: `${String(value).toLowerCase()}` }
|
26
26
|
};
|
27
27
|
case 'nlike':
|
28
28
|
return {
|
29
|
-
clause:
|
29
|
+
clause: `${alias}.${fieldName} NOT LIKE :args${seq}`,
|
30
30
|
value: { [`args${seq}`]: `${value}` }
|
31
31
|
};
|
32
32
|
case 'i_nlike':
|
33
33
|
return {
|
34
|
-
clause: `LOWER(
|
34
|
+
clause: `LOWER(${alias}.${fieldName}) NOT LIKE :args${seq}`,
|
35
35
|
value: { [`args${seq}`]: `${String(value).toLowerCase()}` }
|
36
36
|
};
|
37
37
|
case 'lt':
|
38
38
|
return {
|
39
|
-
clause:
|
39
|
+
clause: `${alias}.${fieldName} < :args${seq}`,
|
40
40
|
parameters: { [`args${seq}`]: value }
|
41
41
|
};
|
42
42
|
case 'gt':
|
43
43
|
return {
|
44
|
-
clause:
|
44
|
+
clause: `${alias}.${fieldName} > :args${seq}`,
|
45
45
|
parameters: { [`args${seq}`]: value }
|
46
46
|
};
|
47
47
|
case 'lte':
|
48
48
|
return {
|
49
|
-
clause:
|
49
|
+
clause: `${alias}.${fieldName} <= :args${seq}`,
|
50
50
|
parameters: { [`args${seq}`]: value }
|
51
51
|
};
|
52
52
|
case 'gte':
|
53
53
|
return {
|
54
|
-
clause:
|
54
|
+
clause: `${alias}.${fieldName} >= :args${seq}`,
|
55
55
|
parameters: { [`args${seq}`]: value }
|
56
56
|
};
|
57
57
|
case 'noteq':
|
58
58
|
return {
|
59
|
-
clause:
|
59
|
+
clause: `${alias}.${fieldName} != :args${seq}`,
|
60
60
|
parameters: { [`args${seq}`]: value }
|
61
61
|
};
|
62
62
|
case 'in':
|
63
|
-
const clause = relation
|
64
|
-
? `"${fieldName}"."id" IN (:...args${seq})`
|
65
|
-
: `"${alias}"."${fieldName}" IN (:...args${seq})`;
|
63
|
+
const clause = relation ? `${fieldName}.id IN (:...args${seq})` : `${alias}.${fieldName} IN (:...args${seq})`;
|
66
64
|
value = (value === null || value === void 0 ? void 0 : value.length) ? value : [value];
|
67
65
|
return {
|
68
66
|
clause,
|
@@ -71,54 +69,54 @@ const buildCondition = function (alias, fieldName, operator, value, relation, se
|
|
71
69
|
case 'notin':
|
72
70
|
value = (value === null || value === void 0 ? void 0 : value.length) ? value : [value];
|
73
71
|
return {
|
74
|
-
clause:
|
72
|
+
clause: `${alias}.${fieldName} NOT IN (:...args${seq})`,
|
75
73
|
parameters: { [`args${seq}`]: value }
|
76
74
|
};
|
77
75
|
case 'notin_with_null':
|
78
76
|
value = (value === null || value === void 0 ? void 0 : value.length) ? value : [value];
|
79
77
|
return {
|
80
|
-
clause: `(
|
78
|
+
clause: `(${alias}.${fieldName} IS NULL OR ${alias}.${fieldName} NOT IN (:...args${seq}))`,
|
81
79
|
parameters: { [`args${seq}`]: value }
|
82
80
|
};
|
83
81
|
case 'is_null':
|
84
82
|
return {
|
85
|
-
clause:
|
83
|
+
clause: `${alias}.${fieldName} IS NULL`
|
86
84
|
};
|
87
85
|
case 'is_not_null':
|
88
86
|
return {
|
89
|
-
clause:
|
87
|
+
clause: `${alias}.${fieldName} IS NOT NULL`
|
90
88
|
};
|
91
89
|
case 'is_false':
|
92
90
|
return {
|
93
|
-
clause:
|
91
|
+
clause: `${alias}.${fieldName} IS FALSE`
|
94
92
|
};
|
95
93
|
case 'is_true':
|
96
94
|
return {
|
97
|
-
clause:
|
95
|
+
clause: `${alias}.${fieldName} IS TRUE`
|
98
96
|
};
|
99
97
|
case 'is_not_false':
|
100
98
|
return {
|
101
|
-
clause:
|
99
|
+
clause: `${alias}.${fieldName} IS NOT FALSE`
|
102
100
|
};
|
103
101
|
case 'is_not_true':
|
104
102
|
return {
|
105
|
-
clause:
|
103
|
+
clause: `${alias}.${fieldName} IS NOT TRUE`
|
106
104
|
};
|
107
105
|
case 'is_present':
|
108
106
|
return {
|
109
|
-
clause:
|
107
|
+
clause: `${alias}.${fieldName} IS PRESENT`
|
110
108
|
};
|
111
109
|
case 'is_blank':
|
112
110
|
return {
|
113
|
-
clause:
|
111
|
+
clause: `${alias}.${fieldName} IS BLANK`
|
114
112
|
};
|
115
113
|
case 'is_empty_num_id':
|
116
114
|
return {
|
117
|
-
clause:
|
115
|
+
clause: `${alias}.${fieldName} IS EMPTY NUMERIC ID`
|
118
116
|
};
|
119
117
|
case 'between':
|
120
118
|
return {
|
121
|
-
clause:
|
119
|
+
clause: `${alias}.${fieldName} BETWEEN :args${seq}_1 AND :args${seq}_2`,
|
122
120
|
parameters: { [`args${seq}_1`]: value[0], [`args${seq}_2`]: value[1] }
|
123
121
|
};
|
124
122
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-builder.js","sourceRoot":"","sources":["../../server/utils/condition-builder.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AAEf,MAAM,cAAc,GAAG,UAC5B,KAAa,EACb,SAAiB,EACjB,QAAgB,EAChB,KAAU,EACV,QAAiB,EACjB,GAAW;IAEX,GAAG,EAAE,CAAA;IAEL,SAAS,GAAG,gBAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IAElC,QAAQ,QAAQ,EAAE;QAChB,KAAK,IAAI;YACP,OAAO;gBACL,MAAM,EAAE,
|
1
|
+
{"version":3,"file":"condition-builder.js","sourceRoot":"","sources":["../../server/utils/condition-builder.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AAEf,MAAM,cAAc,GAAG,UAC5B,KAAa,EACb,SAAiB,EACjB,QAAgB,EAChB,KAAU,EACV,QAAiB,EACjB,GAAW;IAEX,G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AAO;gBACL,MAAM,EAAE,GAAG,KAAK,IAAI,SAAS,WAAW;aACzC,CAAA;QACH,KAAK,iBAAiB;YACpB,OAAO;gBACL,MAAM,EAAE,GAAG,KAAK,IAAI,SAAS,sBAAsB;aACpD,CAAA;QAEH,KAAK,SAAS;YACZ,OAAO;gBACL,MAAM,EAAE,GAAG,KAAK,IAAI,SAAS,kBAAkB,GAAG,eAAe,GAAG,IAAI;gBACxE,UAAU,EAAE,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;aACvE,CAAA;KACJ;AACH,CAAC,CAAA;AAzIY,QAAA,cAAc,kBAyI1B"}
|
@@ -17,7 +17,7 @@ const buildQuery = function (queryBuilder, params, context, domainRef = true) {
|
|
17
17
|
});
|
18
18
|
}
|
19
19
|
if (domainRef) {
|
20
|
-
queryBuilder.andWhere(
|
20
|
+
queryBuilder.andWhere(`${queryBuilder.alias}.domain = :domainId`, { domainId });
|
21
21
|
}
|
22
22
|
if (pagination && pagination.page > 0 && pagination.limit > 0) {
|
23
23
|
queryBuilder.skip(pagination.limit * (pagination.page - 1));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"list-query-builder.js","sourceRoot":"","sources":["../../server/utils/list-query-builder.ts"],"names":[],"mappings":";;;AAAA,2DAAoD;AAE7C,MAAM,UAAU,GAAG,UAAU,YAAiB,EAAE,MAAW,EAAE,OAAY,EAAE,YAAqB,IAAI;IACzG,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;IAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAA;IACpC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;IAChC,MAAM,QAAQ,GAAG,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,E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CAAC,IAAI,EAAE,CAAA;YAC7G,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;aAC/D;iBAAM;gBACL,YAAY,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;aAClE;QACH,CAAC,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAzCY,QAAA,UAAU,cAyCtB"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/shell",
|
3
|
-
"version": "4.0.0
|
3
|
+
"version": "4.0.0",
|
4
4
|
"description": "Core module for framework",
|
5
5
|
"bin": {
|
6
6
|
"things-factory": "bin/things-factory",
|
@@ -31,9 +31,11 @@
|
|
31
31
|
"test": "NODE_ENV=test jest"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
+
"@apollo/client": "^3.4.17",
|
34
35
|
"@graphql-tools/merge": "^7.0.0",
|
35
|
-
"@graphql-tools/
|
36
|
-
"@
|
36
|
+
"@graphql-tools/schema": "^8.2.0",
|
37
|
+
"@graphql-tools/utils": "^8.3.0",
|
38
|
+
"@hatiolab/things-scene": "^2.7.11",
|
37
39
|
"@koa/cors": "^3.1.0",
|
38
40
|
"@material/mwc-button": "^0.22.1",
|
39
41
|
"@material/mwc-fab": "^0.22.1",
|
@@ -41,18 +43,15 @@
|
|
41
43
|
"@material/mwc-icon-button": "^0.22.1",
|
42
44
|
"@material/mwc-slider": "^0.22.1",
|
43
45
|
"@material/mwc-textfield": "^0.22.1",
|
44
|
-
"@things-factory/
|
45
|
-
"@things-factory/
|
46
|
-
"@things-factory/
|
47
|
-
"@
|
48
|
-
"
|
49
|
-
"apollo-
|
50
|
-
"apollo-
|
51
|
-
"apollo-
|
52
|
-
"apollo-
|
53
|
-
"apollo-link-http": "^1.5.17",
|
54
|
-
"apollo-server-koa": "^2.25.2",
|
55
|
-
"apollo-upload-client": "^12.1.0",
|
46
|
+
"@things-factory/ejs-remote": "^4.0.0-beta.2",
|
47
|
+
"@things-factory/env": "^4.0.0-beta.2",
|
48
|
+
"@things-factory/styles": "^4.0.0-beta.2",
|
49
|
+
"@things-factory/utils": "^4.0.0-beta.2",
|
50
|
+
"@webcomponents/webcomponentsjs": "^2.6.0",
|
51
|
+
"apollo-server-core": "^3.4.0",
|
52
|
+
"apollo-server-koa": "^3.4.0",
|
53
|
+
"apollo-server-types": "^3.4.0",
|
54
|
+
"apollo-upload-client": "^16.0.0",
|
56
55
|
"args": "^5.0.0",
|
57
56
|
"broadcastchannel-polyfill": "^1.0.1",
|
58
57
|
"chalk": "^4.1.0",
|
@@ -63,31 +62,29 @@
|
|
63
62
|
"firebase": "^8.0.1",
|
64
63
|
"fs-extra": "^9.0.1",
|
65
64
|
"glob": "^7.1.6",
|
66
|
-
"graphql": "^15.
|
65
|
+
"graphql": "^15.6.1",
|
67
66
|
"graphql-mqtt-subscriptions": "^1.2.0",
|
68
67
|
"graphql-redis-subscriptions": "^2.4.0",
|
69
|
-
"graphql-subscriptions": "^
|
70
|
-
"graphql-tag": "^2.12.
|
68
|
+
"graphql-subscriptions": "^2.0.0",
|
69
|
+
"graphql-tag": "^2.12.6",
|
71
70
|
"graphql-upload": "^12.0.0",
|
72
71
|
"haunted": "^4.8.2",
|
73
|
-
"headroom.js": "^0.12.0",
|
74
72
|
"html-webpack-plugin": "^4.3.0",
|
75
73
|
"husky": "7.0.1",
|
76
74
|
"imports-loader": "^3.0.0",
|
77
|
-
"inquirer": "^8.
|
78
|
-
"ioredis": "^4.
|
75
|
+
"inquirer": "^8.2.0",
|
76
|
+
"ioredis": "^4.28.0",
|
79
77
|
"json5": "^2.2.0",
|
80
|
-
"koa": "^2.13.
|
78
|
+
"koa": "^2.13.4",
|
81
79
|
"koa-bodyparser": "^4.2.0",
|
82
|
-
"koa-ejs-remote": "^1.1.6",
|
83
80
|
"koa-ip": "^2.1.0",
|
84
81
|
"koa-router": "^7.4.0",
|
85
82
|
"koa-send": "^5.0.0",
|
86
83
|
"koa-static": "^5.0.0",
|
87
84
|
"koa-unless": "^1.0.7",
|
88
|
-
"koa-webpack": "^
|
85
|
+
"koa-webpack": "^6.0.0",
|
89
86
|
"koa2-connect-history-api-fallback": "^0.1.2",
|
90
|
-
"lit-element": "^
|
87
|
+
"lit-element": "^3.0.1",
|
91
88
|
"loader-utils": "^2.0.0",
|
92
89
|
"lodash": "^4.17.15",
|
93
90
|
"mkdirp": "^1.0.3",
|
@@ -102,14 +99,13 @@
|
|
102
99
|
"redux": "^4.0.0",
|
103
100
|
"redux-thunk": "^2.3.0",
|
104
101
|
"regenerator-runtime": "^0.13.2",
|
105
|
-
"require-json5": "^1.1.0",
|
106
102
|
"reselect": "^4.0.0",
|
107
103
|
"scrollbooster": "^3.0.2",
|
108
|
-
"subscriptions-transport-ws": "^0.
|
104
|
+
"subscriptions-transport-ws": "^0.11.0",
|
109
105
|
"sweetalert2": "^10.9.0",
|
110
106
|
"swipe-listener": "^1.3.0",
|
111
107
|
"type-graphql": "^1.1.1",
|
112
|
-
"typeorm": "
|
108
|
+
"typeorm": "0.2.38",
|
113
109
|
"web-animations-js": "^2.3.2",
|
114
110
|
"web-push": "^3.4.5",
|
115
111
|
"webfontloader": "^1.6.28"
|
@@ -124,5 +120,5 @@
|
|
124
120
|
"resolutions": {
|
125
121
|
"core-js": "^3.16.0"
|
126
122
|
},
|
127
|
-
"gitHead": "
|
123
|
+
"gitHead": "435f0731c09ba124ed608580f3cdfb722f5ab891"
|
128
124
|
}
|
package/server/pubsub.ts
CHANGED
@@ -1,22 +1,14 @@
|
|
1
|
-
import {
|
2
|
-
const { middleware, host, port, options } = config.get('pubsub', {})
|
3
|
-
|
4
|
-
import { PubSub } from 'graphql-subscriptions'
|
1
|
+
import { MQTTPubSub } from 'graphql-mqtt-subscriptions'
|
5
2
|
import { RedisPubSub } from 'graphql-redis-subscriptions'
|
3
|
+
import { PubSub } from 'graphql-subscriptions'
|
6
4
|
import Redis from 'ioredis'
|
7
|
-
|
8
5
|
import { connect } from 'mqtt'
|
9
|
-
import { MQTTPubSub } from 'graphql-mqtt-subscriptions'
|
10
6
|
|
11
|
-
|
7
|
+
import { config } from '@things-factory/env'
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
debug('payload', payload)
|
17
|
-
return super.publish(trigger, JSON.stringify(payload))
|
18
|
-
}
|
19
|
-
}
|
9
|
+
const { middleware, host, port, nodes, options } = config.get('pubsub', {})
|
10
|
+
|
11
|
+
const debug = require('debug')('things-factory:shell')
|
20
12
|
|
21
13
|
let pubsub: any
|
22
14
|
|
@@ -39,12 +31,21 @@ switch (middleware) {
|
|
39
31
|
},
|
40
32
|
...options
|
41
33
|
}
|
42
|
-
pubsub = new
|
34
|
+
pubsub = new RedisPubSub({
|
43
35
|
publisher: new Redis(redisOption),
|
44
36
|
subscriber: new Redis(redisOption)
|
45
37
|
})
|
38
|
+
break
|
39
|
+
case 'redisCluster':
|
40
|
+
const cluster = new Redis.Cluster(nodes, options)
|
41
|
+
pubsub = new RedisPubSub({
|
42
|
+
publisher: cluster,
|
43
|
+
subscriber: cluster
|
44
|
+
})
|
45
|
+
break
|
46
46
|
default:
|
47
47
|
pubsub = new PubSub()
|
48
|
+
break
|
48
49
|
}
|
49
50
|
|
50
51
|
export { pubsub }
|
package/server/schema.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
import { deepMerge } from '@things-factory/utils'
|
1
|
+
import { loader, orderedModuleNames } from '@things-factory/env'
|
2
|
+
|
4
3
|
import { GraphQLSchema } from 'graphql'
|
5
4
|
import { GraphQLUpload } from 'graphql-upload'
|
6
|
-
|
7
|
-
import {
|
5
|
+
import { buildSchema } from 'type-graphql'
|
6
|
+
import { deepMerge } from '@things-factory/utils'
|
7
|
+
import { mergeSchemas } from '@graphql-tools/schema'
|
8
8
|
|
9
9
|
export async function schema() {
|
10
10
|
const schemas = orderedModuleNames
|
package/server/server-dev.ts
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
process.env.NODE_ENV = 'development'
|
2
2
|
process.setMaxListeners(0)
|
3
3
|
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import koaBodyParser from 'koa-bodyparser'
|
9
|
-
import { historyApiFallback } from 'koa2-connect-history-api-fallback'
|
10
|
-
|
11
|
-
import koaWebpack from 'koa-webpack'
|
4
|
+
import { ConnectionContext, SubscriptionServer } from 'subscriptions-transport-ws'
|
5
|
+
import { config, loader, logger, orderedModuleNames } from '@things-factory/env'
|
6
|
+
import { domainPrivateRouter, domainPublicRouter, globalPrivateRouter, globalPublicRouter } from './routers'
|
7
|
+
import { execute, subscribe } from 'graphql'
|
12
8
|
|
13
9
|
import { ApolloServer } from 'apollo-server-koa'
|
14
|
-
import {
|
15
|
-
|
10
|
+
import { ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core'
|
11
|
+
import { GraphqlLocalClient } from './graphql-local-client'
|
12
|
+
import Koa from 'koa'
|
16
13
|
import co from 'co'
|
17
14
|
import compose from 'koa-compose'
|
18
|
-
|
19
|
-
import {
|
20
|
-
|
15
|
+
import cors from '@koa/cors'
|
16
|
+
import { createServer } from 'http'
|
21
17
|
import { databaseInitializer } from './initializers/database'
|
22
|
-
import {
|
23
|
-
import {
|
24
|
-
|
18
|
+
import { graphqlUploadKoa } from 'graphql-upload'
|
19
|
+
import { historyApiFallback } from 'koa2-connect-history-api-fallback'
|
20
|
+
import ip from 'koa-ip'
|
21
|
+
import koaBodyParser from 'koa-bodyparser'
|
22
|
+
import koaStatic from 'koa-static'
|
23
|
+
import koaWebpack from 'koa-webpack'
|
25
24
|
import { schema } from './schema'
|
26
25
|
|
27
26
|
const debug = require('debug')('things-factory:shell:server-dev')
|
@@ -32,7 +31,7 @@ args.option('port', 'The port on which the app will be running', config.get('por
|
|
32
31
|
args.option(
|
33
32
|
'inspect',
|
34
33
|
`The address on which the inspection will be running. Used in development mode only.
|
35
|
-
This option is just to
|
34
|
+
This option is just to prevent termination for reasons of not recognizing the 'inspect' option.`,
|
36
35
|
config.get('inspect', ':9229')
|
37
36
|
)
|
38
37
|
|
@@ -91,13 +90,15 @@ const bootstrap = async () => {
|
|
91
90
|
|
92
91
|
const builtSchema = await schema()
|
93
92
|
|
94
|
-
const
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
93
|
+
const httpServer = createServer(app.callback())
|
94
|
+
|
95
|
+
const subscriptionServer = SubscriptionServer.create(
|
96
|
+
{
|
97
|
+
schema: builtSchema,
|
98
|
+
// These are imported from `graphql`.
|
99
|
+
execute,
|
100
|
+
subscribe,
|
101
|
+
async onConnect(connectionParams: Object, webSocket: WebSocket, context: ConnectionContext) {
|
101
102
|
var { request } = context
|
102
103
|
|
103
104
|
var url = new URL((connectionParams['headers'] || connectionParams).referer)
|
@@ -121,6 +122,14 @@ const bootstrap = async () => {
|
|
121
122
|
return koacontext
|
122
123
|
}
|
123
124
|
},
|
125
|
+
{
|
126
|
+
server: httpServer,
|
127
|
+
path: '/subscriptions'
|
128
|
+
}
|
129
|
+
)
|
130
|
+
|
131
|
+
const server = new ApolloServer({
|
132
|
+
schema: builtSchema,
|
124
133
|
formatError: error => {
|
125
134
|
logger.error(error)
|
126
135
|
return error
|
@@ -129,20 +138,33 @@ const bootstrap = async () => {
|
|
129
138
|
// logger.info('response %s', JSON.stringify(response, null, 2))
|
130
139
|
return response
|
131
140
|
},
|
132
|
-
playground: {
|
133
|
-
settings: {
|
134
|
-
'request.credentials': 'include'
|
135
|
-
}
|
136
|
-
},
|
137
141
|
context: async ({ connection, ctx }) => {
|
138
142
|
if (connection) {
|
139
143
|
return connection.context
|
140
144
|
} else {
|
141
145
|
return ctx
|
142
146
|
}
|
143
|
-
}
|
147
|
+
},
|
148
|
+
plugins: [
|
149
|
+
ApolloServerPluginLandingPageGraphQLPlayground({
|
150
|
+
settings: {
|
151
|
+
'request.credentials': 'same-origin'
|
152
|
+
}
|
153
|
+
}),
|
154
|
+
{
|
155
|
+
async serverWillStart() {
|
156
|
+
return {
|
157
|
+
async drainServer() {
|
158
|
+
subscriptionServer.close()
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
]
|
144
164
|
})
|
145
165
|
|
166
|
+
server.start()
|
167
|
+
|
146
168
|
GraphqlLocalClient.init(builtSchema, app)
|
147
169
|
|
148
170
|
orderedModuleNames.forEach(name => {
|
@@ -150,7 +172,7 @@ const bootstrap = async () => {
|
|
150
172
|
initMiddlewares && initMiddlewares(app)
|
151
173
|
})
|
152
174
|
|
153
|
-
const render = require('
|
175
|
+
const render = require('@things-factory/ejs-remote')
|
154
176
|
render(app, {
|
155
177
|
root: '/views',
|
156
178
|
host: `http://127.0.0.1:${PORT}`,
|
@@ -210,15 +232,12 @@ const bootstrap = async () => {
|
|
210
232
|
})
|
211
233
|
)
|
212
234
|
|
213
|
-
|
214
|
-
const httpServer = app.listen({ port: PORT }, () => {
|
235
|
+
httpServer.listen({ port: PORT }, () => {
|
215
236
|
logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}${server.graphqlPath}`)
|
216
|
-
logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${
|
237
|
+
logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${'/subscriptions'}`)
|
217
238
|
|
218
239
|
process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)
|
219
240
|
})
|
220
|
-
|
221
|
-
server.installSubscriptionHandlers(httpServer)
|
222
241
|
}
|
223
242
|
|
224
243
|
bootstrap()
|