sonamu 0.4.12 → 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.
Files changed (46) hide show
  1. package/.pnp.cjs +5 -5
  2. package/dist/{base-model-BvVra-8f.d.mts → base-model-CEB0H0aO.d.mts} +1 -1
  3. package/dist/{base-model-Br6krkwK.d.ts → base-model-CrqDMYhI.d.ts} +1 -1
  4. package/dist/bin/cli.js +51 -51
  5. package/dist/bin/cli.mjs +2 -2
  6. package/dist/{chunk-ZLFDB43J.js → chunk-2WAC2GER.js} +147 -96
  7. package/dist/chunk-2WAC2GER.js.map +1 -0
  8. package/dist/{chunk-FKZK27YL.mjs → chunk-C3IPIF6O.mjs} +2 -2
  9. package/dist/{chunk-INTZUNZ6.js → chunk-EXHKSVTE.js} +7 -7
  10. package/dist/{chunk-LNZTU4JC.mjs → chunk-FCERKIIF.mjs} +104 -53
  11. package/dist/chunk-FCERKIIF.mjs.map +1 -0
  12. package/dist/{chunk-JQJTQQ7D.mjs → chunk-HGIBJYOU.mjs} +2 -2
  13. package/dist/{chunk-NPLUHS5L.mjs → chunk-JKSOJRQA.mjs} +2 -2
  14. package/dist/{chunk-FYLFH3Q6.js → chunk-OTKKFP3Y.js} +100 -100
  15. package/dist/{chunk-IEMX4VPN.js → chunk-UZ2IY5VE.js} +4 -4
  16. package/dist/database/drivers/knex/base-model.d.mts +2 -2
  17. package/dist/database/drivers/knex/base-model.d.ts +2 -2
  18. package/dist/database/drivers/knex/base-model.js +8 -8
  19. package/dist/database/drivers/knex/base-model.mjs +3 -3
  20. package/dist/database/drivers/kysely/base-model.d.mts +2 -2
  21. package/dist/database/drivers/kysely/base-model.d.ts +2 -2
  22. package/dist/database/drivers/kysely/base-model.js +9 -9
  23. package/dist/database/drivers/kysely/base-model.mjs +3 -3
  24. package/dist/index.d.mts +17 -4
  25. package/dist/index.d.ts +17 -4
  26. package/dist/index.js +13 -9
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +7 -3
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +2 -2
  31. package/src/api/caster.ts +2 -2
  32. package/src/api/code-converters.ts +7 -0
  33. package/src/api/decorators.ts +36 -4
  34. package/src/shared/web.shared.ts.txt +225 -0
  35. package/src/syncer/syncer.ts +7 -1
  36. package/src/templates/service.template.ts +50 -9
  37. package/dist/chunk-LNZTU4JC.mjs.map +0 -1
  38. package/dist/chunk-ZLFDB43J.js.map +0 -1
  39. package/dist/{chunk-FKZK27YL.mjs.map → chunk-C3IPIF6O.mjs.map} +0 -0
  40. package/dist/{chunk-INTZUNZ6.js.map → chunk-EXHKSVTE.js.map} +0 -0
  41. package/dist/{chunk-JQJTQQ7D.mjs.map → chunk-HGIBJYOU.mjs.map} +0 -0
  42. package/dist/{chunk-NPLUHS5L.mjs.map → chunk-JKSOJRQA.mjs.map} +0 -0
  43. package/dist/{chunk-FYLFH3Q6.js.map → chunk-OTKKFP3Y.js.map} +0 -0
  44. package/dist/{chunk-IEMX4VPN.js.map → chunk-UZ2IY5VE.js.map} +0 -0
  45. package/dist/{model-DWoinpJ7.d.mts → model-aFgomcdc.d.mts} +4 -4
  46. package/dist/{model-DWoinpJ7.d.ts → model-aFgomcdc.d.ts} +4 -4
@@ -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 _chunkZLFDB43Jjs = require('./chunk-ZLFDB43J.js');
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, () => ( _chunkZLFDB43Jjs.DB.getDB(subset.startsWith("A") ? "w" : "r")));
57
- const dbClient = _chunkZLFDB43Jjs.DB.toClient(db);
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-IEMX4VPN.js.map
231
+ //# sourceMappingURL=chunk-UZ2IY5VE.js.map
@@ -1,6 +1,6 @@
1
1
  import { Knex } from 'knex';
2
- import { D as DBPreset, U as UpsertBuilder, K as KnexClient, S as SubsetQuery } from '../../../model-DWoinpJ7.mjs';
3
- import { B as BaseModelClassAbstract } from '../../../base-model-BvVra-8f.mjs';
2
+ import { D as DBPreset, U as UpsertBuilder, K as KnexClient, S as SubsetQuery } from '../../../model-aFgomcdc.mjs';
3
+ import { B as BaseModelClassAbstract } from '../../../base-model-CEB0H0aO.mjs';
4
4
  import 'kysely';
5
5
  import 'zod';
6
6
  import 'mysql2';
@@ -1,6 +1,6 @@
1
1
  import { Knex } from 'knex';
2
- import { D as DBPreset, U as UpsertBuilder, K as KnexClient, S as SubsetQuery } from '../../../model-DWoinpJ7.js';
3
- import { B as BaseModelClassAbstract } from '../../../base-model-Br6krkwK.js';
2
+ import { D as DBPreset, U as UpsertBuilder, K as KnexClient, S as SubsetQuery } from '../../../model-aFgomcdc.js';
3
+ import { B as BaseModelClassAbstract } from '../../../base-model-CrqDMYhI.js';
4
4
  import 'kysely';
5
5
  import 'zod';
6
6
  import 'mysql2';
@@ -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 _chunkIEMX4VPNjs = require('../../../chunk-IEMX4VPN.js');
3
+ var _chunkUZ2IY5VEjs = require('../../../chunk-UZ2IY5VE.js');
4
4
 
5
5
 
