{"version":3,"sources":["../browser/src/decorator/relations/OneToMany.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAA8B,MAAM,QAAQ,CAAC;AAG3E;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,YAA2C,EAAE,WAAwC,EAAE,OAAyB;IACzI,OAAO,UAAU,MAAc,EAAE,YAAoB;QACjD,IAAI,CAAC,OAAO;YAAE,OAAO,GAAG,EAAqB,CAAC;QAE9C,4CAA4C;QAC5C,IAAI,MAAM,GAAG,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7D,IAAI,CAAC,MAAM,IAAI,OAAO,IAAK,OAAe,CAAC,WAAW,EAAE,EAAE,0BAA0B;YAChF,IAAM,aAAa,GAAI,OAAe,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACxF,IAAI,aAAa,IAAI,OAAO,aAAa,CAAC,IAAI,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,SAAS;gBACzG,MAAM,GAAG,IAAI,CAAC;SACrB;QAED,sBAAsB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;YACpC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,+BAA+B;YAC/B,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,aAAa;YAC3B,IAAI,EAAE,YAAY;YAClB,mBAAmB,EAAE,WAAW;YAChC,OAAO,EAAE,OAAO;SACK,CAAC,CAAC;IAC/B,CAAC,CAAC;AACN,CAAC","file":"OneToMany.js","sourcesContent":["import {getMetadataArgsStorage, ObjectType, RelationOptions} from \"../../\";\nimport {RelationMetadataArgs} from \"../../metadata-args/RelationMetadataArgs\";\n\n/**\n * One-to-many relation allows to create type of relation when Entity2 can have multiple instances of Entity1.\n * Entity1 have only one Entity2. Entity1 is an owner of the relationship, and storages Entity2 id on its own side.\n */\nexport function OneToMany<T>(typeFunction: (type?: any) => ObjectType<T>, inverseSide: string|((object: T) => any), options?: RelationOptions): Function {\n return function (object: Object, propertyName: string) {\n if (!options) options = {} as RelationOptions;\n\n // now try to determine it its lazy relation\n let isLazy = options && options.lazy === true ? true : false;\n if (!isLazy && Reflect && (Reflect as any).getMetadata) { // automatic determination\n const reflectedType = (Reflect as any).getMetadata(\"design:type\", object, propertyName);\n if (reflectedType && typeof reflectedType.name === \"string\" && reflectedType.name.toLowerCase() === \"promise\")\n isLazy = true;\n }\n\n getMetadataArgsStorage().relations.push({\n target: object.constructor,\n propertyName: propertyName,\n // propertyType: reflectedType,\n isLazy: isLazy,\n relationType: \"one-to-many\",\n type: typeFunction,\n inverseSideProperty: inverseSide,\n options: options\n } as RelationMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
|