sonamu 0.2.51 → 0.2.53

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.
@@ -4163,7 +4163,7 @@ var DBClass = class {
4163
4163
  );
4164
4164
  try {
4165
4165
  const knexfileModule = await Promise.resolve().then(() => _interopRequireWildcard(require(dbConfigPath)));
4166
- return knexfileModule.default;
4166
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([knexfileModule, 'access', _81 => _81.default, 'optionalAccess', _82 => _82.default]), () => ( knexfileModule.default)), () => ( knexfileModule));
4167
4167
  } catch (e17) {
4168
4168
  }
4169
4169
  throw new ServiceUnavailableException(
@@ -4304,7 +4304,7 @@ var UpsertBuilder = class {
4304
4304
  this.tables.set(tableName, {
4305
4305
  references: /* @__PURE__ */ new Set(),
4306
4306
  rows: [],
4307
- uniqueIndexes: _nullishCoalesce(_optionalChain([tableSpec, 'optionalAccess', _81 => _81.uniqueIndexes]), () => ( [])),
4307
+ uniqueIndexes: _nullishCoalesce(_optionalChain([tableSpec, 'optionalAccess', _83 => _83.uniqueIndexes]), () => ( [])),
4308
4308
  uniquesMap: /* @__PURE__ */ new Map()
4309
4309
  });
4310
4310
  }
@@ -4719,7 +4719,7 @@ var BaseModelClass = class {
4719
4719
  _chalk2.default.blue(countQuery.toQuery().toString())
4720
4720
  );
4721
4721
  }
4722
- return _nullishCoalesce(_optionalChain([countRow, 'optionalAccess', _82 => _82.total]), () => ( 0));
4722
+ return _nullishCoalesce(_optionalChain([countRow, 'optionalAccess', _84 => _84.total]), () => ( 0));
4723
4723
  })();
