@cheetah.js/orm 0.1.30 → 0.1.32
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.js +138 -88
- package/dist/bun/index.js.map +20 -20
- package/package.json +2 -2
package/dist/bun/index.js
CHANGED
|
@@ -218349,6 +218349,7 @@ class Provider {
|
|
|
218349
218349
|
instance;
|
|
218350
218350
|
_provide;
|
|
218351
218351
|
_useClass;
|
|
218352
|
+
_useValue;
|
|
218352
218353
|
hooks;
|
|
218353
218354
|
path;
|
|
218354
218355
|
scope = ProviderScope.SINGLETON;
|
|
@@ -218379,6 +218380,12 @@ class Provider {
|
|
|
218379
218380
|
}, {});
|
|
218380
218381
|
}
|
|
218381
218382
|
}
|
|
218383
|
+
get useValue() {
|
|
218384
|
+
return this._useValue;
|
|
218385
|
+
}
|
|
218386
|
+
set useValue(value) {
|
|
218387
|
+
this._useValue = value();
|
|
218388
|
+
}
|
|
218382
218389
|
get provide() {
|
|
218383
218390
|
return this._provide;
|
|
218384
218391
|
}
|
|
@@ -221476,10 +221483,7 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
|
|
|
221476
221483
|
if (controller2.children) {
|
|
221477
221484
|
const childrenRoutes = this.resolveChildrenRoutes(controller2.path ?? "", controller2.children, controllerMiddleware);
|
|
221478
221485
|
childrenRoutes.forEach((route) => {
|
|
221479
|
-
hydrateRoute.set(route.method.toLowerCase(), [
|
|
221480
|
-
...hydrateRoute.get(route.method.toLowerCase()) || [],
|
|
221481
|
-
route
|
|
221482
|
-
]);
|
|
221486
|
+
hydrateRoute.set(route.method.toLowerCase(), [...hydrateRoute.get(route.method.toLowerCase()) || [], route]);
|
|
221483
221487
|
});
|
|
221484
221488
|
}
|
|
221485
221489
|
}
|
|
@@ -221544,7 +221548,7 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
|
|
|
221544
221548
|
get(token) {
|
|
221545
221549
|
return this.ensureProvider(token);
|
|
221546
221550
|
}
|
|
221547
|
-
invoke(token, locals, options) {
|
|
221551
|
+
invoke(token, locals, options = {}) {
|
|
221548
221552
|
if (locals && locals.has(token)) {
|
|
221549
221553
|
return locals.get(token);
|
|
221550
221554
|
}
|
|
@@ -221559,15 +221563,21 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
|
|
|
221559
221563
|
if (provider3.instance)
|
|
221560
221564
|
return provider3.instance;
|
|
221561
221565
|
let scope = this.scopeOf(provider3);
|
|
221562
|
-
if (!provider3.useClass)
|
|
221566
|
+
if (!provider3.useClass && !provider3.useValue)
|
|
221563
221567
|
throw new Error("Provider not found.");
|
|
221564
221568
|
const deps = this.getConstructorDependencies(provider3.useClass);
|
|
221565
|
-
|
|
221569
|
+
let construct;
|
|
221570
|
+
if (provider3.useValue)
|
|
221571
|
+
construct = (deps2) => provider3.useValue;
|
|
221572
|
+
else
|
|
221573
|
+
construct = (deps2) => new provider3.useClass(...deps2);
|
|
221566
221574
|
let instance;
|
|
221567
221575
|
if (isRequestScope(provider3, deps, this)) {
|
|
221568
221576
|
scope = ProviderScope.REQUEST;
|
|
221569
221577
|
}
|
|
221570
|
-
|
|
221578
|
+
let services = [];
|
|
221579
|
+
if (!provider3.useValue)
|
|
221580
|
+
services = deps.filter((t) => !isPrimitiveType(t)).map((token) => this.invoke(getClassOrSymbol(token), locals));
|
|
221571
221581
|
instance = construct(services);
|
|
221572
221582
|
switch (scope) {
|
|
221573
221583
|
case ProviderScope.SINGLETON:
|
|
@@ -221646,12 +221656,7 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
|
|
|
221646
221656
|
this.container.set(InjectorService_1, provider3);
|
|
221647
221657
|
}
|
|
221648
221658
|
removeUnknownProviders() {
|
|
221649
|
-
const defaults = [
|
|
221650
|
-
Context,
|
|
221651
|
-
InjectorService_1,
|
|
221652
|
-
DefaultRoutesCheetah,
|
|
221653
|
-
LoggerService
|
|
221654
|
-
];
|
|
221659
|
+
const defaults = [Context, InjectorService_1, DefaultRoutesCheetah, LoggerService];
|
|
221655
221660
|
this.applicationConfig.providers = this.applicationConfig.providers || [];
|
|
221656
221661
|
this.applicationConfig.providers.push(...defaults);
|
|
221657
221662
|
let hooks = Metadata.get(CONTROLLER_EVENTS, Reflect);
|
|
@@ -221723,6 +221728,7 @@ var Context = Context_1 = class Context2 {
|
|
|
221723
221728
|
req = {};
|
|
221724
221729
|
headers = {};
|
|
221725
221730
|
locals = {};
|
|
221731
|
+
resultStatus = 200;
|
|
221726
221732
|
constructor() {
|
|
221727
221733
|
}
|
|
221728
221734
|
static async createFromRequest(url, request, server) {
|
|
@@ -221763,6 +221769,12 @@ var Context = Context_1 = class Context2 {
|
|
|
221763
221769
|
setParam(param) {
|
|
221764
221770
|
this.param = param;
|
|
221765
221771
|
}
|
|
221772
|
+
setResponseStatus(status) {
|
|
221773
|
+
this.resultStatus = status;
|
|
221774
|
+
}
|
|
221775
|
+
getResponseStatus() {
|
|
221776
|
+
return this.resultStatus;
|
|
221777
|
+
}
|
|
221766
221778
|
};
|
|
221767
221779
|
Context = Context_1 = __decorate2([
|
|
221768
221780
|
Injectable({ scope: ProviderScope.REQUEST }),
|
|
@@ -221891,9 +221903,9 @@ class Router {
|
|
|
221891
221903
|
}
|
|
221892
221904
|
const result = await injector.invokeRoute(route, context, locals);
|
|
221893
221905
|
injector.callHook(EventType.OnResponse, { context, result });
|
|
221894
|
-
return this.mountResponse(result);
|
|
221906
|
+
return this.mountResponse(result, context);
|
|
221895
221907
|
}
|
|
221896
|
-
mountResponse(result) {
|
|
221908
|
+
mountResponse(result, context) {
|
|
221897
221909
|
let payload;
|
|
221898
221910
|
let contentType;
|
|
221899
221911
|
if (result instanceof Response) {
|
|
@@ -221912,7 +221924,7 @@ class Router {
|
|
|
221912
221924
|
payload = result;
|
|
221913
221925
|
contentType = "text/plain";
|
|
221914
221926
|
}
|
|
221915
|
-
return new Response(payload, { status:
|
|
221927
|
+
return new Response(payload, { status: context.getResponseStatus() || 201, headers: { "Content-Type": contentType } });
|
|
221916
221928
|
}
|
|
221917
221929
|
}
|
|
221918
221930
|
var RouteExecutor = new Router;
|
|
@@ -222296,6 +222308,13 @@ var LoggerService = class LoggerService2 {
|
|
|
222296
222308
|
constructor(injector) {
|
|
222297
222309
|
this.injector = injector;
|
|
222298
222310
|
const pinoConfig = this.injector.applicationConfig.logger || {};
|
|
222311
|
+
pinoConfig["transport"] = pinoConfig.transport || {
|
|
222312
|
+
target: "pino-pretty",
|
|
222313
|
+
options: {
|
|
222314
|
+
colorize: true,
|
|
222315
|
+
ignore: "pid,hostname"
|
|
222316
|
+
}
|
|
222317
|
+
};
|
|
222299
222318
|
this.logger = import_pino.default(pinoConfig);
|
|
222300
222319
|
}
|
|
222301
222320
|
info(message, ...args) {
|
|
@@ -222338,53 +222357,6 @@ function toSnakeCase(propertyKey1) {
|
|
|
222338
222357
|
return propertyKey1.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
222339
222358
|
}
|
|
222340
222359
|
|
|
222341
|
-
// ../../node_modules/balanced-match
|
|
222342
|
-
function Index(options) {
|
|
222343
|
-
return (target, propertyKey) => {
|
|
222344
|
-
const indexes = Metadata.get("indexes", target.constructor) || [];
|
|
222345
|
-
let index;
|
|
222346
|
-
if (options && options.properties) {
|
|
222347
|
-
const properties = options.properties;
|
|
222348
|
-
index = { name: `${properties.join("_")}_index`, properties: options.properties };
|
|
222349
|
-
} else {
|
|
222350
|
-
index = { name: `${propertyKey}_index`, properties: [propertyKey] };
|
|
222351
|
-
}
|
|
222352
|
-
indexes.push(index);
|
|
222353
|
-
Metadata.set("indexes", indexes, target.constructor);
|
|
222354
|
-
};
|
|
222355
|
-
}
|
|
222356
|
-
|
|
222357
|
-
// ../../node_modules/balanced-match/in
|
|
222358
|
-
function Property(options) {
|
|
222359
|
-
return (target, propertyKey) => {
|
|
222360
|
-
const properties = Metadata.get(PROPERTIES, target.constructor) || [];
|
|
222361
|
-
const type = Metadata.getType(target, propertyKey);
|
|
222362
|
-
const length = options && options.length || getDefaultLength(type.name);
|
|
222363
|
-
options = { length, ...options };
|
|
222364
|
-
options["columnName"] = options?.columnName || toSnakeCase(propertyKey);
|
|
222365
|
-
properties.push({ propertyKey, options });
|
|
222366
|
-
Metadata.set(PROPERTIES, properties, target.constructor);
|
|
222367
|
-
if (options.isPrimary) {
|
|
222368
|
-
const indexes = Metadata.get("indexes", target.constructor) || [];
|
|
222369
|
-
indexes.push({ name: `[TABLE]_pkey`, properties: [propertyKey] });
|
|
222370
|
-
Metadata.set("indexes", indexes, target.constructor);
|
|
222371
|
-
}
|
|
222372
|
-
if (options.index) {
|
|
222373
|
-
Index({ properties: [propertyKey] })(target, propertyKey);
|
|
222374
|
-
}
|
|
222375
|
-
properties.forEach((property) => {
|
|
222376
|
-
const types = Metadata.get(PROPERTIES_METADATA, target.constructor) || {};
|
|
222377
|
-
const type2 = Metadata.getType(target, property.propertyKey);
|
|
222378
|
-
types[property.propertyKey] = { type: type2, options: property.options };
|
|
222379
|
-
Metadata.set(PROPERTIES_METADATA, types, target.constructor);
|
|
222380
|
-
});
|
|
222381
|
-
};
|
|
222382
|
-
}
|
|
222383
|
-
// ../../node_modules/balanced-match/index
|
|
222384
|
-
function PrimaryKey(options) {
|
|
222385
|
-
const isPrimary = true;
|
|
222386
|
-
return Property({ ...options, isPrimary, unique: true });
|
|
222387
|
-
}
|
|
222388
222360
|
// ../../node_modules/balanced-match/index.jsodules/minimatch
|
|
222389
222361
|
var ProviderType2;
|
|
222390
222362
|
(function(ProviderType3) {
|
|
@@ -222409,6 +222381,7 @@ class Provider2 {
|
|
|
222409
222381
|
instance;
|
|
222410
222382
|
_provide;
|
|
222411
222383
|
_useClass;
|
|
222384
|
+
_useValue;
|
|
222412
222385
|
hooks;
|
|
222413
222386
|
path;
|
|
222414
222387
|
scope = ProviderScope2.SINGLETON;
|
|
@@ -222439,6 +222412,12 @@ class Provider2 {
|
|
|
222439
222412
|
}, {});
|
|
222440
222413
|
}
|
|
222441
222414
|
}
|
|
222415
|
+
get useValue() {
|
|
222416
|
+
return this._useValue;
|
|
222417
|
+
}
|
|
222418
|
+
set useValue(value) {
|
|
222419
|
+
this._useValue = value();
|
|
222420
|
+
}
|
|
222442
222421
|
get provide() {
|
|
222443
222422
|
return this._provide;
|
|
222444
222423
|
}
|
|
@@ -223200,10 +223179,7 @@ var InjectorService5 = InjectorService_12 = class InjectorService6 {
|
|
|
223200
223179
|
if (controller3.children) {
|
|
223201
223180
|
const childrenRoutes = this.resolveChildrenRoutes(controller3.path ?? "", controller3.children, controllerMiddleware);
|
|
223202
223181
|
childrenRoutes.forEach((route) => {
|
|
223203
|
-
hydrateRoute.set(route.method.toLowerCase(), [
|
|
223204
|
-
...hydrateRoute.get(route.method.toLowerCase()) || [],
|
|
223205
|
-
route
|
|
223206
|
-
]);
|
|
223182
|
+
hydrateRoute.set(route.method.toLowerCase(), [...hydrateRoute.get(route.method.toLowerCase()) || [], route]);
|
|
223207
223183
|
});
|
|
223208
223184
|
}
|
|
223209
223185
|
}
|
|
@@ -223283,10 +223259,14 @@ var InjectorService5 = InjectorService_12 = class InjectorService6 {
|
|
|
223283
223259
|
if (provider6.instance)
|
|
223284
223260
|
return provider6.instance;
|
|
223285
223261
|
let scope = this.scopeOf(provider6);
|
|
223286
|
-
if (!provider6.useClass)
|
|
223262
|
+
if (!provider6.useClass && !provider6.useValue)
|
|
223287
223263
|
throw new Error("Provider not found.");
|
|
223288
223264
|
const deps = this.getConstructorDependencies(provider6.useClass);
|
|
223289
|
-
|
|
223265
|
+
let construct;
|
|
223266
|
+
if (provider6.useClass)
|
|
223267
|
+
construct = (deps2) => new provider6.useClass(...deps2);
|
|
223268
|
+
else
|
|
223269
|
+
construct = (deps2) => provider6.useValue;
|
|
223290
223270
|
let instance;
|
|
223291
223271
|
if (isRequestScope(provider6, deps, this)) {
|
|
223292
223272
|
scope = ProviderScope.REQUEST;
|
|
@@ -223370,12 +223350,7 @@ var InjectorService5 = InjectorService_12 = class InjectorService6 {
|
|
|
223370
223350
|
this.container.set(InjectorService_12, provider6);
|
|
223371
223351
|
}
|
|
223372
223352
|
removeUnknownProviders() {
|
|
223373
|
-
const defaults = [
|
|
223374
|
-
Context,
|
|
223375
|
-
InjectorService_12,
|
|
223376
|
-
DefaultRoutesCheetah,
|
|
223377
|
-
LoggerService
|
|
223378
|
-
];
|
|
223353
|
+
const defaults = [Context, InjectorService_12, DefaultRoutesCheetah, LoggerService];
|
|
223379
223354
|
this.applicationConfig.providers = this.applicationConfig.providers || [];
|
|
223380
223355
|
this.applicationConfig.providers.push(...defaults);
|
|
223381
223356
|
let hooks2 = Metadata.get(CONTROLLER_EVENTS, Reflect);
|
|
@@ -223442,6 +223417,7 @@ var Context4 = Context_12 = class Context5 {
|
|
|
223442
223417
|
req = {};
|
|
223443
223418
|
headers = {};
|
|
223444
223419
|
locals = {};
|
|
223420
|
+
resultStatus = 200;
|
|
223445
223421
|
constructor() {
|
|
223446
223422
|
}
|
|
223447
223423
|
static async createFromRequest(url, request, server) {
|
|
@@ -223449,7 +223425,15 @@ var Context4 = Context_12 = class Context5 {
|
|
|
223449
223425
|
if (request.method === "GET") {
|
|
223450
223426
|
context.setQuery(url);
|
|
223451
223427
|
} else {
|
|
223452
|
-
|
|
223428
|
+
if (request.headers.get("content-type").includes("application/json")) {
|
|
223429
|
+
context.body = await request.json();
|
|
223430
|
+
} else if (request.headers.get("content-type").includes("application/x-www-form-urlencoded")) {
|
|
223431
|
+
context.setBody(await request.formData());
|
|
223432
|
+
} else if (request.headers.get("content-type").includes("multipart/form-data")) {
|
|
223433
|
+
context.setBody(await request.formData());
|
|
223434
|
+
} else {
|
|
223435
|
+
context.body = { body: await request.text() };
|
|
223436
|
+
}
|
|
223453
223437
|
}
|
|
223454
223438
|
context.setReq(request);
|
|
223455
223439
|
context.setHeaders(request.headers);
|
|
@@ -223474,6 +223458,12 @@ var Context4 = Context_12 = class Context5 {
|
|
|
223474
223458
|
setParam(param) {
|
|
223475
223459
|
this.param = param;
|
|
223476
223460
|
}
|
|
223461
|
+
setResponseStatus(status) {
|
|
223462
|
+
this.resultStatus = status;
|
|
223463
|
+
}
|
|
223464
|
+
getResponseStatus() {
|
|
223465
|
+
return this.resultStatus;
|
|
223466
|
+
}
|
|
223477
223467
|
};
|
|
223478
223468
|
Context4 = Context_12 = __decorate6([
|
|
223479
223469
|
Injectable({ scope: ProviderScope.REQUEST }),
|
|
@@ -223597,9 +223587,9 @@ class Router2 {
|
|
|
223597
223587
|
}
|
|
223598
223588
|
const result = await injector.invokeRoute(route, context, locals);
|
|
223599
223589
|
injector.callHook(EventType.OnResponse, { context, result });
|
|
223600
|
-
return this.mountResponse(result);
|
|
223590
|
+
return this.mountResponse(result, context);
|
|
223601
223591
|
}
|
|
223602
|
-
mountResponse(result) {
|
|
223592
|
+
mountResponse(result, context) {
|
|
223603
223593
|
let payload;
|
|
223604
223594
|
let contentType;
|
|
223605
223595
|
if (result instanceof Response) {
|
|
@@ -223618,7 +223608,7 @@ class Router2 {
|
|
|
223618
223608
|
payload = result;
|
|
223619
223609
|
contentType = "text/plain";
|
|
223620
223610
|
}
|
|
223621
|
-
return new Response(payload, { status:
|
|
223611
|
+
return new Response(payload, { status: context.getResponseStatus() || 201, headers: { "Content-Type": contentType } });
|
|
223622
223612
|
}
|
|
223623
223613
|
}
|
|
223624
223614
|
var RouteExecutor4 = new Router2;
|
|
@@ -223649,11 +223639,17 @@ class Cheetah3 {
|
|
|
223649
223639
|
registerProvider({ provide: LoggerService, useClass: provider7 });
|
|
223650
223640
|
return this;
|
|
223651
223641
|
}
|
|
223642
|
+
init() {
|
|
223643
|
+
this.injector.loadModule(createContainer(), this.config, this.router);
|
|
223644
|
+
}
|
|
223652
223645
|
async listen(port = 3000) {
|
|
223653
223646
|
process5.on("SIGTERM", () => this.injector.callHook(EventType.OnApplicationShutdown));
|
|
223654
|
-
this.
|
|
223647
|
+
this.init();
|
|
223655
223648
|
this.createHttpServer(port);
|
|
223656
223649
|
}
|
|
223650
|
+
getHttpServer() {
|
|
223651
|
+
return this.server;
|
|
223652
|
+
}
|
|
223657
223653
|
getInjector() {
|
|
223658
223654
|
return this.injector;
|
|
223659
223655
|
}
|
|
@@ -223750,6 +223746,13 @@ var LoggerService3 = class LoggerService4 {
|
|
|
223750
223746
|
constructor(injector) {
|
|
223751
223747
|
this.injector = injector;
|
|
223752
223748
|
const pinoConfig = this.injector.applicationConfig.logger || {};
|
|
223749
|
+
pinoConfig["transport"] = pinoConfig.transport || {
|
|
223750
|
+
target: "pino-pretty",
|
|
223751
|
+
options: {
|
|
223752
|
+
colorize: true,
|
|
223753
|
+
ignore: "pid,hostname"
|
|
223754
|
+
}
|
|
223755
|
+
};
|
|
223753
223756
|
this.logger = import_pino2.default(pinoConfig);
|
|
223754
223757
|
}
|
|
223755
223758
|
info(message, ...args) {
|
|
@@ -223775,23 +223778,70 @@ LoggerService3 = __decorate8([
|
|
|
223775
223778
|
Service(),
|
|
223776
223779
|
__metadata6("design:paramtypes", [InjectorService])
|
|
223777
223780
|
], LoggerService3);
|
|
223781
|
+
// ../../node_modules/balanced-match
|
|
223782
|
+
function Index(options) {
|
|
223783
|
+
return (target, propertyKey) => {
|
|
223784
|
+
const indexes = Metadata3.get("indexes", target.constructor) || [];
|
|
223785
|
+
let index;
|
|
223786
|
+
if (options && options.properties) {
|
|
223787
|
+
const properties = options.properties;
|
|
223788
|
+
index = { name: `${properties.join("_")}_index`, properties: options.properties };
|
|
223789
|
+
} else {
|
|
223790
|
+
index = { name: `${propertyKey}_index`, properties: [propertyKey] };
|
|
223791
|
+
}
|
|
223792
|
+
indexes.push(index);
|
|
223793
|
+
Metadata3.set("indexes", indexes, target.constructor);
|
|
223794
|
+
};
|
|
223795
|
+
}
|
|
223796
|
+
|
|
223797
|
+
// ../../node_modules/balanced-match/in
|
|
223798
|
+
function Property(options) {
|
|
223799
|
+
return (target, propertyKey) => {
|
|
223800
|
+
const properties = Metadata.get(PROPERTIES, target.constructor) || [];
|
|
223801
|
+
const type = Metadata.getType(target, propertyKey);
|
|
223802
|
+
const length = options && options.length || getDefaultLength(type.name);
|
|
223803
|
+
options = { length, ...options };
|
|
223804
|
+
options["columnName"] = options?.columnName || toSnakeCase(propertyKey);
|
|
223805
|
+
properties.push({ propertyKey, options });
|
|
223806
|
+
Metadata.set(PROPERTIES, properties, target.constructor);
|
|
223807
|
+
if (options.isPrimary) {
|
|
223808
|
+
const indexes = Metadata.get("indexes", target.constructor) || [];
|
|
223809
|
+
indexes.push({ name: `[TABLE]_pkey`, properties: [propertyKey] });
|
|
223810
|
+
Metadata.set("indexes", indexes, target.constructor);
|
|
223811
|
+
}
|
|
223812
|
+
if (options.index) {
|
|
223813
|
+
Index({ properties: [propertyKey] })(target, propertyKey);
|
|
223814
|
+
}
|
|
223815
|
+
properties.forEach((property) => {
|
|
223816
|
+
const types = Metadata.get(PROPERTIES_METADATA, target.constructor) || {};
|
|
223817
|
+
const type2 = Metadata.getType(target, property.propertyKey);
|
|
223818
|
+
types[property.propertyKey] = { type: type2, options: property.options };
|
|
223819
|
+
Metadata.set(PROPERTIES_METADATA, types, target.constructor);
|
|
223820
|
+
});
|
|
223821
|
+
};
|
|
223822
|
+
}
|
|
223823
|
+
// ../../node_modules/balanced-match/index
|
|
223824
|
+
function PrimaryKey(options) {
|
|
223825
|
+
const isPrimary = true;
|
|
223826
|
+
return Property({ ...options, isPrimary, unique: true });
|
|
223827
|
+
}
|
|
223778
223828
|
// ../../node_modules/balanced-match/in
|
|
223779
223829
|
function OneToMany(entity, fkKey) {
|
|
223780
223830
|
return (target, propertyKey) => {
|
|
223781
|
-
const existing =
|
|
223782
|
-
const options = { relation: "one-to-many", propertyKey, isRelation: true, entity, fkKey, type:
|
|
223831
|
+
const existing = Metadata.get(PROPERTIES_RELATIONS, target.constructor) || [];
|
|
223832
|
+
const options = { relation: "one-to-many", propertyKey, isRelation: true, entity, fkKey, type: Metadata.getType(target, propertyKey), originalEntity: target.constructor };
|
|
223783
223833
|
options["columnName"] = `${toSnakeCase(propertyKey)}_id`;
|
|
223784
223834
|
existing.push(options);
|
|
223785
|
-
|
|
223835
|
+
Metadata.set(PROPERTIES_RELATIONS, existing, target.constructor);
|
|
223786
223836
|
};
|
|
223787
223837
|
}
|
|
223788
223838
|
function ManyToOne(entity) {
|
|
223789
223839
|
return (target, propertyKey) => {
|
|
223790
|
-
const existing =
|
|
223791
|
-
const options = { relation: "many-to-one", propertyKey, isRelation: true, entity, type:
|
|
223840
|
+
const existing = Metadata.get(PROPERTIES_RELATIONS, target.constructor) || [];
|
|
223841
|
+
const options = { relation: "many-to-one", propertyKey, isRelation: true, entity, type: Metadata.getType(target, propertyKey), originalEntity: target.constructor };
|
|
223792
223842
|
options["columnName"] = `${toSnakeCase(propertyKey)}_id`;
|
|
223793
223843
|
existing.push(options);
|
|
223794
|
-
|
|
223844
|
+
Metadata.set(PROPERTIES_RELATIONS, existing, target.constructor);
|
|
223795
223845
|
};
|
|
223796
223846
|
}
|
|
223797
223847
|
// ../../node_modules/balanced-match/inde
|
|
@@ -227580,4 +227630,4 @@ export {
|
|
|
227580
227630
|
AfterCreate
|
|
227581
227631
|
};
|
|
227582
227632
|
|
|
227583
|
-
//# debugId=
|
|
227633
|
+
//# debugId=D324EA0E9DAC3A1664756e2164756e21
|