@punks/backend-entity-manager 0.0.253 → 0.0.255

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
@@ -2376,8 +2376,6 @@ class EntityManagerServiceCollection {
2376
2376
  constructor(entityName, locator) {
2377
2377
  this.entityName = entityName;
2378
2378
  this.locator = locator;
2379
- this.replicas = new ReplicasConfiguration();
2380
- this.connectors = new ConnectorsConfiguration();
2381
2379
  this.resolver = new EntityServiceLocator(locator, entityName);
2382
2380
  }
2383
2381
  getServiceLocator() {
@@ -2470,11 +2468,15 @@ class EntityManagerServiceCollection {
2470
2468
  return this;
2471
2469
  }
2472
2470
  withReplica({ name, options, repository, }) {
2473
- this.replicas.configureReplica(name, options, repository);
2471
+ this.resolver
2472
+ .resolveReplicaConfiguration()
2473
+ .configureReplica(name, options, repository);
2474
2474
  return this;
2475
2475
  }
2476
2476
  withSynchronization({ name, options, connector, mapper, }) {
2477
- this.connectors.configureConnector(name, options, connector, mapper);
2477
+ this.resolver
2478
+ .resolveConnectorsConfiguration()
2479
+ .configureConnector(name, options, connector, mapper);
2478
2480
  return this;
2479
2481
  }
2480
2482
  }
@@ -4047,8 +4049,9 @@ exports.EntityManagerRegistry = class EntityManagerRegistry {
4047
4049
  if (!mapper.discoveredClass.injectType) {
4048
4050
  throw new Error(`No inject type found for entity connector mapper: ${entityName} - ${connector.meta.connectorName}`);
4049
4051
  }
4050
- const connectorInstance = (await app.resolve(connector.discoveredClass.injectType));
4051
- const mapperInstance = (await app.resolve(connector.discoveredClass.injectType));
4052
+ const connectorInstance = connector.discoveredClass
4053
+ .instance;
4054
+ const mapperInstance = mapper.discoveredClass.instance;
4052
4055
  registration.withSynchronization({
4053
4056
  name: connector.meta.connectorName,
4054
4057
  mapper: mapperInstance,
@@ -23743,6 +23746,13 @@ class AwsS3BucketError extends Error {
23743
23746
 
23744
23747
  const awsBucketSettings = new AppInMemorySettings();
23745
23748
 
23749
+ const streamToBuffer = (stream) => new Promise((resolve, reject) => {
23750
+ const chunks = [];
23751
+ stream.on("data", (chunk) => chunks.push(chunk));
23752
+ stream.once("end", () => resolve(Buffer.concat(chunks)));
23753
+ stream.once("error", reject);
23754
+ });
23755
+
23746
23756
  const createClient$3 = (settings) => new clientS3.S3Client({
23747
23757
  region: settings.region,
23748
23758
  credentials: settings.awsAccessKeyId && settings.awsSecretAccessKey
@@ -23803,7 +23813,7 @@ exports.AwsS3BucketProvider = class AwsS3BucketProvider {
23803
23813
  Bucket: input.bucket,
23804
23814
  Key: input.filePath,
23805
23815
  }));
23806
- return Buffer.from(result.Body);
23816
+ return streamToBuffer(result.Body);
23807
23817
  }
23808
23818
  catch (e) {
23809
23819
  throw new AwsS3BucketError(`AWS BUCKET | downloadFile | ${input.bucket} | ${input.filePath} | Error -> ${e.message}`);
@@ -29385,7 +29395,7 @@ exports.AwsS3MediaProvider = class AwsS3MediaProvider {
29385
29395
  Bucket: parsedRef.bucket,
29386
29396
  Key: parsedRef.path,
29387
29397
  }));
29388
- return Buffer.from(result.Body);
29398
+ return streamToBuffer(result.Body);
29389
29399
  }
29390
29400
  catch (e) {
29391
29401
  throw new AwsS3MediaError(`AwsS3MediaProvider | mediaDownload | ${input.ref} | Error -> ${e.message}`);