4724
4724
  const rows = await (async () => {
4725
4725
  if (queryMode === "count") {
@@ -4895,7 +4895,7 @@ var SonamuClass = class {
4895
4895
  }
4896
4896
  async withFastify(server, config, options) {
4897
4897
  if (this.isInitialized === false) {
4898
- await this.init(_optionalChain([options, 'optionalAccess', _83 => _83.doSilent]), _optionalChain([options, 'optionalAccess', _84 => _84.enableSync]));
4898
+ await this.init(_optionalChain([options, 'optionalAccess', _85 => _85.doSilent]), _optionalChain([options, 'optionalAccess', _86 => _86.enableSync]));
4899
4899
  }
4900
4900
  server.get(
4901
4901
  `${this.config.route.prefix}/routes`,
@@ -5313,7 +5313,7 @@ var Entity = class {
5313
5313
  const relSubsetQuery = relEntity.resolveSubsetQuery("", relFields);
5314
5314
  let manyJoin;
5315
5315
  if (isHasManyRelationProp(relation)) {
5316
- const fromCol = _nullishCoalesce(_optionalChain([relation, 'optionalAccess', _85 => _85.fromColumn]), () => ( "id"));
5316
+ const fromCol = _nullishCoalesce(_optionalChain([relation, 'optionalAccess', _87 => _87.fromColumn]), () => ( "id"));
5317
5317
  manyJoin = {
5318
5318
  fromTable: this.table,
5319
5319
  fromCol,
@@ -6518,7 +6518,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
6518
6518
  const [, keyName, from, referencesTable, referencesField, onClause] = matched2;
6519
6519
  const [onUpdateFull, _onUpdate] = _nullishCoalesce((_nullishCoalesce(onClause, () => ( ""))).match(/ON UPDATE ([A-Z ]+)$/), () => ( []));
6520
6520
  const onUpdate = _nullishCoalesce(_onUpdate, () => ( "NO ACTION"));
6521
- const onDelete = _nullishCoalesce(_optionalChain([(_nullishCoalesce(onClause, () => ( ""))), 'access', _86 => _86.replace, 'call', _87 => _87(_nullishCoalesce(onUpdateFull, () => ( "")), ""), 'access', _88 => _88.match, 'call', _89 => _89(/ON DELETE ([A-Z ]+) /), 'optionalAccess', _90 => _90[1]]), () => ( "NO ACTION"));
6521
+ const onDelete = _nullishCoalesce(_optionalChain([(_nullishCoalesce(onClause, () => ( ""))), 'access', _88 => _88.replace, 'call', _89 => _89(_nullishCoalesce(onUpdateFull, () => ( "")), ""), 'access', _90 => _90.match, 'call', _91 => _91(/ON DELETE ([A-Z ]+) /), 'optionalAccess', _92 => _92[1]]), () => ( "NO ACTION"));
6522
6522
  return {
6523
6523
  keyName,
6524
6524
  from,
@@ -7393,7 +7393,7 @@ var FixtureManagerClass = class {
7393
7393
  const targetDB = _knex2.default.call(void 0, Sonamu.dbConfig[targetDBName]);
7394
7394
  const { entityId, field, value, searchType } = searchOptions;
7395
7395
  const entity = EntityManager.get(entityId);
7396
- const column = _optionalChain([entity, 'access', _91 => _91.props, 'access', _92 => _92.find, 'call', _93 => _93((prop) => prop.name === field), 'optionalAccess', _94 => _94.type]) === "relation" ? `${field}_id` : field;
7396
+ const column = _optionalChain([entity, 'access', _93 => _93.props, 'access', _94 => _94.find, 'call', _95 => _95((prop) => prop.name === field), 'optionalAccess', _96 => _96.type]) === "relation" ? `${field}_id` : field;
7397
7397
  let query = sourceDB(entity.table);
7398
7398
  if (searchType === "equals") {
7399
7399
  query = query.where(column, value);
@@ -7465,7 +7465,7 @@ var FixtureManagerClass = class {
7465
7465
  prop,
7466
7466
  value: row[prop.name]
7467
7467
  };
7468
- const db = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _95 => _95._db]), () => ( BaseModel.getDB("w")));
7468
+ const db = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _97 => _97._db]), () => ( BaseModel.getDB("w")));
7469
7469
  if (isManyToManyRelationProp(prop)) {
7470
7470
  const relatedEntity = EntityManager.get(prop.with);
7471
7471
  const throughTable = prop.joinTable;
@@ -7484,7 +7484,7 @@ var FixtureManagerClass = class {
7484
7484
  );
7485
7485
  if (relatedProp) {
7486
7486
  const relatedRow = await db(relatedEntity.table).where("id", row.id).first();
7487
- record.columns[prop.name].value = _optionalChain([relatedRow, 'optionalAccess', _96 => _96.id]);
7487
+ record.columns[prop.name].value = _optionalChain([relatedRow, 'optionalAccess', _98 => _98.id]);
7488
7488
  }
7489
7489
  } else if (isRelationProp(prop)) {
7490
7490
  const relatedId = row[`${prop.name}_id`];
@@ -7492,7 +7492,7 @@ var FixtureManagerClass = class {
7492
7492
  if (relatedId) {
7493
7493
  record.belongsRecords.push(`${prop.with}#${relatedId}`);
7494
7494
  }
7495
- if (!_optionalChain([options, 'optionalAccess', _97 => _97.singleRecord]) && relatedId) {
7495
+ if (!_optionalChain([options, 'optionalAccess', _99 => _99.singleRecord]) && relatedId) {
7496
7496
  const relatedEntity = EntityManager.get(prop.with);
7497
7497
  const relatedRow = await db(relatedEntity.table).where("id", relatedId).first();
7498
7498
  if (relatedRow) {
@@ -7832,4 +7832,4 @@ var FixtureManager = new FixtureManagerClass();
7832
7832
 
7833
7833
 
7834
7834
  exports.SQLDateTimeString = SQLDateTimeString; exports.zArrayable = zArrayable; exports.isIntegerProp = isIntegerProp; exports.isBigIntegerProp = isBigIntegerProp; exports.isTextProp = isTextProp; exports.isStringProp = isStringProp; exports.isEnumProp = isEnumProp; exports.isFloatProp = isFloatProp; exports.isDoubleProp = isDoubleProp; exports.isDecimalProp = isDecimalProp; exports.isBooleanProp = isBooleanProp; exports.isDateProp = isDateProp; exports.isDateTimeProp = isDateTimeProp; exports.isTimeProp = isTimeProp; exports.isTimestampProp = isTimestampProp; exports.isJsonProp = isJsonProp; exports.isUuidProp = isUuidProp; exports.isVirtualProp = isVirtualProp; exports.isRelationProp = isRelationProp; exports.isOneToOneRelationProp = isOneToOneRelationProp; exports.isBelongsToOneRelationProp = isBelongsToOneRelationProp; exports.isHasManyRelationProp = isHasManyRelationProp; exports.isManyToManyRelationProp = isManyToManyRelationProp; exports.isCustomJoinClause = isCustomJoinClause; exports.SonamuQueryMode = SonamuQueryMode; exports.isKnexError = isKnexError; exports.ApiParamType = ApiParamType; exports.RenderingNode = RenderingNode; exports.TemplateOptions = TemplateOptions; exports.TemplateKey = TemplateKey; exports.GenerateOptions = GenerateOptions; exports.PathAndCode = PathAndCode; exports.getZodObjectFromApi = getZodObjectFromApi; exports.getZodObjectFromApiParams = getZodObjectFromApiParams; exports.getZodTypeFromApiParamType = getZodTypeFromApiParamType; exports.propNodeToZodTypeDef = propNodeToZodTypeDef; exports.getTextTypeLength = getTextTypeLength; exports.propToZodTypeDef = propToZodTypeDef; exports.zodTypeToZodCode = zodTypeToZodCode; exports.apiParamToTsCode = apiParamToTsCode; exports.apiParamTypeToTsType = apiParamTypeToTsType; exports.unwrapPromiseOnce = unwrapPromiseOnce; exports.serializeZodType = serializeZodType; exports.zodTypeToTsTypeDef = zodTypeToTsTypeDef; exports.registeredApis = registeredApis; exports.api = api; exports.SoException = SoException; exports.isSoException = isSoException; exports.BadRequestException = BadRequestException; exports.UnauthorizedException = UnauthorizedException; exports.NotFoundException = NotFoundException; exports.ServiceUnavailableException = ServiceUnavailableException; exports.InternalServerErrorException = InternalServerErrorException; exports.AlreadyProcessedException = AlreadyProcessedException; exports.DuplicateRowException = DuplicateRowException; exports.TargetNotFoundException = TargetNotFoundException; exports.globAsync = globAsync; exports.importMultiple = importMultiple; exports.findAppRootPath = findAppRootPath; exports.findApiRootPath = findApiRootPath; exports.nonNullable = nonNullable; exports.Entity = Entity; exports.EntityManager = EntityManager; exports.Syncer = Syncer; exports.isLocal = isLocal; exports.isRemote = isRemote; exports.isInDocker = isInDocker; exports.isDaemonServer = isDaemonServer; exports.isDevelopment = isDevelopment; exports.isStaging = isStaging; exports.isProduction = isProduction; exports.isTest = isTest; exports.DB = DB; exports.isRefField = isRefField; exports.UpsertBuilder = UpsertBuilder; exports.BaseModelClass = BaseModelClass; exports.BaseModel = BaseModel; exports.Sonamu = Sonamu; exports.Migrator = Migrator; exports.FixtureManagerClass = FixtureManagerClass; exports.FixtureManager = FixtureManager;
7835
- //# sourceMappingURL=chunk-4EET56IE.js.map
7835
+ //# sourceMappingURL=chunk-5UCV2JP3.js.map