sonamu 0.2.53 → 0.2.54

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/index.js CHANGED
@@ -80,13 +80,13 @@
80
80
 
81
81
 
82
82
 
83
- var _chunk5UCV2JP3js = require('./chunk-5UCV2JP3.js');
83
+ var _chunkJOHF7PK4js = require('./chunk-JOHF7PK4.js');
84
84
 
85
85
  // src/exceptions/error-handler.ts
86
86
  function setupErrorHandler(server) {
87
87
  server.setErrorHandler((error, request, reply) => {
88
88
  _nullishCoalesce(error.statusCode, () => ( (error.statusCode = 400)));
89
- if (_chunk5UCV2JP3js.isSoException.call(void 0, error) && error.payload && Array.isArray(error.payload)) {
89
+ if (_chunkJOHF7PK4js.isSoException.call(void 0, error) && error.payload && Array.isArray(error.payload)) {
90
90
  const issues = error.payload;
91
91
  const [issue] = issues;
92
92
  const message = `${issue.message} (${issue.path.join("/")})`;
@@ -423,5 +423,5 @@ function unique(columns) {
423
423
 
424
424
 
425
425
 
426
- exports.AlreadyProcessedException = _chunk5UCV2JP3js.AlreadyProcessedException; exports.ApiParamType = _chunk5UCV2JP3js.ApiParamType; exports.BadRequestException = _chunk5UCV2JP3js.BadRequestException; exports.BaseModel = _chunk5UCV2JP3js.BaseModel; exports.BaseModelClass = _chunk5UCV2JP3js.BaseModelClass; exports.DB = _chunk5UCV2JP3js.DB; exports.DuplicateRowException = _chunk5UCV2JP3js.DuplicateRowException; exports.Entity = _chunk5UCV2JP3js.Entity; exports.EntityManager = _chunk5UCV2JP3js.EntityManager; exports.FixtureManager = _chunk5UCV2JP3js.FixtureManager; exports.FixtureManagerClass = _chunk5UCV2JP3js.FixtureManagerClass; exports.GenerateOptions = _chunk5UCV2JP3js.GenerateOptions; exports.InternalServerErrorException = _chunk5UCV2JP3js.InternalServerErrorException; exports.Migrator = _chunk5UCV2JP3js.Migrator; exports.NotFoundException = _chunk5UCV2JP3js.NotFoundException; exports.PathAndCode = _chunk5UCV2JP3js.PathAndCode; exports.RenderingNode = _chunk5UCV2JP3js.RenderingNode; exports.SQLDateTimeString = _chunk5UCV2JP3js.SQLDateTimeString; exports.ServiceUnavailableException = _chunk5UCV2JP3js.ServiceUnavailableException; exports.SoException = _chunk5UCV2JP3js.SoException; exports.Sonamu = _chunk5UCV2JP3js.Sonamu; exports.SonamuQueryMode = _chunk5UCV2JP3js.SonamuQueryMode; exports.Syncer = _chunk5UCV2JP3js.Syncer; exports.TargetNotFoundException = _chunk5UCV2JP3js.TargetNotFoundException; exports.TemplateKey = _chunk5UCV2JP3js.TemplateKey; exports.TemplateOptions = _chunk5UCV2JP3js.TemplateOptions; exports.UnauthorizedException = _chunk5UCV2JP3js.UnauthorizedException; exports.UpsertBuilder = _chunk5UCV2JP3js.UpsertBuilder; exports.api = _chunk5UCV2JP3js.api; exports.apiParamToTsCode = _chunk5UCV2JP3js.apiParamToTsCode; exports.apiParamTypeToTsType = _chunk5UCV2JP3js.apiParamTypeToTsType; exports.asArray = asArray; exports.findApiRootPath = _chunk5UCV2JP3js.findApiRootPath; exports.findAppRootPath = _chunk5UCV2JP3js.findAppRootPath; exports.getTextTypeLength = _chunk5UCV2JP3js.getTextTypeLength; exports.getZodObjectFromApi = _chunk5UCV2JP3js.getZodObjectFromApi; exports.getZodObjectFromApiParams = _chunk5UCV2JP3js.getZodObjectFromApiParams; exports.getZodTypeFromApiParamType = _chunk5UCV2JP3js.getZodTypeFromApiParamType; exports.globAsync = _chunk5UCV2JP3js.globAsync; exports.i = i; exports.importMultiple = _chunk5UCV2JP3js.importMultiple; exports.isBelongsToOneRelationProp = _chunk5UCV2JP3js.isBelongsToOneRelationProp; exports.isBigIntegerProp = _chunk5UCV2JP3js.isBigIntegerProp; exports.isBooleanProp = _chunk5UCV2JP3js.isBooleanProp; exports.isCustomJoinClause = _chunk5UCV2JP3js.isCustomJoinClause; exports.isDaemonServer = _chunk5UCV2JP3js.isDaemonServer; exports.isDateProp = _chunk5UCV2JP3js.isDateProp; exports.isDateTimeProp = _chunk5UCV2JP3js.isDateTimeProp; exports.isDecimalProp = _chunk5UCV2JP3js.isDecimalProp; exports.isDevelopment = _chunk5UCV2JP3js.isDevelopment; exports.isDoubleProp = _chunk5UCV2JP3js.isDoubleProp; exports.isEnumProp = _chunk5UCV2JP3js.isEnumProp; exports.isFloatProp = _chunk5UCV2JP3js.isFloatProp; exports.isHasManyRelationProp = _chunk5UCV2JP3js.isHasManyRelationProp; exports.isInDocker = _chunk5UCV2JP3js.isInDocker; exports.isIntegerProp = _chunk5UCV2JP3js.isIntegerProp; exports.isJsonProp = _chunk5UCV2JP3js.isJsonProp; exports.isKnexError = _chunk5UCV2JP3js.isKnexError; exports.isLocal = _chunk5UCV2JP3js.isLocal; exports.isManyToManyRelationProp = _chunk5UCV2JP3js.isManyToManyRelationProp; exports.isOneToOneRelationProp = _chunk5UCV2JP3js.isOneToOneRelationProp; exports.isProduction = _chunk5UCV2JP3js.isProduction; exports.isRefField = _chunk5UCV2JP3js.isRefField; exports.isRelationProp = _chunk5UCV2JP3js.isRelationProp; exports.isRemote = _chunk5UCV2JP3js.isRemote; exports.isSoException = _chunk5UCV2JP3js.isSoException; exports.isStaging = _chunk5UCV2JP3js.isStaging; exports.isStringProp = _chunk5UCV2JP3js.isStringProp; exports.isTest = _chunk5UCV2JP3js.isTest; exports.isTextProp = _chunk5UCV2JP3js.isTextProp; exports.isTimeProp = _chunk5UCV2JP3js.isTimeProp; exports.isTimestampProp = _chunk5UCV2JP3js.isTimestampProp; exports.isUuidProp = _chunk5UCV2JP3js.isUuidProp; exports.isVirtualProp = _chunk5UCV2JP3js.isVirtualProp; exports.nonNullable = _chunk5UCV2JP3js.nonNullable; exports.objToMap = objToMap; exports.p = p; exports.propNodeToZodTypeDef = _chunk5UCV2JP3js.propNodeToZodTypeDef; exports.propToZodTypeDef = _chunk5UCV2JP3js.propToZodTypeDef; exports.registeredApis = _chunk5UCV2JP3js.registeredApis; exports.serializeZodType = _chunk5UCV2JP3js.serializeZodType; exports.setupErrorHandler = setupErrorHandler; exports.unwrapPromiseOnce = _chunk5UCV2JP3js.unwrapPromiseOnce; exports.zArrayable = _chunk5UCV2JP3js.zArrayable; exports.zodTypeToTsTypeDef = _chunk5UCV2JP3js.zodTypeToTsTypeDef; exports.zodTypeToZodCode = _chunk5UCV2JP3js.zodTypeToZodCode;
426
+ exports.AlreadyProcessedException = _chunkJOHF7PK4js.AlreadyProcessedException; exports.ApiParamType = _chunkJOHF7PK4js.ApiParamType; exports.BadRequestException = _chunkJOHF7PK4js.BadRequestException; exports.BaseModel = _chunkJOHF7PK4js.BaseModel; exports.BaseModelClass = _chunkJOHF7PK4js.BaseModelClass; exports.DB = _chunkJOHF7PK4js.DB; exports.DuplicateRowException = _chunkJOHF7PK4js.DuplicateRowException; exports.Entity = _chunkJOHF7PK4js.Entity; exports.EntityManager = _chunkJOHF7PK4js.EntityManager; exports.FixtureManager = _chunkJOHF7PK4js.FixtureManager; exports.FixtureManagerClass = _chunkJOHF7PK4js.FixtureManagerClass; exports.GenerateOptions = _chunkJOHF7PK4js.GenerateOptions; exports.InternalServerErrorException = _chunkJOHF7PK4js.InternalServerErrorException; exports.Migrator = _chunkJOHF7PK4js.Migrator; exports.NotFoundException = _chunkJOHF7PK4js.NotFoundException; exports.PathAndCode = _chunkJOHF7PK4js.PathAndCode; exports.RenderingNode = _chunkJOHF7PK4js.RenderingNode; exports.SQLDateTimeString = _chunkJOHF7PK4js.SQLDateTimeString; exports.ServiceUnavailableException = _chunkJOHF7PK4js.ServiceUnavailableException; exports.SoException = _chunkJOHF7PK4js.SoException; exports.Sonamu = _chunkJOHF7PK4js.Sonamu; exports.SonamuQueryMode = _chunkJOHF7PK4js.SonamuQueryMode; exports.Syncer = _chunkJOHF7PK4js.Syncer; exports.TargetNotFoundException = _chunkJOHF7PK4js.TargetNotFoundException; exports.TemplateKey = _chunkJOHF7PK4js.TemplateKey; exports.TemplateOptions = _chunkJOHF7PK4js.TemplateOptions; exports.UnauthorizedException = _chunkJOHF7PK4js.UnauthorizedException; exports.UpsertBuilder = _chunkJOHF7PK4js.UpsertBuilder; exports.api = _chunkJOHF7PK4js.api; exports.apiParamToTsCode = _chunkJOHF7PK4js.apiParamToTsCode; exports.apiParamTypeToTsType = _chunkJOHF7PK4js.apiParamTypeToTsType; exports.asArray = asArray; exports.findApiRootPath = _chunkJOHF7PK4js.findApiRootPath; exports.findAppRootPath = _chunkJOHF7PK4js.findAppRootPath; exports.getTextTypeLength = _chunkJOHF7PK4js.getTextTypeLength; exports.getZodObjectFromApi = _chunkJOHF7PK4js.getZodObjectFromApi; exports.getZodObjectFromApiParams = _chunkJOHF7PK4js.getZodObjectFromApiParams; exports.getZodTypeFromApiParamType = _chunkJOHF7PK4js.getZodTypeFromApiParamType; exports.globAsync = _chunkJOHF7PK4js.globAsync; exports.i = i; exports.importMultiple = _chunkJOHF7PK4js.importMultiple; exports.isBelongsToOneRelationProp = _chunkJOHF7PK4js.isBelongsToOneRelationProp; exports.isBigIntegerProp = _chunkJOHF7PK4js.isBigIntegerProp; exports.isBooleanProp = _chunkJOHF7PK4js.isBooleanProp; exports.isCustomJoinClause = _chunkJOHF7PK4js.isCustomJoinClause; exports.isDaemonServer = _chunkJOHF7PK4js.isDaemonServer; exports.isDateProp = _chunkJOHF7PK4js.isDateProp; exports.isDateTimeProp = _chunkJOHF7PK4js.isDateTimeProp; exports.isDecimalProp = _chunkJOHF7PK4js.isDecimalProp; exports.isDevelopment = _chunkJOHF7PK4js.isDevelopment; exports.isDoubleProp = _chunkJOHF7PK4js.isDoubleProp; exports.isEnumProp = _chunkJOHF7PK4js.isEnumProp; exports.isFloatProp = _chunkJOHF7PK4js.isFloatProp; exports.isHasManyRelationProp = _chunkJOHF7PK4js.isHasManyRelationProp; exports.isInDocker = _chunkJOHF7PK4js.isInDocker; exports.isIntegerProp = _chunkJOHF7PK4js.isIntegerProp; exports.isJsonProp = _chunkJOHF7PK4js.isJsonProp; exports.isKnexError = _chunkJOHF7PK4js.isKnexError; exports.isLocal = _chunkJOHF7PK4js.isLocal; exports.isManyToManyRelationProp = _chunkJOHF7PK4js.isManyToManyRelationProp; exports.isOneToOneRelationProp = _chunkJOHF7PK4js.isOneToOneRelationProp; exports.isProduction = _chunkJOHF7PK4js.isProduction; exports.isRefField = _chunkJOHF7PK4js.isRefField; exports.isRelationProp = _chunkJOHF7PK4js.isRelationProp; exports.isRemote = _chunkJOHF7PK4js.isRemote; exports.isSoException = _chunkJOHF7PK4js.isSoException; exports.isStaging = _chunkJOHF7PK4js.isStaging; exports.isStringProp = _chunkJOHF7PK4js.isStringProp; exports.isTest = _chunkJOHF7PK4js.isTest; exports.isTextProp = _chunkJOHF7PK4js.isTextProp; exports.isTimeProp = _chunkJOHF7PK4js.isTimeProp; exports.isTimestampProp = _chunkJOHF7PK4js.isTimestampProp; exports.isUuidProp = _chunkJOHF7PK4js.isUuidProp; exports.isVirtualProp = _chunkJOHF7PK4js.isVirtualProp; exports.nonNullable = _chunkJOHF7PK4js.nonNullable; exports.objToMap = objToMap; exports.p = p; exports.propNodeToZodTypeDef = _chunkJOHF7PK4js.propNodeToZodTypeDef; exports.propToZodTypeDef = _chunkJOHF7PK4js.propToZodTypeDef; exports.registeredApis = _chunkJOHF7PK4js.registeredApis; exports.serializeZodType = _chunkJOHF7PK4js.serializeZodType; exports.setupErrorHandler = setupErrorHandler; exports.unwrapPromiseOnce = _chunkJOHF7PK4js.unwrapPromiseOnce; exports.zArrayable = _chunkJOHF7PK4js.zArrayable; exports.zodTypeToTsTypeDef = _chunkJOHF7PK4js.zodTypeToTsTypeDef; exports.zodTypeToZodCode = _chunkJOHF7PK4js.zodTypeToZodCode;
427
427
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -80,7 +80,7 @@ import {
80
80
  zArrayable,
81
81
  zodTypeToTsTypeDef,
82
82
  zodTypeToZodCode
83
- } from "./chunk-XTNCGTDO.mjs";
83
+ } from "./chunk-L4KELCY7.mjs";
84
84
  import "./chunk-PTFDTOJU.mjs";
85
85
 
86
86
  // src/exceptions/error-handler.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonamu",
3
- "version": "0.2.53",
3
+ "version": "0.2.54",
4
4
  "description": "Sonamu — TypeScript Fullstack API Framework",
5
5
  "keywords": [
6
6
  "typescript",
@@ -174,6 +174,25 @@ export function getZodTypeFromApiParamType(
174
174
  t: string;
175
175
  types: ApiParamType[];
176
176
  };
177
+ // nullable 유니온
178
+ if (
179
+ unionType.types.length === 2 &&
180
+ unionType.types.some((type) => type === "null")
181
+ ) {
182
+ if (unionType.types[0] === "null") {
183
+ return getZodTypeFromApiParamType(
184
+ unionType.types[1],
185
+ references
186
+ ).nullable();
187
+ } else {
188
+ return getZodTypeFromApiParamType(
189
+ unionType.types[0],
190
+ references
191
+ ).nullable();
192
+ }
193
+ }
194
+
195
+ // 일반 유니온
177
196
  return z.union(
178
197
  unionType.types.map((type) =>
179
198
  getZodTypeFromApiParamType(type, references)