@punks/backend-entity-manager 0.0.459 → 0.0.461

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/cjs/index.js CHANGED
@@ -689,7 +689,9 @@ class EntityUpdateAction {
689
689
  await this.services
690
690
  .resolveUpdateCommand()
691
691
  .execute(id, updateInput);
692
- const entity = await this.services.resolveGetQuery().execute(id);
692
+ const entity = await this.services
693
+ .resolveGetQuery()
694
+ .execute(id);
693
695
  if (!entity) {
694
696
  throw new Error(`Newly created entity not found with id ${id}`);
695
697
  }
@@ -721,7 +723,9 @@ class EntityUpsertAction {
721
723
  await this.services
722
724
  .resolveUpsertCommand()
723
725
  .execute(id, updateInput);
724
- const entity = await this.services.resolveGetQuery().execute(id);
726
+ const entity = await this.services
727
+ .resolveGetQuery()
728
+ .execute(id);
725
729
  if (!entity) {
726
730
  throw new Error(`Newly created entity not found with id ${id}`);
727
731
  }
@@ -2308,11 +2312,11 @@ class EntityGetQuery {
2308
2312
  constructor(services) {
2309
2313
  this.services = services;
2310
2314
  }
2311
- async execute(id) {
2315
+ async execute(id, options) {
2312
2316
  const context = await this.getContext();
2313
2317
  const entity = await this.services
2314
2318
  .resolveQueryBuilder()
2315
- .get(id, context);
2319
+ .get(id, context, options);
2316
2320
  if (entity) {
2317
2321
  await this.authorize(entity);
2318
2322
  }
@@ -2346,11 +2350,14 @@ class EntitiesSearchQuery {
2346
2350
  constructor(services) {
2347
2351
  this.services = services;
2348
2352
  }
2349
- async execute(request) {
2353
+ async execute(request, options) {
2350
2354
  const context = await this.getContext();
2351
2355
  await this.authorizeSearch(context);
2352
2356
  const queryBuilder = this.services.resolveQueryBuilder();
2353
- const result = await queryBuilder.search(request, context);
2357
+ const result = await queryBuilder.search({
2358
+ ...request,
2359
+ relations: options?.relations ?? request.relations,
2360
+ }, context);
2354
2361
  const filteredEntities = await this.filterAllowedEntities(result.items, context);
2355
2362
  return {
2356
2363
  ...result,
@@ -3830,9 +3837,10 @@ class TypeOrmQueryBuilder extends QueryBuilderBase {
3830
3837
  this.clause = new QueryClauseBuilder();
3831
3838
  this.permissions = new PermissionsChecker();
3832
3839
  }
3833
- async get(id, context) {
3840
+ async get(id, context, options) {
3834
3841
  return await this.getRepository().get(id, {
3835
- relations: this.getRelationsToLoad(undefined, context, exports.QueryBuilderOperation.Get),
3842
+ relations: options?.relations ??
3843
+ this.getRelationsToLoad(undefined, context, exports.QueryBuilderOperation.Get),
3836
3844
  });
3837
3845
  }
3838
3846
  async exists(filters, context) {
@@ -35880,7 +35888,7 @@ let AwsS3FileProvider = class AwsS3FileProvider {
35880
35888
  };
35881
35889
  }
35882
35890
  getBucketFileUploadPath(fileName, filePath) {
35883
- return `${backendCore.ensureTailingSlash(filePath)}${backendCore.ensureStartSlash(fileName)}`;
35891
+ return `${backendCore.ensureTailingSlash(filePath)}${fileName}`;
35884
35892
  }
35885
35893
  getBucketFileUploadDayPath(fileName, date) {
35886
35894
  return `${backendCore.ensureTailingSlash(awsBucketSettings.value.paths.filesUpload)}${createDayPath(date)}${backendCore.ensureStartSlash(backendCore.newUuid())}_${fileName}`;