@things-factory/shell 5.0.0-zeta.19 → 5.0.0-zeta.21
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/client/elements/oops-progress.js +2 -1
- package/client/index.js +1 -5
- package/client/route.js +1 -1
- package/client/store.js +6 -14
- package/dist-server/schema.js +4 -4
- package/dist-server/schema.js.map +1 -1
- package/dist-server/server-dev.js +32 -25
- package/dist-server/server-dev.js.map +1 -1
- package/dist-server/server.js +35 -23
- package/dist-server/server.js.map +1 -1
- package/dist-server/service/common-types/scalar-date.js.map +1 -1
- package/package.json +23 -22
- package/server/schema.ts +4 -4
- package/server/server-dev.ts +35 -27
- package/server/server.ts +38 -24
- package/server/service/common-types/scalar-date.ts +1 -1
- package/things-factory.config.js +0 -4
- package/client/app/app-style.js +0 -69
- package/client/app/app.js +0 -225
- package/client/app/pages/page-404.js +0 -59
- package/client/module-importer.import +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
import gql from 'graphql-tag'
|
1
2
|
import { html, LitElement } from 'lit'
|
2
3
|
|
3
4
|
import { subscribe } from '@operato/graphql'
|
@@ -40,7 +41,7 @@ export class OopsProgress extends LitElement {
|
|
40
41
|
|
41
42
|
this._subscription = await subscribe(
|
42
43
|
{
|
43
|
-
query: `
|
44
|
+
query: gql`
|
44
45
|
subscription {
|
45
46
|
data(tag: "${this.tag}") {
|
46
47
|
tag
|
package/client/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import 'broadcastchannel-polyfill'
|
2
|
-
import '
|
2
|
+
import '@operato/shell/app.js'
|
3
3
|
|
4
4
|
/* Export ENV */
|
5
5
|
export const PROCESS = {
|
@@ -20,7 +20,3 @@ export * from './indexdb'
|
|
20
20
|
|
21
21
|
// elements
|
22
22
|
export * from './elements'
|
23
|
-
|
24
|
-
// Redux assumes `process.env.NODE_ENV` exists in the ES module build.
|
25
|
-
// https://github.com/reactjs/redux/issues/2907
|
26
|
-
window.process = { env: { NODE_ENV: 'production' } }
|
package/client/route.js
CHANGED
package/client/store.js
CHANGED
@@ -1,20 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
import thunk from 'redux-thunk'
|
3
|
-
import { lazyReducerEnhancer } from 'pwa-helpers/lazy-reducer-enhancer.js'
|
1
|
+
import { configureStore } from 'redux';
|
4
2
|
|
5
|
-
import app from './reducers/app.js'
|
6
|
-
import route from './reducers/route.js'
|
3
|
+
import app from './reducers/app.js';
|
4
|
+
import route from './reducers/route.js';
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
export const store = createStore(
|
13
|
-
state => state,
|
14
|
-
devCompose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))
|
15
|
-
)
|
6
|
+
export const store = configureStore({
|
7
|
+
devTools: process.env['NODE-ENV'] !== 'production'
|
8
|
+
})
|
16
9
|
|
17
|
-
// Initially loaded reducers.
|
18
10
|
store.addReducers({
|
19
11
|
app,
|
20
12
|
route
|
package/dist-server/schema.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.schema = void 0;
|
4
|
-
const
|
5
|
-
const graphql_upload_1 = require("graphql-upload");
|
4
|
+
const GraphQLUpload_js_1 = require("graphql-upload/GraphQLUpload.js");
|
6
5
|
const type_graphql_1 = require("type-graphql");
|
7
|
-
const utils_1 = require("@things-factory/utils");
|
8
6
|
const schema_1 = require("@graphql-tools/schema");
|
7
|
+
const env_1 = require("@things-factory/env");
|
8
|
+
const utils_1 = require("@things-factory/utils");
|
9
9
|
async function schema() {
|
10
10
|
const schemas = env_1.orderedModuleNames
|
11
11
|
.map(dep => (0, env_1.loader)(dep).schema)
|
@@ -89,7 +89,7 @@ async function schema() {
|
|
89
89
|
delete resolvers.Mutation;
|
90
90
|
delete resolvers.Subscription;
|
91
91
|
delete resolvers.Directive;
|
92
|
-
resolvers = Object.assign({ Upload:
|
92
|
+
resolvers = Object.assign({ Upload: GraphQLUpload_js_1.GraphQLUpload, Query: (0, utils_1.deepMerge)(Query, queryResolvers), Mutation: (0, utils_1.deepMerge)(Mutation, mutationResolvers), Subscription: (0, utils_1.deepMerge)(Subscription, subscriptionResolvers) }, resolvers);
|
93
93
|
var merged = (0, schema_1.mergeSchemas)({
|
94
94
|
schemas: [
|
95
95
|
await (0, type_graphql_1.buildSchema)({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../server/schema.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../server/schema.ts"],"names":[],"mappings":";;;AACA,sEAA+D;AAC/D,+CAA0C;AAE1C,kDAAoD;AACpD,6CAAgE;AAChE,iDAAiD;AAE1C,KAAK,UAAU,MAAM;IAC1B,MAAM,OAAO,GAAG,wBAAkB;SAC/B,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAA,YAAM,EAAC,GAAG,CAAC,CAAC,MAAM,CAAC;SAC9B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC;SACxB,MAAM,CACL,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACd,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;QAChE,IAAI,EACF,QAAQ,EAAE,SAAS,GAAG,EAAE,EACxB,SAAS,EAAE,UAAU,GAAG,EAAE,EAC1B,eAAe,EAAE,gBAAgB,GAAG,EAAE,EACtC,UAAU,EAAE,WAAW,GAAG,EAAE,EAC7B,GAAG,MAAM,CAAA;QAEV,OAAO;YACL,QAAQ,EAAE,IAAA,iBAAS,EAAC,QAAQ,EAAE,SAAS,CAAC;YACxC,SAAS,EAAE,IAAA,iBAAS,EAAC,SAAS,EAAE,UAAU,CAAC;YAC3C,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE,GAAG,CAAC,gBAAgB,IAAI,EA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AE,qBAAqB,CAAC,IACzD,SAAS,CACb,CAAA;IAED,IAAI,MAAM,GAAG,IAAA,qBAAY,EAAC;QACxB,OAAO,EAAE;YACP,MAAM,IAAA,0BAAW,EAAC;gBAChB,SAAS,EAAE,OAAO,CAAC,eAAe;gBAClC,cAAc,EAAE,WAAW;aAC5B,CAAC;SACH;QACD,QAAQ;QACR,SAAS;KACV,CAAC,CAAA;IAEF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,SAAwC,EAAE,EAAE;QACjF,MAAM,GAAG,SAAS,CAAC,MAAM,CAAQ,CAAA;IACnC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC;AApJD,wBAoJC"}
|
@@ -1,28 +1,26 @@
|
|
1
1
|
"use strict";
|
2
|
+
// ts-import-sorter: disable
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
5
|
};
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
/* following lines should be located in top of the file */
|
7
|
-
// @prettier-ignore
|
7
|
+
/* following 2 lines should be located in top of the file */
|
8
8
|
process.env.NODE_ENV = 'development';
|
9
9
|
process.setMaxListeners(0);
|
10
|
-
/* following lines should be located in top of the file */
|
11
10
|
const apollo_server_core_1 = require("apollo-server-core");
|
12
11
|
const apollo_server_koa_1 = require("apollo-server-koa");
|
13
12
|
const bytes_1 = __importDefault(require("bytes"));
|
14
|
-
const
|
15
|
-
const
|
16
|
-
const graphql_upload_1 = require("graphql-upload");
|
13
|
+
const graphqlUploadKoa_js_1 = __importDefault(require("graphql-upload/graphqlUploadKoa.js"));
|
14
|
+
const ws_1 = require("graphql-ws/lib/use/ws");
|
17
15
|
const http_1 = require("http");
|
18
16
|
const koa_1 = __importDefault(require("koa"));
|
19
17
|
const koa_bodyparser_1 = __importDefault(require("koa-bodyparser"));
|
20
|
-
const koa_compose_1 = __importDefault(require("koa-compose"));
|
21
18
|
const koa_ip_1 = __importDefault(require("koa-ip"));
|
22
19
|
const koa_static_1 = __importDefault(require("koa-static"));
|
20
|
+
const koa_compose_1 = __importDefault(require("koa-compose"));
|
23
21
|
const koa2_connect_history_api_fallback_1 = require("koa2-connect-history-api-fallback");
|
24
|
-
|
25
|
-
const
|
22
|
+
const ws_2 = require("ws");
|
23
|
+
const co_1 = __importDefault(require("co"));
|
26
24
|
const koa_webpack_1 = __importDefault(require("@hatiolab/koa-webpack"));
|
27
25
|
const cors_1 = __importDefault(require("@koa/cors"));
|
28
26
|
const env_1 = require("@things-factory/env");
|
@@ -85,13 +83,19 @@ const bootstrap = async () => {
|
|
85
83
|
process.emit('bootstrap-module-subscription', app, subscriptionMiddleware);
|
86
84
|
const builtSchema = await (0, schema_1.schema)();
|
87
85
|
const httpServer = (0, http_1.createServer)(app.callback());
|
88
|
-
const
|
86
|
+
const websocketServer = new ws_2.WebSocketServer({
|
87
|
+
server: httpServer,
|
88
|
+
path: '/graphql'
|
89
|
+
});
|
90
|
+
// Save the returned server's info so we can shut down this server later
|
91
|
+
const serverCleanup = (0, ws_1.useServer)({
|
89
92
|
schema: builtSchema,
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
async
|
94
|
-
var {
|
93
|
+
context: async (ctx, msg, args) => {
|
94
|
+
return ctx['context'];
|
95
|
+
},
|
96
|
+
onConnect: async (ctx) => {
|
97
|
+
var { extra, connectionParams } = ctx;
|
98
|
+
var { request } = extra;
|
95
99
|
var url = new URL((connectionParams['headers'] || connectionParams).referer);
|
96
100
|
var accessToken = url.searchParams.get('access_token');
|
97
101
|
connectionParams['headers']['authorization'] = accessToken;
|
@@ -102,12 +106,15 @@ const bootstrap = async () => {
|
|
102
106
|
var middlewares = [...subscriptionMiddleware];
|
103
107
|
const fn = co_1.default.wrap((0, koa_compose_1.default)(middlewares));
|
104
108
|
await fn(koacontext);
|
105
|
-
return koacontext;
|
109
|
+
return (ctx['context'] = koacontext);
|
110
|
+
},
|
111
|
+
onDisconnect(ctx, code, reason) {
|
112
|
+
console.log('Disconnected!');
|
113
|
+
},
|
114
|
+
onError(ctx, msg, errors) {
|
115
|
+
console.error(msg, errors);
|
106
116
|
}
|
107
|
-
},
|
108
|
-
server: httpServer,
|
109
|
-
path: '/subscriptions'
|
110
|
-
});
|
117
|
+
}, websocketServer);
|
111
118
|
const server = new apollo_server_koa_1.ApolloServer({
|
112
119
|
schema: builtSchema,
|
113
120
|
formatError: error => {
|
@@ -115,7 +122,6 @@ const bootstrap = async () => {
|
|
115
122
|
return error;
|
116
123
|
},
|
117
124
|
formatResponse: response => {
|
118
|
-
// logger.info('response %s', JSON.stringify(response, null, 2))
|
119
125
|
return response;
|
120
126
|
},
|
121
127
|
context: async ({ connection, ctx }) => {
|
@@ -132,11 +138,12 @@ const bootstrap = async () => {
|
|
132
138
|
'request.credentials': 'same-origin'
|
133
139
|
}
|
134
140
|
}),
|
141
|
+
(0, apollo_server_core_1.ApolloServerPluginDrainHttpServer)({ httpServer }),
|
135
142
|
{
|
136
143
|
async serverWillStart() {
|
137
144
|
return {
|
138
145
|
async drainServer() {
|
139
|
-
|
146
|
+
await serverCleanup.dispose();
|
140
147
|
}
|
141
148
|
};
|
142
149
|
}
|
@@ -171,7 +178,7 @@ const bootstrap = async () => {
|
|
171
178
|
process.emit('client-rebuilt', app, compiler.outputFileSystem);
|
172
179
|
});
|
173
180
|
app.use((0, koa_bodyparser_1.default)(bodyParserOption));
|
174
|
-
app.use((0,
|
181
|
+
app.use((0, graphqlUploadKoa_js_1.default)(fileUploadOption));
|
175
182
|
app.use(server.getMiddleware({
|
176
183
|
path: '/graphql'
|
177
184
|
}));
|
@@ -189,7 +196,7 @@ const bootstrap = async () => {
|
|
189
196
|
.use(routers_1.domainPublicRouter.allowedMethods())
|
190
197
|
.use(routers_1.domainPrivateRouter.routes())
|
191
198
|
.use(routers_1.domainPrivateRouter.allowedMethods());
|
192
|
-
/* should
|
199
|
+
/* should follow this order : history-fallback => webpack-middleware => koaStatic */
|
193
200
|
app.use((0, koa2_connect_history_api_fallback_1.historyApiFallback)({ whiteList: [] }));
|
194
201
|
app.use(middleware);
|
195
202
|
app.use((0, koa_static_1.default)(compiler.outputPath, {
|
@@ -197,7 +204,7 @@ const bootstrap = async () => {
|
|
197
204
|
}));
|
198
205
|
httpServer.listen({ port: PORT }, () => {
|
199
206
|
env_1.logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}${server.graphqlPath}`);
|
200
|
-
env_1.logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${
|
207
|
+
env_1.logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${server.graphqlPath}`);
|
201
208
|
process.emit('bootstrap-module-start', { app, config: env_1.config, builtSchema, httpServer });
|
202
209
|
});
|
203
210
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"server-dev.js","sourceRoot":"","sources":["../server/server-dev.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"server-dev.js","sourceRoot":"","sources":["../server/server-dev.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;;AAE5B,4DAA4D;AAC5D,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,aAAa,CAAA;AACpC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;AAE1B,2DAAsH;AACtH,yDAAgD;AAChD,kDAA+B;AAC/B,6FAAiE;AACjE,8CAAiD;AACjD,+BAAmC;AACnC,8CAAqB;AACrB,oEAA0C;AAC1C,oDAAuB;AACvB,4DAAkC;AAClC,8DAAiC;AACjC,yFAAsE;AACtE,2BAAoC;AACpC,4CAAmB;AAEnB,wEAA8C;AAC9C,qDAA4B;AAC5B,6CAAgF;AAEhF,iEAA2D;AAC3D,sDAA6D;AAC7D,uCAA4G;AAC5G,qCAAiC;AAEjC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE;IACtC,YAAM,CAAC,KAA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C,CAAA;QAElF,OAAO,CAAC,IAAI,CAAC,wBAA+B,EAAE,EAAE,GAAG,EAAE,MAAM,EAAN,YAAM,EAAE,WAAW,EAAE,UAAU,EAAS,CAAC,CAAA;IAChG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,EAAE,CAAA"}
|
package/dist-server/server.js
CHANGED
@@ -1,24 +1,26 @@
|
|
1
1
|
"use strict";
|
2
|
+
// ts-import-sorter: disable
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
5
|
};
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
|
7
|
+
/* following 2 lines should be located in top of the file */
|
7
8
|
process.env.NODE_ENV = 'production';
|
8
9
|
process.setMaxListeners(0);
|
10
|
+
const apollo_server_core_1 = require("apollo-server-core");
|
9
11
|
const apollo_server_koa_1 = require("apollo-server-koa");
|
10
12
|
const bytes_1 = __importDefault(require("bytes"));
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const graphql_upload_1 = require("graphql-upload");
|
13
|
+
const graphqlUploadKoa_js_1 = __importDefault(require("graphql-upload/graphqlUploadKoa.js"));
|
14
|
+
const ws_1 = require("graphql-ws/lib/use/ws");
|
14
15
|
const http_1 = require("http");
|
15
16
|
const koa_1 = __importDefault(require("koa"));
|
16
17
|
const koa_bodyparser_1 = __importDefault(require("koa-bodyparser"));
|
17
|
-
const koa_compose_1 = __importDefault(require("koa-compose"));
|
18
18
|
const koa_ip_1 = __importDefault(require("koa-ip"));
|
19
19
|
const koa_static_1 = __importDefault(require("koa-static"));
|
20
|
+
const koa_compose_1 = __importDefault(require("koa-compose"));
|
20
21
|
const koa2_connect_history_api_fallback_1 = require("koa2-connect-history-api-fallback");
|
21
|
-
const
|
22
|
+
const ws_2 = require("ws");
|
23
|
+
const co_1 = __importDefault(require("co"));
|
22
24
|
const cors_1 = __importDefault(require("@koa/cors"));
|
23
25
|
const env_1 = require("@things-factory/env");
|
24
26
|
const graphql_local_client_1 = require("./graphql-local-client");
|
@@ -74,29 +76,38 @@ const bootstrap = async () => {
|
|
74
76
|
process.emit('bootstrap-module-subscription', app, subscriptionMiddleware);
|
75
77
|
const builtSchema = await (0, schema_1.schema)();
|
76
78
|
const httpServer = (0, http_1.createServer)(app.callback());
|
77
|
-
const
|
79
|
+
const websocketServer = new ws_2.WebSocketServer({
|
80
|
+
server: httpServer,
|
81
|
+
path: '/graphql'
|
82
|
+
});
|
83
|
+
// Save the returned server's info so we can shut down this server later
|
84
|
+
const serverCleanup = (0, ws_1.useServer)({
|
78
85
|
schema: builtSchema,
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
async
|
83
|
-
var {
|
86
|
+
context: async (ctx, msg, args) => {
|
87
|
+
return ctx['context'];
|
88
|
+
},
|
89
|
+
onConnect: async (ctx) => {
|
90
|
+
var { extra, connectionParams } = ctx;
|
91
|
+
var { request } = extra;
|
84
92
|
var url = new URL((connectionParams['headers'] || connectionParams).referer);
|
85
93
|
var accessToken = url.searchParams.get('access_token');
|
86
94
|
connectionParams['headers']['authorization'] = accessToken;
|
87
95
|
request.headers = Object.assign(Object.assign({}, request.headers), (connectionParams['headers'] || connectionParams));
|
88
|
-
/* in case connect error(like a authentication error) just throw exception */
|
89
96
|
var koacontext = await app.createContext(request, {});
|
90
97
|
koacontext['state'] = {};
|
98
|
+
/* in case connect error(like a authentication error) just throw exception */
|
91
99
|
var middlewares = [...subscriptionMiddleware];
|
92
100
|
const fn = co_1.default.wrap((0, koa_compose_1.default)(middlewares));
|
93
101
|
await fn(koacontext);
|
94
|
-
return koacontext;
|
102
|
+
return (ctx['context'] = koacontext);
|
103
|
+
},
|
104
|
+
onDisconnect(ctx, code, reason) {
|
105
|
+
console.log('Disconnected!');
|
106
|
+
},
|
107
|
+
onError(ctx, msg, errors) {
|
108
|
+
console.error(msg, errors);
|
95
109
|
}
|
96
|
-
},
|
97
|
-
server: httpServer,
|
98
|
-
path: '/subscriptions'
|
99
|
-
});
|
110
|
+
}, websocketServer);
|
100
111
|
const server = new apollo_server_koa_1.ApolloServer({
|
101
112
|
schema: builtSchema,
|
102
113
|
formatError: error => {
|
@@ -117,18 +128,19 @@ const bootstrap = async () => {
|
|
117
128
|
}
|
118
129
|
},
|
119
130
|
plugins: [
|
131
|
+
(0, apollo_server_core_1.ApolloServerPluginDrainHttpServer)({ httpServer }),
|
120
132
|
{
|
121
133
|
async serverWillStart() {
|
122
134
|
return {
|
123
135
|
async drainServer() {
|
124
|
-
|
136
|
+
await serverCleanup.dispose();
|
125
137
|
}
|
126
138
|
};
|
127
139
|
}
|
128
140
|
}
|
129
141
|
]
|
130
142
|
});
|
131
|
-
|
143
|
+
server.start();
|
132
144
|
graphql_local_client_1.GraphqlLocalClient.init(builtSchema, app);
|
133
145
|
env_1.orderedModuleNames.forEach(name => {
|
134
146
|
const { initMiddlewares } = (0, env_1.loader)(name);
|
@@ -144,7 +156,7 @@ const bootstrap = async () => {
|
|
144
156
|
debug: false
|
145
157
|
});
|
146
158
|
app.use((0, koa_bodyparser_1.default)(bodyParserOption));
|
147
|
-
app.use((0,
|
159
|
+
app.use((0, graphqlUploadKoa_js_1.default)(fileUploadOption));
|
148
160
|
app.use(server.getMiddleware({
|
149
161
|
path: '/graphql'
|
150
162
|
}));
|
@@ -162,14 +174,14 @@ const bootstrap = async () => {
|
|
162
174
|
.use(routers_1.domainPublicRouter.allowedMethods())
|
163
175
|
.use(routers_1.domainPrivateRouter.routes())
|
164
176
|
.use(routers_1.domainPrivateRouter.allowedMethods());
|
165
|
-
/* should
|
177
|
+
/* should follow this order : history-fallback => koaStatic */
|
166
178
|
app.use((0, koa2_connect_history_api_fallback_1.historyApiFallback)({ whiteList: [] }));
|
167
179
|
app.use((0, koa_static_1.default)(path.join(process.cwd(), 'dist-client'), {
|
168
180
|
index: 'index.html'
|
169
181
|
}));
|
170
182
|
httpServer.listen({ port: PORT }, () => {
|
171
183
|
env_1.logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}${server.graphqlPath}`);
|
172
|
-
env_1.logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${
|
184
|
+
env_1.logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${server.graphqlPath}`);
|
173
185
|
process.emit('bootstrap-module-start', { app, config: env_1.config, builtSchema, httpServer });
|
174
186
|
});
|
175
187
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../server/server.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../server/server.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;;AAE5B,4DAA4D;AAC5D,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAA;AACnC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;AAE1B,2DAAsH;AACtH,yDAAgD;AAChD,kDAA+B;AAC/B,6FAAiE;AACjE,8CAAiD;AACjD,+BAAmC;AACnC,8CAAqB;AACrB,oEAA0C;AAC1C,oDAAuB;AACvB,4DAAkC;AAClC,8DAAiC;AACjC,yFAAsE;AACtE,2BAAoC;AACpC,4CAAmB;AAEnB,qDAA4B;AAC5B,6CAAgF;AAEhF,iEAA2D;AAC3D,sDAA6D;AAC7D,uCAA4G;AAC5G,qCAAiC;AAEjC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE;IACtC,YAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAEnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA;AAEF,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAE5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,2CAA2C,EAAE,YAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAE1F,MAAM,KAAK,GAAG,IAA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AI,CAAC,0CAA0C,IAAI,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;QAElF,OAAO,CAAC,IAAI,CAAC,wBAA+B,EAAE,EAAE,GAAG,EAAE,MAAM,EAAN,YAAM,EAAE,WAAW,EAAE,UAAU,EAAS,CAAC,CAAA;IAChG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,EAAE,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scalar-date.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-date.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEpC,QAAA,UAAU,GAAG,IAAI,2BAAiB,CAAC;IAC9C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,yBAAyB;IACtC,UAAU,CAAC,KAAK;QACd,OAAO,IAAI,IAAI,CAAC,KAAwB,CAAC,CAAA,CAAC,wBAAwB;IACpE,CAAC;IACD,SAAS,CAAC,KAAK;QACb;;;WAGG;QACH,OAAO,IAAI,IAAI,CAAC,
|
1
|
+
{"version":3,"file":"scalar-date.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-date.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEpC,QAAA,UAAU,GAAG,IAAI,2BAAiB,CAAC;IAC9C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,yBAAyB;IACtC,UAAU,CAAC,KAAK;QACd,OAAO,IAAI,IAAI,CAAC,KAAwB,CAAC,CAAA,CAAC,wBAAwB;IACpE,CAAC;IACD,SAAS,CAAC,KAAK;QACb;;;WAGG;QACH,OAAO,IAAI,IAAI,CAAC,KAAY,CAAC,CAAC,OAAO,EAAE,CAAA,CAAC,2BAA2B;IACrE,CAAC;IACD,YAAY,CAAC,GAAG;QACd,IAAI,GAAG,CAAC,IAAI,KAAK,cAAI,CAAC,GAAG,EAAE;YACzB,OAAO,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA,CAAC,uCAAuC;SACpE;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/shell",
|
3
|
-
"version": "5.0.0-zeta.
|
3
|
+
"version": "5.0.0-zeta.21",
|
4
4
|
"description": "Core module for framework",
|
5
5
|
"bin": {
|
6
6
|
"things-factory": "bin/things-factory",
|
@@ -45,21 +45,21 @@
|
|
45
45
|
"@material/mwc-icon-button": "^0.26.1",
|
46
46
|
"@material/mwc-slider": "^0.26.1",
|
47
47
|
"@material/mwc-textfield": "^0.26.1",
|
48
|
-
"@operato/board": "^1.0.0-beta.
|
49
|
-
"@operato/graphql": "^1.0.0-beta.
|
50
|
-
"@operato/help": "^1.0.0-beta.
|
51
|
-
"@operato/layout": "^1.0.0-beta.
|
52
|
-
"@operato/shell": "^1.0.0-beta.
|
53
|
-
"@operato/utils": "^1.0.0-beta.
|
54
|
-
"@things-factory/ejs-remote": "^5.0.0-zeta.
|
55
|
-
"@things-factory/env": "^5.0.0-zeta.
|
56
|
-
"@things-factory/styles": "^5.0.0-zeta.
|
57
|
-
"@things-factory/utils": "^5.0.0-zeta.
|
48
|
+
"@operato/board": "^1.0.0-beta.48",
|
49
|
+
"@operato/graphql": "^1.0.0-beta.48",
|
50
|
+
"@operato/help": "^1.0.0-beta.48",
|
51
|
+
"@operato/layout": "^1.0.0-beta.48",
|
52
|
+
"@operato/shell": "^1.0.0-beta.48",
|
53
|
+
"@operato/utils": "^1.0.0-beta.48",
|
54
|
+
"@things-factory/ejs-remote": "^5.0.0-zeta.21",
|
55
|
+
"@things-factory/env": "^5.0.0-zeta.21",
|
56
|
+
"@things-factory/styles": "^5.0.0-zeta.21",
|
57
|
+
"@things-factory/utils": "^5.0.0-zeta.21",
|
58
58
|
"@webcomponents/webcomponentsjs": "^2.6.0",
|
59
59
|
"@webpack-contrib/schema-utils": "^1.0.0-beta.0",
|
60
|
-
"apollo-server-core": "^3.
|
61
|
-
"apollo-server-koa": "^3.
|
62
|
-
"apollo-server-types": "^3.6.
|
60
|
+
"apollo-server-core": "^3.10.0",
|
61
|
+
"apollo-server-koa": "^3.10.0",
|
62
|
+
"apollo-server-types": "^3.6.2",
|
63
63
|
"apollo-upload-client": "^17.0.0",
|
64
64
|
"args": "^5.0.0",
|
65
65
|
"broadcastchannel-polyfill": "^1.0.1",
|
@@ -71,12 +71,15 @@
|
|
71
71
|
"firebase": "^8.0.1",
|
72
72
|
"fs-extra": "^9.0.1",
|
73
73
|
"glob": "^7.1.6",
|
74
|
-
"graphql": "^
|
74
|
+
"graphql": "^16.5.0",
|
75
|
+
"graphql-language-service-interface": "^2.10.2",
|
76
|
+
"graphql-language-service-parser": "^1.10.4",
|
77
|
+
"graphql-language-service-utils": "^2.7.1",
|
75
78
|
"graphql-mqtt-subscriptions": "^1.2.0",
|
76
|
-
"graphql-redis-subscriptions": "^2.
|
79
|
+
"graphql-redis-subscriptions": "^2.5.0",
|
77
80
|
"graphql-subscriptions": "^2.0.0",
|
78
81
|
"graphql-tag": "^2.12.6",
|
79
|
-
"graphql-upload": "^
|
82
|
+
"graphql-upload": "^15.0.2",
|
80
83
|
"graphql-ws": "^5.9.1",
|
81
84
|
"haunted": "^5.0.0",
|
82
85
|
"html-webpack-plugin": "^5.5.0",
|
@@ -92,7 +95,6 @@
|
|
92
95
|
"koa-router": "^7.4.0",
|
93
96
|
"koa-send": "^5.0.0",
|
94
97
|
"koa-static": "^5.0.0",
|
95
|
-
"koa-unless": "^1.0.7",
|
96
98
|
"koa2-connect-history-api-fallback": "^0.1.2",
|
97
99
|
"lit": "^2.2.7",
|
98
100
|
"loader-utils": "^2.0.0",
|
@@ -112,15 +114,14 @@
|
|
112
114
|
"reselect": "^4.0.0",
|
113
115
|
"sass": "^1.50.1",
|
114
116
|
"scrollbooster": "^3.0.2",
|
115
|
-
"subscriptions-transport-ws": "^0.11.0",
|
116
117
|
"sweetalert2": "^10.9.0",
|
117
|
-
"type-graphql": "
|
118
|
+
"type-graphql": "npm:type-graphql-v2-fork@2.0.0-alpha2",
|
118
119
|
"typeorm": "^0.2.45",
|
119
120
|
"uuid": "^3.4.0",
|
120
121
|
"web-animations-js": "^2.3.2",
|
121
122
|
"web-push": "^3.5.0",
|
122
123
|
"webfontloader": "^1.6.28",
|
123
|
-
"ws": "^8.8.
|
124
|
+
"ws": "^8.8.1"
|
124
125
|
},
|
125
126
|
"optionalDependencies": {
|
126
127
|
"better-sqlite3": "^7.5.3",
|
@@ -130,5 +131,5 @@
|
|
130
131
|
"pg": "^8.7.3",
|
131
132
|
"sqlite3": "^5.0.8"
|
132
133
|
},
|
133
|
-
"gitHead": "
|
134
|
+
"gitHead": "a63dd238090dc87e77ea07dac34e818d31a277f2"
|
134
135
|
}
|
package/server/schema.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import { loader, orderedModuleNames } from '@things-factory/env'
|
2
|
-
|
3
1
|
import { GraphQLSchema } from 'graphql'
|
4
|
-
import { GraphQLUpload } from 'graphql-upload'
|
2
|
+
import { GraphQLUpload } from 'graphql-upload/GraphQLUpload.js'
|
5
3
|
import { buildSchema } from 'type-graphql'
|
6
|
-
|
4
|
+
|
7
5
|
import { mergeSchemas } from '@graphql-tools/schema'
|
6
|
+
import { loader, orderedModuleNames } from '@things-factory/env'
|
7
|
+
import { deepMerge } from '@things-factory/utils'
|
8
8
|
|
9
9
|
export async function schema() {
|
10
10
|
const schemas = orderedModuleNames
|
package/server/server-dev.ts
CHANGED
@@ -1,24 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
// ts-import-sorter: disable
|
2
|
+
|
3
|
+
/* following 2 lines should be located in top of the file */
|
3
4
|
process.env.NODE_ENV = 'development'
|
4
5
|
process.setMaxListeners(0)
|
5
6
|
|
6
|
-
|
7
|
-
import { ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core'
|
7
|
+
import { ApolloServerPluginDrainHttpServer, ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core'
|
8
8
|
import { ApolloServer } from 'apollo-server-koa'
|
9
9
|
import bytesFormat from 'bytes'
|
10
|
-
import
|
11
|
-
import {
|
12
|
-
import { graphqlUploadKoa } from 'graphql-upload'
|
10
|
+
import graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'
|
11
|
+
import { useServer } from 'graphql-ws/lib/use/ws'
|
13
12
|
import { createServer } from 'http'
|
14
13
|
import Koa from 'koa'
|
15
14
|
import koaBodyParser from 'koa-bodyparser'
|
16
|
-
import compose from 'koa-compose'
|
17
15
|
import ip from 'koa-ip'
|
18
16
|
import koaStatic from 'koa-static'
|
17
|
+
import compose from 'koa-compose'
|
19
18
|
import { historyApiFallback } from 'koa2-connect-history-api-fallback'
|
20
|
-
|
21
|
-
import
|
19
|
+
import { WebSocketServer } from 'ws'
|
20
|
+
import co from 'co'
|
22
21
|
|
23
22
|
import koaWebpack from '@hatiolab/koa-webpack'
|
24
23
|
import cors from '@koa/cors'
|
@@ -111,23 +110,29 @@ const bootstrap = async () => {
|
|
111
110
|
const builtSchema = await schema()
|
112
111
|
|
113
112
|
const httpServer = createServer(app.callback())
|
113
|
+
const websocketServer = new WebSocketServer({
|
114
|
+
server: httpServer,
|
115
|
+
path: '/graphql'
|
116
|
+
})
|
114
117
|
|
115
|
-
|
118
|
+
// Save the returned server's info so we can shut down this server later
|
119
|
+
const serverCleanup = useServer(
|
116
120
|
{
|
117
121
|
schema: builtSchema,
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
var {
|
122
|
+
context: async (ctx, msg, args) => {
|
123
|
+
return ctx['context']
|
124
|
+
},
|
125
|
+
onConnect: async ctx => {
|
126
|
+
var { extra, connectionParams } = ctx
|
127
|
+
var { request } = extra
|
123
128
|
|
124
|
-
var url = new URL((connectionParams['headers'] || connectionParams).referer)
|
129
|
+
var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)
|
125
130
|
var accessToken = url.searchParams.get('access_token')
|
126
131
|
connectionParams['headers']['authorization'] = accessToken
|
127
132
|
|
128
133
|
request.headers = {
|
129
134
|
...request.headers,
|
130
|
-
...(connectionParams['headers'] || connectionParams)
|
135
|
+
...(connectionParams['headers'] || (connectionParams as any))
|
131
136
|
}
|
132
137
|
|
133
138
|
var koacontext = await app.createContext(request, {} as any)
|
@@ -139,13 +144,16 @@ const bootstrap = async () => {
|
|
139
144
|
|
140
145
|
await fn(koacontext)
|
141
146
|
|
142
|
-
return koacontext
|
147
|
+
return (ctx['context'] = koacontext)
|
148
|
+
},
|
149
|
+
onDisconnect(ctx, code, reason) {
|
150
|
+
console.log('Disconnected!')
|
151
|
+
},
|
152
|
+
onError(ctx, msg, errors) {
|
153
|
+
console.error(msg, errors)
|
143
154
|
}
|
144
155
|
},
|
145
|
-
|
146
|
-
server: httpServer,
|
147
|
-
path: '/subscriptions'
|
148
|
-
}
|
156
|
+
websocketServer
|
149
157
|
)
|
150
158
|
|
151
159
|
const server = new ApolloServer({
|
@@ -155,7 +163,6 @@ const bootstrap = async () => {
|
|
155
163
|
return error
|
156
164
|
},
|
157
165
|
formatResponse: response => {
|
158
|
-
// logger.info('response %s', JSON.stringify(response, null, 2))
|
159
166
|
return response
|
160
167
|
},
|
161
168
|
context: async ({ connection, ctx }) => {
|
@@ -171,11 +178,12 @@ const bootstrap = async () => {
|
|
171
178
|
'request.credentials': 'same-origin'
|
172
179
|
}
|
173
180
|
}),
|
181
|
+
ApolloServerPluginDrainHttpServer({ httpServer }),
|
174
182
|
{
|
175
183
|
async serverWillStart() {
|
176
184
|
return {
|
177
185
|
async drainServer() {
|
178
|
-
|
186
|
+
await serverCleanup.dispose()
|
179
187
|
}
|
180
188
|
}
|
181
189
|
}
|
@@ -241,7 +249,7 @@ const bootstrap = async () => {
|
|
241
249
|
.use(domainPrivateRouter.routes())
|
242
250
|
.use(domainPrivateRouter.allowedMethods())
|
243
251
|
|
244
|
-
/* should
|
252
|
+
/* should follow this order : history-fallback => webpack-middleware => koaStatic */
|
245
253
|
app.use(historyApiFallback({ whiteList: [] }))
|
246
254
|
|
247
255
|
app.use(middleware)
|
@@ -254,7 +262,7 @@ const bootstrap = async () => {
|
|
254
262
|
|
255
263
|
httpServer.listen({ port: PORT }, () => {
|
256
264
|
logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}${server.graphqlPath}`)
|
257
|
-
logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${
|
265
|
+
logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${server.graphqlPath}`)
|
258
266
|
|
259
267
|
process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)
|
260
268
|
})
|
package/server/server.ts
CHANGED
@@ -1,20 +1,23 @@
|
|
1
|
-
//
|
1
|
+
// ts-import-sorter: disable
|
2
|
+
|
3
|
+
/* following 2 lines should be located in top of the file */
|
2
4
|
process.env.NODE_ENV = 'production'
|
3
5
|
process.setMaxListeners(0)
|
4
6
|
|
7
|
+
import { ApolloServerPluginDrainHttpServer, ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core'
|
5
8
|
import { ApolloServer } from 'apollo-server-koa'
|
6
9
|
import bytesFormat from 'bytes'
|
7
|
-
import
|
8
|
-
import {
|
9
|
-
import { graphqlUploadKoa } from 'graphql-upload'
|
10
|
+
import graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'
|
11
|
+
import { useServer } from 'graphql-ws/lib/use/ws'
|
10
12
|
import { createServer } from 'http'
|
11
13
|
import Koa from 'koa'
|
12
14
|
import koaBodyParser from 'koa-bodyparser'
|
13
|
-
import compose from 'koa-compose'
|
14
15
|
import ip from 'koa-ip'
|
15
16
|
import koaStatic from 'koa-static'
|
17
|
+
import compose from 'koa-compose'
|
16
18
|
import { historyApiFallback } from 'koa2-connect-history-api-fallback'
|
17
|
-
import {
|
19
|
+
import { WebSocketServer } from 'ws'
|
20
|
+
import co from 'co'
|
18
21
|
|
19
22
|
import cors from '@koa/cors'
|
20
23
|
import { config, loader, logger, orderedModuleNames } from '@things-factory/env'
|
@@ -53,6 +56,7 @@ const fileUploadOption = {
|
|
53
56
|
maxFileSize: bytesFormat.parse(fileUpload.maxFileSize) || bytesFormat.parse('10mb'),
|
54
57
|
maxFiles: fileUpload.maxFiles || 10
|
55
58
|
}
|
59
|
+
|
56
60
|
/* bootstrap */
|
57
61
|
const bootstrap = async () => {
|
58
62
|
await databaseInitializer()
|
@@ -93,41 +97,50 @@ const bootstrap = async () => {
|
|
93
97
|
const builtSchema = await schema()
|
94
98
|
|
95
99
|
const httpServer = createServer(app.callback())
|
100
|
+
const websocketServer = new WebSocketServer({
|
101
|
+
server: httpServer,
|
102
|
+
path: '/graphql'
|
103
|
+
})
|
96
104
|
|
97
|
-
|
105
|
+
// Save the returned server's info so we can shut down this server later
|
106
|
+
const serverCleanup = useServer(
|
98
107
|
{
|
99
108
|
schema: builtSchema,
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
var {
|
109
|
+
context: async (ctx, msg, args) => {
|
110
|
+
return ctx['context']
|
111
|
+
},
|
112
|
+
onConnect: async ctx => {
|
113
|
+
var { extra, connectionParams } = ctx
|
114
|
+
var { request } = extra
|
105
115
|
|
106
|
-
var url = new URL((connectionParams['headers'] || connectionParams).referer)
|
116
|
+
var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)
|
107
117
|
var accessToken = url.searchParams.get('access_token')
|
108
118
|
connectionParams['headers']['authorization'] = accessToken
|
109
119
|
|
110
120
|
request.headers = {
|
111
121
|
...request.headers,
|
112
|
-
...(connectionParams['headers'] || connectionParams)
|
122
|
+
...(connectionParams['headers'] || (connectionParams as any))
|
113
123
|
}
|
114
124
|
|
115
|
-
/* in case connect error(like a authentication error) just throw exception */
|
116
125
|
var koacontext = await app.createContext(request, {} as any)
|
117
126
|
koacontext['state'] = {}
|
118
127
|
|
128
|
+
/* in case connect error(like a authentication error) just throw exception */
|
119
129
|
var middlewares = [...subscriptionMiddleware]
|
120
130
|
const fn = co.wrap(compose(middlewares))
|
121
131
|
|
122
132
|
await fn(koacontext)
|
123
133
|
|
124
|
-
return koacontext
|
134
|
+
return (ctx['context'] = koacontext)
|
135
|
+
},
|
136
|
+
onDisconnect(ctx, code, reason) {
|
137
|
+
console.log('Disconnected!')
|
138
|
+
},
|
139
|
+
onError(ctx, msg, errors) {
|
140
|
+
console.error(msg, errors)
|
125
141
|
}
|
126
142
|
},
|
127
|
-
|
128
|
-
server: httpServer,
|
129
|
-
path: '/subscriptions'
|
130
|
-
}
|
143
|
+
websocketServer
|
131
144
|
)
|
132
145
|
|
133
146
|
const server = new ApolloServer({
|
@@ -149,11 +162,12 @@ const bootstrap = async () => {
|
|
149
162
|
}
|
150
163
|
},
|
151
164
|
plugins: [
|
165
|
+
ApolloServerPluginDrainHttpServer({ httpServer }),
|
152
166
|
{
|
153
167
|
async serverWillStart() {
|
154
168
|
return {
|
155
169
|
async drainServer() {
|
156
|
-
|
170
|
+
await serverCleanup.dispose()
|
157
171
|
}
|
158
172
|
}
|
159
173
|
}
|
@@ -161,7 +175,7 @@ const bootstrap = async () => {
|
|
161
175
|
]
|
162
176
|
})
|
163
177
|
|
164
|
-
|
178
|
+
server.start()
|
165
179
|
|
166
180
|
GraphqlLocalClient.init(builtSchema, app)
|
167
181
|
|
@@ -205,7 +219,7 @@ const bootstrap = async () => {
|
|
205
219
|
.use(domainPrivateRouter.routes())
|
206
220
|
.use(domainPrivateRouter.allowedMethods())
|
207
221
|
|
208
|
-
/* should
|
222
|
+
/* should follow this order : history-fallback => koaStatic */
|
209
223
|
app.use(historyApiFallback({ whiteList: [] }))
|
210
224
|
|
211
225
|
app.use(
|
@@ -216,7 +230,7 @@ const bootstrap = async () => {
|
|
216
230
|
|
217
231
|
httpServer.listen({ port: PORT }, () => {
|
218
232
|
logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}${server.graphqlPath}`)
|
219
|
-
logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${
|
233
|
+
logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${server.graphqlPath}`)
|
220
234
|
|
221
235
|
process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)
|
222
236
|
})
|
@@ -11,7 +11,7 @@ export const ScalarDate = new GraphQLScalarType({
|
|
11
11
|
* Note: Allow value to be date only like "2021-01-31" to be serialize before passing data to clientside for TypeGraphql.
|
12
12
|
* Usage: When database column datatype is "date" and data do not contain any time component.
|
13
13
|
*/
|
14
|
-
return new Date(value).getTime() // value sent to the client
|
14
|
+
return new Date(value as any).getTime() // value sent to the client
|
15
15
|
},
|
16
16
|
parseLiteral(ast) {
|
17
17
|
if (ast.kind === Kind.INT) {
|
package/things-factory.config.js
CHANGED
package/client/app/app-style.js
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
import { css } from 'lit'
|
2
|
-
|
3
|
-
export const AppStyle = css`
|
4
|
-
:host {
|
5
|
-
display: grid;
|
6
|
-
|
7
|
-
grid-template-rows: var(--app-grid-template-rows, auto 1fr auto);
|
8
|
-
grid-template-columns: var(--app-grid-template-columns, auto 1fr auto);
|
9
|
-
grid-template-areas: var(--app-grid-template-area, 'header header header' 'nav main aside' 'nav footer aside');
|
10
|
-
grid-gap: var(--app-grid-gap, 0em);
|
11
|
-
|
12
|
-
max-width: 100vw;
|
13
|
-
width: 100vw;
|
14
|
-
height: 100vh;
|
15
|
-
}
|
16
|
-
|
17
|
-
ox-header-bar {
|
18
|
-
grid-area: header;
|
19
|
-
}
|
20
|
-
|
21
|
-
ox-nav-bar {
|
22
|
-
grid-area: nav;
|
23
|
-
}
|
24
|
-
|
25
|
-
main {
|
26
|
-
grid-area: main;
|
27
|
-
|
28
|
-
overflow: hidden;
|
29
|
-
|
30
|
-
display: flex;
|
31
|
-
flex-direction: row;
|
32
|
-
}
|
33
|
-
|
34
|
-
ox-aside-bar {
|
35
|
-
grid-area: aside;
|
36
|
-
}
|
37
|
-
|
38
|
-
ox-footer-bar {
|
39
|
-
grid-area: footer;
|
40
|
-
}
|
41
|
-
|
42
|
-
main * {
|
43
|
-
flex: 1;
|
44
|
-
}
|
45
|
-
|
46
|
-
main *:not([active]) {
|
47
|
-
display: none;
|
48
|
-
}
|
49
|
-
|
50
|
-
[hidden] {
|
51
|
-
display: none;
|
52
|
-
}
|
53
|
-
|
54
|
-
ox-snack-bar {
|
55
|
-
z-index: 1000;
|
56
|
-
}
|
57
|
-
|
58
|
-
/* Wide layout */
|
59
|
-
@media (min-width: 460px) {
|
60
|
-
}
|
61
|
-
|
62
|
-
@media print {
|
63
|
-
:host {
|
64
|
-
width: 100%;
|
65
|
-
height: 100%;
|
66
|
-
min-height: 100vh;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
`
|
package/client/app/app.js
DELETED
@@ -1,225 +0,0 @@
|
|
1
|
-
import '@operato/layout'
|
2
|
-
|
3
|
-
import { LitElement, html } from 'lit'
|
4
|
-
import { UPDATE_ACTIVE_PAGE, UPDATE_CONTEXT_PATH, UPDATE_MODULES, navigateWithSilence, store } from '@operato/shell'
|
5
|
-
|
6
|
-
import { AppStyle } from './app-style'
|
7
|
-
import { ScrollbarStyles } from '@operato/styles'
|
8
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
9
|
-
import { getPathInfo } from '@operato/utils'
|
10
|
-
import { installRouter } from 'pwa-helpers/router.js'
|
11
|
-
import throttle from 'lodash-es/throttle'
|
12
|
-
|
13
|
-
class ThingsApp extends connect(store)(LitElement) {
|
14
|
-
static get properties() {
|
15
|
-
return {
|
16
|
-
_contextPath: String,
|
17
|
-
_page: String,
|
18
|
-
_pages: Object,
|
19
|
-
_resourceId: String,
|
20
|
-
_params: Object,
|
21
|
-
_callbacks: Array,
|
22
|
-
_activePage: Object,
|
23
|
-
_context: Object,
|
24
|
-
_modules: Array
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
static get styles() {
|
29
|
-
return [ScrollbarStyles, AppStyle]
|
30
|
-
}
|
31
|
-
|
32
|
-
render() {
|
33
|
-
var params = this._params || {}
|
34
|
-
var fullbleed = (this._context && this._context.fullbleed) || (params.fullbleed && params.fullbleed == 'Y')
|
35
|
-
var widebleed = (this._context && this._context.widebleed) || (params.widebleed && params.widebleed == 'Y')
|
36
|
-
|
37
|
-
return html`
|
38
|
-
<ox-header-bar ?fullbleed=${fullbleed}></ox-header-bar>
|
39
|
-
|
40
|
-
<ox-nav-bar ?fullbleed=${fullbleed || widebleed}></ox-nav-bar>
|
41
|
-
|
42
|
-
<main></main>
|
43
|
-
|
44
|
-
<ox-aside-bar ?fullbleed=${fullbleed || widebleed}></ox-aside-bar>
|
45
|
-
|
46
|
-
<ox-footer-bar ?fullbleed=${fullbleed}></ox-footer-bar>
|
47
|
-
|
48
|
-
<ox-snack-bar></ox-snack-bar>
|
49
|
-
`
|
50
|
-
}
|
51
|
-
|
52
|
-
constructor() {
|
53
|
-
super()
|
54
|
-
}
|
55
|
-
|
56
|
-
connectedCallback() {
|
57
|
-
super.connectedCallback()
|
58
|
-
|
59
|
-
window.addEventListener('resize', () => this.resized())
|
60
|
-
|
61
|
-
/* 모듈 임포트를 동적으로 처리한다. */
|
62
|
-
import(
|
63
|
-
/* webpackPrefetch: true */
|
64
|
-
/* webpackPreload: true */
|
65
|
-
/* webpackChunkName: "modules" */
|
66
|
-
'../module-importer.import'
|
67
|
-
).then(module => {
|
68
|
-
var modules = module.modules
|
69
|
-
|
70
|
-
/* lifecycle - bootstrapping */
|
71
|
-
this.dispatchEvent(new Event('lifecycle-bootstrap-begin'))
|
72
|
-
modules.forEach((m, idx) => {
|
73
|
-
try {
|
74
|
-
m.bootstrap && m.bootstrap()
|
75
|
-
// console.info(`[${idx} BOOTSTRAPED - ${m.name}]`)
|
76
|
-
} catch (e) {
|
77
|
-
console.error(`[${idx} BOOTSTRAP ERROR -${m.name}]`, e)
|
78
|
-
}
|
79
|
-
})
|
80
|
-
this.dispatchEvent(new Event('lifecycle-bootstrap-finish'))
|
81
|
-
|
82
|
-
/* shouldUpdate를 활성화한다. */
|
83
|
-
this._moduleInitialized = true
|
84
|
-
|
85
|
-
/* modules를 store에 dispatch 함으로써, update를 invoke 시킨다. */
|
86
|
-
store.dispatch({
|
87
|
-
type: UPDATE_MODULES,
|
88
|
-
modules
|
89
|
-
})
|
90
|
-
|
91
|
-
installRouter((location, e) => {
|
92
|
-
var { contextPath } = getPathInfo(location.pathname)
|
93
|
-
|
94
|
-
if (this._contextPath !== contextPath) {
|
95
|
-
store.dispatch({
|
96
|
-
type: UPDATE_CONTEXT_PATH,
|
97
|
-
contextPath
|
98
|
-
})
|
99
|
-
}
|
100
|
-
|
101
|
-
store.dispatch(navigateWithSilence(location))
|
102
|
-
this._callbacks &&
|
103
|
-
this._callbacks.forEach(callback => {
|
104
|
-
try {
|
105
|
-
callback.call(this, location, e)
|
106
|
-
} catch (ex) {
|
107
|
-
console.error(ex)
|
108
|
-
}
|
109
|
-
})
|
110
|
-
})
|
111
|
-
})
|
112
|
-
|
113
|
-
this.setBase()
|
114
|
-
}
|
115
|
-
|
116
|
-
resized() {
|
117
|
-
if (!this._throttledResize) {
|
118
|
-
this._throttledResize = throttle(() => {
|
119
|
-
const aside = this.renderRoot.querySelector('ox-aside-bar').clientWidth
|
120
|
-
const nav = this.renderRoot.querySelector('ox-nav-bar').clientWidth
|
121
|
-
|
122
|
-
this.style.setProperty(
|
123
|
-
'--app-grid-template-columns',
|
124
|
-
`auto minmax(calc(100vw - ${aside}px - ${nav}px), 1fr) auto`
|
125
|
-
)
|
126
|
-
}, 100)
|
127
|
-
}
|
128
|
-
|
129
|
-
this._throttledResize()
|
130
|
-
}
|
131
|
-
|
132
|
-
routeToPage() {
|
133
|
-
let activePages = this.shadowRoot.querySelectorAll('main > .page[active]')
|
134
|
-
activePages.forEach(page => {
|
135
|
-
page.removeAttribute('active')
|
136
|
-
})
|
137
|
-
|
138
|
-
this._activePage = this.shadowRoot.querySelector(`main > .page[data-page=${this._page}]`)
|
139
|
-
|
140
|
-
if (!this._activePage) {
|
141
|
-
/* 해당 route에 연결된 page가 없는 경우에 main 섹션에 해당 element를 추가해준다. */
|
142
|
-
var tagname = this._pages[this._page]
|
143
|
-
if (tagname) {
|
144
|
-
var main = this.shadowRoot.querySelector('main')
|
145
|
-
|
146
|
-
var el = document.createElement(tagname)
|
147
|
-
el.setAttribute('class', 'page')
|
148
|
-
el.setAttribute('data-page', this._page)
|
149
|
-
|
150
|
-
main.appendChild(el)
|
151
|
-
|
152
|
-
this._activePage = el
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
if (this._activePage) {
|
157
|
-
this._activePage.setAttribute('active', true)
|
158
|
-
this._activePage.setAttribute('context-path', this._contextPath)
|
159
|
-
this._activePage.lifecycle = {
|
160
|
-
...(this._activePage.lifecycle || {}),
|
161
|
-
active: true,
|
162
|
-
params: this._params,
|
163
|
-
resourceId: this._resourceId,
|
164
|
-
page: this._page
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
store.dispatch({
|
169
|
-
type: UPDATE_ACTIVE_PAGE,
|
170
|
-
activePage: this._activePage
|
171
|
-
})
|
172
|
-
}
|
173
|
-
|
174
|
-
async updated(changedProps) {
|
175
|
-
if (changedProps.has('_modules')) {
|
176
|
-
this._readyPageList()
|
177
|
-
}
|
178
|
-
|
179
|
-
if (changedProps.has('_page') || changedProps.has('_resourceId') || changedProps.has('_params')) {
|
180
|
-
this.routeToPage()
|
181
|
-
}
|
182
|
-
|
183
|
-
if (changedProps.has('_contextPath')) {
|
184
|
-
this.setBase()
|
185
|
-
}
|
186
|
-
|
187
|
-
this.resized()
|
188
|
-
}
|
189
|
-
|
190
|
-
shouldUpdate() {
|
191
|
-
return this._moduleInitialized
|
192
|
-
}
|
193
|
-
|
194
|
-
stateChanged(state) {
|
195
|
-
this._page = state.route.page
|
196
|
-
this._params = state.route.params
|
197
|
-
this._resourceId = state.route.resourceId
|
198
|
-
this._callbacks = state.route.callbacks
|
199
|
-
this._context = state.route.context
|
200
|
-
this._modules = state.app.modules
|
201
|
-
this._contextPath = state.app.contextPath
|
202
|
-
}
|
203
|
-
|
204
|
-
_readyPageList() {
|
205
|
-
var reversedModules = [...this._modules].reverse()
|
206
|
-
this._pages = {}
|
207
|
-
|
208
|
-
/* 모듈 참조 순서 역순으로 page를 추가한다. (for overidable) */
|
209
|
-
reversedModules.forEach(m => {
|
210
|
-
m.routes &&
|
211
|
-
m.routes.forEach(route => {
|
212
|
-
if (!this._pages[route.page]) {
|
213
|
-
this._pages[route.page] = route.tagname
|
214
|
-
}
|
215
|
-
})
|
216
|
-
})
|
217
|
-
}
|
218
|
-
|
219
|
-
setBase() {
|
220
|
-
var base = document.querySelector('base')
|
221
|
-
base.setAttribute('href', this._contextPath ? `${this._contextPath}/` : '/')
|
222
|
-
}
|
223
|
-
}
|
224
|
-
|
225
|
-
window.customElements.define('things-app', ThingsApp)
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { css, html } from 'lit'
|
2
|
-
|
3
|
-
import { PageView } from '@operato/shell'
|
4
|
-
|
5
|
-
class Page404 extends PageView {
|
6
|
-
static get styles() {
|
7
|
-
return css`
|
8
|
-
:host {
|
9
|
-
display: block;
|
10
|
-
box-sizing: border-box;
|
11
|
-
|
12
|
-
background-color: var(--main-section-background-color);
|
13
|
-
--padding-wide: 15%;
|
14
|
-
}
|
15
|
-
section {
|
16
|
-
padding: var(--padding-wide) 0 0 0;
|
17
|
-
text-align: center;
|
18
|
-
color: var(--secondary-color);
|
19
|
-
}
|
20
|
-
mwc-icon {
|
21
|
-
--mdc-icon-size: 120px;
|
22
|
-
color: var(--status-danger-color);
|
23
|
-
text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1);
|
24
|
-
}
|
25
|
-
h2 {
|
26
|
-
margin: 0 auto;
|
27
|
-
font-size: 2.5em;
|
28
|
-
text-transform: capitalize;
|
29
|
-
}
|
30
|
-
@media only screen and (max-width: 460px) {
|
31
|
-
mwc-icon {
|
32
|
-
padding-top: 25%;
|
33
|
-
--mdc-icon-size: 90px;
|
34
|
-
}
|
35
|
-
h2 {
|
36
|
-
font-size: 2em;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
`
|
40
|
-
}
|
41
|
-
|
42
|
-
get context() {
|
43
|
-
return {
|
44
|
-
title: 'Page Not Found'
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
render() {
|
49
|
-
return html`
|
50
|
-
<section>
|
51
|
-
<mwc-icon>error_outline</mwc-icon>
|
52
|
-
<h2>page not found!</h2>
|
53
|
-
The page you requested cannot be found.
|
54
|
-
</section>
|
55
|
-
`
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
customElements.define('page-404', Page404)
|
File without changes
|