@things-factory/shell 8.0.0-beta.1 → 8.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/package.json +6 -6
  2. package/server/graphql-local-client.ts +0 -59
  3. package/server/index.ts +0 -13
  4. package/server/initializers/database.ts +0 -96
  5. package/server/initializers/naming-strategy.ts +0 -14
  6. package/server/middlewares/domain-middleware.ts +0 -60
  7. package/server/middlewares/index.ts +0 -43
  8. package/server/migrations/1000000000000-SeedDomain.ts +0 -37
  9. package/server/migrations/index.ts +0 -9
  10. package/server/pubsub-log-transport.ts +0 -59
  11. package/server/pubsub.ts +0 -84
  12. package/server/routers/domain-router.ts +0 -13
  13. package/server/routers/global-router.ts +0 -76
  14. package/server/routers/graphql-router.ts +0 -3
  15. package/server/routers/index.ts +0 -3
  16. package/server/schema.ts +0 -163
  17. package/server/server-dev.ts +0 -305
  18. package/server/server.ts +0 -296
  19. package/server/service/attribute-set/attribute-set-item-type.ts +0 -65
  20. package/server/service/attribute-set/attribute-set-mutation.ts +0 -125
  21. package/server/service/attribute-set/attribute-set-query.ts +0 -36
  22. package/server/service/attribute-set/attribute-set-type.ts +0 -46
  23. package/server/service/attribute-set/attribute-set.ts +0 -35
  24. package/server/service/attribute-set/index.ts +0 -6
  25. package/server/service/common-types/index.ts +0 -6
  26. package/server/service/common-types/list-param.ts +0 -61
  27. package/server/service/common-types/log.ts +0 -17
  28. package/server/service/common-types/object-ref.ts +0 -13
  29. package/server/service/common-types/scalar-any.ts +0 -44
  30. package/server/service/common-types/scalar-date.ts +0 -22
  31. package/server/service/common-types/scalar-object.ts +0 -15
  32. package/server/service/directive-transaction/index.ts +0 -1
  33. package/server/service/directive-transaction/transaction.ts +0 -40
  34. package/server/service/domain/domain-mutation.ts +0 -120
  35. package/server/service/domain/domain-query.ts +0 -48
  36. package/server/service/domain/domain-types.ts +0 -63
  37. package/server/service/domain/domain.ts +0 -147
  38. package/server/service/domain/index.ts +0 -6
  39. package/server/service/index.ts +0 -32
  40. package/server/service/subscription-data/data-resolver.ts +0 -37
  41. package/server/service/subscription-data/data-types.ts +0 -16
  42. package/server/service/subscription-data/index.ts +0 -4
  43. package/server/typeorm/encrypt-transform.ts +0 -70
  44. package/server/typeorm/get-data-encryption-key.ts +0 -13
  45. package/server/typeorm/json5-transform.ts +0 -26
  46. package/server/typeorm/round-transform.ts +0 -20
  47. package/server/utils/condition-builder.ts +0 -145
  48. package/server/utils/get-domain.ts +0 -226
  49. package/server/utils/get-query-builder-from-list-params.ts +0 -469
  50. package/server/utils/get-times-for-period.ts +0 -60
  51. package/server/utils/index.ts +0 -8
  52. package/server/utils/list-param-adjuster.ts +0 -21
  53. package/server/utils/list-params-converter.ts +0 -200
  54. package/server/utils/list-query-builder.ts +0 -120
  55. package/server/utils/publish-progress.ts +0 -23
