@cheetah.js/orm 0.1.0 → 0.1.1
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/dist/bun/index.d.ts +1 -2
- package/dist/bun/index.js +1295 -500
- package/dist/bun/index.js.map +24 -14
- package/dist/entry.d.ts +2 -0
- package/dist/entry.js +6 -0
- package/dist/entry.js.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/migration/migrator.js +4 -5
- package/dist/migration/migrator.js.map +1 -1
- package/dist/orm.d.ts +3 -2
- package/dist/orm.js +24 -6
- package/dist/orm.js.map +1 -1
- package/dist/orm.service.d.ts +4 -2
- package/dist/orm.service.js +8 -4
- package/dist/orm.service.js.map +1 -1
- package/package.json +1 -1
- package/src/entry.ts +6 -0
- package/src/index.ts +1 -6
- package/src/migration/migrator.ts +4 -5
- package/src/orm.service.ts +11 -9
- package/src/orm.ts +10 -4
- package/test/node-database.ts +4 -6
- package/test/migration/.sql +0 -5
package/dist/bun/index.js
CHANGED
|
@@ -23556,15 +23556,15 @@ ${lanes.join("\n")}
|
|
|
23556
23556
|
return predicate && predicate.kind === 0;
|
|
23557
23557
|
}
|
|
23558
23558
|
function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
23559
|
-
return forEach(objectLiteral == null ? undefined : objectLiteral.properties, (
|
|
23560
|
-
if (!isPropertyAssignment(
|
|
23559
|
+
return forEach(objectLiteral == null ? undefined : objectLiteral.properties, (property2) => {
|
|
23560
|
+
if (!isPropertyAssignment(property2))
|
|
23561
23561
|
return;
|
|
23562
|
-
const propName = tryGetTextOfPropertyName(
|
|
23563
|
-
return key === propName || key2 && key2 === propName ? callback(
|
|
23562
|
+
const propName = tryGetTextOfPropertyName(property2.name);
|
|
23563
|
+
return key === propName || key2 && key2 === propName ? callback(property2) : undefined;
|
|
23564
23564
|
});
|
|
23565
23565
|
}
|
|
23566
23566
|
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
|
23567
|
-
return forEachPropertyAssignment(objectLiteral, propKey, (
|
|
23567
|
+
return forEachPropertyAssignment(objectLiteral, propKey, (property2) => isArrayLiteralExpression(property2.initializer) ? find(property2.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : undefined);
|
|
23568
23568
|
}
|
|
23569
23569
|
function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
|
23570
23570
|
if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
|
|
@@ -23573,7 +23573,7 @@ ${lanes.join("\n")}
|
|
|
23573
23573
|
}
|
|
23574
23574
|
}
|
|
23575
23575
|
function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
|
|
23576
|
-
return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (
|
|
23576
|
+
return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property2) => isArrayLiteralExpression(property2.initializer) ? find(property2.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : undefined);
|
|
23577
23577
|
}
|
|
23578
23578
|
function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
|
|
23579
23579
|
return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
|
|
@@ -26506,17 +26506,17 @@ ${lanes.join("\n")}
|
|
|
26506
26506
|
return Debug.assertNever(a);
|
|
26507
26507
|
}
|
|
26508
26508
|
}
|
|
26509
|
-
function compareDataObjects(dst,
|
|
26510
|
-
if (!dst || !
|
|
26509
|
+
function compareDataObjects(dst, src2) {
|
|
26510
|
+
if (!dst || !src2 || Object.keys(dst).length !== Object.keys(src2).length) {
|
|
26511
26511
|
return false;
|
|
26512
26512
|
}
|
|
26513
26513
|
for (const e in dst) {
|
|
26514
26514
|
if (typeof dst[e] === "object") {
|
|
26515
|
-
if (!compareDataObjects(dst[e],
|
|
26515
|
+
if (!compareDataObjects(dst[e], src2[e])) {
|
|
26516
26516
|
return false;
|
|
26517
26517
|
}
|
|
26518
26518
|
} else if (typeof dst[e] !== "function") {
|
|
26519
|
-
if (dst[e] !==
|
|
26519
|
+
if (dst[e] !== src2[e]) {
|
|
26520
26520
|
return false;
|
|
26521
26521
|
}
|
|
26522
26522
|
}
|
|
@@ -35048,10 +35048,10 @@ ${lanes.join("\n")}
|
|
|
35048
35048
|
return setParent(setTextRange(factory2.cloneNode(memberName), memberName), memberName.parent);
|
|
35049
35049
|
}
|
|
35050
35050
|
}
|
|
35051
|
-
function createExpressionForAccessorDeclaration(factory2, properties,
|
|
35052
|
-
const { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(properties,
|
|
35053
|
-
if (
|
|
35054
|
-
return setTextRange(factory2.createObjectDefinePropertyCall(receiver, createExpressionForPropertyName(factory2,
|
|
35051
|
+
function createExpressionForAccessorDeclaration(factory2, properties, property2, receiver, multiLine) {
|
|
35052
|
+
const { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(properties, property2);
|
|
35053
|
+
if (property2 === firstAccessor) {
|
|
35054
|
+
return setTextRange(factory2.createObjectDefinePropertyCall(receiver, createExpressionForPropertyName(factory2, property2.name), factory2.createPropertyDescriptor({
|
|
35055
35055
|
enumerable: factory2.createFalse(),
|
|
35056
35056
|
configurable: true,
|
|
35057
35057
|
get: getAccessor && setTextRange(setOriginalNode(factory2.createFunctionExpression(getModifiers(getAccessor), undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body), getAccessor), getAccessor),
|
|
@@ -35060,29 +35060,29 @@ ${lanes.join("\n")}
|
|
|
35060
35060
|
}
|
|
35061
35061
|
return;
|
|
35062
35062
|
}
|
|
35063
|
-
function createExpressionForPropertyAssignment(factory2,
|
|
35064
|
-
return setOriginalNode(setTextRange(factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver,
|
|
35063
|
+
function createExpressionForPropertyAssignment(factory2, property2, receiver) {
|
|
35064
|
+
return setOriginalNode(setTextRange(factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver, property2.name, property2.name), property2.initializer), property2), property2);
|
|
35065
35065
|
}
|
|
35066
|
-
function createExpressionForShorthandPropertyAssignment(factory2,
|
|
35067
|
-
return setOriginalNode(setTextRange(factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver,
|
|
35066
|
+
function createExpressionForShorthandPropertyAssignment(factory2, property2, receiver) {
|
|
35067
|
+
return setOriginalNode(setTextRange(factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver, property2.name, property2.name), factory2.cloneNode(property2.name)), property2), property2);
|
|
35068
35068
|
}
|
|
35069
35069
|
function createExpressionForMethodDeclaration(factory2, method, receiver) {
|
|
35070
35070
|
return setOriginalNode(setTextRange(factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver, method.name, method.name), setOriginalNode(setTextRange(factory2.createFunctionExpression(getModifiers(method), method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body), method), method)), method), method);
|
|
35071
35071
|
}
|
|
35072
|
-
function createExpressionForObjectLiteralElementLike(factory2, node,
|
|
35073
|
-
if (
|
|
35074
|
-
Debug.failBadSyntaxKind(
|
|
35072
|
+
function createExpressionForObjectLiteralElementLike(factory2, node, property2, receiver) {
|
|
35073
|
+
if (property2.name && isPrivateIdentifier(property2.name)) {
|
|
35074
|
+
Debug.failBadSyntaxKind(property2.name, "Private identifiers are not allowed in object literals.");
|
|
35075
35075
|
}
|
|
35076
|
-
switch (
|
|
35076
|
+
switch (property2.kind) {
|
|
35077
35077
|
case 177:
|
|
35078
35078
|
case 178:
|
|
35079
|
-
return createExpressionForAccessorDeclaration(factory2, node.properties,
|
|
35079
|
+
return createExpressionForAccessorDeclaration(factory2, node.properties, property2, receiver, !!node.multiLine);
|
|
35080
35080
|
case 303:
|
|
35081
|
-
return createExpressionForPropertyAssignment(factory2,
|
|
35081
|
+
return createExpressionForPropertyAssignment(factory2, property2, receiver);
|
|
35082
35082
|
case 304:
|
|
35083
|
-
return createExpressionForShorthandPropertyAssignment(factory2,
|
|
35083
|
+
return createExpressionForShorthandPropertyAssignment(factory2, property2, receiver);
|
|
35084
35084
|
case 174:
|
|
35085
|
-
return createExpressionForMethodDeclaration(factory2,
|
|
35085
|
+
return createExpressionForMethodDeclaration(factory2, property2, receiver);
|
|
35086
35086
|
}
|
|
35087
35087
|
}
|
|
35088
35088
|
function expandPreOrPostfixIncrementOrDecrementExpression(factory2, node, expression, recordTempVariable, resultVariable) {
|
|
@@ -43484,7 +43484,7 @@ ${lanes.join("\n")}
|
|
|
43484
43484
|
if (sourceFile) {
|
|
43485
43485
|
const fileName = configFileName || "tsconfig.json";
|
|
43486
43486
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
43487
|
-
const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (
|
|
43487
|
+
const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property2) => property2.initializer);
|
|
43488
43488
|
const error2 = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
43489
43489
|
errors.push(error2);
|
|
43490
43490
|
} else {
|
|
@@ -51498,9 +51498,9 @@ ${lanes.join("\n")}
|
|
|
51498
51498
|
const node = getParseTreeNode(nodeIn, isPropertyAccessOrQualifiedNameOrImportTypeNode);
|
|
51499
51499
|
return !!node && isValidPropertyAccess(node, escapeLeadingUnderscores(propertyName));
|
|
51500
51500
|
},
|
|
51501
|
-
isValidPropertyAccessForCompletions: (nodeIn, type,
|
|
51501
|
+
isValidPropertyAccessForCompletions: (nodeIn, type, property2) => {
|
|
51502
51502
|
const node = getParseTreeNode(nodeIn, isPropertyAccessExpression);
|
|
51503
|
-
return !!node && isValidPropertyAccessForCompletions(node, type,
|
|
51503
|
+
return !!node && isValidPropertyAccessForCompletions(node, type, property2);
|
|
51504
51504
|
},
|
|
51505
51505
|
getSignatureFromDeclaration: (declarationIn) => {
|
|
51506
51506
|
const declaration = getParseTreeNode(declarationIn, isFunctionLike);
|
|
@@ -60069,11 +60069,11 @@ ${lanes.join("\n")}
|
|
|
60069
60069
|
}
|
|
60070
60070
|
function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
|
|
60071
60071
|
const list = obj.properties;
|
|
60072
|
-
return list.some((
|
|
60073
|
-
const nameType =
|
|
60072
|
+
return list.some((property2) => {
|
|
60073
|
+
const nameType = property2.name && (isJsxNamespacedName(property2.name) ? getStringLiteralType(getTextOfJsxAttributeName(property2.name)) : getLiteralTypeFromPropertyName(property2.name));
|
|
60074
60074
|
const name = nameType && isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : undefined;
|
|
60075
60075
|
const expected = name === undefined ? undefined : getTypeOfPropertyOfType(contextualType, name);
|
|
60076
|
-
return !!expected && isLiteralType(expected) && !isTypeAssignableTo(getTypeOfNode(
|
|
60076
|
+
return !!expected && isLiteralType(expected) && !isTypeAssignableTo(getTypeOfNode(property2), expected);
|
|
60077
60077
|
});
|
|
60078
60078
|
}
|
|
60079
60079
|
function getAllPossiblePropertiesOfTypes(types) {
|
|
@@ -60499,15 +60499,15 @@ ${lanes.join("\n")}
|
|
|
60499
60499
|
}
|
|
60500
60500
|
function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
|
|
60501
60501
|
var _a, _b;
|
|
60502
|
-
let
|
|
60503
|
-
if (!
|
|
60504
|
-
|
|
60505
|
-
if (
|
|
60502
|
+
let property2 = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? undefined : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? undefined : _b.get(name) : undefined;
|
|
60503
|
+
if (!property2) {
|
|
60504
|
+
property2 = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
60505
|
+
if (property2) {
|
|
60506
60506
|
const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
|
|
60507
|
-
properties.set(name,
|
|
60507
|
+
properties.set(name, property2);
|
|
60508
60508
|
}
|
|
60509
60509
|
}
|
|
60510
|
-
return
|
|
60510
|
+
return property2;
|
|
60511
60511
|
}
|
|
60512
60512
|
function getCommonDeclarationsOfSymbols(symbols) {
|
|
60513
60513
|
let commonDeclarations;
|
|
@@ -60531,8 +60531,8 @@ ${lanes.join("\n")}
|
|
|
60531
60531
|
return commonDeclarations;
|
|
60532
60532
|
}
|
|
60533
60533
|
function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
|
|
60534
|
-
const
|
|
60535
|
-
return
|
|
60534
|
+
const property2 = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
60535
|
+
return property2 && !(getCheckFlags(property2) & 16) ? property2 : undefined;
|
|
60536
60536
|
}
|
|
60537
60537
|
function getReducedType(type) {
|
|
60538
60538
|
if (type.flags & 1048576 && type.objectFlags & 16777216) {
|
|
@@ -61979,10 +61979,10 @@ ${lanes.join("\n")}
|
|
|
61979
61979
|
const flags = elementFlags[i];
|
|
61980
61980
|
combinedFlags |= flags;
|
|
61981
61981
|
if (!(combinedFlags & 12)) {
|
|
61982
|
-
const
|
|
61983
|
-
|
|
61984
|
-
|
|
61985
|
-
properties.push(
|
|
61982
|
+
const property2 = createSymbol(4 | (flags & 2 ? 16777216 : 0), "" + i, readonly ? 8 : 0);
|
|
61983
|
+
property2.links.tupleLabelDeclaration = namedMemberDeclarations == null ? undefined : namedMemberDeclarations[i];
|
|
61984
|
+
property2.links.type = typeParameter;
|
|
61985
|
+
properties.push(property2);
|
|
61986
61986
|
}
|
|
61987
61987
|
}
|
|
61988
61988
|
}
|
|
@@ -62995,8 +62995,8 @@ ${lanes.join("\n")}
|
|
|
62995
62995
|
diagnostics.add(createDiagnosticForNode(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType)));
|
|
62996
62996
|
return undefinedType;
|
|
62997
62997
|
} else if (indexType.flags & (8 | 4)) {
|
|
62998
|
-
const types = map(objectType.properties, (
|
|
62999
|
-
return getTypeOfSymbol(
|
|
62998
|
+
const types = map(objectType.properties, (property2) => {
|
|
62999
|
+
return getTypeOfSymbol(property2);
|
|
63000
63000
|
});
|
|
63001
63001
|
return getUnionType(append(types, undefinedType));
|
|
63002
63002
|
}
|
|
@@ -64991,12 +64991,12 @@ ${lanes.join("\n")}
|
|
|
64991
64991
|
return !!(entry & 1);
|
|
64992
64992
|
}
|
|
64993
64993
|
const targetEnumType = getTypeOfSymbol(targetSymbol);
|
|
64994
|
-
for (const
|
|
64995
|
-
if (
|
|
64996
|
-
const targetProperty = getPropertyOfType(targetEnumType,
|
|
64994
|
+
for (const property2 of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
|
|
64995
|
+
if (property2.flags & 8) {
|
|
64996
|
+
const targetProperty = getPropertyOfType(targetEnumType, property2.escapedName);
|
|
64997
64997
|
if (!targetProperty || !(targetProperty.flags & 8)) {
|
|
64998
64998
|
if (errorReporter) {
|
|
64999
|
-
errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(
|
|
64999
|
+
errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property2), typeToString(getDeclaredTypeOfSymbol(targetSymbol), undefined, 64));
|
|
65000
65000
|
enumRelation.set(id, 2 | 4);
|
|
65001
65001
|
} else {
|
|
65002
65002
|
enumRelation.set(id, 2);
|
|
@@ -67073,10 +67073,10 @@ ${lanes.join("\n")}
|
|
|
67073
67073
|
function getDeclaringClass(prop) {
|
|
67074
67074
|
return prop.parent && prop.parent.flags & 32 ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : undefined;
|
|
67075
67075
|
}
|
|
67076
|
-
function getTypeOfPropertyInBaseClass(
|
|
67077
|
-
const classType = getDeclaringClass(
|
|
67076
|
+
function getTypeOfPropertyInBaseClass(property2) {
|
|
67077
|
+
const classType = getDeclaringClass(property2);
|
|
67078
67078
|
const baseClassType = classType && getBaseTypes(classType)[0];
|
|
67079
|
-
return baseClassType && getTypeOfPropertyOfType(baseClassType,
|
|
67079
|
+
return baseClassType && getTypeOfPropertyOfType(baseClassType, property2.escapedName);
|
|
67080
67080
|
}
|
|
67081
67081
|
function isPropertyInClassDerivedFrom(prop, baseClass) {
|
|
67082
67082
|
return forEachProperty2(prop, (sp) => {
|
|
@@ -67505,10 +67505,10 @@ ${lanes.join("\n")}
|
|
|
67505
67505
|
}
|
|
67506
67506
|
function transformTypeOfMembers(type, f) {
|
|
67507
67507
|
const members = createSymbolTable();
|
|
67508
|
-
for (const
|
|
67509
|
-
const original = getTypeOfSymbol(
|
|
67508
|
+
for (const property2 of getPropertiesOfObjectType(type)) {
|
|
67509
|
+
const original = getTypeOfSymbol(property2);
|
|
67510
67510
|
const updated = f(original);
|
|
67511
|
-
members.set(
|
|
67511
|
+
members.set(property2.escapedName, updated === original ? property2 : createSymbolWithType(property2, updated));
|
|
67512
67512
|
}
|
|
67513
67513
|
return members;
|
|
67514
67514
|
}
|
|
@@ -73573,8 +73573,8 @@ ${lanes.join("\n")}
|
|
|
73573
73573
|
return isValidPropertyAccessWithType(node, false, propertyName, getTypeFromTypeNode(node));
|
|
73574
73574
|
}
|
|
73575
73575
|
}
|
|
73576
|
-
function isValidPropertyAccessForCompletions(node, type,
|
|
73577
|
-
return isPropertyAccessible(node, node.kind === 211 && node.expression.kind === 108, false, type,
|
|
73576
|
+
function isValidPropertyAccessForCompletions(node, type, property2) {
|
|
73577
|
+
return isPropertyAccessible(node, node.kind === 211 && node.expression.kind === 108, false, type, property2);
|
|
73578
73578
|
}
|
|
73579
73579
|
function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
|
|
73580
73580
|
if (isTypeAny(type)) {
|
|
@@ -73583,15 +73583,15 @@ ${lanes.join("\n")}
|
|
|
73583
73583
|
const prop = getPropertyOfType(type, propertyName);
|
|
73584
73584
|
return !!prop && isPropertyAccessible(node, isSuper, false, type, prop);
|
|
73585
73585
|
}
|
|
73586
|
-
function isPropertyAccessible(node, isSuper, isWrite, containingType,
|
|
73586
|
+
function isPropertyAccessible(node, isSuper, isWrite, containingType, property2) {
|
|
73587
73587
|
if (isTypeAny(containingType)) {
|
|
73588
73588
|
return true;
|
|
73589
73589
|
}
|
|
73590
|
-
if (
|
|
73591
|
-
const declClass = getContainingClass(
|
|
73590
|
+
if (property2.valueDeclaration && isPrivateIdentifierClassElementDeclaration(property2.valueDeclaration)) {
|
|
73591
|
+
const declClass = getContainingClass(property2.valueDeclaration);
|
|
73592
73592
|
return !isOptionalChain(node) && !!findAncestor(node, (parent2) => parent2 === declClass);
|
|
73593
73593
|
}
|
|
73594
|
-
return checkPropertyAccessibilityAtLocation(node, isSuper, isWrite, containingType,
|
|
73594
|
+
return checkPropertyAccessibilityAtLocation(node, isSuper, isWrite, containingType, property2);
|
|
73595
73595
|
}
|
|
73596
73596
|
function getForInVariableSymbol(node) {
|
|
73597
73597
|
const initializer = node.initializer;
|
|
@@ -76688,27 +76688,27 @@ ${lanes.join("\n")}
|
|
|
76688
76688
|
}
|
|
76689
76689
|
function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis = false) {
|
|
76690
76690
|
const properties = node.properties;
|
|
76691
|
-
const
|
|
76692
|
-
if (
|
|
76693
|
-
const name =
|
|
76691
|
+
const property2 = properties[propertyIndex];
|
|
76692
|
+
if (property2.kind === 303 || property2.kind === 304) {
|
|
76693
|
+
const name = property2.name;
|
|
76694
76694
|
const exprType = getLiteralTypeFromPropertyName(name);
|
|
76695
76695
|
if (isTypeUsableAsPropertyName(exprType)) {
|
|
76696
76696
|
const text = getPropertyNameFromType(exprType);
|
|
76697
76697
|
const prop = getPropertyOfType(objectLiteralType, text);
|
|
76698
76698
|
if (prop) {
|
|
76699
|
-
markPropertyAsReferenced(prop,
|
|
76700
|
-
checkPropertyAccessibility(
|
|
76699
|
+
markPropertyAsReferenced(prop, property2, rightIsThis);
|
|
76700
|
+
checkPropertyAccessibility(property2, false, true, objectLiteralType, prop);
|
|
76701
76701
|
}
|
|
76702
76702
|
}
|
|
76703
76703
|
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32, name);
|
|
76704
|
-
const type = getFlowTypeOfDestructuring(
|
|
76705
|
-
return checkDestructuringAssignment(
|
|
76706
|
-
} else if (
|
|
76704
|
+
const type = getFlowTypeOfDestructuring(property2, elementType);
|
|
76705
|
+
return checkDestructuringAssignment(property2.kind === 304 ? property2 : property2.initializer, type);
|
|
76706
|
+
} else if (property2.kind === 305) {
|
|
76707
76707
|
if (propertyIndex < properties.length - 1) {
|
|
76708
|
-
error2(
|
|
76708
|
+
error2(property2, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
76709
76709
|
} else {
|
|
76710
76710
|
if (languageVersion < 99) {
|
|
76711
|
-
checkExternalEmitHelpers(
|
|
76711
|
+
checkExternalEmitHelpers(property2, 4);
|
|
76712
76712
|
}
|
|
76713
76713
|
const nonRestNames = [];
|
|
76714
76714
|
if (allProperties) {
|
|
@@ -76720,10 +76720,10 @@ ${lanes.join("\n")}
|
|
|
76720
76720
|
}
|
|
76721
76721
|
const type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
|
|
76722
76722
|
checkGrammarForDisallowedTrailingComma(allProperties, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
|
|
76723
|
-
return checkDestructuringAssignment(
|
|
76723
|
+
return checkDestructuringAssignment(property2.expression, type);
|
|
76724
76724
|
}
|
|
76725
76725
|
} else {
|
|
76726
|
-
error2(
|
|
76726
|
+
error2(property2, Diagnostics.Property_assignment_expected);
|
|
76727
76727
|
}
|
|
76728
76728
|
}
|
|
76729
76729
|
function checkArrayLiteralAssignment(node, sourceType, checkMode) {
|
|
@@ -79983,10 +79983,10 @@ ${lanes.join("\n")}
|
|
|
79983
79983
|
const exprType = getLiteralTypeFromPropertyName(name);
|
|
79984
79984
|
if (isTypeUsableAsPropertyName(exprType)) {
|
|
79985
79985
|
const nameText = getPropertyNameFromType(exprType);
|
|
79986
|
-
const
|
|
79987
|
-
if (
|
|
79988
|
-
markPropertyAsReferenced(
|
|
79989
|
-
checkPropertyAccessibility(node, !!parent2.initializer && parent2.initializer.kind === 108, false, parentType,
|
|
79986
|
+
const property2 = getPropertyOfType(parentType, nameText);
|
|
79987
|
+
if (property2) {
|
|
79988
|
+
markPropertyAsReferenced(property2, undefined, false);
|
|
79989
|
+
checkPropertyAccessibility(node, !!parent2.initializer && parent2.initializer.kind === 108, false, parentType, property2);
|
|
79990
79990
|
}
|
|
79991
79991
|
}
|
|
79992
79992
|
}
|
|
@@ -87696,8 +87696,8 @@ ${lanes.join("\n")}
|
|
|
87696
87696
|
}
|
|
87697
87697
|
return { decorators: decorators5, parameters };
|
|
87698
87698
|
}
|
|
87699
|
-
function getAllDecoratorsOfProperty(
|
|
87700
|
-
const decorators5 = getDecorators(
|
|
87699
|
+
function getAllDecoratorsOfProperty(property2) {
|
|
87700
|
+
const decorators5 = getDecorators(property2);
|
|
87701
87701
|
if (!some(decorators5)) {
|
|
87702
87702
|
return;
|
|
87703
87703
|
}
|
|
@@ -90695,7 +90695,7 @@ ${lanes.join("\n")}
|
|
|
90695
90695
|
const instanceProperties = getProperties(node, false, false);
|
|
90696
90696
|
let properties = instanceProperties;
|
|
90697
90697
|
if (!useDefineForClassFields) {
|
|
90698
|
-
properties = filter(properties, (
|
|
90698
|
+
properties = filter(properties, (property2) => !!property2.initializer || isPrivateIdentifier(property2.name) || hasAccessorModifier(property2));
|
|
90699
90699
|
}
|
|
90700
90700
|
const privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node);
|
|
90701
90701
|
const needsConstructorBody = some(properties) || some(privateMethodsAndAccessors);
|
|
@@ -90748,32 +90748,32 @@ ${lanes.join("\n")}
|
|
|
90748
90748
|
return setTextRange(factory2.createBlock(setTextRange(factory2.createNodeArray(statements), constructor ? constructor.body.statements : node.members), multiLine), constructor ? constructor.body : undefined);
|
|
90749
90749
|
}
|
|
90750
90750
|
function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
|
|
90751
|
-
for (const
|
|
90752
|
-
if (isStatic(
|
|
90751
|
+
for (const property2 of properties) {
|
|
90752
|
+
if (isStatic(property2) && !shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
90753
90753
|
continue;
|
|
90754
90754
|
}
|
|
90755
|
-
const statement = transformPropertyOrClassStaticBlock(
|
|
90755
|
+
const statement = transformPropertyOrClassStaticBlock(property2, receiver);
|
|
90756
90756
|
if (!statement) {
|
|
90757
90757
|
continue;
|
|
90758
90758
|
}
|
|
90759
90759
|
statements.push(statement);
|
|
90760
90760
|
}
|
|
90761
90761
|
}
|
|
90762
|
-
function transformPropertyOrClassStaticBlock(
|
|
90763
|
-
const expression = isClassStaticBlockDeclaration(
|
|
90762
|
+
function transformPropertyOrClassStaticBlock(property2, receiver) {
|
|
90763
|
+
const expression = isClassStaticBlockDeclaration(property2) ? setCurrentClassElementAnd(property2, transformClassStaticBlockDeclaration, property2) : transformProperty(property2, receiver);
|
|
90764
90764
|
if (!expression) {
|
|
90765
90765
|
return;
|
|
90766
90766
|
}
|
|
90767
90767
|
const statement = factory2.createExpressionStatement(expression);
|
|
90768
|
-
setOriginalNode(statement,
|
|
90769
|
-
addEmitFlags(statement, getEmitFlags(
|
|
90770
|
-
setCommentRange(statement,
|
|
90771
|
-
const propertyOriginalNode = getOriginalNode(
|
|
90768
|
+
setOriginalNode(statement, property2);
|
|
90769
|
+
addEmitFlags(statement, getEmitFlags(property2) & 3072);
|
|
90770
|
+
setCommentRange(statement, property2);
|
|
90771
|
+
const propertyOriginalNode = getOriginalNode(property2);
|
|
90772
90772
|
if (isParameter(propertyOriginalNode)) {
|
|
90773
90773
|
setSourceMapRange(statement, propertyOriginalNode);
|
|
90774
90774
|
removeAllComments(statement);
|
|
90775
90775
|
} else {
|
|
90776
|
-
setSourceMapRange(statement, moveRangePastModifiers(
|
|
90776
|
+
setSourceMapRange(statement, moveRangePastModifiers(property2));
|
|
90777
90777
|
}
|
|
90778
90778
|
setSyntheticLeadingComments(expression, undefined);
|
|
90779
90779
|
setSyntheticTrailingComments(expression, undefined);
|
|
@@ -90784,50 +90784,50 @@ ${lanes.join("\n")}
|
|
|
90784
90784
|
}
|
|
90785
90785
|
function generateInitializedPropertyExpressionsOrClassStaticBlock(propertiesOrClassStaticBlocks, receiver) {
|
|
90786
90786
|
const expressions = [];
|
|
90787
|
-
for (const
|
|
90788
|
-
const expression = isClassStaticBlockDeclaration(
|
|
90787
|
+
for (const property2 of propertiesOrClassStaticBlocks) {
|
|
90788
|
+
const expression = isClassStaticBlockDeclaration(property2) ? setCurrentClassElementAnd(property2, transformClassStaticBlockDeclaration, property2) : setCurrentClassElementAnd(property2, () => transformProperty(property2, receiver), undefined);
|
|
90789
90789
|
if (!expression) {
|
|
90790
90790
|
continue;
|
|
90791
90791
|
}
|
|
90792
90792
|
startOnNewLine(expression);
|
|
90793
|
-
setOriginalNode(expression,
|
|
90794
|
-
addEmitFlags(expression, getEmitFlags(
|
|
90795
|
-
setSourceMapRange(expression, moveRangePastModifiers(
|
|
90796
|
-
setCommentRange(expression,
|
|
90793
|
+
setOriginalNode(expression, property2);
|
|
90794
|
+
addEmitFlags(expression, getEmitFlags(property2) & 3072);
|
|
90795
|
+
setSourceMapRange(expression, moveRangePastModifiers(property2));
|
|
90796
|
+
setCommentRange(expression, property2);
|
|
90797
90797
|
expressions.push(expression);
|
|
90798
90798
|
}
|
|
90799
90799
|
return expressions;
|
|
90800
90800
|
}
|
|
90801
|
-
function transformProperty(
|
|
90801
|
+
function transformProperty(property2, receiver) {
|
|
90802
90802
|
var _a;
|
|
90803
90803
|
const savedCurrentClassElement = currentClassElement;
|
|
90804
|
-
const transformed = transformPropertyWorker(
|
|
90805
|
-
if (transformed && hasStaticModifier(
|
|
90806
|
-
setOriginalNode(transformed,
|
|
90804
|
+
const transformed = transformPropertyWorker(property2, receiver);
|
|
90805
|
+
if (transformed && hasStaticModifier(property2) && ((_a = lexicalEnvironment == null ? undefined : lexicalEnvironment.data) == null ? undefined : _a.facts)) {
|
|
90806
|
+
setOriginalNode(transformed, property2);
|
|
90807
90807
|
addEmitFlags(transformed, 4);
|
|
90808
|
-
setSourceMapRange(transformed, getSourceMapRange(
|
|
90809
|
-
lexicalEnvironmentMap.set(getOriginalNode(
|
|
90808
|
+
setSourceMapRange(transformed, getSourceMapRange(property2.name));
|
|
90809
|
+
lexicalEnvironmentMap.set(getOriginalNode(property2), lexicalEnvironment);
|
|
90810
90810
|
}
|
|
90811
90811
|
currentClassElement = savedCurrentClassElement;
|
|
90812
90812
|
return transformed;
|
|
90813
90813
|
}
|
|
90814
|
-
function transformPropertyWorker(
|
|
90814
|
+
function transformPropertyWorker(property2, receiver) {
|
|
90815
90815
|
const emitAssignment = !useDefineForClassFields;
|
|
90816
|
-
if (isNamedEvaluation(
|
|
90817
|
-
|
|
90816
|
+
if (isNamedEvaluation(property2, isAnonymousClassNeedingAssignedName)) {
|
|
90817
|
+
property2 = transformNamedEvaluation(context, property2);
|
|
90818
90818
|
}
|
|
90819
|
-
const propertyName = hasAccessorModifier(
|
|
90820
|
-
if (hasStaticModifier(
|
|
90821
|
-
currentClassElement =
|
|
90819
|
+
const propertyName = hasAccessorModifier(property2) ? factory2.getGeneratedPrivateNameForNode(property2.name) : isComputedPropertyName(property2.name) && !isSimpleInlineableExpression(property2.name.expression) ? factory2.updateComputedPropertyName(property2.name, factory2.getGeneratedNameForNode(property2.name)) : property2.name;
|
|
90820
|
+
if (hasStaticModifier(property2)) {
|
|
90821
|
+
currentClassElement = property2;
|
|
90822
90822
|
}
|
|
90823
|
-
if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(
|
|
90823
|
+
if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property2)) {
|
|
90824
90824
|
const privateIdentifierInfo = accessPrivateIdentifier2(propertyName);
|
|
90825
90825
|
if (privateIdentifierInfo) {
|
|
90826
90826
|
if (privateIdentifierInfo.kind === "f") {
|
|
90827
90827
|
if (!privateIdentifierInfo.isStatic) {
|
|
90828
|
-
return createPrivateInstanceFieldInitializer(factory2, receiver, visitNode(
|
|
90828
|
+
return createPrivateInstanceFieldInitializer(factory2, receiver, visitNode(property2.initializer, visitor, isExpression), privateIdentifierInfo.brandCheckIdentifier);
|
|
90829
90829
|
} else {
|
|
90830
|
-
return createPrivateStaticFieldInitializer(factory2, privateIdentifierInfo.variableName, visitNode(
|
|
90830
|
+
return createPrivateStaticFieldInitializer(factory2, privateIdentifierInfo.variableName, visitNode(property2.initializer, visitor, isExpression));
|
|
90831
90831
|
}
|
|
90832
90832
|
} else {
|
|
90833
90833
|
return;
|
|
@@ -90836,14 +90836,14 @@ ${lanes.join("\n")}
|
|
|
90836
90836
|
Debug.fail("Undeclared private name for property declaration.");
|
|
90837
90837
|
}
|
|
90838
90838
|
}
|
|
90839
|
-
if ((isPrivateIdentifier(propertyName) || hasStaticModifier(
|
|
90839
|
+
if ((isPrivateIdentifier(propertyName) || hasStaticModifier(property2)) && !property2.initializer) {
|
|
90840
90840
|
return;
|
|
90841
90841
|
}
|
|
90842
|
-
const propertyOriginalNode = getOriginalNode(
|
|
90842
|
+
const propertyOriginalNode = getOriginalNode(property2);
|
|
90843
90843
|
if (hasSyntacticModifier(propertyOriginalNode, 256)) {
|
|
90844
90844
|
return;
|
|
90845
90845
|
}
|
|
90846
|
-
let initializer = visitNode(
|
|
90846
|
+
let initializer = visitNode(property2.initializer, visitor, isExpression);
|
|
90847
90847
|
if (isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier(propertyName)) {
|
|
90848
90848
|
const localName = factory2.cloneNode(propertyName);
|
|
90849
90849
|
if (initializer) {
|
|
@@ -95353,7 +95353,7 @@ ${lanes.join("\n")}
|
|
|
95353
95353
|
} else if (hex) {
|
|
95354
95354
|
return utf16EncodeAsString(parseInt(hex, 16));
|
|
95355
95355
|
} else {
|
|
95356
|
-
const ch =
|
|
95356
|
+
const ch = entities2.get(word);
|
|
95357
95357
|
return ch ? utf16EncodeAsString(ch) : match;
|
|
95358
95358
|
}
|
|
95359
95359
|
});
|
|
@@ -95389,11 +95389,11 @@ ${lanes.join("\n")}
|
|
|
95389
95389
|
return node.dotDotDotToken ? factory2.createSpreadElement(expression) : expression;
|
|
95390
95390
|
}
|
|
95391
95391
|
}
|
|
95392
|
-
var
|
|
95392
|
+
var entities2;
|
|
95393
95393
|
var init_jsx = __esm2({
|
|
95394
95394
|
"src/compiler/transformers/jsx.ts"() {
|
|
95395
95395
|
init_ts2();
|
|
95396
|
-
|
|
95396
|
+
entities2 = new Map(Object.entries({
|
|
95397
95397
|
quot: 34,
|
|
95398
95398
|
amp: 38,
|
|
95399
95399
|
apos: 39,
|
|
@@ -96854,8 +96854,8 @@ ${lanes.join("\n")}
|
|
|
96854
96854
|
const properties = node.properties;
|
|
96855
96855
|
let numInitialProperties = -1, hasComputed = false;
|
|
96856
96856
|
for (let i = 0;i < properties.length; i++) {
|
|
96857
|
-
const
|
|
96858
|
-
if (
|
|
96857
|
+
const property2 = properties[i];
|
|
96858
|
+
if (property2.transformFlags & 1048576 && hierarchyFacts & 4 || (hasComputed = Debug.checkDefined(property2.name).kind === 167)) {
|
|
96859
96859
|
numInitialProperties = i;
|
|
96860
96860
|
break;
|
|
96861
96861
|
}
|
|
@@ -97239,23 +97239,23 @@ ${lanes.join("\n")}
|
|
|
97239
97239
|
const properties = node.properties;
|
|
97240
97240
|
const numProperties = properties.length;
|
|
97241
97241
|
for (let i = start;i < numProperties; i++) {
|
|
97242
|
-
const
|
|
97243
|
-
switch (
|
|
97242
|
+
const property2 = properties[i];
|
|
97243
|
+
switch (property2.kind) {
|
|
97244
97244
|
case 177:
|
|
97245
97245
|
case 178:
|
|
97246
|
-
const accessors = getAllAccessorDeclarations(node.properties,
|
|
97247
|
-
if (
|
|
97246
|
+
const accessors = getAllAccessorDeclarations(node.properties, property2);
|
|
97247
|
+
if (property2 === accessors.firstAccessor) {
|
|
97248
97248
|
expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine));
|
|
97249
97249
|
}
|
|
97250
97250
|
break;
|
|
97251
97251
|
case 174:
|
|
97252
|
-
expressions.push(transformObjectLiteralMethodDeclarationToExpression(
|
|
97252
|
+
expressions.push(transformObjectLiteralMethodDeclarationToExpression(property2, receiver, node, node.multiLine));
|
|
97253
97253
|
break;
|
|
97254
97254
|
case 303:
|
|
97255
|
-
expressions.push(transformPropertyAssignmentToExpression(
|
|
97255
|
+
expressions.push(transformPropertyAssignmentToExpression(property2, receiver, node.multiLine));
|
|
97256
97256
|
break;
|
|
97257
97257
|
case 304:
|
|
97258
|
-
expressions.push(transformShorthandPropertyAssignmentToExpression(
|
|
97258
|
+
expressions.push(transformShorthandPropertyAssignmentToExpression(property2, receiver, node.multiLine));
|
|
97259
97259
|
break;
|
|
97260
97260
|
default:
|
|
97261
97261
|
Debug.failBadSyntaxKind(node);
|
|
@@ -97263,17 +97263,17 @@ ${lanes.join("\n")}
|
|
|
97263
97263
|
}
|
|
97264
97264
|
}
|
|
97265
97265
|
}
|
|
97266
|
-
function transformPropertyAssignmentToExpression(
|
|
97267
|
-
const expression = factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver, Debug.checkDefined(visitNode(
|
|
97268
|
-
setTextRange(expression,
|
|
97266
|
+
function transformPropertyAssignmentToExpression(property2, receiver, startsOnNewLine) {
|
|
97267
|
+
const expression = factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver, Debug.checkDefined(visitNode(property2.name, visitor, isPropertyName))), Debug.checkDefined(visitNode(property2.initializer, visitor, isExpression)));
|
|
97268
|
+
setTextRange(expression, property2);
|
|
97269
97269
|
if (startsOnNewLine) {
|
|
97270
97270
|
startOnNewLine(expression);
|
|
97271
97271
|
}
|
|
97272
97272
|
return expression;
|
|
97273
97273
|
}
|
|
97274
|
-
function transformShorthandPropertyAssignmentToExpression(
|
|
97275
|
-
const expression = factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver, Debug.checkDefined(visitNode(
|
|
97276
|
-
setTextRange(expression,
|
|
97274
|
+
function transformShorthandPropertyAssignmentToExpression(property2, receiver, startsOnNewLine) {
|
|
97275
|
+
const expression = factory2.createAssignment(createMemberAccessForPropertyName(factory2, receiver, Debug.checkDefined(visitNode(property2.name, visitor, isPropertyName))), factory2.cloneNode(property2.name));
|
|
97276
|
+
setTextRange(expression, property2);
|
|
97277
97277
|
if (startsOnNewLine) {
|
|
97278
97278
|
startOnNewLine(expression);
|
|
97279
97279
|
}
|
|
@@ -98150,12 +98150,12 @@ ${lanes.join("\n")}
|
|
|
98150
98150
|
const expressions = reduceLeft(properties, reduceProperty, [], numInitialProperties);
|
|
98151
98151
|
expressions.push(multiLine ? startOnNewLine(setParent(setTextRange(factory2.cloneNode(temp), temp), temp.parent)) : temp);
|
|
98152
98152
|
return factory2.inlineExpressions(expressions);
|
|
98153
|
-
function reduceProperty(expressions2,
|
|
98154
|
-
if (containsYield(
|
|
98153
|
+
function reduceProperty(expressions2, property2) {
|
|
98154
|
+
if (containsYield(property2) && expressions2.length > 0) {
|
|
98155
98155
|
emitStatement(factory2.createExpressionStatement(factory2.inlineExpressions(expressions2)));
|
|
98156
98156
|
expressions2 = [];
|
|
98157
98157
|
}
|
|
98158
|
-
const expression = createExpressionForObjectLiteralElementLike(factory2, node,
|
|
98158
|
+
const expression = createExpressionForObjectLiteralElementLike(factory2, node, property2, temp);
|
|
98159
98159
|
const visited = visitNode(expression, visitor, isExpression);
|
|
98160
98160
|
if (visited) {
|
|
98161
98161
|
if (multiLine) {
|
|
@@ -111458,7 +111458,7 @@ ${lanes.join("\n")}
|
|
|
111458
111458
|
if (!referenceInfo)
|
|
111459
111459
|
return;
|
|
111460
111460
|
const { sourceFile, index } = referenceInfo;
|
|
111461
|
-
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (
|
|
111461
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property2) => isArrayLiteralExpression(property2.initializer) ? property2.initializer : undefined);
|
|
111462
111462
|
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(sourceFile, referencesSyntax.elements[index], reason.kind === 2 ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here) : undefined;
|
|
111463
111463
|
case 8:
|
|
111464
111464
|
if (!options.types)
|
|
@@ -111552,7 +111552,7 @@ ${lanes.join("\n")}
|
|
|
111552
111552
|
return forEachOptionsSyntaxByName("paths", callback);
|
|
111553
111553
|
}
|
|
111554
111554
|
function getOptionsSyntaxByValue(name, value) {
|
|
111555
|
-
return forEachOptionsSyntaxByName(name, (
|
|
111555
|
+
return forEachOptionsSyntaxByName(name, (property2) => isStringLiteral(property2.initializer) && property2.initializer.text === value ? property2.initializer : undefined);
|
|
111556
111556
|
}
|
|
111557
111557
|
function getOptionsSyntaxByArrayElementValue(name, value) {
|
|
111558
111558
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
@@ -111565,7 +111565,7 @@ ${lanes.join("\n")}
|
|
|
111565
111565
|
createDiagnosticForOption(false, option1, undefined, message, ...args);
|
|
111566
111566
|
}
|
|
111567
111567
|
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
111568
|
-
const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (
|
|
111568
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (property2) => isArrayLiteralExpression(property2.initializer) ? property2.initializer : undefined);
|
|
111569
111569
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
111570
111570
|
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
111571
111571
|
} else {
|
|
@@ -122417,31 +122417,31 @@ ${lanes.join("\n")}
|
|
|
122417
122417
|
const jsonObjectLiteral = getTsConfigObjectLiteralExpression(configFile);
|
|
122418
122418
|
if (!jsonObjectLiteral)
|
|
122419
122419
|
return;
|
|
122420
|
-
forEachProperty(jsonObjectLiteral, (
|
|
122420
|
+
forEachProperty(jsonObjectLiteral, (property2, propertyName) => {
|
|
122421
122421
|
switch (propertyName) {
|
|
122422
122422
|
case "files":
|
|
122423
122423
|
case "include":
|
|
122424
122424
|
case "exclude": {
|
|
122425
|
-
const foundExactMatch = updatePaths(
|
|
122426
|
-
if (foundExactMatch || propertyName !== "include" || !isArrayLiteralExpression(
|
|
122425
|
+
const foundExactMatch = updatePaths(property2);
|
|
122426
|
+
if (foundExactMatch || propertyName !== "include" || !isArrayLiteralExpression(property2.initializer))
|
|
122427
122427
|
return;
|
|
122428
|
-
const includes = mapDefined(
|
|
122428
|
+
const includes = mapDefined(property2.initializer.elements, (e) => isStringLiteral(e) ? e.text : undefined);
|
|
122429
122429
|
if (includes.length === 0)
|
|
122430
122430
|
return;
|
|
122431
122431
|
const matchers = getFileMatcherPatterns(configDir, [], includes, useCaseSensitiveFileNames2, currentDirectory);
|
|
122432
122432
|
if (getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames2).test(oldFileOrDirPath) && !getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames2).test(newFileOrDirPath)) {
|
|
122433
|
-
changeTracker.insertNodeAfter(configFile, last(
|
|
122433
|
+
changeTracker.insertNodeAfter(configFile, last(property2.initializer.elements), factory.createStringLiteral(relativePath(newFileOrDirPath)));
|
|
122434
122434
|
}
|
|
122435
122435
|
return;
|
|
122436
122436
|
}
|
|
122437
122437
|
case "compilerOptions":
|
|
122438
|
-
forEachProperty(
|
|
122438
|
+
forEachProperty(property2.initializer, (property22, propertyName2) => {
|
|
122439
122439
|
const option = getOptionFromName(propertyName2);
|
|
122440
122440
|
Debug.assert((option == null ? undefined : option.type) !== "listOrElement");
|
|
122441
122441
|
if (option && (option.isFilePath || option.type === "list" && option.element.isFilePath)) {
|
|
122442
|
-
updatePaths(
|
|
122442
|
+
updatePaths(property22);
|
|
122443
122443
|
} else if (propertyName2 === "paths") {
|
|
122444
|
-
forEachProperty(
|
|
122444
|
+
forEachProperty(property22.initializer, (pathsProperty) => {
|
|
122445
122445
|
if (!isArrayLiteralExpression(pathsProperty.initializer))
|
|
122446
122446
|
return;
|
|
122447
122447
|
for (const e of pathsProperty.initializer.elements) {
|
|
@@ -122453,8 +122453,8 @@ ${lanes.join("\n")}
|
|
|
122453
122453
|
return;
|
|
122454
122454
|
}
|
|
122455
122455
|
});
|
|
122456
|
-
function updatePaths(
|
|
122457
|
-
const elements = isArrayLiteralExpression(
|
|
122456
|
+
function updatePaths(property2) {
|
|
122457
|
+
const elements = isArrayLiteralExpression(property2.initializer) ? property2.initializer.elements : [property2.initializer];
|
|
122458
122458
|
let foundExactMatch = false;
|
|
122459
122459
|
for (const element of elements) {
|
|
122460
122460
|
foundExactMatch = tryUpdateString(element) || foundExactMatch;
|
|
@@ -122533,7 +122533,7 @@ ${lanes.join("\n")}
|
|
|
122533
122533
|
return resolved.resolvedModule && { newFileName: resolved.resolvedModule.resolvedFileName, updated: false };
|
|
122534
122534
|
function tryChangeWithIgnoringPackageJsonExisting(oldFileName) {
|
|
122535
122535
|
const newFileName = oldToNew(oldFileName);
|
|
122536
|
-
return newFileName && find(sourceFiles, (
|
|
122536
|
+
return newFileName && find(sourceFiles, (src2) => src2.fileName === newFileName) ? tryChangeWithIgnoringPackageJson(oldFileName) : undefined;
|
|
122537
122537
|
}
|
|
122538
122538
|
function tryChangeWithIgnoringPackageJson(oldFileName) {
|
|
122539
122539
|
return !endsWith(oldFileName, "/package.json") ? tryChange(oldFileName) : undefined;
|
|
@@ -122561,9 +122561,9 @@ ${lanes.join("\n")}
|
|
|
122561
122561
|
function forEachProperty(objectLiteral, cb) {
|
|
122562
122562
|
if (!isObjectLiteralExpression(objectLiteral))
|
|
122563
122563
|
return;
|
|
122564
|
-
for (const
|
|
122565
|
-
if (isPropertyAssignment(
|
|
122566
|
-
cb(
|
|
122564
|
+
for (const property2 of objectLiteral.properties) {
|
|
122565
|
+
if (isPropertyAssignment(property2) && isStringLiteral(property2.name)) {
|
|
122566
|
+
cb(property2, property2.name.text);
|
|
122567
122567
|
}
|
|
122568
122568
|
}
|
|
122569
122569
|
}
|
|
@@ -126968,12 +126968,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
126968
126968
|
const nonRestArguments = hasRestParameter2 ? functionArguments.slice(0, parameters.length - 1) : functionArguments;
|
|
126969
126969
|
const properties = map(nonRestArguments, (arg, i) => {
|
|
126970
126970
|
const parameterName = getParameterName(parameters[i]);
|
|
126971
|
-
const
|
|
126972
|
-
suppressLeadingAndTrailingTrivia(
|
|
126973
|
-
if (isPropertyAssignment(
|
|
126974
|
-
suppressLeadingAndTrailingTrivia(
|
|
126975
|
-
copyComments(arg,
|
|
126976
|
-
return
|
|
126971
|
+
const property2 = createPropertyOrShorthandAssignment(parameterName, arg);
|
|
126972
|
+
suppressLeadingAndTrailingTrivia(property2.name);
|
|
126973
|
+
if (isPropertyAssignment(property2))
|
|
126974
|
+
suppressLeadingAndTrailingTrivia(property2.initializer);
|
|
126975
|
+
copyComments(arg, property2);
|
|
126976
|
+
return property2;
|
|
126977
126977
|
});
|
|
126978
126978
|
if (hasRestParameter2 && functionArguments.length >= parameters.length) {
|
|
126979
126979
|
const restArguments = functionArguments.slice(parameters.length - 1);
|
|
@@ -133855,12 +133855,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
133855
133855
|
return true;
|
|
133856
133856
|
return isFunctionLike(source);
|
|
133857
133857
|
} else {
|
|
133858
|
-
return every(_target.properties, (
|
|
133859
|
-
if (isMethodDeclaration(
|
|
133858
|
+
return every(_target.properties, (property2) => {
|
|
133859
|
+
if (isMethodDeclaration(property2) || isGetOrSetAccessorDeclaration(property2))
|
|
133860
133860
|
return true;
|
|
133861
|
-
if (isPropertyAssignment(
|
|
133861
|
+
if (isPropertyAssignment(property2) && isFunctionExpression(property2.initializer) && !!property2.name)
|
|
133862
133862
|
return true;
|
|
133863
|
-
if (isConstructorAssignment(
|
|
133863
|
+
if (isConstructorAssignment(property2))
|
|
133864
133864
|
return true;
|
|
133865
133865
|
return false;
|
|
133866
133866
|
});
|
|
@@ -133899,14 +133899,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
133899
133899
|
}
|
|
133900
133900
|
return;
|
|
133901
133901
|
} else if (isObjectLiteralExpression(assignmentExpr)) {
|
|
133902
|
-
forEach(assignmentExpr.properties, (
|
|
133903
|
-
if (isMethodDeclaration(
|
|
133904
|
-
members.push(
|
|
133902
|
+
forEach(assignmentExpr.properties, (property2) => {
|
|
133903
|
+
if (isMethodDeclaration(property2) || isGetOrSetAccessorDeclaration(property2)) {
|
|
133904
|
+
members.push(property2);
|
|
133905
133905
|
}
|
|
133906
|
-
if (isPropertyAssignment(
|
|
133907
|
-
createFunctionLikeExpressionMember(members,
|
|
133906
|
+
if (isPropertyAssignment(property2) && isFunctionExpression(property2.initializer)) {
|
|
133907
|
+
createFunctionLikeExpressionMember(members, property2.initializer, property2.name);
|
|
133908
133908
|
}
|
|
133909
|
-
if (isConstructorAssignment(
|
|
133909
|
+
if (isConstructorAssignment(property2))
|
|
133910
133910
|
return;
|
|
133911
133911
|
return;
|
|
133912
133912
|
});
|
|
@@ -136611,9 +136611,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
136611
136611
|
fixIds: [fixId18],
|
|
136612
136612
|
getCodeActions(context) {
|
|
136613
136613
|
const { sourceFile, span, preferences } = context;
|
|
136614
|
-
const
|
|
136615
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile,
|
|
136616
|
-
return [createCodeFixAction(fixId18, changes, [Diagnostics.Use_element_access_for_0,
|
|
136614
|
+
const property2 = getPropertyAccessExpression(sourceFile, span.start);
|
|
136615
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile, property2, preferences));
|
|
136616
|
+
return [createCodeFixAction(fixId18, changes, [Diagnostics.Use_element_access_for_0, property2.name.text], fixId18, Diagnostics.Use_element_access_for_all_undeclared_properties)];
|
|
136617
136617
|
},
|
|
136618
136618
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => doChange14(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
|
|
136619
136619
|
});
|
|
@@ -137284,12 +137284,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
137284
137284
|
const staticInitialization = initializePropertyToUndefined(factory.createIdentifier(className), tokenName);
|
|
137285
137285
|
changeTracker.insertNodeAfter(sourceFile, classDeclaration, staticInitialization);
|
|
137286
137286
|
} else if (isPrivateIdentifier(token)) {
|
|
137287
|
-
const
|
|
137287
|
+
const property2 = factory.createPropertyDeclaration(undefined, tokenName, undefined, undefined, undefined);
|
|
137288
137288
|
const lastProp = getNodeToInsertPropertyAfter(classDeclaration);
|
|
137289
137289
|
if (lastProp) {
|
|
137290
|
-
changeTracker.insertNodeAfter(sourceFile, lastProp,
|
|
137290
|
+
changeTracker.insertNodeAfter(sourceFile, lastProp, property2);
|
|
137291
137291
|
} else {
|
|
137292
|
-
changeTracker.insertMemberAtStart(sourceFile, classDeclaration,
|
|
137292
|
+
changeTracker.insertMemberAtStart(sourceFile, classDeclaration, property2);
|
|
137293
137293
|
}
|
|
137294
137294
|
} else {
|
|
137295
137295
|
const classConstructor = getFirstConstructorWithBody(classDeclaration);
|
|
@@ -137333,12 +137333,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
137333
137333
|
}
|
|
137334
137334
|
function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) {
|
|
137335
137335
|
const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : undefined;
|
|
137336
|
-
const
|
|
137336
|
+
const property2 = isClassLike(node) ? factory.createPropertyDeclaration(modifiers, tokenName, undefined, typeNode, undefined) : factory.createPropertySignature(undefined, tokenName, undefined, typeNode);
|
|
137337
137337
|
const lastProp = getNodeToInsertPropertyAfter(node);
|
|
137338
137338
|
if (lastProp) {
|
|
137339
|
-
changeTracker.insertNodeAfter(sourceFile, lastProp,
|
|
137339
|
+
changeTracker.insertNodeAfter(sourceFile, lastProp, property2);
|
|
137340
137340
|
} else {
|
|
137341
|
-
changeTracker.insertMemberAtStart(sourceFile, node,
|
|
137341
|
+
changeTracker.insertMemberAtStart(sourceFile, node, property2);
|
|
137342
137342
|
}
|
|
137343
137343
|
}
|
|
137344
137344
|
function getNodeToInsertPropertyAfter(node) {
|
|
@@ -138030,8 +138030,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
138030
138030
|
fixIds: [fixId29],
|
|
138031
138031
|
getCodeActions(context) {
|
|
138032
138032
|
const { sourceFile, span } = context;
|
|
138033
|
-
const
|
|
138034
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, context.sourceFile,
|
|
138033
|
+
const property2 = getProperty2(sourceFile, span.start);
|
|
138034
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, context.sourceFile, property2));
|
|
138035
138035
|
return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
138036
138036
|
},
|
|
138037
138037
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => doChange23(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
@@ -140531,8 +140531,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
140531
140531
|
], true));
|
|
140532
140532
|
}
|
|
140533
140533
|
function updatePropertyDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
|
|
140534
|
-
const
|
|
140535
|
-
changeTracker.replaceNode(file, declaration,
|
|
140534
|
+
const property2 = factory.updatePropertyDeclaration(declaration, modifiers, fieldName, declaration.questionToken || declaration.exclamationToken, type, declaration.initializer);
|
|
140535
|
+
changeTracker.replaceNode(file, declaration, property2);
|
|
140536
140536
|
}
|
|
140537
140537
|
function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
|
|
140538
140538
|
let assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
|
|
@@ -140704,8 +140704,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
140704
140704
|
}
|
|
140705
140705
|
function addDefiniteAssignmentAssertion(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) {
|
|
140706
140706
|
suppressLeadingAndTrailingTrivia(propertyDeclaration);
|
|
140707
|
-
const
|
|
140708
|
-
changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration,
|
|
140707
|
+
const property2 = factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.modifiers, propertyDeclaration.name, factory.createToken(54), propertyDeclaration.type, propertyDeclaration.initializer);
|
|
140708
|
+
changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property2);
|
|
140709
140709
|
}
|
|
140710
140710
|
function getActionForAddMissingUndefinedType(context, info) {
|
|
140711
140711
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addUndefinedType(t, context.sourceFile, info));
|
|
@@ -140733,8 +140733,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
140733
140733
|
}
|
|
140734
140734
|
function addInitializer(changeTracker, propertyDeclarationSourceFile, propertyDeclaration, initializer) {
|
|
140735
140735
|
suppressLeadingAndTrailingTrivia(propertyDeclaration);
|
|
140736
|
-
const
|
|
140737
|
-
changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration,
|
|
140736
|
+
const property2 = factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.modifiers, propertyDeclaration.name, propertyDeclaration.questionToken, propertyDeclaration.type, initializer);
|
|
140737
|
+
changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property2);
|
|
140738
140738
|
}
|
|
140739
140739
|
function getInitializer(checker, propertyDeclaration) {
|
|
140740
140740
|
return getDefaultValueFromType(checker, checker.getTypeFromTypeNode(propertyDeclaration.type));
|
|
@@ -144099,8 +144099,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
144099
144099
|
const type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, expression);
|
|
144100
144100
|
const properties = type && type.properties;
|
|
144101
144101
|
if (properties) {
|
|
144102
|
-
properties.forEach((
|
|
144103
|
-
membersDeclaredBySpreadAssignment.add(
|
|
144102
|
+
properties.forEach((property2) => {
|
|
144103
|
+
membersDeclaredBySpreadAssignment.add(property2.name);
|
|
144104
144104
|
});
|
|
144105
144105
|
}
|
|
144106
144106
|
}
|
|
@@ -158379,9 +158379,9 @@ var require_cjs = __commonJS((exports) => {
|
|
|
158379
158379
|
}
|
|
158380
158380
|
case "[":
|
|
158381
158381
|
clearStateChar();
|
|
158382
|
-
const [
|
|
158382
|
+
const [src2, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(pattern, i);
|
|
158383
158383
|
if (consumed) {
|
|
158384
|
-
re +=
|
|
158384
|
+
re += src2;
|
|
158385
158385
|
uflag = uflag || needUflag;
|
|
158386
158386
|
i += consumed - 1;
|
|
158387
158387
|
hasMagic = hasMagic || magic;
|
|
@@ -200336,15 +200336,15 @@ var require_ts_morph = __commonJS((exports) => {
|
|
|
200336
200336
|
return this._context.project;
|
|
200337
200337
|
}
|
|
200338
200338
|
getNodeProperty(propertyName) {
|
|
200339
|
-
const
|
|
200340
|
-
if (
|
|
200339
|
+
const property2 = this.compilerNode[propertyName];
|
|
200340
|
+
if (property2 == null)
|
|
200341
200341
|
return;
|
|
200342
|
-
else if (
|
|
200343
|
-
return
|
|
200344
|
-
else if (isNode(
|
|
200345
|
-
return this._getNodeFromCompilerNode(
|
|
200342
|
+
else if (property2 instanceof Array)
|
|
200343
|
+
return property2.map((p) => isNode(p) ? this._getNodeFromCompilerNode(p) : p);
|
|
200344
|
+
else if (isNode(property2))
|
|
200345
|
+
return this._getNodeFromCompilerNode(property2);
|
|
200346
200346
|
else
|
|
200347
|
-
return
|
|
200347
|
+
return property2;
|
|
200348
200348
|
function isNode(value) {
|
|
200349
200349
|
return typeof value.kind === "number" && typeof value.pos === "number" && typeof value.end === "number";
|
|
200350
200350
|
}
|
|
@@ -207545,7 +207545,7 @@ var require_ts_morph = __commonJS((exports) => {
|
|
|
207545
207545
|
kind: exports.StructureKind.Class,
|
|
207546
207546
|
ctors: this.getConstructors().filter((ctor) => isAmbient || !ctor.isOverload()).map((ctor) => ctor.getStructure()),
|
|
207547
207547
|
methods: this.getMethods().filter((method) => isAmbient || !method.isOverload()).map((method) => method.getStructure()),
|
|
207548
|
-
properties: this.getProperties().map((
|
|
207548
|
+
properties: this.getProperties().map((property2) => property2.getStructure()),
|
|
207549
207549
|
extends: getExtends ? getExtends.getText() : undefined,
|
|
207550
207550
|
getAccessors: this.getGetAccessors().map((getAccessor) => getAccessor.getStructure()),
|
|
207551
207551
|
setAccessors: this.getSetAccessors().map((accessor) => accessor.getStructure())
|
|
@@ -213885,7 +213885,7 @@ var require_ts_morph = __commonJS((exports) => {
|
|
|
213885
213885
|
exports.setScopeForNode = setScopeForNode;
|
|
213886
213886
|
});
|
|
213887
213887
|
|
|
213888
|
-
// /export/htdocs/p/framework/node_modules/postgres-array/index.js
|
|
213888
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/node_modules/postgres-array/index.js
|
|
213889
213889
|
var require_postgres_array = __commonJS((exports) => {
|
|
213890
213890
|
var identity = function(value) {
|
|
213891
213891
|
return value;
|
|
@@ -213981,7 +213981,7 @@ var require_postgres_array = __commonJS((exports) => {
|
|
|
213981
213981
|
}
|
|
213982
213982
|
});
|
|
213983
213983
|
|
|
213984
|
-
// /export/htdocs/p/framework/node_modules/pg-types/lib/arrayParser.js
|
|
213984
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/lib/arrayParser.js
|
|
213985
213985
|
var require_arrayParser = __commonJS((exports, module) => {
|
|
213986
213986
|
var array = require_postgres_array();
|
|
213987
213987
|
module.exports = {
|
|
@@ -213995,7 +213995,7 @@ var require_arrayParser = __commonJS((exports, module) => {
|
|
|
213995
213995
|
};
|
|
213996
213996
|
});
|
|
213997
213997
|
|
|
213998
|
-
// /export/htdocs/p/framework/node_modules/postgres-date/index.js
|
|
213998
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/node_modules/postgres-date/index.js
|
|
213999
213999
|
var require_postgres_date = __commonJS((exports, module) => {
|
|
214000
214000
|
var getDate = function(isoDate) {
|
|
214001
214001
|
var matches = DATE.exec(isoDate);
|
|
@@ -214097,7 +214097,7 @@ var require_mutable = __commonJS((exports, module) => {
|
|
|
214097
214097
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
214098
214098
|
});
|
|
214099
214099
|
|
|
214100
|
-
// /export/htdocs/p/framework/node_modules/postgres-interval/index.js
|
|
214100
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/node_modules/postgres-interval/index.js
|
|
214101
214101
|
var require_postgres_interval = __commonJS((exports, module) => {
|
|
214102
214102
|
var PostgresInterval = function(raw) {
|
|
214103
214103
|
if (!(this instanceof PostgresInterval)) {
|
|
@@ -214114,18 +214114,18 @@ var require_postgres_interval = __commonJS((exports, module) => {
|
|
|
214114
214114
|
return {};
|
|
214115
214115
|
var matches = INTERVAL.exec(interval);
|
|
214116
214116
|
var isNegative = matches[8] === "-";
|
|
214117
|
-
return Object.keys(positions).reduce(function(parsed,
|
|
214118
|
-
var position = positions[
|
|
214117
|
+
return Object.keys(positions).reduce(function(parsed, property3) {
|
|
214118
|
+
var position = positions[property3];
|
|
214119
214119
|
var value = matches[position];
|
|
214120
214120
|
if (!value)
|
|
214121
214121
|
return parsed;
|
|
214122
|
-
value =
|
|
214122
|
+
value = property3 === "milliseconds" ? parseMilliseconds(value) : parseInt(value, 10);
|
|
214123
214123
|
if (!value)
|
|
214124
214124
|
return parsed;
|
|
214125
|
-
if (isNegative && ~negatives.indexOf(
|
|
214125
|
+
if (isNegative && ~negatives.indexOf(property3)) {
|
|
214126
214126
|
value *= -1;
|
|
214127
214127
|
}
|
|
214128
|
-
parsed[
|
|
214128
|
+
parsed[property3] = value;
|
|
214129
214129
|
return parsed;
|
|
214130
214130
|
}, {});
|
|
214131
214131
|
};
|
|
@@ -214139,12 +214139,12 @@ var require_postgres_interval = __commonJS((exports, module) => {
|
|
|
214139
214139
|
}
|
|
214140
214140
|
if (filtered.length === 0)
|
|
214141
214141
|
return "0";
|
|
214142
|
-
return filtered.map(function(
|
|
214143
|
-
var value = this[
|
|
214144
|
-
if (
|
|
214142
|
+
return filtered.map(function(property3) {
|
|
214143
|
+
var value = this[property3] || 0;
|
|
214144
|
+
if (property3 === "seconds" && this.milliseconds) {
|
|
214145
214145
|
value = (value + this.milliseconds / 1000).toFixed(6).replace(/\.?0+$/, "");
|
|
214146
214146
|
}
|
|
214147
|
-
return value + " " +
|
|
214147
|
+
return value + " " + property3;
|
|
214148
214148
|
}, this).join(" ");
|
|
214149
214149
|
};
|
|
214150
214150
|
var propertiesISOEquivalent = {
|
|
@@ -214161,12 +214161,12 @@ var require_postgres_interval = __commonJS((exports, module) => {
|
|
|
214161
214161
|
var datePart = dateProperties.map(buildProperty, this).join("");
|
|
214162
214162
|
var timePart = timeProperties.map(buildProperty, this).join("");
|
|
214163
214163
|
return "P" + datePart + "T" + timePart;
|
|
214164
|
-
function buildProperty(
|
|
214165
|
-
var value = this[
|
|
214166
|
-
if (
|
|
214164
|
+
function buildProperty(property3) {
|
|
214165
|
+
var value = this[property3] || 0;
|
|
214166
|
+
if (property3 === "seconds" && this.milliseconds) {
|
|
214167
214167
|
value = (value + this.milliseconds / 1000).toFixed(6).replace(/0+$/, "");
|
|
214168
214168
|
}
|
|
214169
|
-
return value + propertiesISOEquivalent[
|
|
214169
|
+
return value + propertiesISOEquivalent[property3];
|
|
214170
214170
|
}
|
|
214171
214171
|
};
|
|
214172
214172
|
var NUMBER = "([+-]?\\d+)";
|
|
@@ -214189,7 +214189,7 @@ var require_postgres_interval = __commonJS((exports, module) => {
|
|
|
214189
214189
|
var negatives = ["hours", "minutes", "seconds", "milliseconds"];
|
|
214190
214190
|
});
|
|
214191
214191
|
|
|
214192
|
-
// /export/htdocs/p/framework/node_modules/postgres-bytea/index.js
|
|
214192
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/node_modules/postgres-bytea/index.js
|
|
214193
214193
|
var require_postgres_bytea = __commonJS((exports, module) => {
|
|
214194
214194
|
module.exports = function parseBytea(input) {
|
|
214195
214195
|
if (/^\\x/.test(input)) {
|
|
@@ -214221,7 +214221,7 @@ var require_postgres_bytea = __commonJS((exports, module) => {
|
|
|
214221
214221
|
};
|
|
214222
214222
|
});
|
|
214223
214223
|
|
|
214224
|
-
// /export/htdocs/p/framework/node_modules/pg-types/lib/textParsers.js
|
|
214224
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/lib/textParsers.js
|
|
214225
214225
|
var require_textParsers = __commonJS((exports, module) => {
|
|
214226
214226
|
var allowNull = function(fn) {
|
|
214227
214227
|
return function nullAllowed(value) {
|
|
@@ -214501,7 +214501,7 @@ var require_pg_int8 = __commonJS((exports, module) => {
|
|
|
214501
214501
|
module.exports = readInt8;
|
|
214502
214502
|
});
|
|
214503
214503
|
|
|
214504
|
-
// /export/htdocs/p/framework/node_modules/pg-types/lib/binaryParsers.js
|
|
214504
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/lib/binaryParsers.js
|
|
214505
214505
|
var require_binaryParsers = __commonJS((exports, module) => {
|
|
214506
214506
|
var parseInt64 = require_pg_int8();
|
|
214507
214507
|
var parseBits = function(data, bits, offset, invert, callback) {
|
|
@@ -214700,7 +214700,7 @@ var require_binaryParsers = __commonJS((exports, module) => {
|
|
|
214700
214700
|
};
|
|
214701
214701
|
});
|
|
214702
214702
|
|
|
214703
|
-
// /export/htdocs/p/framework/node_modules/pg-types/lib/builtins.js
|
|
214703
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/lib/builtins.js
|
|
214704
214704
|
var require_builtins = __commonJS((exports, module) => {
|
|
214705
214705
|
module.exports = {
|
|
214706
214706
|
BOOL: 16,
|
|
@@ -214766,7 +214766,7 @@ var require_builtins = __commonJS((exports, module) => {
|
|
|
214766
214766
|
};
|
|
214767
214767
|
});
|
|
214768
214768
|
|
|
214769
|
-
// /export/htdocs/p/framework/node_modules/pg-types/index.js
|
|
214769
|
+
// /export/htdocs/p/framework/node_modules/pg/node_modules/pg-types/index.js
|
|
214770
214770
|
var require_pg_types = __commonJS((exports) => {
|
|
214771
214771
|
var noParse = function(val) {
|
|
214772
214772
|
return String(val);
|
|
@@ -215565,12 +215565,12 @@ var require_result = __commonJS((exports, module) => {
|
|
|
215565
215565
|
var require_query = __commonJS((exports, module) => {
|
|
215566
215566
|
var { EventEmitter } = import.meta.require("events");
|
|
215567
215567
|
var Result = require_result();
|
|
215568
|
-
var
|
|
215568
|
+
var utils10 = require_utils5();
|
|
215569
215569
|
|
|
215570
215570
|
class Query3 extends EventEmitter {
|
|
215571
215571
|
constructor(config, values, callback) {
|
|
215572
215572
|
super();
|
|
215573
|
-
config =
|
|
215573
|
+
config = utils10.normalizeQueryConfig(config, values, callback);
|
|
215574
215574
|
this.text = config.text;
|
|
215575
215575
|
this.values = config.values;
|
|
215576
215576
|
this.rows = config.rows;
|
|
@@ -215721,7 +215721,7 @@ var require_query = __commonJS((exports, module) => {
|
|
|
215721
215721
|
statement: this.name,
|
|
215722
215722
|
values: this.values,
|
|
215723
215723
|
binary: this.binary,
|
|
215724
|
-
valueMapper:
|
|
215724
|
+
valueMapper: utils10.prepareValue
|
|
215725
215725
|
});
|
|
215726
215726
|
} catch (err) {
|
|
215727
215727
|
this.handleError(err, connection);
|
|
@@ -217025,7 +217025,7 @@ var require_lib = __commonJS((exports, module) => {
|
|
|
217025
217025
|
// /export/htdocs/p/framework/node_modules/pg/lib/client.js
|
|
217026
217026
|
var require_client = __commonJS((exports, module) => {
|
|
217027
217027
|
var EventEmitter = import.meta.require("events").EventEmitter;
|
|
217028
|
-
var
|
|
217028
|
+
var utils10 = require_utils5();
|
|
217029
217029
|
var sasl = require_sasl();
|
|
217030
217030
|
var TypeOverrides = require_type_overrides();
|
|
217031
217031
|
var ConnectionParameters = require_connection_parameters();
|
|
@@ -217391,10 +217391,10 @@ var require_client = __commonJS((exports, module) => {
|
|
|
217391
217391
|
return this._types.getTypeParser(oid, format);
|
|
217392
217392
|
}
|
|
217393
217393
|
escapeIdentifier(str) {
|
|
217394
|
-
return
|
|
217394
|
+
return utils10.escapeIdentifier(str);
|
|
217395
217395
|
}
|
|
217396
217396
|
escapeLiteral(str) {
|
|
217397
|
-
return
|
|
217397
|
+
return utils10.escapeLiteral(str);
|
|
217398
217398
|
}
|
|
217399
217399
|
_pulseQueryQueue() {
|
|
217400
217400
|
if (this.readyForQuery === true) {
|
|
@@ -217896,10 +217896,10 @@ var require_pg_pool = __commonJS((exports, module) => {
|
|
|
217896
217896
|
var require_query2 = __commonJS((exports, module) => {
|
|
217897
217897
|
var EventEmitter = import.meta.require("events").EventEmitter;
|
|
217898
217898
|
var util = import.meta.require("util");
|
|
217899
|
-
var
|
|
217899
|
+
var utils10 = require_utils5();
|
|
217900
217900
|
var NativeQuery = module.exports = function(config, values, callback) {
|
|
217901
217901
|
EventEmitter.call(this);
|
|
217902
|
-
config =
|
|
217902
|
+
config = utils10.normalizeQueryConfig(config, values, callback);
|
|
217903
217903
|
this.text = config.text;
|
|
217904
217904
|
this.values = config.values;
|
|
217905
217905
|
this.name = config.name;
|
|
@@ -217998,7 +217998,7 @@ var require_query2 = __commonJS((exports, module) => {
|
|
|
217998
217998
|
console.error("You supplied %s (%s)", this.name, this.name.length);
|
|
217999
217999
|
console.error("This can cause conflicts and silent errors executing queries");
|
|
218000
218000
|
}
|
|
218001
|
-
var values = (this.values || []).map(
|
|
218001
|
+
var values = (this.values || []).map(utils10.prepareValue);
|
|
218002
218002
|
if (client.namedQueries[this.name]) {
|
|
218003
218003
|
if (this.text && client.namedQueries[this.name] !== this.text) {
|
|
218004
218004
|
const err = new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);
|
|
@@ -218017,7 +218017,7 @@ var require_query2 = __commonJS((exports, module) => {
|
|
|
218017
218017
|
const err = new Error("Query values must be an array");
|
|
218018
218018
|
return after(err);
|
|
218019
218019
|
}
|
|
218020
|
-
var vals = this.values.map(
|
|
218020
|
+
var vals = this.values.map(utils10.prepareValue);
|
|
218021
218021
|
client.native.query(this.text, vals, after);
|
|
218022
218022
|
} else {
|
|
218023
218023
|
client.native.query(this.text, after);
|
|
@@ -218318,6 +218318,12 @@ var require_lib2 = __commonJS((exports, module) => {
|
|
|
218318
218318
|
}
|
|
218319
218319
|
});
|
|
218320
218320
|
|
|
218321
|
+
// ../../node_modul
|
|
218322
|
+
var ENTITIES = "cheetah:entities";
|
|
218323
|
+
var PROPERTIES = "cheetah:properties";
|
|
218324
|
+
var PROPERTIES_METADATA = "cheetah:properties:metadata";
|
|
218325
|
+
var PROPERTIES_RELATIONS = "cheetah:properties:relations";
|
|
218326
|
+
|
|
218321
218327
|
// /export/htdocs/p/framework/node_modules/reflect-metadata/Reflect.js
|
|
218322
218328
|
/*! *****************************************************************************
|
|
218323
218329
|
Copyright (C) Microsoft. All rights reserved.
|
|
@@ -219094,6 +219100,7 @@ class Provider {
|
|
|
219094
219100
|
this.type = ProviderType2.PROVIDER;
|
|
219095
219101
|
this.deps = [];
|
|
219096
219102
|
this.scope = ProviderScope2.SINGLETON;
|
|
219103
|
+
this.children = [];
|
|
219097
219104
|
this.provide = token;
|
|
219098
219105
|
this.useClass = token;
|
|
219099
219106
|
Object.assign(this, options);
|
|
@@ -219130,6 +219137,9 @@ class Provider {
|
|
|
219130
219137
|
clone() {
|
|
219131
219138
|
return new (classOf(this))(this._provide, this);
|
|
219132
219139
|
}
|
|
219140
|
+
isChild() {
|
|
219141
|
+
return !!this.parent;
|
|
219142
|
+
}
|
|
219133
219143
|
}
|
|
219134
219144
|
|
|
219135
219145
|
// /export/htdocs/p/framework/packages/core/dist/commons/registries/ProviderControl.js
|
|
@@ -219485,6 +219495,9 @@ var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
|
219485
219495
|
function Controller(options) {
|
|
219486
219496
|
return (target) => {
|
|
219487
219497
|
registerController({ provide: target, ...options });
|
|
219498
|
+
options?.children && options.children.forEach((child) => {
|
|
219499
|
+
registerController({ provide: child, parent: target });
|
|
219500
|
+
});
|
|
219488
219501
|
};
|
|
219489
219502
|
}
|
|
219490
219503
|
// /export/htdocs/p/framework/packages/core/dist/commons/decorators/http.decorators.js
|
|
@@ -219514,7 +219527,7 @@ var Body = createParamDecorator((context, data) => data ? context.body[data] : c
|
|
|
219514
219527
|
var Query = createParamDecorator((context, data) => data ? context.query[data] : context.query || {});
|
|
219515
219528
|
var Param = createParamDecorator((context, data) => data ? context.param[data] : null);
|
|
219516
219529
|
var Req = createParamDecorator((context) => context.req);
|
|
219517
|
-
var Headers = createParamDecorator((context, data) => data ? context.headers
|
|
219530
|
+
var Headers = createParamDecorator((context, data) => data ? context.headers[data] : context.headers || {});
|
|
219518
219531
|
var Locals = createParamDecorator((context) => context.locals || {});
|
|
219519
219532
|
var Get = createMethodDecorator("GET");
|
|
219520
219533
|
var Post = createMethodDecorator("POST");
|
|
@@ -221445,7 +221458,7 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
|
|
|
221445
221458
|
resolveControllers() {
|
|
221446
221459
|
if (!this.settings)
|
|
221447
221460
|
return {};
|
|
221448
|
-
const controllers = GlobalProvider.getByType(ProviderType2.CONTROLLER);
|
|
221461
|
+
const controllers = GlobalProvider.getByType(ProviderType2.CONTROLLER).filter((controller2) => !controller2.isChild());
|
|
221449
221462
|
let hydrateRoute = new Map;
|
|
221450
221463
|
for (const controller2 of controllers) {
|
|
221451
221464
|
let routes = Metadata.get(CONTROLLER_ROUTES, controller2.token);
|
|
@@ -221477,11 +221490,68 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
|
|
|
221477
221490
|
}))
|
|
221478
221491
|
]);
|
|
221479
221492
|
}
|
|
221493
|
+
if (controller2.children) {
|
|
221494
|
+
const childrenRoutes = this.resolveChildrenRoutes(controller2.path ?? "", controller2.children, controllerMiddleware);
|
|
221495
|
+
childrenRoutes.forEach((route) => {
|
|
221496
|
+
hydrateRoute.set(route.method.toLowerCase(), [
|
|
221497
|
+
...hydrateRoute.get(route.method.toLowerCase()) || [],
|
|
221498
|
+
route
|
|
221499
|
+
]);
|
|
221500
|
+
});
|
|
221501
|
+
}
|
|
221480
221502
|
}
|
|
221481
221503
|
hydrateRoute.forEach((method) => {
|
|
221482
221504
|
method.forEach((route) => this.router.add(route.method.toLowerCase(), route.path, route));
|
|
221483
221505
|
});
|
|
221484
221506
|
}
|
|
221507
|
+
resolveChildrenRoutes(parentPath, children, parentMiddlewares) {
|
|
221508
|
+
let childrenRoutes = [];
|
|
221509
|
+
for (const childController of children) {
|
|
221510
|
+
let controller2 = GlobalProvider.get(childController);
|
|
221511
|
+
if (!controller2)
|
|
221512
|
+
throw new Error(`Child ${childController} not is an controller. Please, check the providers configuration.`);
|
|
221513
|
+
let childRoutes = Metadata.get(CONTROLLER_ROUTES, controller2.token);
|
|
221514
|
+
const childMiddlewares = Metadata.get(CONTROLLER_MIDDLEWARES, controller2.token) || [];
|
|
221515
|
+
if (childRoutes.length === 0)
|
|
221516
|
+
continue;
|
|
221517
|
+
if (parentPath) {
|
|
221518
|
+
childRoutes = childRoutes.map((route) => {
|
|
221519
|
+
let controllerPath = controller2?.path ?? "";
|
|
221520
|
+
if (controllerPath.endsWith("/")) {
|
|
221521
|
+
controllerPath = controller2.path.slice(0, -1);
|
|
221522
|
+
}
|
|
221523
|
+
if (!controllerPath.startsWith("/")) {
|
|
221524
|
+
controllerPath = `/${controller2.path}`;
|
|
221525
|
+
}
|
|
221526
|
+
route.path = `${parentPath}${controllerPath ?? ""}${route.path}`;
|
|
221527
|
+
if (route.path.endsWith("/")) {
|
|
221528
|
+
route.path = route.path.slice(0, -1);
|
|
221529
|
+
}
|
|
221530
|
+
if (!route.path.startsWith("/")) {
|
|
221531
|
+
route.path = `/${route.path}`;
|
|
221532
|
+
}
|
|
221533
|
+
return route;
|
|
221534
|
+
});
|
|
221535
|
+
}
|
|
221536
|
+
for (const method of Object.keys(HttpMethod).map((key) => HttpMethod[key])) {
|
|
221537
|
+
if (!childRoutes.some((route) => route.method.toLowerCase() === method))
|
|
221538
|
+
continue;
|
|
221539
|
+
childrenRoutes = [
|
|
221540
|
+
...childrenRoutes,
|
|
221541
|
+
...childRoutes.filter((route) => route.method.toLowerCase() === method).map((route) => ({
|
|
221542
|
+
...route,
|
|
221543
|
+
provider: controller2.token,
|
|
221544
|
+
route,
|
|
221545
|
+
middlewares: [...parentMiddlewares, ...childMiddlewares, ...Metadata.get(ROUTE_MIDDLEWARES, controller2.token, route.methodName) || []]
|
|
221546
|
+
}))
|
|
221547
|
+
];
|
|
221548
|
+
}
|
|
221549
|
+
if (controller2.children) {
|
|
221550
|
+
childrenRoutes = [...childrenRoutes, ...this.resolveChildrenRoutes(controller2.path, controller2.children, childMiddlewares)];
|
|
221551
|
+
}
|
|
221552
|
+
}
|
|
221553
|
+
return childrenRoutes;
|
|
221554
|
+
}
|
|
221485
221555
|
ensureProvider(token) {
|
|
221486
221556
|
if (!this.container.has(token) && GlobalProvider.has(token)) {
|
|
221487
221557
|
this.container.addProvider(token);
|
|
@@ -221716,7 +221786,7 @@ class LocalsContainer extends Map {
|
|
|
221716
221786
|
var DESIGN_PARAM_TYPES = "design:paramtypes";
|
|
221717
221787
|
var DESIGN_TYPE = "design:type";
|
|
221718
221788
|
var DESIGN_RETURN_TYPE = "design:returntype";
|
|
221719
|
-
var
|
|
221789
|
+
var PROPERTIES2 = new Map;
|
|
221720
221790
|
|
|
221721
221791
|
class Metadata {
|
|
221722
221792
|
static get(key, target, propertyKey) {
|
|
@@ -221754,11 +221824,11 @@ class Metadata {
|
|
|
221754
221824
|
return this.set(DESIGN_PARAM_TYPES, value, target.prototype, propertyKey);
|
|
221755
221825
|
}
|
|
221756
221826
|
static set(key, value, target, propertyKey) {
|
|
221757
|
-
const targets =
|
|
221827
|
+
const targets = PROPERTIES2.has(key) ? PROPERTIES2.get(key) || [] : [];
|
|
221758
221828
|
const classConstructor = classOf(target);
|
|
221759
221829
|
if (targets.indexOf(classConstructor) === -1) {
|
|
221760
221830
|
targets.push(classConstructor);
|
|
221761
|
-
|
|
221831
|
+
PROPERTIES2.set(key, targets);
|
|
221762
221832
|
}
|
|
221763
221833
|
Reflect.defineMetadata(key, value, classOf(target), propertyKey);
|
|
221764
221834
|
}
|
|
@@ -221772,7 +221842,7 @@ class Metadata {
|
|
|
221772
221842
|
return Reflect.getMetadata(ROUTE_PARAM, target.constructor, propertyKey);
|
|
221773
221843
|
}
|
|
221774
221844
|
}
|
|
221775
|
-
Metadata.getTargetsFromPropertyKey = (metadataKey) =>
|
|
221845
|
+
Metadata.getTargetsFromPropertyKey = (metadataKey) => PROPERTIES2.has(metadataKey) ? PROPERTIES2.get(metadataKey) || [] : [];
|
|
221776
221846
|
// /export/htdocs/p/framework/packages/core/dist/domain/http-method.js
|
|
221777
221847
|
var HttpMethod;
|
|
221778
221848
|
(function(HttpMethod2) {
|
|
@@ -221879,6 +221949,68 @@ class HttpException {
|
|
|
221879
221949
|
// /export/htdocs/p/framework/packages/core/dist/Cheetah.js
|
|
221880
221950
|
import process3 from "process";
|
|
221881
221951
|
var parseUrl2 = require_parseurl_fast();
|
|
221952
|
+
|
|
221953
|
+
class Cheetah {
|
|
221954
|
+
constructor(config = {}) {
|
|
221955
|
+
this.config = config;
|
|
221956
|
+
this.router = new memoirist_default;
|
|
221957
|
+
this.injector = createInjector();
|
|
221958
|
+
this.fetch = (request, server) => this.fetcher(request, server);
|
|
221959
|
+
this.catcher = (error) => {
|
|
221960
|
+
if (error instanceof HttpException) {
|
|
221961
|
+
return new Response(JSON.stringify({
|
|
221962
|
+
message: error.getResponse(),
|
|
221963
|
+
statusCode: error.getStatus()
|
|
221964
|
+
}), {
|
|
221965
|
+
status: error.statusCode,
|
|
221966
|
+
headers: { "Content-Type": "application/json" }
|
|
221967
|
+
});
|
|
221968
|
+
}
|
|
221969
|
+
return new Response(error.message, { status: 500 });
|
|
221970
|
+
};
|
|
221971
|
+
}
|
|
221972
|
+
use(plugin) {
|
|
221973
|
+
if (!this.config.providers) {
|
|
221974
|
+
this.config.providers = [];
|
|
221975
|
+
}
|
|
221976
|
+
for (const provider4 of plugin.config.exports || []) {
|
|
221977
|
+
this.config.providers.push(provider4);
|
|
221978
|
+
}
|
|
221979
|
+
return this;
|
|
221980
|
+
}
|
|
221981
|
+
useLogger(provider4) {
|
|
221982
|
+
registerProvider({ provide: LoggerService, useClass: provider4 });
|
|
221983
|
+
return this;
|
|
221984
|
+
}
|
|
221985
|
+
async listen(port = 3000) {
|
|
221986
|
+
process3.on("SIGTERM", () => this.injector.callHook(EventType.OnApplicationShutdown));
|
|
221987
|
+
this.injector.loadModule(createContainer(), this.config, this.router);
|
|
221988
|
+
this.createHttpServer(port);
|
|
221989
|
+
}
|
|
221990
|
+
getInjector() {
|
|
221991
|
+
return this.injector;
|
|
221992
|
+
}
|
|
221993
|
+
createHttpServer(port) {
|
|
221994
|
+
this.server = Bun.serve({ port, fetch: this.fetch, error: this.catcher });
|
|
221995
|
+
console.log(`Server running on port ${port}`);
|
|
221996
|
+
}
|
|
221997
|
+
async fetcher(request, server) {
|
|
221998
|
+
const urlParsed = parseUrl2(request);
|
|
221999
|
+
const context = await Context.createFromRequest(urlParsed, request, server);
|
|
222000
|
+
this.injector.callHook(EventType.OnRequest, { context });
|
|
222001
|
+
const local = new LocalsContainer;
|
|
222002
|
+
const route = this.router.find(request.method.toLowerCase(), urlParsed.path);
|
|
222003
|
+
if (!route) {
|
|
222004
|
+
throw new HttpException("Method not allowed", 404);
|
|
222005
|
+
}
|
|
222006
|
+
context.param = route.params;
|
|
222007
|
+
local.set(Context, context);
|
|
222008
|
+
return RouteExecutor.executeRoute(route.store, this.injector, context, local);
|
|
222009
|
+
}
|
|
222010
|
+
close(closeActiveConnections = false) {
|
|
222011
|
+
this.server.stop(closeActiveConnections);
|
|
222012
|
+
}
|
|
222013
|
+
}
|
|
221882
222014
|
// /export/htdocs/p/framework/packages/core/dist/events/on-event.js
|
|
221883
222015
|
var EventType;
|
|
221884
222016
|
(function(EventType2) {
|
|
@@ -222945,7 +223077,7 @@ Context4 = Context_12 = __decorate6([
|
|
|
222945
223077
|
var DESIGN_PARAM_TYPES2 = "design:paramtypes";
|
|
222946
223078
|
var DESIGN_TYPE2 = "design:type";
|
|
222947
223079
|
var DESIGN_RETURN_TYPE2 = "design:returntype";
|
|
222948
|
-
var
|
|
223080
|
+
var PROPERTIES3 = new Map;
|
|
222949
223081
|
|
|
222950
223082
|
class Metadata3 {
|
|
222951
223083
|
static get(key, target, propertyKey) {
|
|
@@ -222983,11 +223115,11 @@ class Metadata3 {
|
|
|
222983
223115
|
return this.set(DESIGN_PARAM_TYPES2, value, target.prototype, propertyKey);
|
|
222984
223116
|
}
|
|
222985
223117
|
static set(key, value, target, propertyKey) {
|
|
222986
|
-
const targets =
|
|
223118
|
+
const targets = PROPERTIES3.has(key) ? PROPERTIES3.get(key) || [] : [];
|
|
222987
223119
|
const classConstructor = classOf(target);
|
|
222988
223120
|
if (targets.indexOf(classConstructor) === -1) {
|
|
222989
223121
|
targets.push(classConstructor);
|
|
222990
|
-
|
|
223122
|
+
PROPERTIES3.set(key, targets);
|
|
222991
223123
|
}
|
|
222992
223124
|
Reflect.defineMetadata(key, value, classOf(target), propertyKey);
|
|
222993
223125
|
}
|
|
@@ -223001,7 +223133,7 @@ class Metadata3 {
|
|
|
223001
223133
|
return Reflect.getMetadata(ROUTE_PARAM, target.constructor, propertyKey);
|
|
223002
223134
|
}
|
|
223003
223135
|
}
|
|
223004
|
-
Metadata3.getTargetsFromPropertyKey = (metadataKey) =>
|
|
223136
|
+
Metadata3.getTargetsFromPropertyKey = (metadataKey) => PROPERTIES3.has(metadataKey) ? PROPERTIES3.get(metadataKey) || [] : [];
|
|
223005
223137
|
// ../../node_modules/balanced-match/index.jsodules/minimat
|
|
223006
223138
|
var HttpMethod2;
|
|
223007
223139
|
(function(HttpMethod3) {
|
|
@@ -223087,68 +223219,6 @@ var RouteExecutor4 = new Router2;
|
|
|
223087
223219
|
// ../../node_modules/balanced-match/index.jsodu
|
|
223088
223220
|
import process4 from "process";
|
|
223089
223221
|
var parseUrl4 = require_parseurl_fast();
|
|
223090
|
-
|
|
223091
|
-
class Cheetah2 {
|
|
223092
|
-
constructor(config = {}) {
|
|
223093
|
-
this.config = config;
|
|
223094
|
-
this.router = new memoirist_default2;
|
|
223095
|
-
this.injector = createInjector();
|
|
223096
|
-
this.fetch = (request, server) => this.fetcher(request, server);
|
|
223097
|
-
this.catcher = (error) => {
|
|
223098
|
-
if (error instanceof HttpException) {
|
|
223099
|
-
return new Response(JSON.stringify({
|
|
223100
|
-
message: error.getResponse(),
|
|
223101
|
-
statusCode: error.getStatus()
|
|
223102
|
-
}), {
|
|
223103
|
-
status: error.statusCode,
|
|
223104
|
-
headers: { "Content-Type": "application/json" }
|
|
223105
|
-
});
|
|
223106
|
-
}
|
|
223107
|
-
return new Response(error.message, { status: 500 });
|
|
223108
|
-
};
|
|
223109
|
-
}
|
|
223110
|
-
use(plugin) {
|
|
223111
|
-
if (!this.config.providers) {
|
|
223112
|
-
this.config.providers = [];
|
|
223113
|
-
}
|
|
223114
|
-
for (const provider7 of plugin.config.exports || []) {
|
|
223115
|
-
this.config.providers.push(provider7);
|
|
223116
|
-
}
|
|
223117
|
-
return this;
|
|
223118
|
-
}
|
|
223119
|
-
useLogger(provider7) {
|
|
223120
|
-
registerProvider({ provide: LoggerService, useClass: provider7 });
|
|
223121
|
-
return this;
|
|
223122
|
-
}
|
|
223123
|
-
async listen(port = 3000) {
|
|
223124
|
-
process4.on("SIGTERM", () => this.injector.callHook(EventType.OnApplicationShutdown));
|
|
223125
|
-
this.injector.loadModule(createContainer(), this.config, this.router);
|
|
223126
|
-
this.createHttpServer(port);
|
|
223127
|
-
}
|
|
223128
|
-
getInjector() {
|
|
223129
|
-
return this.injector;
|
|
223130
|
-
}
|
|
223131
|
-
createHttpServer(port) {
|
|
223132
|
-
this.server = Bun.serve({ port, fetch: this.fetch, error: this.catcher });
|
|
223133
|
-
console.log(`Server running on port ${port}`);
|
|
223134
|
-
}
|
|
223135
|
-
async fetcher(request, server) {
|
|
223136
|
-
const urlParsed = parseUrl4(request);
|
|
223137
|
-
const context = await Context.createFromRequest(urlParsed, request, server);
|
|
223138
|
-
this.injector.callHook(EventType.OnRequest, { context });
|
|
223139
|
-
const local = new LocalsContainer;
|
|
223140
|
-
const route = this.router.find(request.method.toLowerCase(), urlParsed.path);
|
|
223141
|
-
if (!route) {
|
|
223142
|
-
throw new HttpException("Method not allowed", 404);
|
|
223143
|
-
}
|
|
223144
|
-
context.param = route.params;
|
|
223145
|
-
local.set(Context, context);
|
|
223146
|
-
return RouteExecutor4.executeRoute(route.store, this.injector, context, local);
|
|
223147
|
-
}
|
|
223148
|
-
close(closeActiveConnections = false) {
|
|
223149
|
-
this.server.stop(closeActiveConnections);
|
|
223150
|
-
}
|
|
223151
|
-
}
|
|
223152
223222
|
// ../../node_modules/balanced-match/index.jsodules/mini
|
|
223153
223223
|
var EventType2;
|
|
223154
223224
|
(function(EventType3) {
|
|
@@ -223231,6 +223301,14 @@ LoggerService3 = __decorate8([
|
|
|
223231
223301
|
Service(),
|
|
223232
223302
|
__metadata6("design:paramtypes", [InjectorService])
|
|
223233
223303
|
], LoggerService3);
|
|
223304
|
+
// ../../node_modules/balanced-match/
|
|
223305
|
+
function Entity(options) {
|
|
223306
|
+
return (target) => {
|
|
223307
|
+
const entities = Metadata3.get(ENTITIES, Reflect) || [];
|
|
223308
|
+
entities.push({ target, options });
|
|
223309
|
+
Metadata3.set(ENTITIES, entities, Reflect);
|
|
223310
|
+
};
|
|
223311
|
+
}
|
|
223234
223312
|
// ../../node_m
|
|
223235
223313
|
function getDefaultLength(type) {
|
|
223236
223314
|
if (type === "String") {
|
|
@@ -223248,6 +223326,63 @@ function getDefaultLength(type) {
|
|
|
223248
223326
|
return 255;
|
|
223249
223327
|
}
|
|
223250
223328
|
|
|
223329
|
+
// ../../node_modules/balanced-match/in
|
|
223330
|
+
function Property(options) {
|
|
223331
|
+
return (target, propertyKey) => {
|
|
223332
|
+
const properties = Metadata.get(PROPERTIES, target.constructor) || [];
|
|
223333
|
+
const type = Metadata.getType(target, propertyKey);
|
|
223334
|
+
const length = options && options.length || getDefaultLength(type.name);
|
|
223335
|
+
options = { length, ...options };
|
|
223336
|
+
properties.push({ propertyKey, options });
|
|
223337
|
+
Metadata.set(PROPERTIES, properties, target.constructor);
|
|
223338
|
+
if (options.isPrimary) {
|
|
223339
|
+
const indexes = Metadata.get("indexes", target.constructor) || [];
|
|
223340
|
+
indexes.push({ name: `[TABLE]_pkey`, properties: [propertyKey] });
|
|
223341
|
+
Metadata.set("indexes", indexes, target.constructor);
|
|
223342
|
+
}
|
|
223343
|
+
properties.forEach((property) => {
|
|
223344
|
+
const types = Metadata.get(PROPERTIES_METADATA, target.constructor) || {};
|
|
223345
|
+
const type2 = Metadata.getType(target, property.propertyKey);
|
|
223346
|
+
types[property.propertyKey] = { type: type2, options: property.options };
|
|
223347
|
+
Metadata.set(PROPERTIES_METADATA, types, target.constructor);
|
|
223348
|
+
});
|
|
223349
|
+
};
|
|
223350
|
+
}
|
|
223351
|
+
// ../../node_modules/balanced-match/index
|
|
223352
|
+
function PrimaryKey(options) {
|
|
223353
|
+
const isPrimary = true;
|
|
223354
|
+
return Property({ ...options, isPrimary, unique: true });
|
|
223355
|
+
}
|
|
223356
|
+
// ../../node_modules/balanced-match/in
|
|
223357
|
+
function OneToMany(entity, fkKey) {
|
|
223358
|
+
return (target, propertyKey) => {
|
|
223359
|
+
const existing = Metadata.get(PROPERTIES_RELATIONS, target.constructor) || [];
|
|
223360
|
+
existing.push({ relation: "one-to-many", propertyKey, isRelation: true, entity, fkKey, type: Metadata.getType(target, propertyKey) });
|
|
223361
|
+
Metadata.set(PROPERTIES_RELATIONS, existing, target.constructor);
|
|
223362
|
+
};
|
|
223363
|
+
}
|
|
223364
|
+
function ManyToOne(entity) {
|
|
223365
|
+
return (target, propertyKey) => {
|
|
223366
|
+
const existing = Metadata.get(PROPERTIES_RELATIONS, target.constructor) || [];
|
|
223367
|
+
existing.push({ relation: "many-to-one", propertyKey, isRelation: true, entity, type: Metadata.getType(target, propertyKey) });
|
|
223368
|
+
Metadata.set(PROPERTIES_RELATIONS, existing, target.constructor);
|
|
223369
|
+
};
|
|
223370
|
+
}
|
|
223371
|
+
// ../../node_modules/balanced-match
|
|
223372
|
+
function Index(options) {
|
|
223373
|
+
return (target, propertyKey) => {
|
|
223374
|
+
const indexes = Metadata.get("indexes", target.constructor) || [];
|
|
223375
|
+
let index;
|
|
223376
|
+
if (options && options.properties) {
|
|
223377
|
+
const properties = options.properties;
|
|
223378
|
+
index = { name: `${properties.join("_")}_index`, properties: options.properties };
|
|
223379
|
+
} else {
|
|
223380
|
+
index = { name: `${propertyKey}_index`, properties: [propertyKey] };
|
|
223381
|
+
}
|
|
223382
|
+
indexes.push(index);
|
|
223383
|
+
Metadata.set("indexes", indexes, target.constructor);
|
|
223384
|
+
};
|
|
223385
|
+
}
|
|
223251
223386
|
// ../../node_modules/bal
|
|
223252
223387
|
class EntityStorage {
|
|
223253
223388
|
static instance;
|
|
@@ -223347,11 +223482,11 @@ class EntityStorage {
|
|
|
223347
223482
|
getFkKey(relationShip) {
|
|
223348
223483
|
if (typeof relationShip.fkKey === "undefined") {
|
|
223349
223484
|
const entity = this.entities.get(relationShip.entity());
|
|
223350
|
-
const
|
|
223351
|
-
if (!
|
|
223485
|
+
const property2 = Object.entries(entity.showProperties).find(([key, value]) => value.options.isPrimary === true);
|
|
223486
|
+
if (!property2) {
|
|
223352
223487
|
throw new Error(`Entity ${entity.tableName} does not have a primary key`);
|
|
223353
223488
|
}
|
|
223354
|
-
return
|
|
223489
|
+
return property2[0];
|
|
223355
223490
|
}
|
|
223356
223491
|
if (typeof relationShip.fkKey === "string") {
|
|
223357
223492
|
return relationShip.fkKey;
|
|
@@ -223365,181 +223500,6 @@ EntityStorage = __legacyDecorateClassTS([
|
|
|
223365
223500
|
__legacyMetadataTS("design:paramtypes", [])
|
|
223366
223501
|
], EntityStorage);
|
|
223367
223502
|
|
|
223368
|
-
// ../../node_modul
|
|
223369
|
-
var ENTITIES = "cheetah:entities";
|
|
223370
|
-
var PROPERTIES3 = "cheetah:properties";
|
|
223371
|
-
var PROPERTIES_METADATA = "cheetah:properties:metadata";
|
|
223372
|
-
var PROPERTIES_RELATIONS = "cheetah:properties:relations";
|
|
223373
|
-
|
|
223374
|
-
// ../../node_modules
|
|
223375
|
-
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
223376
|
-
class OrmService {
|
|
223377
|
-
storage2;
|
|
223378
|
-
allEntities = new Map;
|
|
223379
|
-
constructor(storage2, entityFile = undefined) {
|
|
223380
|
-
this.storage = storage2;
|
|
223381
|
-
console.log("Preparing entities...");
|
|
223382
|
-
const files = new import_ts_morph.Project({ skipLoadingLibFiles: true }).addSourceFilesAtPaths(entityFile ?? this.getSourceFilePaths());
|
|
223383
|
-
files.forEach((file) => {
|
|
223384
|
-
file.getClasses().forEach((classDeclaration) => {
|
|
223385
|
-
if (classDeclaration.getDecorator("Entity")) {
|
|
223386
|
-
const properties = classDeclaration.getProperties();
|
|
223387
|
-
const nullables = [];
|
|
223388
|
-
const defaults = {};
|
|
223389
|
-
properties.forEach((property) => {
|
|
223390
|
-
const propertyName = property.getName();
|
|
223391
|
-
const isNullable = property.hasQuestionToken();
|
|
223392
|
-
const initializer = property.getInitializer();
|
|
223393
|
-
if (isNullable) {
|
|
223394
|
-
nullables.push(propertyName);
|
|
223395
|
-
}
|
|
223396
|
-
if (initializer) {
|
|
223397
|
-
const initializerKind = initializer.getKind();
|
|
223398
|
-
switch (initializerKind) {
|
|
223399
|
-
case import_ts_morph.SyntaxKind.StringLiteral:
|
|
223400
|
-
defaults[propertyName] = initializer.getText();
|
|
223401
|
-
break;
|
|
223402
|
-
case import_ts_morph.SyntaxKind.NumericLiteral:
|
|
223403
|
-
defaults[propertyName] = parseFloat(initializer.getText());
|
|
223404
|
-
break;
|
|
223405
|
-
default:
|
|
223406
|
-
defaults[propertyName] = () => initializer.getText();
|
|
223407
|
-
break;
|
|
223408
|
-
}
|
|
223409
|
-
}
|
|
223410
|
-
this.allEntities.set(classDeclaration.getName(), { nullables, defaults });
|
|
223411
|
-
});
|
|
223412
|
-
}
|
|
223413
|
-
});
|
|
223414
|
-
});
|
|
223415
|
-
}
|
|
223416
|
-
async onInit() {
|
|
223417
|
-
const configFile = globbySync("cheetah.config.ts", { absolute: true });
|
|
223418
|
-
if (configFile.length === 0) {
|
|
223419
|
-
console.log("No config file found!");
|
|
223420
|
-
return;
|
|
223421
|
-
}
|
|
223422
|
-
const config = await import(configFile[0]);
|
|
223423
|
-
if (typeof config.default.entities === "string") {
|
|
223424
|
-
const files = globbySync([config.default.entities, "!node_modules"], { gitignore: true, absolute: true });
|
|
223425
|
-
for (const file of files) {
|
|
223426
|
-
await import(file);
|
|
223427
|
-
}
|
|
223428
|
-
}
|
|
223429
|
-
const entities2 = Metadata.get(ENTITIES, Reflect);
|
|
223430
|
-
if (!entities2) {
|
|
223431
|
-
console.log("No entities found!");
|
|
223432
|
-
return;
|
|
223433
|
-
}
|
|
223434
|
-
for (const entity of entities2) {
|
|
223435
|
-
const nullableDefaultEntity = this.allEntities.get(entity.target.name);
|
|
223436
|
-
const properties = Metadata.get(PROPERTIES_METADATA, entity.target);
|
|
223437
|
-
const relationship = Metadata.get(PROPERTIES_RELATIONS, entity.target);
|
|
223438
|
-
for (const property in properties) {
|
|
223439
|
-
if (nullableDefaultEntity?.nullables.includes(property)) {
|
|
223440
|
-
properties[property].options.nullable = true;
|
|
223441
|
-
}
|
|
223442
|
-
if (nullableDefaultEntity?.defaults[property]) {
|
|
223443
|
-
properties[property].options.default = nullableDefaultEntity?.defaults[property];
|
|
223444
|
-
}
|
|
223445
|
-
}
|
|
223446
|
-
this.storage.add(entity, properties, relationship);
|
|
223447
|
-
}
|
|
223448
|
-
console.log("Entities prepared!");
|
|
223449
|
-
}
|
|
223450
|
-
getSourceFilePaths() {
|
|
223451
|
-
const projectRoot = process.cwd();
|
|
223452
|
-
const getAllFiles = (dir) => {
|
|
223453
|
-
const patterns = [`${dir}/**/*.(ts|js)`, "!**/node_modules/**"];
|
|
223454
|
-
try {
|
|
223455
|
-
return globbySync(patterns, { gitignore: true });
|
|
223456
|
-
} catch (error) {
|
|
223457
|
-
console.error("Erro ao obter arquivos:", error);
|
|
223458
|
-
return [];
|
|
223459
|
-
}
|
|
223460
|
-
};
|
|
223461
|
-
return getAllFiles(projectRoot);
|
|
223462
|
-
}
|
|
223463
|
-
}
|
|
223464
|
-
__legacyDecorateClassTS([
|
|
223465
|
-
OnApplicationInit(),
|
|
223466
|
-
__legacyMetadataTS("design:type", Function),
|
|
223467
|
-
__legacyMetadataTS("design:paramtypes", []),
|
|
223468
|
-
__legacyMetadataTS("design:returntype", Promise)
|
|
223469
|
-
], OrmService.prototype, "onInit", null);
|
|
223470
|
-
OrmService = __legacyDecorateClassTS([
|
|
223471
|
-
Service(),
|
|
223472
|
-
__legacyMetadataTS("design:paramtypes", [
|
|
223473
|
-
typeof EntityStorage === "undefined" ? Object : EntityStorage,
|
|
223474
|
-
String
|
|
223475
|
-
])
|
|
223476
|
-
], OrmService);
|
|
223477
|
-
|
|
223478
|
-
// ../../node_modules/balanced-match/
|
|
223479
|
-
function Entity(options) {
|
|
223480
|
-
return (target) => {
|
|
223481
|
-
const entities2 = Metadata.get(ENTITIES, Reflect) || [];
|
|
223482
|
-
entities2.push({ target, options });
|
|
223483
|
-
Metadata.set(ENTITIES, entities2, Reflect);
|
|
223484
|
-
};
|
|
223485
|
-
}
|
|
223486
|
-
// ../../node_modules/balanced-match/in
|
|
223487
|
-
function Property2(options) {
|
|
223488
|
-
return (target, propertyKey) => {
|
|
223489
|
-
const properties = Metadata.get(PROPERTIES3, target.constructor) || [];
|
|
223490
|
-
const type = Metadata.getType(target, propertyKey);
|
|
223491
|
-
const length = options && options.length || getDefaultLength(type.name);
|
|
223492
|
-
options = { length, ...options };
|
|
223493
|
-
properties.push({ propertyKey, options });
|
|
223494
|
-
Metadata.set(PROPERTIES3, properties, target.constructor);
|
|
223495
|
-
if (options.isPrimary) {
|
|
223496
|
-
const indexes = Metadata.get("indexes", target.constructor) || [];
|
|
223497
|
-
indexes.push({ name: `[TABLE]_pkey`, properties: [propertyKey] });
|
|
223498
|
-
Metadata.set("indexes", indexes, target.constructor);
|
|
223499
|
-
}
|
|
223500
|
-
properties.forEach((property) => {
|
|
223501
|
-
const types = Metadata.get(PROPERTIES_METADATA, target.constructor) || {};
|
|
223502
|
-
const type2 = Metadata.getType(target, property.propertyKey);
|
|
223503
|
-
types[property.propertyKey] = { type: type2, options: property.options };
|
|
223504
|
-
Metadata.set(PROPERTIES_METADATA, types, target.constructor);
|
|
223505
|
-
});
|
|
223506
|
-
};
|
|
223507
|
-
}
|
|
223508
|
-
// ../../node_modules/balanced-match/index
|
|
223509
|
-
function PrimaryKey(options) {
|
|
223510
|
-
const isPrimary = true;
|
|
223511
|
-
return Property2({ ...options, isPrimary, unique: true });
|
|
223512
|
-
}
|
|
223513
|
-
// ../../node_modules/balanced-match/in
|
|
223514
|
-
function OneToMany(entity, fkKey) {
|
|
223515
|
-
return (target, propertyKey) => {
|
|
223516
|
-
const existing = Metadata.get(PROPERTIES_RELATIONS, target.constructor) || [];
|
|
223517
|
-
existing.push({ relation: "one-to-many", propertyKey, isRelation: true, entity, fkKey, type: Metadata.getType(target, propertyKey) });
|
|
223518
|
-
Metadata.set(PROPERTIES_RELATIONS, existing, target.constructor);
|
|
223519
|
-
};
|
|
223520
|
-
}
|
|
223521
|
-
function ManyToOne(entity) {
|
|
223522
|
-
return (target, propertyKey) => {
|
|
223523
|
-
const existing = Metadata.get(PROPERTIES_RELATIONS, target.constructor) || [];
|
|
223524
|
-
existing.push({ relation: "many-to-one", propertyKey, isRelation: true, entity, type: Metadata.getType(target, propertyKey) });
|
|
223525
|
-
Metadata.set(PROPERTIES_RELATIONS, existing, target.constructor);
|
|
223526
|
-
};
|
|
223527
|
-
}
|
|
223528
|
-
// ../../node_modules/balanced-match
|
|
223529
|
-
function Index(options) {
|
|
223530
|
-
return (target, propertyKey) => {
|
|
223531
|
-
const indexes = Metadata.get("indexes", target.constructor) || [];
|
|
223532
|
-
let index;
|
|
223533
|
-
if (options && options.properties) {
|
|
223534
|
-
const properties = options.properties;
|
|
223535
|
-
index = { name: `${properties.join("_")}_index`, properties: options.properties };
|
|
223536
|
-
} else {
|
|
223537
|
-
index = { name: `${propertyKey}_index`, properties: [propertyKey] };
|
|
223538
|
-
}
|
|
223539
|
-
indexes.push(index);
|
|
223540
|
-
Metadata.set("indexes", indexes, target.constructor);
|
|
223541
|
-
};
|
|
223542
|
-
}
|
|
223543
223503
|
// ../../node_module
|
|
223544
223504
|
class SqlBuilder {
|
|
223545
223505
|
driver;
|
|
@@ -223694,24 +223654,24 @@ class SqlBuilder {
|
|
|
223694
223654
|
if (typeof this.statements.join === "undefined") {
|
|
223695
223655
|
throw new Error("Join not found");
|
|
223696
223656
|
}
|
|
223697
|
-
const
|
|
223657
|
+
const entities2 = column.split(".");
|
|
223698
223658
|
let lastEntity = this.model;
|
|
223699
223659
|
let lastAlias = this.statements.alias;
|
|
223700
223660
|
const relationsMap = new Map(this.entity.relations.map((rel) => [rel.propertyKey, rel]));
|
|
223701
223661
|
const joinMap = new Map(this.statements.join.map((join) => [join.joinProperty, join]));
|
|
223702
|
-
for (let i = 0;i <
|
|
223662
|
+
for (let i = 0;i < entities2.length; i++) {
|
|
223703
223663
|
if (i === 0) {
|
|
223704
|
-
const relation = relationsMap.get(
|
|
223664
|
+
const relation = relationsMap.get(entities2[i]);
|
|
223705
223665
|
lastEntity = relation?.entity();
|
|
223706
|
-
lastAlias = joinMap.get(
|
|
223666
|
+
lastAlias = joinMap.get(entities2[i])?.joinAlias;
|
|
223707
223667
|
} else {
|
|
223708
|
-
if (i + 1 ===
|
|
223668
|
+
if (i + 1 === entities2.length) {
|
|
223709
223669
|
if (onlyAlias) {
|
|
223710
|
-
return `${lastAlias}."${
|
|
223670
|
+
return `${lastAlias}."${entities2[i]}"`;
|
|
223711
223671
|
}
|
|
223712
|
-
return `${lastAlias}."${
|
|
223672
|
+
return `${lastAlias}."${entities2[i]}" as ${lastAlias}_${entities2[i]}`;
|
|
223713
223673
|
}
|
|
223714
|
-
const lastStatement = joinMap.get(
|
|
223674
|
+
const lastStatement = joinMap.get(entities2[i]);
|
|
223715
223675
|
lastEntity = lastStatement?.joinEntity;
|
|
223716
223676
|
lastAlias = lastStatement?.joinAlias;
|
|
223717
223677
|
}
|
|
@@ -223953,18 +223913,20 @@ class SqlBuilder {
|
|
|
223953
223913
|
|
|
223954
223914
|
// ../../node
|
|
223955
223915
|
class Orm {
|
|
223956
|
-
connection;
|
|
223957
223916
|
logger3;
|
|
223958
223917
|
driverInstance;
|
|
223959
223918
|
static instance;
|
|
223919
|
+
connection;
|
|
223920
|
+
constructor(logger3) {
|
|
223921
|
+
this.logger = logger3;
|
|
223922
|
+
Orm.instance = this;
|
|
223923
|
+
}
|
|
223960
223924
|
static getInstance() {
|
|
223961
223925
|
return Orm.instance;
|
|
223962
223926
|
}
|
|
223963
|
-
|
|
223927
|
+
setConnection(connection) {
|
|
223964
223928
|
this.connection = connection;
|
|
223965
|
-
this.logger = logger3;
|
|
223966
223929
|
this.driverInstance = new this.connection.driver(connection);
|
|
223967
|
-
Orm.instance = this;
|
|
223968
223930
|
}
|
|
223969
223931
|
createQueryBuilder(model) {
|
|
223970
223932
|
return new SqlBuilder(model);
|
|
@@ -223976,6 +223938,840 @@ class Orm {
|
|
|
223976
223938
|
return this.driverInstance.disconnect();
|
|
223977
223939
|
}
|
|
223978
223940
|
}
|
|
223941
|
+
Orm = __legacyDecorateClassTS([
|
|
223942
|
+
Service(),
|
|
223943
|
+
__legacyMetadataTS("design:paramtypes", [
|
|
223944
|
+
typeof LoggerService === "undefined" ? Object : LoggerService
|
|
223945
|
+
])
|
|
223946
|
+
], Orm);
|
|
223947
|
+
// ../../node_modules
|
|
223948
|
+
var import_ts_morph2 = __toESM(require_ts_morph(), 1);
|
|
223949
|
+
|
|
223950
|
+
// ../../node_module
|
|
223951
|
+
var ENTITIES2 = "cheetah:entities";
|
|
223952
|
+
var PROPERTIES_METADATA2 = "cheetah:properties:metadata";
|
|
223953
|
+
var PROPERTIES_RELATIONS2 = "cheetah:properties:relations";
|
|
223954
|
+
// ../../node_mo
|
|
223955
|
+
function getDefaultLength2(type) {
|
|
223956
|
+
if (type === "String") {
|
|
223957
|
+
return 255;
|
|
223958
|
+
}
|
|
223959
|
+
if (type === "Number") {
|
|
223960
|
+
return 11;
|
|
223961
|
+
}
|
|
223962
|
+
if (type === "Boolean") {
|
|
223963
|
+
return 1;
|
|
223964
|
+
}
|
|
223965
|
+
if (type === "Date") {
|
|
223966
|
+
return 6;
|
|
223967
|
+
}
|
|
223968
|
+
return 255;
|
|
223969
|
+
}
|
|
223970
|
+
// ../../node_modules/bala
|
|
223971
|
+
var __decorate9 = function(decorators5, target, key, desc) {
|
|
223972
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
223973
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
223974
|
+
r = Reflect.decorate(decorators5, target, key, desc);
|
|
223975
|
+
else
|
|
223976
|
+
for (var i = decorators5.length - 1;i >= 0; i--)
|
|
223977
|
+
if (d = decorators5[i])
|
|
223978
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
223979
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
223980
|
+
};
|
|
223981
|
+
var __metadata7 = function(k, v) {
|
|
223982
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
223983
|
+
return Reflect.metadata(k, v);
|
|
223984
|
+
};
|
|
223985
|
+
var EntityStorage_1;
|
|
223986
|
+
var EntityStorage2 = EntityStorage_1 = class EntityStorage3 {
|
|
223987
|
+
constructor() {
|
|
223988
|
+
this.entities = new Map;
|
|
223989
|
+
EntityStorage_1.instance = this;
|
|
223990
|
+
}
|
|
223991
|
+
add(entity, properties, relations) {
|
|
223992
|
+
const entityName = entity.options?.tableName || entity.target.name.toLowerCase();
|
|
223993
|
+
const indexes = Metadata.get("indexes", entity.target) || [];
|
|
223994
|
+
this.entities.set(entity.target, {
|
|
223995
|
+
showProperties: properties,
|
|
223996
|
+
hideProperties: [],
|
|
223997
|
+
relations,
|
|
223998
|
+
indexes: indexes.map((index) => {
|
|
223999
|
+
return {
|
|
224000
|
+
table: entityName,
|
|
224001
|
+
indexName: index.name.replace("[TABLE]", entityName),
|
|
224002
|
+
columnName: index.properties.join(",")
|
|
224003
|
+
};
|
|
224004
|
+
}),
|
|
224005
|
+
tableName: entityName,
|
|
224006
|
+
...entity.options
|
|
224007
|
+
});
|
|
224008
|
+
}
|
|
224009
|
+
get(entity) {
|
|
224010
|
+
return this.entities.get(entity);
|
|
224011
|
+
}
|
|
224012
|
+
entries() {
|
|
224013
|
+
return this.entities.entries();
|
|
224014
|
+
}
|
|
224015
|
+
static getInstance() {
|
|
224016
|
+
return EntityStorage_1.instance;
|
|
224017
|
+
}
|
|
224018
|
+
async snapshot(values) {
|
|
224019
|
+
return {
|
|
224020
|
+
tableName: values.tableName,
|
|
224021
|
+
schema: values.schema || "public",
|
|
224022
|
+
indexes: values.indexes || [],
|
|
224023
|
+
columns: this.snapshotColumns(values)
|
|
224024
|
+
};
|
|
224025
|
+
}
|
|
224026
|
+
snapshotColumns(values) {
|
|
224027
|
+
let properties = Object.entries(values.showProperties).map(([key, value]) => {
|
|
224028
|
+
return {
|
|
224029
|
+
name: key,
|
|
224030
|
+
type: value.type.name,
|
|
224031
|
+
nullable: value.options?.nullable,
|
|
224032
|
+
default: value.options?.default,
|
|
224033
|
+
primary: value.options?.isPrimary,
|
|
224034
|
+
unique: value.options?.unique,
|
|
224035
|
+
length: value.options?.length
|
|
224036
|
+
};
|
|
224037
|
+
});
|
|
224038
|
+
let relations = values.relations && values.relations.map((relation) => {
|
|
224039
|
+
const type = this.getFkType(relation);
|
|
224040
|
+
return {
|
|
224041
|
+
name: relation.propertyKey,
|
|
224042
|
+
type,
|
|
224043
|
+
nullable: relation.nullable,
|
|
224044
|
+
unique: relation.unique,
|
|
224045
|
+
length: relation.length || getDefaultLength2(type),
|
|
224046
|
+
default: relation.default,
|
|
224047
|
+
primary: relation.isPrimary,
|
|
224048
|
+
foreignKeys: [
|
|
224049
|
+
{
|
|
224050
|
+
referencedColumnName: this.getFkKey(relation),
|
|
224051
|
+
referencedTableName: this.get(relation.entity()).tableName
|
|
224052
|
+
}
|
|
224053
|
+
]
|
|
224054
|
+
};
|
|
224055
|
+
});
|
|
224056
|
+
if (!relations) {
|
|
224057
|
+
relations = [];
|
|
224058
|
+
}
|
|
224059
|
+
if (!properties) {
|
|
224060
|
+
properties = [];
|
|
224061
|
+
}
|
|
224062
|
+
return [...properties, ...relations];
|
|
224063
|
+
}
|
|
224064
|
+
snapshotIndexes(values) {
|
|
224065
|
+
return Object.entries(values.showProperties).map(([key, value]) => {
|
|
224066
|
+
return {
|
|
224067
|
+
indexName: key,
|
|
224068
|
+
columnName: key,
|
|
224069
|
+
table: values.tableName
|
|
224070
|
+
};
|
|
224071
|
+
});
|
|
224072
|
+
}
|
|
224073
|
+
getFkType(relation) {
|
|
224074
|
+
const entity = this.get(relation.entity());
|
|
224075
|
+
if (!entity) {
|
|
224076
|
+
return "unknown";
|
|
224077
|
+
}
|
|
224078
|
+
return entity.showProperties[this.getFkKey(relation)].type.name;
|
|
224079
|
+
}
|
|
224080
|
+
getFkKey(relationShip) {
|
|
224081
|
+
if (typeof relationShip.fkKey === "undefined") {
|
|
224082
|
+
const entity = this.entities.get(relationShip.entity());
|
|
224083
|
+
const property3 = Object.entries(entity.showProperties).find(([key, value]) => value.options.isPrimary === true);
|
|
224084
|
+
if (!property3) {
|
|
224085
|
+
throw new Error(`Entity ${entity.tableName} does not have a primary key`);
|
|
224086
|
+
}
|
|
224087
|
+
return property3[0];
|
|
224088
|
+
}
|
|
224089
|
+
if (typeof relationShip.fkKey === "string") {
|
|
224090
|
+
return relationShip.fkKey;
|
|
224091
|
+
}
|
|
224092
|
+
const match = /\.(?<propriedade>[\w]+)/.exec(relationShip.fkKey.toString());
|
|
224093
|
+
return match ? match.groups.propriedade : "";
|
|
224094
|
+
}
|
|
224095
|
+
};
|
|
224096
|
+
EntityStorage2 = EntityStorage_1 = __decorate9([
|
|
224097
|
+
Service(),
|
|
224098
|
+
__metadata7("design:paramtypes", [])
|
|
224099
|
+
], EntityStorage2);
|
|
224100
|
+
|
|
224101
|
+
// ../../node_modules
|
|
224102
|
+
class SqlBuilder3 {
|
|
224103
|
+
constructor(model) {
|
|
224104
|
+
this.statements = {};
|
|
224105
|
+
this.aliases = new Set;
|
|
224106
|
+
this.lastKeyNotOperator = "";
|
|
224107
|
+
this.updatedColumns = [];
|
|
224108
|
+
const orm = Orm.getInstance();
|
|
224109
|
+
this.driver = orm.driverInstance;
|
|
224110
|
+
this.logger = orm.logger;
|
|
224111
|
+
this.entityStorage = EntityStorage2.getInstance();
|
|
224112
|
+
this.getEntity(model);
|
|
224113
|
+
}
|
|
224114
|
+
select(columns) {
|
|
224115
|
+
const tableName = this.entity.tableName || this.model.name.toLowerCase();
|
|
224116
|
+
const schema = this.entity.schema || "public";
|
|
224117
|
+
this.statements.statement = "select";
|
|
224118
|
+
this.statements.columns = columns;
|
|
224119
|
+
this.statements.alias = this.getAlias(tableName);
|
|
224120
|
+
this.statements.table = `"${schema}"."${tableName}"`;
|
|
224121
|
+
return this;
|
|
224122
|
+
}
|
|
224123
|
+
insert(values) {
|
|
224124
|
+
const { tableName, schema } = this.getTableName();
|
|
224125
|
+
this.statements.statement = "insert";
|
|
224126
|
+
this.statements.alias = this.getAlias(tableName);
|
|
224127
|
+
this.statements.table = `"${schema}"."${tableName}"`;
|
|
224128
|
+
this.statements.values = this.withUpdatedValues(this.withDefaultValues(values, this.entity), this.entity);
|
|
224129
|
+
return this;
|
|
224130
|
+
}
|
|
224131
|
+
update(values) {
|
|
224132
|
+
const { tableName, schema } = this.getTableName();
|
|
224133
|
+
this.statements.statement = "update";
|
|
224134
|
+
this.statements.alias = this.getAlias(tableName);
|
|
224135
|
+
this.statements.table = `${schema}.${tableName}`;
|
|
224136
|
+
this.statements.values = this.withUpdatedValues(values, this.entity);
|
|
224137
|
+
return this;
|
|
224138
|
+
}
|
|
224139
|
+
where(where) {
|
|
224140
|
+
if (typeof where === "undefined" || Object.entries(where).length === 0) {
|
|
224141
|
+
return this;
|
|
224142
|
+
}
|
|
224143
|
+
this.statements.where = this.conditionToSql(where, this.statements.alias);
|
|
224144
|
+
return this;
|
|
224145
|
+
}
|
|
224146
|
+
orderBy(orderBy) {
|
|
224147
|
+
if (typeof orderBy === "undefined") {
|
|
224148
|
+
return this;
|
|
224149
|
+
}
|
|
224150
|
+
this.statements.orderBy = this.objectToStringMap(orderBy);
|
|
224151
|
+
return this;
|
|
224152
|
+
}
|
|
224153
|
+
limit(limit) {
|
|
224154
|
+
this.statements.limit = limit;
|
|
224155
|
+
return this;
|
|
224156
|
+
}
|
|
224157
|
+
offset(offset) {
|
|
224158
|
+
this.statements.offset = offset;
|
|
224159
|
+
return this;
|
|
224160
|
+
}
|
|
224161
|
+
async executeAndReturnFirst() {
|
|
224162
|
+
this.statements.limit = 1;
|
|
224163
|
+
const result = await this.execute();
|
|
224164
|
+
if (result.query.rows.length === 0) {
|
|
224165
|
+
return;
|
|
224166
|
+
}
|
|
224167
|
+
return this.transformToModel(result.query.rows[0]);
|
|
224168
|
+
}
|
|
224169
|
+
async executeAndReturnFirstOrFail() {
|
|
224170
|
+
this.statements.limit = 1;
|
|
224171
|
+
const result = await this.execute();
|
|
224172
|
+
if (result.query.rows.length === 0) {
|
|
224173
|
+
throw new Error("Result not found");
|
|
224174
|
+
}
|
|
224175
|
+
return this.transformToModel(result.query.rows[0]);
|
|
224176
|
+
}
|
|
224177
|
+
async executeAndReturnAll() {
|
|
224178
|
+
const result = await this.execute();
|
|
224179
|
+
if (result.query.rows.length === 0) {
|
|
224180
|
+
return [];
|
|
224181
|
+
}
|
|
224182
|
+
return result.query.rows.map((row) => this.transformToModel(row));
|
|
224183
|
+
}
|
|
224184
|
+
async execute() {
|
|
224185
|
+
if (!this.statements.columns) {
|
|
224186
|
+
let columns = [
|
|
224187
|
+
...this.getColumnsEntity(this.model, this.statements.alias)
|
|
224188
|
+
];
|
|
224189
|
+
if (this.statements.join) {
|
|
224190
|
+
columns = [
|
|
224191
|
+
...columns,
|
|
224192
|
+
...this.statements.join.flatMap((join) => this.getColumnsEntity(join.joinEntity, join.joinAlias))
|
|
224193
|
+
];
|
|
224194
|
+
}
|
|
224195
|
+
this.statements.columns = columns;
|
|
224196
|
+
} else {
|
|
224197
|
+
this.statements.columns = this.statements.columns.map((column) => {
|
|
224198
|
+
return this.discoverColumnAlias(column);
|
|
224199
|
+
}).flat();
|
|
224200
|
+
}
|
|
224201
|
+
this.statements.columns.push(...this.updatedColumns);
|
|
224202
|
+
const result = await this.driver.executeStatement(this.statements);
|
|
224203
|
+
this.logger.debug(`SQL: ${result.sql} [${Date.now() - result.startTime}ms]`);
|
|
224204
|
+
return result;
|
|
224205
|
+
}
|
|
224206
|
+
startTransaction() {
|
|
224207
|
+
return this.driver.startTransaction();
|
|
224208
|
+
}
|
|
224209
|
+
commit() {
|
|
224210
|
+
return this.driver.commitTransaction();
|
|
224211
|
+
}
|
|
224212
|
+
rollback() {
|
|
224213
|
+
return this.driver.rollbackTransaction();
|
|
224214
|
+
}
|
|
224215
|
+
async inTransaction(callback) {
|
|
224216
|
+
await this.startTransaction();
|
|
224217
|
+
try {
|
|
224218
|
+
const result = await callback(this);
|
|
224219
|
+
await this.commit();
|
|
224220
|
+
return result;
|
|
224221
|
+
} catch (e) {
|
|
224222
|
+
await this.rollback();
|
|
224223
|
+
throw e;
|
|
224224
|
+
}
|
|
224225
|
+
}
|
|
224226
|
+
objectToStringMap(obj, parentKey = "") {
|
|
224227
|
+
let result = [];
|
|
224228
|
+
for (let key in obj) {
|
|
224229
|
+
if (obj.hasOwnProperty(key)) {
|
|
224230
|
+
let fullKey = parentKey ? `${parentKey}.${key}` : key;
|
|
224231
|
+
if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
224232
|
+
result = result.concat(this.objectToStringMap(obj[key], fullKey));
|
|
224233
|
+
} else {
|
|
224234
|
+
result.push(`${this.discoverColumnAlias(fullKey, true)} ${obj[key]}`);
|
|
224235
|
+
}
|
|
224236
|
+
}
|
|
224237
|
+
}
|
|
224238
|
+
return result;
|
|
224239
|
+
}
|
|
224240
|
+
discoverColumnAlias(column, onlyAlias = false) {
|
|
224241
|
+
if (!column.includes(".")) {
|
|
224242
|
+
if (onlyAlias) {
|
|
224243
|
+
return `${this.statements.alias}."${column}"`;
|
|
224244
|
+
}
|
|
224245
|
+
return `${this.statements.alias}."${column}" as ${this.statements.alias}_${column}`;
|
|
224246
|
+
}
|
|
224247
|
+
if (typeof this.statements.join === "undefined") {
|
|
224248
|
+
throw new Error("Join not found");
|
|
224249
|
+
}
|
|
224250
|
+
const entities3 = column.split(".");
|
|
224251
|
+
let lastEntity = this.model;
|
|
224252
|
+
let lastAlias = this.statements.alias;
|
|
224253
|
+
const relationsMap = new Map(this.entity.relations.map((rel) => [rel.propertyKey, rel]));
|
|
224254
|
+
const joinMap = new Map(this.statements.join.map((join) => [join.joinProperty, join]));
|
|
224255
|
+
for (let i = 0;i < entities3.length; i++) {
|
|
224256
|
+
if (i === 0) {
|
|
224257
|
+
const relation = relationsMap.get(entities3[i]);
|
|
224258
|
+
lastEntity = relation?.entity();
|
|
224259
|
+
lastAlias = joinMap.get(entities3[i])?.joinAlias;
|
|
224260
|
+
} else {
|
|
224261
|
+
if (i + 1 === entities3.length) {
|
|
224262
|
+
if (onlyAlias) {
|
|
224263
|
+
return `${lastAlias}."${entities3[i]}"`;
|
|
224264
|
+
}
|
|
224265
|
+
return `${lastAlias}."${entities3[i]}" as ${lastAlias}_${entities3[i]}`;
|
|
224266
|
+
}
|
|
224267
|
+
const lastStatement = joinMap.get(entities3[i]);
|
|
224268
|
+
lastEntity = lastStatement?.joinEntity;
|
|
224269
|
+
lastAlias = lastStatement?.joinAlias;
|
|
224270
|
+
}
|
|
224271
|
+
}
|
|
224272
|
+
return "";
|
|
224273
|
+
}
|
|
224274
|
+
getTableName() {
|
|
224275
|
+
const tableName = this.entity.tableName || this.model.name.toLowerCase();
|
|
224276
|
+
const schema = this.entity.schema || "public";
|
|
224277
|
+
return { tableName, schema };
|
|
224278
|
+
}
|
|
224279
|
+
addSimpleConditionToSql(key, value, alias = null, operator = "=") {
|
|
224280
|
+
const aliasToUse = alias || this.statements.alias;
|
|
224281
|
+
const valueByType = typeof value === "string" ? `'${value}'` : value;
|
|
224282
|
+
return `${aliasToUse}.${key} ${operator} ${valueByType}`;
|
|
224283
|
+
}
|
|
224284
|
+
addInConditionToSql(key, values, alias = null) {
|
|
224285
|
+
const aliasToUse = alias || this.statements.alias;
|
|
224286
|
+
return `${aliasToUse}.${key} IN (${values.map((val) => typeof val === "string" ? `'${val}'` : val).join(", ")})`;
|
|
224287
|
+
}
|
|
224288
|
+
addLogicalOperatorToSql(conditions, operator) {
|
|
224289
|
+
return `(${conditions.join(` ${operator} `)})`;
|
|
224290
|
+
}
|
|
224291
|
+
conditionToSql(condition, alias) {
|
|
224292
|
+
const sqlParts = [];
|
|
224293
|
+
const operators = ["$eq", "$ne", "$in", "$nin", "$like", "$gt", "$gte", "$lt", "$lte", "$and", "$or"];
|
|
224294
|
+
for (let [key, value] of Object.entries(condition)) {
|
|
224295
|
+
if (!operators.includes(key)) {
|
|
224296
|
+
this.lastKeyNotOperator = key;
|
|
224297
|
+
}
|
|
224298
|
+
const relationShip = this.entity.relations?.find((rel) => rel.propertyKey === key);
|
|
224299
|
+
if (relationShip) {
|
|
224300
|
+
sqlParts.push(this.applyJoin(relationShip, value, alias));
|
|
224301
|
+
} else if (typeof value !== "object" || value === null) {
|
|
224302
|
+
if (key === "$eq") {
|
|
224303
|
+
sqlParts.push(this.addSimpleConditionToSql(this.lastKeyNotOperator, value, alias, "="));
|
|
224304
|
+
continue;
|
|
224305
|
+
}
|
|
224306
|
+
sqlParts.push(this.addSimpleConditionToSql(key, value, alias));
|
|
224307
|
+
} else if (!operators.includes(key) && Array.isArray(value)) {
|
|
224308
|
+
sqlParts.push(this.addInConditionToSql(key, value, alias));
|
|
224309
|
+
} else {
|
|
224310
|
+
if (["$or", "$and"].includes(key)) {
|
|
224311
|
+
sqlParts.push(this.addLogicalOperatorToSql(value.map((cond) => this.conditionToSql(cond, alias)), key.toUpperCase().replace("$", "")));
|
|
224312
|
+
}
|
|
224313
|
+
for (const operator of operators) {
|
|
224314
|
+
if (operator in value) {
|
|
224315
|
+
switch (operator) {
|
|
224316
|
+
case "$eq":
|
|
224317
|
+
sqlParts.push(this.addSimpleConditionToSql(key, value["$eq"], alias, "="));
|
|
224318
|
+
break;
|
|
224319
|
+
case "$ne":
|
|
224320
|
+
sqlParts.push(this.addSimpleConditionToSql(key, value["$ne"], alias, "!="));
|
|
224321
|
+
break;
|
|
224322
|
+
case "$in":
|
|
224323
|
+
sqlParts.push(this.addInConditionToSql(key, value["$in"], alias));
|
|
224324
|
+
break;
|
|
224325
|
+
case "$nin":
|
|
224326
|
+
sqlParts.push(`${alias}.${key} NOT IN (${value["$nin"].map((val) => this.t(val)).join(", ")})`);
|
|
224327
|
+
break;
|
|
224328
|
+
case "$like":
|
|
224329
|
+
sqlParts.push(`${alias}.${key} LIKE '${value["$like"]}'`);
|
|
224330
|
+
break;
|
|
224331
|
+
case "$gt":
|
|
224332
|
+
sqlParts.push(`${alias}.${key} > ${value["$gt"]}`);
|
|
224333
|
+
break;
|
|
224334
|
+
case "$gte":
|
|
224335
|
+
sqlParts.push(`${alias}.${key} >= ${value["$gte"]}`);
|
|
224336
|
+
break;
|
|
224337
|
+
case "$lt":
|
|
224338
|
+
sqlParts.push(`${alias}.${key} < ${value["$lt"]}`);
|
|
224339
|
+
break;
|
|
224340
|
+
case "$lte":
|
|
224341
|
+
sqlParts.push(`${alias}.${key} <= ${value["$lte"]}`);
|
|
224342
|
+
break;
|
|
224343
|
+
case "$and":
|
|
224344
|
+
case "$or":
|
|
224345
|
+
const parts = value[operator].map((cond) => this.conditionToSql(cond, alias));
|
|
224346
|
+
sqlParts.push(this.addLogicalOperatorToSql(parts, operator.toUpperCase().replace("$", "")));
|
|
224347
|
+
break;
|
|
224348
|
+
}
|
|
224349
|
+
}
|
|
224350
|
+
}
|
|
224351
|
+
}
|
|
224352
|
+
}
|
|
224353
|
+
return this.addLogicalOperatorToSql(sqlParts, "AND");
|
|
224354
|
+
}
|
|
224355
|
+
t(value) {
|
|
224356
|
+
return typeof value === "string" ? `'${value}'` : value;
|
|
224357
|
+
}
|
|
224358
|
+
applyJoin(relationShip, value, alias) {
|
|
224359
|
+
const { tableName, schema } = this.getTableName();
|
|
224360
|
+
const { tableName: joinTableName, schema: joinSchema } = this.entityStorage.get(relationShip.entity()) || {
|
|
224361
|
+
tableName: relationShip.entity().name.toLowerCase(),
|
|
224362
|
+
schema: "public"
|
|
224363
|
+
};
|
|
224364
|
+
let originPrimaryKey = "id";
|
|
224365
|
+
for (const prop in this.entity.showProperties) {
|
|
224366
|
+
if (this.entity.showProperties[prop].options.isPrimary) {
|
|
224367
|
+
originPrimaryKey = prop;
|
|
224368
|
+
break;
|
|
224369
|
+
}
|
|
224370
|
+
}
|
|
224371
|
+
const joinAlias = `${this.getAlias(joinTableName)}`;
|
|
224372
|
+
const joinWhere = this.conditionToSql(value, joinAlias);
|
|
224373
|
+
this.statements.join = this.statements.join || [];
|
|
224374
|
+
let on = "";
|
|
224375
|
+
switch (relationShip.relation) {
|
|
224376
|
+
case "one-to-many":
|
|
224377
|
+
on = `${joinAlias}.${this.getFkKey(relationShip)} = ${alias}.${originPrimaryKey}`;
|
|
224378
|
+
break;
|
|
224379
|
+
case "many-to-one":
|
|
224380
|
+
on = `${alias}.${relationShip.propertyKey} = ${joinAlias}.${this.getFkKey(relationShip)}`;
|
|
224381
|
+
break;
|
|
224382
|
+
}
|
|
224383
|
+
this.statements.join.push({
|
|
224384
|
+
joinAlias,
|
|
224385
|
+
joinTable: joinTableName,
|
|
224386
|
+
joinSchema: joinSchema || "public",
|
|
224387
|
+
joinWhere,
|
|
224388
|
+
joinProperty: relationShip.propertyKey,
|
|
224389
|
+
originAlias: alias,
|
|
224390
|
+
originSchema: schema,
|
|
224391
|
+
originTable: tableName,
|
|
224392
|
+
propertyKey: relationShip.propertyKey,
|
|
224393
|
+
joinEntity: relationShip.entity(),
|
|
224394
|
+
type: "LEFT",
|
|
224395
|
+
on,
|
|
224396
|
+
originalEntity: relationShip.originalEntity
|
|
224397
|
+
});
|
|
224398
|
+
return joinWhere;
|
|
224399
|
+
}
|
|
224400
|
+
getFkKey(relationShip) {
|
|
224401
|
+
if (typeof relationShip.fkKey === "undefined") {
|
|
224402
|
+
return "id";
|
|
224403
|
+
}
|
|
224404
|
+
if (typeof relationShip.fkKey === "string") {
|
|
224405
|
+
return relationShip.fkKey;
|
|
224406
|
+
}
|
|
224407
|
+
const match = /\.(?<propriedade>[\w]+)/.exec(relationShip.fkKey.toString());
|
|
224408
|
+
return match ? match.groups.propriedade : "";
|
|
224409
|
+
}
|
|
224410
|
+
getEntity(model) {
|
|
224411
|
+
const entity = this.entityStorage.get(model);
|
|
224412
|
+
this.model = model;
|
|
224413
|
+
if (!entity) {
|
|
224414
|
+
throw new Error("Entity not found");
|
|
224415
|
+
}
|
|
224416
|
+
this.entity = entity;
|
|
224417
|
+
}
|
|
224418
|
+
transformToModel(data) {
|
|
224419
|
+
const instance = new this.model;
|
|
224420
|
+
instance.$_isPersisted = true;
|
|
224421
|
+
const entitiesByAlias = {
|
|
224422
|
+
[this.statements.alias]: instance
|
|
224423
|
+
};
|
|
224424
|
+
const entitiesOptions = new Map;
|
|
224425
|
+
entitiesOptions.set(this.statements.alias, this.entityStorage.get(instance.constructor));
|
|
224426
|
+
if (this.statements.join) {
|
|
224427
|
+
this.statements.join.forEach((join) => {
|
|
224428
|
+
const joinInstance = new join.joinEntity;
|
|
224429
|
+
joinInstance.$_isPersisted = true;
|
|
224430
|
+
entitiesByAlias[join.joinAlias] = joinInstance;
|
|
224431
|
+
entitiesOptions.set(join.joinAlias, this.entityStorage.get(joinInstance.constructor));
|
|
224432
|
+
});
|
|
224433
|
+
}
|
|
224434
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
224435
|
+
const [alias, prop] = key.split("_");
|
|
224436
|
+
const entity = entitiesByAlias[alias];
|
|
224437
|
+
if (!entity) {
|
|
224438
|
+
return;
|
|
224439
|
+
}
|
|
224440
|
+
if (entitiesOptions.get(alias).showProperties.hasOwnProperty(prop)) {
|
|
224441
|
+
entity[prop] = value;
|
|
224442
|
+
}
|
|
224443
|
+
});
|
|
224444
|
+
if (this.statements.join) {
|
|
224445
|
+
this.statements.join.forEach((join) => {
|
|
224446
|
+
const { joinAlias, originAlias, propertyKey } = join;
|
|
224447
|
+
const originEntity = entitiesByAlias[originAlias];
|
|
224448
|
+
const joinEntity = entitiesByAlias[joinAlias];
|
|
224449
|
+
const property3 = entitiesOptions.get(originAlias).relations.find((rel) => rel.propertyKey === propertyKey);
|
|
224450
|
+
if (!originEntity || !joinEntity) {
|
|
224451
|
+
return;
|
|
224452
|
+
}
|
|
224453
|
+
originEntity[propertyKey] = property3.type === Array ? originEntity[propertyKey] ? [...originEntity[propertyKey], joinEntity] : [joinEntity] : joinEntity;
|
|
224454
|
+
});
|
|
224455
|
+
}
|
|
224456
|
+
return instance;
|
|
224457
|
+
}
|
|
224458
|
+
getAlias(tableName) {
|
|
224459
|
+
const alias = tableName.split("").shift() || "";
|
|
224460
|
+
let counter = 1;
|
|
224461
|
+
let uniqueAlias = `${alias}${counter}`;
|
|
224462
|
+
while (this.aliases.has(uniqueAlias)) {
|
|
224463
|
+
counter++;
|
|
224464
|
+
uniqueAlias = `${alias}${counter}`;
|
|
224465
|
+
}
|
|
224466
|
+
this.aliases.add(uniqueAlias);
|
|
224467
|
+
return uniqueAlias;
|
|
224468
|
+
}
|
|
224469
|
+
getColumnsEntity(entity, alias) {
|
|
224470
|
+
const e = this.entityStorage.get(entity);
|
|
224471
|
+
if (!e) {
|
|
224472
|
+
throw new Error("Entity not found");
|
|
224473
|
+
}
|
|
224474
|
+
return Object.keys(e.showProperties).map((key) => `${alias}."${key}" as "${alias}_${key}"`);
|
|
224475
|
+
}
|
|
224476
|
+
withDefaultValues(values, entityOptions) {
|
|
224477
|
+
const property3 = Object.entries(entityOptions.showProperties).filter(([_, value]) => value.options.onInsert);
|
|
224478
|
+
const defaultProperties = Object.entries(entityOptions.showProperties).filter(([_, value]) => value.options.default);
|
|
224479
|
+
for (const [key, property4] of defaultProperties) {
|
|
224480
|
+
if (typeof values[key] === "undefined") {
|
|
224481
|
+
if (typeof property4.options.default === "function") {
|
|
224482
|
+
values[key] = (0, eval)(property4.options.default());
|
|
224483
|
+
} else {
|
|
224484
|
+
values[key] = (0, eval)(property4.options.default);
|
|
224485
|
+
}
|
|
224486
|
+
}
|
|
224487
|
+
}
|
|
224488
|
+
property3.forEach(([key, property4]) => {
|
|
224489
|
+
values[key] = property4.options.onInsert();
|
|
224490
|
+
this.updatedColumns.push(`${this.statements.alias}."${key}" as "${this.statements.alias}_${key}"`);
|
|
224491
|
+
});
|
|
224492
|
+
return values;
|
|
224493
|
+
}
|
|
224494
|
+
withUpdatedValues(values, entityOptions) {
|
|
224495
|
+
const property3 = Object.entries(entityOptions.showProperties).filter(([_, value]) => value.options.onUpdate);
|
|
224496
|
+
property3.forEach(([key, property4]) => {
|
|
224497
|
+
values[key] = property4.options.onUpdate();
|
|
224498
|
+
this.updatedColumns.push(`${this.statements.alias}."${key}" as "${this.statements.alias}_${key}"`);
|
|
224499
|
+
});
|
|
224500
|
+
return values;
|
|
224501
|
+
}
|
|
224502
|
+
}
|
|
224503
|
+
|
|
224504
|
+
// ../../node_
|
|
224505
|
+
var __decorate10 = function(decorators5, target, key, desc) {
|
|
224506
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
224507
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
224508
|
+
r = Reflect.decorate(decorators5, target, key, desc);
|
|
224509
|
+
else
|
|
224510
|
+
for (var i = decorators5.length - 1;i >= 0; i--)
|
|
224511
|
+
if (d = decorators5[i])
|
|
224512
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
224513
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
224514
|
+
};
|
|
224515
|
+
var __metadata8 = function(k, v) {
|
|
224516
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
224517
|
+
return Reflect.metadata(k, v);
|
|
224518
|
+
};
|
|
224519
|
+
var Orm_1;
|
|
224520
|
+
var Orm2 = Orm_1 = class Orm3 {
|
|
224521
|
+
constructor(logger3) {
|
|
224522
|
+
this.logger = logger3;
|
|
224523
|
+
Orm_1.instance = this;
|
|
224524
|
+
}
|
|
224525
|
+
static getInstance() {
|
|
224526
|
+
return Orm_1.instance;
|
|
224527
|
+
}
|
|
224528
|
+
setConnection(connection) {
|
|
224529
|
+
this.connection = connection;
|
|
224530
|
+
this.driverInstance = new this.connection.driver(connection);
|
|
224531
|
+
}
|
|
224532
|
+
createQueryBuilder(model) {
|
|
224533
|
+
return new SqlBuilder3(model);
|
|
224534
|
+
}
|
|
224535
|
+
connect() {
|
|
224536
|
+
return this.driverInstance.connect();
|
|
224537
|
+
}
|
|
224538
|
+
disconnect() {
|
|
224539
|
+
return this.driverInstance.disconnect();
|
|
224540
|
+
}
|
|
224541
|
+
};
|
|
224542
|
+
Orm2 = Orm_1 = __decorate10([
|
|
224543
|
+
Service(),
|
|
224544
|
+
__metadata8("design:paramtypes", [LoggerService])
|
|
224545
|
+
], Orm2);
|
|
224546
|
+
// ../../node_modules/
|
|
224547
|
+
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
224548
|
+
var __decorate11 = function(decorators5, target, key, desc) {
|
|
224549
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
224550
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
224551
|
+
r = Reflect.decorate(decorators5, target, key, desc);
|
|
224552
|
+
else
|
|
224553
|
+
for (var i = decorators5.length - 1;i >= 0; i--)
|
|
224554
|
+
if (d = decorators5[i])
|
|
224555
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
224556
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
224557
|
+
};
|
|
224558
|
+
var __metadata9 = function(k, v) {
|
|
224559
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
224560
|
+
return Reflect.metadata(k, v);
|
|
224561
|
+
};
|
|
224562
|
+
var OrmService = class OrmService2 {
|
|
224563
|
+
constructor(orm2, storage2, entityFile = undefined) {
|
|
224564
|
+
this.orm = orm2;
|
|
224565
|
+
this.storage = storage2;
|
|
224566
|
+
this.allEntities = new Map;
|
|
224567
|
+
console.log("Preparing entities...");
|
|
224568
|
+
const files = new import_ts_morph.Project({ skipLoadingLibFiles: true }).addSourceFilesAtPaths(entityFile ?? this.getSourceFilePaths());
|
|
224569
|
+
files.forEach((file) => {
|
|
224570
|
+
file.getClasses().forEach((classDeclaration) => {
|
|
224571
|
+
if (classDeclaration.getDecorator("Entity")) {
|
|
224572
|
+
const properties = classDeclaration.getProperties();
|
|
224573
|
+
const nullables = [];
|
|
224574
|
+
const defaults = {};
|
|
224575
|
+
properties.forEach((property3) => {
|
|
224576
|
+
const propertyName = property3.getName();
|
|
224577
|
+
const isNullable = property3.hasQuestionToken();
|
|
224578
|
+
const initializer = property3.getInitializer();
|
|
224579
|
+
if (isNullable) {
|
|
224580
|
+
nullables.push(propertyName);
|
|
224581
|
+
}
|
|
224582
|
+
if (initializer) {
|
|
224583
|
+
const initializerKind = initializer.getKind();
|
|
224584
|
+
switch (initializerKind) {
|
|
224585
|
+
case import_ts_morph.SyntaxKind.StringLiteral:
|
|
224586
|
+
defaults[propertyName] = initializer.getText();
|
|
224587
|
+
break;
|
|
224588
|
+
case import_ts_morph.SyntaxKind.NumericLiteral:
|
|
224589
|
+
defaults[propertyName] = parseFloat(initializer.getText());
|
|
224590
|
+
break;
|
|
224591
|
+
default:
|
|
224592
|
+
defaults[propertyName] = () => initializer.getText();
|
|
224593
|
+
break;
|
|
224594
|
+
}
|
|
224595
|
+
}
|
|
224596
|
+
this.allEntities.set(classDeclaration.getName(), { nullables, defaults });
|
|
224597
|
+
});
|
|
224598
|
+
}
|
|
224599
|
+
});
|
|
224600
|
+
});
|
|
224601
|
+
}
|
|
224602
|
+
async onInit(customConfig = undefined) {
|
|
224603
|
+
const configFile = globbySync("cheetah.config.ts", { absolute: true });
|
|
224604
|
+
if (configFile.length === 0) {
|
|
224605
|
+
console.log("No config file found!");
|
|
224606
|
+
return;
|
|
224607
|
+
}
|
|
224608
|
+
const config = await import(configFile[0]);
|
|
224609
|
+
this.orm.setConnection(customConfig ?? config.default.connection);
|
|
224610
|
+
await this.orm.connect();
|
|
224611
|
+
if (typeof config.default.entities === "string") {
|
|
224612
|
+
const files = globbySync([config.default.entities, "!node_modules"], { gitignore: true, absolute: true });
|
|
224613
|
+
for (const file of files) {
|
|
224614
|
+
await import(file);
|
|
224615
|
+
}
|
|
224616
|
+
}
|
|
224617
|
+
const entities4 = Metadata.get(ENTITIES2, Reflect);
|
|
224618
|
+
if (!entities4) {
|
|
224619
|
+
console.log("No entities found!");
|
|
224620
|
+
return;
|
|
224621
|
+
}
|
|
224622
|
+
for (const entity of entities4) {
|
|
224623
|
+
const nullableDefaultEntity = this.allEntities.get(entity.target.name);
|
|
224624
|
+
const properties = Metadata.get(PROPERTIES_METADATA2, entity.target);
|
|
224625
|
+
const relationship = Metadata.get(PROPERTIES_RELATIONS2, entity.target);
|
|
224626
|
+
for (const property3 in properties) {
|
|
224627
|
+
if (nullableDefaultEntity?.nullables.includes(property3)) {
|
|
224628
|
+
properties[property3].options.nullable = true;
|
|
224629
|
+
}
|
|
224630
|
+
if (nullableDefaultEntity?.defaults[property3]) {
|
|
224631
|
+
properties[property3].options.default = nullableDefaultEntity?.defaults[property3];
|
|
224632
|
+
}
|
|
224633
|
+
}
|
|
224634
|
+
this.storage.add(entity, properties, relationship);
|
|
224635
|
+
}
|
|
224636
|
+
console.log("Entities prepared!");
|
|
224637
|
+
}
|
|
224638
|
+
getSourceFilePaths() {
|
|
224639
|
+
const projectRoot = process.cwd();
|
|
224640
|
+
const getAllFiles = (dir) => {
|
|
224641
|
+
const patterns = [`${dir}/**/*.(ts|js)`, "!**/node_modules/**"];
|
|
224642
|
+
try {
|
|
224643
|
+
return globbySync(patterns, { gitignore: true });
|
|
224644
|
+
} catch (error) {
|
|
224645
|
+
console.error("Erro ao obter arquivos:", error);
|
|
224646
|
+
return [];
|
|
224647
|
+
}
|
|
224648
|
+
};
|
|
224649
|
+
return getAllFiles(projectRoot);
|
|
224650
|
+
}
|
|
224651
|
+
};
|
|
224652
|
+
__decorate11([
|
|
224653
|
+
OnApplicationInit(),
|
|
224654
|
+
__metadata9("design:type", Function),
|
|
224655
|
+
__metadata9("design:paramtypes", [Object]),
|
|
224656
|
+
__metadata9("design:returntype", Promise)
|
|
224657
|
+
], OrmService.prototype, "onInit", null);
|
|
224658
|
+
OrmService = __decorate11([
|
|
224659
|
+
Service(),
|
|
224660
|
+
__metadata9("design:paramtypes", [Orm2, EntityStorage2, Object])
|
|
224661
|
+
], OrmService);
|
|
224662
|
+
// ../../node_modules/balan
|
|
224663
|
+
var import_pg = __toESM(require_lib2(), 1);
|
|
224664
|
+
// ../../node_mo
|
|
224665
|
+
var CheetahOrm = new Cheetah({ exports: [Orm2, OrmService, EntityStorage2] });
|
|
224666
|
+
// ../../node_modules
|
|
224667
|
+
class OrmService3 {
|
|
224668
|
+
orm7;
|
|
224669
|
+
storage2;
|
|
224670
|
+
allEntities = new Map;
|
|
224671
|
+
constructor(orm7, storage2, entityFile = undefined) {
|
|
224672
|
+
this.orm = orm7;
|
|
224673
|
+
this.storage = storage2;
|
|
224674
|
+
console.log("Preparing entities...");
|
|
224675
|
+
const files = new import_ts_morph2.Project({ skipLoadingLibFiles: true }).addSourceFilesAtPaths(entityFile ?? this.getSourceFilePaths());
|
|
224676
|
+
files.forEach((file) => {
|
|
224677
|
+
file.getClasses().forEach((classDeclaration) => {
|
|
224678
|
+
if (classDeclaration.getDecorator("Entity")) {
|
|
224679
|
+
const properties = classDeclaration.getProperties();
|
|
224680
|
+
const nullables = [];
|
|
224681
|
+
const defaults = {};
|
|
224682
|
+
properties.forEach((property4) => {
|
|
224683
|
+
const propertyName = property4.getName();
|
|
224684
|
+
const isNullable = property4.hasQuestionToken();
|
|
224685
|
+
const initializer = property4.getInitializer();
|
|
224686
|
+
if (isNullable) {
|
|
224687
|
+
nullables.push(propertyName);
|
|
224688
|
+
}
|
|
224689
|
+
if (initializer) {
|
|
224690
|
+
const initializerKind = initializer.getKind();
|
|
224691
|
+
switch (initializerKind) {
|
|
224692
|
+
case import_ts_morph2.SyntaxKind.StringLiteral:
|
|
224693
|
+
defaults[propertyName] = initializer.getText();
|
|
224694
|
+
break;
|
|
224695
|
+
case import_ts_morph2.SyntaxKind.NumericLiteral:
|
|
224696
|
+
defaults[propertyName] = parseFloat(initializer.getText());
|
|
224697
|
+
break;
|
|
224698
|
+
default:
|
|
224699
|
+
defaults[propertyName] = () => initializer.getText();
|
|
224700
|
+
break;
|
|
224701
|
+
}
|
|
224702
|
+
}
|
|
224703
|
+
this.allEntities.set(classDeclaration.getName(), { nullables, defaults });
|
|
224704
|
+
});
|
|
224705
|
+
}
|
|
224706
|
+
});
|
|
224707
|
+
});
|
|
224708
|
+
}
|
|
224709
|
+
async onInit(customConfig = undefined) {
|
|
224710
|
+
const configFile = globbySync("cheetah.config.ts", { absolute: true });
|
|
224711
|
+
if (configFile.length === 0) {
|
|
224712
|
+
console.log("No config file found!");
|
|
224713
|
+
return;
|
|
224714
|
+
}
|
|
224715
|
+
const config = await import(configFile[0]);
|
|
224716
|
+
this.orm.setConnection(customConfig ?? config.default.connection);
|
|
224717
|
+
await this.orm.connect();
|
|
224718
|
+
if (typeof config.default.entities === "string") {
|
|
224719
|
+
const files = globbySync([config.default.entities, "!node_modules"], { gitignore: true, absolute: true });
|
|
224720
|
+
for (const file of files) {
|
|
224721
|
+
await import(file);
|
|
224722
|
+
}
|
|
224723
|
+
}
|
|
224724
|
+
const entities6 = Metadata.get(ENTITIES, Reflect);
|
|
224725
|
+
if (!entities6) {
|
|
224726
|
+
console.log("No entities found!");
|
|
224727
|
+
return;
|
|
224728
|
+
}
|
|
224729
|
+
for (const entity2 of entities6) {
|
|
224730
|
+
const nullableDefaultEntity = this.allEntities.get(entity2.target.name);
|
|
224731
|
+
const properties = Metadata.get(PROPERTIES_METADATA, entity2.target);
|
|
224732
|
+
const relationship = Metadata.get(PROPERTIES_RELATIONS, entity2.target);
|
|
224733
|
+
for (const property4 in properties) {
|
|
224734
|
+
if (nullableDefaultEntity?.nullables.includes(property4)) {
|
|
224735
|
+
properties[property4].options.nullable = true;
|
|
224736
|
+
}
|
|
224737
|
+
if (nullableDefaultEntity?.defaults[property4]) {
|
|
224738
|
+
properties[property4].options.default = nullableDefaultEntity?.defaults[property4];
|
|
224739
|
+
}
|
|
224740
|
+
}
|
|
224741
|
+
this.storage.add(entity2, properties, relationship);
|
|
224742
|
+
}
|
|
224743
|
+
console.log("Entities prepared!");
|
|
224744
|
+
}
|
|
224745
|
+
getSourceFilePaths() {
|
|
224746
|
+
const projectRoot = process.cwd();
|
|
224747
|
+
const getAllFiles = (dir) => {
|
|
224748
|
+
const patterns = [`${dir}/**/*.(ts|js)`, "!**/node_modules/**"];
|
|
224749
|
+
try {
|
|
224750
|
+
return globbySync(patterns, { gitignore: true });
|
|
224751
|
+
} catch (error) {
|
|
224752
|
+
console.error("Erro ao obter arquivos:", error);
|
|
224753
|
+
return [];
|
|
224754
|
+
}
|
|
224755
|
+
};
|
|
224756
|
+
return getAllFiles(projectRoot);
|
|
224757
|
+
}
|
|
224758
|
+
}
|
|
224759
|
+
__legacyDecorateClassTS([
|
|
224760
|
+
OnApplicationInit(),
|
|
224761
|
+
__legacyMetadataTS("design:type", Function),
|
|
224762
|
+
__legacyMetadataTS("design:paramtypes", [
|
|
224763
|
+
Object
|
|
224764
|
+
]),
|
|
224765
|
+
__legacyMetadataTS("design:returntype", Promise)
|
|
224766
|
+
], OrmService3.prototype, "onInit", null);
|
|
224767
|
+
OrmService3 = __legacyDecorateClassTS([
|
|
224768
|
+
Service(),
|
|
224769
|
+
__legacyMetadataTS("design:paramtypes", [
|
|
224770
|
+
typeof Orm2 === "undefined" ? Object : Orm2,
|
|
224771
|
+
typeof EntityStorage === "undefined" ? Object : EntityStorage,
|
|
224772
|
+
String
|
|
224773
|
+
])
|
|
224774
|
+
], OrmService3);
|
|
223979
224775
|
// ../../node_modules/balanc
|
|
223980
224776
|
class BaseEntity {
|
|
223981
224777
|
_oldValues = {};
|
|
@@ -224043,7 +224839,7 @@ class BaseEntity {
|
|
|
224043
224839
|
}
|
|
224044
224840
|
}
|
|
224045
224841
|
// ../../node_modules/bala
|
|
224046
|
-
var
|
|
224842
|
+
var import_pg2 = __toESM(require_lib2(), 1);
|
|
224047
224843
|
|
|
224048
224844
|
class PgDriver {
|
|
224049
224845
|
connectionString;
|
|
@@ -224055,7 +224851,7 @@ class PgDriver {
|
|
|
224055
224851
|
const { host, port, username, password, database } = options;
|
|
224056
224852
|
this.connectionString = `postgres://${username}:${password}@${host}:${port}/${database}`;
|
|
224057
224853
|
}
|
|
224058
|
-
this.client = new
|
|
224854
|
+
this.client = new import_pg2.Client({
|
|
224059
224855
|
connectionString: this.connectionString
|
|
224060
224856
|
});
|
|
224061
224857
|
}
|
|
@@ -224298,22 +225094,21 @@ class PgDriver {
|
|
|
224298
225094
|
}
|
|
224299
225095
|
}
|
|
224300
225096
|
}
|
|
224301
|
-
|
|
224302
225097
|
// ../../node_m
|
|
224303
|
-
var
|
|
225098
|
+
var CheetahOrm2 = new Cheetah({ exports: [Orm, OrmService3, EntityStorage] });
|
|
224304
225099
|
export {
|
|
224305
225100
|
getDefaultLength,
|
|
224306
|
-
|
|
225101
|
+
Property,
|
|
224307
225102
|
PrimaryKey,
|
|
224308
225103
|
PgDriver,
|
|
224309
|
-
OrmService,
|
|
225104
|
+
OrmService3 as OrmService,
|
|
224310
225105
|
Orm,
|
|
224311
225106
|
OneToMany,
|
|
224312
225107
|
ManyToOne,
|
|
224313
225108
|
Index,
|
|
224314
225109
|
Entity,
|
|
224315
|
-
CheetahOrm,
|
|
225110
|
+
CheetahOrm2 as CheetahOrm,
|
|
224316
225111
|
BaseEntity
|
|
224317
225112
|
};
|
|
224318
225113
|
|
|
224319
|
-
//# debugId=
|
|
225114
|
+
//# debugId=3C714E5DC008C7C264756e2164756e21
|