@things-factory/code-base 7.0.0-alpha.8 → 7.0.1-alpha.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/client/{codes-getter.js → codes-getter.ts} +4 -5
- package/dist-client/codes-getter.d.ts +2 -0
- package/dist-client/codes-getter.js +52 -0
- package/dist-client/codes-getter.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/index.js +0 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/common-code/common-code-query.js +1 -0
- package/dist-server/service/common-code/common-code-query.js.map +1 -1
- package/dist-server/service/common-code/common-code.js +1 -1
- package/dist-server/service/common-code/common-code.js.map +1 -1
- package/dist-server/service/common-code-detail/common-code-detail-query.js +13 -0
- package/dist-server/service/common-code-detail/common-code-detail-query.js.map +1 -1
- package/dist-server/service/common-code-detail/common-code-detail-type.js +8 -0
- package/dist-server/service/common-code-detail/common-code-detail-type.js.map +1 -1
- package/dist-server/service/common-code-detail/common-code-detail.js +8 -9
- package/dist-server/service/common-code-detail/common-code-detail.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -8
- package/server/index.ts +0 -1
- package/server/service/common-code/common-code-query.ts +2 -5
- package/server/service/common-code/common-code.ts +2 -12
- package/server/service/common-code-detail/common-code-detail-query.ts +8 -0
- package/server/service/common-code-detail/common-code-detail-type.ts +7 -1
- package/server/service/common-code-detail/common-code-detail.ts +12 -31
- package/dist-server/migrations/index.js +0 -12
- package/dist-server/migrations/index.js.map +0 -1
- package/server/migrations/index.ts +0 -9
- /package/client/{index.js → index.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/code-base",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1-alpha.0",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
|
-
"browser": "client/index.js",
|
|
5
|
+
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
7
7
|
"author": "",
|
|
8
8
|
"description": "Server-side module for handling common code management.",
|
|
@@ -17,14 +17,19 @@
|
|
|
17
17
|
"directory": "packages/code-base"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"build": "npm run build:server && npm run build:client",
|
|
21
|
+
"copy:files": "copyfiles -e \"./client/**/*.{ts,js,json}\" -u 1 \"./client/**/*\" dist-client",
|
|
22
|
+
"build:client": "npm run copy:files && npx tsc --p ./client/tsconfig.json",
|
|
23
|
+
"build:server": "npx tsc --p ./server/tsconfig.json",
|
|
24
|
+
"clean:client": "npx rimraf dist-client",
|
|
25
|
+
"clean:server": "npx rimraf dist-server",
|
|
26
|
+
"clean": "npm run clean:server && npm run clean:client",
|
|
24
27
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
28
|
},
|
|
26
29
|
"dependencies": {
|
|
27
|
-
"@
|
|
30
|
+
"@operato/graphql": "^2.0.0-alpha.0",
|
|
31
|
+
"@things-factory/auth-base": "^7.0.1-alpha.0",
|
|
32
|
+
"@things-factory/shell": "^7.0.1-alpha.0"
|
|
28
33
|
},
|
|
29
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "d18cdb7648bd2003f11278ec7bc8df74edbd31fc"
|
|
30
35
|
}
|
package/server/index.ts
CHANGED
|
@@ -34,12 +34,9 @@ export class CommonCodeQuery {
|
|
|
34
34
|
return { items, total }
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/* TODO move to operato-wms module */
|
|
37
38
|
@Query(returns => CommonCode, { description: "To fetch specific domain's CommonCodes by given name" })
|
|
38
|
-
async partnerCommonCode(
|
|
39
|
-
@Arg('name') name: string,
|
|
40
|
-
@Arg('partnerDomainId') partnerDomainId: string,
|
|
41
|
-
@Ctx() context: ResolverContext
|
|
42
|
-
): Promise<CommonCode> {
|
|
39
|
+
async partnerCommonCode(@Arg('name') name: string, @Arg('partnerDomainId') partnerDomainId: string, @Ctx() context: ResolverContext): Promise<CommonCode> {
|
|
43
40
|
return await getRepository(CommonCode).findOne({
|
|
44
41
|
where: { domain: { id: partnerDomainId }, name }
|
|
45
42
|
})
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
-
import {
|
|
3
|
-
Column,
|
|
4
|
-
CreateDateColumn,
|
|
5
|
-
Entity,
|
|
6
|
-
Index,
|
|
7
|
-
ManyToOne,
|
|
8
|
-
OneToMany,
|
|
9
|
-
PrimaryGeneratedColumn,
|
|
10
|
-
RelationId,
|
|
11
|
-
UpdateDateColumn
|
|
12
|
-
} from 'typeorm'
|
|
2
|
+
import { Column, CreateDateColumn, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'
|
|
13
3
|
|
|
14
4
|
import { User } from '@things-factory/auth-base'
|
|
15
5
|
import { Domain } from '@things-factory/shell'
|
|
@@ -18,7 +8,7 @@ import { CommonCodeDetail } from '../common-code-detail/common-code-detail'
|
|
|
18
8
|
|
|
19
9
|
@Entity()
|
|
20
10
|
@Index('ix_common_code_0', (commonCode: CommonCode) => [commonCode.domain, commonCode.name], { unique: true })
|
|
21
|
-
@Index('ix_common_code_1', (commonCode: CommonCode) => [commonCode.domain])
|
|
11
|
+
@Index('ix_common_code_1', (commonCode: CommonCode) => [commonCode.domain]) /* TOBE-REMOVED */
|
|
22
12
|
@ObjectType({ description: 'Entity for CommonCode' })
|
|
23
13
|
export class CommonCode {
|
|
24
14
|
@PrimaryGeneratedColumn('uuid')
|
|
@@ -40,6 +40,14 @@ export class CommonCodeDetailQuery {
|
|
|
40
40
|
return await getRepository(CommonCode).findOneBy({ id: commonCodeDetail.commonCodeId })
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
@FieldResolver(type => Domain)
|
|
44
|
+
async description(@Root() commonCodeDetail: CommonCodeDetail, @Ctx() context: ResolverContext): Promise<String> {
|
|
45
|
+
const { lng } = context.state
|
|
46
|
+
const { labels, description } = commonCodeDetail
|
|
47
|
+
|
|
48
|
+
return (lng && labels && labels[lng]) || description
|
|
49
|
+
}
|
|
50
|
+
|
|
43
51
|
@FieldResolver(type => Domain)
|
|
44
52
|
async domain(@Root() commonCodeDetail: CommonCodeDetail): Promise<Domain> {
|
|
45
53
|
return await getRepository(Domain).findOneBy({ id: commonCodeDetail.domainId })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'
|
|
2
2
|
|
|
3
|
-
import { ObjectRef } from '@things-factory/shell'
|
|
3
|
+
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
|
4
4
|
|
|
5
5
|
import { CommonCodeDetail } from './common-code-detail'
|
|
6
6
|
|
|
@@ -12,6 +12,9 @@ export class NewCommonCodeDetail {
|
|
|
12
12
|
@Field({ nullable: true })
|
|
13
13
|
description?: string
|
|
14
14
|
|
|
15
|
+
@Field(type => ScalarObject, { nullable: true })
|
|
16
|
+
labels?: any // { [lng: string]: string }
|
|
17
|
+
|
|
15
18
|
@Field(type => ObjectRef!)
|
|
16
19
|
commonCode: ObjectRef
|
|
17
20
|
|
|
@@ -30,6 +33,9 @@ export class CommonCodeDetailPatch {
|
|
|
30
33
|
@Field({ nullable: true })
|
|
31
34
|
description?: string
|
|
32
35
|
|
|
36
|
+
@Field(type => ScalarObject, { nullable: true })
|
|
37
|
+
labels?: any // { [lng: string]: string }
|
|
38
|
+
|
|
33
39
|
@Field(type => ObjectRef!)
|
|
34
40
|
commonCode: ObjectRef
|
|
35
41
|
|
|
@@ -1,31 +1,14 @@
|
|
|
1
|
-
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
-
import {
|
|
3
|
-
Column,
|
|
4
|
-
CreateDateColumn,
|
|
5
|
-
Entity,
|
|
6
|
-
Index,
|
|
7
|
-
ManyToOne,
|
|
8
|
-
PrimaryGeneratedColumn,
|
|
9
|
-
RelationId,
|
|
10
|
-
UpdateDateColumn
|
|
11
|
-
} from 'typeorm'
|
|
1
|
+
import { Field, ID, InputType, ObjectType } from 'type-graphql'
|
|
2
|
+
import { Column, CreateDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'
|
|
12
3
|
|
|
13
4
|
import { User } from '@things-factory/auth-base'
|
|
14
|
-
import { Domain } from '@things-factory/shell'
|
|
5
|
+
import { Domain, ScalarObject } from '@things-factory/shell'
|
|
15
6
|
|
|
16
7
|
import { CommonCode } from '../common-code/common-code'
|
|
17
8
|
|
|
18
9
|
@Entity()
|
|
19
|
-
@Index(
|
|
20
|
-
|
|
21
|
-
(commonCodeDetail: CommonCodeDetail) => [commonCodeDetail.commonCode, commonCodeDetail.name],
|
|
22
|
-
{ unique: true }
|
|
23
|
-
)
|
|
24
|
-
@Index(
|
|
25
|
-
'ix_common_code_detail_1',
|
|
26
|
-
(commonCodeDetail: CommonCodeDetail) => [commonCodeDetail.commonCode, commonCodeDetail.rank],
|
|
27
|
-
{ unique: true }
|
|
28
|
-
)
|
|
10
|
+
@Index('ix_common_code_detail_0', (commonCodeDetail: CommonCodeDetail) => [commonCodeDetail.commonCode, commonCodeDetail.name], { unique: true })
|
|
11
|
+
@Index('ix_common_code_detail_1', (commonCodeDetail: CommonCodeDetail) => [commonCodeDetail.commonCode, commonCodeDetail.rank], { unique: true })
|
|
29
12
|
@ObjectType({ description: 'Entity for CommonCodeDetail' })
|
|
30
13
|
export class CommonCodeDetail {
|
|
31
14
|
@PrimaryGeneratedColumn('uuid')
|
|
@@ -50,12 +33,14 @@ export class CommonCodeDetail {
|
|
|
50
33
|
@Field()
|
|
51
34
|
name: string
|
|
52
35
|
|
|
53
|
-
@Column({
|
|
54
|
-
nullable: true
|
|
55
|
-
})
|
|
36
|
+
@Column({ nullable: true })
|
|
56
37
|
@Field({ nullable: true })
|
|
57
38
|
description?: string
|
|
58
39
|
|
|
40
|
+
@Column('simple-json', { nullable: true })
|
|
41
|
+
@Field(type => ScalarObject, { nullable: true })
|
|
42
|
+
labels?: any // { [lng: string]: string }
|
|
43
|
+
|
|
59
44
|
@Column()
|
|
60
45
|
@Field({ nullable: true })
|
|
61
46
|
rank: number
|
|
@@ -68,18 +53,14 @@ export class CommonCodeDetail {
|
|
|
68
53
|
@Field({ nullable: true })
|
|
69
54
|
updatedAt?: Date
|
|
70
55
|
|
|
71
|
-
@ManyToOne(type => User, {
|
|
72
|
-
nullable: true
|
|
73
|
-
})
|
|
56
|
+
@ManyToOne(type => User, { nullable: true })
|
|
74
57
|
@Field({ nullable: true })
|
|
75
58
|
creator?: User
|
|
76
59
|
|
|
77
60
|
@RelationId((commonCodeDetail: CommonCodeDetail) => commonCodeDetail.creator)
|
|
78
61
|
creatorId?: string
|
|
79
62
|
|
|
80
|
-
@ManyToOne(type => User, {
|
|
81
|
-
nullable: true
|
|
82
|
-
})
|
|
63
|
+
@ManyToOne(type => User, { nullable: true })
|
|
83
64
|
@Field({ nullable: true })
|
|
84
65
|
updater?: User
|
|
85
66
|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.migrations = void 0;
|
|
4
|
-
const glob = require('glob');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
exports.migrations = [];
|
|
7
|
-
glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function (file) {
|
|
8
|
-
if (file.indexOf('index.js') !== -1)
|
|
9
|
-
return;
|
|
10
|
-
exports.migrations = exports.migrations.concat(Object.values(require(path.resolve(file))) || []);
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,UAAS,IAAI;IACzE,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"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const glob = require('glob')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
export var migrations = []
|
|
5
|
-
|
|
6
|
-
glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {
|
|
7
|
-
if (file.indexOf('index.js') !== -1) return
|
|
8
|
-
migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])
|
|
9
|
-
})
|
|
File without changes
|