@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,30 +1,30 @@
|
|
|
1
|
-
import { ObjectType } from '@nestjs/graphql';
|
|
2
|
-
import { ChildEntity, Column } from 'typeorm';
|
|
3
|
-
import { OmniRecordEntity } from './base/omni-record.entity.js';
|
|
4
|
-
import { OmniDocumentKind } from './omni-document-kind.enum.js';
|
|
5
|
-
|
|
6
|
-
@ChildEntity(OmniDocumentKind.Document)
|
|
7
|
-
@ObjectType({ isAbstract: true })
|
|
8
|
-
export class OmniDocumentEntity extends OmniRecordEntity {
|
|
9
|
-
kind: OmniDocumentKind = OmniDocumentKind.Document;
|
|
10
|
-
|
|
11
|
-
@Column({
|
|
12
|
-
type: 'varchar',
|
|
13
|
-
default: OmniDocumentKind.Document,
|
|
14
|
-
enum: Object.values(OmniDocumentKind),
|
|
15
|
-
length: 32,
|
|
16
|
-
})
|
|
17
|
-
documentKind!: OmniDocumentKind;
|
|
18
|
-
|
|
19
|
-
@Column({ type: 'text', nullable: true })
|
|
20
|
-
content?: string | null;
|
|
21
|
-
|
|
22
|
-
@Column({ type: 'varchar', nullable: true, length: 128 })
|
|
23
|
-
contentMimeType?: string | null;
|
|
24
|
-
|
|
25
|
-
@Column({ type: 'varchar', nullable: true, length: 2048 })
|
|
26
|
-
sourceUrl?: string | null;
|
|
27
|
-
|
|
28
|
-
@Column({ type: Date, nullable: true })
|
|
29
|
-
publishedAt?: Date | null;
|
|
30
|
-
}
|
|
1
|
+
import { ObjectType } from '@nestjs/graphql';
|
|
2
|
+
import { ChildEntity, Column } from 'typeorm';
|
|
3
|
+
import { OmniRecordEntity } from './base/omni-record.entity.js';
|
|
4
|
+
import { OmniDocumentKind } from './omni-document-kind.enum.js';
|
|
5
|
+
|
|
6
|
+
@ChildEntity(OmniDocumentKind.Document)
|
|
7
|
+
@ObjectType({ isAbstract: true })
|
|
8
|
+
export class OmniDocumentEntity extends OmniRecordEntity {
|
|
9
|
+
kind: OmniDocumentKind = OmniDocumentKind.Document;
|
|
10
|
+
|
|
11
|
+
@Column({
|
|
12
|
+
type: 'varchar',
|
|
13
|
+
default: OmniDocumentKind.Document,
|
|
14
|
+
enum: Object.values(OmniDocumentKind),
|
|
15
|
+
length: 32,
|
|
16
|
+
})
|
|
17
|
+
documentKind!: OmniDocumentKind;
|
|
18
|
+
|
|
19
|
+
@Column({ type: 'text', nullable: true })
|
|
20
|
+
content?: string | null;
|
|
21
|
+
|
|
22
|
+
@Column({ type: 'varchar', nullable: true, length: 128 })
|
|
23
|
+
contentMimeType?: string | null;
|
|
24
|
+
|
|
25
|
+
@Column({ type: 'varchar', nullable: true, length: 2048 })
|
|
26
|
+
sourceUrl?: string | null;
|
|
27
|
+
|
|
28
|
+
@Column({ type: Date, nullable: true })
|
|
29
|
+
publishedAt?: Date | null;
|
|
30
|
+
}
|
|
@@ -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 { OmniDocumentKind } from './omni-document-kind.enum.js';
|
|
5
|
-
import { OmniDocumentEntity } from './omni-document.entity.js';
|
|
6
|
-
import type { OmniDeletePolicy, OmniScope } from './omni-scope.js';
|
|
7
|
-
import { OmniScopedService } from './omni-scoped.service.js';
|
|
8
|
-
|
|
9
|
-
export class OmniDocumentService extends OmniScopedService<OmniDocumentEntity> {
|
|
10
|
-
constructor(
|
|
11
|
-
repository: GenericTypeORMRepository<OmniDocumentEntity>,
|
|
12
|
-
scopeOrRepositoryWrite?:
|
|
13
|
-
OmniScope | GenericTypeORMRepository<OmniDocumentEntity>,
|
|
14
|
-
deletion: OmniDeletePolicy = 'tombstone',
|
|
15
|
-
) {
|
|
16
|
-
super(repository, scopeOrRepositoryWrite, deletion);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
protected normalizeDocumentInput(
|
|
20
|
-
input: DeepPartial<OmniDocumentEntity>,
|
|
21
|
-
): DeepPartial<OmniDocumentEntity> {
|
|
22
|
-
return {
|
|
23
|
-
...input,
|
|
24
|
-
kind: OmniDocumentKind.Document,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
override async createEntity(
|
|
29
|
-
input: DeepPartial<OmniDocumentEntity>,
|
|
30
|
-
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
31
|
-
returnEntity?: true,
|
|
32
|
-
): Promise<OmniDocumentEntity>;
|
|
33
|
-
override async createEntity(
|
|
34
|
-
input: DeepPartial<OmniDocumentEntity>,
|
|
35
|
-
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
36
|
-
returnEntity?: boolean,
|
|
37
|
-
): Promise<OmniDocumentEntity | boolean>;
|
|
38
|
-
override async createEntity(
|
|
39
|
-
input: DeepPartial<OmniDocumentEntity>,
|
|
40
|
-
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
41
|
-
returnEntity = true,
|
|
42
|
-
): Promise<OmniDocumentEntity | boolean> {
|
|
43
|
-
return super.createEntity(
|
|
44
|
-
this.normalizeDocumentInput(input),
|
|
45
|
-
findOptions,
|
|
46
|
-
returnEntity,
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
override async updateEntity(
|
|
51
|
-
conditions: FindOptionsWhere<OmniDocumentEntity>,
|
|
52
|
-
input: DeepPartial<OmniDocumentEntity>,
|
|
53
|
-
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
54
|
-
returnEntity?: true,
|
|
55
|
-
): Promise<OmniDocumentEntity>;
|
|
56
|
-
override async updateEntity(
|
|
57
|
-
conditions: FindOptionsWhere<OmniDocumentEntity>,
|
|
58
|
-
input: DeepPartial<OmniDocumentEntity>,
|
|
59
|
-
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
60
|
-
returnEntity?: boolean,
|
|
61
|
-
): Promise<OmniDocumentEntity | boolean>;
|
|
62
|
-
override async updateEntity(
|
|
63
|
-
conditions: FindOptionsWhere<OmniDocumentEntity>,
|
|
64
|
-
input: DeepPartial<OmniDocumentEntity>,
|
|
65
|
-
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
66
|
-
returnEntity = true,
|
|
67
|
-
): Promise<OmniDocumentEntity | boolean> {
|
|
68
|
-
return super.updateEntity(
|
|
69
|
-
conditions,
|
|
70
|
-
this.normalizeDocumentInput(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 { OmniDocumentKind } from './omni-document-kind.enum.js';
|
|
5
|
+
import { OmniDocumentEntity } from './omni-document.entity.js';
|
|
6
|
+
import type { OmniDeletePolicy, OmniScope } from './omni-scope.js';
|
|
7
|
+
import { OmniScopedService } from './omni-scoped.service.js';
|
|
8
|
+
|
|
9
|
+
export class OmniDocumentService extends OmniScopedService<OmniDocumentEntity> {
|
|
10
|
+
constructor(
|
|
11
|
+
repository: GenericTypeORMRepository<OmniDocumentEntity>,
|
|
12
|
+
scopeOrRepositoryWrite?:
|
|
13
|
+
OmniScope | GenericTypeORMRepository<OmniDocumentEntity>,
|
|
14
|
+
deletion: OmniDeletePolicy = 'tombstone',
|
|
15
|
+
) {
|
|
16
|
+
super(repository, scopeOrRepositoryWrite, deletion);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
protected normalizeDocumentInput(
|
|
20
|
+
input: DeepPartial<OmniDocumentEntity>,
|
|
21
|
+
): DeepPartial<OmniDocumentEntity> {
|
|
22
|
+
return {
|
|
23
|
+
...input,
|
|
24
|
+
kind: OmniDocumentKind.Document,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
override async createEntity(
|
|
29
|
+
input: DeepPartial<OmniDocumentEntity>,
|
|
30
|
+
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
31
|
+
returnEntity?: true,
|
|
32
|
+
): Promise<OmniDocumentEntity>;
|
|
33
|
+
override async createEntity(
|
|
34
|
+
input: DeepPartial<OmniDocumentEntity>,
|
|
35
|
+
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
36
|
+
returnEntity?: boolean,
|
|
37
|
+
): Promise<OmniDocumentEntity | boolean>;
|
|
38
|
+
override async createEntity(
|
|
39
|
+
input: DeepPartial<OmniDocumentEntity>,
|
|
40
|
+
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
41
|
+
returnEntity = true,
|
|
42
|
+
): Promise<OmniDocumentEntity | boolean> {
|
|
43
|
+
return super.createEntity(
|
|
44
|
+
this.normalizeDocumentInput(input),
|
|
45
|
+
findOptions,
|
|
46
|
+
returnEntity,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override async updateEntity(
|
|
51
|
+
conditions: FindOptionsWhere<OmniDocumentEntity>,
|
|
52
|
+
input: DeepPartial<OmniDocumentEntity>,
|
|
53
|
+
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
54
|
+
returnEntity?: true,
|
|
55
|
+
): Promise<OmniDocumentEntity>;
|
|
56
|
+
override async updateEntity(
|
|
57
|
+
conditions: FindOptionsWhere<OmniDocumentEntity>,
|
|
58
|
+
input: DeepPartial<OmniDocumentEntity>,
|
|
59
|
+
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
60
|
+
returnEntity?: boolean,
|
|
61
|
+
): Promise<OmniDocumentEntity | boolean>;
|
|
62
|
+
override async updateEntity(
|
|
63
|
+
conditions: FindOptionsWhere<OmniDocumentEntity>,
|
|
64
|
+
input: DeepPartial<OmniDocumentEntity>,
|
|
65
|
+
findOptions?: CrudGenFindManyOptions<OmniDocumentEntity>,
|
|
66
|
+
returnEntity = true,
|
|
67
|
+
): Promise<OmniDocumentEntity | boolean> {
|
|
68
|
+
return super.updateEntity(
|
|
69
|
+
conditions,
|
|
70
|
+
this.normalizeDocumentInput(input),
|
|
71
|
+
findOptions,
|
|
72
|
+
returnEntity,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
package/src/omni-dto.helpers.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated REST mappers instantiate DTOs directly. Keep server-owned scope
|
|
3
|
-
* and lifecycle fields out of that copy so REST and GraphQL expose the same
|
|
4
|
-
* public contract.
|
|
5
|
-
*/
|
|
6
|
-
export function assignOmniPublicDto<T extends object>(
|
|
7
|
-
target: T,
|
|
8
|
-
data: object,
|
|
9
|
-
): void {
|
|
10
|
-
const {
|
|
11
|
-
scopeId: _scopeId,
|
|
12
|
-
deletedAt: _deletedAt,
|
|
13
|
-
...publicData
|
|
14
|
-
} = data as {
|
|
15
|
-
scopeId?: unknown;
|
|
16
|
-
deletedAt?: unknown;
|
|
17
|
-
};
|
|
18
|
-
Object.assign(target, publicData);
|
|
19
|
-
delete (target as { scopeId?: unknown }).scopeId;
|
|
20
|
-
delete (target as { deletedAt?: unknown }).deletedAt;
|
|
21
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Generated REST mappers instantiate DTOs directly. Keep server-owned scope
|
|
3
|
+
* and lifecycle fields out of that copy so REST and GraphQL expose the same
|
|
4
|
+
* public contract.
|
|
5
|
+
*/
|
|
6
|
+
export function assignOmniPublicDto<T extends object>(
|
|
7
|
+
target: T,
|
|
8
|
+
data: object,
|
|
9
|
+
): void {
|
|
10
|
+
const {
|
|
11
|
+
scopeId: _scopeId,
|
|
12
|
+
deletedAt: _deletedAt,
|
|
13
|
+
...publicData
|
|
14
|
+
} = data as {
|
|
15
|
+
scopeId?: unknown;
|
|
16
|
+
deletedAt?: unknown;
|
|
17
|
+
};
|
|
18
|
+
Object.assign(target, publicData);
|
|
19
|
+
delete (target as { scopeId?: unknown }).scopeId;
|
|
20
|
+
delete (target as { deletedAt?: unknown }).deletedAt;
|
|
21
|
+
}
|