sonamu 0.2.43 → 0.2.45

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
@@ -79,13 +79,13 @@
79
79
 
80
80
 
81
81
 
82
- var _chunkCOTJCJ2Ojs = require('./chunk-COTJCJ2O.js');
82
+ var _chunk77XBF27Ljs = require('./chunk-77XBF27L.js');
83
83
 
84
84
  // src/exceptions/error-handler.ts
85
85
  function setupErrorHandler(server) {
86
86
  server.setErrorHandler((error, request, reply) => {
87
87
  _nullishCoalesce(error.statusCode, () => ( (error.statusCode = 400)));
88
- if (_chunkCOTJCJ2Ojs.isSoException.call(void 0, error) && error.payload && Array.isArray(error.payload)) {
88
+ if (_chunk77XBF27Ljs.isSoException.call(void 0, error) && error.payload && Array.isArray(error.payload)) {
89
89
  const issues = error.payload;
90
90
  const [issue] = issues;
91
91
  const message = `${issue.message} (${issue.path.join("/")})`;
@@ -421,5 +421,5 @@ function unique(columns) {
421
421
 
422
422
 
423
423
 
424
- exports.AlreadyProcessedException = _chunkCOTJCJ2Ojs.AlreadyProcessedException; exports.ApiParamType = _chunkCOTJCJ2Ojs.ApiParamType; exports.BadRequestException = _chunkCOTJCJ2Ojs.BadRequestException; exports.BaseModel = _chunkCOTJCJ2Ojs.BaseModel; exports.BaseModelClass = _chunkCOTJCJ2Ojs.BaseModelClass; exports.DB = _chunkCOTJCJ2Ojs.DB; exports.DuplicateRowException = _chunkCOTJCJ2Ojs.DuplicateRowException; exports.EntityManager = _chunkCOTJCJ2Ojs.EntityManager; exports.FixtureManager = _chunkCOTJCJ2Ojs.FixtureManager; exports.FixtureManagerClass = _chunkCOTJCJ2Ojs.FixtureManagerClass; exports.GenerateOptions = _chunkCOTJCJ2Ojs.GenerateOptions; exports.InternalServerErrorException = _chunkCOTJCJ2Ojs.InternalServerErrorException; exports.Migrator = _chunkCOTJCJ2Ojs.Migrator; exports.NotFoundException = _chunkCOTJCJ2Ojs.NotFoundException; exports.PathAndCode = _chunkCOTJCJ2Ojs.PathAndCode; exports.RenderingNode = _chunkCOTJCJ2Ojs.RenderingNode; exports.SQLDateTimeString = _chunkCOTJCJ2Ojs.SQLDateTimeString; exports.ServiceUnavailableException = _chunkCOTJCJ2Ojs.ServiceUnavailableException; exports.SoException = _chunkCOTJCJ2Ojs.SoException; exports.Sonamu = _chunkCOTJCJ2Ojs.Sonamu; exports.SonamuQueryMode = _chunkCOTJCJ2Ojs.SonamuQueryMode; exports.Syncer = _chunkCOTJCJ2Ojs.Syncer; exports.TargetNotFoundException = _chunkCOTJCJ2Ojs.TargetNotFoundException; exports.TemplateKey = _chunkCOTJCJ2Ojs.TemplateKey; exports.TemplateOptions = _chunkCOTJCJ2Ojs.TemplateOptions; exports.UnauthorizedException = _chunkCOTJCJ2Ojs.UnauthorizedException; exports.UpsertBuilder = _chunkCOTJCJ2Ojs.UpsertBuilder; exports.api = _chunkCOTJCJ2Ojs.api; exports.apiParamToTsCode = _chunkCOTJCJ2Ojs.apiParamToTsCode; exports.apiParamTypeToTsType = _chunkCOTJCJ2Ojs.apiParamTypeToTsType; exports.asArray = asArray; exports.findApiRootPath = _chunkCOTJCJ2Ojs.findApiRootPath; exports.findAppRootPath = _chunkCOTJCJ2Ojs.findAppRootPath; exports.getTextTypeLength = _chunkCOTJCJ2Ojs.getTextTypeLength; exports.getZodObjectFromApi = _chunkCOTJCJ2Ojs.getZodObjectFromApi; exports.getZodObjectFromApiParams = _chunkCOTJCJ2Ojs.getZodObjectFromApiParams; exports.getZodTypeFromApiParamType = _chunkCOTJCJ2Ojs.getZodTypeFromApiParamType; exports.globAsync = _chunkCOTJCJ2Ojs.globAsync; exports.i = i; exports.importMultiple = _chunkCOTJCJ2Ojs.importMultiple; exports.isBelongsToOneRelationProp = _chunkCOTJCJ2Ojs.isBelongsToOneRelationProp; exports.isBigIntegerProp = _chunkCOTJCJ2Ojs.isBigIntegerProp; exports.isBooleanProp = _chunkCOTJCJ2Ojs.isBooleanProp; exports.isCustomJoinClause = _chunkCOTJCJ2Ojs.isCustomJoinClause; exports.isDaemonServer = _chunkCOTJCJ2Ojs.isDaemonServer; exports.isDateProp = _chunkCOTJCJ2Ojs.isDateProp; exports.isDateTimeProp = _chunkCOTJCJ2Ojs.isDateTimeProp; exports.isDecimalProp = _chunkCOTJCJ2Ojs.isDecimalProp; exports.isDevelopment = _chunkCOTJCJ2Ojs.isDevelopment; exports.isDoubleProp = _chunkCOTJCJ2Ojs.isDoubleProp; exports.isEnumProp = _chunkCOTJCJ2Ojs.isEnumProp; exports.isFloatProp = _chunkCOTJCJ2Ojs.isFloatProp; exports.isHasManyRelationProp = _chunkCOTJCJ2Ojs.isHasManyRelationProp; exports.isInDocker = _chunkCOTJCJ2Ojs.isInDocker; exports.isIntegerProp = _chunkCOTJCJ2Ojs.isIntegerProp; exports.isJsonProp = _chunkCOTJCJ2Ojs.isJsonProp; exports.isKnexError = _chunkCOTJCJ2Ojs.isKnexError; exports.isLocal = _chunkCOTJCJ2Ojs.isLocal; exports.isManyToManyRelationProp = _chunkCOTJCJ2Ojs.isManyToManyRelationProp; exports.isOneToOneRelationProp = _chunkCOTJCJ2Ojs.isOneToOneRelationProp; exports.isProduction = _chunkCOTJCJ2Ojs.isProduction; exports.isRefField = _chunkCOTJCJ2Ojs.isRefField; exports.isRelationProp = _chunkCOTJCJ2Ojs.isRelationProp; exports.isRemote = _chunkCOTJCJ2Ojs.isRemote; exports.isSoException = _chunkCOTJCJ2Ojs.isSoException; exports.isStaging = _chunkCOTJCJ2Ojs.isStaging; exports.isStringProp = _chunkCOTJCJ2Ojs.isStringProp; exports.isTest = _chunkCOTJCJ2Ojs.isTest; exports.isTextProp = _chunkCOTJCJ2Ojs.isTextProp; exports.isTimeProp = _chunkCOTJCJ2Ojs.isTimeProp; exports.isTimestampProp = _chunkCOTJCJ2Ojs.isTimestampProp; exports.isUuidProp = _chunkCOTJCJ2Ojs.isUuidProp; exports.isVirtualProp = _chunkCOTJCJ2Ojs.isVirtualProp; exports.nonNullable = _chunkCOTJCJ2Ojs.nonNullable; exports.objToMap = objToMap; exports.p = p; exports.propNodeToZodTypeDef = _chunkCOTJCJ2Ojs.propNodeToZodTypeDef; exports.propToZodTypeDef = _chunkCOTJCJ2Ojs.propToZodTypeDef; exports.registeredApis = _chunkCOTJCJ2Ojs.registeredApis; exports.serializeZodType = _chunkCOTJCJ2Ojs.serializeZodType; exports.setupErrorHandler = setupErrorHandler; exports.unwrapPromiseOnce = _chunkCOTJCJ2Ojs.unwrapPromiseOnce; exports.zArrayable = _chunkCOTJCJ2Ojs.zArrayable; exports.zodTypeToTsTypeDef = _chunkCOTJCJ2Ojs.zodTypeToTsTypeDef; exports.zodTypeToZodCode = _chunkCOTJCJ2Ojs.zodTypeToZodCode;
424
+ exports.AlreadyProcessedException = _chunk77XBF27Ljs.AlreadyProcessedException; exports.ApiParamType = _chunk77XBF27Ljs.ApiParamType; exports.BadRequestException = _chunk77XBF27Ljs.BadRequestException; exports.BaseModel = _chunk77XBF27Ljs.BaseModel; exports.BaseModelClass = _chunk77XBF27Ljs.BaseModelClass; exports.DB = _chunk77XBF27Ljs.DB; exports.DuplicateRowException = _chunk77XBF27Ljs.DuplicateRowException; exports.EntityManager = _chunk77XBF27Ljs.EntityManager; exports.FixtureManager = _chunk77XBF27Ljs.FixtureManager; exports.FixtureManagerClass = _chunk77XBF27Ljs.FixtureManagerClass; exports.GenerateOptions = _chunk77XBF27Ljs.GenerateOptions; exports.InternalServerErrorException = _chunk77XBF27Ljs.InternalServerErrorException; exports.Migrator = _chunk77XBF27Ljs.Migrator; exports.NotFoundException = _chunk77XBF27Ljs.NotFoundException; exports.PathAndCode = _chunk77XBF27Ljs.PathAndCode; exports.RenderingNode = _chunk77XBF27Ljs.RenderingNode; exports.SQLDateTimeString = _chunk77XBF27Ljs.SQLDateTimeString; exports.ServiceUnavailableException = _chunk77XBF27Ljs.ServiceUnavailableException; exports.SoException = _chunk77XBF27Ljs.SoException; exports.Sonamu = _chunk77XBF27Ljs.Sonamu; exports.SonamuQueryMode = _chunk77XBF27Ljs.SonamuQueryMode; exports.Syncer = _chunk77XBF27Ljs.Syncer; exports.TargetNotFoundException = _chunk77XBF27Ljs.TargetNotFoundException; exports.TemplateKey = _chunk77XBF27Ljs.TemplateKey; exports.TemplateOptions = _chunk77XBF27Ljs.TemplateOptions; exports.UnauthorizedException = _chunk77XBF27Ljs.UnauthorizedException; exports.UpsertBuilder = _chunk77XBF27Ljs.UpsertBuilder; exports.api = _chunk77XBF27Ljs.api; exports.apiParamToTsCode = _chunk77XBF27Ljs.apiParamToTsCode; exports.apiParamTypeToTsType = _chunk77XBF27Ljs.apiParamTypeToTsType; exports.asArray = asArray; exports.findApiRootPath = _chunk77XBF27Ljs.findApiRootPath; exports.findAppRootPath = _chunk77XBF27Ljs.findAppRootPath; exports.getTextTypeLength = _chunk77XBF27Ljs.getTextTypeLength; exports.getZodObjectFromApi = _chunk77XBF27Ljs.getZodObjectFromApi; exports.getZodObjectFromApiParams = _chunk77XBF27Ljs.getZodObjectFromApiParams; exports.getZodTypeFromApiParamType = _chunk77XBF27Ljs.getZodTypeFromApiParamType; exports.globAsync = _chunk77XBF27Ljs.globAsync; exports.i = i; exports.importMultiple = _chunk77XBF27Ljs.importMultiple; exports.isBelongsToOneRelationProp = _chunk77XBF27Ljs.isBelongsToOneRelationProp; exports.isBigIntegerProp = _chunk77XBF27Ljs.isBigIntegerProp; exports.isBooleanProp = _chunk77XBF27Ljs.isBooleanProp; exports.isCustomJoinClause = _chunk77XBF27Ljs.isCustomJoinClause; exports.isDaemonServer = _chunk77XBF27Ljs.isDaemonServer; exports.isDateProp = _chunk77XBF27Ljs.isDateProp; exports.isDateTimeProp = _chunk77XBF27Ljs.isDateTimeProp; exports.isDecimalProp = _chunk77XBF27Ljs.isDecimalProp; exports.isDevelopment = _chunk77XBF27Ljs.isDevelopment; exports.isDoubleProp = _chunk77XBF27Ljs.isDoubleProp; exports.isEnumProp = _chunk77XBF27Ljs.isEnumProp; exports.isFloatProp = _chunk77XBF27Ljs.isFloatProp; exports.isHasManyRelationProp = _chunk77XBF27Ljs.isHasManyRelationProp; exports.isInDocker = _chunk77XBF27Ljs.isInDocker; exports.isIntegerProp = _chunk77XBF27Ljs.isIntegerProp; exports.isJsonProp = _chunk77XBF27Ljs.isJsonProp; exports.isKnexError = _chunk77XBF27Ljs.isKnexError; exports.isLocal = _chunk77XBF27Ljs.isLocal; exports.isManyToManyRelationProp = _chunk77XBF27Ljs.isManyToManyRelationProp; exports.isOneToOneRelationProp = _chunk77XBF27Ljs.isOneToOneRelationProp; exports.isProduction = _chunk77XBF27Ljs.isProduction; exports.isRefField = _chunk77XBF27Ljs.isRefField; exports.isRelationProp = _chunk77XBF27Ljs.isRelationProp; exports.isRemote = _chunk77XBF27Ljs.isRemote; exports.isSoException = _chunk77XBF27Ljs.isSoException; exports.isStaging = _chunk77XBF27Ljs.isStaging; exports.isStringProp = _chunk77XBF27Ljs.isStringProp; exports.isTest = _chunk77XBF27Ljs.isTest; exports.isTextProp = _chunk77XBF27Ljs.isTextProp; exports.isTimeProp = _chunk77XBF27Ljs.isTimeProp; exports.isTimestampProp = _chunk77XBF27Ljs.isTimestampProp; exports.isUuidProp = _chunk77XBF27Ljs.isUuidProp; exports.isVirtualProp = _chunk77XBF27Ljs.isVirtualProp; exports.nonNullable = _chunk77XBF27Ljs.nonNullable; exports.objToMap = objToMap; exports.p = p; exports.propNodeToZodTypeDef = _chunk77XBF27Ljs.propNodeToZodTypeDef; exports.propToZodTypeDef = _chunk77XBF27Ljs.propToZodTypeDef; exports.registeredApis = _chunk77XBF27Ljs.registeredApis; exports.serializeZodType = _chunk77XBF27Ljs.serializeZodType; exports.setupErrorHandler = setupErrorHandler; exports.unwrapPromiseOnce = _chunk77XBF27Ljs.unwrapPromiseOnce; exports.zArrayable = _chunk77XBF27Ljs.zArrayable; exports.zodTypeToTsTypeDef = _chunk77XBF27Ljs.zodTypeToTsTypeDef; exports.zodTypeToZodCode = _chunk77XBF27Ljs.zodTypeToZodCode;
425
425
  //# 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-5B6LB6JU.mjs";
83
+ } from "./chunk-7BVQURJT.mjs";
84
84
  import "./chunk-JXJTFHF7.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.43",
3
+ "version": "0.2.45",
4
4
  "description": "Sonamu — TypeScript Fullstack API Framework",
5
5
  "keywords": [
6
6
  "typescript",
@@ -1,41 +1,45 @@
1
1
  import knex from "knex";
2
2
 
3
3
  export function attachOnDuplicateUpdate() {
4
- knex.QueryBuilder.extend("onDuplicateUpdate", function (...columns) {
5
- if (columns.length === 0) {
6
- // 업데이트 컬럼이 없으면 onDuplicateUpdate 구문 처리 패스
7
- const { sql: originalSQL, bindings: originalBindings } = this.toSQL();
8
- return this.client.raw(originalSQL, originalBindings);
9
- }
4
+ try {
5
+ knex.QueryBuilder.extend("onDuplicateUpdate", function (...columns) {
6
+ if (columns.length === 0) {
7
+ // 업데이트 컬럼이 없으면 onDuplicateUpdate 구문 처리 패스
8
+ const { sql: originalSQL, bindings: originalBindings } = this.toSQL();
9
+ return this.client.raw(originalSQL, originalBindings);
10
+ }
10
11
 
11
- const { placeholders, bindings } = columns.reduce(
12
- (result, column) => {
13
- if (typeof column === "string") {
14
- result.placeholders.push(`?? = Values(??)`);
15
- result.bindings.push(column, column);
16
- } else if (column && typeof column === "object") {
17
- Object.keys(column).forEach((key) => {
18
- result.placeholders.push(`?? = ?`);
19
- result.bindings.push(key, column[key]);
20
- });
21
- } else {
22
- throw new Error(
23
- "onDuplicateUpdate error: expected column name to be string or object."
24
- );
25
- }
12
+ const { placeholders, bindings } = columns.reduce(
13
+ (result, column) => {
14
+ if (typeof column === "string") {
15
+ result.placeholders.push(`?? = Values(??)`);
16
+ result.bindings.push(column, column);
17
+ } else if (column && typeof column === "object") {
18
+ Object.keys(column).forEach((key) => {
19
+ result.placeholders.push(`?? = ?`);
20
+ result.bindings.push(key, column[key]);
21
+ });
22
+ } else {
23
+ throw new Error(
24
+ "onDuplicateUpdate error: expected column name to be string or object."
25
+ );
26
+ }
26
27
 
27
- return result;
28
- },
29
- { placeholders: [], bindings: [] }
30
- );
28
+ return result;
29
+ },
30
+ { placeholders: [], bindings: [] }
31
+ );
31
32
 
32
- const { sql: originalSQL, bindings: originalBindings } = this.toSQL();
33
+ const { sql: originalSQL, bindings: originalBindings } = this.toSQL();
33
34
 
34
- const newBindings = [...originalBindings, ...bindings];
35
+ const newBindings = [...originalBindings, ...bindings];
35
36
 
36
- return this.client.raw(
37
- `${originalSQL} ON DUPLICATE KEY UPDATE ${placeholders.join(", ")}`,
38
- newBindings
39
- );
40
- });
37
+ return this.client.raw(
38
+ `${originalSQL} ON DUPLICATE KEY UPDATE ${placeholders.join(", ")}`,
39
+ newBindings
40
+ );
41
+ });
42
+ } catch {
43
+ // ignored
44
+ }
41
45
  }
package/tsup.config.js CHANGED
@@ -19,11 +19,26 @@ export default defineConfig({
19
19
  }
20
20
  },
21
21
  external: [
22
- "zod",
22
+ "chalk",
23
+ "dotenv",
24
+ "fast-deep-equal",
23
25
  "fastify",
26
+ "fs-extra",
27
+ "glob",
24
28
  "inflection",
29
+ "knex",
30
+ "lodash",
31
+ "luxon",
32
+ "mysql2",
33
+ "node-sql-parser",
34
+ "prompts",
35
+ "qs",
36
+ "tsicli",
37
+ "uuid",
38
+ "zod",
39
+ "prettier",
25
40
  "source-map-support",
41
+ "tsup",
26
42
  "typescript",
27
- "prettier",
28
43
  ],
29
44
  });