Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sa committed Dec 8, 2023
1 parent f16b6e4 commit b980dcb
Show file tree
Hide file tree
Showing 23 changed files with 101 additions and 144 deletions.
18 changes: 5 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
getClassType,
isMapType,
isMongoIdType,
isSetType,
Expand Down Expand Up @@ -46,5 +45,5 @@ inputRegistry.set(type => {
return isMapType(type);
}, MapInputComponent);
inputRegistry.set(type => {
return type.kind === ReflectionKind.class && getClassName(getClassType(type)) === 'UploadedFile';
return type.kind === ReflectionKind.class && getClassName(type.classType) === 'UploadedFile';
}, BinaryInputComponent);
3 changes: 1 addition & 2 deletions packages/api-console-gui/src/app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import objectInspect from 'object-inspect';
import { getClassName } from '@deepkit/core';
import {
getClassType,
getTypeJitContainer,
isBackReferenceType,
isReferenceType,
Expand All @@ -20,7 +19,7 @@ export function isReferenceLike(type: Type): boolean {
}

function manualTypeStringify(type: Type): string | undefined {
if (type.kind === ReflectionKind.class && getClassName(getClassType(type)) === 'UploadedFile') return 'UploadedFile';
if (type.kind === ReflectionKind.class && getClassName(type.classType) === 'UploadedFile') return 'UploadedFile';
//we are not interested in the methods
if (type.kind === ReflectionKind.method || type.kind === ReflectionKind.methodSignature) return '';
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/bson/src/bson-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class BaseParser {
return nodeBufferToArrayBuffer(b);
}
if (type && type.kind === ReflectionKind.class) {
const typedArrayConstructor = getClassType(type);
const typedArrayConstructor = type.classType;
return new typedArrayConstructor(nodeBufferToArrayBuffer(b));
}

Expand Down
20 changes: 10 additions & 10 deletions packages/injector/src/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ export class Injector implements InjectorInterface {
const destinationVar = compiler.reserveConst({ token: fromProvider.provide });

if (options.type.kind === ReflectionKind.class) {
const found = findModuleForConfig(getClassType(options.type), resolveDependenciesFrom);
const found = findModuleForConfig(options.type.classType, resolveDependenciesFrom);
if (found) {
return compiler.reserveVariable('fullConfig', getPathValue(found.module.getConfig(), found.path));
}
Expand All @@ -629,14 +629,14 @@ export class Injector implements InjectorInterface {
return compiler.reserveVariable('tagRegistry', this.buildContext.tagRegistry);
}

if (options.type.kind === ReflectionKind.class && resolveDependenciesFrom[0] instanceof getClassType(options.type)) {
if (options.type.kind === ReflectionKind.class && resolveDependenciesFrom[0] instanceof options.type.classType) {
return compiler.reserveConst(resolveDependenciesFrom[0], 'module');
}

if (options.type.kind === ReflectionKind.class && isPrototypeOfBase(options.type.classType, Tag)) {
const tokenVar = compiler.reserveVariable('token', options.type.classType);
const resolvedVar = compiler.reserveVariable('tagResolved');
const entries = this.buildContext.tagRegistry.resolve(getClassType(options.type));
const entries = this.buildContext.tagRegistry.resolve(options.type.classType);
const args: string[] = [];
for (const entry of entries) {
args.push(`${compiler.reserveConst(entry.module)}.injector.resolver(${compiler.reserveConst(getContainerToken(entry.tagProvider.provider.provide))}, scope, ${destinationVar})`);
Expand All @@ -655,7 +655,7 @@ export class Injector implements InjectorInterface {
const pickArguments = getPickArguments(options.type);
if (pickArguments) {
if (pickArguments[0].kind === ReflectionKind.class) {
const found = findModuleForConfig(getClassType(pickArguments[0]), resolveDependenciesFrom);
const found = findModuleForConfig(pickArguments[0].classType, resolveDependenciesFrom);
if (found) {
const fullConfig = compiler.reserveVariable('fullConfig', getPathValue(found.module.getConfig(), found.path));
let index = pickArguments[1];
Expand Down Expand Up @@ -778,24 +778,24 @@ export class Injector implements InjectorInterface {
// }

if (type.kind === ReflectionKind.class) {
const found = findModuleForConfig(getClassType(type), resolveDependenciesFrom);
const found = findModuleForConfig(type.l, resolveDependenciesFrom);
if (found) return () => getPathValue(found.module.getConfig(), found.path);
}

if (type.kind === ReflectionKind.class && type.classType === TagRegistry) return () => this.buildContext.tagRegistry;

if (type.kind === ReflectionKind.class && resolveDependenciesFrom[0] instanceof getClassType(type)) {
if (type.kind === ReflectionKind.class && resolveDependenciesFrom[0] instanceof type.classType) {
return () => resolveDependenciesFrom[0];
}

if (type.kind === ReflectionKind.class && isPrototypeOfBase(type.classType, Tag)) {
const entries = this.buildContext.tagRegistry.resolve(getClassType(type));
const entries = this.buildContext.tagRegistry.resolve(type.classType);
const args: any[] = [];
for (const entry of entries) {
args.push(entry.module.injector!.resolver!(entry.tagProvider.provider.provide, scope));
}

return new (getClassType(type))(args);
return new (type.classType)(args);
}

if (type.kind === ReflectionKind.function && type.typeName === 'PartialFactory') {
Expand All @@ -809,7 +809,7 @@ export class Injector implements InjectorInterface {
const pickArguments = getPickArguments(type);
if (pickArguments) {
if (pickArguments[0].kind === ReflectionKind.class) {
const found = findModuleForConfig(getClassType(pickArguments[0]), resolveDependenciesFrom);
const found = findModuleForConfig(pickArguments[0].classType, resolveDependenciesFrom);
if (found) {
const fullConfig = getPathValue(found.module.getConfig(), found.path);
let index = pickArguments[1];
Expand Down Expand Up @@ -1027,7 +1027,7 @@ export function partialFactory(
}

if (type.kind === ReflectionKind.class) {
const classType = getClassType(type);
const classType = type.classType;
const reflectionClass = ReflectionClass.from(classType);

const args: { name: string; resolve: (scope?: Scope) => ReturnType<Resolver<any>> }[] = [];
Expand Down
4 changes: 2 additions & 2 deletions packages/orm-browser-gui/src/app/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ inputRegistry.set(isMongoIdType, StringInputComponent);
// return isMapType(type);
// }, MapInputComponent);
inputRegistry.set(type => {
return type.kind === ReflectionKind.class && getClassName(getClassType(type)) === 'UploadedFile';
return type.kind === ReflectionKind.class && getClassName(type.classType) === 'UploadedFile';
}, BinaryInputComponent);


Expand Down Expand Up @@ -81,5 +81,5 @@ cellRegistry.set(isMongoIdType, StringCellComponent);
// return isMapType(type);
// }, MapCellComponent);
cellRegistry.set(type => {
return type.kind === ReflectionKind.class && getClassName(getClassType(type)) === 'UploadedFile';
return type.kind === ReflectionKind.class && getClassName(type.classType) === 'UploadedFile';
}, BinaryCellComponent);
2 changes: 1 addition & 1 deletion packages/sql/src/platform/default-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export abstract class DefaultPlatform {

addBinaryType(sqlType: string, size?: number, scale?: number) {
this.addType((type: Type) => {
return type.kind === ReflectionKind.class && binaryTypes.includes(getClassType(type));
return type.kind === ReflectionKind.class && binaryTypes.includes(type.classType);
}, sqlType, size, scale);
}

Expand Down
Loading

0 comments on commit b980dcb

Please sign in to comment.