package/server/server.ts DELETED
@@ -1,296 +0,0 @@
1
- // ts-import-sorter: disable
2
-
3
- /* following 5 lines should be located in top of the file */
4
- const OS = require('os')
5
- process.env.UV_THREADPOOL_SIZE = OS.cpus().length
6
-
7
- console.log('UV_THREADPOOL_SIZE', process.env.UV_THREADPOOL_SIZE)
8
-
9
- process.env.NODE_ENV = 'production'
10
- process.setMaxListeners(0)
11
-
12
- import { ApolloServer } from '@apollo/server'
13
- import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'
14
- import { ApolloServerPluginLandingPageProductionDefault } from '@apollo/server/plugin/landingPage/default'
15
- import { koaMiddleware } from '@as-integrations/koa'
16
-
17
- import bytesFormat from 'bytes'
18
- import graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'
19
- import { useServer } from 'graphql-ws/lib/use/ws'
20
- import { createServer } from 'http'
21
- import Koa from 'koa'
22
- import koaBodyParser from 'koa-bodyparser'
23
- import koaStatic from 'koa-static'
24
- import compose from 'koa-compose'
25
- import { historyApiFallback } from 'koa2-connect-history-api-fallback'
26
- import { WebSocketServer } from 'ws'
27
- import co from 'co'
28
- import http from 'http'
29
-
30
- import cors from '@koa/cors'
31
- import crypto from 'crypto'
32
-
33
- import { config, loader, logger, orderedModuleNames } from '@things-factory/env'
34
- import { initLicense, checkValidity } from '@things-factory/operato-license-checker'
35
-
36
- import { GraphqlLocalClient } from './graphql-local-client'
37
- import { databaseInitializer } from './initializers/database'
38
- import {
39
- domainPrivateRouter,
40
- domainPublicRouter,
41
- globalPrivateRouter,
42
- globalPublicRouter,
43
- graphqlRouter
44
- } from './routers'
45
- import { schema } from './schema'
46
- import { domainMiddleware } from './middlewares'
47
-
48
- process.on('uncaughtException', error => {
49
- logger.error('uncaughtException: ', error)
50
-
51
- //process.exit(1)
52
- })
53
-
54
- const args = require('args')
55
-
56
- args.option('port', 'The port on which the app will be running', config.get('port', 3000))
57
-
58
- const flags = args.parse(process.argv)
59
-
60
- const path = require('path')
61
-
62
- const PORT = (process.env.PORT = flags.port)
63
-
64
- const requestBody = config.get('requestBody') || {}
65
-
66
- const bodyParserOption = {
67
- formLimit: requestBody.formLimit || '10mb',
68
- jsonLimit: requestBody.jsonLimit || '10mb',
69
- textLimit: requestBody.textLimit || '10mb'
70
- }
71
-
72
- const fileUpload = config.get('fileUpload') || {}
73
- const fileUploadOption = {
74
- maxFileSize: bytesFormat.parse(fileUpload.maxFileSize) || bytesFormat.parse('10mb'),
75
- maxFiles: fileUpload.maxFiles || 10
76
- }
77
-
78
- initLicense(config.get('licenseKey'))
79
-
80
- /* bootstrap */
81
- const bootstrap = async () => {
82
- await databaseInitializer()
83
-
84
- const app = new Koa() as any
85
- app.proxy = true
86
-
87
- app.use(
88
- cors({
89
- origin: function (ctx) {
90
- return ctx.request.headers.origin || '*'
91
- },
92
- exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],
93
- maxAge: 5,
94
- credentials: true,
95
- /* allowMethods: ['GET', 'POST', 'DELETE'], -- use default */
96
- allowHeaders: ['Content-Type', 'Authorization', 'Accept']
97
- })
98
- )
99
-
100
- app.use(async (ctx, next) => {
101
- ctx.set('X-Content-Type-Options', 'nosniff')
102
-
103
- const { directives = {} } = config.get('CSP') || {}
104
-
105
- const nonce = crypto.randomBytes(16).toString('base64')
106
- ctx.state.nonce = nonce
107
-
108
- const cspHeader = Object.entries(directives as { [key: string]: string[] })
109
- .map(([key, value]) => `${key} ${value.join(' ')}`)
110
- .join('; ')
111
-
112
- ctx.set('Content-Security-Policy', cspHeader)
113
-
114
- await next()
115
- })
116
-
117
- var subscriptionMiddleware = []
118
- process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)
119
-
120
- const builtSchema = await schema()
121
-
122
- const httpServer = createServer(app.callback())
123
- const websocketServer = new WebSocketServer({
124
- server: httpServer,
125
- path: '/graphql'
126
- })
127
-
128
- // Save the returned server's info so we can shut down this server later
129
- const serverCleanup = useServer(
130
- {
131
- schema: builtSchema,
132
- context: async (ctx, msg, args) => {
133
- return ctx['context']
134
- },
135
- onConnect: async ctx => {
136
- var { extra, connectionParams } = ctx
137
- var { request } = extra
138
-
139
- if (((connectionParams['headers'] as any) || connectionParams)?.referer) {
140
- var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)
141
- var accessToken = url.searchParams.get('access_token')
142
- if (accessToken) {
143
- connectionParams['headers']['authorization'] = accessToken
144
- }
145
- }
146
-
147
- request.headers = {
148
- ...request.headers,
149
- ...(connectionParams['headers'] || (connectionParams as any))
150
- }
151
-
152
- var koacontext = await app.createContext(request, new http.ServerResponse(request))
153
- koacontext['state'] = {}
154
-
155
- /* in case connect error(like a authentication error) just throw exception */
156
- var middlewares = [domainMiddleware, ...subscriptionMiddleware]
157
- const fn = co.wrap(compose(middlewares))
158
-
159
- await fn(koacontext)
160
-
161
- return (ctx['context'] = koacontext)
162
- },
163
- onDisconnect(ctx, code, reason) {
164
- console.log('Disconnected!')
165
- },
166
- onError(ctx, msg, errors) {
167
- console.error(msg, errors)
168
- }
169
- },
170
- websocketServer
171
- )
172
-
173
- const server = new ApolloServer({
174
- schema: builtSchema,
175
- formatError: error => {
176
- logger.error(error)
177
- return error
178
- },
179
- introspection: true,
180
- csrfPrevention: true,
181
- plugins: [
182
- // Proper shutdown for the HTTP server.
183
- ApolloServerPluginDrainHttpServer({ httpServer }),
184
- // Proper shutdown for the WebSocket server.
185
- {
186
- async serverWillStart() {
187
- return {
188
- async drainServer() {
189
- await serverCleanup.dispose()
190
- }
191
- }
192
- }
193
- },
194
- // TODO make this landing page work
195
- ApolloServerPluginLandingPageProductionDefault({
196
- graphRef: 'my-graph-id@my-graph-variant',
197
- footer: false
198
- })
199
- ],
200
- cache: 'bounded'
201
- })
202
-
203
- await server.start()
204
-
205
- GraphqlLocalClient.init(builtSchema, app)
206
-
207
- orderedModuleNames.forEach(name => {
208
- const { initMiddlewares } = loader(name)
209
- initMiddlewares && initMiddlewares(app)
210
- })
211
-
212
- const render = require('@things-factory/ejs-remote')
213
- render(app, {
214
- root: '/views',
215
- host: `http://127.0.0.1:${PORT}`,
216
- layout: false,
217
- viewExt: 'html',
218
- cache: true,
219
- debug: false
220
- })
221
-
222
- app.use(koaBodyParser(bodyParserOption))
223
-
224
- /* routers */
225
- const ssoMiddlewares = []
226
- process.emit('bootstrap-collect-sso-middleware' as any, null, ssoMiddlewares)
227
- app.ssoMiddlewares = ssoMiddlewares
228
-
229
- process.emit('bootstrap-module-global-public-route' as any, app, globalPublicRouter)
230
- process.emit('bootstrap-module-global-private-route' as any, app, globalPrivateRouter)
231
- process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)
232
- process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)
233
-
234
- app.use(checkValidity) /* Check the license after most of the context has been built */
235
-
236
- app
237
- .use(globalPublicRouter.routes())
238
- .use(globalPublicRouter.allowedMethods())
239
- .use(globalPrivateRouter.routes())
240
- .use(globalPrivateRouter.allowedMethods())
241
- .use(domainPublicRouter.routes())
242
- .use(domainPublicRouter.allowedMethods())
243
- .use(domainPrivateRouter.routes())
244
- .use(domainPrivateRouter.allowedMethods())
245
-
246
- /* Graphql Upload's multipart/form-data handling affects the restful file upload feature, so it should be placed after the routers configuration. */
247
- app.use(graphqlUploadKoa(fileUploadOption))
248
-
249
- graphqlRouter.post(
250
- '/graphql',
251
- koaMiddleware(server, {
252
- context: async ({ ctx }) => ctx
253
- })
254
- )
255
- app.use(graphqlRouter.routes())
256
- app.use(graphqlRouter.allowedMethods())
257
-
258
- /* should follow this order : history-fallback => koaStatic */
259
- app.use(historyApiFallback({ whiteList: [] }))
260
-
261
- app.use(
262
- koaStatic(path.join(process.cwd(), 'dist-app'), {
263
- index: 'index.html'
264
- })
265
- )
266
-
267
- // Set keep-alive timeout from configuration or fallback to default (65000ms).
268
- // The keepAliveTimeout determines how long the server will keep an idle connection
269
- // alive before closing it.
270
- const keepAliveTimeout = config.get('keepAliveTimeout', 65000)
271
-
272
- // Apply the configured keep-alive timeout to the server. If no configuration is
273
- // provided, default to 65000ms (65 seconds). In the context of an external load balancer,
274
- // this timeout is critical for maintaining persistent connections between the load
275
- // balancer and the server. Setting a sufficiently long keepAliveTimeout minimizes
276
- // the need to constantly re-establish TCP connections, improving efficiency and
277
- // reducing connection overhead.
278
- httpServer.keepAliveTimeout = keepAliveTimeout || 65000
279
-
280
- // Set headersTimeout to be 1000ms (1 second) longer than keepAliveTimeout.
281
- // This ensures the server has sufficient time to receive headers from the client
282
- // before closing the connection, preventing premature disconnections. In the context
283
- // of a load balancer, this ensures that if the load balancer is sending headers
284
- // slowly (due to network delays or other factors), the connection isn't closed
285
- // before the headers are fully transmitted.
286
- httpServer.headersTimeout = keepAliveTimeout + 1000
287
-
288
- httpServer.listen({ port: PORT }, () => {
289
- logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}/graphql`)
290
- logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)
291
-
292
- process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)
293
- })
294
- }
295
-
296
- bootstrap()
@@ -1,65 +0,0 @@
1
- import { Field, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'
2
- import { ScalarObject } from '../common-types'
3
-
4
- export enum AttributeSetItemType {
5
- number = 'number',
6
- text = 'text',
7
- boolean = 'boolean',
8
- select = 'select',
9
- date = 'date',
10
- datetime = 'datetime',
11
- file = 'file'
12
- }
13
-
14
- registerEnumType(AttributeSetItemType, {
15
- name: 'AttributeSetItemType',
16
- description: 'type enumeration of a attribute-set-item'
17
- })
18
-
19
- @ObjectType({ description: 'Entity for AttributeSetItem' })
20
- export class AttributeSetItem {
21
- @Field()
22
- name: string
23
-
24
- @Field({ nullable: true })
25
- description?: string
26
-
27
- @Field({ nullable: true })
28
- tag?: string
29
-
30
- @Field({ nullable: true })
31
- active?: boolean
32
-
33
- @Field({ nullable: true })
34
- hidden?: boolean
35
-
36
- @Field({ nullable: true })
37
- type?: AttributeSetItemType
38
-
39
- @Field(type => ScalarObject, { nullable: true })
40
- options?: { [option: string]: any }
41
- }
42
-
43
- @InputType()
44
- export class AttributeSetItemPatch {
45
- @Field({ nullable: true })
46
- name?: string
47
-
48
- @Field({ nullable: true })
49
- description?: string
50
-
51
- @Field({ nullable: true })
52
- tag?: string
53
-
54
- @Field(type => AttributeSetItemType, { nullable: true })
55
- type?: AttributeSetItemType
56
-
57
- @Field(type => ScalarObject, { nullable: true })
58
- options?: { [option: string]: any }
59
-
60
- @Field({ nullable: true })
61
- active?: boolean
62
-
63
- @Field({ nullable: true })
64
- hidden?: boolean
65
- }
@@ -1,125 +0,0 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { AttributeSet } from './attribute-set'
5
- import { NewAttributeSet, AttributeSetPatch } from './attribute-set-type'
6
-
7
- @Resolver(AttributeSet)
8
- export class AttributeSetMutation {
9
- @Directive('@transaction')
10
- @Directive('@privilege(superUserGranted: true)')
11
- @Mutation(returns => AttributeSet, { description: 'To create new AttributeSet' })
12
- async createAttributeSet(@Arg('attribute') attribute: NewAttributeSet, @Ctx() context: any): Promise<AttributeSet> {
13
- const { tx } = context.state
14
-
15
- return await tx.getRepository(AttributeSet).save({
16
- ...attribute
17
- })
18
- }
19
-
20
- @Directive('@transaction')
21
- @Directive('@privilege(superUserGranted: true)')
22
- @Mutation(returns => AttributeSet, { description: 'To modify AttributeSet information' })
23
- async updateAttributeSet(
24
- @Arg('id') id: string,
25
- @Arg('patch') patch: AttributeSetPatch,
26
- @Ctx() context: any
27
- ): Promise<AttributeSet> {
28
- const { tx } = context.state
29
-
30
- const repository = tx.getRepository(AttributeSet)
31
- const attribute = await repository.findOne({
32
- where: { id }
33
- })
34
-
35
- return await repository.save({
36
- ...attribute,
37
- ...patch
38
- })
39
- }
40
-
41
- @Directive('@transaction')
42
- @Directive('@privilege(superUserGranted: true)')
43
- @Mutation(returns => [AttributeSet], { description: "To modify multiple AttributeSets' information" })
44
- async updateMultipleAttributeSet(
45
- @Arg('patches', type => [AttributeSetPatch]) patches: AttributeSetPatch[],
46
- @Ctx() context: any
47
- ): Promise<AttributeSet[]> {
48
- const { tx } = context.state
49
-
50
- let results = []
51
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
52
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
53
- const attributeRepo = tx.getRepository(AttributeSet)
54
-
55
- if (_createRecords.length > 0) {
56
- for (let i = 0; i < _createRecords.length; i++) {
57
- const newRecord = _createRecords[i]
58
-
59
- const result = await attributeRepo.save({
60
- ...newRecord
61
- })
62
-
63
- results.push({ ...result, cuFlag: '+' })
64
- }
65
- }
66
-
67
- if (_updateRecords.length > 0) {
68
- for (let i = 0; i < _updateRecords.length; i++) {
69
- const updateRecord = _updateRecords[i]
70
- const attribute = await attributeRepo.findOneBy({ id: updateRecord.id })
71
-
72
- const result = await attributeRepo.save({
73
- ...attribute,
74
- ...updateRecord
75
- })
76
-
77
- results.push({ ...result, cuFlag: 'M' })
78
- }
79
- }
80
-
81
- return results
82
- }
83
-
84
- @Directive('@transaction')
85
- @Directive('@privilege(superUserGranted: true)')
86
- @Mutation(returns => Boolean, { description: 'To delete AttributeSet' })
87
- async deleteAttributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
88
- const { tx } = context.state
89
-
90
- await tx.getRepository(AttributeSet).delete({ id })
91
-
92
- return true
93
- }
94
-
95
- @Directive('@transaction')
96
- @Directive('@privilege(superUserGranted: true)')
97
- @Mutation(returns => Boolean, { description: 'To delete multiple AttributeSets' })
98
- async deleteAttributeSets(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
99
- const { tx } = context.state
100
-
101
- await tx.getRepository(AttributeSet).delete({
102
- id: In(ids)
103
- })
104
-
105
- return true
106
- }
107
-
108
- @Directive('@transaction')
109
- @Directive('@privilege(superUserGranted: true)')
110
- @Mutation(returns => Boolean, { description: 'To import multiple AttributeSets' })
111
- async importAttributeSets(
112
- @Arg('attributes', type => [AttributeSetPatch]) attributes: AttributeSetPatch[],
113
- @Ctx() context: any
114
- ): Promise<boolean> {
115
- const { tx } = context.state
116
-
117
- await Promise.all(
118
- attributes.map(async (attribute: AttributeSetPatch) => {
119
- await tx.getRepository(AttributeSet).save(attribute)
120
- })
121
- )
122
-
123
- return true
124
- }
125
- }
@@ -1,36 +0,0 @@
1
- import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
2
- import { AttributeSet } from './attribute-set'
3
- import { AttributeSetList } from './attribute-set-type'
4
- import { ListParam } from '../common-types'
5
- import { getRepository } from '../../initializers/database'
6
- import { getQueryBuilderFromListParams } from '../../utils'
7
-
8
- @Resolver(AttributeSet)
9
- export class AttributeSetQuery {
10
- @Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet' })
11
- async attributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<AttributeSet> {
12
- return await getRepository(AttributeSet).findOne({
13
- where: { id }
14
- })
15
- }
16
-
17
- @Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet by Entity name' })
18
- async attributeSetByEntity(@Arg('entity') entity: string, @Ctx() context: any): Promise<AttributeSet> {
19
- return await getRepository(AttributeSet).findOne({
20
- where: { entity }
21
- })
22
- }
23
-
24
- @Query(returns => AttributeSetList, { description: 'To fetch multiple AttributeSets' })
25
- async attributeSets(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<AttributeSetList> {
26
- const queryBuilder = getQueryBuilderFromListParams({
27
- params,
28
- repository: await getRepository(AttributeSet),
29
- searchables: ['entity', 'description']
30
- })
31
-
32
- const [items, total] = await queryBuilder.getManyAndCount()
33
-
34
- return { items, total }
35
- }
36
- }
@@ -1,46 +0,0 @@
1
- import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
2
-
3
- import { AttributeSet } from './attribute-set'
4
- import { AttributeSetItemPatch } from './attribute-set-item-type'
5
-
6
- @InputType()
7
- export class NewAttributeSet {
8
- @Field()
9
- entity: string
10
-
11
- @Field({ nullable: true })
12
- description?: string
13
-
14
- @Field(type => [AttributeSetItemPatch], { nullable: true })
15
- items?: AttributeSetItemPatch[]
16
-
17
- @Field({ nullable: true })
18
- active?: boolean
19
- }
20
-
21
- @InputType()
22
- export class AttributeSetPatch {
23
- @Field(type => ID, { nullable: true })
24
- id?: string
25
-
26
- @Field({ nullable: true })
27
- entity?: string
28
-
29
- @Field({ nullable: true })
30
- description?: string
31
-
32
- @Field(type => [AttributeSetItemPatch], { nullable: true })
33
- items?: AttributeSetItemPatch[]
34
-
35
- @Field({ nullable: true })
36
- cuFlag?: string
37
- }
38
-
39
- @ObjectType()
40
- export class AttributeSetList {
41
- @Field(type => [AttributeSet])
42
- items: AttributeSet[]
43
-
44
- @Field(type => Int)
45
- total: number
46
- }
@@ -1,35 +0,0 @@
1
- import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm'
2
- import { ObjectType, Field, ID } from 'type-graphql'
3
-
4
- import { AttributeSetItem } from './attribute-set-item-type'
5
-
6
- @Entity()
7
- @Index('ix_attribute_set_0', (attributeSet: AttributeSet) => [attributeSet.entity], {
8
- unique: true
9
- })
10
- @ObjectType({ description: 'Entity for AttributeSet' })
11
- export class AttributeSet {
12
- @PrimaryGeneratedColumn('uuid')
13
- @Field(type => ID)
14
- readonly id: string
15
-
16
- @Column({ nullable: true, default: '' })
17
- @Field({ nullable: true })
18
- entity: string = ''
19
-
20
- @Column({ nullable: true, default: '' })
21
- @Field({ nullable: true })
22
- description: string = ''
23
-
24
- @Column('simple-json', { nullable: true })
25
- @Field(type => [AttributeSetItem], { nullable: true })
26
- items: AttributeSetItem[]
27
-
28
- @CreateDateColumn()
29
- @Field({ nullable: true })
30
- createdAt?: Date
31
-
32
- @UpdateDateColumn()
33
- @Field({ nullable: true })
34
- updatedAt?: Date
35
- }
@@ -1,6 +0,0 @@
1
- import { AttributeSet } from './attribute-set'
2
- import { AttributeSetQuery } from './attribute-set-query'
3
- import { AttributeSetMutation } from './attribute-set-mutation'
4
-
5
- export const entities = [AttributeSet]
6
- export const resolvers = [AttributeSetQuery, AttributeSetMutation]
@@ -1,6 +0,0 @@
1
- export * from './list-param'
2
- export * from './scalar-any'
3
- export * from './scalar-date'
4
- export * from './scalar-object'
5
- export * from './object-ref'
6
- export * from './log'
@@ -1,61 +0,0 @@
1
- import { ArgsType, Field, InputType, Int, registerEnumType } from 'type-graphql'
2
-
3
- import { ScalarAny } from './scalar-any'
4
-
5
- export enum InheritedValueType {
6
- None = 'None',
7
- Only = 'Only',
8
- Include = 'Include'
9
- }
10
-
11
- registerEnumType(InheritedValueType, {
12
- name: 'InheritedValueType'
13
- })
14
-
15
- @InputType()
16
- export class Sorting {
17
- @Field({ description: 'Field name to sort by' })
18
- name: string
19
-
20
- @Field({ nullable: true, description: 'Set to true if descending sort. Default is "false"' })
21
- desc?: boolean
22
- }
23
-
24
- @InputType()
25
- export class Pagination {
26
- @Field(type => Int, { nullable: true })
27
- page?: number
28
-
29
- @Field(type => Int, { nullable: true })
30
- limit?: number
31
- }
32
-
33
- @InputType()
34
- export class Filter {
35
- @Field()
36
- name: string
37
-
38
- @Field()
39
- operator: string
40
-
41
- @Field(type => ScalarAny, { nullable: true })
42
- value?: any
43
-
44
- @Field({ nullable: true })
45
- relation?: boolean
46
- }
47
-
48
- @ArgsType()
49
- export class ListParam {
50
- @Field(type => [Filter], { nullable: true })
51
- filters?: Filter[]
52
-
53
- @Field(type => Pagination, { nullable: true })
54
- pagination?: Pagination
55
-
56
- @Field(type => [Sorting], { nullable: true })
57
- sortings?: Sorting[]
58
-
59
- @Field(type => InheritedValueType, { nullable: true })
60
- inherited?: InheritedValueType
61
- }
@@ -1,17 +0,0 @@
1
- import { ObjectType, Field } from 'type-graphql'
2
- import { ScalarObject } from './scalar-object'
3
-
4
- @ObjectType()
5
- export class Log {
6
- @Field(() => ScalarObject, { description: 'the source of the log' })
7
- source: object
8
-
9
- @Field({ description: 'log level (error, warning, info, ..)' })
10
- level: string
11
-
12
- @Field({ description: 'log body message' })
13
- message: string
14
-
15
- @Field({ description: 'timestamp the log occurred' })
16
- timestamp: string
17
- }