@things-factory/operato-codelingua 8.0.5 → 9.0.0-beta.10

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 (35) hide show
  1. package/.dockerignore +24 -6
  2. package/dist-client/tsconfig.tsbuildinfo +1 -1
  3. package/dist-server/tsconfig.tsbuildinfo +1 -1
  4. package/package.json +48 -48
  5. package/client/bootstrap.ts +0 -206
  6. package/client/icons/menu-icons.ts +0 -91
  7. package/client/index.ts +0 -0
  8. package/client/pages/git-project/git-project-list-page.ts +0 -427
  9. package/client/route.ts +0 -8
  10. package/client/themes/dark.css +0 -51
  11. package/client/themes/light.css +0 -51
  12. package/client/tsconfig.json +0 -12
  13. package/client/viewparts/menu-tools.ts +0 -170
  14. package/client/viewparts/user-circle.ts +0 -24
  15. package/installer/config.production.js +0 -40
  16. package/installer/docker-compose.yml +0 -42
  17. package/installer/install.sh +0 -54
  18. package/installer/migrate.sh +0 -1
  19. package/installer/start.sh +0 -18
  20. package/installer/stop.sh +0 -1
  21. package/installer/upgrade.sh +0 -1
  22. package/server/controllers/github-controller.ts +0 -98
  23. package/server/controllers/index.ts +0 -0
  24. package/server/index.ts +0 -7
  25. package/server/middlewares/index.ts +0 -3
  26. package/server/migrations/index.ts +0 -9
  27. package/server/routers/github-webhook-router.ts +0 -45
  28. package/server/routes.ts +0 -30
  29. package/server/service/git-project/git-project-mutation.ts +0 -179
  30. package/server/service/git-project/git-project-query.ts +0 -48
  31. package/server/service/git-project/git-project-type.ts +0 -76
  32. package/server/service/git-project/git-project.ts +0 -114
  33. package/server/service/git-project/index.ts +0 -7
  34. package/server/service/index.ts +0 -21
  35. package/server/tsconfig.json +0 -9
