@nest-yalc-2/omnikernel-module 2.2.2 → 2.2.4
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/package.json +17 -15
- package/src/__tests__/omni-collection.entity.spec.ts +49 -49
- package/src/__tests__/omni-collection.service.spec.ts +83 -83
- package/src/__tests__/omni-document.entity.spec.ts +55 -55
- package/src/__tests__/omni-document.service.spec.ts +83 -83
- package/src/__tests__/omni-extension-projection-constraints.spec.ts +518 -518
- package/src/__tests__/omni-extension-projection.registration.spec.ts +947 -946
- package/src/__tests__/omni-extension-projection.service.spec.ts +806 -806
- package/src/__tests__/omni-external-ref.entity.spec.ts +36 -36
- package/src/__tests__/omni-external-ref.service.spec.ts +252 -252
- package/src/__tests__/omni-named.entity.spec.ts +33 -33
- package/src/__tests__/omni-record.entity.spec.ts +32 -32
- package/src/__tests__/omni-record.service.spec.ts +107 -107
- package/src/__tests__/omni-relation-semantics.spec.ts +102 -102
- package/src/__tests__/omni-relation.entity.spec.ts +38 -38
- package/src/__tests__/omni-scope-substrate.spec.ts +81 -81
- package/src/__tests__/omni-scoped.backend.spec.ts +115 -115
- package/src/__tests__/omni-scoped.service.spec.ts +354 -354
- package/src/__tests__/omnikernel.diagnostics.spec.ts +94 -94
- package/src/__tests__/omnikernel.module.spec.ts +38 -40
- package/src/__tests__/omnikernel.persistence.spec.ts +154 -154
- package/src/__tests__/omnikernel.public-api.spec.ts +238 -238
- package/src/__tests__/omnikernel.query.service.spec.ts +155 -155
- package/src/base/omni-base.entity.ts +41 -41
- package/src/base/omni-external-ref.entity.ts +53 -53
- package/src/base/omni-named.entity.ts +16 -16
- package/src/base/omni-record.entity.ts +51 -51
- package/src/base/omni-relation.entity.ts +72 -72
- package/src/index.ts +49 -49
- package/src/omni-collection-kind.enum.ts +10 -10
- package/src/omni-collection.backend.ts +16 -16
- package/src/omni-collection.dto.ts +170 -170
- package/src/omni-collection.entity.ts +21 -21
- package/src/omni-collection.service.ts +75 -75
- package/src/omni-document-kind.enum.ts +12 -12
- package/src/omni-document.backend.ts +16 -16
- package/src/omni-document.dto.ts +198 -198
- package/src/omni-document.entity.ts +30 -30
- package/src/omni-document.service.ts +75 -75
- package/src/omni-dto.helpers.ts +21 -21
- package/src/omni-extension-projection.definition.ts +294 -294
- package/src/omni-extension-projection.resource.ts +274 -274
- package/src/omni-extension-projection.service.ts +452 -452
- package/src/omni-external-ref-binding.validator.ts +53 -53
- package/src/omni-external-ref-internal-type.enum.ts +11 -11
- package/src/omni-external-ref.backend.ts +25 -25
- package/src/omni-external-ref.dto.ts +128 -128
- package/src/omni-external-ref.service.ts +255 -255
- package/src/omni-migration.ts +365 -365
- package/src/omni-named.backend.ts +11 -11
- package/src/omni-named.dto.ts +86 -86
- package/src/omni-projection.catalog.ts +345 -345
- package/src/omni-projection.lifecycle.ts +53 -53
- package/src/omni-record-status.enum.ts +11 -11
- package/src/omni-record.backend.ts +19 -19
- package/src/omni-record.dto.ts +157 -157
- package/src/omni-record.service.ts +113 -113
- package/src/omni-relation-kind.contract.ts +49 -49
- package/src/omni-relation-kind.enum.ts +12 -12
- package/src/omni-relation-projection.definition.ts +166 -166
- package/src/omni-relation-projection.resource.ts +360 -360
- package/src/omni-relation-projection.service.ts +610 -610
- package/src/omni-relation-semantics.ts +52 -52
- package/src/omni-relation-status.enum.ts +11 -11
- package/src/omni-relation.backend.ts +21 -21
- package/src/omni-relation.dto.ts +142 -142
- package/src/omni-relation.service.ts +159 -159
- package/src/omni-scope.ts +161 -161
- package/src/omni-scoped.backend.ts +110 -110
- package/src/omni-scoped.repository.ts +34 -34
- package/src/omni-scoped.service.ts +338 -338
- package/src/omnikernel.diagnostics.ts +83 -83
- package/src/omnikernel.module.ts +97 -97
- package/src/omnikernel.query.service.ts +108 -108
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { ObjectType } from '@nestjs/graphql';
|
|
2
|
-
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
3
|
-
import type { Relation } from 'typeorm';
|
|
4
|
-
import { OmniBaseEntity } from './omni-base.entity.js';
|
|
5
|
-
import { OmniRecordEntity } from './omni-record.entity.js';
|
|
6
|
-
import { OmniRelationStatus } from '../omni-relation-status.enum.js';
|
|
7
|
-
|
|
8
|
-
@Entity('omni-relation')
|
|
9
|
-
@Index('omni_relation_scope_source_kind_status_created_guid_idx', [
|
|
10
|
-
'scopeId',
|
|
11
|
-
'sourceRecordId',
|
|
12
|
-
'kind',
|
|
13
|
-
'status',
|
|
14
|
-
'createdAt',
|
|
15
|
-
'guid',
|
|
16
|
-
])
|
|
17
|
-
@Index('omni_relation_scope_target_kind_status_created_guid_idx', [
|
|
18
|
-
'scopeId',
|
|
19
|
-
'targetRecordId',
|
|
20
|
-
'kind',
|
|
21
|
-
'status',
|
|
22
|
-
'createdAt',
|
|
23
|
-
'guid',
|
|
24
|
-
])
|
|
25
|
-
@Index(
|
|
26
|
-
'omni_relation_scope_edge_kind_status_unique',
|
|
27
|
-
['scopeId', 'sourceRecordId', 'targetRecordId', 'kind', 'status'],
|
|
28
|
-
{ unique: true },
|
|
29
|
-
)
|
|
30
|
-
@ObjectType({ isAbstract: true })
|
|
31
|
-
export class OmniRelationEntity extends OmniBaseEntity {
|
|
32
|
-
@Column({ type: 'varchar', length: 36 })
|
|
33
|
-
sourceRecordId!: string;
|
|
34
|
-
|
|
35
|
-
@ManyToOne(() => OmniRecordEntity, (record) => record.outgoingRelations)
|
|
36
|
-
@JoinColumn([
|
|
37
|
-
{ name: 'scopeId', referencedColumnName: 'scopeId' },
|
|
38
|
-
{ name: 'sourceRecordId', referencedColumnName: 'guid' },
|
|
39
|
-
])
|
|
40
|
-
sourceRecord!: Relation<OmniRecordEntity>;
|
|
41
|
-
|
|
42
|
-
@Column({ type: 'varchar', length: 36 })
|
|
43
|
-
targetRecordId!: string;
|
|
44
|
-
|
|
45
|
-
@ManyToOne(() => OmniRecordEntity, (record) => record.incomingRelations)
|
|
46
|
-
@JoinColumn([
|
|
47
|
-
{ name: 'scopeId', referencedColumnName: 'scopeId' },
|
|
48
|
-
{ name: 'targetRecordId', referencedColumnName: 'guid' },
|
|
49
|
-
])
|
|
50
|
-
targetRecord!: Relation<OmniRecordEntity>;
|
|
51
|
-
|
|
52
|
-
/** Validated by the registered relation-kind contract, not a closed enum. */
|
|
53
|
-
@Column({ type: 'varchar', length: 64 })
|
|
54
|
-
kind!: string;
|
|
55
|
-
|
|
56
|
-
@Column({
|
|
57
|
-
type: 'varchar',
|
|
58
|
-
default: OmniRelationStatus.Active,
|
|
59
|
-
enum: Object.values(OmniRelationStatus),
|
|
60
|
-
length: 32,
|
|
61
|
-
})
|
|
62
|
-
status!: OmniRelationStatus;
|
|
63
|
-
|
|
64
|
-
@Column({ type: 'simple-json', nullable: true })
|
|
65
|
-
payload?: Record<string, unknown> | null;
|
|
66
|
-
|
|
67
|
-
@Column({ type: 'varchar', nullable: true, length: 128 })
|
|
68
|
-
payloadSchemaId?: string | null;
|
|
69
|
-
|
|
70
|
-
@Column({ type: 'integer', nullable: true })
|
|
71
|
-
payloadSchemaVersion?: number | null;
|
|
72
|
-
}
|
|
1
|
+
import { ObjectType } from '@nestjs/graphql';
|
|
2
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
3
|
+
import type { Relation } from 'typeorm';
|
|
4
|
+
import { OmniBaseEntity } from './omni-base.entity.js';
|
|
5
|
+
import { OmniRecordEntity } from './omni-record.entity.js';
|
|
6
|
+
import { OmniRelationStatus } from '../omni-relation-status.enum.js';
|
|
7
|
+
|
|
8
|
+
@Entity('omni-relation')
|
|
9
|
+
@Index('omni_relation_scope_source_kind_status_created_guid_idx', [
|
|
10
|
+
'scopeId',
|
|
11
|
+
'sourceRecordId',
|
|
12
|
+
'kind',
|
|
13
|
+
'status',
|
|
14
|
+
'createdAt',
|
|
15
|
+
'guid',
|
|
16
|
+
])
|
|
17
|
+
@Index('omni_relation_scope_target_kind_status_created_guid_idx', [
|
|
18
|
+
'scopeId',
|
|
19
|
+
'targetRecordId',
|
|
20
|
+
'kind',
|
|
21
|
+
'status',
|
|
22
|
+
'createdAt',
|
|
23
|
+
'guid',
|
|
24
|
+
])
|
|
25
|
+
@Index(
|
|
26
|
+
'omni_relation_scope_edge_kind_status_unique',
|
|
27
|
+
['scopeId', 'sourceRecordId', 'targetRecordId', 'kind', 'status'],
|
|
28
|
+
{ unique: true },
|
|
29
|
+
)
|
|
30
|
+
@ObjectType({ isAbstract: true })
|
|
31
|
+
export class OmniRelationEntity extends OmniBaseEntity {
|
|
32
|
+
@Column({ type: 'varchar', length: 36 })
|
|
33
|
+
sourceRecordId!: string;
|
|
34
|
+
|
|
35
|
+
@ManyToOne(() => OmniRecordEntity, (record) => record.outgoingRelations)
|
|
36
|
+
@JoinColumn([
|
|
37
|
+
{ name: 'scopeId', referencedColumnName: 'scopeId' },
|
|
38
|
+
{ name: 'sourceRecordId', referencedColumnName: 'guid' },
|
|
39
|
+
])
|
|
40
|
+
sourceRecord!: Relation<OmniRecordEntity>;
|
|
41
|
+
|
|
42
|
+
@Column({ type: 'varchar', length: 36 })
|
|
43
|
+
targetRecordId!: string;
|
|
44
|
+
|
|
45
|
+
@ManyToOne(() => OmniRecordEntity, (record) => record.incomingRelations)
|
|
46
|
+
@JoinColumn([
|
|
47
|
+
{ name: 'scopeId', referencedColumnName: 'scopeId' },
|
|
48
|
+
{ name: 'targetRecordId', referencedColumnName: 'guid' },
|
|
49
|
+
])
|
|
50
|
+
targetRecord!: Relation<OmniRecordEntity>;
|
|
51
|
+
|
|
52
|
+
/** Validated by the registered relation-kind contract, not a closed enum. */
|
|
53
|
+
@Column({ type: 'varchar', length: 64 })
|
|
54
|
+
kind!: string;
|
|
55
|
+
|
|
56
|
+
@Column({
|
|
57
|
+
type: 'varchar',
|
|
58
|
+
default: OmniRelationStatus.Active,
|
|
59
|
+
enum: Object.values(OmniRelationStatus),
|
|
60
|
+
length: 32,
|
|
61
|
+
})
|
|
62
|
+
status!: OmniRelationStatus;
|
|
63
|
+
|
|
64
|
+
@Column({ type: 'simple-json', nullable: true })
|
|
65
|
+
payload?: Record<string, unknown> | null;
|
|
66
|
+
|
|
67
|
+
@Column({ type: 'varchar', nullable: true, length: 128 })
|
|
68
|
+
payloadSchemaId?: string | null;
|
|
69
|
+
|
|
70
|
+
@Column({ type: 'integer', nullable: true })
|
|
71
|
+
payloadSchemaVersion?: number | null;
|
|
72
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
export * from './base/omni-base.entity.js';
|
|
2
|
-
export * from './base/omni-named.entity.js';
|
|
3
|
-
export * from './base/omni-record.entity.js';
|
|
4
|
-
export * from './base/omni-relation.entity.js';
|
|
5
|
-
export * from './base/omni-external-ref.entity.js';
|
|
6
|
-
export * from './omni-named.dto.js';
|
|
7
|
-
export * from './omni-dto.helpers.js';
|
|
8
|
-
export * from './omni-named.backend.js';
|
|
9
|
-
export * from './omni-record-status.enum.js';
|
|
10
|
-
export * from './omni-relation-status.enum.js';
|
|
11
|
-
export * from './omni-relation-kind.enum.js';
|
|
12
|
-
export * from './omni-relation-kind.contract.js';
|
|
13
|
-
export * from './omni-relation-semantics.js';
|
|
14
|
-
export * from './omni-record.dto.js';
|
|
15
|
-
export * from './omni-record.backend.js';
|
|
16
|
-
export * from './omni-record.service.js';
|
|
17
|
-
export * from './omni-collection-kind.enum.js';
|
|
18
|
-
export * from './omni-collection.entity.js';
|
|
19
|
-
export * from './omni-collection.dto.js';
|
|
20
|
-
export * from './omni-collection.service.js';
|
|
21
|
-
export * from './omni-collection.backend.js';
|
|
22
|
-
export * from './omni-document-kind.enum.js';
|
|
23
|
-
export * from './omni-document.entity.js';
|
|
24
|
-
export * from './omni-document.dto.js';
|
|
25
|
-
export * from './omni-document.service.js';
|
|
26
|
-
export * from './omni-document.backend.js';
|
|
27
|
-
export * from './omni-relation.dto.js';
|
|
28
|
-
export * from './omni-relation.backend.js';
|
|
29
|
-
export * from './omni-external-ref-internal-type.enum.js';
|
|
30
|
-
export * from './omni-external-ref-binding.validator.js';
|
|
31
|
-
export * from './omni-external-ref.dto.js';
|
|
32
|
-
export * from './omni-external-ref.service.js';
|
|
33
|
-
export * from './omni-external-ref.backend.js';
|
|
34
|
-
export * from './omni-scoped.repository.js';
|
|
35
|
-
export * from './omni-scoped.service.js';
|
|
36
|
-
export * from './omni-scope.js';
|
|
37
|
-
export * from './omni-scoped.backend.js';
|
|
38
|
-
export * from './omni-projection.lifecycle.js';
|
|
39
|
-
export * from './omni-projection.catalog.js';
|
|
40
|
-
export * from './omni-extension-projection.definition.js';
|
|
41
|
-
export * from './omni-extension-projection.resource.js';
|
|
42
|
-
export * from './omni-extension-projection.service.js';
|
|
43
|
-
export * from './omni-migration.js';
|
|
44
|
-
export * from './omni-relation-projection.definition.js';
|
|
45
|
-
export * from './omni-relation-projection.resource.js';
|
|
46
|
-
export * from './omni-relation-projection.service.js';
|
|
47
|
-
export * from './omnikernel.query.service.js';
|
|
48
|
-
export * from './omnikernel.diagnostics.js';
|
|
49
|
-
export * from './omnikernel.module.js';
|
|
1
|
+
export * from './base/omni-base.entity.js';
|
|
2
|
+
export * from './base/omni-named.entity.js';
|
|
3
|
+
export * from './base/omni-record.entity.js';
|
|
4
|
+
export * from './base/omni-relation.entity.js';
|
|
5
|
+
export * from './base/omni-external-ref.entity.js';
|
|
6
|
+
export * from './omni-named.dto.js';
|
|
7
|
+
export * from './omni-dto.helpers.js';
|
|
8
|
+
export * from './omni-named.backend.js';
|
|
9
|
+
export * from './omni-record-status.enum.js';
|
|
10
|
+
export * from './omni-relation-status.enum.js';
|
|
11
|
+
export * from './omni-relation-kind.enum.js';
|
|
12
|
+
export * from './omni-relation-kind.contract.js';
|
|
13
|
+
export * from './omni-relation-semantics.js';
|
|
14
|
+
export * from './omni-record.dto.js';
|
|
15
|
+
export * from './omni-record.backend.js';
|
|
16
|
+
export * from './omni-record.service.js';
|
|
17
|
+
export * from './omni-collection-kind.enum.js';
|
|
18
|
+
export * from './omni-collection.entity.js';
|
|
19
|
+
export * from './omni-collection.dto.js';
|
|
20
|
+
export * from './omni-collection.service.js';
|
|
21
|
+
export * from './omni-collection.backend.js';
|
|
22
|
+
export * from './omni-document-kind.enum.js';
|
|
23
|
+
export * from './omni-document.entity.js';
|
|
24
|
+
export * from './omni-document.dto.js';
|
|
25
|
+
export * from './omni-document.service.js';
|
|
26
|
+
export * from './omni-document.backend.js';
|
|
27
|
+
export * from './omni-relation.dto.js';
|
|
28
|
+
export * from './omni-relation.backend.js';
|
|
29
|
+
export * from './omni-external-ref-internal-type.enum.js';
|
|
30
|
+
export * from './omni-external-ref-binding.validator.js';
|
|
31
|
+
export * from './omni-external-ref.dto.js';
|
|
32
|
+
export * from './omni-external-ref.service.js';
|
|
33
|
+
export * from './omni-external-ref.backend.js';
|
|
34
|
+
export * from './omni-scoped.repository.js';
|
|
35
|
+
export * from './omni-scoped.service.js';
|
|
36
|
+
export * from './omni-scope.js';
|
|
37
|
+
export * from './omni-scoped.backend.js';
|
|
38
|
+
export * from './omni-projection.lifecycle.js';
|
|
39
|
+
export * from './omni-projection.catalog.js';
|
|
40
|
+
export * from './omni-extension-projection.definition.js';
|
|
41
|
+
export * from './omni-extension-projection.resource.js';
|
|
42
|
+
export * from './omni-extension-projection.service.js';
|
|
43
|
+
export * from './omni-migration.js';
|
|
44
|
+
export * from './omni-relation-projection.definition.js';
|
|
45
|
+
export * from './omni-relation-projection.resource.js';
|
|
46
|
+
export * from './omni-relation-projection.service.js';
|
|
47
|
+
export * from './omnikernel.query.service.js';
|
|
48
|
+
export * from './omnikernel.diagnostics.js';
|
|
49
|
+
export * from './omnikernel.module.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { registerEnumType } from '@nestjs/graphql';
|
|
2
|
-
|
|
3
|
-
export enum OmniCollectionKind {
|
|
4
|
-
Collection = 'collection',
|
|
5
|
-
Folder = 'folder',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
registerEnumType(OmniCollectionKind, {
|
|
9
|
-
name: 'OmniCollectionKind',
|
|
10
|
-
});
|
|
1
|
+
import { registerEnumType } from '@nestjs/graphql';
|
|
2
|
+
|
|
3
|
+
export enum OmniCollectionKind {
|
|
4
|
+
Collection = 'collection',
|
|
5
|
+
Folder = 'folder',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
registerEnumType(OmniCollectionKind, {
|
|
9
|
+
name: 'OmniCollectionKind',
|
|
10
|
+
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { OmniCollectionEntity } from './omni-collection.entity.js';
|
|
2
|
-
import { OmniCollectionService } from './omni-collection.service.js';
|
|
3
|
-
import {
|
|
4
|
-
omniBackendServiceToken,
|
|
5
|
-
omniScopedBackendProvidersFactory,
|
|
6
|
-
} from './omni-scoped.backend.js';
|
|
7
|
-
|
|
8
|
-
export const omniCollectionBackendProvidersFactory = (dbConnection: string) =>
|
|
9
|
-
omniScopedBackendProvidersFactory<OmniCollectionEntity>({
|
|
10
|
-
entityModel: OmniCollectionEntity,
|
|
11
|
-
dbConnection,
|
|
12
|
-
serviceToken: omniBackendServiceToken(OmniCollectionService),
|
|
13
|
-
serviceProvider: OmniCollectionService,
|
|
14
|
-
createService: (repository, scope, options) =>
|
|
15
|
-
new OmniCollectionService(repository, scope, options.deletion.collection),
|
|
16
|
-
});
|
|
1
|
+
import { OmniCollectionEntity } from './omni-collection.entity.js';
|
|
2
|
+
import { OmniCollectionService } from './omni-collection.service.js';
|
|
3
|
+
import {
|
|
4
|
+
omniBackendServiceToken,
|
|
5
|
+
omniScopedBackendProvidersFactory,
|
|
6
|
+
} from './omni-scoped.backend.js';
|
|
7
|
+
|
|
8
|
+
export const omniCollectionBackendProvidersFactory = (dbConnection: string) =>
|
|
9
|
+
omniScopedBackendProvidersFactory<OmniCollectionEntity>({
|
|
10
|
+
entityModel: OmniCollectionEntity,
|
|
11
|
+
dbConnection,
|
|
12
|
+
serviceToken: omniBackendServiceToken(OmniCollectionService),
|
|
13
|
+
serviceProvider: OmniCollectionService,
|
|
14
|
+
createService: (repository, scope, options) =>
|
|
15
|
+
new OmniCollectionService(repository, scope, options.deletion.collection),
|
|
16
|
+
});
|
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InputType,
|
|
3
|
-
Int,
|
|
4
|
-
ObjectType,
|
|
5
|
-
OmitType,
|
|
6
|
-
PartialType,
|
|
7
|
-
} from '@nestjs/graphql';
|
|
8
|
-
import {
|
|
9
|
-
ModelField,
|
|
10
|
-
ModelObject,
|
|
11
|
-
} from '@nest-yalc-2/crud-gen/object.decorator.js';
|
|
12
|
-
import { UUIDScalar } from '@nest-yalc-2/graphql/scalars/uuid.scalar.js';
|
|
13
|
-
import returnValue from '@node-yalc/utils/returnValue.js';
|
|
14
|
-
import {
|
|
15
|
-
IsEnum,
|
|
16
|
-
IsInt,
|
|
17
|
-
IsObject,
|
|
18
|
-
IsOptional,
|
|
19
|
-
IsString,
|
|
20
|
-
IsUUID,
|
|
21
|
-
MaxLength,
|
|
22
|
-
} from 'class-validator';
|
|
23
|
-
import { GraphQLJSONObject } from 'graphql-type-json';
|
|
24
|
-
import type { Relation } from 'typeorm';
|
|
25
|
-
import { OmniRelationEntity } from './base/omni-relation.entity.js';
|
|
26
|
-
import { OmniCollectionEntity } from './omni-collection.entity.js';
|
|
27
|
-
import { OmniCollectionKind } from './omni-collection-kind.enum.js';
|
|
28
|
-
import { assignOmniPublicDto } from './omni-dto.helpers.js';
|
|
29
|
-
import { OmniRecordStatus } from './omni-record-status.enum.js';
|
|
30
|
-
import { OmniRelationType } from './omni-relation.dto.js';
|
|
31
|
-
|
|
32
|
-
@ObjectType()
|
|
33
|
-
@ModelObject()
|
|
34
|
-
export class OmniCollectionType extends OmniCollectionEntity {
|
|
35
|
-
constructor(data?: Partial<OmniCollectionType>) {
|
|
36
|
-
super();
|
|
37
|
-
if (data) {
|
|
38
|
-
assignOmniPublicDto(this, data);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@ModelField({ gqlType: returnValue(UUIDScalar), isRequired: true })
|
|
43
|
-
@IsUUID()
|
|
44
|
-
guid!: string;
|
|
45
|
-
|
|
46
|
-
@ModelField({ gqlType: returnValue(Int) })
|
|
47
|
-
@IsInt()
|
|
48
|
-
revision!: number;
|
|
49
|
-
|
|
50
|
-
@ModelField({
|
|
51
|
-
gqlType: returnValue(String),
|
|
52
|
-
gqlOptions: { nullable: true },
|
|
53
|
-
})
|
|
54
|
-
@IsOptional()
|
|
55
|
-
@IsString()
|
|
56
|
-
@MaxLength(128)
|
|
57
|
-
externalId?: string | null;
|
|
58
|
-
|
|
59
|
-
@ModelField({ gqlType: returnValue(String) })
|
|
60
|
-
@IsString()
|
|
61
|
-
@MaxLength(255)
|
|
62
|
-
title!: string;
|
|
63
|
-
|
|
64
|
-
@ModelField({
|
|
65
|
-
gqlType: returnValue(String),
|
|
66
|
-
gqlOptions: { nullable: true },
|
|
67
|
-
})
|
|
68
|
-
@IsOptional()
|
|
69
|
-
@IsString()
|
|
70
|
-
@MaxLength(255)
|
|
71
|
-
slug?: string | null;
|
|
72
|
-
|
|
73
|
-
@ModelField({ gqlType: returnValue(OmniCollectionKind) })
|
|
74
|
-
@IsEnum(OmniCollectionKind)
|
|
75
|
-
kind!: OmniCollectionKind;
|
|
76
|
-
|
|
77
|
-
@ModelField({ gqlType: returnValue(OmniRecordStatus) })
|
|
78
|
-
@IsEnum(OmniRecordStatus)
|
|
79
|
-
status!: OmniRecordStatus;
|
|
80
|
-
|
|
81
|
-
@ModelField({
|
|
82
|
-
gqlType: returnValue(GraphQLJSONObject),
|
|
83
|
-
gqlOptions: { nullable: true },
|
|
84
|
-
})
|
|
85
|
-
@IsOptional()
|
|
86
|
-
@IsObject()
|
|
87
|
-
payload?: Record<string, unknown> | null;
|
|
88
|
-
|
|
89
|
-
@ModelField({
|
|
90
|
-
gqlType: returnValue(String),
|
|
91
|
-
gqlOptions: { nullable: true },
|
|
92
|
-
})
|
|
93
|
-
@IsOptional()
|
|
94
|
-
@IsString()
|
|
95
|
-
@MaxLength(128)
|
|
96
|
-
payloadSchemaId?: string | null;
|
|
97
|
-
|
|
98
|
-
@ModelField({
|
|
99
|
-
gqlType: returnValue(Int),
|
|
100
|
-
gqlOptions: { nullable: true },
|
|
101
|
-
})
|
|
102
|
-
@IsOptional()
|
|
103
|
-
@IsInt()
|
|
104
|
-
payloadSchemaVersion?: number | null;
|
|
105
|
-
|
|
106
|
-
@ModelField({
|
|
107
|
-
gqlType: () => [OmniRelationType],
|
|
108
|
-
gqlOptions: { nullable: true },
|
|
109
|
-
relation: {
|
|
110
|
-
relationType: 'one-to-many',
|
|
111
|
-
sourceKey: { dst: 'guid', alias: 'guid' },
|
|
112
|
-
targetKey: { dst: 'sourceRecordId', alias: 'sourceRecordId' },
|
|
113
|
-
type: () => OmniRelationEntity,
|
|
114
|
-
},
|
|
115
|
-
})
|
|
116
|
-
outgoingRelations?: Relation<OmniRelationType[]>;
|
|
117
|
-
|
|
118
|
-
@ModelField({
|
|
119
|
-
gqlType: () => [OmniRelationType],
|
|
120
|
-
gqlOptions: { nullable: true },
|
|
121
|
-
relation: {
|
|
122
|
-
relationType: 'one-to-many',
|
|
123
|
-
sourceKey: { dst: 'guid', alias: 'guid' },
|
|
124
|
-
targetKey: { dst: 'targetRecordId', alias: 'targetRecordId' },
|
|
125
|
-
type: () => OmniRelationEntity,
|
|
126
|
-
},
|
|
127
|
-
})
|
|
128
|
-
incomingRelations?: Relation<OmniRelationType[]>;
|
|
129
|
-
|
|
130
|
-
@ModelField({ gqlType: returnValue(OmniCollectionKind) })
|
|
131
|
-
@IsEnum(OmniCollectionKind)
|
|
132
|
-
collectionKind!: OmniCollectionKind;
|
|
133
|
-
|
|
134
|
-
@ModelField({
|
|
135
|
-
gqlType: returnValue(String),
|
|
136
|
-
gqlOptions: { nullable: true },
|
|
137
|
-
})
|
|
138
|
-
@IsOptional()
|
|
139
|
-
@IsString()
|
|
140
|
-
summary?: string | null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@InputType()
|
|
144
|
-
@ModelObject()
|
|
145
|
-
export class OmniCollectionCreateInput extends OmitType(
|
|
146
|
-
OmniCollectionType,
|
|
147
|
-
[
|
|
148
|
-
'createdAt',
|
|
149
|
-
'updatedAt',
|
|
150
|
-
'revision',
|
|
151
|
-
'kind',
|
|
152
|
-
'outgoingRelations',
|
|
153
|
-
'incomingRelations',
|
|
154
|
-
] as const,
|
|
155
|
-
InputType,
|
|
156
|
-
) {}
|
|
157
|
-
|
|
158
|
-
@InputType()
|
|
159
|
-
@ModelObject({ copyFrom: OmniCollectionType })
|
|
160
|
-
export class OmniCollectionCondition extends PartialType(
|
|
161
|
-
OmniCollectionCreateInput,
|
|
162
|
-
InputType,
|
|
163
|
-
) {}
|
|
164
|
-
|
|
165
|
-
@InputType()
|
|
166
|
-
@ModelObject({ copyFrom: OmniCollectionType })
|
|
167
|
-
export class OmniCollectionUpdateInput extends PartialType(
|
|
168
|
-
OmniCollectionCreateInput,
|
|
169
|
-
InputType,
|
|
170
|
-
) {}
|
|
1
|
+
import {
|
|
2
|
+
InputType,
|
|
3
|
+
Int,
|
|
4
|
+
ObjectType,
|
|
5
|
+
OmitType,
|
|
6
|
+
PartialType,
|
|
7
|
+
} from '@nestjs/graphql';
|
|
8
|
+
import {
|
|
9
|
+
ModelField,
|
|
10
|
+
ModelObject,
|
|
11
|
+
} from '@nest-yalc-2/crud-gen/object.decorator.js';
|
|
12
|
+
import { UUIDScalar } from '@nest-yalc-2/graphql/scalars/uuid.scalar.js';
|
|
13
|
+
import returnValue from '@node-yalc/utils/returnValue.js';
|
|
14
|
+
import {
|
|
15
|
+
IsEnum,
|
|
16
|
+
IsInt,
|
|
17
|
+
IsObject,
|
|
18
|
+
IsOptional,
|
|
19
|
+
IsString,
|
|
20
|
+
IsUUID,
|
|
21
|
+
MaxLength,
|
|
22
|
+
} from 'class-validator';
|
|
23
|
+
import { GraphQLJSONObject } from 'graphql-type-json';
|
|
24
|
+
import type { Relation } from 'typeorm';
|
|
25
|
+
import { OmniRelationEntity } from './base/omni-relation.entity.js';
|
|
26
|
+
import { OmniCollectionEntity } from './omni-collection.entity.js';
|
|
27
|
+
import { OmniCollectionKind } from './omni-collection-kind.enum.js';
|
|
28
|
+
import { assignOmniPublicDto } from './omni-dto.helpers.js';
|
|
29
|
+
import { OmniRecordStatus } from './omni-record-status.enum.js';
|
|
30
|
+
import { OmniRelationType } from './omni-relation.dto.js';
|
|
31
|
+
|
|
32
|
+
@ObjectType()
|
|
33
|
+
@ModelObject()
|
|
34
|
+
export class OmniCollectionType extends OmniCollectionEntity {
|
|
35
|
+
constructor(data?: Partial<OmniCollectionType>) {
|
|
36
|
+
super();
|
|
37
|
+
if (data) {
|
|
38
|
+
assignOmniPublicDto(this, data);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@ModelField({ gqlType: returnValue(UUIDScalar), isRequired: true })
|
|
43
|
+
@IsUUID()
|
|
44
|
+
guid!: string;
|
|
45
|
+
|
|
46
|
+
@ModelField({ gqlType: returnValue(Int) })
|
|
47
|
+
@IsInt()
|
|
48
|
+
revision!: number;
|
|
49
|
+
|
|
50
|
+
@ModelField({
|
|
51
|
+
gqlType: returnValue(String),
|
|
52
|
+
gqlOptions: { nullable: true },
|
|
53
|
+
})
|
|
54
|
+
@IsOptional()
|
|
55
|
+
@IsString()
|
|
56
|
+
@MaxLength(128)
|
|
57
|
+
externalId?: string | null;
|
|
58
|
+
|
|
59
|
+
@ModelField({ gqlType: returnValue(String) })
|
|
60
|
+
@IsString()
|
|
61
|
+
@MaxLength(255)
|
|
62
|
+
title!: string;
|
|
63
|
+
|
|
64
|
+
@ModelField({
|
|
65
|
+
gqlType: returnValue(String),
|
|
66
|
+
gqlOptions: { nullable: true },
|
|
67
|
+
})
|
|
68
|
+
@IsOptional()
|
|
69
|
+
@IsString()
|
|
70
|
+
@MaxLength(255)
|
|
71
|
+
slug?: string | null;
|
|
72
|
+
|
|
73
|
+
@ModelField({ gqlType: returnValue(OmniCollectionKind) })
|
|
74
|
+
@IsEnum(OmniCollectionKind)
|
|
75
|
+
kind!: OmniCollectionKind;
|
|
76
|
+
|
|
77
|
+
@ModelField({ gqlType: returnValue(OmniRecordStatus) })
|
|
78
|
+
@IsEnum(OmniRecordStatus)
|
|
79
|
+
status!: OmniRecordStatus;
|
|
80
|
+
|
|
81
|
+
@ModelField({
|
|
82
|
+
gqlType: returnValue(GraphQLJSONObject),
|
|
83
|
+
gqlOptions: { nullable: true },
|
|
84
|
+
})
|
|
85
|
+
@IsOptional()
|
|
86
|
+
@IsObject()
|
|
87
|
+
payload?: Record<string, unknown> | null;
|
|
88
|
+
|
|
89
|
+
@ModelField({
|
|
90
|
+
gqlType: returnValue(String),
|
|
91
|
+
gqlOptions: { nullable: true },
|
|
92
|
+
})
|
|
93
|
+
@IsOptional()
|
|
94
|
+
@IsString()
|
|
95
|
+
@MaxLength(128)
|
|
96
|
+
payloadSchemaId?: string | null;
|
|
97
|
+
|
|
98
|
+
@ModelField({
|
|
99
|
+
gqlType: returnValue(Int),
|
|
100
|
+
gqlOptions: { nullable: true },
|
|
101
|
+
})
|
|
102
|
+
@IsOptional()
|
|
103
|
+
@IsInt()
|
|
104
|
+
payloadSchemaVersion?: number | null;
|
|
105
|
+
|
|
106
|
+
@ModelField({
|
|
107
|
+
gqlType: () => [OmniRelationType],
|
|
108
|
+
gqlOptions: { nullable: true },
|
|
109
|
+
relation: {
|
|
110
|
+
relationType: 'one-to-many',
|
|
111
|
+
sourceKey: { dst: 'guid', alias: 'guid' },
|
|
112
|
+
targetKey: { dst: 'sourceRecordId', alias: 'sourceRecordId' },
|
|
113
|
+
type: () => OmniRelationEntity,
|
|
114
|
+
},
|
|
115
|
+
})
|
|
116
|
+
outgoingRelations?: Relation<OmniRelationType[]>;
|
|
117
|
+
|
|
118
|
+
@ModelField({
|
|
119
|
+
gqlType: () => [OmniRelationType],
|
|
120
|
+
gqlOptions: { nullable: true },
|
|
121
|
+
relation: {
|
|
122
|
+
relationType: 'one-to-many',
|
|
123
|
+
sourceKey: { dst: 'guid', alias: 'guid' },
|
|
124
|
+
targetKey: { dst: 'targetRecordId', alias: 'targetRecordId' },
|
|
125
|
+
type: () => OmniRelationEntity,
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
incomingRelations?: Relation<OmniRelationType[]>;
|
|
129
|
+
|
|
130
|
+
@ModelField({ gqlType: returnValue(OmniCollectionKind) })
|
|
131
|
+
@IsEnum(OmniCollectionKind)
|
|
132
|
+
collectionKind!: OmniCollectionKind;
|
|
133
|
+
|
|
134
|
+
@ModelField({
|
|
135
|
+
gqlType: returnValue(String),
|
|
136
|
+
gqlOptions: { nullable: true },
|
|
137
|
+
})
|
|
138
|
+
@IsOptional()
|
|
139
|
+
@IsString()
|
|
140
|
+
summary?: string | null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@InputType()
|
|
144
|
+
@ModelObject()
|
|
145
|
+
export class OmniCollectionCreateInput extends OmitType(
|
|
146
|
+
OmniCollectionType,
|
|
147
|
+
[
|
|
148
|
+
'createdAt',
|
|
149
|
+
'updatedAt',
|
|
150
|
+
'revision',
|
|
151
|
+
'kind',
|
|
152
|
+
'outgoingRelations',
|
|
153
|
+
'incomingRelations',
|
|
154
|
+
] as const,
|
|
155
|
+
InputType,
|
|
156
|
+
) {}
|
|
157
|
+
|
|
158
|
+
@InputType()
|
|
159
|
+
@ModelObject({ copyFrom: OmniCollectionType })
|
|
160
|
+
export class OmniCollectionCondition extends PartialType(
|
|
161
|
+
OmniCollectionCreateInput,
|
|
162
|
+
InputType,
|
|
163
|
+
) {}
|
|
164
|
+
|
|
165
|
+
@InputType()
|
|
166
|
+
@ModelObject({ copyFrom: OmniCollectionType })
|
|
167
|
+
export class OmniCollectionUpdateInput extends PartialType(
|
|
168
|
+
OmniCollectionCreateInput,
|
|
169
|
+
InputType,
|
|
170
|
+
) {}
|