@nest-yalc-2/omnikernel-module 1.1.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/LICENSE +661 -0
- package/README.md +193 -0
- package/package.json +52 -0
- package/src/__tests__/omni-collection.entity.spec.ts +49 -0
- package/src/__tests__/omni-collection.service.spec.ts +83 -0
- package/src/__tests__/omni-document.entity.spec.ts +55 -0
- package/src/__tests__/omni-document.service.spec.ts +83 -0
- package/src/__tests__/omni-extension-projection-constraints.spec.ts +518 -0
- package/src/__tests__/omni-extension-projection.registration.spec.ts +946 -0
- package/src/__tests__/omni-extension-projection.service.spec.ts +806 -0
- package/src/__tests__/omni-external-ref.entity.spec.ts +36 -0
- package/src/__tests__/omni-external-ref.service.spec.ts +252 -0
- package/src/__tests__/omni-named.entity.spec.ts +33 -0
- package/src/__tests__/omni-record.entity.spec.ts +32 -0
- package/src/__tests__/omni-record.service.spec.ts +107 -0
- package/src/__tests__/omni-relation-semantics.spec.ts +102 -0
- package/src/__tests__/omni-relation.entity.spec.ts +38 -0
- package/src/__tests__/omni-scope-substrate.spec.ts +81 -0
- package/src/__tests__/omni-scoped.backend.spec.ts +115 -0
- package/src/__tests__/omni-scoped.service.spec.ts +354 -0
- package/src/__tests__/omnikernel.diagnostics.spec.ts +94 -0
- package/src/__tests__/omnikernel.module.spec.ts +40 -0
- package/src/__tests__/omnikernel.persistence.spec.ts +154 -0
- package/src/__tests__/omnikernel.public-api.spec.ts +238 -0
- package/src/__tests__/omnikernel.query.service.spec.ts +155 -0
- package/src/__tests__/tsconfig.json +6 -0
- package/src/base/omni-base.entity.d.ts +9 -0
- package/src/base/omni-base.entity.js +53 -0
- package/src/base/omni-base.entity.js.map +1 -0
- package/src/base/omni-base.entity.ts +41 -0
- package/src/base/omni-external-ref.entity.d.ts +13 -0
- package/src/base/omni-external-ref.entity.js +72 -0
- package/src/base/omni-external-ref.entity.js.map +1 -0
- package/src/base/omni-external-ref.entity.ts +53 -0
- package/src/base/omni-named.entity.d.ts +6 -0
- package/src/base/omni-named.entity.js +35 -0
- package/src/base/omni-named.entity.js.map +1 -0
- package/src/base/omni-named.entity.ts +16 -0
- package/src/base/omni-record.entity.d.ts +13 -0
- package/src/base/omni-record.entity.js +71 -0
- package/src/base/omni-record.entity.js.map +1 -0
- package/src/base/omni-record.entity.ts +51 -0
- package/src/base/omni-relation.entity.d.ts +15 -0
- package/src/base/omni-relation.entity.js +91 -0
- package/src/base/omni-relation.entity.js.map +1 -0
- package/src/base/omni-relation.entity.ts +72 -0
- package/src/index.d.ts +49 -0
- package/src/index.js +66 -0
- package/src/index.js.map +1 -0
- package/src/index.ts +49 -0
- package/src/omni-collection-kind.enum.d.ts +4 -0
- package/src/omni-collection-kind.enum.js +13 -0
- package/src/omni-collection-kind.enum.js.map +1 -0
- package/src/omni-collection-kind.enum.ts +10 -0
- package/src/omni-collection.backend.d.ts +2 -0
- package/src/omni-collection.backend.js +15 -0
- package/src/omni-collection.backend.js.map +1 -0
- package/src/omni-collection.backend.ts +16 -0
- package/src/omni-collection.dto.d.ts +32 -0
- package/src/omni-collection.dto.js +184 -0
- package/src/omni-collection.dto.js.map +1 -0
- package/src/omni-collection.dto.ts +170 -0
- package/src/omni-collection.entity.d.ts +7 -0
- package/src/omni-collection.entity.js +41 -0
- package/src/omni-collection.entity.js.map +1 -0
- package/src/omni-collection.entity.ts +21 -0
- package/src/omni-collection.service.d.ts +14 -0
- package/src/omni-collection.service.js +24 -0
- package/src/omni-collection.service.js.map +1 -0
- package/src/omni-collection.service.ts +75 -0
- package/src/omni-document-kind.enum.d.ts +6 -0
- package/src/omni-document-kind.enum.js +15 -0
- package/src/omni-document-kind.enum.js.map +1 -0
- package/src/omni-document-kind.enum.ts +12 -0
- package/src/omni-document.backend.d.ts +2 -0
- package/src/omni-document.backend.js +15 -0
- package/src/omni-document.backend.js.map +1 -0
- package/src/omni-document.backend.ts +16 -0
- package/src/omni-document.dto.d.ts +35 -0
- package/src/omni-document.dto.js +213 -0
- package/src/omni-document.dto.js.map +1 -0
- package/src/omni-document.dto.ts +198 -0
- package/src/omni-document.entity.d.ts +10 -0
- package/src/omni-document.entity.js +53 -0
- package/src/omni-document.entity.js.map +1 -0
- package/src/omni-document.entity.ts +30 -0
- package/src/omni-document.service.d.ts +14 -0
- package/src/omni-document.service.js +24 -0
- package/src/omni-document.service.js.map +1 -0
- package/src/omni-document.service.ts +75 -0
- package/src/omni-dto.helpers.d.ts +1 -0
- package/src/omni-dto.helpers.js +10 -0
- package/src/omni-dto.helpers.js.map +1 -0
- package/src/omni-dto.helpers.ts +21 -0
- package/src/omni-extension-projection.definition.d.ts +17 -0
- package/src/omni-extension-projection.definition.js +160 -0
- package/src/omni-extension-projection.definition.js.map +1 -0
- package/src/omni-extension-projection.definition.ts +294 -0
- package/src/omni-extension-projection.resource.d.ts +42 -0
- package/src/omni-extension-projection.resource.js +127 -0
- package/src/omni-extension-projection.resource.js.map +1 -0
- package/src/omni-extension-projection.resource.ts +274 -0
- package/src/omni-extension-projection.service.d.ts +33 -0
- package/src/omni-extension-projection.service.js +332 -0
- package/src/omni-extension-projection.service.js.map +1 -0
- package/src/omni-extension-projection.service.ts +452 -0
- package/src/omni-external-ref-binding.validator.d.ts +14 -0
- package/src/omni-external-ref-binding.validator.js +34 -0
- package/src/omni-external-ref-binding.validator.js.map +1 -0
- package/src/omni-external-ref-binding.validator.ts +53 -0
- package/src/omni-external-ref-internal-type.enum.d.ts +5 -0
- package/src/omni-external-ref-internal-type.enum.js +14 -0
- package/src/omni-external-ref-internal-type.enum.js.map +1 -0
- package/src/omni-external-ref-internal-type.enum.ts +11 -0
- package/src/omni-external-ref.backend.d.ts +2 -0
- package/src/omni-external-ref.backend.js +19 -0
- package/src/omni-external-ref.backend.js.map +1 -0
- package/src/omni-external-ref.backend.ts +25 -0
- package/src/omni-external-ref.dto.d.ts +26 -0
- package/src/omni-external-ref.dto.js +140 -0
- package/src/omni-external-ref.dto.js.map +1 -0
- package/src/omni-external-ref.dto.ts +128 -0
- package/src/omni-external-ref.service.d.ts +33 -0
- package/src/omni-external-ref.service.js +133 -0
- package/src/omni-external-ref.service.js.map +1 -0
- package/src/omni-external-ref.service.ts +255 -0
- package/src/omni-migration.d.ts +28 -0
- package/src/omni-migration.js +239 -0
- package/src/omni-migration.js.map +1 -0
- package/src/omni-migration.ts +365 -0
- package/src/omni-named.backend.d.ts +2 -0
- package/src/omni-named.backend.js +13 -0
- package/src/omni-named.backend.js.map +1 -0
- package/src/omni-named.backend.ts +11 -0
- package/src/omni-named.dto.d.ts +19 -0
- package/src/omni-named.dto.js +94 -0
- package/src/omni-named.dto.js.map +1 -0
- package/src/omni-named.dto.ts +86 -0
- package/src/omni-projection.catalog.d.ts +49 -0
- package/src/omni-projection.catalog.js +177 -0
- package/src/omni-projection.catalog.js.map +1 -0
- package/src/omni-projection.catalog.ts +345 -0
- package/src/omni-projection.lifecycle.d.ts +20 -0
- package/src/omni-projection.lifecycle.js +3 -0
- package/src/omni-projection.lifecycle.js.map +1 -0
- package/src/omni-projection.lifecycle.ts +53 -0
- package/src/omni-record-status.enum.d.ts +5 -0
- package/src/omni-record-status.enum.js +14 -0
- package/src/omni-record-status.enum.js.map +1 -0
- package/src/omni-record-status.enum.ts +11 -0
- package/src/omni-record.backend.d.ts +2 -0
- package/src/omni-record.backend.js +13 -0
- package/src/omni-record.backend.js.map +1 -0
- package/src/omni-record.backend.ts +19 -0
- package/src/omni-record.dto.d.ts +29 -0
- package/src/omni-record.dto.js +169 -0
- package/src/omni-record.dto.js.map +1 -0
- package/src/omni-record.dto.ts +157 -0
- package/src/omni-record.service.d.ts +18 -0
- package/src/omni-record.service.js +45 -0
- package/src/omni-record.service.js.map +1 -0
- package/src/omni-record.service.ts +113 -0
- package/src/omni-relation-kind.contract.d.ts +9 -0
- package/src/omni-relation-kind.contract.js +33 -0
- package/src/omni-relation-kind.contract.js.map +1 -0
- package/src/omni-relation-kind.contract.ts +49 -0
- package/src/omni-relation-kind.enum.d.ts +6 -0
- package/src/omni-relation-kind.enum.js +15 -0
- package/src/omni-relation-kind.enum.js.map +1 -0
- package/src/omni-relation-kind.enum.ts +12 -0
- package/src/omni-relation-projection.definition.d.ts +25 -0
- package/src/omni-relation-projection.definition.js +83 -0
- package/src/omni-relation-projection.definition.js.map +1 -0
- package/src/omni-relation-projection.definition.ts +166 -0
- package/src/omni-relation-projection.resource.d.ts +51 -0
- package/src/omni-relation-projection.resource.js +203 -0
- package/src/omni-relation-projection.resource.js.map +1 -0
- package/src/omni-relation-projection.resource.ts +360 -0
- package/src/omni-relation-projection.service.d.ts +47 -0
- package/src/omni-relation-projection.service.js +385 -0
- package/src/omni-relation-projection.service.js.map +1 -0
- package/src/omni-relation-projection.service.ts +610 -0
- package/src/omni-relation-semantics.d.ts +11 -0
- package/src/omni-relation-semantics.js +34 -0
- package/src/omni-relation-semantics.js.map +1 -0
- package/src/omni-relation-semantics.ts +52 -0
- package/src/omni-relation-status.enum.d.ts +5 -0
- package/src/omni-relation-status.enum.js +14 -0
- package/src/omni-relation-status.enum.js.map +1 -0
- package/src/omni-relation-status.enum.ts +11 -0
- package/src/omni-relation.backend.d.ts +2 -0
- package/src/omni-relation.backend.js +17 -0
- package/src/omni-relation.backend.js.map +1 -0
- package/src/omni-relation.backend.ts +21 -0
- package/src/omni-relation.dto.d.ts +28 -0
- package/src/omni-relation.dto.js +153 -0
- package/src/omni-relation.dto.js.map +1 -0
- package/src/omni-relation.dto.ts +142 -0
- package/src/omni-relation.service.d.ts +19 -0
- package/src/omni-relation.service.js +76 -0
- package/src/omni-relation.service.js.map +1 -0
- package/src/omni-relation.service.ts +159 -0
- package/src/omni-scope.d.ts +33 -0
- package/src/omni-scope.js +91 -0
- package/src/omni-scope.js.map +1 -0
- package/src/omni-scope.ts +161 -0
- package/src/omni-scoped.backend.d.ts +21 -0
- package/src/omni-scoped.backend.js +47 -0
- package/src/omni-scoped.backend.js.map +1 -0
- package/src/omni-scoped.backend.ts +110 -0
- package/src/omni-scoped.repository.d.ts +10 -0
- package/src/omni-scoped.repository.js +26 -0
- package/src/omni-scoped.repository.js.map +1 -0
- package/src/omni-scoped.repository.ts +34 -0
- package/src/omni-scoped.service.d.ts +36 -0
- package/src/omni-scoped.service.js +171 -0
- package/src/omni-scoped.service.js.map +1 -0
- package/src/omni-scoped.service.ts +338 -0
- package/src/omnikernel.diagnostics.d.ts +16 -0
- package/src/omnikernel.diagnostics.js +50 -0
- package/src/omnikernel.diagnostics.js.map +1 -0
- package/src/omnikernel.diagnostics.ts +83 -0
- package/src/omnikernel.module.d.ts +5 -0
- package/src/omnikernel.module.js +87 -0
- package/src/omnikernel.module.js.map +1 -0
- package/src/omnikernel.module.ts +97 -0
- package/src/omnikernel.query.service.d.ts +17 -0
- package/src/omnikernel.query.service.js +85 -0
- package/src/omnikernel.query.service.js.map +1 -0
- package/src/omnikernel.query.service.ts +108 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { ConflictException } from '@nestjs/common';
|
|
2
|
+
import type { CrudGenFindManyOptions } from '@nest-yalc-2/crud-gen/api-graphql/crud-gen-gql.interface.js';
|
|
3
|
+
import type { DeepPartial, FindOptionsWhere } from 'typeorm';
|
|
4
|
+
import { OmniExternalRefEntity } from './base/omni-external-ref.entity.js';
|
|
5
|
+
import { OmniExternalRefBindingValidator } from './omni-external-ref-binding.validator.js';
|
|
6
|
+
import { OmniExternalRefInternalType } from './omni-external-ref-internal-type.enum.js';
|
|
7
|
+
import { OmniScopedService } from './omni-scoped.service.js';
|
|
8
|
+
import type { OmniDeletePolicy, OmniScope } from './omni-scope.js';
|
|
9
|
+
|
|
10
|
+
function hasOwn(input: object, key: string): boolean {
|
|
11
|
+
return Object.prototype.hasOwnProperty.call(input, key);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface OmniExternalRefLookup {
|
|
15
|
+
provider: string;
|
|
16
|
+
externalId: string;
|
|
17
|
+
account?: string | null;
|
|
18
|
+
container?: string | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface OmniExternalRefSyncInput extends OmniExternalRefLookup {
|
|
22
|
+
payload?: Record<string, unknown> | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type OmniExternalRefUpsertInput = Omit<
|
|
26
|
+
DeepPartial<OmniExternalRefEntity>,
|
|
27
|
+
'provider' | 'externalId' | 'internalType' | 'internalId'
|
|
28
|
+
> &
|
|
29
|
+
Pick<
|
|
30
|
+
OmniExternalRefEntity,
|
|
31
|
+
'provider' | 'externalId' | 'internalType' | 'internalId'
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
export class OmniExternalRefService extends OmniScopedService<OmniExternalRefEntity> {
|
|
35
|
+
constructor(
|
|
36
|
+
repository: any,
|
|
37
|
+
scopeOrRepositoryWrite: OmniScope | any | undefined,
|
|
38
|
+
deletion: OmniDeletePolicy,
|
|
39
|
+
private readonly bindingValidator: OmniExternalRefBindingValidator,
|
|
40
|
+
) {
|
|
41
|
+
if (!bindingValidator) {
|
|
42
|
+
throw new TypeError(
|
|
43
|
+
'OmniExternalRefService requires an OmniExternalRefBindingValidator.',
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
super(repository, scopeOrRepositoryWrite, deletion);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async findByExternalIdentity({
|
|
50
|
+
provider,
|
|
51
|
+
externalId,
|
|
52
|
+
account = null,
|
|
53
|
+
container = null,
|
|
54
|
+
}: OmniExternalRefLookup): Promise<OmniExternalRefEntity | null> {
|
|
55
|
+
return this.getRepository().findOne({
|
|
56
|
+
where: {
|
|
57
|
+
scopeId: this.scopeId,
|
|
58
|
+
provider,
|
|
59
|
+
externalId,
|
|
60
|
+
account: account ?? '',
|
|
61
|
+
container: container ?? '',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async findForInternalRecord(
|
|
67
|
+
internalType: OmniExternalRefInternalType,
|
|
68
|
+
internalId: string,
|
|
69
|
+
provider?: string,
|
|
70
|
+
): Promise<OmniExternalRefEntity[]> {
|
|
71
|
+
return this.getRepository().find({
|
|
72
|
+
where: {
|
|
73
|
+
scopeId: this.scopeId,
|
|
74
|
+
internalType,
|
|
75
|
+
internalId,
|
|
76
|
+
...(provider ? { provider } : {}),
|
|
77
|
+
},
|
|
78
|
+
order: {
|
|
79
|
+
createdAt: 'ASC',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async upsertExternalRef(
|
|
85
|
+
input: OmniExternalRefUpsertInput,
|
|
86
|
+
): Promise<OmniExternalRefEntity> {
|
|
87
|
+
if (input.provider.trim().length === 0) {
|
|
88
|
+
throw new Error('OmniExternalRef.provider is required');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (input.externalId.trim().length === 0) {
|
|
92
|
+
throw new Error('OmniExternalRef.externalId is required');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const existing = await this.findByExternalIdentity({
|
|
96
|
+
provider: input.provider,
|
|
97
|
+
externalId: input.externalId,
|
|
98
|
+
account: input.account ?? null,
|
|
99
|
+
container: input.container ?? null,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (existing) {
|
|
103
|
+
if (
|
|
104
|
+
existing.internalType !== input.internalType ||
|
|
105
|
+
existing.internalId !== input.internalId
|
|
106
|
+
) {
|
|
107
|
+
throw new ConflictException(
|
|
108
|
+
'External reference binding is immutable after creation.',
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
const {
|
|
112
|
+
internalType: _internalType,
|
|
113
|
+
internalId: _internalId,
|
|
114
|
+
...update
|
|
115
|
+
} = this.normalizeExternalIdentity(input);
|
|
116
|
+
return this.updateEntity(
|
|
117
|
+
{ guid: existing.guid },
|
|
118
|
+
update,
|
|
119
|
+
) as Promise<OmniExternalRefEntity>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return this.createEntity(
|
|
123
|
+
this.normalizeExternalIdentity(input),
|
|
124
|
+
) as Promise<OmniExternalRefEntity>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async syncDocumentReference(
|
|
128
|
+
internalId: string,
|
|
129
|
+
input: OmniExternalRefSyncInput,
|
|
130
|
+
): Promise<OmniExternalRefEntity> {
|
|
131
|
+
return this.upsertExternalRef({
|
|
132
|
+
...input,
|
|
133
|
+
internalType: OmniExternalRefInternalType.Document,
|
|
134
|
+
internalId,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async syncCollectionReference(
|
|
139
|
+
internalId: string,
|
|
140
|
+
input: OmniExternalRefSyncInput,
|
|
141
|
+
): Promise<OmniExternalRefEntity> {
|
|
142
|
+
return this.upsertExternalRef({
|
|
143
|
+
...input,
|
|
144
|
+
internalType: OmniExternalRefInternalType.Collection,
|
|
145
|
+
internalId,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
override async createEntity(
|
|
150
|
+
input: DeepPartial<OmniExternalRefEntity>,
|
|
151
|
+
findOptions?: CrudGenFindManyOptions<OmniExternalRefEntity>,
|
|
152
|
+
returnEntity?: true,
|
|
153
|
+
): Promise<OmniExternalRefEntity>;
|
|
154
|
+
override async createEntity(
|
|
155
|
+
input: DeepPartial<OmniExternalRefEntity>,
|
|
156
|
+
findOptions?: CrudGenFindManyOptions<OmniExternalRefEntity>,
|
|
157
|
+
returnEntity?: boolean,
|
|
158
|
+
): Promise<OmniExternalRefEntity | boolean>;
|
|
159
|
+
override async createEntity(
|
|
160
|
+
input: DeepPartial<OmniExternalRefEntity>,
|
|
161
|
+
findOptions?: CrudGenFindManyOptions<OmniExternalRefEntity>,
|
|
162
|
+
returnEntity = true,
|
|
163
|
+
): Promise<OmniExternalRefEntity | boolean> {
|
|
164
|
+
const normalized = this.normalizeExternalIdentity(input);
|
|
165
|
+
this.rejectServerFields(normalized as object);
|
|
166
|
+
await this.assertBinding(normalized);
|
|
167
|
+
if (
|
|
168
|
+
typeof normalized.provider === 'string' &&
|
|
169
|
+
typeof normalized.externalId === 'string'
|
|
170
|
+
) {
|
|
171
|
+
const existing = await this.findByExternalIdentity({
|
|
172
|
+
provider: normalized.provider,
|
|
173
|
+
externalId: normalized.externalId,
|
|
174
|
+
account: normalized.account ?? null,
|
|
175
|
+
container: normalized.container ?? null,
|
|
176
|
+
});
|
|
177
|
+
if (existing) {
|
|
178
|
+
throw new ConflictException(
|
|
179
|
+
'External reference identity already exists in this scope.',
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return super.createEntity(normalized, findOptions, returnEntity);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
override async updateEntity(
|
|
187
|
+
conditions: FindOptionsWhere<OmniExternalRefEntity>,
|
|
188
|
+
input: DeepPartial<OmniExternalRefEntity>,
|
|
189
|
+
findOptions?: CrudGenFindManyOptions<OmniExternalRefEntity>,
|
|
190
|
+
returnEntity?: true,
|
|
191
|
+
): Promise<OmniExternalRefEntity>;
|
|
192
|
+
override async updateEntity(
|
|
193
|
+
conditions: FindOptionsWhere<OmniExternalRefEntity>,
|
|
194
|
+
input: DeepPartial<OmniExternalRefEntity>,
|
|
195
|
+
findOptions?: CrudGenFindManyOptions<OmniExternalRefEntity>,
|
|
196
|
+
returnEntity?: boolean,
|
|
197
|
+
): Promise<OmniExternalRefEntity | boolean>;
|
|
198
|
+
override async updateEntity(
|
|
199
|
+
conditions: FindOptionsWhere<OmniExternalRefEntity>,
|
|
200
|
+
input: DeepPartial<OmniExternalRefEntity>,
|
|
201
|
+
findOptions?: CrudGenFindManyOptions<OmniExternalRefEntity>,
|
|
202
|
+
returnEntity = true,
|
|
203
|
+
): Promise<OmniExternalRefEntity | boolean> {
|
|
204
|
+
const normalized = this.normalizeExternalIdentity(input);
|
|
205
|
+
this.rejectBindingMutation(normalized as object);
|
|
206
|
+
return super.updateEntity(
|
|
207
|
+
conditions,
|
|
208
|
+
normalized,
|
|
209
|
+
findOptions,
|
|
210
|
+
returnEntity,
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private async assertBinding(
|
|
215
|
+
input: DeepPartial<OmniExternalRefEntity>,
|
|
216
|
+
): Promise<void> {
|
|
217
|
+
if (
|
|
218
|
+
typeof input.internalId !== 'string' ||
|
|
219
|
+
input.internalType === undefined
|
|
220
|
+
) {
|
|
221
|
+
throw new ConflictException(
|
|
222
|
+
'External reference binding requires internalType and internalId.',
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
if (input.internalType !== OmniExternalRefInternalType.Record) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
await this.bindingValidator.assertTarget({
|
|
229
|
+
internalId: input.internalId,
|
|
230
|
+
internalType: input.internalType,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private rejectBindingMutation(input: object): void {
|
|
235
|
+
if (hasOwn(input, 'internalType') || hasOwn(input, 'internalId')) {
|
|
236
|
+
throw new ConflictException(
|
|
237
|
+
'External reference binding is immutable after creation.',
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
private normalizeExternalIdentity<
|
|
243
|
+
T extends DeepPartial<OmniExternalRefEntity>,
|
|
244
|
+
>(input: T): T {
|
|
245
|
+
return {
|
|
246
|
+
...input,
|
|
247
|
+
...(Object.prototype.hasOwnProperty.call(input, 'account')
|
|
248
|
+
? { account: input.account ?? '' }
|
|
249
|
+
: {}),
|
|
250
|
+
...(Object.prototype.hasOwnProperty.call(input, 'container')
|
|
251
|
+
? { container: input.container ?? '' }
|
|
252
|
+
: {}),
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DataSource, EntityTarget } from 'typeorm';
|
|
2
|
+
import { Table, type TableOptions } from 'typeorm';
|
|
3
|
+
import { type ProjectionResourceDefinition } from '@nest-yalc-2/crud-gen';
|
|
4
|
+
export interface OmniMigrationSnapshot {
|
|
5
|
+
readonly version: string;
|
|
6
|
+
readonly dialect: 'sqlite' | 'postgres';
|
|
7
|
+
readonly tables: readonly TableOptions[];
|
|
8
|
+
readonly indexStatements: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
export interface OmniMigrationRunner {
|
|
11
|
+
createTable(table: unknown, ifNotExist?: boolean, createForeignKeys?: boolean, createIndices?: boolean): Promise<void>;
|
|
12
|
+
query(statement: string): Promise<unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface OmniMigrationPlan {
|
|
15
|
+
readonly version: string;
|
|
16
|
+
readonly tableNames: readonly string[];
|
|
17
|
+
readonly indexStatements: readonly string[];
|
|
18
|
+
createTables(): Table[];
|
|
19
|
+
create(queryRunner: OmniMigrationRunner): Promise<void>;
|
|
20
|
+
drop(queryRunner: OmniMigrationRunner): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export interface OmniMigrationExtensionRegistration {
|
|
23
|
+
readonly entities: readonly EntityTarget<any>[];
|
|
24
|
+
readonly definition: ProjectionResourceDefinition;
|
|
25
|
+
}
|
|
26
|
+
export declare function captureOmniMigrationSnapshot(version: string, dataSource: DataSource, extensions?: readonly OmniMigrationExtensionRegistration[]): OmniMigrationSnapshot;
|
|
27
|
+
export declare function defineOmniMigrationSnapshot(snapshot: OmniMigrationSnapshot): OmniMigrationSnapshot;
|
|
28
|
+
export declare function createOmniMigrationPlan(snapshot: OmniMigrationSnapshot): OmniMigrationPlan;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.captureOmniMigrationSnapshot = captureOmniMigrationSnapshot;
|
|
4
|
+
exports.defineOmniMigrationSnapshot = defineOmniMigrationSnapshot;
|
|
5
|
+
exports.createOmniMigrationPlan = createOmniMigrationPlan;
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const crud_gen_1 = require("@nest-yalc-2/crud-gen");
|
|
8
|
+
const omni_external_ref_entity_js_1 = require("./base/omni-external-ref.entity.js");
|
|
9
|
+
const omni_named_entity_js_1 = require("./base/omni-named.entity.js");
|
|
10
|
+
const omni_record_entity_js_1 = require("./base/omni-record.entity.js");
|
|
11
|
+
const omni_relation_entity_js_1 = require("./base/omni-relation.entity.js");
|
|
12
|
+
const omni_collection_entity_js_1 = require("./omni-collection.entity.js");
|
|
13
|
+
const omni_document_entity_js_1 = require("./omni-document.entity.js");
|
|
14
|
+
const omniBaseEntities = [
|
|
15
|
+
omni_named_entity_js_1.OmniNamedEntity,
|
|
16
|
+
omni_record_entity_js_1.OmniRecordEntity,
|
|
17
|
+
omni_document_entity_js_1.OmniDocumentEntity,
|
|
18
|
+
omni_collection_entity_js_1.OmniCollectionEntity,
|
|
19
|
+
omni_relation_entity_js_1.OmniRelationEntity,
|
|
20
|
+
omni_external_ref_entity_js_1.OmniExternalRefEntity,
|
|
21
|
+
];
|
|
22
|
+
function freezeDeep(value) {
|
|
23
|
+
if (value && typeof value === 'object' && !Object.isFrozen(value)) {
|
|
24
|
+
for (const child of Object.values(value)) {
|
|
25
|
+
freezeDeep(child);
|
|
26
|
+
}
|
|
27
|
+
Object.freeze(value);
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
function dialectFor(dataSource) {
|
|
32
|
+
if (dataSource.options.type === 'sqlite')
|
|
33
|
+
return 'sqlite';
|
|
34
|
+
if (dataSource.options.type === 'postgres')
|
|
35
|
+
return 'postgres';
|
|
36
|
+
throw new TypeError('Omni migration snapshots support SQLite or PostgreSQL.');
|
|
37
|
+
}
|
|
38
|
+
function tableOptions(table) {
|
|
39
|
+
return {
|
|
40
|
+
database: table.database,
|
|
41
|
+
schema: table.schema,
|
|
42
|
+
name: table.name,
|
|
43
|
+
withoutRowid: table.withoutRowid,
|
|
44
|
+
engine: table.engine,
|
|
45
|
+
comment: table.comment,
|
|
46
|
+
columns: table.columns.map((column) => ({
|
|
47
|
+
name: column.name,
|
|
48
|
+
type: column.type,
|
|
49
|
+
default: column.default,
|
|
50
|
+
onUpdate: column.onUpdate,
|
|
51
|
+
isNullable: column.isNullable,
|
|
52
|
+
isGenerated: column.isGenerated,
|
|
53
|
+
generationStrategy: column.generationStrategy,
|
|
54
|
+
isPrimary: column.isPrimary,
|
|
55
|
+
isUnique: column.isUnique,
|
|
56
|
+
isArray: column.isArray,
|
|
57
|
+
comment: column.comment,
|
|
58
|
+
length: column.length,
|
|
59
|
+
width: column.width,
|
|
60
|
+
charset: column.charset,
|
|
61
|
+
collation: column.collation,
|
|
62
|
+
precision: column.precision,
|
|
63
|
+
scale: column.scale,
|
|
64
|
+
zerofill: column.zerofill,
|
|
65
|
+
unsigned: column.unsigned,
|
|
66
|
+
enum: column.enum ? [...column.enum] : undefined,
|
|
67
|
+
enumName: column.enumName,
|
|
68
|
+
primaryKeyConstraintName: column.primaryKeyConstraintName,
|
|
69
|
+
asExpression: column.asExpression,
|
|
70
|
+
generatedType: column.generatedType,
|
|
71
|
+
generatedIdentity: column.generatedIdentity,
|
|
72
|
+
spatialFeatureType: column.spatialFeatureType,
|
|
73
|
+
srid: column.srid,
|
|
74
|
+
})),
|
|
75
|
+
indices: table.indices.map((index) => ({
|
|
76
|
+
name: index.name,
|
|
77
|
+
columnNames: [...index.columnNames],
|
|
78
|
+
isUnique: index.isUnique,
|
|
79
|
+
isSpatial: index.isSpatial,
|
|
80
|
+
isConcurrent: index.isConcurrent,
|
|
81
|
+
isFulltext: index.isFulltext,
|
|
82
|
+
isNullFiltered: index.isNullFiltered,
|
|
83
|
+
parser: index.parser,
|
|
84
|
+
where: index.where,
|
|
85
|
+
})),
|
|
86
|
+
foreignKeys: table.foreignKeys.map((foreignKey) => ({
|
|
87
|
+
name: foreignKey.name,
|
|
88
|
+
columnNames: [...foreignKey.columnNames],
|
|
89
|
+
referencedDatabase: foreignKey.referencedDatabase,
|
|
90
|
+
referencedSchema: foreignKey.referencedSchema,
|
|
91
|
+
referencedTableName: foreignKey.referencedTableName,
|
|
92
|
+
referencedColumnNames: [...foreignKey.referencedColumnNames],
|
|
93
|
+
onDelete: foreignKey.onDelete,
|
|
94
|
+
onUpdate: foreignKey.onUpdate,
|
|
95
|
+
deferrable: foreignKey.deferrable,
|
|
96
|
+
})),
|
|
97
|
+
uniques: table.uniques.map((unique) => ({
|
|
98
|
+
name: unique.name,
|
|
99
|
+
columnNames: [...unique.columnNames],
|
|
100
|
+
deferrable: unique.deferrable,
|
|
101
|
+
})),
|
|
102
|
+
checks: table.checks.map((check) => ({
|
|
103
|
+
name: check.name,
|
|
104
|
+
columnNames: check.columnNames ? [...check.columnNames] : undefined,
|
|
105
|
+
expression: check.expression,
|
|
106
|
+
})),
|
|
107
|
+
exclusions: table.exclusions.map((exclusion) => ({
|
|
108
|
+
name: exclusion.name,
|
|
109
|
+
expression: exclusion.expression,
|
|
110
|
+
})),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function tableSnapshots(dataSource, entities) {
|
|
114
|
+
const byTableName = new Map();
|
|
115
|
+
for (const entity of entities) {
|
|
116
|
+
const metadata = dataSource.getMetadata(entity);
|
|
117
|
+
const table = typeorm_1.Table.create(metadata, dataSource.driver);
|
|
118
|
+
table.foreignKeys = metadata.foreignKeys.map((foreignKey) => typeorm_1.TableForeignKey.create(foreignKey, dataSource.driver));
|
|
119
|
+
const current = byTableName.get(table.name);
|
|
120
|
+
if (!current || current.columns.length < table.columns.length) {
|
|
121
|
+
byTableName.set(table.name, table);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return orderTablesTopologically([...byTableName.values()].map(tableOptions));
|
|
125
|
+
}
|
|
126
|
+
function orderTablesTopologically(tables) {
|
|
127
|
+
const byName = new Map();
|
|
128
|
+
for (const table of tables) {
|
|
129
|
+
if (!table.name)
|
|
130
|
+
throw new TypeError('Omni migration table name is required.');
|
|
131
|
+
byName.set(table.name, table);
|
|
132
|
+
}
|
|
133
|
+
const dependencies = new Map();
|
|
134
|
+
for (const table of tables) {
|
|
135
|
+
const tableName = table.name;
|
|
136
|
+
const parents = new Set();
|
|
137
|
+
for (const foreignKey of table.foreignKeys ?? []) {
|
|
138
|
+
const parent = foreignKey.referencedTableName;
|
|
139
|
+
if (!parent || parent === tableName)
|
|
140
|
+
continue;
|
|
141
|
+
if (!byName.has(parent)) {
|
|
142
|
+
throw new TypeError(`Omni migration table ${tableName} references ${parent}, which is absent from this snapshot.`);
|
|
143
|
+
}
|
|
144
|
+
parents.add(parent);
|
|
145
|
+
}
|
|
146
|
+
dependencies.set(tableName, parents);
|
|
147
|
+
}
|
|
148
|
+
const remaining = new Map([...dependencies.entries()].map(([name, parents]) => [
|
|
149
|
+
name,
|
|
150
|
+
new Set(parents),
|
|
151
|
+
]));
|
|
152
|
+
const ordered = [];
|
|
153
|
+
while (remaining.size > 0) {
|
|
154
|
+
const ready = tables.filter((table) => table.name !== undefined && remaining.get(table.name)?.size === 0);
|
|
155
|
+
if (ready.length === 0) {
|
|
156
|
+
throw new TypeError(`Omni migration snapshot has a cross-table foreign-key cycle: ${[
|
|
157
|
+
...remaining.keys(),
|
|
158
|
+
].join(', ')}.`);
|
|
159
|
+
}
|
|
160
|
+
for (const table of ready) {
|
|
161
|
+
const name = table.name;
|
|
162
|
+
remaining.delete(name);
|
|
163
|
+
ordered.push(table);
|
|
164
|
+
for (const parents of remaining.values())
|
|
165
|
+
parents.delete(name);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return ordered;
|
|
169
|
+
}
|
|
170
|
+
function quotedIdentifier(identifier) {
|
|
171
|
+
return `"${identifier.replaceAll('"', '""')}"`;
|
|
172
|
+
}
|
|
173
|
+
function quotedTableName(table) {
|
|
174
|
+
if (!table.name)
|
|
175
|
+
throw new TypeError('Omni migration table name is required.');
|
|
176
|
+
return [table.schema, table.name]
|
|
177
|
+
.filter((part) => typeof part === 'string' && part.length > 0)
|
|
178
|
+
.map(quotedIdentifier)
|
|
179
|
+
.join('.');
|
|
180
|
+
}
|
|
181
|
+
function captureOmniMigrationSnapshot(version, dataSource, extensions = []) {
|
|
182
|
+
const dialect = dialectFor(dataSource);
|
|
183
|
+
return defineOmniMigrationSnapshot({
|
|
184
|
+
version,
|
|
185
|
+
dialect,
|
|
186
|
+
tables: tableSnapshots(dataSource, [
|
|
187
|
+
...omniBaseEntities,
|
|
188
|
+
...extensions.flatMap((extension) => extension.entities),
|
|
189
|
+
]),
|
|
190
|
+
indexStatements: extensions.flatMap((extension) => (0, crud_gen_1.createProjectionDialect)(dialect).compileIndexStatements(extension.definition)),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function defineOmniMigrationSnapshot(snapshot) {
|
|
194
|
+
if (typeof snapshot.version !== 'string' ||
|
|
195
|
+
snapshot.version.trim().length === 0) {
|
|
196
|
+
throw new TypeError('Omni migration snapshot version is required.');
|
|
197
|
+
}
|
|
198
|
+
if (snapshot.dialect !== 'sqlite' && snapshot.dialect !== 'postgres') {
|
|
199
|
+
throw new TypeError('Omni migration snapshot dialect is unsupported.');
|
|
200
|
+
}
|
|
201
|
+
if (!Array.isArray(snapshot.tables) || snapshot.tables.length === 0) {
|
|
202
|
+
throw new TypeError('Omni migration snapshot requires at least one table.');
|
|
203
|
+
}
|
|
204
|
+
const names = snapshot.tables.map((table) => table.name);
|
|
205
|
+
if (names.some((name) => typeof name !== 'string' || name.length === 0) ||
|
|
206
|
+
new Set(names).size !== names.length) {
|
|
207
|
+
throw new TypeError('Omni migration snapshot table names must be unique.');
|
|
208
|
+
}
|
|
209
|
+
if (!Array.isArray(snapshot.indexStatements) ||
|
|
210
|
+
snapshot.indexStatements.some((statement) => typeof statement !== 'string' || statement.trim().length === 0) ||
|
|
211
|
+
new Set(snapshot.indexStatements).size !== snapshot.indexStatements.length) {
|
|
212
|
+
throw new TypeError('Omni migration snapshot index statements must be unique non-empty strings.');
|
|
213
|
+
}
|
|
214
|
+
return freezeDeep(structuredClone(snapshot));
|
|
215
|
+
}
|
|
216
|
+
function createOmniMigrationPlan(snapshot) {
|
|
217
|
+
const source = defineOmniMigrationSnapshot(snapshot);
|
|
218
|
+
const tables = orderTablesTopologically(source.tables);
|
|
219
|
+
return Object.freeze({
|
|
220
|
+
version: source.version,
|
|
221
|
+
tableNames: Object.freeze(tables.map((table) => table.name)),
|
|
222
|
+
indexStatements: Object.freeze([...source.indexStatements]),
|
|
223
|
+
createTables: () => tables.map((table) => new typeorm_1.Table(structuredClone(table))),
|
|
224
|
+
create: async (queryRunner) => {
|
|
225
|
+
for (const table of tables) {
|
|
226
|
+
await queryRunner.createTable(new typeorm_1.Table(structuredClone(table)));
|
|
227
|
+
}
|
|
228
|
+
for (const statement of source.indexStatements) {
|
|
229
|
+
await queryRunner.query(statement);
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
drop: async (queryRunner) => {
|
|
233
|
+
for (const table of [...tables].reverse()) {
|
|
234
|
+
await queryRunner.query(`DROP TABLE IF EXISTS ${quotedTableName(table)}`);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=omni-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omni-migration.js","sourceRoot":"","sources":["omni-migration.ts"],"names":[],"mappings":";;AA4QA,oEAmBC;AAOD,kEAmCC;AAOD,0DA4BC;AA3WD,qCAAoE;AACpE,oDAG+B;AAC/B,oFAA2E;AAC3E,sEAA8D;AAC9D,wEAAgE;AAChE,4EAAoE;AACpE,2EAAmE;AACnE,uEAA+D;AAwD/D,MAAM,gBAAgB,GAAG;IACvB,sCAAe;IACf,wCAAgB;IAChB,4CAAkB;IAClB,gDAAoB;IACpB,4CAAkB;IAClB,mDAAqB;CACb,CAAC;AAEX,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAA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