@@ -1,179 +0,0 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { GitProject, GitProjectStatus } from './git-project'
5
- import { NewGitProject, GitProjectPatch } from './git-project-type'
6
- import { registerWebhook, unregisterWebhook } from '../../controllers/github-controller'
7
-
8
- @Resolver(GitProject)
9
- export class GitProjectMutation {
10
- @Directive('@transaction')
11
- @Mutation(returns => GitProject, { description: 'To create new GitProject' })
12
- async createGitProject(
13
- @Arg('gitProject') gitProject: NewGitProject,
14
- @Ctx() context: ResolverContext
15
- ): Promise<GitProject> {
16
- const { domain, user, tx } = context.state
17
-
18
- const result = await tx.getRepository(GitProject).save({
19
- ...gitProject,
20
- domain,
21
- creator: user,
22
- updater: user
23
- })
24
-
25
- return result
26
- }
27
-
28
- @Directive('@transaction')
29
- @Mutation(returns => GitProject, { description: 'To modify GitProject information' })
30
- async updateGitProject(
31
- @Arg('id') id: string,
32
- @Arg('patch') patch: GitProjectPatch,
33
- @Ctx() context: ResolverContext
34
- ): Promise<GitProject> {
35
- const { domain, user, tx } = context.state
36
-
37
- const repository = tx.getRepository(GitProject)
38
- const gitProject = await repository.findOne({
39
- where: { domain: { id: domain.id }, id }
40
- })
41
-
42
- const result = await repository.save({
43
- ...gitProject,
44
- ...patch,
45
- updater: user
46
- })
47
-
48
- return result
49
- }
50
-
51
- @Directive('@transaction')
52
- @Mutation(returns => [GitProject], { description: "To modify multiple GitProjects' information" })
53
- async updateMultipleGitProject(
54
- @Arg('patches', type => [GitProjectPatch]) patches: GitProjectPatch[],
55
- @Ctx() context: ResolverContext
56
- ): Promise<GitProject[]> {
57
- const { domain, user, tx } = context.state
58
-
59
- let results = []
60
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
61
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
62
- const gitProjectRepo = tx.getRepository(GitProject)
63
-
64
- if (_createRecords.length > 0) {
65
- for (let i = 0; i < _createRecords.length; i++) {
66
- const newRecord = _createRecords[i]
67
-
68
- const result = await gitProjectRepo.save({
69
- ...newRecord,
70
- domain,
71
- creator: user,
72
- updater: user
73
- })
74
-
75
- results.push({ ...result, cuFlag: '+' })
76
- }
77
- }
78
-
79
- if (_updateRecords.length > 0) {
80
- for (let i = 0; i < _updateRecords.length; i++) {
81
- const updateRecord = _updateRecords[i]
82
- const gitProject = await gitProjectRepo.findOneBy({ id: updateRecord.id })
83
-
84
- const result = await gitProjectRepo.save({
85
- ...gitProject,
86
- ...updateRecord,
87
- updater: user
88
- })
89
-
90
- results.push({ ...result, cuFlag: 'M' })
91
- }
92
- }
93
-
94
- return results
95
- }
96
-
97
- @Directive('@transaction')
98
- @Mutation(returns => Boolean, { description: 'To delete GitProject' })
99
- async deleteGitProject(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
100
- const { domain, tx } = context.state
101
-
102
- await tx.getRepository(GitProject).delete({ domain: { id: domain.id }, id })
103
-
104
- return true
105
- }
106
-
107
- @Directive('@transaction')
108
- @Mutation(returns => Boolean, { description: 'To delete multiple GitProjects' })
109
- async deleteGitProjects(
110
- @Arg('ids', type => [String]) ids: string[],
111
- @Ctx() context: ResolverContext
112
- ): Promise<boolean> {
113
- const { domain, tx } = context.state
114
-
115
- await tx.getRepository(GitProject).delete({
116
- domain: { id: domain.id },
117
- id: In(ids)
118
- })
119
-
120
- return true
121
- }
122
-
123
- @Directive('@transaction')
124
- @Mutation(returns => Boolean, { description: 'To import multiple GitProjects' })
125
- async importGitProjects(
126
- @Arg('gitProjects', type => [GitProjectPatch]) gitProjects: GitProjectPatch[],
127
- @Ctx() context: ResolverContext
128
- ): Promise<boolean> {
129
- const { domain, tx } = context.state
130
-
131
- await Promise.all(
132
- gitProjects.map(async (gitProject: GitProjectPatch) => {
133
- const createdGitProject: GitProject = await tx.getRepository(GitProject).save({ domain, ...gitProject })
134
- })
135
- )
136
-
137
- return true
138
- }
139
-
140
- @Directive('@transaction')
141
- @Mutation(returns => Boolean, { description: 'To register GitHub webhook' })
142
- async registerGithubWebhook(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
143
- const { domain, tx } = context.state
144
-
145
- const repository = tx.getRepository(GitProject)
146
- const gitProject = await repository.findOne({ where: { domain: { id: domain.id }, id } })
147
-
148
- if (!gitProject) {
149
- throw new Error('GitProject not found')
150
- }
151
-
152
- const webhook = await registerWebhook(gitProject.apiKey, gitProject.name, gitProject.webhookUrl)
153
-
154
- gitProject.state = GitProjectStatus.REGISTERED
155
- await repository.save(gitProject)
156
-
157
- return true
158
- }
159
-
160
- @Directive('@transaction')
161
- @Mutation(returns => Boolean, { description: 'To unregister GitHub webhook' })
162
- async unregisterGithubWebhook(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
163
- const { domain, tx } = context.state
164
-
165
- const repository = tx.getRepository(GitProject)
166
- const gitProject = await repository.findOne({ where: { domain: { id: domain.id }, id } })
167
-
168
- if (!gitProject) {
169
- throw new Error('GitProject not found')
170
- }
171
-
172
- await unregisterWebhook(gitProject.apiKey, gitProject.name, gitProject.webhookUrl)
173
-
174
- gitProject.state = GitProjectStatus.READY
175
- await repository.save(gitProject)
176
-
177
- return true
178
- }
179
- }
@@ -1,48 +0,0 @@
1
- import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
2
- import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
3
- import { User } from '@things-factory/auth-base'
4
- import { GitProject } from './git-project'
5
- import { GitProjectList } from './git-project-type'
6
-
7
- @Resolver(GitProject)
8
- export class GitProjectQuery {
9
- @Query(returns => GitProject!, { nullable: true, description: 'To fetch a GitProject' })
10
- async gitProject(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<GitProject> {
11
- const { domain } = context.state
12
-
13
- return await getRepository(GitProject).findOne({
14
- where: { domain: { id: domain.id }, id }
15
- })
16
- }
17
-
18
- @Query(returns => GitProjectList, { description: 'To fetch multiple GitProjects' })
19
- async gitProjects(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<GitProjectList> {
20
- const { domain } = context.state
21
-
22
- const queryBuilder = getQueryBuilderFromListParams({
23
- domain,
24
- params,
25
- repository: await getRepository(GitProject),
26
- searchables: ['name', 'description']
27
- })
28
-
29
- const [items, total] = await queryBuilder.getManyAndCount()
30
-
31
- return { items, total }
32
- }
33
-
34
- @FieldResolver(type => Domain)
35
- async domain(@Root() gitProject: GitProject): Promise<Domain> {
36
- return gitProject.domainId && (await getRepository(Domain).findOneBy({ id: gitProject.domainId }))
37
- }
38
-
39
- @FieldResolver(type => User)
40
- async updater(@Root() gitProject: GitProject): Promise<User> {
41
- return gitProject.updaterId && (await getRepository(User).findOneBy({ id: gitProject.updaterId }))
42
- }
43
-
44
- @FieldResolver(type => User)
45
- async creator(@Root() gitProject: GitProject): Promise<User> {
46
- return gitProject.creatorId && (await getRepository(User).findOneBy({ id: gitProject.creatorId }))
47
- }
48
- }
@@ -1,76 +0,0 @@
1
- import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
2
- import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
3
- import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
4
-
5
- import { ObjectRef, ScalarObject } from '@things-factory/shell'
6
-
7
- import { GitProject, GitProjectStatus, GitProjectLanguage } from './git-project'
8
-
9
- @InputType()
10
- export class NewGitProject {
11
- @Field()
12
- name: string
13
-
14
- @Field({ nullable: true })
15
- description?: string
16
-
17
- @Field({ nullable: true })
18
- repositoryUrl?: string
19
-
20
- @Field({ nullable: true })
21
- apiKey?: string
22
-
23
- @Field(type => GitProjectLanguage, { nullable: true })
24
- language?: GitProjectLanguage
25
-
26
- @Field(type => GitProjectStatus, { nullable: true })
27
- state?: GitProjectStatus
28
-
29
- @Field({ nullable: true })
30
- active?: boolean
31
-
32
- @Field({ nullable: true })
33
- params?: string
34
- }
35
-
36
- @InputType()
37
- export class GitProjectPatch {
38
- @Field(type => ID, { nullable: true })
39
- id?: string
40
-
41
- @Field({ nullable: true })
42
- name?: string
43
-
44
- @Field({ nullable: true })
45
- description?: string
46
-
47
- @Field({ nullable: true })
48
- repositoryUrl?: string
49
-
50
- @Field({ nullable: true })
51
- webhookUrl?: string
52
-
53
- @Field({ nullable: true })
54
- apiKey?: string
55
-
56
- @Field(type => GitProjectLanguage, { nullable: true })
57
- language?: GitProjectLanguage
58
-
59
- @Field(type => GitProjectStatus, { nullable: true })
60
- state?: GitProjectStatus
61
-
62
- @Field({ nullable: true })
63
- active?: boolean
64
-
65
- @Field({ nullable: true })
66
- cuFlag?: string
67
- }
68
-
69
- @ObjectType()
70
- export class GitProjectList {
71
- @Field(type => [GitProject])
72
- items: GitProject[]
73
-
74
- @Field(type => Int)
75
- total: number
76
- }
@@ -1,114 +0,0 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- Entity,
5
- Index,
6
- Column,
7
- RelationId,
8
- ManyToOne,
9
- PrimaryGeneratedColumn
10
- } from 'typeorm'
11
- import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
12
-
13
- import { Domain } from '@things-factory/shell'
14
- import { User } from '@things-factory/auth-base'
15
-
16
- export enum GitProjectStatus {
17
- REGISTERED = 'REGISTERED',
18
- READY = 'READY'
19
- }
20
-
21
- registerEnumType(GitProjectStatus, {
22
- name: 'GitProjectStatus',
23
- description: 'state enumeration of a gitProject'
24
- })
25
-
26
- export enum GitProjectLanguage {
27
- javascript = 'javascript',
28
- typescript = 'typescript',
29
- java = 'java',
30
- python = 'python',
31
- c = 'c',
32
- cpp = 'cpp'
33
- }
34
-
35
- registerEnumType(GitProjectLanguage, {
36
- name: 'GitProjectLanguage',
37
- description: 'language enumeration of a gitProject'
38
- })
39
-
40
- @Entity()
41
- @Index('ix_git_project_0', (gitProject: GitProject) => [gitProject.domain, gitProject.name], {
42
- unique: true
43
- })
44
- @ObjectType({ description: 'Entity for GitProject' })
45
- export class GitProject {
46
- @PrimaryGeneratedColumn('uuid')
47
- @Field(type => ID)
48
- readonly id: string
49
-
50
- @ManyToOne(type => Domain)
51
- @Field({ nullable: true })
52
- domain?: Domain
53
-
54
- @RelationId((gitProject: GitProject) => gitProject.domain)
55
- domainId?: string
56
-
57
- @Column()
58
- @Field({ nullable: true })
59
- name?: string
60
-
61
- @Column({ nullable: true })
62
- @Field({ nullable: true })
63
- description?: string
64
-
65
- @Column({ nullable: true })
66
- @Field({ nullable: true })
67
- repositoryUrl?: string
68
-
69
- @Column({ nullable: true })
70
- @Field({ nullable: true })
71
- language?: GitProjectLanguage
72
-
73
- @Column({ nullable: true })
74
- @Field({ nullable: true })
75
- apiKey?: string
76
-
77
- @Column({ nullable: true })
78
- @Field({ nullable: true })
79
- active?: boolean
80
-
81
- @Column({ nullable: true })
82
- @Field({ nullable: true })
83
- state?: GitProjectStatus
84
-
85
- @Column({ nullable: true })
86
- @Field({ nullable: true })
87
- params?: string
88
-
89
- @CreateDateColumn()
90
- @Field({ nullable: true })
91
- createdAt?: Date
92
-
93
- @UpdateDateColumn()
94
- @Field({ nullable: true })
95
- updatedAt?: Date
96
-
97
- @ManyToOne(type => User, { nullable: true })
98
- @Field(type => User, { nullable: true })
99
- creator?: User
100
-
101
- @RelationId((gitProject: GitProject) => gitProject.creator)
102
- creatorId?: string
103
-
104
- @ManyToOne(type => User, { nullable: true })
105
- @Field(type => User, { nullable: true })
106
- updater?: User
107
-
108
- @RelationId((gitProject: GitProject) => gitProject.updater)
109
- updaterId?: string
110
-
111
- get webhookUrl(): string {
112
- return `https://codelingua.hatiolab.com/github-webhook/${this.id}`
113
- }
114
- }
@@ -1,7 +0,0 @@
1
- import { GitProject } from './git-project'
2
- import { GitProjectQuery } from './git-project-query'
3
- import { GitProjectMutation } from './git-project-mutation'
4
-
5
- export const entities = [GitProject]
6
- export const resolvers = [GitProjectQuery, GitProjectMutation]
7
- export const subscribers = []
@@ -1,21 +0,0 @@
1
- /* EXPORT ENTITY TYPES */
2
- export * from './git-project/git-project'
3
-
4
- /* IMPORT ENTITIES AND RESOLVERS */
5
- import {
6
- entities as GitProjectEntities,
7
- resolvers as GitProjectResolvers,
8
- subscribers as GitProjectSubscribers
9
- } from './git-project'
10
-
11
- export const entities = [
12
- /* ENTITIES */
13
- ...GitProjectEntities
14
- ]
15
-
16
- export const schema = {
17
- resolverClasses: [
18
- /* RESOLVER CLASSES */
19
- ...GitProjectResolvers
20
- ]
21
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig-base.json",
3
- "compilerOptions": {
4
- "outDir": "../dist-server",
5
- "baseUrl": "./"
6
- },
7
- "include": ["./**/*"],
8
- "exclude": ["**/*.spec.ts"]
9
- }