6
- var _chunkINTZUNZ6js = require('../../../chunk-INTZUNZ6.js');
6
+ var _chunkEXHKSVTEjs = require('../../../chunk-EXHKSVTE.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkZLFDB43Jjs = require('../../../chunk-ZLFDB43J.js');
10
+ var _chunk2WAC2GERjs = require('../../../chunk-2WAC2GER.js');
11
11
 
12
12
  // src/database/drivers/knex/base-model.ts
13
- var BaseModelClass = class extends _chunkIEMX4VPNjs.BaseModelClassAbstract {
13
+ var BaseModelClass = class extends _chunkUZ2IY5VEjs.BaseModelClassAbstract {
14
14
  getDB(which) {
15
- return _chunkZLFDB43Jjs.DB.getDB(which);
15
+ return _chunk2WAC2GERjs.DB.getDB(which);
16
16
  }
17
17
  async destroy() {
18
- return _chunkZLFDB43Jjs.DB.destroy();
18
+ return _chunk2WAC2GERjs.DB.destroy();
19
19
  }
20
20
  getUpsertBuilder() {
21
- return new (0, _chunkINTZUNZ6js.UpsertBuilder)();
21
+ return new (0, _chunkEXHKSVTEjs.UpsertBuilder)();
22
22
  }
23
23
  applyJoins(clonedQb, joins) {
24
24
  for (const join of joins) {
25
- if (_chunkZLFDB43Jjs.isCustomJoinClause.call(void 0, join)) {
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-JQJTQQ7D.mjs";
3
+ } from "../../../chunk-HGIBJYOU.mjs";
4
4
  import {
5
5
  UpsertBuilder
6
- } from "../../../chunk-NPLUHS5L.mjs";
6
+ } from "../../../chunk-JKSOJRQA.mjs";
7
7
  import {
8
8
  DB,
9
9
  isCustomJoinClause
10
- } from "../../../chunk-LNZTU4JC.mjs";
10
+ } from "../../../chunk-FCERKIIF.mjs";
11
11
  import "../../../chunk-PTFDTOJU.mjs";
12
12
 
13
13
  // src/database/drivers/knex/base-model.ts
@@ -1,6 +1,6 @@
1
1
  import { Kysely, SelectQueryBuilder } from 'kysely';
2
- import { D as DBPreset, a as Database, U as UpsertBuilder, b as KyselyClient, S as SubsetQuery } from '../../../model-DWoinpJ7.mjs';
3
- import { B as BaseModelClassAbstract } from '../../../base-model-BvVra-8f.mjs';
2
+ import { D as DBPreset, a as Database, U as UpsertBuilder, b as KyselyClient, S as SubsetQuery } from '../../../model-aFgomcdc.mjs';
3
+ import { B as BaseModelClassAbstract } from '../../../base-model-CEB0H0aO.mjs';
4
4
  import { UndirectedOrderByExpression } from 'kysely/dist/cjs/parser/order-by-parser';
5
5
  import 'knex';
6
6
  import 'zod';
@@ -1,6 +1,6 @@
1
1
  import { Kysely, SelectQueryBuilder } from 'kysely';
2
- import { D as DBPreset, a as Database, U as UpsertBuilder, b as KyselyClient, S as SubsetQuery } from '../../../model-DWoinpJ7.js';
3
- import { B as BaseModelClassAbstract } from '../../../base-model-Br6krkwK.js';
2
+ import { D as DBPreset, a as Database, U as UpsertBuilder, b as KyselyClient, S as SubsetQuery } from '../../../model-aFgomcdc.js';
3
+ import { B as BaseModelClassAbstract } from '../../../base-model-CrqDMYhI.js';
4
4
  import { UndirectedOrderByExpression } from 'kysely/dist/cjs/parser/order-by-parser';
5
5
  import 'knex';
6
6
  import 'zod';
@@ -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 _chunkIEMX4VPNjs = require('../../../chunk-IEMX4VPN.js');
3
+ var _chunkUZ2IY5VEjs = require('../../../chunk-UZ2IY5VE.js');
4
4
 
5
5
 
6
- var _chunkINTZUNZ6js = require('../../../chunk-INTZUNZ6.js');
6
+ var _chunkEXHKSVTEjs = require('../../../chunk-EXHKSVTE.js');
7
7
 
8
8
 
9
9
 
10
10
 
11
- var _chunkZLFDB43Jjs = require('../../../chunk-ZLFDB43J.js');
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 _chunkIEMX4VPNjs.BaseModelClassAbstract {
15
+ var BaseModelClass = class extends _chunkUZ2IY5VEjs.BaseModelClassAbstract {
16
16
  getDB(which) {
17
- return _chunkZLFDB43Jjs.DB.getDB(which);
17
+ return _chunk2WAC2GERjs.DB.getDB(which);
18
18
  }
19
19
  async destroy() {
20
- return _chunkZLFDB43Jjs.DB.destroy();
20
+ return _chunk2WAC2GERjs.DB.destroy();
21
21
  }
22
22
  getUpsertBuilder() {
23
- return new (0, _chunkINTZUNZ6js.UpsertBuilder)();
23
+ return new (0, _chunkEXHKSVTEjs.UpsertBuilder)();
24
24
  }
25
25
  applyJoins(clonedQb, joins) {
26
26
  for (const join of joins) {
27
- if (_chunkZLFDB43Jjs.isCustomJoinClause.call(void 0, join)) {
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 _chunkIEMX4VPNjs.BaseModelClassAbstract {
48
48
  if (!column) {
49
49
  throw new Error("parseOrderBy: Invalid column");
50
50
  }
51
- const entity = _chunkZLFDB43Jjs.EntityManager.get(_inflection2.default.classify(table));
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-JQJTQQ7D.mjs";
3
+ } from "../../../chunk-HGIBJYOU.mjs";
4
4
  import {
5
5
  UpsertBuilder
6
- } from "../../../chunk-NPLUHS5L.mjs";
6
+ } from "../../../chunk-JKSOJRQA.mjs";
7
7
  import {
8
8
  DB,
9
9
  EntityManager,
10
10
  isCustomJoinClause
11
- } from "../../../chunk-LNZTU4JC.mjs";
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.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { A as ApiParamType, e as ApiParam, E as EntityPropNode, T as TextProp, f as EntityProp, R as RelationProp, g as EntityIndex, h as EntityJson, S as SubsetQuery, i as EntitySubsetRow, j as TemplateKey, k as TemplateOptions, P as PathAndCode, G as GenerateOptions, l as RenderingNode, m as SonamuDBConfig, c as DatabaseDriver, D as DBPreset, U as UpsertBuilder, K as KnexClient, b as KyselyClient, a as Database, n as SonamuDBBaseConfig, o as KnexConfig, p as KyselyConfig, q as KnexGenerator, r as KnexBaseConfig, s as SonamuKnexDBConfig, C as CodeGenerator, M as MigrationColumn, t as MigrationIndex, u as GenMigrationCode, v as MigrationForeign, w as KyselyBaseConfig, x as SonamuKyselyDBConfig, y as DatabaseExtend, I as IntegerProp, z as BigIntegerProp, F as StringProp, H as FloatProp, J as DoubleProp, L as DecimalProp, N as BooleanProp, O as DateProp, Q as DateTimeProp, V as TimeProp, W as TimestampProp, X as JsonProp, Y as UuidProp, Z as EnumProp, _ as VirtualProp, $ as DistributiveOmit, a0 as OneToOneRelationProp, a1 as BelongsToOneRelationProp, a2 as HasManyRelationProp, a3 as ManyToManyRelationProp, a4 as MigrationSet, a5 as MigrationSetAndJoinTable, a6 as FixtureSearchOptions, a7 as FixtureRecord, a8 as FixtureImportResult } from './model-DWoinpJ7.mjs';
3
- export { aS as ArrayOr, B as BaseListParams, aj as CommonProp, ac as DatabaseClient, d as DriverSpec, af as EnumsLabel, ag as EnumsLabelKo, ad as Environment, am as FlattenSubsetRow, aO as KnexColumnType, aL as KnexError, aR as ListResult, aP as MigrationJoinTable, aQ as RelationNode, al as RelationOn, ak as RelationType, an as SMDInput, ah as SQLDateTimeString, ae as SonamuDBFullConfig, aK as SonamuQueryMode, a9 as UBRef, ab as WhereClause, aT as asArray, aG as isBelongsToOneRelationProp, ap as isBigIntegerProp, aw as isBooleanProp, aJ as isCustomJoinClause, ax as isDateProp, ay as isDateTimeProp, av as isDecimalProp, au as isDoubleProp, as as isEnumProp, at as isFloatProp, aH as isHasManyRelationProp, ao as isIntegerProp, aB as isJsonProp, aM as isKnexError, aN as isKyselyError, aI as isManyToManyRelationProp, aF as isOneToOneRelationProp, aa as isRefField, aE as isRelationProp, ar as isStringProp, aq as isTextProp, az as isTimeProp, aA as isTimestampProp, aC as isUuidProp, aD as isVirtualProp, aU as objToMap, ai as zArrayable } from './model-DWoinpJ7.mjs';
2
+ import { A as ApiParamType, e as ApiParam, E as EntityPropNode, T as TextProp, f as EntityProp, R as RelationProp, g as EntityIndex, h as EntityJson, S as SubsetQuery, i as EntitySubsetRow, j as TemplateKey, k as TemplateOptions, P as PathAndCode, G as GenerateOptions, l as RenderingNode, m as SonamuDBConfig, c as DatabaseDriver, D as DBPreset, U as UpsertBuilder, K as KnexClient, b as KyselyClient, a as Database, n as SonamuDBBaseConfig, o as KnexConfig, p as KyselyConfig, q as KnexGenerator, r as KnexBaseConfig, s as SonamuKnexDBConfig, C as CodeGenerator, M as MigrationColumn, t as MigrationIndex, u as GenMigrationCode, v as MigrationForeign, w as KyselyBaseConfig, x as SonamuKyselyDBConfig, y as DatabaseExtend, I as IntegerProp, z as BigIntegerProp, F as StringProp, H as FloatProp, J as DoubleProp, L as DecimalProp, N as BooleanProp, O as DateProp, Q as DateTimeProp, V as TimeProp, W as TimestampProp, X as JsonProp, Y as UuidProp, Z as EnumProp, _ as VirtualProp, $ as DistributiveOmit, a0 as OneToOneRelationProp, a1 as BelongsToOneRelationProp, a2 as HasManyRelationProp, a3 as ManyToManyRelationProp, a4 as MigrationSet, a5 as MigrationSetAndJoinTable, a6 as FixtureSearchOptions, a7 as FixtureRecord, a8 as FixtureImportResult } from './model-aFgomcdc.mjs';
3
+ export { aS as ArrayOr, B as BaseListParams, aj as CommonProp, ac as DatabaseClient, d as DriverSpec, af as EnumsLabel, ag as EnumsLabelKo, ad as Environment, am as FlattenSubsetRow, aO as KnexColumnType, aL as KnexError, aR as ListResult, aP as MigrationJoinTable, aQ as RelationNode, al as RelationOn, ak as RelationType, an as SMDInput, ah as SQLDateTimeString, ae as SonamuDBFullConfig, aK as SonamuQueryMode, a9 as UBRef, ab as WhereClause, aT as asArray, aG as isBelongsToOneRelationProp, ap as isBigIntegerProp, aw as isBooleanProp, aJ as isCustomJoinClause, ax as isDateProp, ay as isDateTimeProp, av as isDecimalProp, au as isDoubleProp, as as isEnumProp, at as isFloatProp, aH as isHasManyRelationProp, ao as isIntegerProp, aB as isJsonProp, aM as isKnexError, aN as isKyselyError, aI as isManyToManyRelationProp, aF as isOneToOneRelationProp, aa as isRefField, aE as isRelationProp, ar as isStringProp, aq as isTextProp, az as isTimeProp, aA as isTimestampProp, aC as isUuidProp, aD as isVirtualProp, aU as objToMap, ai as zArrayable } from './model-aFgomcdc.mjs';
4
4
  import { HTTPMethods, FastifyReply, FastifyInstance, FastifyRequest } from 'fastify';
5
5
  import { RouteGenericInterface } from 'fastify/types/route';
6
6
  import { Server, IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';
@@ -11,7 +11,7 @@ import * as kysely from 'kysely';
11
11
  import { Kysely } from 'kysely';
12
12
  import 'mysql2';
13
13
 
14
- type ServiceClient = "axios" | "axios-multipart" | "swr" | "socketio" | "window-fetch";
14
+ type ServiceClient = "axios" | "axios-multipart" | "swr" | "window-fetch";
15
15
  type ApiDecoratorOptions = {
16
16
  httpMethod?: HTTPMethods;
17
17
  contentType?: "text/plain" | "text/html" | "text/xml" | "application/json" | "application/octet-stream";
@@ -21,22 +21,33 @@ type ApiDecoratorOptions = {
21
21
  guards?: string[];
22
22
  description?: string;
23
23
  };
24
+ type StreamDecoratorOptions = {
25
+ type: "sse";
26
+ events: z.ZodObject<any>;
27
+ path?: string;
28
+ resourceName?: string;
29
+ guards?: string[];
30
+ description?: string;
31
+ };
24
32
  declare const registeredApis: {
25
33
  modelName: string;
26
34
  methodName: string;
27
35
  path: string;
28
36
  options: ApiDecoratorOptions;
37
+ streamOptions?: StreamDecoratorOptions;
29
38
  }[];
30
39
  type ExtendedApi = {
31
40
  modelName: string;
32
41
  methodName: string;
33
42
  path: string;
34
43
  options: ApiDecoratorOptions;
44
+ streamOptions?: StreamDecoratorOptions;
35
45
  typeParameters: ApiParamType.TypeParam[];
36
46
  parameters: ApiParam[];
37
47
  returnType: ApiParamType;
38
48
  };
39
49
  declare function api(options?: ApiDecoratorOptions): (target: Object, propertyKey: string) => void;
50
+ declare function stream(options: StreamDecoratorOptions): (target: Object, propertyKey: string) => void;
40
51
 
41
52
  declare function getZodObjectFromApi(api: ExtendedApi, references?: {
42
53
  [id: string]: z.ZodObject<any>;
@@ -52,6 +63,7 @@ declare function getTextTypeLength(textType: TextProp["textType"]): number;
52
63
  declare function propToZodTypeDef(prop: EntityProp, injectImportKeys: string[]): string;
53
64
  declare function zodTypeToZodCode(zt: z.ZodFirstPartySchemaTypes | z.ZodObject<any>): string;
54
65
  declare function apiParamToTsCode(params: ApiParam[], injectImportKeys: string[]): string;
66
+ declare function apiParamToTsCodeAsObject(params: ApiParam[], injectImportKeys: string[]): string;
55
67
  declare function apiParamTypeToTsType(paramType: ApiParamType, injectImportKeys: string[]): string;
56
68
  declare function unwrapPromiseOnce(paramType: ApiParamType): ApiParamType;
57
69
  declare function serializeZodType(zt: z.ZodTypeAny): any;
@@ -216,6 +228,7 @@ declare class Syncer {
216
228
  methodName: string;
217
229
  path: string;
218
230
  options: ApiDecoratorOptions;
231
+ streamOptions?: StreamDecoratorOptions | undefined;
219
232
  }[]>;
220
233
  resolveTypeNode(typeNode: ts.TypeNode): ApiParamType;
221
234
  resolveParamDec: (paramDec: {
@@ -797,4 +810,4 @@ declare function findApiRootPath(): string;
797
810
  declare function nonNullable<T>(value: T): value is NonNullable<T>;
798
811
  declare function hydrate<T>(rows: T[]): T[];
799
812
 
800
- export { AlreadyProcessedException, type ApiDecoratorOptions, ApiParam, ApiParamType, BadRequestException, BaseFrameClass, BelongsToOneRelationProp, BigIntegerProp, BooleanProp, type Context, type ContextExtend, DB, DBKnexClass, DBKyselyClass, DBPreset, Database, DatabaseDriver, DatabaseExtend, DateProp, DateTimeProp, DecimalProp, DistributiveOmit, DoubleProp, DuplicateRowException, Entity, EntityIndex, EntityJson, EntityManager, type EntityNamesRecord, EntityProp, EntityPropNode, EntitySubsetRow, EnumProp, type ExtendedApi, FixtureImportResult, FixtureManager, FixtureManagerClass, FixtureRecord, FixtureSearchOptions, FloatProp, GenMigrationCode, GenerateOptions, HasManyRelationProp, IntegerProp, InternalServerErrorException, JsonProp, KnexBaseConfig, KnexConfig, KyselyBaseConfig, KyselyConfig, ManyToManyRelationProp, MigrationColumn, MigrationForeign, MigrationIndex, MigrationSet, MigrationSetAndJoinTable, type MigrationStatus, Migrator, type MigratorOptions, NotFoundException, OneToOneRelationProp, PathAndCode, RelationProp, type RenderedTemplate, RenderingNode, type ServiceClient, ServiceUnavailableException, SoException, Sonamu, type SonamuConfig, SonamuDBBaseConfig, SonamuDBConfig, SonamuKnexDBConfig, SonamuKyselyDBConfig, type SonamuSecrets, StringProp, SubsetQuery, Syncer, TargetNotFoundException, TemplateKey, TemplateOptions, TextProp, TimeProp, TimestampProp, UnauthorizedException, UpsertBuilder, UuidProp, VirtualProp, api, apiParamToTsCode, apiParamTypeToTsType, findApiRootPath, findAppRootPath, getTextTypeLength, getZodObjectFromApi, getZodObjectFromApiParams, getZodTypeFromApiParamType, globAsync, hydrate, i, importMultiple, isDaemonServer, isDevelopment, isInDocker, isLocal, isProduction, isRemote, isSoException, isStaging, isTest, nonNullable, p, propNodeToZodTypeDef, propToZodTypeDef, registeredApis, serializeZodType, setupErrorHandler, unwrapPromiseOnce, zodTypeToTsTypeDef, zodTypeToZodCode };
813
+ export { AlreadyProcessedException, type ApiDecoratorOptions, ApiParam, ApiParamType, BadRequestException, BaseFrameClass, BelongsToOneRelationProp, BigIntegerProp, BooleanProp, type Context, type ContextExtend, DB, DBKnexClass, DBKyselyClass, DBPreset, Database, DatabaseDriver, DatabaseExtend, DateProp, DateTimeProp, DecimalProp, DistributiveOmit, DoubleProp, DuplicateRowException, Entity, EntityIndex, EntityJson, EntityManager, type EntityNamesRecord, EntityProp, EntityPropNode, EntitySubsetRow, EnumProp, type ExtendedApi, FixtureImportResult, FixtureManager, FixtureManagerClass, FixtureRecord, FixtureSearchOptions, FloatProp, GenMigrationCode, GenerateOptions, HasManyRelationProp, IntegerProp, InternalServerErrorException, JsonProp, KnexBaseConfig, KnexConfig, KyselyBaseConfig, KyselyConfig, ManyToManyRelationProp, MigrationColumn, MigrationForeign, MigrationIndex, MigrationSet, MigrationSetAndJoinTable, type MigrationStatus, Migrator, type MigratorOptions, NotFoundException, OneToOneRelationProp, PathAndCode, RelationProp, type RenderedTemplate, RenderingNode, type ServiceClient, ServiceUnavailableException, SoException, Sonamu, type SonamuConfig, SonamuDBBaseConfig, SonamuDBConfig, SonamuKnexDBConfig, SonamuKyselyDBConfig, type SonamuSecrets, type StreamDecoratorOptions, StringProp, SubsetQuery, Syncer, TargetNotFoundException, TemplateKey, TemplateOptions, TextProp, TimeProp, TimestampProp, UnauthorizedException, UpsertBuilder, UuidProp, VirtualProp, api, apiParamToTsCode, apiParamToTsCodeAsObject, apiParamTypeToTsType, findApiRootPath, findAppRootPath, getTextTypeLength, getZodObjectFromApi, getZodObjectFromApiParams, getZodTypeFromApiParamType, globAsync, hydrate, i, importMultiple, isDaemonServer, isDevelopment, isInDocker, isLocal, isProduction, isRemote, isSoException, isStaging, isTest, nonNullable, p, propNodeToZodTypeDef, propToZodTypeDef, registeredApis, serializeZodType, setupErrorHandler, stream, unwrapPromiseOnce, zodTypeToTsTypeDef, zodTypeToZodCode };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { A as ApiParamType, e as ApiParam, E as EntityPropNode, T as TextProp, f as EntityProp, R as RelationProp, g as EntityIndex, h as EntityJson, S as SubsetQuery, i as EntitySubsetRow, j as TemplateKey, k as TemplateOptions, P as PathAndCode, G as GenerateOptions, l as RenderingNode, m as SonamuDBConfig, c as DatabaseDriver, D as DBPreset, U as UpsertBuilder, K as KnexClient, b as KyselyClient, a as Database, n as SonamuDBBaseConfig, o as KnexConfig, p as KyselyConfig, q as KnexGenerator, r as KnexBaseConfig, s as SonamuKnexDBConfig, C as CodeGenerator, M as MigrationColumn, t as MigrationIndex, u as GenMigrationCode, v as MigrationForeign, w as KyselyBaseConfig, x as SonamuKyselyDBConfig, y as DatabaseExtend, I as IntegerProp, z as BigIntegerProp, F as StringProp, H as FloatProp, J as DoubleProp, L as DecimalProp, N as BooleanProp, O as DateProp, Q as DateTimeProp, V as TimeProp, W as TimestampProp, X as JsonProp, Y as UuidProp, Z as EnumProp, _ as VirtualProp, $ as DistributiveOmit, a0 as OneToOneRelationProp, a1 as BelongsToOneRelationProp, a2 as HasManyRelationProp, a3 as ManyToManyRelationProp, a4 as MigrationSet, a5 as MigrationSetAndJoinTable, a6 as FixtureSearchOptions, a7 as FixtureRecord, a8 as FixtureImportResult } from './model-DWoinpJ7.js';
3
- export { aS as ArrayOr, B as BaseListParams, aj as CommonProp, ac as DatabaseClient, d as DriverSpec, af as EnumsLabel, ag as EnumsLabelKo, ad as Environment, am as FlattenSubsetRow, aO as KnexColumnType, aL as KnexError, aR as ListResult, aP as MigrationJoinTable, aQ as RelationNode, al as RelationOn, ak as RelationType, an as SMDInput, ah as SQLDateTimeString, ae as SonamuDBFullConfig, aK as SonamuQueryMode, a9 as UBRef, ab as WhereClause, aT as asArray, aG as isBelongsToOneRelationProp, ap as isBigIntegerProp, aw as isBooleanProp, aJ as isCustomJoinClause, ax as isDateProp, ay as isDateTimeProp, av as isDecimalProp, au as isDoubleProp, as as isEnumProp, at as isFloatProp, aH as isHasManyRelationProp, ao as isIntegerProp, aB as isJsonProp, aM as isKnexError, aN as isKyselyError, aI as isManyToManyRelationProp, aF as isOneToOneRelationProp, aa as isRefField, aE as isRelationProp, ar as isStringProp, aq as isTextProp, az as isTimeProp, aA as isTimestampProp, aC as isUuidProp, aD as isVirtualProp, aU as objToMap, ai as zArrayable } from './model-DWoinpJ7.js';
2
+ import { A as ApiParamType, e as ApiParam, E as EntityPropNode, T as TextProp, f as EntityProp, R as RelationProp, g as EntityIndex, h as EntityJson, S as SubsetQuery, i as EntitySubsetRow, j as TemplateKey, k as TemplateOptions, P as PathAndCode, G as GenerateOptions, l as RenderingNode, m as SonamuDBConfig, c as DatabaseDriver, D as DBPreset, U as UpsertBuilder, K as KnexClient, b as KyselyClient, a as Database, n as SonamuDBBaseConfig, o as KnexConfig, p as KyselyConfig, q as KnexGenerator, r as KnexBaseConfig, s as SonamuKnexDBConfig, C as CodeGenerator, M as MigrationColumn, t as MigrationIndex, u as GenMigrationCode, v as MigrationForeign, w as KyselyBaseConfig, x as SonamuKyselyDBConfig, y as DatabaseExtend, I as IntegerProp, z as BigIntegerProp, F as StringProp, H as FloatProp, J as DoubleProp, L as DecimalProp, N as BooleanProp, O as DateProp, Q as DateTimeProp, V as TimeProp, W as TimestampProp, X as JsonProp, Y as UuidProp, Z as EnumProp, _ as VirtualProp, $ as DistributiveOmit, a0 as OneToOneRelationProp, a1 as BelongsToOneRelationProp, a2 as HasManyRelationProp, a3 as ManyToManyRelationProp, a4 as MigrationSet, a5 as MigrationSetAndJoinTable, a6 as FixtureSearchOptions, a7 as FixtureRecord, a8 as FixtureImportResult } from './model-aFgomcdc.js';
3
+ export { aS as ArrayOr, B as BaseListParams, aj as CommonProp, ac as DatabaseClient, d as DriverSpec, af as EnumsLabel, ag as EnumsLabelKo, ad as Environment, am as FlattenSubsetRow, aO as KnexColumnType, aL as KnexError, aR as ListResult, aP as MigrationJoinTable, aQ as RelationNode, al as RelationOn, ak as RelationType, an as SMDInput, ah as SQLDateTimeString, ae as SonamuDBFullConfig, aK as SonamuQueryMode, a9 as UBRef, ab as WhereClause, aT as asArray, aG as isBelongsToOneRelationProp, ap as isBigIntegerProp, aw as isBooleanProp, aJ as isCustomJoinClause, ax as isDateProp, ay as isDateTimeProp, av as isDecimalProp, au as isDoubleProp, as as isEnumProp, at as isFloatProp, aH as isHasManyRelationProp, ao as isIntegerProp, aB as isJsonProp, aM as isKnexError, aN as isKyselyError, aI as isManyToManyRelationProp, aF as isOneToOneRelationProp, aa as isRefField, aE as isRelationProp, ar as isStringProp, aq as isTextProp, az as isTimeProp, aA as isTimestampProp, aC as isUuidProp, aD as isVirtualProp, aU as objToMap, ai as zArrayable } from './model-aFgomcdc.js';
4
4
  import { HTTPMethods, FastifyReply, FastifyInstance, FastifyRequest } from 'fastify';
5
5
  import { RouteGenericInterface } from 'fastify/types/route';
6
6
  import { Server, IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';
@@ -11,7 +11,7 @@ import * as kysely from 'kysely';
11
11
  import { Kysely } from 'kysely';
12
12
  import 'mysql2';
13
13
 
14
- type ServiceClient = "axios" | "axios-multipart" | "swr" | "socketio" | "window-fetch";
14
+ type ServiceClient = "axios" | "axios-multipart" | "swr" | "window-fetch";
15
15
  type ApiDecoratorOptions = {
16
16
  httpMethod?: HTTPMethods;
17
17
  contentType?: "text/plain" | "text/html" | "text/xml" | "application/json" | "application/octet-stream";
@@ -21,22 +21,33 @@ type ApiDecoratorOptions = {
21
21
  guards?: string[];
22
22
  description?: string;
23
23
  };
24
+ type StreamDecoratorOptions = {
25
+ type: "sse";
26
+ events: z.ZodObject<any>;
27
+ path?: string;
28
+ resourceName?: string;
29
+ guards?: string[];
30
+ description?: string;
31
+ };
24
32
  declare const registeredApis: {
25
33
  modelName: string;
26
34
  methodName: string;
27
35
  path: string;
28
36
  options: ApiDecoratorOptions;
37
+ streamOptions?: StreamDecoratorOptions;
29
38
  }[];
30
39
  type ExtendedApi = {
31
40
  modelName: string;
32
41
  methodName: string;
33
42
  path: string;
34
43
  options: ApiDecoratorOptions;
44
+ streamOptions?: StreamDecoratorOptions;
35
45
  typeParameters: ApiParamType.TypeParam[];
36
46
  parameters: ApiParam[];
37
47
  returnType: ApiParamType;
38
48
  };
39
49
  declare function api(options?: ApiDecoratorOptions): (target: Object, propertyKey: string) => void;
50
+ declare function stream(options: StreamDecoratorOptions): (target: Object, propertyKey: string) => void;
40
51
 
41
52
  declare function getZodObjectFromApi(api: ExtendedApi, references?: {
42
53
  [id: string]: z.ZodObject<any>;
@@ -52,6 +63,7 @@ declare function getTextTypeLength(textType: TextProp["textType"]): number;
52
63
  declare function propToZodTypeDef(prop: EntityProp, injectImportKeys: string[]): string;
53
64
  declare function zodTypeToZodCode(zt: z.ZodFirstPartySchemaTypes | z.ZodObject<any>): string;
54
65
  declare function apiParamToTsCode(params: ApiParam[], injectImportKeys: string[]): string;
66
+ declare function apiParamToTsCodeAsObject(params: ApiParam[], injectImportKeys: string[]): string;
55
67
  declare function apiParamTypeToTsType(paramType: ApiParamType, injectImportKeys: string[]): string;
56
68
  declare function unwrapPromiseOnce(paramType: ApiParamType): ApiParamType;
57
69
  declare function serializeZodType(zt: z.ZodTypeAny): any;
@@ -216,6 +228,7 @@ declare class Syncer {
216
228
  methodName: string;
217
229
  path: string;
218
230
  options: ApiDecoratorOptions;
231
+ streamOptions?: StreamDecoratorOptions | undefined;
219
232
  }[]>;
220
233
  resolveTypeNode(typeNode: ts.TypeNode): ApiParamType;
221
234
  resolveParamDec: (paramDec: {
@@ -797,4 +810,4 @@ declare function findApiRootPath(): string;
797
810
  declare function nonNullable<T>(value: T): value is NonNullable<T>;
798
811
  declare function hydrate<T>(rows: T[]): T[];
799
812
 
800
- export { AlreadyProcessedException, type ApiDecoratorOptions, ApiParam, ApiParamType, BadRequestException, BaseFrameClass, BelongsToOneRelationProp, BigIntegerProp, BooleanProp, type Context, type ContextExtend, DB, DBKnexClass, DBKyselyClass, DBPreset, Database, DatabaseDriver, DatabaseExtend, DateProp, DateTimeProp, DecimalProp, DistributiveOmit, DoubleProp, DuplicateRowException, Entity, EntityIndex, EntityJson, EntityManager, type EntityNamesRecord, EntityProp, EntityPropNode, EntitySubsetRow, EnumProp, type ExtendedApi, FixtureImportResult, FixtureManager, FixtureManagerClass, FixtureRecord, FixtureSearchOptions, FloatProp, GenMigrationCode, GenerateOptions, HasManyRelationProp, IntegerProp, InternalServerErrorException, JsonProp, KnexBaseConfig, KnexConfig, KyselyBaseConfig, KyselyConfig, ManyToManyRelationProp, MigrationColumn, MigrationForeign, MigrationIndex, MigrationSet, MigrationSetAndJoinTable, type MigrationStatus, Migrator, type MigratorOptions, NotFoundException, OneToOneRelationProp, PathAndCode, RelationProp, type RenderedTemplate, RenderingNode, type ServiceClient, ServiceUnavailableException, SoException, Sonamu, type SonamuConfig, SonamuDBBaseConfig, SonamuDBConfig, SonamuKnexDBConfig, SonamuKyselyDBConfig, type SonamuSecrets, StringProp, SubsetQuery, Syncer, TargetNotFoundException, TemplateKey, TemplateOptions, TextProp, TimeProp, TimestampProp, UnauthorizedException, UpsertBuilder, UuidProp, VirtualProp, api, apiParamToTsCode, apiParamTypeToTsType, findApiRootPath, findAppRootPath, getTextTypeLength, getZodObjectFromApi, getZodObjectFromApiParams, getZodTypeFromApiParamType, globAsync, hydrate, i, importMultiple, isDaemonServer, isDevelopment, isInDocker, isLocal, isProduction, isRemote, isSoException, isStaging, isTest, nonNullable, p, propNodeToZodTypeDef, propToZodTypeDef, registeredApis, serializeZodType, setupErrorHandler, unwrapPromiseOnce, zodTypeToTsTypeDef, zodTypeToZodCode };
813
+ export { AlreadyProcessedException, type ApiDecoratorOptions, ApiParam, ApiParamType, BadRequestException, BaseFrameClass, BelongsToOneRelationProp, BigIntegerProp, BooleanProp, type Context, type ContextExtend, DB, DBKnexClass, DBKyselyClass, DBPreset, Database, DatabaseDriver, DatabaseExtend, DateProp, DateTimeProp, DecimalProp, DistributiveOmit, DoubleProp, DuplicateRowException, Entity, EntityIndex, EntityJson, EntityManager, type EntityNamesRecord, EntityProp, EntityPropNode, EntitySubsetRow, EnumProp, type ExtendedApi, FixtureImportResult, FixtureManager, FixtureManagerClass, FixtureRecord, FixtureSearchOptions, FloatProp, GenMigrationCode, GenerateOptions, HasManyRelationProp, IntegerProp, InternalServerErrorException, JsonProp, KnexBaseConfig, KnexConfig, KyselyBaseConfig, KyselyConfig, ManyToManyRelationProp, MigrationColumn, MigrationForeign, MigrationIndex, MigrationSet, MigrationSetAndJoinTable, type MigrationStatus, Migrator, type MigratorOptions, NotFoundException, OneToOneRelationProp, PathAndCode, RelationProp, type RenderedTemplate, RenderingNode, type ServiceClient, ServiceUnavailableException, SoException, Sonamu, type SonamuConfig, SonamuDBBaseConfig, SonamuDBConfig, SonamuKnexDBConfig, SonamuKyselyDBConfig, type SonamuSecrets, type StreamDecoratorOptions, StringProp, SubsetQuery, Syncer, TargetNotFoundException, TemplateKey, TemplateOptions, TextProp, TimeProp, TimestampProp, UnauthorizedException, UpsertBuilder, UuidProp, VirtualProp, api, apiParamToTsCode, apiParamToTsCodeAsObject, apiParamTypeToTsType, findApiRootPath, findAppRootPath, getTextTypeLength, getZodObjectFromApi, getZodObjectFromApiParams, getZodTypeFromApiParamType, globAsync, hydrate, i, importMultiple, isDaemonServer, isDevelopment, isInDocker, isLocal, isProduction, isRemote, isSoException, isStaging, isTest, nonNullable, p, propNodeToZodTypeDef, propToZodTypeDef, registeredApis, serializeZodType, setupErrorHandler, stream, unwrapPromiseOnce, zodTypeToTsTypeDef, zodTypeToZodCode };
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkFYLFH3Q6js = require('./chunk-FYLFH3Q6.js');
5
+ var _chunkOTKKFP3Yjs = require('./chunk-OTKKFP3Y.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkINTZUNZ6js = require('./chunk-INTZUNZ6.js');
9
+ var _chunkEXHKSVTEjs = require('./chunk-EXHKSVTE.js');
10
10
 
11
11
 
12
12
 
@@ -88,15 +88,17 @@ var _chunkINTZUNZ6js = require('./chunk-INTZUNZ6.js');
88
88
 
89
89
 
90
90
 
91
- var _chunkZLFDB43Jjs = require('./chunk-ZLFDB43J.js');
91
+
92
+
93
+ var _chunk2WAC2GERjs = require('./chunk-2WAC2GER.js');
92
94
 
93
95
  // src/api/base-frame.ts
94
96
  var BaseFrameClass = class {
95
97
  getDB(which) {
96
- return _chunkZLFDB43Jjs.DB.getDB(which);
98
+ return _chunk2WAC2GERjs.DB.getDB(which);
97
99
  }
98
100
  getUpsertBuilder() {
99
- return new (0, _chunkINTZUNZ6js.UpsertBuilder)();
101
+ return new (0, _chunkEXHKSVTEjs.UpsertBuilder)();
100
102
  }
101
103
  };
102
104
 
@@ -104,7 +106,7 @@ var BaseFrameClass = class {
104
106
  function setupErrorHandler(server) {
105
107
  server.setErrorHandler((error, request, reply) => {
106
108
  error.statusCode ??= 400;
107
- if (_chunkZLFDB43Jjs.isSoException.call(void 0, error) && error.payload && Array.isArray(error.payload)) {
109
+ if (_chunk2WAC2GERjs.isSoException.call(void 0, error) && error.payload && Array.isArray(error.payload)) {
108
110
  const issues = error.payload;
109
111
  const [issue] = issues;
110
112
  const message = `${issue.message} (${issue.path.join("/")})`;
@@ -327,13 +329,13 @@ var i = {
327
329
  function index(columns) {
328
330
  return {
329
331
  type: "index",
330
- columns: _chunkZLFDB43Jjs.asArray.call(void 0, columns)
332
+ columns: _chunk2WAC2GERjs.asArray.call(void 0, columns)
331
333
  };
332
334
  }
333
335
  function unique(columns) {
334
336
  return {
335
337
  type: "unique",
336
- columns: _chunkZLFDB43Jjs.asArray.call(void 0, columns)
338
+ columns: _chunk2WAC2GERjs.asArray.call(void 0, columns)
337
339
  };
338
340
  }
339
341
 
@@ -426,5 +428,7 @@ function unique(columns) {
426
428
 
427
429
 
428
430
 
429
- exports.AlreadyProcessedException = _chunkZLFDB43Jjs.AlreadyProcessedException; exports.ApiParamType = _chunkZLFDB43Jjs.ApiParamType; exports.BadRequestException = _chunkZLFDB43Jjs.BadRequestException; exports.BaseFrameClass = BaseFrameClass; exports.DB = _chunkZLFDB43Jjs.DB; exports.DBKnexClass = _chunkZLFDB43Jjs.DBKnexClass; exports.DBKyselyClass = _chunkZLFDB43Jjs.DBKyselyClass; exports.DuplicateRowException = _chunkZLFDB43Jjs.DuplicateRowException; exports.Entity = _chunkZLFDB43Jjs.Entity; exports.EntityManager = _chunkZLFDB43Jjs.EntityManager; exports.FixtureManager = _chunkFYLFH3Q6js.FixtureManager; exports.FixtureManagerClass = _chunkFYLFH3Q6js.FixtureManagerClass; exports.GenerateOptions = _chunkZLFDB43Jjs.GenerateOptions; exports.InternalServerErrorException = _chunkZLFDB43Jjs.InternalServerErrorException; exports.Migrator = _chunkFYLFH3Q6js.Migrator; exports.NotFoundException = _chunkZLFDB43Jjs.NotFoundException; exports.PathAndCode = _chunkZLFDB43Jjs.PathAndCode; exports.RenderingNode = _chunkZLFDB43Jjs.RenderingNode; exports.SQLDateTimeString = _chunkZLFDB43Jjs.SQLDateTimeString; exports.ServiceUnavailableException = _chunkZLFDB43Jjs.ServiceUnavailableException; exports.SoException = _chunkZLFDB43Jjs.SoException; exports.Sonamu = _chunkZLFDB43Jjs.Sonamu; exports.SonamuQueryMode = _chunkZLFDB43Jjs.SonamuQueryMode; exports.Syncer = _chunkZLFDB43Jjs.Syncer; exports.TargetNotFoundException = _chunkZLFDB43Jjs.TargetNotFoundException; exports.TemplateKey = _chunkZLFDB43Jjs.TemplateKey; exports.TemplateOptions = _chunkZLFDB43Jjs.TemplateOptions; exports.UnauthorizedException = _chunkZLFDB43Jjs.UnauthorizedException; exports.UpsertBuilder = _chunkINTZUNZ6js.UpsertBuilder; exports.api = _chunkZLFDB43Jjs.api; exports.apiParamToTsCode = _chunkZLFDB43Jjs.apiParamToTsCode; exports.apiParamTypeToTsType = _chunkZLFDB43Jjs.apiParamTypeToTsType; exports.asArray = _chunkZLFDB43Jjs.asArray; exports.findApiRootPath = _chunkZLFDB43Jjs.findApiRootPath; exports.findAppRootPath = _chunkZLFDB43Jjs.findAppRootPath; exports.getTextTypeLength = _chunkZLFDB43Jjs.getTextTypeLength; exports.getZodObjectFromApi = _chunkZLFDB43Jjs.getZodObjectFromApi; exports.getZodObjectFromApiParams = _chunkZLFDB43Jjs.getZodObjectFromApiParams; exports.getZodTypeFromApiParamType = _chunkZLFDB43Jjs.getZodTypeFromApiParamType; exports.globAsync = _chunkZLFDB43Jjs.globAsync; exports.hydrate = _chunkZLFDB43Jjs.hydrate; exports.i = i; exports.importMultiple = _chunkZLFDB43Jjs.importMultiple; exports.isBelongsToOneRelationProp = _chunkZLFDB43Jjs.isBelongsToOneRelationProp; exports.isBigIntegerProp = _chunkZLFDB43Jjs.isBigIntegerProp; exports.isBooleanProp = _chunkZLFDB43Jjs.isBooleanProp; exports.isCustomJoinClause = _chunkZLFDB43Jjs.isCustomJoinClause; exports.isDaemonServer = _chunkZLFDB43Jjs.isDaemonServer; exports.isDateProp = _chunkZLFDB43Jjs.isDateProp; exports.isDateTimeProp = _chunkZLFDB43Jjs.isDateTimeProp; exports.isDecimalProp = _chunkZLFDB43Jjs.isDecimalProp; exports.isDevelopment = _chunkZLFDB43Jjs.isDevelopment; exports.isDoubleProp = _chunkZLFDB43Jjs.isDoubleProp; exports.isEnumProp = _chunkZLFDB43Jjs.isEnumProp; exports.isFloatProp = _chunkZLFDB43Jjs.isFloatProp; exports.isHasManyRelationProp = _chunkZLFDB43Jjs.isHasManyRelationProp; exports.isInDocker = _chunkZLFDB43Jjs.isInDocker; exports.isIntegerProp = _chunkZLFDB43Jjs.isIntegerProp; exports.isJsonProp = _chunkZLFDB43Jjs.isJsonProp; exports.isKnexError = _chunkZLFDB43Jjs.isKnexError; exports.isKyselyError = _chunkZLFDB43Jjs.isKyselyError; exports.isLocal = _chunkZLFDB43Jjs.isLocal; exports.isManyToManyRelationProp = _chunkZLFDB43Jjs.isManyToManyRelationProp; exports.isOneToOneRelationProp = _chunkZLFDB43Jjs.isOneToOneRelationProp; exports.isProduction = _chunkZLFDB43Jjs.isProduction; exports.isRefField = _chunkINTZUNZ6js.isRefField; exports.isRelationProp = _chunkZLFDB43Jjs.isRelationProp; exports.isRemote = _chunkZLFDB43Jjs.isRemote; exports.isSoException = _chunkZLFDB43Jjs.isSoException; exports.isStaging = _chunkZLFDB43Jjs.isStaging; exports.isStringProp = _chunkZLFDB43Jjs.isStringProp; exports.isTest = _chunkZLFDB43Jjs.isTest; exports.isTextProp = _chunkZLFDB43Jjs.isTextProp; exports.isTimeProp = _chunkZLFDB43Jjs.isTimeProp; exports.isTimestampProp = _chunkZLFDB43Jjs.isTimestampProp; exports.isUuidProp = _chunkZLFDB43Jjs.isUuidProp; exports.isVirtualProp = _chunkZLFDB43Jjs.isVirtualProp; exports.nonNullable = _chunkZLFDB43Jjs.nonNullable; exports.objToMap = _chunkZLFDB43Jjs.objToMap; exports.p = p; exports.propNodeToZodTypeDef = _chunkZLFDB43Jjs.propNodeToZodTypeDef; exports.propToZodTypeDef = _chunkZLFDB43Jjs.propToZodTypeDef; exports.registeredApis = _chunkZLFDB43Jjs.registeredApis; exports.serializeZodType = _chunkZLFDB43Jjs.serializeZodType; exports.setupErrorHandler = setupErrorHandler; exports.unwrapPromiseOnce = _chunkZLFDB43Jjs.unwrapPromiseOnce; exports.zArrayable = _chunkZLFDB43Jjs.zArrayable; exports.zodTypeToTsTypeDef = _chunkZLFDB43Jjs.zodTypeToTsTypeDef; exports.zodTypeToZodCode = _chunkZLFDB43Jjs.zodTypeToZodCode;
431
+
432
+
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;
430
434
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/base-frame.ts","../src/exceptions/error-handler.ts","../src/entity/entity-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAe,iBAAf,MAA8B;AAAA,EACnC,MAAM,OAAuB;AAC3B,WAAO,GAAG,MAAM,KAAK;AAAA,EACvB;AAAA,EAEA,mBAAmB;AACjB,WAAO,IAAI,cAAsB;AAAA,EACnC;AACF;;;ACTO,SAAS,kBAAkB,QAAyB;AACzD,SAAO,gBAAgB,CAAC,OAAO,SAAS,UAAU;AAChD,UAAM,eAAe;AAErB,QAAI,cAAc,KAAK,KAAK,MAAM,WAAW,MAAM,QAAQ,MAAM,OAAO,GAAG;AACzE,YAAM,SAAS,MAAM;AACrB,YAAM,CAAC,KAAK,IAAI;AAChB,YAAM,UAAU,GAAG,MAAM,OAAO,KAAK,MAAM,KAAK,KAAK,GAAG,CAAC;AAEzD,cAAQ,IAAI,MAAM,GAAG,MAAM,UAAU,IAAI,OAAO,EAAE;AAClD,YAAM,OAAO,MAAM,cAAc,MAAM,MAAM,aAAa,GAAG,EAAE,KAAK;AAAA,QAClE,MAAM,MAAM;AAAA,QACZ,MAAM,MAAM;AAAA,QACZ;AAAA,QACA,kBAAkB,MAAM;AAAA,QACxB;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,cAAQ,IAAI,MAAM,GAAG,MAAM,UAAU,IAAI,MAAM,OAAO,EAAE;AACx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,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,iBACP,MACA,QAIsB;AACtB,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AACA,SAAS,qBACP,MACA,QAC0B;AAC1B,SAAO,gBAAiB,OAAO,iBAAiB;AAChD,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AACA,SAAS,gBACP,MACA,QACqB;AACrB,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AACA,SAAS,mBACP,MACA,QACwB;AACxB,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AAEO,IAAM,IAAI;AAAA,EACf;AAAA,EACA;AACF;AAEA,SAAS,MAAM,SAAyC;AACtD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,QAAQ,OAAO;AAAA,EAC1B;AACF;AAEA,SAAS,OAAO,SAAyC;AACvD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,QAAQ,OAAO;AAAA,EAC1B;AACF","sourcesContent":["import { Knex } from \"knex\";\nimport { DB } from \"../database/db\";\nimport { DBPreset } from \"../database/types\";\nimport { UpsertBuilder } from \"../database/upsert-builder\";\n\nexport abstract class BaseFrameClass {\n getDB(which: DBPreset): Knex {\n return DB.getDB(which) as Knex;\n }\n\n getUpsertBuilder() {\n return new UpsertBuilder<\"knex\">();\n }\n}\n","import { FastifyInstance } from \"fastify\";\nimport { ZodIssue } from \"zod\";\nimport { isSoException } from \"./so-exceptions\";\n\nexport function setupErrorHandler(server: FastifyInstance) {\n server.setErrorHandler((error, request, reply) => {\n error.statusCode ??= 400;\n\n if (isSoException(error) && error.payload && Array.isArray(error.payload)) {\n const issues = error.payload as ZodIssue[];\n const [issue] = issues;\n const message = `${issue.message} (${issue.path.join(\"/\")})`;\n\n request.log.error(`${error.statusCode} ${message}`);\n reply.status(error.statusCode <= 501 ? error.statusCode : 501).send({\n name: error.name,\n code: error.code,\n message: message,\n validationErrors: error.validation,\n issues,\n });\n } else {\n request.log.error(`${error.statusCode} ${error.message}`);\n reply.status(error.statusCode <= 501 ? error.statusCode : 501).send({\n name: error.name,\n code: error.code,\n message: error.message,\n validationErrors: error.validation,\n });\n }\n });\n}\n","import inflection from \"inflection\";\nimport {\n BelongsToOneRelationProp,\n BigIntegerProp,\n BooleanProp,\n DateProp,\n DateTimeProp,\n DecimalProp,\n DistributiveOmit,\n DoubleProp,\n EnumProp,\n FloatProp,\n HasManyRelationProp,\n IntegerProp,\n JsonProp,\n ManyToManyRelationProp,\n OneToOneRelationProp,\n EntityIndex,\n StringProp,\n TextProp,\n TimeProp,\n TimestampProp,\n UuidProp,\n VirtualProp,\n} from \"../types/types\";\nimport { asArray } from \"../utils/model\";\n\nexport const p = {\n integer,\n bigInteger,\n text,\n string,\n float,\n double,\n decimal,\n boolean,\n date,\n dateTime,\n time,\n timestamp,\n json,\n uuid,\n enums,\n virtual,\n relationOneToOne,\n relationBelongsToOne,\n relationHasMany,\n relationManyToMany,\n};\n\nfunction integer(\n name: string,\n option?: Omit<IntegerProp, \"name\" | \"type\">\n): IntegerProp {\n return {\n name,\n type: \"integer\",\n ...option,\n };\n}\nfunction bigInteger(\n name: string,\n option?: Omit<BigIntegerProp, \"name\" | \"type\">\n): BigIntegerProp {\n return {\n name,\n type: \"bigInteger\",\n ...option,\n };\n}\nfunction text(name: string, option: Omit<TextProp, \"name\" | \"type\">): TextProp {\n return {\n name,\n type: \"text\",\n ...option,\n };\n}\nfunction string(\n name: string,\n option: Omit<StringProp, \"name\" | \"type\">\n): StringProp {\n return {\n name,\n type: \"string\",\n ...option,\n };\n}\nfunction float(\n name: string,\n option?: Omit<FloatProp, \"name\" | \"type\">\n): FloatProp {\n return {\n name,\n type: \"float\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction double(\n name: string,\n option?: Omit<DoubleProp, \"name\" | \"type\">\n): DoubleProp {\n return {\n name,\n type: \"double\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction decimal(\n name: string,\n option?: Omit<DecimalProp, \"name\" | \"type\">\n): DecimalProp {\n return {\n name,\n type: \"decimal\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction boolean(\n name: string,\n option?: Omit<BooleanProp, \"name\" | \"type\">\n): BooleanProp {\n return {\n name,\n type: \"boolean\",\n ...option,\n };\n}\nfunction date(\n name: string,\n option?: Omit<DateProp, \"name\" | \"type\"> & { now?: true }\n): DateProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"date\",\n ...option,\n };\n}\nfunction dateTime(\n name: string,\n option?: Omit<DateTimeProp, \"name\" | \"type\"> & { now?: true }\n): DateTimeProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"datetime\",\n ...option,\n };\n}\nfunction time(\n name: string,\n option?: Omit<TimeProp, \"name\" | \"type\"> & { now?: true }\n): TimeProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"time\",\n ...option,\n };\n}\nfunction timestamp(\n name: string,\n option?: Omit<TimestampProp, \"name\" | \"type\"> & { now?: true }\n): TimestampProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"timestamp\",\n ...option,\n };\n}\nfunction json(name: string, option: Omit<JsonProp, \"name\" | \"type\">): JsonProp {\n return {\n name,\n type: \"json\",\n ...option,\n };\n}\nfunction uuid(name: string, option: Omit<UuidProp, \"name\" | \"type\">): UuidProp {\n return {\n name,\n type: \"uuid\",\n ...option,\n };\n}\nfunction enums(\n name: string,\n option: Omit<EnumProp, \"name\" | \"type\" | \"id\"> & { id?: string }\n): EnumProp {\n return {\n name,\n type: \"enum\",\n id: option.id ?? `$Model${inflection.camelize(name)}`,\n ...option,\n };\n}\nfunction virtual(\n name: string,\n option: Omit<VirtualProp, \"name\" | \"type\" | \"dbDefault\" | \"toFilter\">\n): VirtualProp {\n return {\n name,\n type: \"virtual\",\n ...option,\n };\n}\nfunction relationOneToOne(\n name: string,\n option: DistributiveOmit<\n OneToOneRelationProp,\n \"name\" | \"type\" | \"relationType\"\n >\n): OneToOneRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"OneToOne\",\n ...option,\n };\n}\nfunction relationBelongsToOne(\n name: string,\n option: Omit<BelongsToOneRelationProp, \"name\" | \"type\" | \"relationType\">\n): BelongsToOneRelationProp {\n option.useConstraint = (option.useConstraint ?? true) as false;\n return {\n name,\n type: \"relation\",\n relationType: \"BelongsToOne\",\n ...option,\n };\n}\nfunction relationHasMany(\n name: string,\n option: Omit<HasManyRelationProp, \"name\" | \"type\" | \"relationType\">\n): HasManyRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"HasMany\",\n ...option,\n };\n}\nfunction relationManyToMany(\n name: string,\n option: Omit<ManyToManyRelationProp, \"name\" | \"type\" | \"relationType\">\n): ManyToManyRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"ManyToMany\",\n ...option,\n };\n}\n\nexport const i = {\n index,\n unique,\n};\n\nfunction index(columns: string | string[]): EntityIndex {\n return {\n type: \"index\",\n columns: asArray(columns),\n };\n}\n\nfunction unique(columns: string | string[]): EntityIndex {\n return {\n type: \"unique\",\n columns: asArray(columns),\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/api/base-frame.ts","../src/exceptions/error-handler.ts","../src/entity/entity-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,QACP,MACA,QACa;AACb,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,WACP,MACA,QACgB;AAChB,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,KAAK,MAAc,QAAmD;AAC7E,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,OACP,MACA,QACY;AACZ,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,MACP,MACA,QACW;AACX,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,WAAW;AAAA,IACX,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AACF;AACA,SAAS,OACP,MACA,QACY;AACZ,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,WAAW;AAAA,IACX,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AACF;AACA,SAAS,QACP,MACA,QACa;AACb,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,WAAW;AAAA,IACX,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AACF;AACA,SAAS,QACP,MACA,QACa;AACb,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,KACP,MACA,QACU;AACV,MAAI,QAAQ,QAAQ,MAAM;AACxB,WAAO,OAAO;AACd,WAAO,YAAY;AAAA,EACrB;AACA,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,SACP,MACA,QACc;AACd,MAAI,QAAQ,QAAQ,MAAM;AACxB,WAAO,OAAO;AACd,WAAO,YAAY;AAAA,EACrB;AACA,SAAO;AAAA,IACL;AAAA,I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L;AACF;AACA,SAAS,mBACP,MACA,QACwB;AACxB,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AAEO,IAAM,IAAI;AAAA,EACf;AAAA,EACA;AACF;AAEA,SAAS,MAAM,SAAyC;AACtD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,QAAQ,OAAO;AAAA,EAC1B;AACF;AAEA,SAAS,OAAO,SAAyC;AACvD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,QAAQ,OAAO;AAAA,EAC1B;AACF","sourcesContent":["import { Knex } from \"knex\";\nimport { DB } from \"../database/db\";\nimport { DBPreset } from \"../database/types\";\nimport { UpsertBuilder } from \"../database/upsert-builder\";\n\nexport abstract class BaseFrameClass {\n getDB(which: DBPreset): Knex {\n return DB.getDB(which) as Knex;\n }\n\n getUpsertBuilder() {\n return new UpsertBuilder<\"knex\">();\n }\n}\n","import { FastifyInstance } from \"fastify\";\nimport { ZodIssue } from \"zod\";\nimport { isSoException } from \"./so-exceptions\";\n\nexport function setupErrorHandler(server: FastifyInstance) {\n server.setErrorHandler((error, request, reply) => {\n error.statusCode ??= 400;\n\n if (isSoException(error) && error.payload && Array.isArray(error.payload)) {\n const issues = error.payload as ZodIssue[];\n const [issue] = issues;\n const message = `${issue.message} (${issue.path.join(\"/\")})`;\n\n request.log.error(`${error.statusCode} ${message}`);\n reply.status(error.statusCode <= 501 ? error.statusCode : 501).send({\n name: error.name,\n code: error.code,\n message: message,\n validationErrors: error.validation,\n issues,\n });\n } else {\n request.log.error(`${error.statusCode} ${error.message}`);\n reply.status(error.statusCode <= 501 ? error.statusCode : 501).send({\n name: error.name,\n code: error.code,\n message: error.message,\n validationErrors: error.validation,\n });\n }\n });\n}\n","import inflection from \"inflection\";\nimport {\n BelongsToOneRelationProp,\n BigIntegerProp,\n BooleanProp,\n DateProp,\n DateTimeProp,\n DecimalProp,\n DistributiveOmit,\n DoubleProp,\n EnumProp,\n FloatProp,\n HasManyRelationProp,\n IntegerProp,\n JsonProp,\n ManyToManyRelationProp,\n OneToOneRelationProp,\n EntityIndex,\n StringProp,\n TextProp,\n TimeProp,\n TimestampProp,\n UuidProp,\n VirtualProp,\n} from \"../types/types\";\nimport { asArray } from \"../utils/model\";\n\nexport const p = {\n integer,\n bigInteger,\n text,\n string,\n float,\n double,\n decimal,\n boolean,\n date,\n dateTime,\n time,\n timestamp,\n json,\n uuid,\n enums,\n virtual,\n relationOneToOne,\n relationBelongsToOne,\n relationHasMany,\n relationManyToMany,\n};\n\nfunction integer(\n name: string,\n option?: Omit<IntegerProp, \"name\" | \"type\">\n): IntegerProp {\n return {\n name,\n type: \"integer\",\n ...option,\n };\n}\nfunction bigInteger(\n name: string,\n option?: Omit<BigIntegerProp, \"name\" | \"type\">\n): BigIntegerProp {\n return {\n name,\n type: \"bigInteger\",\n ...option,\n };\n}\nfunction text(name: string, option: Omit<TextProp, \"name\" | \"type\">): TextProp {\n return {\n name,\n type: \"text\",\n ...option,\n };\n}\nfunction string(\n name: string,\n option: Omit<StringProp, \"name\" | \"type\">\n): StringProp {\n return {\n name,\n type: \"string\",\n ...option,\n };\n}\nfunction float(\n name: string,\n option?: Omit<FloatProp, \"name\" | \"type\">\n): FloatProp {\n return {\n name,\n type: \"float\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction double(\n name: string,\n option?: Omit<DoubleProp, \"name\" | \"type\">\n): DoubleProp {\n return {\n name,\n type: \"double\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction decimal(\n name: string,\n option?: Omit<DecimalProp, \"name\" | \"type\">\n): DecimalProp {\n return {\n name,\n type: \"decimal\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction boolean(\n name: string,\n option?: Omit<BooleanProp, \"name\" | \"type\">\n): BooleanProp {\n return {\n name,\n type: \"boolean\",\n ...option,\n };\n}\nfunction date(\n name: string,\n option?: Omit<DateProp, \"name\" | \"type\"> & { now?: true }\n): DateProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"date\",\n ...option,\n };\n}\nfunction dateTime(\n name: string,\n option?: Omit<DateTimeProp, \"name\" | \"type\"> & { now?: true }\n): DateTimeProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"datetime\",\n ...option,\n };\n}\nfunction time(\n name: string,\n option?: Omit<TimeProp, \"name\" | \"type\"> & { now?: true }\n): TimeProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"time\",\n ...option,\n };\n}\nfunction timestamp(\n name: string,\n option?: Omit<TimestampProp, \"name\" | \"type\"> & { now?: true }\n): TimestampProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"timestamp\",\n ...option,\n };\n}\nfunction json(name: string, option: Omit<JsonProp, \"name\" | \"type\">): JsonProp {\n return {\n name,\n type: \"json\",\n ...option,\n };\n}\nfunction uuid(name: string, option: Omit<UuidProp, \"name\" | \"type\">): UuidProp {\n return {\n name,\n type: \"uuid\",\n ...option,\n };\n}\nfunction enums(\n name: string,\n option: Omit<EnumProp, \"name\" | \"type\" | \"id\"> & { id?: string }\n): EnumProp {\n return {\n name,\n type: \"enum\",\n id: option.id ?? `$Model${inflection.camelize(name)}`,\n ...option,\n };\n}\nfunction virtual(\n name: string,\n option: Omit<VirtualProp, \"name\" | \"type\" | \"dbDefault\" | \"toFilter\">\n): VirtualProp {\n return {\n name,\n type: \"virtual\",\n ...option,\n };\n}\nfunction relationOneToOne(\n name: string,\n option: DistributiveOmit<\n OneToOneRelationProp,\n \"name\" | \"type\" | \"relationType\"\n >\n): OneToOneRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"OneToOne\",\n ...option,\n };\n}\nfunction relationBelongsToOne(\n name: string,\n option: Omit<BelongsToOneRelationProp, \"name\" | \"type\" | \"relationType\">\n): BelongsToOneRelationProp {\n option.useConstraint = (option.useConstraint ?? true) as false;\n return {\n name,\n type: \"relation\",\n relationType: \"BelongsToOne\",\n ...option,\n };\n}\nfunction relationHasMany(\n name: string,\n option: Omit<HasManyRelationProp, \"name\" | \"type\" | \"relationType\">\n): HasManyRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"HasMany\",\n ...option,\n };\n}\nfunction relationManyToMany(\n name: string,\n option: Omit<ManyToManyRelationProp, \"name\" | \"type\" | \"relationType\">\n): ManyToManyRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"ManyToMany\",\n ...option,\n };\n}\n\nexport const i = {\n index,\n unique,\n};\n\nfunction index(columns: string | string[]): EntityIndex {\n return {\n type: \"index\",\n columns: asArray(columns),\n };\n}\n\nfunction unique(columns: string | string[]): EntityIndex {\n return {\n type: \"unique\",\n columns: asArray(columns),\n };\n}\n"]}
package/dist/index.mjs CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  FixtureManager,
3
3
  FixtureManagerClass,
4
4
  Migrator
5
- } from "./chunk-FKZK27YL.mjs";
5
+ } from "./chunk-C3IPIF6O.mjs";
6
6
  import {
7
7
  UpsertBuilder,
8
8
  isRefField
9
- } from "./chunk-NPLUHS5L.mjs";
9
+ } from "./chunk-JKSOJRQA.mjs";
10
10
  import {
11
11
  AlreadyProcessedException,
12
12
  ApiParamType,
@@ -34,6 +34,7 @@ import {
34
34
  UnauthorizedException,
35
35
  api,
36
36
  apiParamToTsCode,
37
+ apiParamToTsCodeAsObject,
37
38
  apiParamTypeToTsType,
38
39
  asArray,
39
40
  findApiRootPath,
@@ -84,11 +85,12 @@ import {
84
85
  propToZodTypeDef,
85
86
  registeredApis,
86
87
  serializeZodType,
88
+ stream,
87
89
  unwrapPromiseOnce,
88
90
  zArrayable,
89
91
  zodTypeToTsTypeDef,
90
92
  zodTypeToZodCode
91
- } from "./chunk-LNZTU4JC.mjs";
93
+ } from "./chunk-FCERKIIF.mjs";
92
94
  import "./chunk-PTFDTOJU.mjs";
93
95
 
94
96
  // src/api/base-frame.ts
@@ -369,6 +371,7 @@ export {
369
371
  UpsertBuilder,
370
372
  api,
371
373
  apiParamToTsCode,
374
+ apiParamToTsCodeAsObject,
372
375
  apiParamTypeToTsType,
373
376
  asArray,
374
377
  findApiRootPath,
@@ -423,6 +426,7 @@ export {
423
426
  registeredApis,
424
427
  serializeZodType,
425
428
  setupErrorHandler,
429
+ stream,
426
430
  unwrapPromiseOnce,
427
431
  zArrayable,
428
432
  zodTypeToTsTypeDef,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/base-frame.ts","../src/exceptions/error-handler.ts","../src/entity/entity-utils.ts"],"sourcesContent":["import { Knex } from \"knex\";\nimport { DB } from \"../database/db\";\nimport { DBPreset } from \"../database/types\";\nimport { UpsertBuilder } from \"../database/upsert-builder\";\n\nexport abstract class BaseFrameClass {\n getDB(which: DBPreset): Knex {\n return DB.getDB(which) as Knex;\n }\n\n getUpsertBuilder() {\n return new UpsertBuilder<\"knex\">();\n }\n}\n","import { FastifyInstance } from \"fastify\";\nimport { ZodIssue } from \"zod\";\nimport { isSoException } from \"./so-exceptions\";\n\nexport function setupErrorHandler(server: FastifyInstance) {\n server.setErrorHandler((error, request, reply) => {\n error.statusCode ??= 400;\n\n if (isSoException(error) && error.payload && Array.isArray(error.payload)) {\n const issues = error.payload as ZodIssue[];\n const [issue] = issues;\n const message = `${issue.message} (${issue.path.join(\"/\")})`;\n\n request.log.error(`${error.statusCode} ${message}`);\n reply.status(error.statusCode <= 501 ? error.statusCode : 501).send({\n name: error.name,\n code: error.code,\n message: message,\n validationErrors: error.validation,\n issues,\n });\n } else {\n request.log.error(`${error.statusCode} ${error.message}`);\n reply.status(error.statusCode <= 501 ? error.statusCode : 501).send({\n name: error.name,\n code: error.code,\n message: error.message,\n validationErrors: error.validation,\n });\n }\n });\n}\n","import inflection from \"inflection\";\nimport {\n BelongsToOneRelationProp,\n BigIntegerProp,\n BooleanProp,\n DateProp,\n DateTimeProp,\n DecimalProp,\n DistributiveOmit,\n DoubleProp,\n EnumProp,\n FloatProp,\n HasManyRelationProp,\n IntegerProp,\n JsonProp,\n ManyToManyRelationProp,\n OneToOneRelationProp,\n EntityIndex,\n StringProp,\n TextProp,\n TimeProp,\n TimestampProp,\n UuidProp,\n VirtualProp,\n} from \"../types/types\";\nimport { asArray } from \"../utils/model\";\n\nexport const p = {\n integer,\n bigInteger,\n text,\n string,\n float,\n double,\n decimal,\n boolean,\n date,\n dateTime,\n time,\n timestamp,\n json,\n uuid,\n enums,\n virtual,\n relationOneToOne,\n relationBelongsToOne,\n relationHasMany,\n relationManyToMany,\n};\n\nfunction integer(\n name: string,\n option?: Omit<IntegerProp, \"name\" | \"type\">\n): IntegerProp {\n return {\n name,\n type: \"integer\",\n ...option,\n };\n}\nfunction bigInteger(\n name: string,\n option?: Omit<BigIntegerProp, \"name\" | \"type\">\n): BigIntegerProp {\n return {\n name,\n type: \"bigInteger\",\n ...option,\n };\n}\nfunction text(name: string, option: Omit<TextProp, \"name\" | \"type\">): TextProp {\n return {\n name,\n type: \"text\",\n ...option,\n };\n}\nfunction string(\n name: string,\n option: Omit<StringProp, \"name\" | \"type\">\n): StringProp {\n return {\n name,\n type: \"string\",\n ...option,\n };\n}\nfunction float(\n name: string,\n option?: Omit<FloatProp, \"name\" | \"type\">\n): FloatProp {\n return {\n name,\n type: \"float\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction double(\n name: string,\n option?: Omit<DoubleProp, \"name\" | \"type\">\n): DoubleProp {\n return {\n name,\n type: \"double\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction decimal(\n name: string,\n option?: Omit<DecimalProp, \"name\" | \"type\">\n): DecimalProp {\n return {\n name,\n type: \"decimal\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction boolean(\n name: string,\n option?: Omit<BooleanProp, \"name\" | \"type\">\n): BooleanProp {\n return {\n name,\n type: \"boolean\",\n ...option,\n };\n}\nfunction date(\n name: string,\n option?: Omit<DateProp, \"name\" | \"type\"> & { now?: true }\n): DateProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"date\",\n ...option,\n };\n}\nfunction dateTime(\n name: string,\n option?: Omit<DateTimeProp, \"name\" | \"type\"> & { now?: true }\n): DateTimeProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"datetime\",\n ...option,\n };\n}\nfunction time(\n name: string,\n option?: Omit<TimeProp, \"name\" | \"type\"> & { now?: true }\n): TimeProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"time\",\n ...option,\n };\n}\nfunction timestamp(\n name: string,\n option?: Omit<TimestampProp, \"name\" | \"type\"> & { now?: true }\n): TimestampProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"timestamp\",\n ...option,\n };\n}\nfunction json(name: string, option: Omit<JsonProp, \"name\" | \"type\">): JsonProp {\n return {\n name,\n type: \"json\",\n ...option,\n };\n}\nfunction uuid(name: string, option: Omit<UuidProp, \"name\" | \"type\">): UuidProp {\n return {\n name,\n type: \"uuid\",\n ...option,\n };\n}\nfunction enums(\n name: string,\n option: Omit<EnumProp, \"name\" | \"type\" | \"id\"> & { id?: string }\n): EnumProp {\n return {\n name,\n type: \"enum\",\n id: option.id ?? `$Model${inflection.camelize(name)}`,\n ...option,\n };\n}\nfunction virtual(\n name: string,\n option: Omit<VirtualProp, \"name\" | \"type\" | \"dbDefault\" | \"toFilter\">\n): VirtualProp {\n return {\n name,\n type: \"virtual\",\n ...option,\n };\n}\nfunction relationOneToOne(\n name: string,\n option: DistributiveOmit<\n OneToOneRelationProp,\n \"name\" | \"type\" | \"relationType\"\n >\n): OneToOneRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"OneToOne\",\n ...option,\n };\n}\nfunction relationBelongsToOne(\n name: string,\n option: Omit<BelongsToOneRelationProp, \"name\" | \"type\" | \"relationType\">\n): BelongsToOneRelationProp {\n option.useConstraint = (option.useConstraint ?? true) as false;\n return {\n name,\n type: \"relation\",\n relationType: \"BelongsToOne\",\n ...option,\n };\n}\nfunction relationHasMany(\n name: string,\n option: Omit<HasManyRelationProp, \"name\" | \"type\" | \"relationType\">\n): HasManyRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"HasMany\",\n ...option,\n };\n}\nfunction relationManyToMany(\n name: string,\n option: Omit<ManyToManyRelationProp, \"name\" | \"type\" | \"relationType\">\n): ManyToManyRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"ManyToMany\",\n ...option,\n };\n}\n\nexport const i = {\n index,\n unique,\n};\n\nfunction index(columns: string | string[]): EntityIndex {\n return {\n type: \"index\",\n columns: asArray(columns),\n };\n}\n\nfunction unique(columns: string | string[]): EntityIndex {\n return {\n type: \"unique\",\n columns: asArray(columns),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAe,iBAAf,MAA8B;AAAA,EACnC,MAAM,OAAuB;AAC3B,WAAO,GAAG,MAAM,KAAK;AAAA,EACvB;AAAA,EAEA,mBAAmB;AACjB,WAAO,IAAI,cAAsB;AAAA,EACnC;AACF;;;ACTO,SAAS,kBAAkB,QAAyB;AACzD,SAAO,gBAAgB,CAAC,OAAO,SAAS,UAAU;AAChD,UAAM,eAAe;AAErB,QAAI,cAAc,KAAK,KAAK,MAAM,WAAW,MAAM,QAAQ,MAAM,OAAO,GAAG;AACzE,YAAM,SAAS,MAAM;AACrB,YAAM,CAAC,KAAK,IAAI;AAChB,YAAM,UAAU,GAAG,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mD;AAC7E,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,KAAK,MAAc,QAAmD;AAC7E,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,MACP,MACA,QACU;AACV,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,IAAI,OAAO,MAAM,SAAS,WAAW,SAAS,IAAI,CAAC;AAAA,IACnD,GAAG;AAAA,EACL;AACF;AACA,SAAS,QACP,MACA,QACa;AACb,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AACF;AACA,SAAS,iBACP,MACA,QAIsB;AACtB,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AACA,SAAS,qBACP,MACA,QAC0B;AAC1B,SAAO,gBAAiB,OAAO,iBAAiB;AAChD,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AACA,SAAS,gBACP,MACA,QACqB;AACrB,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AACA,SAAS,mBACP,MACA,QACwB;AACxB,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AACF;AAEO,IAAM,IAAI;AAAA,EACf;AAAA,EACA;AACF;AAEA,SAAS,MAAM,SAAyC;AACtD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,QAAQ,OAAO;AAAA,EAC1B;AACF;AAEA,SAAS,OAAO,SAAyC;AACvD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,QAAQ,OAAO;AAAA,EAC1B;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/api/base-frame.ts","../src/exceptions/error-handler.ts","../src/entity/entity-utils.ts"],"sourcesContent":["import { Knex } from \"knex\";\nimport { DB } from \"../database/db\";\nimport { DBPreset } from \"../database/types\";\nimport { UpsertBuilder } from \"../database/upsert-builder\";\n\nexport abstract class BaseFrameClass {\n getDB(which: DBPreset): Knex {\n return DB.getDB(which) as Knex;\n }\n\n getUpsertBuilder() {\n return new UpsertBuilder<\"knex\">();\n }\n}\n","import { FastifyInstance } from \"fastify\";\nimport { ZodIssue } from \"zod\";\nimport { isSoException } from \"./so-exceptions\";\n\nexport function setupErrorHandler(server: FastifyInstance) {\n server.setErrorHandler((error, request, reply) => {\n error.statusCode ??= 400;\n\n if (isSoException(error) && error.payload && Array.isArray(error.payload)) {\n const issues = error.payload as ZodIssue[];\n const [issue] = issues;\n const message = `${issue.message} (${issue.path.join(\"/\")})`;\n\n request.log.error(`${error.statusCode} ${message}`);\n reply.status(error.statusCode <= 501 ? error.statusCode : 501).send({\n name: error.name,\n code: error.code,\n message: message,\n validationErrors: error.validation,\n issues,\n });\n } else {\n request.log.error(`${error.statusCode} ${error.message}`);\n reply.status(error.statusCode <= 501 ? error.statusCode : 501).send({\n name: error.name,\n code: error.code,\n message: error.message,\n validationErrors: error.validation,\n });\n }\n });\n}\n","import inflection from \"inflection\";\nimport {\n BelongsToOneRelationProp,\n BigIntegerProp,\n BooleanProp,\n DateProp,\n DateTimeProp,\n DecimalProp,\n DistributiveOmit,\n DoubleProp,\n EnumProp,\n FloatProp,\n HasManyRelationProp,\n IntegerProp,\n JsonProp,\n ManyToManyRelationProp,\n OneToOneRelationProp,\n EntityIndex,\n StringProp,\n TextProp,\n TimeProp,\n TimestampProp,\n UuidProp,\n VirtualProp,\n} from \"../types/types\";\nimport { asArray } from \"../utils/model\";\n\nexport const p = {\n integer,\n bigInteger,\n text,\n string,\n float,\n double,\n decimal,\n boolean,\n date,\n dateTime,\n time,\n timestamp,\n json,\n uuid,\n enums,\n virtual,\n relationOneToOne,\n relationBelongsToOne,\n relationHasMany,\n relationManyToMany,\n};\n\nfunction integer(\n name: string,\n option?: Omit<IntegerProp, \"name\" | \"type\">\n): IntegerProp {\n return {\n name,\n type: \"integer\",\n ...option,\n };\n}\nfunction bigInteger(\n name: string,\n option?: Omit<BigIntegerProp, \"name\" | \"type\">\n): BigIntegerProp {\n return {\n name,\n type: \"bigInteger\",\n ...option,\n };\n}\nfunction text(name: string, option: Omit<TextProp, \"name\" | \"type\">): TextProp {\n return {\n name,\n type: \"text\",\n ...option,\n };\n}\nfunction string(\n name: string,\n option: Omit<StringProp, \"name\" | \"type\">\n): StringProp {\n return {\n name,\n type: \"string\",\n ...option,\n };\n}\nfunction float(\n name: string,\n option?: Omit<FloatProp, \"name\" | \"type\">\n): FloatProp {\n return {\n name,\n type: \"float\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction double(\n name: string,\n option?: Omit<DoubleProp, \"name\" | \"type\">\n): DoubleProp {\n return {\n name,\n type: \"double\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction decimal(\n name: string,\n option?: Omit<DecimalProp, \"name\" | \"type\">\n): DecimalProp {\n return {\n name,\n type: \"decimal\",\n precision: 8,\n scale: 2,\n ...option,\n };\n}\nfunction boolean(\n name: string,\n option?: Omit<BooleanProp, \"name\" | \"type\">\n): BooleanProp {\n return {\n name,\n type: \"boolean\",\n ...option,\n };\n}\nfunction date(\n name: string,\n option?: Omit<DateProp, \"name\" | \"type\"> & { now?: true }\n): DateProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"date\",\n ...option,\n };\n}\nfunction dateTime(\n name: string,\n option?: Omit<DateTimeProp, \"name\" | \"type\"> & { now?: true }\n): DateTimeProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"datetime\",\n ...option,\n };\n}\nfunction time(\n name: string,\n option?: Omit<TimeProp, \"name\" | \"type\"> & { now?: true }\n): TimeProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"time\",\n ...option,\n };\n}\nfunction timestamp(\n name: string,\n option?: Omit<TimestampProp, \"name\" | \"type\"> & { now?: true }\n): TimestampProp {\n if (option?.now === true) {\n delete option.now;\n option.dbDefault = \"CURRENT_TIMESTAMP\";\n }\n return {\n name,\n type: \"timestamp\",\n ...option,\n };\n}\nfunction json(name: string, option: Omit<JsonProp, \"name\" | \"type\">): JsonProp {\n return {\n name,\n type: \"json\",\n ...option,\n };\n}\nfunction uuid(name: string, option: Omit<UuidProp, \"name\" | \"type\">): UuidProp {\n return {\n name,\n type: \"uuid\",\n ...option,\n };\n}\nfunction enums(\n name: string,\n option: Omit<EnumProp, \"name\" | \"type\" | \"id\"> & { id?: string }\n): EnumProp {\n return {\n name,\n type: \"enum\",\n id: option.id ?? `$Model${inflection.camelize(name)}`,\n ...option,\n };\n}\nfunction virtual(\n name: string,\n option: Omit<VirtualProp, \"name\" | \"type\" | \"dbDefault\" | \"toFilter\">\n): VirtualProp {\n return {\n name,\n type: \"virtual\",\n ...option,\n };\n}\nfunction relationOneToOne(\n name: string,\n option: DistributiveOmit<\n OneToOneRelationProp,\n \"name\" | \"type\" | \"relationType\"\n >\n): OneToOneRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"OneToOne\",\n ...option,\n };\n}\nfunction relationBelongsToOne(\n name: string,\n option: Omit<BelongsToOneRelationProp, \"name\" | \"type\" | \"relationType\">\n): BelongsToOneRelationProp {\n option.useConstraint = (option.useConstraint ?? true) as false;\n return {\n name,\n type: \"relation\",\n relationType: \"BelongsToOne\",\n ...option,\n };\n}\nfunction relationHasMany(\n name: string,\n option: Omit<HasManyRelationProp, \"name\" | \"type\" | \"relationType\">\n): HasManyRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"HasMany\",\n ...option,\n };\n}\nfunction relationManyToMany(\n name: string,\n option: Omit<ManyToManyRelationProp, \"name\" | \"type\" | \"relationType\">\n): ManyToManyRelationProp {\n return {\n name,\n type: \"relation\",\n relationType: \"ManyToMany\",\n ...option,\n };\n}\n\nexport const i = {\n index,\n unique,\n};\n\nfunction index(columns: string | string[]): EntityIndex {\n return {\n type: \"index\",\n columns: asArray(columns),\n };\n}\n\nfunction unique(columns: string | string[]): EntityIndex {\n return {\n type: \"unique\",\n columns: asArray(columns),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAe,iBAAf,MAA8B;AAAA,EACnC,MAAM,OAAuB;AAC3B,WAAO,GAAG,MAAM,KAAK;AAAA,EACvB;AAAA,EAEA,mBAAmB;AACjB,WAAO,IAAI,cAAsB;AAAA,EACnC;AACF;;;ACTO,SAAS,kBAAkB,QAAyB;AACzD,SAAO,gBAAgB,CAAC,OAAO,SAAS,UAAU;AAChD,UAAM,eAAe;AAErB,QAAI,cAAc,KAAK,KAAK,MAAM,WAAW,MAAM,QAAQ,MAAM,OAAO,GAAG;AACzE,YAAM,SAAS,MAAM;AACrB,YAAM,CAAC,KAAK,IAAI;AAChB,YAAM,UAAU,GAAG,MAAM,OAAO,KAAK,MAAM,KAAK,KAAK,GAAG,CAAC;AAEzD,cAAQ,IAAI,MAAM,GAAG,MAAM,UAAU,IAAI,OAAO,EAAE;AAClD,YAAM,OAAO,MAAM,cAAc,MAAM,MAAM,aAAa,GAAG,EAAE,KAAK;AAAA,QAClE,MAAM,MAAM;AAAA,QACZ,MAAM,MAAM;AAAA,QACZ;AAAA,QACA,kBAAkB,MAAM;AAAA,QACxB;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,cAAQ,IAAI,MAAM,GAAG,MAAM,UAAU,IAAI,MAAM,OAAO,EAAE;AACxD,YAAM,OAAO,MAAM,cAAc,MAAM,MAAM,aAAa,GAAG,EAAE,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