@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.
Files changed (74) hide show
  1. package/package.json +17 -15
  2. package/src/__tests__/omni-collection.entity.spec.ts +49 -49
  3. package/src/__tests__/omni-collection.service.spec.ts +83 -83
  4. package/src/__tests__/omni-document.entity.spec.ts +55 -55
  5. package/src/__tests__/omni-document.service.spec.ts +83 -83
  6. package/src/__tests__/omni-extension-projection-constraints.spec.ts +518 -518
  7. package/src/__tests__/omni-extension-projection.registration.spec.ts +947 -946
  8. package/src/__tests__/omni-extension-projection.service.spec.ts +806 -806
  9. package/src/__tests__/omni-external-ref.entity.spec.ts +36 -36
  10. package/src/__tests__/omni-external-ref.service.spec.ts +252 -252
  11. package/src/__tests__/omni-named.entity.spec.ts +33 -33
  12. package/src/__tests__/omni-record.entity.spec.ts +32 -32
  13. package/src/__tests__/omni-record.service.spec.ts +107 -107
  14. package/src/__tests__/omni-relation-semantics.spec.ts +102 -102
  15. package/src/__tests__/omni-relation.entity.spec.ts +38 -38
  16. package/src/__tests__/omni-scope-substrate.spec.ts +81 -81
  17. package/src/__tests__/omni-scoped.backend.spec.ts +115 -115
  18. package/src/__tests__/omni-scoped.service.spec.ts +354 -354
  19. package/src/__tests__/omnikernel.diagnostics.spec.ts +94 -94
  20. package/src/__tests__/omnikernel.module.spec.ts +38 -40
  21. package/src/__tests__/omnikernel.persistence.spec.ts +154 -154
  22. package/src/__tests__/omnikernel.public-api.spec.ts +238 -238
  23. package/src/__tests__/omnikernel.query.service.spec.ts +155 -155
  24. package/src/base/omni-base.entity.ts +41 -41
  25. package/src/base/omni-external-ref.entity.ts +53 -53
  26. package/src/base/omni-named.entity.ts +16 -16
  27. package/src/base/omni-record.entity.ts +51 -51
  28. package/src/base/omni-relation.entity.ts +72 -72
  29. package/src/index.ts +49 -49
  30. package/src/omni-collection-kind.enum.ts +10 -10
  31. package/src/omni-collection.backend.ts +16 -16
  32. package/src/omni-collection.dto.ts +170 -170
  33. package/src/omni-collection.entity.ts +21 -21
  34. package/src/omni-collection.service.ts +75 -75
  35. package/src/omni-document-kind.enum.ts +12 -12
  36. package/src/omni-document.backend.ts +16 -16
  37. package/src/omni-document.dto.ts +198 -198
  38. package/src/omni-document.entity.ts +30 -30
  39. package/src/omni-document.service.ts +75 -75
  40. package/src/omni-dto.helpers.ts +21 -21
  41. package/src/omni-extension-projection.definition.ts +294 -294
  42. package/src/omni-extension-projection.resource.ts +274 -274
  43. package/src/omni-extension-projection.service.ts +452 -452
  44. package/src/omni-external-ref-binding.validator.ts +53 -53
  45. package/src/omni-external-ref-internal-type.enum.ts +11 -11
  46. package/src/omni-external-ref.backend.ts +25 -25
  47. package/src/omni-external-ref.dto.ts +128 -128
  48. package/src/omni-external-ref.service.ts +255 -255
  49. package/src/omni-migration.ts +365 -365
  50. package/src/omni-named.backend.ts +11 -11
  51. package/src/omni-named.dto.ts +86 -86
  52. package/src/omni-projection.catalog.ts +345 -345
  53. package/src/omni-projection.lifecycle.ts +53 -53
  54. package/src/omni-record-status.enum.ts +11 -11
  55. package/src/omni-record.backend.ts +19 -19
  56. package/src/omni-record.dto.ts +157 -157
  57. package/src/omni-record.service.ts +113 -113
  58. package/src/omni-relation-kind.contract.ts +49 -49
  59. package/src/omni-relation-kind.enum.ts +12 -12
  60. package/src/omni-relation-projection.definition.ts +166 -166
  61. package/src/omni-relation-projection.resource.ts +360 -360
  62. package/src/omni-relation-projection.service.ts +610 -610
  63. package/src/omni-relation-semantics.ts +52 -52
  64. package/src/omni-relation-status.enum.ts +11 -11
  65. package/src/omni-relation.backend.ts +21 -21
  66. package/src/omni-relation.dto.ts +142 -142
  67. package/src/omni-relation.service.ts +159 -159
  68. package/src/omni-scope.ts +161 -161
  69. package/src/omni-scoped.backend.ts +110 -110
  70. package/src/omni-scoped.repository.ts +34 -34
  71. package/src/omni-scoped.service.ts +338 -338
  72. package/src/omnikernel.diagnostics.ts +83 -83
  73. package/src/omnikernel.module.ts +97 -97
  74. package/src/omnikernel.query.service.ts +108 -108
