@things-factory/shell 4.0.0-alpha.6 → 4.0.0-beta.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/elements/oops-progress.js +15 -7
- package/client/graphql-client.js +23 -17
- package/client/index.js +2 -2
- package/client/{notification-store.js → indexdb.js} +49 -40
- package/client/serviceworker/sw-src.js +3 -3
- package/client/themes/oops-theme.css +9 -9
- package/config/config.development.js +12 -1
- package/dist-server/graphql-local-client.js +1 -1
- package/dist-server/graphql-local-client.js.map +1 -1
- package/dist-server/index.js +1 -1
- package/dist-server/initializers/database.js +3 -2
- package/dist-server/initializers/database.js.map +1 -1
- package/dist-server/initializers/naming-strategy.js +1 -1
- package/dist-server/initializers/naming-strategy.js.map +1 -1
- package/dist-server/middlewares/domain-middleware.js +1 -1
- package/dist-server/middlewares/domain-middleware.js.map +1 -1
- package/dist-server/middlewares/index.js +2 -2
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/migrations/1000000000000-SeedDomain.js +2 -2
- package/dist-server/migrations/1000000000000-SeedDomain.js.map +1 -1
- package/dist-server/pubsub-log-transport.js +1 -1
- package/dist-server/pubsub-log-transport.js.map +1 -1
- package/dist-server/pubsub.js +15 -13
- package/dist-server/pubsub.js.map +1 -1
- package/dist-server/routers/index.js +1 -1
- package/dist-server/schema.js +10 -10
- package/dist-server/schema.js.map +1 -1
- package/dist-server/server-dev.js +71 -52
- package/dist-server/server-dev.js.map +1 -1
- package/dist-server/server.js +62 -47
- package/dist-server/server.js.map +1 -1
- package/dist-server/service/common-types/index.js +1 -1
- package/dist-server/service/common-types/list-param.js +15 -15
- package/dist-server/service/common-types/list-param.js.map +1 -1
- package/dist-server/service/common-types/log.js +5 -5
- package/dist-server/service/common-types/log.js.map +1 -1
- package/dist-server/service/common-types/object-ref.js +4 -4
- package/dist-server/service/common-types/object-ref.js.map +1 -1
- package/dist-server/service/common-types/scalar-any.js +27 -13
- package/dist-server/service/common-types/scalar-any.js.map +1 -1
- package/dist-server/service/directive-transaction/index.js +1 -1
- package/dist-server/service/directive-transaction/transaction.js +5 -4
- package/dist-server/service/directive-transaction/transaction.js.map +1 -1
- package/dist-server/service/domain/domain-resolver.js +43 -41
- package/dist-server/service/domain/domain-resolver.js.map +1 -1
- package/dist-server/service/domain/domain-types.js +17 -17
- package/dist-server/service/domain/domain-types.js.map +1 -1
- package/dist-server/service/domain/domain.js +31 -31
- package/dist-server/service/domain/domain.js.map +1 -1
- package/dist-server/service/index.js +9 -6
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/subscription-data/data-resolver.js +5 -4
- package/dist-server/service/subscription-data/data-resolver.js.map +1 -1
- package/dist-server/service/subscription-data/data-types.js +4 -4
- package/dist-server/service/subscription-data/data-types.js.map +1 -1
- package/dist-server/utils/condition-builder.js +25 -26
- package/dist-server/utils/condition-builder.js.map +1 -1
- package/dist-server/utils/get-domain.js +3 -3
- package/dist-server/utils/get-domain.js.map +1 -1
- package/dist-server/utils/index.js +1 -1
- package/dist-server/utils/list-params-converter.js +21 -21
- package/dist-server/utils/list-params-converter.js.map +1 -1
- package/dist-server/utils/list-query-builder.js +4 -3
- package/dist-server/utils/list-query-builder.js.map +1 -1
- package/helps/about/components.md +3 -0
- package/helps/about/{common → framework}/redirection.md +0 -0
- package/helps/about/framework/typegraphql.md +74 -0
- package/helps/about/framework.md +10 -0
- package/helps/about/modules.md +3 -1
- package/helps/about/things-factory.en.md +3 -0
- package/helps/about/things-factory.ko.md +4 -0
- package/helps/components/oops-progress.md +73 -0
- 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/common-types/list-param.ts +1 -1
- package/server/service/common-types/scalar-any.ts +29 -13
- package/server/service/domain/domain-resolver.ts +8 -6
- package/server/service/index.ts +14 -5
- package/server/utils/condition-builder.ts +23 -25
- package/server/utils/list-query-builder.ts +1 -1
- package/db.test.sqlite +0 -0
package/bin/things-factory-dev
CHANGED
@@ -1,11 +1,5 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
in
|
7
|
-
i) INSPECT=${OPTARG};;
|
8
|
-
esac
|
9
|
-
done
|
10
|
-
node --inspect=$INSPECT -e "'use strict'
|
11
|
-
require('@things-factory/shell/dist-server/server-dev')" $0 $@
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
'use strict'
|
4
|
+
|
5
|
+
require('@things-factory/shell/dist-server/server-dev')
|
@@ -4,7 +4,8 @@ import { subscribe } from '../graphql-client'
|
|
4
4
|
export class OopsProgress extends LitElement {
|
5
5
|
static get properties() {
|
6
6
|
return {
|
7
|
-
tag: String
|
7
|
+
tag: String,
|
8
|
+
subscription: Boolean
|
8
9
|
}
|
9
10
|
}
|
10
11
|
|
@@ -17,19 +18,26 @@ export class OopsProgress extends LitElement {
|
|
17
18
|
this.stopSubscribe()
|
18
19
|
}
|
19
20
|
|
21
|
+
get subscription() {
|
22
|
+
return this._subscription
|
23
|
+
}
|
24
|
+
|
25
|
+
set subscription(subscription) {
|
26
|
+
console.warn('oops-progress#subscription is readonly property')
|
27
|
+
}
|
28
|
+
|
20
29
|
async updated(changes) {
|
21
|
-
if (changes.has('tag')) {
|
30
|
+
if (changes.has('tag') && this.subscription) {
|
22
31
|
await this.stopSubscribe()
|
23
|
-
await this.startSubscribe()
|
24
32
|
}
|
25
33
|
}
|
26
34
|
|
27
35
|
async startSubscribe() {
|
28
|
-
if (!this.tag || this.
|
36
|
+
if (!this.tag || this._subscription) {
|
29
37
|
return
|
30
38
|
}
|
31
39
|
|
32
|
-
this.
|
40
|
+
this._subscription = await subscribe(
|
33
41
|
{
|
34
42
|
query: `
|
35
43
|
subscription {
|
@@ -63,8 +71,8 @@ export class OopsProgress extends LitElement {
|
|
63
71
|
}
|
64
72
|
|
65
73
|
async stopSubscribe() {
|
66
|
-
await this.
|
67
|
-
delete this.
|
74
|
+
await this._subscription?.unsubscribe()
|
75
|
+
delete this._subscription
|
68
76
|
}
|
69
77
|
}
|
70
78
|
|
package/client/graphql-client.js
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
import { ApolloClient } from 'apollo
|
2
|
-
|
3
|
-
import { ApolloLink } from 'apollo-link'
|
4
|
-
import { HttpLink } from 'apollo-link-http'
|
5
|
-
import { onError } from 'apollo-link-error'
|
6
|
-
import { createUploadLink } from 'apollo-upload-client'
|
7
|
-
import { persistCache } from 'apollo-cache-persist'
|
1
|
+
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache, from } from '@apollo/client/core'
|
2
|
+
|
8
3
|
import { SubscriptionClient } from 'subscriptions-transport-ws'
|
4
|
+
import { createUploadLink } from 'apollo-upload-client'
|
5
|
+
import { onError } from '@apollo/client/link/error'
|
6
|
+
|
7
|
+
// import { persistCache } from 'apollo-cache-persist'
|
9
8
|
|
10
|
-
const GRAPHQL_URI = '/graphql'
|
9
|
+
export const GRAPHQL_URI = '/graphql'
|
11
10
|
|
12
11
|
const defaultOptions = {
|
13
12
|
watchQuery: {
|
@@ -23,7 +22,7 @@ const defaultOptions = {
|
|
23
22
|
}
|
24
23
|
}
|
25
24
|
|
26
|
-
const ERROR_HANDLER = ({ graphQLErrors, networkError }) => {
|
25
|
+
const ERROR_HANDLER = ({ operation, graphQLErrors, networkError }) => {
|
27
26
|
if (graphQLErrors) {
|
28
27
|
document.dispatchEvent(
|
29
28
|
new CustomEvent('notify', {
|
@@ -47,11 +46,18 @@ const ERROR_HANDLER = ({ graphQLErrors, networkError }) => {
|
|
47
46
|
document.dispatchEvent(new CustomEvent('domain-required'))
|
48
47
|
break
|
49
48
|
default:
|
49
|
+
var { name, response, statusCode, bodyText, message } = networkError
|
50
|
+
if (name == 'ServerParseError') {
|
51
|
+
message = `[ ${statusCode || ''} : ${response.statusText} ] ${bodyText}`
|
52
|
+
} else {
|
53
|
+
message = `[ ${statusCode || ''} : ${response.statusText} ] ${message}`
|
54
|
+
}
|
55
|
+
|
50
56
|
document.dispatchEvent(
|
51
57
|
new CustomEvent('notify', {
|
52
58
|
detail: {
|
53
59
|
level: 'error',
|
54
|
-
message
|
60
|
+
message,
|
55
61
|
ex: networkError
|
56
62
|
}
|
57
63
|
})
|
@@ -76,19 +82,19 @@ const httpLink = ApolloLink.split(
|
|
76
82
|
new HttpLink(httpOptions)
|
77
83
|
)
|
78
84
|
|
79
|
-
const initPersistCache = async () => {
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
+
// const initPersistCache = async () => {
|
86
|
+
// persistCache({
|
87
|
+
// cache,
|
88
|
+
// storage: window.localStorage
|
89
|
+
// })
|
90
|
+
// }
|
85
91
|
|
86
92
|
// initPersistCache()
|
87
93
|
|
88
94
|
export const client = new ApolloClient({
|
89
95
|
defaultOptions,
|
90
96
|
cache,
|
91
|
-
link:
|
97
|
+
link: from([onError(ERROR_HANDLER), httpLink])
|
92
98
|
})
|
93
99
|
|
94
100
|
/* SubscriptionClient */
|
package/client/index.js
CHANGED
@@ -49,48 +49,49 @@ class Queue {
|
|
49
49
|
}
|
50
50
|
}
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
].reduce(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
return await new Promise((resolve, reject) => {
|
73
|
-
request.onsuccess = event => {
|
74
|
-
resolve(event.target.result)
|
75
|
-
}
|
52
|
+
function getStore(storeName) {
|
53
|
+
return [
|
54
|
+
'add',
|
55
|
+
'delete',
|
56
|
+
'clear',
|
57
|
+
'get',
|
58
|
+
'getAll',
|
59
|
+
'getAllKeys',
|
60
|
+
'count',
|
61
|
+
'put',
|
62
|
+
'openCursor',
|
63
|
+
'openKeyCursor'
|
64
|
+
].reduce(
|
65
|
+
(sum, m) => {
|
66
|
+
sum[m] = async (...params) => {
|
67
|
+
const db = await getIndexDB()
|
68
|
+
const transaction = db.transaction(storeName, 'readwrite')
|
69
|
+
const store = transaction.objectStore(storeName)
|
70
|
+
const request = store[m].apply(store, params)
|
76
71
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
72
|
+
return await new Promise((resolve, reject) => {
|
73
|
+
request.onsuccess = event => {
|
74
|
+
resolve(event.target.result)
|
75
|
+
}
|
76
|
+
|
77
|
+
request.onerror = event => {
|
78
|
+
reject(event)
|
79
|
+
}
|
80
|
+
})
|
81
|
+
}
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
83
|
+
return sum
|
84
|
+
},
|
85
|
+
{
|
86
|
+
async limit(limit = 50) {
|
87
|
+
const keys = (await this.getAllKeys()).slice(0, -limit)
|
88
|
+
for (let i = 0; i < keys.length; i++) {
|
89
|
+
await this.delete(keys[i])
|
90
|
+
}
|
90
91
|
}
|
91
92
|
}
|
92
|
-
|
93
|
-
|
93
|
+
)
|
94
|
+
}
|
94
95
|
|
95
96
|
function getIndexedDB() {
|
96
97
|
if (typeof window !== 'undefined') {
|
@@ -102,7 +103,7 @@ function getIndexedDB() {
|
|
102
103
|
|
103
104
|
var db
|
104
105
|
|
105
|
-
function
|
106
|
+
function getIndexDB() {
|
106
107
|
if (db) {
|
107
108
|
return db
|
108
109
|
}
|
@@ -114,7 +115,7 @@ function getNotificationDB() {
|
|
114
115
|
if (!indexedDB) {
|
115
116
|
reject('this browser does not support indexedDB')
|
116
117
|
}
|
117
|
-
const request = getIndexedDB().open('
|
118
|
+
const request = getIndexedDB().open('things-factory-database')
|
118
119
|
|
119
120
|
request.onerror = function (event) {
|
120
121
|
console.log("Why didn't you allow my web app to use IndexedDB?!")
|
@@ -123,8 +124,12 @@ function getNotificationDB() {
|
|
123
124
|
|
124
125
|
request.onupgradeneeded = function (event) {
|
125
126
|
var db = event.target.result
|
127
|
+
|
126
128
|
var store = db.createObjectStore('notifications', { keyPath: 'id', autoIncrement: true })
|
127
129
|
store.createIndex('notification_id_unqiue', 'id', { unique: true })
|
130
|
+
|
131
|
+
var store = db.createObjectStore('client_settings', { keyPath: 'key', autoIncrement: true })
|
132
|
+
store.createIndex('client_setting_key_unqiue', 'key', { unique: true })
|
128
133
|
}
|
129
134
|
|
130
135
|
request.onsuccess = function (event) {
|
@@ -135,3 +140,7 @@ function getNotificationDB() {
|
|
135
140
|
})
|
136
141
|
)
|
137
142
|
}
|
143
|
+
|
144
|
+
/* ready indexedDB Stores */
|
145
|
+
export const clientSettingStore = getStore('client_settings')
|
146
|
+
export const notificationStore = getStore('notifications')
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { setCacheNameDetails } from 'workbox-core'
|
2
2
|
import * as navigationPreload from 'workbox-navigation-preload'
|
3
3
|
import { registerRoute, NavigationRoute } from 'workbox-routing'
|
4
4
|
import { precacheAndRoute, cleanupOutdatedCaches } from 'workbox-precaching'
|
5
5
|
import { StaleWhileRevalidate, NetworkFirst, CacheFirst, CacheOnly, NetworkOnly } from 'workbox-strategies'
|
6
6
|
import 'broadcastchannel-polyfill'
|
7
|
-
import { notificationStore } from '../
|
7
|
+
import { notificationStore } from '../indexdb'
|
8
8
|
|
9
9
|
const ENV = process.env
|
10
10
|
const production = ENV['NODE-ENV'] == 'production'
|
@@ -20,7 +20,7 @@ setCacheNameDetails({
|
|
20
20
|
|
21
21
|
/* for lifecycle */
|
22
22
|
|
23
|
-
skipWaiting()
|
23
|
+
self.skipWaiting()
|
24
24
|
|
25
25
|
/* for production only */
|
26
26
|
|
@@ -1,21 +1,21 @@
|
|
1
1
|
body {
|
2
2
|
/* oops note style */
|
3
|
-
--oops-note-icon-font: normal
|
4
|
-
--oops-note-icon-color: rgba(
|
5
|
-
--oops-note-icon-border:
|
3
|
+
--oops-note-icon-font: normal 24px var(--mdc-icon-font, 'Material Icons');
|
4
|
+
--oops-note-icon-color: rgba(var(--secondary-color-rgb), 0.3);
|
5
|
+
--oops-note-icon-border: 2px solid rgba(var(--secondary-color-rgb), 0.3);
|
6
6
|
--oops-note-icon-border-radius: 50px;
|
7
|
-
--oops-note-icon-padding:
|
8
|
-
--oops-note-title-margin:
|
9
|
-
--oops-note-title-font: bold
|
7
|
+
--oops-note-icon-padding: var(--padding-default);
|
8
|
+
--oops-note-title-margin: 7px 0 2px 0;
|
9
|
+
--oops-note-title-font: bold 14px var(--theme-font);
|
10
10
|
--oops-note-title-color: var(--secondary-color);
|
11
|
-
--oops-note-description-font: normal
|
11
|
+
--oops-note-description-font: normal 12px var(--theme-font);
|
12
12
|
--oops-note-description-color: var(--primary-color);
|
13
13
|
}
|
14
14
|
@media only screen and (max-width: 460px) {
|
15
15
|
body {
|
16
16
|
--oops-note-icon-padding: var(--padding-narrow);
|
17
|
-
--oops-note-icon-font: normal
|
18
|
-
--oops-note-title-font: bold
|
17
|
+
--oops-note-icon-font: normal 18px var(--mdc-icon-font, 'Material Icons');
|
18
|
+
--oops-note-title-font: bold 13px var(--theme-font);
|
19
19
|
--oops-note-title-margin: var(--margin-narrow) 0 2px 0;
|
20
20
|
--oops-note-description-font: normal 0px var(--theme-font);
|
21
21
|
}
|
@@ -26,13 +26,24 @@ module.exports = {
|
|
26
26
|
* pubsub configuration
|
27
27
|
* ie.
|
28
28
|
* pubsub: {
|
29
|
-
* middleware: 'redis', // empty, redis, mqtt
|
29
|
+
* middleware: 'redis', // empty, redis, mqtt, redisCluster
|
30
30
|
* host: 'redis',
|
31
31
|
* port: 6379,
|
32
32
|
* options: {
|
33
33
|
* ...
|
34
34
|
* }
|
35
35
|
* }
|
36
|
+
*
|
37
|
+
* pubsub: {
|
38
|
+
* middleware: 'redisCluster', // empty, redis, mqtt, redisCluster
|
39
|
+
* nodes: [
|
40
|
+
* { host: '{endpoint1}', port: 6379 },
|
41
|
+
* { host: '{endpoint2}', port: 6379 },
|
42
|
+
* ]
|
43
|
+
* options: {
|
44
|
+
* ...
|
45
|
+
* }
|
46
|
+
* }
|
36
47
|
*
|
37
48
|
* pubsub: {
|
38
49
|
* middleware: 'mqtt',
|
@@ -19,7 +19,7 @@ class GraphqlLocalClient {
|
|
19
19
|
// Execute the actual operation
|
20
20
|
const res = await executeOperation({
|
21
21
|
variables,
|
22
|
-
query: typeof operation === 'string' ? operation : graphql_1.print(operation)
|
22
|
+
query: typeof operation === 'string' ? operation : (0, graphql_1.print)(operation)
|
23
23
|
});
|
24
24
|
// Throw an error with all the messages of the
|
25
25
|
// errors to make them easy to match using Jest
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"graphql-local-client.js","sourceRoot":"","sources":["../server/graphql-local-client.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,qCAA6C;AA4B7C,MAAa,kBAAkB;IAG7B,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG;QACrB,MAAM,OAAO,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;YAChE,8CAA8C;YAC9C,MAAM,MAAM,GAAG,IAAI,qCAAgB,CAAC;gBAClC,MAAM;gBACN,OAAO,kCAOF,OAAO,KACV,GAAG,GACJ;aACF,CAAC,CAAA;YAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAC7D,MAAM,SAAS,GAAG,KAAK,IAAI,QAAQ,CAAA;YACnC,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE;gBACzC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;aACzE;YAED,+BAA+B;YAC/B,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC;gBACjC,SAAS;gBACT,KAAK,EAAE,OAAO,SA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AI,CAAC,CAAA;gBACjE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;aACzB;YAED,OAAO,GAAG,CAAA;QACZ,CAAC,CAAA;QAED,kBAAkB,CAAC,MAAM,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;IACjE,CAAC;CACF;AA5CD,gDA4CC"}
|
package/dist-server/index.js
CHANGED
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
7
7
|
o[k2] = m[k];
|
8
8
|
}));
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
11
|
};
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
__exportStar(require("./migrations"), exports);
|
@@ -11,9 +11,9 @@ try {
|
|
11
11
|
catch (e) {
|
12
12
|
ormconfig = require('@things-factory/shell/ormconfig');
|
13
13
|
}
|
14
|
-
|
14
|
+
const databaseInitializer = async () => {
|
15
15
|
try {
|
16
|
-
const connection = await typeorm_1.createConnection(ormconfig);
|
16
|
+
const connection = await (0, typeorm_1.createConnection)(ormconfig);
|
17
17
|
env_1.logger.info('Database connection established');
|
18
18
|
if (ormconfig.type == 'sqlite' && ormconfig.synchronize == false) {
|
19
19
|
await connection.query('PRAGMA foreign_keys=OFF');
|
@@ -26,4 +26,5 @@ exports.databaseInitializer = async () => {
|
|
26
26
|
env_1.logger.error(e);
|
27
27
|
}
|
28
28
|
};
|
29
|
+
exports.databaseInitializer = databaseInitializer;
|
29
30
|
//# sourceMappingURL=database.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../server/initializers/database.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAA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__importDefault(require("pluralize"));
|
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
10
10
|
class NamingStrategy extends typeorm_1.DefaultNamingStrategy {
|
11
11
|
tableName(targetName, userSpecifiedName) {
|
12
|
-
return userSpecifiedName || pluralize_1.default(lodash_1.default.snakeCase(targetName));
|
12
|
+
return userSpecifiedName || (0, pluralize_1.default)(lodash_1.default.snakeCase(targetName));
|
13
13
|
}
|
14
14
|
columnName(propertyName, customName, embeddedPrefixes) {
|
15
15
|
return lodash_1.default.snakeCase(embeddedPrefixes.concat(customName || propertyName).join('_'));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"naming-strategy.js","sourceRoot":"","sources":["../../server/initializers/naming-strategy.ts"],"names":[],"mappings":";;;;;;AACA,qCAA+C;AAC/C,0DAAiC;AACjC,oDAAsB;AAEtB,MAAa,cAAe,SAAQ,+BAAqB;IACvD,SAAS,CAAC,UAAkB,EAAE,iBAAyB;QACrD,OAAO,iBAAiB,IAAI,mBAAS,
|
1
|
+
{"version":3,"file":"naming-strategy.js","sourceRoot":"","sources":["../../server/initializers/naming-strategy.ts"],"names":[],"mappings":";;;;;;AACA,qCAA+C;AAC/C,0DAAiC;AACjC,oDAAsB;AAEtB,MAAa,cAAe,SAAQ,+BAAqB;IACvD,SAAS,CAAC,UAAkB,EAAE,iBAAyB;QACrD,OAAO,iBAAiB,IAAI,IAAA,mBAAS,EAAC,gBAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,UAAU,CAAC,YAAoB,EAAE,UAAkB,EAAE,gBAA0B;QAC7E,OAAO,gBAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAU,IAAI,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IACnF,CAAC;CACF;AARD,wCAQC"}
|
@@ -15,7 +15,7 @@ async function domainMiddleware(context, next) {
|
|
15
15
|
* For purposes such as API calls, the target domainType may be different from the system domainType.
|
16
16
|
* So, we don't check domainType here.
|
17
17
|
*/
|
18
|
-
context.state.domain = await utils_1.getDomainFromURL(context);
|
18
|
+
context.state.domain = await (0, utils_1.getDomainFromURL)(context);
|
19
19
|
debug('subdomain', context.path, (_a = context.state.domain) === null || _a === void 0 ? void 0 : _a.subdomain);
|
20
20
|
await next();
|
21
21
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-middleware.js","sourceRoot":"","sources":["../../server/middlewares/domain-middleware.ts"],"names":[],"mappings":";;;AAAA,oCAA2C;AAE3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,wCAAwC,CAAC,CAAA;AAEjE,KAAK,UAAU,gBAAgB,CAAC,OAAY,EAAE,IAAS;;IAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAChC,IAAI,MAAM,EAAE;QACV,KAAK,CAAC,sBAAsB,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;QAC7D,OAAO,MAAM,IAAI,EAAE,CAAA;KACpB;IAED;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,wBAAgB,
|
1
|
+
{"version":3,"file":"domain-middleware.js","sourceRoot":"","sources":["../../server/middlewares/domain-middleware.ts"],"names":[],"mappings":";;;AAAA,oCAA2C;AAE3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,wCAAwC,CAAC,CAAA;AAEjE,KAAK,UAAU,gBAAgB,CAAC,OAAY,EAAE,IAAS;;IAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAChC,IAAI,MAAM,EAAE;QACV,KAAK,CAAC,sBAAsB,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;QAC7D,OAAO,MAAM,IAAI,EAAE,CAAA;KACpB;IAED;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAA;IAEtD,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE,MAAA,OAAO,CAAC,KAAK,CAAC,MAAM,0CAAE,SAAS,CAAC,CAAA;IAEjE,MAAM,IAAI,EAAE,CAAA;AACd,CAAC;AAjBD,4CAiBC"}
|
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
7
7
|
o[k2] = m[k];
|
8
8
|
}));
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
11
|
};
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
exports.initMiddlewares = void 0;
|
@@ -41,7 +41,7 @@ function initMiddlewares(app) {
|
|
41
41
|
app.use(async (context, next) => {
|
42
42
|
const { method, path } = context;
|
43
43
|
if (method == 'POST' && path.startsWith('/graphql')) {
|
44
|
-
return await domain_middleware_1.domainMiddleware(context, next);
|
44
|
+
return await (0, domain_middleware_1.domainMiddleware)(context, next);
|
45
45
|
}
|
46
46
|
await next();
|
47
47
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAAoD;AACpD,2DAAsD;AAEtD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,iCAAiC,CAAC,CAAA;AAEjE,SAAgB,eAAe,CAAC,GAAG;IACjC,GAAG,CAAC,eAAe,GAAG,YAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAA;IAEtD,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;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G,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC9B,IAAI;YACF,MAAM,IAAI,EAAE,CAAA;SACb;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAA;YAClC,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,OAAO,CAAA;YAE1B,yCAAyC;YACzC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;SACxC;IACH,CAAC,CAAC,CAAA;IAEF;;;OAGG;IACH,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;QAEhC,IAAI,MAAM,IAAI,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YACnD,OAAO,MAAM,IAAA,oCAAgB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAA;SAC7C;QAED,MAAM,IAAI,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;AACJ,CAAC;AApCD,0CAoCC;AAED,OAAO,CAAC,EAAE,CAAC,+BAAsC,EAAE,CAAC,GAAG,EAAE,sBAAsB,EAAE,EAAE;IACjF,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAEtC,sBAAsB,CAAC,IAAI,CAAC,oCAAgB,CAAC,CAAA;AAC/C,CAAC,CAAC,CAAA;AAEF,sDAAmC"}
|
@@ -12,13 +12,13 @@ const SEED_DOMAINS = [
|
|
12
12
|
];
|
13
13
|
class SeedDomain1000000000000 {
|
14
14
|
async up(queryRunner) {
|
15
|
-
const repository = typeorm_1.getRepository(domain_1.Domain);
|
15
|
+
const repository = (0, typeorm_1.getRepository)(domain_1.Domain);
|
16
16
|
return await Promise.all(SEED_DOMAINS.map(async (domain) => {
|
17
17
|
await repository.save(Object.assign({}, domain));
|
18
18
|
}));
|
19
19
|
}
|
20
20
|
async down(queryRunner) {
|
21
|
-
const repository = typeorm_1.getRepository(domain_1.Domain);
|
21
|
+
const repository = (0, typeorm_1.getRepository)(domain_1.Domain);
|
22
22
|
return await Promise.all(SEED_DOMAINS.reverse().map(async (domain) => {
|
23
23
|
let recode = await repository.findOne({ subdomain: domain.subdomain });
|
24
24
|
await repository.remove(recode);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"1000000000000-SeedDomain.js","sourceRoot":"","sources":["../../server/migrations/1000000000000-SeedDomain.ts"],"names":[],"mappings":";;;AAAA,qCAAwE;AACxE,qDAAiD;AAEjD,MAAM,YAAY,GAAG;IACnB;QACE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,IAAI;KACjB;CACF,CAAA;AAED,MAAa,uBAAuB;IAC3B,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,UAAU,GAAG,uBAAa,
|
1
|
+
{"version":3,"file":"1000000000000-SeedDomain.js","sourceRoot":"","sources":["../../server/migrations/1000000000000-SeedDomain.ts"],"names":[],"mappings":";;;AAAA,qCAAwE;AACxE,qDAAiD;AAEjD,MAAM,YAAY,GAAG;IACnB;QACE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,IAAI;KACjB;CACF,CAAA;AAED,MAAa,uBAAuB;IAC3B,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,eAAM,CAAC,CAAA;QAExC,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,YAAY,CAAC,GAAG,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE;YAC9B,MAAM,UAAU,CAAC,IAAI,mBAChB,MAAM,EACT,CAAA;QACJ,CAAC,CAAC,CACH,CAAA;IACH,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAwB;QACxC,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,eAAM,CAAC,CAAA;QAExC,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,YAAY,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE;YACxC,IAAI,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAA;YACtE,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACjC,CAAC,CAAC,CACH,CAAA;IACH,CAAC;CACF;AAvBD,0DAuBC"}
|
@@ -12,7 +12,7 @@ class PubSubLogTransport extends winston_transport_1.default {
|
|
12
12
|
super(opts);
|
13
13
|
this.topic = opts.topic;
|
14
14
|
this.source = opts.source;
|
15
|
-
this.resolver = opts.resolver || camelCase_1.default(this.topic);
|
15
|
+
this.resolver = opts.resolver || (0, camelCase_1.default)(this.topic);
|
16
16
|
}
|
17
17
|
log(info, callback) {
|
18
18
|
setImmediate(() => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pubsub-log-transport.js","sourceRoot":"","sources":["../server/pubsub-log-transport.ts"],"names":[],"mappings":";;;;;;AAAA,iEAAwC;AACxC,0EAAyC;AACzC,qCAAiC;AAEjC,MAAa,kBAAmB,SAAQ,2BAAS;IAK/C,YAAY,IAAI;QACd,KAAK,CAAC,IAAI,CAAC,CAAA;QAEX,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,mBAAS,
|
1
|
+
{"version":3,"file":"pubsub-log-transport.js","sourceRoot":"","sources":["../server/pubsub-log-transport.ts"],"names":[],"mappings":";;;;;;AAAA,iEAAwC;AACxC,0EAAyC;AACzC,qCAAiC;AAEjC,MAAa,kBAAmB,SAAQ,2BAAS;IAK/C,YAAY,IAAI;QACd,KAAK,CAAC,IAAI,CAAC,CAAA;QAEX,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAA,mBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACxD,CAAC;IAED,GAAG,CAAC,IAAI,EAAE,QAAQ;QAChB,YAAY,CAAC,GAAG,EAAE;YAChB,eAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE;gBACzB,CAAC,IAAI,CAAC,QAAQ,CAAC,kBACb,MAAM,EAAE,IAAI,CAAC,MAAM,IAChB,IAAI,CACR;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,EAAE,CAAA;IACZ,CAAC;CACF;AAzBD,gDAyBC"}
|
package/dist-server/pubsub.js
CHANGED
@@ -4,27 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.pubsub = void 0;
|
7
|
-
const
|
8
|
-
const { middleware, host, port, options } = env_1.config.get('pubsub', {});
|
9
|
-
const graphql_subscriptions_1 = require("graphql-subscriptions");
|
7
|
+
const graphql_mqtt_subscriptions_1 = require("graphql-mqtt-subscriptions");
|
10
8
|
const graphql_redis_subscriptions_1 = require("graphql-redis-subscriptions");
|
9
|
+
const graphql_subscriptions_1 = require("graphql-subscriptions");
|
11
10
|
const ioredis_1 = __importDefault(require("ioredis"));
|
12
11
|
const mqtt_1 = require("mqtt");
|
13
|
-
const
|
12
|
+
const env_1 = require("@things-factory/env");
|
13
|
+
const { middleware, host, port, nodes, options } = env_1.config.get('pubsub', {});
|
14
14
|
const debug = require('debug')('things-factory:shell');
|
15
|
-
// override publish because payload of redis publish is required string only.
|
16
|
-
class MyRedisPubSub extends graphql_redis_subscriptions_1.RedisPubSub {
|
17
|
-
publish(trigger, payload) {
|
18
|
-
debug('payload', payload);
|
19
|
-
return super.publish(trigger, JSON.stringify(payload));
|
20
|
-
}
|
21
|
-
}
|
22
15
|
let pubsub;
|
23
16
|
exports.pubsub = pubsub;
|
24
17
|
switch (middleware) {
|
25
18
|
case 'mqtt':
|
26
19
|
exports.pubsub = pubsub = new graphql_mqtt_subscriptions_1.MQTTPubSub({
|
27
|
-
client: mqtt_1.connect('mqtt://' + host, Object.assign({ reconnectPeriod: 1000 }, options))
|
20
|
+
client: (0, mqtt_1.connect)('mqtt://' + host, Object.assign({ reconnectPeriod: 1000 }, options))
|
28
21
|
});
|
29
22
|
break;
|
30
23
|
case 'redis':
|
@@ -33,11 +26,20 @@ switch (middleware) {
|
|
33
26
|
// reconnect after
|
34
27
|
return Math.min(times * 50, 2000);
|
35
28
|
} }, options);
|
36
|
-
exports.pubsub = pubsub = new
|
29
|
+
exports.pubsub = pubsub = new graphql_redis_subscriptions_1.RedisPubSub({
|
37
30
|
publisher: new ioredis_1.default(redisOption),
|
38
31
|
subscriber: new ioredis_1.default(redisOption)
|
39
32
|
});
|
33
|
+
break;
|
34
|
+
case 'redisCluster':
|
35
|
+
const cluster = new ioredis_1.default.Cluster(nodes, options);
|
36
|
+
exports.pubsub = pubsub = new graphql_redis_subscriptions_1.RedisPubSub({
|
37
|
+
publisher: cluster,
|
38
|
+
subscriber: cluster
|
39
|
+
});
|
40
|
+
break;
|
40
41
|
default:
|
41
42
|
exports.pubsub = pubsub = new graphql_subscriptions_1.PubSub();
|
43
|
+
break;
|
42
44
|
}
|
43
45
|
//# sourceMappingURL=pubsub.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pubsub.js","sourceRoot":"","sources":["../server/pubsub.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;
|
1
|
+
{"version":3,"file":"pubsub.js","sourceRoot":"","sources":["../server/pubsub.ts"],"names":[],"mappings":";;;;;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ACrB,MAAK;CACR"}
|
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
7
7
|
o[k2] = m[k];
|
8
8
|
}));
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
11
|
};
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
__exportStar(require("./global-router"), exports);
|