@things-factory/shell 9.0.0-beta.5 → 9.0.0-beta.50
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/_index.html +0 -1
- package/config/config.development.js +1 -1
- package/config/config.production.js +1 -14
- package/dist-server/middlewares/domain-middleware.js +3 -3
- package/dist-server/middlewares/domain-middleware.js.map +1 -1
- package/dist-server/migrations/index.js +4 -5
- package/dist-server/migrations/index.js.map +1 -1
- package/dist-server/server.js +1 -1
- package/dist-server/server.js.map +1 -1
- package/dist-server/service/domain/domain-query.d.ts +1 -0
- package/dist-server/service/domain/domain-query.js +12 -0
- package/dist-server/service/domain/domain-query.js.map +1 -1
- package/dist-server/service/domain/domain-types.d.ts +2 -0
- package/dist-server/service/domain/domain-types.js +8 -0
- package/dist-server/service/domain/domain-types.js.map +1 -1
- package/dist-server/service/domain/domain.js +1 -35
- package/dist-server/service/domain/domain.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/utils/get-domain.d.ts +9 -10
- package/dist-server/utils/get-domain.js +66 -71
- package/dist-server/utils/get-domain.js.map +1 -1
- package/dist-server/utils/get-query-builder-from-list-params.js.map +1 -1
- package/dist-server/utils/get-times-for-period.d.ts +24 -4
- package/dist-server/utils/get-times-for-period.js +42 -5
- package/dist-server/utils/get-times-for-period.js.map +1 -1
- package/package.json +9 -11
- package/translations/en.json +2 -0
- package/translations/ja.json +2 -0
- package/translations/ko.json +3 -1
- package/translations/ms.json +2 -0
- package/translations/zh.json +2 -0
- package/views/public/home.html +0 -1
- package/client/scene/scene-components.js +0 -3
- package/client/scene/scene-player.js +0 -103
- package/client/scene/scene-viewer.js +0 -106
- package/client/scene/things-scene-components.import +0 -1
package/_index.html
CHANGED
@@ -51,7 +51,6 @@
|
|
51
51
|
|
52
52
|
<!-- Performance tip: hint to the browser to start the handshake for the fonts site -->
|
53
53
|
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin />
|
54
|
-
<link href="/node_modules/@material-design-icons/font/index.css" rel="stylesheet" />
|
55
54
|
<link href="/node_modules/material-symbols/index.css" rel="stylesheet" />
|
56
55
|
<link href="/node_modules/@fontsource/roboto/index.css" rel="stylesheet" />
|
57
56
|
<link rel="stylesheet" href="/theme.css" />
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module.exports = {
|
2
|
-
|
2
|
+
domainTypes: ['domain'],
|
3
3
|
port: 3000,
|
4
4
|
subdomainOffset: 2,
|
5
5
|
keepAliveTimeout: 65000,
|
@@ -98,19 +98,6 @@ module.exports = {
|
|
98
98
|
* }
|
99
99
|
**/
|
100
100
|
|
101
|
-
/**
|
102
|
-
* Domain Primary Colulumn Configuration
|
103
|
-
* support
|
104
|
-
* Types : "int","int2","int4","int8","integer","tinyint","smallint","mediumint","bigint",'uuid'
|
105
|
-
* Strategy = 'uuid','rowid',"increment","identity"
|
106
|
-
* by defualt use uuid auto generated id
|
107
|
-
* ie.
|
108
|
-
* domainPrimaryOption:{
|
109
|
-
* type:'int8',
|
110
|
-
* strategy:null
|
111
|
-
* }
|
112
|
-
*/
|
113
|
-
|
114
101
|
/*
|
115
102
|
* pubsub configuration
|
116
103
|
* ie.
|
@@ -8,9 +8,9 @@ async function domainMiddleware(context, next) {
|
|
8
8
|
var { domain } = context.state;
|
9
9
|
if (!domain) {
|
10
10
|
/*
|
11
|
-
* The
|
12
|
-
* For purposes such as API calls, the target
|
13
|
-
* So, we don't check
|
11
|
+
* The domainTypes should be checked only when signin and checkin.
|
12
|
+
* For purposes such as API calls, the target domainTypes may be different from the system domainTypes.
|
13
|
+
* So, we don't check domainTypes here.
|
14
14
|
*/
|
15
15
|
domain = await (0, get_domain_js_1.getDomainFromURL)(context);
|
16
16
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-middleware.js","sourceRoot":"","sources":["../../server/middlewares/domain-middleware.ts"],"names":[],"mappings":";;AAGA,4CAwDC;;AA3DD,oEAAkC;AAClC,0DAAyD;A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AG,CAAA;gBACpB,OAAM;YACR,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7D,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACrC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAClC,CAAC,CAAC,CAAA;YAEF,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAA;YAE9B,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,UAAU,CAAA;YACjD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;IAE7B,OAAO,IAAI,EAAE,CAAA;AACf,CAAC","sourcesContent":["import requestIp from 'request-ip'\nimport { getDomainFromURL } from '../utils/get-domain.js'\n\nexport async function domainMiddleware(context: any, next: any) {\n var { domain } = context.state\n if (!domain) {\n /*\n * The
|
1
|
+
{"version":3,"file":"domain-middleware.js","sourceRoot":"","sources":["../../server/middlewares/domain-middleware.ts"],"names":[],"mappings":";;AAGA,4CAwDC;;AA3DD,oEAAkC;AAClC,0DAAyD;AAElD,KAAK,UAAU,gBAAgB,CAAC,OAAY,EAAE,IAAS;IAC5D,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ;;;;WAIG;QACH,MAAM,GAAG,MAAM,IAAA,gCAAgB,EAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,oBAAS,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC7C,MAAM,EAAE,SAAS,GAAG,EAAE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AI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,UAAU,CAAA;YACjD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;IAE7B,OAAO,IAAI,EAAE,CAAA;AACf,CAAC","sourcesContent":["import requestIp from 'request-ip'\nimport { getDomainFromURL } from '../utils/get-domain.js'\n\nexport async function domainMiddleware(context: any, next: any) {\n var { domain } = context.state\n if (!domain) {\n /*\n * The domainTypes should be checked only when signin and checkin.\n * For purposes such as API calls, the target domainTypes may be different from the system domainTypes.\n * So, we don't check domainTypes here.\n */\n domain = await getDomainFromURL(context)\n }\n\n if (domain) {\n const ip = requestIp.getClientIp(context.req)\n const { whitelist = [], blacklist = [], protectedlist = [], privileges = [] } = domain.iplist || {}\n\n if (Array.isArray(whitelist) && whitelist.length > 0) {\n /* whitelist 우선 */\n const whitelisted =\n Array.isArray(whitelist) &&\n whitelist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n if (!whitelisted) {\n context.status = 403\n return\n }\n } else {\n const blacklisted =\n Array.isArray(blacklist) &&\n blacklist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n if (blacklisted) {\n context.status = 403\n return\n }\n }\n\n if (Array.isArray(protectedlist) && protectedlist.length > 0) {\n const safe = protectedlist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n context.state.unsafeIP = !safe\n\n if (!safe) {\n context.state.prohibitedPrivileges = privileges\n }\n }\n }\n\n context.state.domain = domain\n\n return next()\n}\n"]}
|
@@ -1,13 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.migrations = void 0;
|
4
|
-
const
|
5
|
-
const
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
4
|
+
const glob = require('glob');
|
5
|
+
const path = require('path');
|
7
6
|
exports.migrations = [];
|
8
|
-
|
7
|
+
glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function (file) {
|
9
8
|
if (file.indexOf('index.js') !== -1)
|
10
9
|
return;
|
11
|
-
exports.migrations = exports.migrations.concat(Object.values(require(
|
10
|
+
exports.migrations = exports.migrations.concat(Object.values(require(path.resolve(file))) || []);
|
12
11
|
});
|
13
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI;IAC1E,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA","sourcesContent":["const glob = require('glob')\nconst path = require('path')\n\nexport var migrations = []\n\nglob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function (file) {\n if (file.indexOf('index.js') !== -1) return\n migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])\n})\n"]}
|
package/dist-server/server.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../server/server.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;AA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AS,CAAC,CAAA;IAChG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,EAAE,CAAA","sourcesContent":["// ts-import-sorter: disable\n\n/* following 5 lines should be located in top of the file */\nimport OS from 'os'\nprocess.env.UV_THREADPOOL_SIZE = String(OS.availableParallelism())\n\nconsole.log('UV_THREADPOOL_SIZE', process.env.UV_THREADPOOL_SIZE)\n\nprocess.env.NODE_ENV = 'production'\nprocess.setMaxListeners(0)\n\nimport { ApolloServer } from '@apollo/server'\nimport { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'\nimport { ApolloServerPluginLandingPageProductionDefault } from '@apollo/server/plugin/landingPage/default'\nimport { koaMiddleware } from '@as-integrations/koa'\n\nimport bytesFormat from 'bytes'\nimport graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'\nimport { useServer } from 'graphql-ws/lib/use/ws'\nimport { createServer } from 'http'\nimport Koa from 'koa'\nimport koaBodyParser from 'koa-bodyparser'\nimport koaStatic from 'koa-static'\nimport compose from 'koa-compose'\nimport { historyApiFallback } from 'koa2-connect-history-api-fallback'\nimport { WebSocketServer } from 'ws'\nimport co from 'co'\nimport http from 'http'\nimport path from 'path'\nimport args from 'args'\n\nimport cors from '@koa/cors'\nimport crypto from 'crypto'\n\nimport { config, loader, logger, orderedModuleNames } from '@things-factory/env'\nimport { initLicense, checkValidity } from '@things-factory/operato-license-checker'\n\nimport { GraphqlLocalClient } from './graphql-local-client.js'\nimport { databaseInitializer } from './initializers/database.js'\nimport {\n domainPrivateRouter,\n domainPublicRouter,\n globalPrivateRouter,\n globalPublicRouter,\n graphqlRouter\n} from './routers/index.js'\nimport { schema } from './schema.js'\nimport { domainMiddleware } from './middlewares/domain-middleware.js'\nimport { setupProcessExitHandlers } from './process-cleaner.js'\n\nsetupProcessExitHandlers()\n\nargs.option('port', 'The port on which the app will be running', config.get('port', 3000))\n\nconst flags = args.parse(process.argv)\n\nconst PORT = (process.env.PORT = flags.port)\n\nconst requestBody = config.get('requestBody') || {}\n\nconst bodyParserOption = {\n formLimit: requestBody.formLimit || '10mb',\n jsonLimit: requestBody.jsonLimit || '10mb',\n textLimit: requestBody.textLimit || '10mb'\n}\n\nconst fileUpload = config.get('fileUpload') || {}\nconst fileUploadOption = {\n maxFileSize: bytesFormat.parse(fileUpload.maxFileSize) || bytesFormat.parse('10mb'),\n maxFiles: fileUpload.maxFiles || 10\n}\n\ninitLicense(config.get('licenseKey'))\n\n/* bootstrap */\nconst bootstrap = async () => {\n await databaseInitializer()\n\n const app = new Koa() as any\n app.proxy = true\n\n app.use(\n cors({\n origin: function (ctx) {\n return ctx.request.headers.origin || '*'\n },\n exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],\n maxAge: 5,\n credentials: true,\n /* allowMethods: ['GET', 'POST', 'DELETE'], -- use default */\n allowHeaders: ['Content-Type', 'Authorization', 'Accept']\n })\n )\n\n app.use(async (ctx, next) => {\n ctx.set('X-Content-Type-Options', 'nosniff')\n\n const { directives = {} } = config.get('CSP') || {}\n\n const nonce = crypto.randomBytes(16).toString('base64')\n ctx.state.nonce = nonce\n\n const cspHeader = Object.entries(directives as { [key: string]: string[] })\n .map(([key, value]) => `${key} ${value.join(' ')}`)\n .join('; ')\n\n ctx.set('Content-Security-Policy', cspHeader)\n\n await next()\n })\n\n var subscriptionMiddleware = []\n process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)\n\n const builtSchema = await schema()\n\n const httpServer = createServer(app.callback())\n const websocketServer = new WebSocketServer({\n server: httpServer,\n path: '/graphql'\n })\n\n // Save the returned server's info so we can shut down this server later\n const serverCleanup = useServer(\n {\n schema: builtSchema,\n context: async (ctx, msg, args) => {\n return ctx['context']\n },\n onConnect: async ctx => {\n var { extra, connectionParams } = ctx\n var { request } = extra\n\n if (((connectionParams['headers'] as any) || connectionParams)?.referer) {\n var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)\n var accessToken = url.searchParams.get('access_token')\n if (accessToken) {\n connectionParams['headers']['authorization'] = accessToken\n }\n }\n\n request.headers = {\n ...request.headers,\n ...(connectionParams['headers'] || (connectionParams as any))\n }\n\n var koacontext = await app.createContext(request, new http.ServerResponse(request))\n koacontext['state'] = {}\n\n /* in case connect error(like a authentication error) just throw exception */\n var middlewares = [domainMiddleware, ...subscriptionMiddleware]\n const fn = co.wrap(compose(middlewares))\n\n await fn(koacontext)\n\n return (ctx['context'] = koacontext)\n },\n onDisconnect(ctx, code, reason) {\n console.log('Disconnected!')\n },\n onError(ctx, msg, errors) {\n console.error(msg, errors)\n }\n },\n websocketServer\n )\n\n const server = new ApolloServer({\n schema: builtSchema,\n formatError: error => {\n logger.error(error)\n return error\n },\n introspection: true,\n csrfPrevention: true,\n plugins: [\n // Proper shutdown for the HTTP server.\n ApolloServerPluginDrainHttpServer({ httpServer }),\n // Proper shutdown for the WebSocket server.\n {\n async serverWillStart() {\n return {\n async drainServer() {\n await serverCleanup.dispose()\n }\n }\n }\n },\n // TODO make this landing page work\n ApolloServerPluginLandingPageProductionDefault({\n graphRef: 'my-graph-id@my-graph-variant',\n footer: false\n })\n ],\n cache: 'bounded'\n })\n\n await server.start()\n\n GraphqlLocalClient.init(builtSchema, app)\n\n orderedModuleNames.forEach(name => {\n const { initMiddlewares } = loader(name)\n initMiddlewares && initMiddlewares(app)\n })\n\n const render = require('@things-factory/ejs-remote')\n render(app, {\n root: '/views',\n host: `http://127.0.0.1:${PORT}`,\n layout: false,\n viewExt: 'html',\n cache: true,\n debug: false\n })\n\n app.use(koaBodyParser(bodyParserOption))\n\n /* routers */\n const ssoMiddlewares = []\n process.emit('bootstrap-collect-sso-middleware' as any, null, ssoMiddlewares)\n app.ssoMiddlewares = ssoMiddlewares\n\n process.emit('bootstrap-module-global-public-route' as any, app, globalPublicRouter)\n process.emit('bootstrap-module-global-private-route' as any, app, globalPrivateRouter)\n process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)\n process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)\n\n app.use(checkValidity) /* Check the license after most of the context has been built */\n\n app\n .use(globalPublicRouter.routes())\n .use(globalPublicRouter.allowedMethods())\n .use(globalPrivateRouter.routes())\n .use(globalPrivateRouter.allowedMethods())\n .use(domainPublicRouter.routes())\n .use(domainPublicRouter.allowedMethods())\n .use(domainPrivateRouter.routes())\n .use(domainPrivateRouter.allowedMethods())\n\n /* Graphql Upload's multipart/form-data handling affects the restful file upload feature, so it should be placed after the routers configuration. */\n app.use(graphqlUploadKoa(fileUploadOption))\n\n graphqlRouter.post(\n '/graphql',\n koaMiddleware(server, {\n context: async ({ ctx }) => ctx\n })\n )\n app.use(graphqlRouter.routes())\n app.use(graphqlRouter.allowedMethods())\n\n /* should follow this order : history-fallback => koaStatic */\n app.use(historyApiFallback({ whiteList: [] }))\n\n app.use(\n koaStatic(path.join(process.cwd(), 'dist-app'), {\n index: 'index.html'\n })\n )\n\n // Set keep-alive timeout from configuration or fallback to default (65000ms).\n // The keepAliveTimeout determines how long the server will keep an idle connection\n // alive before closing it.\n const keepAliveTimeout = config.get('keepAliveTimeout', 65000)\n\n // Apply the configured keep-alive timeout to the server. If no configuration is\n // provided, default to 65000ms (65 seconds). In the context of an external load balancer,\n // this timeout is critical for maintaining persistent connections between the load\n // balancer and the server. Setting a sufficiently long keepAliveTimeout minimizes\n // the need to constantly re-establish TCP connections, improving efficiency and\n // reducing connection overhead.\n httpServer.keepAliveTimeout = keepAliveTimeout || 65000\n\n // Set headersTimeout to be 1000ms (1 second) longer than keepAliveTimeout.\n // This ensures the server has sufficient time to receive headers from the client\n // before closing the connection, preventing premature disconnections. In the context\n // of a load balancer, this ensures that if the load balancer is sending headers\n // slowly (due to network delays or other factors), the connection isn't closed\n // before the headers are fully transmitted.\n httpServer.headersTimeout = keepAliveTimeout + 1000\n\n httpServer.listen({ port: PORT }, () => {\n logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}/graphql`)\n logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)\n\n process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)\n })\n}\n\nbootstrap()\n"]}
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../server/server.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;AAE5B,4DAA4D;AAC5D,oDAAmB;AACnB,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,MAAM,CAAC,YAAE,CAAC,oBAAoB,EAAE,CAAC,CAAA;AAElE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;AAEjE,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAA;AACnC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;AAE1B,2CAA6C;AAC7C,2EAAyF;AACzF,uEAA0G;AAC1G,8CAAoD;AAEpD,0DAA+B;AAC/B,qGAAiE;AACjE,8CAAiD;AACjD,+BAAmC;AACnC,sDAAqB;AACrB,4EAA0C;AAC1C,oEAAkC;AAClC,sEAAiC;AACjC,yFAAsE;AACtE,2BAAoC;AACpC,oDAAmB;AACnB,wDAAuB;AACvB,wDAAuB;AACvB,wDAAuB;AAEvB,6DAA4B;AAC5B,4DAA2B;AAE3B,6CAAgF;AAChF,qFAAoF;AAEpF,uEAA8D;AAC9D,4DAAgE;AAChE,iDAM2B;AAC3B,2CAAoC;AACpC,6EAAqE;AACrE,6DAA+D;AAE/D,IAAA,6CAAwB,GAAE,CAAA;AAE1B,cAAI,CAAC,MAAM,CAAC,MAAM,EAAE,2CAA2C,EAAE,YAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAE1F,MAAM,KAAK,GAAG,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAEtC,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;AAE5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AAM,CAAC,IAAI,CAAC,0CAA0C,IAAI,UAAU,CAAC,CAAA;QAErE,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","sourcesContent":["// ts-import-sorter: disable\n\n/* following 5 lines should be located in top of the file */\nimport OS from 'os'\nprocess.env.UV_THREADPOOL_SIZE = String(OS.availableParallelism())\n\nconsole.log('UV_THREADPOOL_SIZE', process.env.UV_THREADPOOL_SIZE)\n\nprocess.env.NODE_ENV = 'production'\nprocess.setMaxListeners(0)\n\nimport { ApolloServer } from '@apollo/server'\nimport { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'\nimport { ApolloServerPluginLandingPageProductionDefault } from '@apollo/server/plugin/landingPage/default'\nimport { koaMiddleware } from '@as-integrations/koa'\n\nimport bytesFormat from 'bytes'\nimport graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'\nimport { useServer } from 'graphql-ws/lib/use/ws'\nimport { createServer } from 'http'\nimport Koa from 'koa'\nimport koaBodyParser from 'koa-bodyparser'\nimport koaStatic from 'koa-static'\nimport compose from 'koa-compose'\nimport { historyApiFallback } from 'koa2-connect-history-api-fallback'\nimport { WebSocketServer } from 'ws'\nimport co from 'co'\nimport http from 'http'\nimport path from 'path'\nimport args from 'args'\n\nimport cors from '@koa/cors'\nimport crypto from 'crypto'\n\nimport { config, loader, logger, orderedModuleNames } from '@things-factory/env'\nimport { initLicense, checkValidity } from '@things-factory/operato-license-checker'\n\nimport { GraphqlLocalClient } from './graphql-local-client.js'\nimport { databaseInitializer } from './initializers/database.js'\nimport {\n domainPrivateRouter,\n domainPublicRouter,\n globalPrivateRouter,\n globalPublicRouter,\n graphqlRouter\n} from './routers/index.js'\nimport { schema } from './schema.js'\nimport { domainMiddleware } from './middlewares/domain-middleware.js'\nimport { setupProcessExitHandlers } from './process-cleaner.js'\n\nsetupProcessExitHandlers()\n\nargs.option('port', 'The port on which the app will be running', config.get('port', 3000))\n\nconst flags = args.parse(process.argv)\n\nconst PORT = (process.env.PORT = flags.port)\n\nconst requestBody = config.get('requestBody') || {}\n\nconst bodyParserOption = {\n formLimit: requestBody.formLimit || '10mb',\n jsonLimit: requestBody.jsonLimit || '10mb',\n textLimit: requestBody.textLimit || '10mb'\n}\n\nconst fileUpload = config.get('fileUpload') || {}\nconst fileUploadOption = {\n maxFileSize: bytesFormat.parse(fileUpload.maxFileSize) || bytesFormat.parse('10mb'),\n maxFiles: fileUpload.maxFiles || 10\n}\n\ninitLicense(config.get('licenseKey'))\n\n/* bootstrap */\nconst bootstrap = async () => {\n await databaseInitializer()\n\n const app = new Koa() as any\n app.proxy = true\n\n app.use(\n cors({\n origin: function (ctx) {\n return ctx.request.headers.origin || '*'\n },\n exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],\n maxAge: 5,\n credentials: true,\n /* allowMethods: ['GET', 'POST', 'DELETE'], -- use default */\n allowHeaders: ['Content-Type', 'Authorization', 'Accept']\n })\n )\n\n app.use(async (ctx, next) => {\n ctx.set('X-Content-Type-Options', 'nosniff')\n\n const { directives = {} } = config.get('CSP') || {}\n\n const nonce = crypto.randomBytes(16).toString('base64')\n ctx.state.nonce = nonce\n\n const cspHeader = Object.entries(directives as { [key: string]: string[] })\n .map(([key, value]) => `${key} ${value.join(' ')}`)\n .join('; ')\n\n ctx.set('Content-Security-Policy', cspHeader)\n\n await next()\n })\n\n var subscriptionMiddleware = []\n process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)\n\n const builtSchema = await schema()\n\n const httpServer = createServer(app.callback())\n const websocketServer = new WebSocketServer({\n server: httpServer,\n path: '/graphql'\n })\n\n // Save the returned server's info so we can shut down this server later\n const serverCleanup = useServer(\n {\n schema: builtSchema,\n context: async (ctx, msg, args) => {\n return ctx['context']\n },\n onConnect: async ctx => {\n var { extra, connectionParams } = ctx\n var { request } = extra\n\n if (((connectionParams['headers'] as any) || connectionParams)?.referer) {\n var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)\n var accessToken = url.searchParams.get('access_token')\n if (accessToken) {\n connectionParams['headers']['authorization'] = accessToken\n }\n }\n\n request.headers = {\n ...request.headers,\n ...(connectionParams['headers'] || (connectionParams as any))\n }\n\n var koacontext = await app.createContext(request, new http.ServerResponse(request))\n koacontext['state'] = {}\n\n /* in case connect error(like a authentication error) just throw exception */\n var middlewares = [domainMiddleware, ...subscriptionMiddleware]\n const fn = co.wrap(compose(middlewares))\n\n await fn(koacontext)\n\n return (ctx['context'] = koacontext)\n },\n onDisconnect(ctx, code, reason) {\n console.log('Disconnected!')\n },\n onError(ctx, msg, errors) {\n console.error(msg, errors)\n }\n },\n websocketServer\n )\n\n const server = new ApolloServer({\n schema: builtSchema,\n formatError: error => {\n logger.error(error)\n return error\n },\n introspection: false,\n csrfPrevention: true,\n plugins: [\n // Proper shutdown for the HTTP server.\n ApolloServerPluginDrainHttpServer({ httpServer }),\n // Proper shutdown for the WebSocket server.\n {\n async serverWillStart() {\n return {\n async drainServer() {\n await serverCleanup.dispose()\n }\n }\n }\n },\n // TODO make this landing page work\n ApolloServerPluginLandingPageProductionDefault({\n graphRef: 'my-graph-id@my-graph-variant',\n footer: false\n })\n ],\n cache: 'bounded'\n })\n\n await server.start()\n\n GraphqlLocalClient.init(builtSchema, app)\n\n orderedModuleNames.forEach(name => {\n const { initMiddlewares } = loader(name)\n initMiddlewares && initMiddlewares(app)\n })\n\n const render = require('@things-factory/ejs-remote')\n render(app, {\n root: '/views',\n host: `http://127.0.0.1:${PORT}`,\n layout: false,\n viewExt: 'html',\n cache: true,\n debug: false\n })\n\n app.use(koaBodyParser(bodyParserOption))\n\n /* routers */\n const ssoMiddlewares = []\n process.emit('bootstrap-collect-sso-middleware' as any, null, ssoMiddlewares)\n app.ssoMiddlewares = ssoMiddlewares\n\n process.emit('bootstrap-module-global-public-route' as any, app, globalPublicRouter)\n process.emit('bootstrap-module-global-private-route' as any, app, globalPrivateRouter)\n process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)\n process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)\n\n app.use(checkValidity) /* Check the license after most of the context has been built */\n\n app\n .use(globalPublicRouter.routes())\n .use(globalPublicRouter.allowedMethods())\n .use(globalPrivateRouter.routes())\n .use(globalPrivateRouter.allowedMethods())\n .use(domainPublicRouter.routes())\n .use(domainPublicRouter.allowedMethods())\n .use(domainPrivateRouter.routes())\n .use(domainPrivateRouter.allowedMethods())\n\n /* Graphql Upload's multipart/form-data handling affects the restful file upload feature, so it should be placed after the routers configuration. */\n app.use(graphqlUploadKoa(fileUploadOption))\n\n graphqlRouter.post(\n '/graphql',\n koaMiddleware(server, {\n context: async ({ ctx }) => ctx\n })\n )\n app.use(graphqlRouter.routes())\n app.use(graphqlRouter.allowedMethods())\n\n /* should follow this order : history-fallback => koaStatic */\n app.use(historyApiFallback({ whiteList: [] }))\n\n app.use(\n koaStatic(path.join(process.cwd(), 'dist-app'), {\n index: 'index.html'\n })\n )\n\n // Set keep-alive timeout from configuration or fallback to default (65000ms).\n // The keepAliveTimeout determines how long the server will keep an idle connection\n // alive before closing it.\n const keepAliveTimeout = config.get('keepAliveTimeout', 65000)\n\n // Apply the configured keep-alive timeout to the server. If no configuration is\n // provided, default to 65000ms (65 seconds). In the context of an external load balancer,\n // this timeout is critical for maintaining persistent connections between the load\n // balancer and the server. Setting a sufficiently long keepAliveTimeout minimizes\n // the need to constantly re-establish TCP connections, improving efficiency and\n // reducing connection overhead.\n httpServer.keepAliveTimeout = keepAliveTimeout || 65000\n\n // Set headersTimeout to be 1000ms (1 second) longer than keepAliveTimeout.\n // This ensures the server has sufficient time to receive headers from the client\n // before closing the connection, preventing premature disconnections. In the context\n // of a load balancer, this ensures that if the load balancer is sending headers\n // slowly (due to network delays or other factors), the connection isn't closed\n // before the headers are fully transmitted.\n httpServer.headersTimeout = keepAliveTimeout + 1000\n\n httpServer.listen({ port: PORT }, () => {\n logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}/graphql`)\n logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)\n\n process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)\n })\n}\n\nbootstrap()\n"]}
|
@@ -2,6 +2,7 @@ import { ListParam } from '../common-types/list-param.js';
|
|
2
2
|
import { Domain, IPList } from './domain.js';
|
3
3
|
import { DomainList } from './domain-types.js';
|
4
4
|
export declare class DomainQuery {
|
5
|
+
domainTypes(context: any): Promise<String[]>;
|
5
6
|
domain(id: string, context: any): Promise<Domain>;
|
6
7
|
domains(params: ListParam, context: any): Promise<DomainList>;
|
7
8
|
secureIPList(context: any): Promise<IPList | null>;
|
@@ -9,7 +9,11 @@ const list_param_js_1 = require("../common-types/list-param.js");
|
|
9
9
|
const domain_js_1 = require("./domain.js");
|
10
10
|
const domain_types_js_1 = require("./domain-types.js");
|
11
11
|
const scalar_object_js_1 = require("../common-types/scalar-object.js");
|
12
|
+
const env_1 = require("@things-factory/env");
|
12
13
|
let DomainQuery = class DomainQuery {
|
14
|
+
async domainTypes(context) {
|
15
|
+
return env_1.config.get('domainTypes') || ['domain'];
|
16
|
+
}
|
13
17
|
async domain(id, context) {
|
14
18
|
const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
|
15
19
|
return await repository.findOneBy({ id });
|
@@ -33,6 +37,14 @@ let DomainQuery = class DomainQuery {
|
|
33
37
|
}
|
34
38
|
};
|
35
39
|
exports.DomainQuery = DomainQuery;
|
40
|
+
tslib_1.__decorate([
|
41
|
+
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
42
|
+
(0, type_graphql_1.Query)(returns => [String], { description: 'To fetch domain' }),
|
43
|
+
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
44
|
+
tslib_1.__metadata("design:type", Function),
|
45
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
46
|
+
tslib_1.__metadata("design:returntype", Promise)
|
47
|
+
], DomainQuery.prototype, "domainTypes", null);
|
36
48
|
tslib_1.__decorate([
|
37
49
|
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
38
50
|
(0, type_graphql_1.Query)(returns => domain_js_1.Domain, { description: 'To fetch domain' }),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAExG,gEAA8D;AAC9D,6GAAiG;AAEjG,iEAAyD;AACzD,2CAA4C;AAC5C,uDAA8C;AAC9C,uEAA+D;
|
1
|
+
{"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAExG,gEAA8D;AAC9D,6GAAiG;AAEjG,iEAAyD;AACzD,2CAA4C;AAC5C,uDAA8C;AAC9C,uEAA+D;AAC/D,6CAA4C;AAGrC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGhB,AAAN,KAAK,CAAC,WAAW,CAAQ,OAAY;QACnC,OAAO,YAAM,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAChD,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CAAY,EAAU,EAAS,OAAY;QACrD,MAAM,UAAU,GAAG,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAA;QAExC,OAAO,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC3C,CAAC;IAIK,AAAN,KAAK,CAAC,OAAO,CAA0B,MAAiB,EAAS,OAAY;QAC3E,MAAM,YAAY,GAAG,MAAM,IAAA,qEAA6B,EAAC;YACvD,UAAU,EAAE,IAAA,2BAAa,EAAC,kBAAM,CAAC;YACjC,KAAK,EAAE,cAAc;YACrB,MAAM;YACN,WAAW,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A,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,yBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,yBAAS;;0CAWvD;AAIK;IAFL,IAAA,wBAAS,EAAC,wGAAwG,CAAC;IACnH,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,+BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAC/D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAGxB;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,kBAAM;;yCAElC;sBAxCU,WAAW;IADvB,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,WAAW,CAyCvB","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, FieldResolver, Root } from 'type-graphql'\n\nimport { getRepository } from '../../initializers/database.js'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params.js'\n\nimport { ListParam } from '../common-types/list-param.js'\nimport { Domain, IPList } from './domain.js'\nimport { DomainList } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\nimport { config } from '@things-factory/env'\n\n@Resolver(Domain)\nexport class DomainQuery {\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => [String], { description: 'To fetch domain' })\n async domainTypes(@Ctx() context: any): Promise<String[]> {\n return config.get('domainTypes') || ['domain']\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => Domain, { description: 'To fetch domain' })\n async domain(@Arg('id') id: string, @Ctx() context: any): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' })\n async domains(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<DomainList> {\n const queryBuilder = await getQueryBuilderFromListParams({\n repository: getRepository(Domain),\n alias: 'ContactPoint',\n params,\n searchables: ['name', 'description', 'subdomain']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => ScalarObject, { nullable: true, description: 'To fetch domain' })\n async secureIPList(@Ctx() context: any): Promise<IPList | null> {\n const { domain } = context.state\n return domain.iplist\n }\n\n @FieldResolver(type => Domain)\n async parent(@Root() domain: Domain): Promise<Domain> {\n return domain.parentId && (await getRepository(Domain).findOneBy({ id: domain.parentId }))\n }\n}\n"]}
|
@@ -3,6 +3,7 @@ import { ObjectRef } from '../common-types/index.js';
|
|
3
3
|
export declare class DomainInput {
|
4
4
|
name: string;
|
5
5
|
description?: string;
|
6
|
+
extType?: string;
|
6
7
|
}
|
7
8
|
export declare class DomainPatch {
|
8
9
|
id?: string;
|
@@ -16,6 +17,7 @@ export declare class DomainPatch {
|
|
16
17
|
brandName?: string;
|
17
18
|
brandImage?: string;
|
18
19
|
contentImage?: string;
|
20
|
+
extType?: string;
|
19
21
|
attributes?: any;
|
20
22
|
theme?: string;
|
21
23
|
}
|
@@ -16,6 +16,10 @@ tslib_1.__decorate([
|
|
16
16
|
(0, type_graphql_1.Field)({ nullable: true }),
|
17
17
|
tslib_1.__metadata("design:type", String)
|
18
18
|
], DomainInput.prototype, "description", void 0);
|
19
|
+
tslib_1.__decorate([
|
20
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
21
|
+
tslib_1.__metadata("design:type", String)
|
22
|
+
], DomainInput.prototype, "extType", void 0);
|
19
23
|
exports.DomainInput = DomainInput = tslib_1.__decorate([
|
20
24
|
(0, type_graphql_1.InputType)()
|
21
25
|
], DomainInput);
|
@@ -66,6 +70,10 @@ tslib_1.__decorate([
|
|
66
70
|
(0, type_graphql_1.Field)({ nullable: true }),
|
67
71
|
tslib_1.__metadata("design:type", String)
|
68
72
|
], DomainPatch.prototype, "contentImage", void 0);
|
73
|
+
tslib_1.__decorate([
|
74
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
75
|
+
tslib_1.__metadata("design:type", String)
|
76
|
+
], DomainPatch.prototype, "extType", void 0);
|
69
77
|
tslib_1.__decorate([
|
70
78
|
(0, type_graphql_1.Field)(type => index_js_1.ScalarObject, { nullable: true }),
|
71
79
|
tslib_1.__metadata("design:type", Object)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,2CAA4C;AAC5C,uDAAkE;AAG3D,IAAM,WAAW,GAAjB,MAAM,WAAW;
|
1
|
+
{"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,2CAA4C;AAC5C,uDAAkE;AAG3D,IAAM,WAAW,GAAjB,MAAM,WAAW;CASvB,CAAA;AATY,kCAAW;AAEtB;IADC,IAAA,oBAAK,GAAE;;yCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;sBARL,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CASvB;AAGM,IAAM,WAAW,GAAjB,MAAM,WAAW;CA0CvB,CAAA;AA1CY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACf;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AAG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AC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC1B;qBALF,UAAU;IADtB,IAAA,yBAAU,GAAE;GACA,UAAU,CAMtB","sourcesContent":["import { ObjectType, InputType, Field, Int } from 'type-graphql'\nimport { Domain, IPList } from './domain.js'\nimport { ObjectRef, ScalarObject } from '../common-types/index.js'\n\n@InputType()\nexport class DomainInput {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n extType?: string\n}\n\n@InputType()\nexport class DomainPatch {\n @Field({ nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n timezone?: string\n\n @Field({ nullable: true })\n systemFlag?: Boolean\n\n @Field({ nullable: true })\n subdomain?: string\n\n @Field({ nullable: true })\n owner?: string\n\n @Field(type => ObjectRef, { nullable: true })\n parent?: ObjectRef\n\n @Field({ nullable: true })\n brandName?: string\n\n @Field({ nullable: true })\n brandImage?: string\n\n @Field({ nullable: true })\n contentImage?: string\n\n @Field({ nullable: true })\n extType?: string\n\n @Field(type => ScalarObject, { nullable: true })\n attributes?: any\n\n @Field({ nullable: true })\n theme?: string\n}\n\n@ObjectType()\nexport class DomainList {\n @Field(type => [Domain], { nullable: true })\n items: Domain[]\n\n @Field(type => Int, { nullable: true })\n total: number\n}\n"]}
|
@@ -4,47 +4,13 @@ exports.Domain = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const typeorm_1 = require("typeorm");
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
7
|
-
const env_1 = require("@things-factory/env");
|
8
7
|
const scalar_object_js_1 = require("../common-types/scalar-object.js");
|
9
|
-
const numericTypes = ['int', 'int2', 'int4', 'int8', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint'];
|
10
|
-
const generatedStrategy = ['uuid', 'rowid', 'increment', 'identity'];
|
11
|
-
const domainPrimaryOption = env_1.config.get('domainPrimaryOption');
|
12
|
-
const domainPrimaryType = domainPrimaryOption === null || domainPrimaryOption === void 0 ? void 0 : domainPrimaryOption.type;
|
13
|
-
const domainPrimaryStrategy = domainPrimaryOption === null || domainPrimaryOption === void 0 ? void 0 : domainPrimaryOption.strategy;
|
14
8
|
let Domain = class Domain {
|
15
9
|
};
|
16
10
|
exports.Domain = Domain;
|
17
11
|
tslib_1.__decorate([
|
12
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
18
13
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
19
|
-
(0, typeorm_1.Column)(domainPrimaryOption
|
20
|
-
? {
|
21
|
-
type: domainPrimaryType,
|
22
|
-
primary: true,
|
23
|
-
transformer: {
|
24
|
-
//from(value: DatabaseType): EntityType
|
25
|
-
from: value => {
|
26
|
-
return value;
|
27
|
-
},
|
28
|
-
//to(value: EntityType): DatabaseType
|
29
|
-
to: value => {
|
30
|
-
if (!value) {
|
31
|
-
value = 0;
|
32
|
-
}
|
33
|
-
if (numericTypes.indexOf(domainPrimaryType) >= 0) {
|
34
|
-
return parseInt(value);
|
35
|
-
}
|
36
|
-
else {
|
37
|
-
return value;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
},
|
41
|
-
generated: generatedStrategy.indexOf(domainPrimaryStrategy) >= 0 ? domainPrimaryStrategy : false
|
42
|
-
}
|
43
|
-
: {
|
44
|
-
type: 'uuid',
|
45
|
-
primary: true,
|
46
|
-
generated: 'uuid'
|
47
|
-
}),
|
48
14
|
tslib_1.__metadata("design:type", String)
|
49
15
|
], Domain.prototype, "id", void 0);
|
50
16
|
tslib_1.__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../server/service/domain/domain.ts"],"names":[],"mappings":";;;;AAAA,
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../server/service/domain/domain.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAA+D;AAC/D,uEAA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AQ,EAAE,IAAI,EAAE,CAAC;IACzC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,+BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAChC;AAIhB;IAFC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzB,IAAA,0BAAgB,GAAE;sCACR,IAAI;yCAAA;AAIf;IAFC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzB,IAAA,0BAAgB,GAAE;sCACR,IAAI;yCAAA;AAIf;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;yCAAA;iBA/EL,MAAM;IANlB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,aAAa,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;QAC9E,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,yBAAU,GAAE;GACA,MAAM,CAgFlB","sourcesContent":["import {\n Column,\n CreateDateColumn,\n ManyToOne,\n OneToMany,\n RelationId,\n Entity,\n Index,\n UpdateDateColumn,\n DeleteDateColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Directive, Field, ID } from 'type-graphql'\nimport { ScalarObject } from '../common-types/scalar-object.js'\n\nexport type IPList = {\n whitelist?: string[]\n blacklist?: string[]\n protectedlist?: string[]\n privileges?: {\n category: string\n privilege: string\n }[]\n}\n\n@Entity()\n@Index('ix_domain_0', (domain: Domain) => [domain.subdomain, domain.deletedAt], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@ObjectType()\nexport class Domain {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Field()\n @Column({ unique: true })\n name: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n description: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n extType: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n timezone: string\n\n @Directive('@deprecated(reason: \"Use `parent`\")')\n @Field({ nullable: true })\n @Column({ default: false })\n systemFlag: boolean\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n subdomain: string\n\n @Field({ nullable: true })\n @ManyToOne(type => Domain, { nullable: true })\n parent: Domain\n\n @RelationId((domain: Domain) => domain.parent)\n parentId?: string\n\n @OneToMany(type => Domain, domain => domain.parent)\n @Field(type => Domain, { nullable: true })\n children: Domain[]\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n brandName: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n brandImage: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n contentImage: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n owner: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n theme: string\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n iplist?: IPList\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n attributes?: any\n\n @Field({ nullable: true })\n @CreateDateColumn()\n createdAt: Date\n\n @Field({ nullable: true })\n @UpdateDateColumn()\n updatedAt: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n}\n"]}
|