sonamu 0.4.13 → 0.4.14
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/bin/cli.js +51 -51
- package/dist/bin/cli.mjs +2 -2
- package/dist/{chunk-DMJSNO2L.js → chunk-2WAC2GER.js} +44 -44
- package/dist/{chunk-DMJSNO2L.js.map → chunk-2WAC2GER.js.map} +1 -1
- package/dist/{chunk-NI37CY4T.mjs → chunk-C3IPIF6O.mjs} +2 -2
- package/dist/{chunk-DYFCACHD.js → chunk-EXHKSVTE.js} +7 -7
- package/dist/{chunk-QJFHDCBN.mjs → chunk-FCERKIIF.mjs} +2 -2
- package/dist/chunk-FCERKIIF.mjs.map +1 -0
- package/dist/{chunk-DDJ7T4MA.mjs → chunk-HGIBJYOU.mjs} +2 -2
- package/dist/{chunk-NIFOTHBW.mjs → chunk-JKSOJRQA.mjs} +2 -2
- package/dist/{chunk-CXAVBVKC.js → chunk-OTKKFP3Y.js} +100 -100
- package/dist/{chunk-J6S43O7G.js → chunk-UZ2IY5VE.js} +4 -4
- package/dist/database/drivers/knex/base-model.js +8 -8
- package/dist/database/drivers/knex/base-model.mjs +3 -3
- package/dist/database/drivers/kysely/base-model.js +9 -9
- package/dist/database/drivers/kysely/base-model.mjs +3 -3
- package/dist/index.js +9 -9
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/src/api/caster.ts +2 -2
- package/dist/chunk-QJFHDCBN.mjs.map +0 -1
- /package/dist/{chunk-NI37CY4T.mjs.map → chunk-C3IPIF6O.mjs.map} +0 -0
- /package/dist/{chunk-DYFCACHD.js.map → chunk-EXHKSVTE.js.map} +0 -0
- /package/dist/{chunk-DDJ7T4MA.mjs.map → chunk-HGIBJYOU.mjs.map} +0 -0
- /package/dist/{chunk-NIFOTHBW.mjs.map → chunk-JKSOJRQA.mjs.map} +0 -0
- /package/dist/{chunk-CXAVBVKC.js.map → chunk-OTKKFP3Y.js.map} +0 -0
- /package/dist/{chunk-J6S43O7G.js.map → chunk-UZ2IY5VE.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2WAC2GERjs = require('./chunk-2WAC2GER.js');
|
|
4
4
|
|
|
5
5
|
// src/database/base-model.ts
|
|
6
6
|
var _luxon = require('luxon');
|
|
@@ -53,8 +53,8 @@ var BaseModelClassAbstract = (_class = class {constructor() { _class.prototype._
|
|
|
53
53
|
db: _db,
|
|
54
54
|
optimizeCountQuery
|
|
55
55
|
}) {
|
|
56
|
-
const db = _nullishCoalesce(_db, () => (
|
|
57
|
-
const dbClient =
|
|
56
|
+
const db = _nullishCoalesce(_db, () => ( _chunk2WAC2GERjs.DB.getDB(subset.startsWith("A") ? "w" : "r")));
|
|
57
|
+
const dbClient = _chunk2WAC2GERjs.DB.toClient(db);
|
|
58
58
|
baseTable = _nullishCoalesce(baseTable, () => ( _inflection2.default.pluralize(_inflection2.default.underscore(this.modelName))));
|
|
59
59
|
const queryMode = _nullishCoalesce(params.queryMode, () => ( (params.id !== void 0 ? "list" : "both")));
|
|
60
60
|
const { select, virtual, joins, loaders } = subsetQuery;
|
|
@@ -228,4 +228,4 @@ var BaseModelClassAbstract = (_class = class {constructor() { _class.prototype._
|
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
exports.BaseModelClassAbstract = BaseModelClassAbstract;
|
|
231
|
-
//# sourceMappingURL=chunk-
|
|
231
|
+
//# sourceMappingURL=chunk-UZ2IY5VE.js.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkUZ2IY5VEjs = require('../../../chunk-UZ2IY5VE.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkEXHKSVTEjs = require('../../../chunk-EXHKSVTE.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk2WAC2GERjs = require('../../../chunk-2WAC2GER.js');
|
|
11
11
|
|
|
12
12
|
// src/database/drivers/knex/base-model.ts
|
|
13
|
-
var BaseModelClass = class extends
|
|
13
|
+
var BaseModelClass = class extends _chunkUZ2IY5VEjs.BaseModelClassAbstract {
|
|
14
14
|
getDB(which) {
|
|
15
|
-
return
|
|
15
|
+
return _chunk2WAC2GERjs.DB.getDB(which);
|
|
16
16
|
}
|
|
17
17
|
async destroy() {
|
|
18
|
-
return
|
|
18
|
+
return _chunk2WAC2GERjs.DB.destroy();
|
|
19
19
|
}
|
|
20
20
|
getUpsertBuilder() {
|
|
21
|
-
return new (0,
|
|
21
|
+
return new (0, _chunkEXHKSVTEjs.UpsertBuilder)();
|
|
22
22
|
}
|
|
23
23
|
applyJoins(clonedQb, joins) {
|
|
24
24
|
for (const join of joins) {
|
|
25
|
-
if (
|
|
25
|
+
if (_chunk2WAC2GERjs.isCustomJoinClause.call(void 0, join)) {
|
|
26
26
|
if (join.join === "inner") {
|
|
27
27
|
clonedQb.qb = clonedQb.qb.innerJoin(
|
|
28
28
|
`${join.table} as ${join.as}`,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseModelClassAbstract
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-HGIBJYOU.mjs";
|
|
4
4
|
import {
|
|
5
5
|
UpsertBuilder
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-JKSOJRQA.mjs";
|
|
7
7
|
import {
|
|
8
8
|
DB,
|
|
9
9
|
isCustomJoinClause
|
|
10
|
-
} from "../../../chunk-
|
|
10
|
+
} from "../../../chunk-FCERKIIF.mjs";
|
|
11
11
|
import "../../../chunk-PTFDTOJU.mjs";
|
|
12
12
|
|
|
13
13
|
// src/database/drivers/knex/base-model.ts
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkUZ2IY5VEjs = require('../../../chunk-UZ2IY5VE.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkEXHKSVTEjs = require('../../../chunk-EXHKSVTE.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk2WAC2GERjs = require('../../../chunk-2WAC2GER.js');
|
|
12
12
|
|
|
13
13
|
// src/database/drivers/kysely/base-model.ts
|
|
14
14
|
var _inflection = require('inflection'); var _inflection2 = _interopRequireDefault(_inflection);
|
|
15
|
-
var BaseModelClass = class extends
|
|
15
|
+
var BaseModelClass = class extends _chunkUZ2IY5VEjs.BaseModelClassAbstract {
|
|
16
16
|
getDB(which) {
|
|
17
|
-
return
|
|
17
|
+
return _chunk2WAC2GERjs.DB.getDB(which);
|
|
18
18
|
}
|
|
19
19
|
async destroy() {
|
|
20
|
-
return
|
|
20
|
+
return _chunk2WAC2GERjs.DB.destroy();
|
|
21
21
|
}
|
|
22
22
|
getUpsertBuilder() {
|
|
23
|
-
return new (0,
|
|
23
|
+
return new (0, _chunkEXHKSVTEjs.UpsertBuilder)();
|
|
24
24
|
}
|
|
25
25
|
applyJoins(clonedQb, joins) {
|
|
26
26
|
for (const join of joins) {
|
|
27
|
-
if (
|
|
27
|
+
if (_chunk2WAC2GERjs.isCustomJoinClause.call(void 0, join)) {
|
|
28
28
|
throw new Error("Custom join clause is not supported in Kysely");
|
|
29
29
|
}
|
|
30
30
|
if (join.join === "inner") {
|
|
@@ -48,7 +48,7 @@ var BaseModelClass = class extends _chunkJ6S43O7Gjs.BaseModelClassAbstract {
|
|
|
48
48
|
if (!column) {
|
|
49
49
|
throw new Error("parseOrderBy: Invalid column");
|
|
50
50
|
}
|
|
51
|
-
const entity =
|
|
51
|
+
const entity = _chunk2WAC2GERjs.EntityManager.get(_inflection2.default.classify(table));
|
|
52
52
|
if (!entity.props.find((p) => p.name === column)) {
|
|
53
53
|
throw new Error("parseOrderBy: \uD604\uC7AC \uC5D4\uD2F0\uD2F0\uC5D0 \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uCEEC\uB7FC\uC785\uB2C8\uB2E4: ");
|
|
54
54
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseModelClassAbstract
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-HGIBJYOU.mjs";
|
|
4
4
|
import {
|
|
5
5
|
UpsertBuilder
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-JKSOJRQA.mjs";
|
|
7
7
|
import {
|
|
8
8
|
DB,
|
|
9
9
|
EntityManager,
|
|
10
10
|
isCustomJoinClause
|
|
11
|
-
} from "../../../chunk-
|
|
11
|
+
} from "../../../chunk-FCERKIIF.mjs";
|
|
12
12
|
import "../../../chunk-PTFDTOJU.mjs";
|
|
13
13
|
|
|
14
14
|
// src/database/drivers/kysely/base-model.ts
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkOTKKFP3Yjs = require('./chunk-OTKKFP3Y.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkEXHKSVTEjs = require('./chunk-EXHKSVTE.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -90,15 +90,15 @@ var _chunkDYFCACHDjs = require('./chunk-DYFCACHD.js');
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
|
|
93
|
-
var
|
|
93
|
+
var _chunk2WAC2GERjs = require('./chunk-2WAC2GER.js');
|
|
94
94
|
|
|
95
95
|
// src/api/base-frame.ts
|
|
96
96
|
var BaseFrameClass = class {
|
|
97
97
|
getDB(which) {
|
|
98
|
-
return
|
|
98
|
+
return _chunk2WAC2GERjs.DB.getDB(which);
|
|
99
99
|
}
|
|
100
100
|
getUpsertBuilder() {
|
|
101
|
-
return new (0,
|
|
101
|
+
return new (0, _chunkEXHKSVTEjs.UpsertBuilder)();
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
|
|
@@ -106,7 +106,7 @@ var BaseFrameClass = class {
|
|
|
106
106
|
function setupErrorHandler(server) {
|
|
107
107
|
server.setErrorHandler((error, request, reply) => {
|
|
108
108
|
error.statusCode ??= 400;
|
|
109
|
-
if (
|
|
109
|
+
if (_chunk2WAC2GERjs.isSoException.call(void 0, error) && error.payload && Array.isArray(error.payload)) {
|
|
110
110
|
const issues = error.payload;
|
|
111
111
|
const [issue] = issues;
|
|
112
112
|
const message = `${issue.message} (${issue.path.join("/")})`;
|
|
@@ -329,13 +329,13 @@ var i = {
|
|
|
329
329
|
function index(columns) {
|
|
330
330
|
return {
|
|
331
331
|
type: "index",
|
|
332
|
-
columns:
|
|
332
|
+
columns: _chunk2WAC2GERjs.asArray.call(void 0, columns)
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
335
|
function unique(columns) {
|
|
336
336
|
return {
|
|
337
337
|
type: "unique",
|
|
338
|
-
columns:
|
|
338
|
+
columns: _chunk2WAC2GERjs.asArray.call(void 0, columns)
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
341
|
|
|
@@ -430,5 +430,5 @@ function unique(columns) {
|
|
|
430
430
|
|
|
431
431
|
|
|
432
432
|
|
|
433
|
-
exports.AlreadyProcessedException =
|
|
433
|
+
exports.AlreadyProcessedException = _chunk2WAC2GERjs.AlreadyProcessedException; exports.ApiParamType = _chunk2WAC2GERjs.ApiParamType; exports.BadRequestException = _chunk2WAC2GERjs.BadRequestException; exports.BaseFrameClass = BaseFrameClass; exports.DB = _chunk2WAC2GERjs.DB; exports.DBKnexClass = _chunk2WAC2GERjs.DBKnexClass; exports.DBKyselyClass = _chunk2WAC2GERjs.DBKyselyClass; exports.DuplicateRowException = _chunk2WAC2GERjs.DuplicateRowException; exports.Entity = _chunk2WAC2GERjs.Entity; exports.EntityManager = _chunk2WAC2GERjs.EntityManager; exports.FixtureManager = _chunkOTKKFP3Yjs.FixtureManager; exports.FixtureManagerClass = _chunkOTKKFP3Yjs.FixtureManagerClass; exports.GenerateOptions = _chunk2WAC2GERjs.GenerateOptions; exports.InternalServerErrorException = _chunk2WAC2GERjs.InternalServerErrorException; exports.Migrator = _chunkOTKKFP3Yjs.Migrator; exports.NotFoundException = _chunk2WAC2GERjs.NotFoundException; exports.PathAndCode = _chunk2WAC2GERjs.PathAndCode; exports.RenderingNode = _chunk2WAC2GERjs.RenderingNode; exports.SQLDateTimeString = _chunk2WAC2GERjs.SQLDateTimeString; exports.ServiceUnavailableException = _chunk2WAC2GERjs.ServiceUnavailableException; exports.SoException = _chunk2WAC2GERjs.SoException; exports.Sonamu = _chunk2WAC2GERjs.Sonamu; exports.SonamuQueryMode = _chunk2WAC2GERjs.SonamuQueryMode; exports.Syncer = _chunk2WAC2GERjs.Syncer; exports.TargetNotFoundException = _chunk2WAC2GERjs.TargetNotFoundException; exports.TemplateKey = _chunk2WAC2GERjs.TemplateKey; exports.TemplateOptions = _chunk2WAC2GERjs.TemplateOptions; exports.UnauthorizedException = _chunk2WAC2GERjs.UnauthorizedException; exports.UpsertBuilder = _chunkEXHKSVTEjs.UpsertBuilder; exports.api = _chunk2WAC2GERjs.api; exports.apiParamToTsCode = _chunk2WAC2GERjs.apiParamToTsCode; exports.apiParamToTsCodeAsObject = _chunk2WAC2GERjs.apiParamToTsCodeAsObject; exports.apiParamTypeToTsType = _chunk2WAC2GERjs.apiParamTypeToTsType; exports.asArray = _chunk2WAC2GERjs.asArray; exports.findApiRootPath = _chunk2WAC2GERjs.findApiRootPath; exports.findAppRootPath = _chunk2WAC2GERjs.findAppRootPath; exports.getTextTypeLength = _chunk2WAC2GERjs.getTextTypeLength; exports.getZodObjectFromApi = _chunk2WAC2GERjs.getZodObjectFromApi; exports.getZodObjectFromApiParams = _chunk2WAC2GERjs.getZodObjectFromApiParams; exports.getZodTypeFromApiParamType = _chunk2WAC2GERjs.getZodTypeFromApiParamType; exports.globAsync = _chunk2WAC2GERjs.globAsync; exports.hydrate = _chunk2WAC2GERjs.hydrate; exports.i = i; exports.importMultiple = _chunk2WAC2GERjs.importMultiple; exports.isBelongsToOneRelationProp = _chunk2WAC2GERjs.isBelongsToOneRelationProp; exports.isBigIntegerProp = _chunk2WAC2GERjs.isBigIntegerProp; exports.isBooleanProp = _chunk2WAC2GERjs.isBooleanProp; exports.isCustomJoinClause = _chunk2WAC2GERjs.isCustomJoinClause; exports.isDaemonServer = _chunk2WAC2GERjs.isDaemonServer; exports.isDateProp = _chunk2WAC2GERjs.isDateProp; exports.isDateTimeProp = _chunk2WAC2GERjs.isDateTimeProp; exports.isDecimalProp = _chunk2WAC2GERjs.isDecimalProp; exports.isDevelopment = _chunk2WAC2GERjs.isDevelopment; exports.isDoubleProp = _chunk2WAC2GERjs.isDoubleProp; exports.isEnumProp = _chunk2WAC2GERjs.isEnumProp; exports.isFloatProp = _chunk2WAC2GERjs.isFloatProp; exports.isHasManyRelationProp = _chunk2WAC2GERjs.isHasManyRelationProp; exports.isInDocker = _chunk2WAC2GERjs.isInDocker; exports.isIntegerProp = _chunk2WAC2GERjs.isIntegerProp; exports.isJsonProp = _chunk2WAC2GERjs.isJsonProp; exports.isKnexError = _chunk2WAC2GERjs.isKnexError; exports.isKyselyError = _chunk2WAC2GERjs.isKyselyError; exports.isLocal = _chunk2WAC2GERjs.isLocal; exports.isManyToManyRelationProp = _chunk2WAC2GERjs.isManyToManyRelationProp; exports.isOneToOneRelationProp = _chunk2WAC2GERjs.isOneToOneRelationProp; exports.isProduction = _chunk2WAC2GERjs.isProduction; exports.isRefField = _chunkEXHKSVTEjs.isRefField; exports.isRelationProp = _chunk2WAC2GERjs.isRelationProp; exports.isRemote = _chunk2WAC2GERjs.isRemote; exports.isSoException = _chunk2WAC2GERjs.isSoException; exports.isStaging = _chunk2WAC2GERjs.isStaging; exports.isStringProp = _chunk2WAC2GERjs.isStringProp; exports.isTest = _chunk2WAC2GERjs.isTest; exports.isTextProp = _chunk2WAC2GERjs.isTextProp; exports.isTimeProp = _chunk2WAC2GERjs.isTimeProp; exports.isTimestampProp = _chunk2WAC2GERjs.isTimestampProp; exports.isUuidProp = _chunk2WAC2GERjs.isUuidProp; exports.isVirtualProp = _chunk2WAC2GERjs.isVirtualProp; exports.nonNullable = _chunk2WAC2GERjs.nonNullable; exports.objToMap = _chunk2WAC2GERjs.objToMap; exports.p = p; exports.propNodeToZodTypeDef = _chunk2WAC2GERjs.propNodeToZodTypeDef; exports.propToZodTypeDef = _chunk2WAC2GERjs.propToZodTypeDef; exports.registeredApis = _chunk2WAC2GERjs.registeredApis; exports.serializeZodType = _chunk2WAC2GERjs.serializeZodType; exports.setupErrorHandler = setupErrorHandler; exports.stream = _chunk2WAC2GERjs.stream; exports.unwrapPromiseOnce = _chunk2WAC2GERjs.unwrapPromiseOnce; exports.zArrayable = _chunk2WAC2GERjs.zArrayable; exports.zodTypeToTsTypeDef = _chunk2WAC2GERjs.zodTypeToTsTypeDef; exports.zodTypeToZodCode = _chunk2WAC2GERjs.zodTypeToZodCode;
|
|
434
434
|
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
FixtureManager,
|
|
3
3
|
FixtureManagerClass,
|
|
4
4
|
Migrator
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-C3IPIF6O.mjs";
|
|
6
6
|
import {
|
|
7
7
|
UpsertBuilder,
|
|
8
8
|
isRefField
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JKSOJRQA.mjs";
|
|
10
10
|
import {
|
|
11
11
|
AlreadyProcessedException,
|
|
12
12
|
ApiParamType,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
zArrayable,
|
|
91
91
|
zodTypeToTsTypeDef,
|
|
92
92
|
zodTypeToZodCode
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-FCERKIIF.mjs";
|
|
94
94
|
import "./chunk-PTFDTOJU.mjs";
|
|
95
95
|
|
|
96
96
|
// src/api/base-frame.ts
|
package/package.json
CHANGED
package/src/api/caster.ts
CHANGED
|
@@ -15,8 +15,8 @@ function isZodNumberAnyway(zodType: z.ZodType<any>) {
|
|
|
15
15
|
) {
|
|
16
16
|
} else if (
|
|
17
17
|
zodType instanceof z.ZodOptional &&
|
|
18
|
-
zodType._def
|
|
19
|
-
zodType._type
|
|
18
|
+
zodType._def?.innerType instanceof z.ZodOptional &&
|
|
19
|
+
zodType._type?.def?.innerType instanceof z.ZodNumber
|
|
20
20
|
) {
|
|
21
21
|
return true;
|
|
22
22
|
}
|