@@ -1,21 +1,21 @@
1
- import { ObjectType } from '@nestjs/graphql';
2
- import { ChildEntity, Column } from 'typeorm';
3
- import { OmniRecordEntity } from './base/omni-record.entity.js';
4
- import { OmniCollectionKind } from './omni-collection-kind.enum.js';
5
-
6
- @ChildEntity(OmniCollectionKind.Collection)
7
- @ObjectType({ isAbstract: true })
8
- export class OmniCollectionEntity extends OmniRecordEntity {
9
- kind: OmniCollectionKind = OmniCollectionKind.Collection;
10
-
11
- @Column({
12
- type: 'varchar',
13
- default: OmniCollectionKind.Collection,
14
- enum: Object.values(OmniCollectionKind),
15
- length: 32,
16
- })
17
- collectionKind!: OmniCollectionKind;
18
-
19
- @Column({ type: 'text', nullable: true })
20
- summary?: string | null;
21
- }
1
+ import { ObjectType } from '@nestjs/graphql';
2
+ import { ChildEntity, Column } from 'typeorm';
3
+ import { OmniRecordEntity } from './base/omni-record.entity.js';
4
+ import { OmniCollectionKind } from './omni-collection-kind.enum.js';
5
+
6
+ @ChildEntity(OmniCollectionKind.Collection)
7
+ @ObjectType({ isAbstract: true })
8
+ export class OmniCollectionEntity extends OmniRecordEntity {
9
+ kind: OmniCollectionKind = OmniCollectionKind.Collection;
10
+
11
+ @Column({
12
+ type: 'varchar',
13
+ default: OmniCollectionKind.Collection,
14
+ enum: Object.values(OmniCollectionKind),
15
+ length: 32,
16
+ })
17
+ collectionKind!: OmniCollectionKind;
18
+
19
+ @Column({ type: 'text', nullable: true })
20
+ summary?: string | null;
21
+ }
@@ -1,75 +1,75 @@
1
- import type { CrudGenFindManyOptions } from '@nest-yalc-2/crud-gen/api-graphql/crud-gen-gql.interface.js';
2
- import type { GenericTypeORMRepository } from '@nest-yalc-2/crud-gen/typeorm/generic.repository.js';
3
- import type { DeepPartial, FindOptionsWhere } from 'typeorm';
4
- import { OmniCollectionKind } from './omni-collection-kind.enum.js';
5
- import { OmniCollectionEntity } from './omni-collection.entity.js';
6
- import type { OmniDeletePolicy, OmniScope } from './omni-scope.js';
7
- import { OmniScopedService } from './omni-scoped.service.js';
8
-
9
- export class OmniCollectionService extends OmniScopedService<OmniCollectionEntity> {
10
- constructor(
11
- repository: GenericTypeORMRepository<OmniCollectionEntity>,
12
- scopeOrRepositoryWrite?:
13
- OmniScope | GenericTypeORMRepository<OmniCollectionEntity>,
14
- deletion: OmniDeletePolicy = 'tombstone',
15
- ) {
16
- super(repository, scopeOrRepositoryWrite, deletion);
17
- }
18
-
19
- protected normalizeCollectionInput(
20
- input: DeepPartial<OmniCollectionEntity>,
21
- ): DeepPartial<OmniCollectionEntity> {
22
- return {
23
- ...input,
24
- kind: OmniCollectionKind.Collection,
25
- };
26
- }
27
-
28
- override async createEntity(
29
- input: DeepPartial<OmniCollectionEntity>,
30
- findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
31
- returnEntity?: true,
32
- ): Promise<OmniCollectionEntity>;
33
- override async createEntity(
34
- input: DeepPartial<OmniCollectionEntity>,
35
- findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
36
- returnEntity?: boolean,
37
- ): Promise<OmniCollectionEntity | boolean>;
38
- override async createEntity(
39
- input: DeepPartial<OmniCollectionEntity>,
40
- findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
41
- returnEntity = true,
42
- ): Promise<OmniCollectionEntity | boolean> {
43
- return super.createEntity(
44
- this.normalizeCollectionInput(input),
45
- findOptions,
46
- returnEntity,
47
- );
48
- }
49
-
50
- override async updateEntity(
51
- conditions: FindOptionsWhere<OmniCollectionEntity>,
52
- input: DeepPartial<OmniCollectionEntity>,
53
- findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
54
- returnEntity?: true,
55
- ): Promise<OmniCollectionEntity>;
56
- override async updateEntity(
57
- conditions: FindOptionsWhere<OmniCollectionEntity>,
58
- input: DeepPartial<OmniCollectionEntity>,
59
- findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
60
- returnEntity?: boolean,
61
- ): Promise<OmniCollectionEntity | boolean>;
62
- override async updateEntity(
63
- conditions: FindOptionsWhere<OmniCollectionEntity>,
64
- input: DeepPartial<OmniCollectionEntity>,
65
- findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
66
- returnEntity = true,
67
- ): Promise<OmniCollectionEntity | boolean> {
68
- return super.updateEntity(
69
- conditions,
70
- this.normalizeCollectionInput(input),
71
- findOptions,
72
- returnEntity,
73
- );
74
- }
75
- }
1
+ import type { CrudGenFindManyOptions } from '@nest-yalc-2/crud-gen/api-graphql/crud-gen-gql.interface.js';
2
+ import type { GenericTypeORMRepository } from '@nest-yalc-2/crud-gen/typeorm/generic.repository.js';
3
+ import type { DeepPartial, FindOptionsWhere } from 'typeorm';
4
+ import { OmniCollectionKind } from './omni-collection-kind.enum.js';
5
+ import { OmniCollectionEntity } from './omni-collection.entity.js';
6
+ import type { OmniDeletePolicy, OmniScope } from './omni-scope.js';
7
+ import { OmniScopedService } from './omni-scoped.service.js';
8
+
9
+ export class OmniCollectionService extends OmniScopedService<OmniCollectionEntity> {
10
+ constructor(
11
+ repository: GenericTypeORMRepository<OmniCollectionEntity>,
12
+ scopeOrRepositoryWrite?:
13
+ OmniScope | GenericTypeORMRepository<OmniCollectionEntity>,
14
+ deletion: OmniDeletePolicy = 'tombstone',
15
+ ) {
16
+ super(repository, scopeOrRepositoryWrite, deletion);
17
+ }
18
+
19
+ protected normalizeCollectionInput(
20
+ input: DeepPartial<OmniCollectionEntity>,
21
+ ): DeepPartial<OmniCollectionEntity> {
22
+ return {
23
+ ...input,
24
+ kind: OmniCollectionKind.Collection,
25
+ };
26
+ }
27
+
28
+ override async createEntity(
29
+ input: DeepPartial<OmniCollectionEntity>,
30
+ findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
31
+ returnEntity?: true,
32
+ ): Promise<OmniCollectionEntity>;
33
+ override async createEntity(
34
+ input: DeepPartial<OmniCollectionEntity>,
35
+ findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
36
+ returnEntity?: boolean,
37
+ ): Promise<OmniCollectionEntity | boolean>;
38
+ override async createEntity(
39
+ input: DeepPartial<OmniCollectionEntity>,
40
+ findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
41
+ returnEntity = true,
42
+ ): Promise<OmniCollectionEntity | boolean> {
43
+ return super.createEntity(
44
+ this.normalizeCollectionInput(input),
45
+ findOptions,
46
+ returnEntity,
47
+ );
48
+ }
49
+
50
+ override async updateEntity(
51
+ conditions: FindOptionsWhere<OmniCollectionEntity>,
52
+ input: DeepPartial<OmniCollectionEntity>,
53
+ findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
54
+ returnEntity?: true,
55
+ ): Promise<OmniCollectionEntity>;
56
+ override async updateEntity(
57
+ conditions: FindOptionsWhere<OmniCollectionEntity>,
58
+ input: DeepPartial<OmniCollectionEntity>,
59
+ findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
60
+ returnEntity?: boolean,
61
+ ): Promise<OmniCollectionEntity | boolean>;
62
+ override async updateEntity(
63
+ conditions: FindOptionsWhere<OmniCollectionEntity>,
64
+ input: DeepPartial<OmniCollectionEntity>,
65
+ findOptions?: CrudGenFindManyOptions<OmniCollectionEntity>,
66
+ returnEntity = true,
67
+ ): Promise<OmniCollectionEntity | boolean> {
68
+ return super.updateEntity(
69
+ conditions,
70
+ this.normalizeCollectionInput(input),
71
+ findOptions,
72
+ returnEntity,
73
+ );
74
+ }
75
+ }
@@ -1,12 +1,12 @@
1
- import { registerEnumType } from '@nestjs/graphql';
2
-
3
- export enum OmniDocumentKind {
4
- Document = 'document',
5
- Note = 'note',
6
- Article = 'article',
7
- Page = 'page',
8
- }
9
-
10
- registerEnumType(OmniDocumentKind, {
11
- name: 'OmniDocumentKind',
12
- });
1
+ import { registerEnumType } from '@nestjs/graphql';
2
+
3
+ export enum OmniDocumentKind {
4
+ Document = 'document',
5
+ Note = 'note',
6
+ Article = 'article',
7
+ Page = 'page',
8
+ }
9
+
10
+ registerEnumType(OmniDocumentKind, {
11
+ name: 'OmniDocumentKind',
12
+ });
@@ -1,16 +1,16 @@
1
- import { OmniDocumentEntity } from './omni-document.entity.js';
2
- import { OmniDocumentService } from './omni-document.service.js';
3
- import {
4
- omniBackendServiceToken,
5
- omniScopedBackendProvidersFactory,
6
- } from './omni-scoped.backend.js';
7
-
8
- export const omniDocumentBackendProvidersFactory = (dbConnection: string) =>
9
- omniScopedBackendProvidersFactory<OmniDocumentEntity>({
10
- entityModel: OmniDocumentEntity,
11
- dbConnection,
12
- serviceToken: omniBackendServiceToken(OmniDocumentService),
13
- serviceProvider: OmniDocumentService,
14
- createService: (repository, scope, options) =>
15
- new OmniDocumentService(repository, scope, options.deletion.document),
16
- });
1
+ import { OmniDocumentEntity } from './omni-document.entity.js';
2
+ import { OmniDocumentService } from './omni-document.service.js';
3
+ import {
4
+ omniBackendServiceToken,
5
+ omniScopedBackendProvidersFactory,
6
+ } from './omni-scoped.backend.js';
7
+
8
+ export const omniDocumentBackendProvidersFactory = (dbConnection: string) =>
9
+ omniScopedBackendProvidersFactory<OmniDocumentEntity>({
10
+ entityModel: OmniDocumentEntity,
11
+ dbConnection,
12
+ serviceToken: omniBackendServiceToken(OmniDocumentService),
13
+ serviceProvider: OmniDocumentService,
14
+ createService: (repository, scope, options) =>
15
+ new OmniDocumentService(repository, scope, options.deletion.document),
16
+ });
@@ -1,198 +1,198 @@
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
- IsDate,
16
- IsEnum,
17
- IsInt,
18
- IsObject,
19
- IsOptional,
20
- IsString,
21
- IsUrl,
22
- IsUUID,
23
- MaxLength,
24
- } from 'class-validator';
25
- import { GraphQLJSONObject } from 'graphql-type-json';
26
- import type { Relation } from 'typeorm';
27
- import { OmniDocumentEntity } from './omni-document.entity.js';
28
- import { OmniDocumentKind } from './omni-document-kind.enum.js';
29
- import { assignOmniPublicDto } from './omni-dto.helpers.js';
30
- import { OmniRecordStatus } from './omni-record-status.enum.js';
31
- import { OmniRelationEntity } from './base/omni-relation.entity.js';
32
- import { OmniRelationType } from './omni-relation.dto.js';
33
-
34
- @ObjectType()
35
- @ModelObject()
36
- export class OmniDocumentType extends OmniDocumentEntity {
37
- constructor(data?: Partial<OmniDocumentType>) {
38
- super();
39
- if (data) {
40
- assignOmniPublicDto(this, data);
41
- }
42
- }
43
-
44
- @ModelField({ gqlType: returnValue(UUIDScalar), isRequired: true })
45
- @IsUUID()
46
- guid!: string;
47
-
48
- @ModelField({ gqlType: returnValue(Int) })
49
- @IsInt()
50
- revision!: number;
51
-
52
- @ModelField({
53
- gqlType: returnValue(String),
54
- gqlOptions: { nullable: true },
55
- })
56
- @IsOptional()
57
- @IsString()
58
- @MaxLength(128)
59
- externalId?: string | null;
60
-
61
- @ModelField({ gqlType: returnValue(String) })
62
- @IsString()
63
- @MaxLength(255)
64
- title!: string;
65
-
66
- @ModelField({
67
- gqlType: returnValue(String),
68
- gqlOptions: { nullable: true },
69
- })
70
- @IsOptional()
71
- @IsString()
72
- @MaxLength(255)
73
- slug?: string | null;
74
-
75
- @ModelField({ gqlType: returnValue(OmniDocumentKind) })
76
- @IsEnum(OmniDocumentKind)
77
- kind!: OmniDocumentKind;
78
-
79
- @ModelField({ gqlType: returnValue(OmniRecordStatus) })
80
- @IsEnum(OmniRecordStatus)
81
- status!: OmniRecordStatus;
82
-
83
- @ModelField({
84
- gqlType: returnValue(GraphQLJSONObject),
85
- gqlOptions: { nullable: true },
86
- })
87
- @IsOptional()
88
- @IsObject()
89
- payload?: Record<string, unknown> | null;
90
-
91
- @ModelField({
92
- gqlType: returnValue(String),
93
- gqlOptions: { nullable: true },
94
- })
95
- @IsOptional()
96
- @IsString()
97
- @MaxLength(128)
98
- payloadSchemaId?: string | null;
99
-
100
- @ModelField({
101
- gqlType: returnValue(Int),
102
- gqlOptions: { nullable: true },
103
- })
104
- @IsOptional()
105
- @IsInt()
106
- payloadSchemaVersion?: number | null;
107
-
108
- @ModelField({
109
- gqlType: () => [OmniRelationType],
110
- gqlOptions: { nullable: true },
111
- relation: {
112
- relationType: 'one-to-many',
113
- sourceKey: { dst: 'guid', alias: 'guid' },
114
- targetKey: { dst: 'sourceRecordId', alias: 'sourceRecordId' },
115
- type: () => OmniRelationEntity,
116
- },
117
- })
118
- outgoingRelations?: Relation<OmniRelationType[]>;
119
-
120
- @ModelField({
121
- gqlType: () => [OmniRelationType],
122
- gqlOptions: { nullable: true },
123
- relation: {
124
- relationType: 'one-to-many',
125
- sourceKey: { dst: 'guid', alias: 'guid' },
126
- targetKey: { dst: 'targetRecordId', alias: 'targetRecordId' },
127
- type: () => OmniRelationEntity,
128
- },
129
- })
130
- incomingRelations?: Relation<OmniRelationType[]>;
131
-
132
- @ModelField({ gqlType: returnValue(OmniDocumentKind) })
133
- @IsEnum(OmniDocumentKind)
134
- documentKind!: OmniDocumentKind;
135
-
136
- @ModelField({
137
- gqlType: returnValue(String),
138
- gqlOptions: { nullable: true },
139
- })
140
- @IsOptional()
141
- @IsString()
142
- content?: string | null;
143
-
144
- @ModelField({
145
- gqlType: returnValue(String),
146
- gqlOptions: { nullable: true },
147
- })
148
- @IsOptional()
149
- @IsString()
150
- @MaxLength(128)
151
- contentMimeType?: string | null;
152
-
153
- @ModelField({
154
- gqlType: returnValue(String),
155
- gqlOptions: { nullable: true },
156
- })
157
- @IsOptional()
158
- @IsUrl()
159
- @MaxLength(2048)
160
- sourceUrl?: string | null;
161
-
162
- @ModelField({
163
- gqlType: returnValue(Date),
164
- gqlOptions: { nullable: true },
165
- })
166
- @IsOptional()
167
- @IsDate()
168
- publishedAt?: Date | null;
169
- }
170
-
171
- @InputType()
172
- @ModelObject()
173
- export class OmniDocumentCreateInput extends OmitType(
174
- OmniDocumentType,
175
- [
176
- 'createdAt',
177
- 'updatedAt',
178
- 'revision',
179
- 'kind',
180
- 'outgoingRelations',
181
- 'incomingRelations',
182
- ] as const,
183
- InputType,
184
- ) {}
185
-
186
- @InputType()
187
- @ModelObject({ copyFrom: OmniDocumentType })
188
- export class OmniDocumentCondition extends PartialType(
189
- OmniDocumentCreateInput,
190
- InputType,
191
- ) {}
192
-
193
- @InputType()
194
- @ModelObject({ copyFrom: OmniDocumentType })
195
- export class OmniDocumentUpdateInput extends PartialType(
196
- OmniDocumentCreateInput,
197
- InputType,
198
- ) {}
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
+ IsDate,
16
+ IsEnum,
17
+ IsInt,
18
+ IsObject,
19
+ IsOptional,
20
+ IsString,
21
+ IsUrl,
22
+ IsUUID,
23
+ MaxLength,
24
+ } from 'class-validator';
25
+ import { GraphQLJSONObject } from 'graphql-type-json';
26
+ import type { Relation } from 'typeorm';
27
+ import { OmniDocumentEntity } from './omni-document.entity.js';
28
+ import { OmniDocumentKind } from './omni-document-kind.enum.js';
29
+ import { assignOmniPublicDto } from './omni-dto.helpers.js';
30
+ import { OmniRecordStatus } from './omni-record-status.enum.js';
31
+ import { OmniRelationEntity } from './base/omni-relation.entity.js';
32
+ import { OmniRelationType } from './omni-relation.dto.js';
33
+
34
+ @ObjectType()
35
+ @ModelObject()
36
+ export class OmniDocumentType extends OmniDocumentEntity {
37
+ constructor(data?: Partial<OmniDocumentType>) {
38
+ super();
39
+ if (data) {
40
+ assignOmniPublicDto(this, data);
41
+ }
42
+ }
43
+
44
+ @ModelField({ gqlType: returnValue(UUIDScalar), isRequired: true })
45
+ @IsUUID()
46
+ guid!: string;
47
+
48
+ @ModelField({ gqlType: returnValue(Int) })
49
+ @IsInt()
50
+ revision!: number;
51
+
52
+ @ModelField({
53
+ gqlType: returnValue(String),
54
+ gqlOptions: { nullable: true },
55
+ })
56
+ @IsOptional()
57
+ @IsString()
58
+ @MaxLength(128)
59
+ externalId?: string | null;
60
+
61
+ @ModelField({ gqlType: returnValue(String) })
62
+ @IsString()
63
+ @MaxLength(255)
64
+ title!: string;
65
+
66
+ @ModelField({
67
+ gqlType: returnValue(String),
68
+ gqlOptions: { nullable: true },
69
+ })
70
+ @IsOptional()
71
+ @IsString()
72
+ @MaxLength(255)
73
+ slug?: string | null;
74
+
75
+ @ModelField({ gqlType: returnValue(OmniDocumentKind) })
76
+ @IsEnum(OmniDocumentKind)
77
+ kind!: OmniDocumentKind;
78
+
79
+ @ModelField({ gqlType: returnValue(OmniRecordStatus) })
80
+ @IsEnum(OmniRecordStatus)
81
+ status!: OmniRecordStatus;
82
+
83
+ @ModelField({
84
+ gqlType: returnValue(GraphQLJSONObject),
85
+ gqlOptions: { nullable: true },
86
+ })
87
+ @IsOptional()
88
+ @IsObject()
89
+ payload?: Record<string, unknown> | null;
90
+
91
+ @ModelField({
92
+ gqlType: returnValue(String),
93
+ gqlOptions: { nullable: true },
94
+ })
95
+ @IsOptional()
96
+ @IsString()
97
+ @MaxLength(128)
98
+ payloadSchemaId?: string | null;
99
+
100
+ @ModelField({
101
+ gqlType: returnValue(Int),
102
+ gqlOptions: { nullable: true },
103
+ })
104
+ @IsOptional()
105
+ @IsInt()
106
+ payloadSchemaVersion?: number | null;
107
+
108
+ @ModelField({
109
+ gqlType: () => [OmniRelationType],
110
+ gqlOptions: { nullable: true },
111
+ relation: {
112
+ relationType: 'one-to-many',
113
+ sourceKey: { dst: 'guid', alias: 'guid' },
114
+ targetKey: { dst: 'sourceRecordId', alias: 'sourceRecordId' },
115
+ type: () => OmniRelationEntity,
116
+ },
117
+ })
118
+ outgoingRelations?: Relation<OmniRelationType[]>;
119
+
120
+ @ModelField({
121
+ gqlType: () => [OmniRelationType],
122
+ gqlOptions: { nullable: true },
123
+ relation: {
124
+ relationType: 'one-to-many',
125
+ sourceKey: { dst: 'guid', alias: 'guid' },
126
+ targetKey: { dst: 'targetRecordId', alias: 'targetRecordId' },
127
+ type: () => OmniRelationEntity,
128
+ },
129
+ })
130
+ incomingRelations?: Relation<OmniRelationType[]>;
131
+
132
+ @ModelField({ gqlType: returnValue(OmniDocumentKind) })
133
+ @IsEnum(OmniDocumentKind)
134
+ documentKind!: OmniDocumentKind;
135
+
136
+ @ModelField({
137
+ gqlType: returnValue(String),
138
+ gqlOptions: { nullable: true },
139
+ })
140
+ @IsOptional()
141
+ @IsString()
142
+ content?: string | null;
143
+
144
+ @ModelField({
145
+ gqlType: returnValue(String),
146
+ gqlOptions: { nullable: true },
147
+ })
148
+ @IsOptional()
149
+ @IsString()
150
+ @MaxLength(128)
151
+ contentMimeType?: string | null;
152
+
153
+ @ModelField({
154
+ gqlType: returnValue(String),
155
+ gqlOptions: { nullable: true },
156
+ })
157
+ @IsOptional()
158
+ @IsUrl()
159
+ @MaxLength(2048)
160
+ sourceUrl?: string | null;
161
+
162
+ @ModelField({
163
+ gqlType: returnValue(Date),
164
+ gqlOptions: { nullable: true },
165
+ })
166
+ @IsOptional()
167
+ @IsDate()
168
+ publishedAt?: Date | null;
169
+ }
170
+
171
+ @InputType()
172
+ @ModelObject()
173
+ export class OmniDocumentCreateInput extends OmitType(
174
+ OmniDocumentType,
175
+ [
176
+ 'createdAt',
177
+ 'updatedAt',
178
+ 'revision',
179
+ 'kind',
180
+ 'outgoingRelations',
181
+ 'incomingRelations',
182
+ ] as const,
183
+ InputType,
184
+ ) {}
185
+
186
+ @InputType()
187
+ @ModelObject({ copyFrom: OmniDocumentType })
188
+ export class OmniDocumentCondition extends PartialType(
189
+ OmniDocumentCreateInput,
190
+ InputType,
191
+ ) {}
192
+
193
+ @InputType()
194
+ @ModelObject({ copyFrom: OmniDocumentType })
195
+ export class OmniDocumentUpdateInput extends PartialType(
196
+ OmniDocumentCreateInput,
197
+ InputType,
198
+ ) {}