sonamu 0.4.14 → 0.5.1
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/.swcrc +15 -0
- package/dist/api/base-frame.d.ts +8 -0
- package/dist/api/base-frame.d.ts.map +1 -0
- package/dist/api/base-frame.js +2 -0
- package/dist/api/base-frame.js.map +1 -0
- package/dist/api/caster.d.ts +5 -0
- package/dist/api/caster.d.ts.map +1 -0
- package/dist/api/caster.js +2 -0
- package/dist/api/caster.js.map +1 -0
- package/dist/api/code-converters.d.ts +23 -0
- package/dist/api/code-converters.d.ts.map +1 -0
- package/dist/api/code-converters.js +2 -0
- package/dist/api/code-converters.js.map +1 -0
- package/dist/api/context.d.ts +19 -0
- package/dist/api/context.d.ts.map +1 -0
- package/dist/api/context.js +2 -0
- package/dist/api/context.js.map +1 -0
- package/dist/api/decorators.d.ts +50 -0
- package/dist/api/decorators.d.ts.map +1 -0
- package/dist/api/decorators.js +2 -0
- package/dist/api/decorators.js.map +1 -0
- package/dist/api/index.d.ts +8 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/sonamu.d.ts +84 -0
- package/dist/api/sonamu.d.ts.map +1 -0
- package/dist/api/sonamu.js +2 -0
- package/dist/api/sonamu.js.map +1 -0
- package/dist/bin/build-config.d.ts +9 -0
- package/dist/bin/build-config.d.ts.map +1 -0
- package/dist/bin/build-config.js +2 -0
- package/dist/bin/build-config.js.map +1 -0
- package/dist/bin/cli-wrapper.d.ts +2 -0
- package/dist/bin/cli-wrapper.d.ts.map +1 -0
- package/dist/bin/cli-wrapper.js +1 -38
- package/dist/bin/cli-wrapper.js.map +1 -1
- package/dist/bin/cli.d.ts +2 -2
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +1 -903
- package/dist/bin/cli.js.map +1 -1
- package/dist/database/_batch_update.d.ts +15 -0
- package/dist/database/_batch_update.d.ts.map +1 -0
- package/dist/database/_batch_update.js +2 -0
- package/dist/database/_batch_update.js.map +1 -0
- package/dist/database/base-model.d.ts +48 -0
- package/dist/database/base-model.d.ts.map +1 -0
- package/dist/database/base-model.js +2 -0
- package/dist/database/base-model.js.map +1 -0
- package/dist/database/code-generator.d.ts +13 -0
- package/dist/database/code-generator.d.ts.map +1 -0
- package/dist/database/code-generator.js +2 -0
- package/dist/database/code-generator.js.map +1 -0
- package/dist/database/db.d.ts +40 -0
- package/dist/database/db.d.ts.map +1 -0
- package/dist/database/db.js +2 -0
- package/dist/database/db.js.map +1 -0
- package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts +2 -0
- package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts.map +1 -0
- package/dist/database/knex-plugins/knex-on-duplicate-update.js +2 -0
- package/dist/database/knex-plugins/knex-on-duplicate-update.js.map +1 -0
- package/dist/database/puri-wrapper.d.ts +34 -0
- package/dist/database/puri-wrapper.d.ts.map +1 -0
- package/dist/database/puri-wrapper.js +2 -0
- package/dist/database/puri-wrapper.js.map +1 -0
- package/dist/database/puri.d.ts +83 -0
- package/dist/database/puri.d.ts.map +1 -0
- package/dist/database/puri.js +2 -0
- package/dist/database/puri.js.map +1 -0
- package/dist/database/puri.types.d.ts +60 -0
- package/dist/database/puri.types.d.ts.map +1 -0
- package/dist/database/puri.types.js +2 -0
- package/dist/database/puri.types.js.map +1 -0
- package/dist/database/transaction-context.d.ts +9 -0
- package/dist/database/transaction-context.d.ts.map +1 -0
- package/dist/database/transaction-context.js +2 -0
- package/dist/database/transaction-context.js.map +1 -0
- package/dist/database/upsert-builder.d.ts +34 -0
- package/dist/database/upsert-builder.d.ts.map +1 -0
- package/dist/database/upsert-builder.js +2 -0
- package/dist/database/upsert-builder.js.map +1 -0
- package/dist/entity/entity-manager.d.ts +32 -0
- package/dist/entity/entity-manager.d.ts.map +1 -0
- package/dist/entity/entity-manager.js +2 -0
- package/dist/entity/entity-manager.js.map +1 -0
- package/dist/entity/entity-utils.d.ts +61 -0
- package/dist/entity/entity-utils.d.ts.map +1 -0
- package/dist/entity/entity-utils.js +2 -0
- package/dist/entity/entity-utils.js.map +1 -0
- package/dist/entity/entity.d.ts +62 -0
- package/dist/entity/entity.d.ts.map +1 -0
- package/dist/entity/entity.js +2 -0
- package/dist/entity/entity.js.map +1 -0
- package/dist/entity/migrator.d.ts +135 -0
- package/dist/entity/migrator.d.ts.map +1 -0
- package/dist/entity/migrator.js +2 -0
- package/dist/entity/migrator.js.map +1 -0
- package/dist/exceptions/error-handler.d.ts +3 -0
- package/dist/exceptions/error-handler.d.ts.map +1 -0
- package/dist/exceptions/error-handler.js +2 -0
- package/dist/exceptions/error-handler.js.map +1 -0
- package/dist/exceptions/so-exceptions.d.ts +48 -0
- package/dist/exceptions/so-exceptions.d.ts.map +1 -0
- package/dist/exceptions/so-exceptions.js +2 -0
- package/dist/exceptions/so-exceptions.js.map +1 -0
- package/dist/file-storage/driver.d.ts +48 -0
- package/dist/file-storage/driver.d.ts.map +1 -0
- package/dist/file-storage/driver.js +2 -0
- package/dist/file-storage/driver.js.map +1 -0
- package/dist/file-storage/file-storage.d.ts +50 -0
- package/dist/file-storage/file-storage.d.ts.map +1 -0
- package/dist/file-storage/file-storage.js +2 -0
- package/dist/file-storage/file-storage.js.map +1 -0
- package/dist/index.d.ts +23 -813
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -433
- package/dist/index.js.map +1 -1
- package/dist/migration/code-generation.d.ts +15 -0
- package/dist/migration/code-generation.d.ts.map +1 -0
- package/dist/migration/code-generation.js +2 -0
- package/dist/migration/code-generation.js.map +1 -0
- package/dist/migration/migration-set.d.ts +17 -0
- package/dist/migration/migration-set.d.ts.map +1 -0
- package/dist/migration/migration-set.js +2 -0
- package/dist/migration/migration-set.js.map +1 -0
- package/dist/migration/migrator.d.ts +130 -0
- package/dist/migration/migrator.d.ts.map +1 -0
- package/dist/migration/migrator.js +2 -0
- package/dist/migration/migrator.js.map +1 -0
- package/dist/migration/types.d.ts +52 -0
- package/dist/migration/types.d.ts.map +1 -0
- package/dist/migration/types.js +2 -0
- package/dist/migration/types.js.map +1 -0
- package/dist/stream/index.d.ts +2 -0
- package/dist/stream/index.d.ts.map +1 -0
- package/dist/stream/index.js +2 -0
- package/dist/stream/index.js.map +1 -0
- package/dist/stream/sse.d.ts +13 -0
- package/dist/stream/sse.d.ts.map +1 -0
- package/dist/stream/sse.js +2 -0
- package/dist/stream/sse.js.map +1 -0
- package/dist/syncer/index.d.ts +2 -0
- package/dist/syncer/index.d.ts.map +1 -0
- package/dist/syncer/index.js +2 -0
- package/dist/syncer/index.js.map +1 -0
- package/dist/syncer/syncer.d.ts +127 -0
- package/dist/syncer/syncer.d.ts.map +1 -0
- package/dist/syncer/syncer.js +2 -0
- package/dist/syncer/syncer.js.map +1 -0
- package/dist/templates/base-template.d.ts +13 -0
- package/dist/templates/base-template.d.ts.map +1 -0
- package/dist/templates/base-template.js +2 -0
- package/dist/templates/base-template.js.map +1 -0
- package/dist/templates/entity.template.d.ts +17 -0
- package/dist/templates/entity.template.d.ts.map +1 -0
- package/dist/templates/entity.template.js +2 -0
- package/dist/templates/entity.template.js.map +1 -0
- package/dist/templates/generated.template.d.ts +27 -0
- package/dist/templates/generated.template.d.ts.map +1 -0
- package/dist/templates/generated.template.js +2 -0
- package/dist/templates/generated.template.js.map +1 -0
- package/dist/templates/generated_http.template.d.ts +24 -0
- package/dist/templates/generated_http.template.d.ts.map +1 -0
- package/dist/templates/generated_http.template.js +2 -0
- package/dist/templates/generated_http.template.js.map +1 -0
- package/dist/templates/generated_sso.template.d.ts +20 -0
- package/dist/templates/generated_sso.template.d.ts.map +1 -0
- package/dist/templates/generated_sso.template.js +2 -0
- package/dist/templates/generated_sso.template.js.map +1 -0
- package/dist/templates/index.d.ts +2 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +2 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/init_types.template.d.ts +17 -0
- package/dist/templates/init_types.template.d.ts.map +1 -0
- package/dist/templates/init_types.template.js +2 -0
- package/dist/templates/init_types.template.js.map +1 -0
- package/dist/templates/model.template.d.ts +17 -0
- package/dist/templates/model.template.d.ts.map +1 -0
- package/dist/templates/model.template.js +2 -0
- package/dist/templates/model.template.js.map +1 -0
- package/dist/templates/model_test.template.d.ts +17 -0
- package/dist/templates/model_test.template.d.ts.map +1 -0
- package/dist/templates/model_test.template.js +2 -0
- package/dist/templates/model_test.template.js.map +1 -0
- package/dist/templates/service.template.d.ts +29 -0
- package/dist/templates/service.template.d.ts.map +1 -0
- package/dist/templates/service.template.js +2 -0
- package/dist/templates/service.template.js.map +1 -0
- package/dist/templates/view_enums_buttonset.template.d.ts +17 -0
- package/dist/templates/view_enums_buttonset.template.d.ts.map +1 -0
- package/dist/templates/view_enums_buttonset.template.js +2 -0
- package/dist/templates/view_enums_buttonset.template.js.map +1 -0
- package/dist/templates/view_enums_dropdown.template.d.ts +18 -0
- package/dist/templates/view_enums_dropdown.template.d.ts.map +1 -0
- package/dist/templates/view_enums_dropdown.template.js +2 -0
- package/dist/templates/view_enums_dropdown.template.js.map +1 -0
- package/dist/templates/view_enums_select.template.d.ts +17 -0
- package/dist/templates/view_enums_select.template.d.ts.map +1 -0
- package/dist/templates/view_enums_select.template.js +2 -0
- package/dist/templates/view_enums_select.template.js.map +1 -0
- package/dist/templates/view_form.template.d.ts +26 -0
- package/dist/templates/view_form.template.d.ts.map +1 -0
- package/dist/templates/view_form.template.js +2 -0
- package/dist/templates/view_form.template.js.map +1 -0
- package/dist/templates/view_id_all_select.template.d.ts +17 -0
- package/dist/templates/view_id_all_select.template.d.ts.map +1 -0
- package/dist/templates/view_id_all_select.template.js +2 -0
- package/dist/templates/view_id_all_select.template.js.map +1 -0
- package/dist/templates/view_id_async_select.template.d.ts +17 -0
- package/dist/templates/view_id_async_select.template.d.ts.map +1 -0
- package/dist/templates/view_id_async_select.template.js +2 -0
- package/dist/templates/view_id_async_select.template.js.map +1 -0
- package/dist/templates/view_list.template.d.ts +38 -0
- package/dist/templates/view_list.template.d.ts.map +1 -0
- package/dist/templates/view_list.template.js +2 -0
- package/dist/templates/view_list.template.js.map +1 -0
- package/dist/templates/view_list_columns.template.d.ts +17 -0
- package/dist/templates/view_list_columns.template.d.ts.map +1 -0
- package/dist/templates/view_list_columns.template.js +2 -0
- package/dist/templates/view_list_columns.template.js.map +1 -0
- package/dist/templates/view_search_input.template.d.ts +17 -0
- package/dist/templates/view_search_input.template.d.ts.map +1 -0
- package/dist/templates/view_search_input.template.js +2 -0
- package/dist/templates/view_search_input.template.js.map +1 -0
- package/dist/testing/_relation-graph.d.ts +7 -0
- package/dist/testing/_relation-graph.d.ts.map +1 -0
- package/dist/testing/_relation-graph.js +2 -0
- package/dist/testing/_relation-graph.js.map +1 -0
- package/dist/testing/fixture-manager.d.ts +35 -0
- package/dist/testing/fixture-manager.d.ts.map +1 -0
- package/dist/testing/fixture-manager.js +2 -0
- package/dist/testing/fixture-manager.js.map +1 -0
- package/dist/types/types.d.ts +611 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +2 -0
- package/dist/types/types.js.map +1 -0
- package/dist/typings/knex.d.js +2 -0
- package/dist/typings/knex.d.js.map +1 -0
- package/dist/utils/async-utils.d.ts +25 -0
- package/dist/utils/async-utils.d.ts.map +1 -0
- package/dist/utils/async-utils.js +2 -0
- package/dist/utils/async-utils.js.map +1 -0
- package/dist/utils/controller.d.ts +9 -0
- package/dist/utils/controller.d.ts.map +1 -0
- package/dist/utils/controller.js +2 -0
- package/dist/utils/controller.js.map +1 -0
- package/dist/utils/fs-utils.d.ts +9 -0
- package/dist/utils/fs-utils.d.ts.map +1 -0
- package/dist/utils/fs-utils.js +2 -0
- package/dist/utils/fs-utils.js.map +1 -0
- package/dist/utils/lodash-able.d.ts +2 -0
- package/dist/utils/lodash-able.d.ts.map +1 -0
- package/dist/utils/lodash-able.js +2 -0
- package/dist/utils/lodash-able.js.map +1 -0
- package/dist/utils/model.d.ts +17 -0
- package/dist/utils/model.d.ts.map +1 -0
- package/dist/utils/model.js +2 -0
- package/dist/utils/model.js.map +1 -0
- package/dist/utils/sql-parser.d.ts +4 -0
- package/dist/utils/sql-parser.d.ts.map +1 -0
- package/dist/utils/sql-parser.js +2 -0
- package/dist/utils/sql-parser.js.map +1 -0
- package/dist/utils/utils.d.ts +9 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +2 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/utils/zod-error.d.ts +8 -0
- package/dist/utils/zod-error.d.ts.map +1 -0
- package/dist/utils/zod-error.js +2 -0
- package/dist/utils/zod-error.js.map +1 -0
- package/nodemon.json +6 -0
- package/package.json +32 -45
- package/src/api/base-frame.ts +3 -4
- package/src/api/caster.ts +22 -23
- package/src/api/code-converters.ts +170 -134
- package/src/api/context.ts +15 -3
- package/src/api/decorators.ts +144 -20
- package/src/api/index.ts +2 -0
- package/src/api/sonamu.ts +408 -165
- package/src/bin/build-config.ts +10 -0
- package/src/bin/cli-wrapper.ts +35 -32
- package/src/bin/cli.ts +141 -204
- package/src/database/_batch_update.ts +10 -15
- package/src/database/base-model.ts +326 -216
- package/src/database/db.ts +191 -21
- package/src/database/{drivers/knex/plugins → knex-plugins}/knex-on-duplicate-update.ts +1 -1
- package/src/database/puri-wrapper.ts +129 -0
- package/src/database/puri.ts +808 -0
- package/src/database/puri.types.ts +222 -0
- package/src/database/transaction-context.ts +18 -0
- package/src/database/upsert-builder.ts +32 -35
- package/src/entity/entity-manager.ts +7 -15
- package/src/entity/entity.ts +9 -31
- package/src/entity/migrator-/354/235/264/354/202/254/352/260/224/354/226/264/354/232/224.md +1 -0
- package/src/file-storage/driver.ts +131 -0
- package/src/file-storage/file-storage.ts +100 -0
- package/src/index.ts +15 -11
- package/src/migration/code-generation.ts +777 -0
- package/src/migration/migration-set.ts +453 -0
- package/src/migration/migrator.ts +823 -0
- package/src/migration/types.ts +53 -0
- package/src/shared/web.shared.ts.txt +33 -2
- package/src/stream/index.ts +1 -0
- package/src/stream/sse.ts +49 -0
- package/src/syncer/syncer.ts +294 -127
- package/src/templates/generated.template.ts +13 -1
- package/src/templates/generated_http.template.ts +15 -12
- package/src/templates/generated_sso.template.ts +50 -2
- package/src/templates/model.template.ts +138 -2
- package/src/templates/service.template.ts +0 -1
- package/src/templates/view_form.template.ts +11 -7
- package/src/templates/view_list.template.ts +12 -4
- package/src/testing/fixture-manager.ts +229 -174
- package/src/types/types.ts +108 -14
- package/src/utils/async-utils.ts +64 -0
- package/src/utils/fs-utils.ts +17 -0
- package/src/utils/model.ts +0 -2
- package/src/utils/utils.ts +14 -58
- package/src/utils/zod-error.ts +12 -176
- package/tsconfig.json +6 -0
- package/tsup.config.js +4 -2
- package/.pnp.cjs +0 -14363
- package/.pnp.loader.mjs +0 -2047
- package/.vscode/extensions.json +0 -6
- package/.vscode/settings.json +0 -9
- package/.yarnrc.yml +0 -5
- package/dist/base-model-CEB0H0aO.d.mts +0 -43
- package/dist/base-model-CrqDMYhI.d.ts +0 -43
- package/dist/bin/cli-wrapper.d.mts +0 -1
- package/dist/bin/cli-wrapper.mjs +0 -43
- package/dist/bin/cli-wrapper.mjs.map +0 -1
- package/dist/bin/cli.d.mts +0 -2
- package/dist/bin/cli.mjs +0 -907
- package/dist/bin/cli.mjs.map +0 -1
- package/dist/chunk-2WAC2GER.js +0 -7625
- package/dist/chunk-2WAC2GER.js.map +0 -1
- package/dist/chunk-C3IPIF6O.mjs +0 -1581
- package/dist/chunk-C3IPIF6O.mjs.map +0 -1
- package/dist/chunk-EXHKSVTE.js +0 -280
- package/dist/chunk-EXHKSVTE.js.map +0 -1
- package/dist/chunk-FCERKIIF.mjs +0 -7623
- package/dist/chunk-FCERKIIF.mjs.map +0 -1
- package/dist/chunk-HGIBJYOU.mjs +0 -231
- package/dist/chunk-HGIBJYOU.mjs.map +0 -1
- package/dist/chunk-JKSOJRQA.mjs +0 -280
- package/dist/chunk-JKSOJRQA.mjs.map +0 -1
- package/dist/chunk-OTKKFP3Y.js +0 -1581
- package/dist/chunk-OTKKFP3Y.js.map +0 -1
- package/dist/chunk-PTFDTOJU.mjs +0 -19
- package/dist/chunk-PTFDTOJU.mjs.map +0 -1
- package/dist/chunk-UZ2IY5VE.js +0 -231
- package/dist/chunk-UZ2IY5VE.js.map +0 -1
- package/dist/database/drivers/knex/base-model.d.mts +0 -16
- package/dist/database/drivers/knex/base-model.d.ts +0 -16
- package/dist/database/drivers/knex/base-model.js +0 -55
- package/dist/database/drivers/knex/base-model.js.map +0 -1
- package/dist/database/drivers/knex/base-model.mjs +0 -56
- package/dist/database/drivers/knex/base-model.mjs.map +0 -1
- package/dist/database/drivers/kysely/base-model.d.mts +0 -22
- package/dist/database/drivers/kysely/base-model.d.ts +0 -22
- package/dist/database/drivers/kysely/base-model.js +0 -64
- package/dist/database/drivers/kysely/base-model.js.map +0 -1
- package/dist/database/drivers/kysely/base-model.mjs +0 -65
- package/dist/database/drivers/kysely/base-model.mjs.map +0 -1
- package/dist/index.d.mts +0 -813
- package/dist/index.mjs +0 -435
- package/dist/index.mjs.map +0 -1
- package/dist/model-aFgomcdc.d.mts +0 -1112
- package/dist/model-aFgomcdc.d.ts +0 -1112
- package/src/database/base-model.abstract.ts +0 -97
- package/src/database/db.abstract.ts +0 -75
- package/src/database/drivers/knex/base-model.ts +0 -55
- package/src/database/drivers/knex/client.ts +0 -209
- package/src/database/drivers/knex/db.ts +0 -232
- package/src/database/drivers/knex/generator.ts +0 -659
- package/src/database/drivers/kysely/base-model.ts +0 -89
- package/src/database/drivers/kysely/client.ts +0 -309
- package/src/database/drivers/kysely/db.ts +0 -238
- package/src/database/drivers/kysely/generator.ts +0 -714
- package/src/database/types.ts +0 -118
- package/src/entity/migrator.ts +0 -1400
- package/src/smd/smd-manager.ts +0 -139
- package/src/smd/smd.ts +0 -571
- package/src/templates/kysely_types.template.ts +0 -205
package/src/types/types.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
import type { GuardKey } from "./../api/decorators";
|
|
2
|
+
import type { FastifyCorsOptions } from "@fastify/cors";
|
|
3
|
+
import type { FastifyFormbodyOptions } from "@fastify/formbody";
|
|
4
|
+
import type {
|
|
5
|
+
FastifyInstance,
|
|
6
|
+
FastifyReply,
|
|
7
|
+
FastifyRequest,
|
|
8
|
+
FastifyServerOptions,
|
|
9
|
+
} from "fastify";
|
|
10
|
+
import type { QsPluginOptions } from "fastify-qs";
|
|
1
11
|
import { z } from "zod";
|
|
12
|
+
import type { Context, ApiDecoratorOptions } from "../api";
|
|
13
|
+
import type { FastifyMultipartOptions } from "@fastify/multipart";
|
|
14
|
+
import type { Driver } from "../file-storage/driver";
|
|
15
|
+
import type { SsePluginOptions } from "fastify-sse-v2/lib/types";
|
|
2
16
|
|
|
3
|
-
/*
|
|
17
|
+
/*
|
|
4
18
|
Enums
|
|
5
19
|
*/
|
|
6
20
|
export type EnumsLabel<T extends string, L extends "ko" | "en"> = {
|
|
@@ -26,7 +40,7 @@ export type SQLDateTimeString = z.infer<typeof SQLDateTimeString>;
|
|
|
26
40
|
*/
|
|
27
41
|
export function zArrayable<T extends z.ZodTypeAny>(
|
|
28
42
|
shape: T
|
|
29
|
-
): z.ZodUnion<[T, z.ZodArray<T
|
|
43
|
+
): z.ZodUnion<[T, z.ZodArray<T>]> {
|
|
30
44
|
return z.union([shape, shape.array()]);
|
|
31
45
|
}
|
|
32
46
|
export type DistributiveOmit<T, K extends keyof any> = T extends any
|
|
@@ -186,9 +200,10 @@ export type EntityProp =
|
|
|
186
200
|
| RelationProp;
|
|
187
201
|
|
|
188
202
|
export type EntityIndex = {
|
|
189
|
-
type: "index" | "unique";
|
|
203
|
+
type: "index" | "unique" | "fulltext";
|
|
190
204
|
columns: string[];
|
|
191
205
|
name?: string;
|
|
206
|
+
parser?: "built-in" | "ngram";
|
|
192
207
|
};
|
|
193
208
|
export type EntityJson = {
|
|
194
209
|
id: string;
|
|
@@ -412,9 +427,6 @@ export type KnexError = {
|
|
|
412
427
|
export function isKnexError(e: any): e is KnexError {
|
|
413
428
|
return e.code && e.sqlMessage && e.sqlState;
|
|
414
429
|
}
|
|
415
|
-
export function isKyselyError(e: any): e is KnexError {
|
|
416
|
-
return e.code && e.sqlMessage && e.sqlState;
|
|
417
|
-
}
|
|
418
430
|
|
|
419
431
|
export type KnexColumnType =
|
|
420
432
|
| "string"
|
|
@@ -446,7 +458,8 @@ export type MigrationColumn = {
|
|
|
446
458
|
};
|
|
447
459
|
export type MigrationIndex = {
|
|
448
460
|
columns: string[];
|
|
449
|
-
type: "unique" | "index";
|
|
461
|
+
type: "unique" | "index" | "fulltext";
|
|
462
|
+
parser?: "built-in" | "ngram";
|
|
450
463
|
};
|
|
451
464
|
export type MigrationForeign = {
|
|
452
465
|
columns: string[];
|
|
@@ -593,11 +606,6 @@ export namespace ApiParamType {
|
|
|
593
606
|
export function isRefKnex(v: any): v is ApiParamType.Ref {
|
|
594
607
|
return v?.t === "ref" && v.id === "Knex";
|
|
595
608
|
}
|
|
596
|
-
export function isRefKysely(v: any): v is ApiParamType.Ref {
|
|
597
|
-
return (
|
|
598
|
-
v?.t === "ref" && (v.id === "Kysely" || v.id.startsWith("Transaction"))
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
609
|
export function isTypeParam(v: any): v is ApiParamType.TypeParam {
|
|
602
610
|
return v?.t === "type-param";
|
|
603
611
|
}
|
|
@@ -635,6 +643,7 @@ export type RenderingNode = {
|
|
|
635
643
|
| "string-image"
|
|
636
644
|
| "string-datetime"
|
|
637
645
|
| "string-date"
|
|
646
|
+
| "datetime"
|
|
638
647
|
| "number-plain"
|
|
639
648
|
| "number-id"
|
|
640
649
|
| "number-fk_id"
|
|
@@ -738,7 +747,6 @@ export const TemplateOptions = z.object({
|
|
|
738
747
|
entityId: z.string(),
|
|
739
748
|
enumId: z.string(),
|
|
740
749
|
}),
|
|
741
|
-
kysely_interface: z.object({}),
|
|
742
750
|
});
|
|
743
751
|
export type TemplateOptions = z.infer<typeof TemplateOptions>;
|
|
744
752
|
|
|
@@ -761,7 +769,6 @@ export const TemplateKey = z.enum([
|
|
|
761
769
|
"view_enums_select",
|
|
762
770
|
"view_enums_dropdown",
|
|
763
771
|
"view_enums_buttonset",
|
|
764
|
-
"kysely_interface",
|
|
765
772
|
]);
|
|
766
773
|
export type TemplateKey = z.infer<typeof TemplateKey>;
|
|
767
774
|
|
|
@@ -812,3 +819,90 @@ export type RelationNode = {
|
|
|
812
819
|
entityId: string;
|
|
813
820
|
related: Set<string>;
|
|
814
821
|
};
|
|
822
|
+
|
|
823
|
+
export interface DatabaseSchemaExtend {}
|
|
824
|
+
export type ManyToManyBaseSchema<
|
|
825
|
+
FromIdKey extends string,
|
|
826
|
+
ToIdKey extends string,
|
|
827
|
+
> = {
|
|
828
|
+
id: number;
|
|
829
|
+
} & {
|
|
830
|
+
[K in `${FromIdKey}_id`]: number;
|
|
831
|
+
} & {
|
|
832
|
+
[K in `${ToIdKey}_id`]: number;
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
export type SonamuFastifyConfig = {
|
|
836
|
+
contextProvider: (
|
|
837
|
+
defaultContext: Pick<
|
|
838
|
+
Context,
|
|
839
|
+
"request" | "reply" | "headers" | "createSSE"
|
|
840
|
+
>,
|
|
841
|
+
request: FastifyRequest,
|
|
842
|
+
reply: FastifyReply
|
|
843
|
+
) => Context;
|
|
844
|
+
guardHandler: (
|
|
845
|
+
guard: GuardKey,
|
|
846
|
+
request: FastifyRequest,
|
|
847
|
+
api: {
|
|
848
|
+
typeParameters: ApiParamType.TypeParam[];
|
|
849
|
+
parameters: ApiParam[];
|
|
850
|
+
returnType: ApiParamType;
|
|
851
|
+
modelName: string;
|
|
852
|
+
methodName: string;
|
|
853
|
+
path: string;
|
|
854
|
+
options: ApiDecoratorOptions;
|
|
855
|
+
}
|
|
856
|
+
) => void;
|
|
857
|
+
cache?: {
|
|
858
|
+
get: (key: string) => Promise<unknown | null>;
|
|
859
|
+
put: (key: string, value: unknown, ttl?: number) => Promise<void>;
|
|
860
|
+
resolveKey: (
|
|
861
|
+
path: string,
|
|
862
|
+
reqBody: {
|
|
863
|
+
[key: string]: unknown;
|
|
864
|
+
}
|
|
865
|
+
) =>
|
|
866
|
+
| {
|
|
867
|
+
cache: false;
|
|
868
|
+
}
|
|
869
|
+
| {
|
|
870
|
+
cache: true;
|
|
871
|
+
key: string;
|
|
872
|
+
ttl?: number;
|
|
873
|
+
};
|
|
874
|
+
};
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
export type SonamuServerOptions = {
|
|
878
|
+
fastify?: FastifyServerOptions;
|
|
879
|
+
|
|
880
|
+
listen?: {
|
|
881
|
+
port: number;
|
|
882
|
+
host?: string;
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
plugins?: {
|
|
886
|
+
cors?: boolean | FastifyCorsOptions;
|
|
887
|
+
formbody?: boolean | FastifyFormbodyOptions;
|
|
888
|
+
multipart?: boolean | FastifyMultipartOptions;
|
|
889
|
+
qs?: boolean | QsPluginOptions;
|
|
890
|
+
sse?: boolean | SsePluginOptions;
|
|
891
|
+
|
|
892
|
+
custom?: (server: FastifyInstance) => void;
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
apiConfig: SonamuFastifyConfig;
|
|
896
|
+
|
|
897
|
+
storage?: Driver;
|
|
898
|
+
|
|
899
|
+
lifecycle?: {
|
|
900
|
+
onStart?: (server: FastifyInstance) => Promise<void> | void;
|
|
901
|
+
onShutdown?: (server: FastifyInstance) => Promise<void> | void;
|
|
902
|
+
onError?: (
|
|
903
|
+
error: Error,
|
|
904
|
+
request: FastifyRequest,
|
|
905
|
+
reply: FastifyReply
|
|
906
|
+
) => Promise<void> | void;
|
|
907
|
+
};
|
|
908
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 비동기 조건으로 배열을 필터링합니다
|
|
3
|
+
* @example
|
|
4
|
+
* const filtered = await filterAsync([1, 2, 3], async (x) => x > 1);
|
|
5
|
+
*/
|
|
6
|
+
export async function filterAsync<T>(
|
|
7
|
+
arr: T[],
|
|
8
|
+
predicate: (item: T, index: number, array: T[]) => Promise<boolean>
|
|
9
|
+
): Promise<T[]> {
|
|
10
|
+
const results = await Promise.all(
|
|
11
|
+
arr.map((item, index) =>
|
|
12
|
+
predicate(item, index, arr).then((keep) => ({ item, keep }))
|
|
13
|
+
)
|
|
14
|
+
);
|
|
15
|
+
return results.filter((r) => r.keep).map((r) => r.item);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 비동기 조건이 모든 요소에 대해 참인지 확인합니다
|
|
20
|
+
* @example
|
|
21
|
+
* const allValid = await everyAsync([1, 2, 3], async (x) => x > 0);
|
|
22
|
+
*/
|
|
23
|
+
export async function everyAsync<T>(
|
|
24
|
+
arr: T[],
|
|
25
|
+
predicate: (item: T, index: number, array: T[]) => Promise<boolean>
|
|
26
|
+
): Promise<boolean> {
|
|
27
|
+
for (let i = 0; i < arr.length; i++) {
|
|
28
|
+
if (!(await predicate(arr[i], i, arr))) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 비동기 변환 함수를 배열의 각 요소에 적용합니다
|
|
37
|
+
* @example
|
|
38
|
+
* const doubled = await mapAsync([1, 2, 3], async (x) => x * 2);
|
|
39
|
+
*/
|
|
40
|
+
export async function mapAsync<T, U>(
|
|
41
|
+
arr: T[],
|
|
42
|
+
mapper: (item: T, index: number, array: T[]) => Promise<U>
|
|
43
|
+
): Promise<U[]> {
|
|
44
|
+
return Promise.all(
|
|
45
|
+
arr.map((item, index) => mapper(item, index, arr))
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 비동기 리듀서로 배열을 축약합니다
|
|
51
|
+
* @example
|
|
52
|
+
* const sum = await reduceAsync([1, 2, 3], async (acc, x) => acc + x, 0);
|
|
53
|
+
*/
|
|
54
|
+
export async function reduceAsync<T, U>(
|
|
55
|
+
arr: T[],
|
|
56
|
+
reducer: (accumulator: U, currentValue: T, index: number, array: T[]) => Promise<U>,
|
|
57
|
+
initialValue: U
|
|
58
|
+
): Promise<U> {
|
|
59
|
+
let accumulator = initialValue;
|
|
60
|
+
for (let i = 0; i < arr.length; i++) {
|
|
61
|
+
accumulator = await reducer(accumulator, arr[i], i, arr);
|
|
62
|
+
}
|
|
63
|
+
return accumulator;
|
|
64
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PathLike, constants } from "fs";
|
|
2
|
+
import { access } from "fs/promises";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* fs/promises에는 exists가 없어요. 대신 access가 있습니다.
|
|
6
|
+
* 근데 얘는 인터페이스가 쓰기 불편해요. 그래서 감싸주었습니다.
|
|
7
|
+
* @param path
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export async function exists(path: PathLike): Promise<boolean> {
|
|
11
|
+
try {
|
|
12
|
+
await access(path, constants.F_OK);
|
|
13
|
+
return true;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/utils/model.ts
CHANGED
package/src/utils/utils.ts
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import glob from "
|
|
3
|
-
import fs from "fs
|
|
4
|
-
import _ from "lodash";
|
|
2
|
+
import { glob } from "fs/promises";
|
|
3
|
+
import fs from "fs";
|
|
5
4
|
|
|
6
|
-
export function globAsync(pathPattern: string): Promise<string[]> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
resolve(files);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
});
|
|
5
|
+
export async function globAsync(pathPattern: string): Promise<string[]> {
|
|
6
|
+
const files: string[] = [];
|
|
7
|
+
for await (const file of glob(path.resolve(pathPattern))) {
|
|
8
|
+
files.push(file);
|
|
9
|
+
}
|
|
10
|
+
return files;
|
|
16
11
|
}
|
|
17
12
|
export async function importMultiple(
|
|
18
13
|
filePaths: string[],
|
|
@@ -46,6 +41,12 @@ export async function findAppRootPath() {
|
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
export function findApiRootPath() {
|
|
44
|
+
// NOTE: for support npm / yarn workspaces
|
|
45
|
+
const workspacePath = process.env["INIT_CWD"];
|
|
46
|
+
if (workspacePath && workspacePath.length !== 0) {
|
|
47
|
+
return workspacePath;
|
|
48
|
+
}
|
|
49
|
+
|
|
49
50
|
const basePath = require.main?.path ?? __dirname;
|
|
50
51
|
let dir = path.dirname(basePath);
|
|
51
52
|
if (dir.includes("/.yarn/")) {
|
|
@@ -63,48 +64,3 @@ export function findApiRootPath() {
|
|
|
63
64
|
export function nonNullable<T>(value: T): value is NonNullable<T> {
|
|
64
65
|
return value !== null && value !== undefined;
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
export function hydrate<T>(rows: T[]): T[] {
|
|
68
|
-
return rows.map((row: any) => {
|
|
69
|
-
// nullable relation인 경우 관련된 필드가 전부 null로 생성되는 것 방지하는 코드
|
|
70
|
-
const nestedKeys = Object.keys(row).filter((key) => key.includes("__"));
|
|
71
|
-
const groups = _.groupBy(nestedKeys, (key) => key.split("__")[0]);
|
|
72
|
-
const nullKeys = Object.keys(groups).filter(
|
|
73
|
-
(key) =>
|
|
74
|
-
groups[key].length > 1 &&
|
|
75
|
-
groups[key].every((field) => row[field] === null)
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const hydrated = Object.keys(row).reduce((r, field) => {
|
|
79
|
-
if (!field.includes("__")) {
|
|
80
|
-
if (Array.isArray(row[field]) && _.isObject(row[field][0])) {
|
|
81
|
-
r[field] = hydrate(row[field]);
|
|
82
|
-
return r;
|
|
83
|
-
} else {
|
|
84
|
-
r[field] = row[field];
|
|
85
|
-
return r;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const parts = field.split("__");
|
|
90
|
-
const objPath =
|
|
91
|
-
parts[0] +
|
|
92
|
-
parts
|
|
93
|
-
.slice(1)
|
|
94
|
-
.map((part) => `[${part}]`)
|
|
95
|
-
.join("");
|
|
96
|
-
_.set(
|
|
97
|
-
r,
|
|
98
|
-
objPath,
|
|
99
|
-
row[field] && Array.isArray(row[field]) && _.isObject(row[field][0])
|
|
100
|
-
? hydrate(row[field])
|
|
101
|
-
: row[field]
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
return r;
|
|
105
|
-
}, {} as any);
|
|
106
|
-
nullKeys.map((nullKey) => (hydrated[nullKey] = null));
|
|
107
|
-
|
|
108
|
-
return hydrated;
|
|
109
|
-
});
|
|
110
|
-
}
|
package/src/utils/zod-error.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
|
|
3
4
|
type ValidationError = {
|
|
4
5
|
path: string[];
|
|
@@ -6,184 +7,19 @@ type ValidationError = {
|
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export function humanizeZodError(error: z.ZodError): ValidationError[] {
|
|
9
|
-
return error.issues.map((
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return `${acc}[${cur}]`;
|
|
10
|
+
return error.issues.map(({ path: originPath, message }) => {
|
|
11
|
+
const path = originPath.map(item => {
|
|
12
|
+
if (typeof item === "symbol") {
|
|
13
|
+
return item.description ?? item.toString();
|
|
14
14
|
}
|
|
15
|
-
return i === 0 ? cur : `${acc}.${cur}`;
|
|
16
|
-
}, "");
|
|
17
|
-
|
|
18
|
-
switch (issue.code) {
|
|
19
|
-
case z.ZodIssueCode.invalid_type:
|
|
20
|
-
return {
|
|
21
|
-
path: pathAsStrings,
|
|
22
|
-
message: `${path} should be a ${issue.expected}, received ${issue.received}.`,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
case z.ZodIssueCode.unrecognized_keys:
|
|
26
|
-
return {
|
|
27
|
-
path: pathAsStrings,
|
|
28
|
-
message: `Unrecognized keys in ${path}: ${issue.keys.join(", ")}.`,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
case z.ZodIssueCode.invalid_union:
|
|
32
|
-
return {
|
|
33
|
-
path: pathAsStrings,
|
|
34
|
-
message: `${path} failed union validation. Inner errors: ${issue.unionErrors
|
|
35
|
-
.map((e) => e.issues.map((i) => i.message).join("; "))
|
|
36
|
-
.join(" OR ")}.`,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
case z.ZodIssueCode.invalid_enum_value:
|
|
40
|
-
return {
|
|
41
|
-
path: pathAsStrings,
|
|
42
|
-
message: `${path} must be one of: ${issue.options.join(", ")}.`,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
case z.ZodIssueCode.invalid_arguments:
|
|
46
|
-
return {
|
|
47
|
-
path: pathAsStrings,
|
|
48
|
-
message: `Invalid function arguments: ${issue.argumentsError.issues
|
|
49
|
-
.map((i) => i.message)
|
|
50
|
-
.join("; ")}.`,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
case z.ZodIssueCode.invalid_return_type:
|
|
54
|
-
return {
|
|
55
|
-
path: pathAsStrings,
|
|
56
|
-
message: `Invalid function return type: ${issue.returnTypeError.issues
|
|
57
|
-
.map((i) => i.message)
|
|
58
|
-
.join("; ")}.`,
|
|
59
|
-
};
|
|
60
15
|
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
|
|
64
|
-
message: `${path} must be a valid date.`,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
case z.ZodIssueCode.invalid_string:
|
|
68
|
-
const validationType = issue.validation;
|
|
69
|
-
return {
|
|
70
|
-
path: pathAsStrings,
|
|
71
|
-
message: `${path} must be a valid ${validationType}.`,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
case z.ZodIssueCode.too_small:
|
|
75
|
-
return {
|
|
76
|
-
path: pathAsStrings,
|
|
77
|
-
message: `${path} ${getMinimumMessage(issue)}.`,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
case z.ZodIssueCode.too_big:
|
|
81
|
-
return {
|
|
82
|
-
path: pathAsStrings,
|
|
83
|
-
message: `${path} ${getMaximumMessage(issue)}`,
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
case z.ZodIssueCode.not_multiple_of:
|
|
87
|
-
return {
|
|
88
|
-
path: pathAsStrings,
|
|
89
|
-
message: `${path} must be a multiple of ${issue.multipleOf.toString()}.`,
|
|
90
|
-
};
|
|
16
|
+
if (typeof item === "number") {
|
|
17
|
+
return `[${item}]`;
|
|
18
|
+
}
|
|
91
19
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
path: pathAsStrings,
|
|
95
|
-
message: issue.message || `${path} failed custom validation.`,
|
|
96
|
-
};
|
|
20
|
+
return item;
|
|
21
|
+
});
|
|
97
22
|
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
path: pathAsStrings,
|
|
101
|
-
message: issue.message,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
23
|
+
return { path, message: message };
|
|
104
24
|
});
|
|
105
25
|
}
|
|
106
|
-
|
|
107
|
-
function getMinimumMessage(
|
|
108
|
-
issue: z.ZodIssue & { code: typeof z.ZodIssueCode.too_small }
|
|
109
|
-
) {
|
|
110
|
-
switch (issue.type) {
|
|
111
|
-
case "string":
|
|
112
|
-
return `must be ${
|
|
113
|
-
issue.exact ? "exactly" : issue.inclusive ? "at least" : "more than"
|
|
114
|
-
} ${issue.minimum} character${issue.minimum === 1 ? "" : "s"}`;
|
|
115
|
-
|
|
116
|
-
case "number":
|
|
117
|
-
return `must be ${
|
|
118
|
-
issue.exact
|
|
119
|
-
? "exactly"
|
|
120
|
-
: issue.inclusive
|
|
121
|
-
? "greater than or equal to"
|
|
122
|
-
: "greater than"
|
|
123
|
-
} ${issue.minimum.toString()}`;
|
|
124
|
-
|
|
125
|
-
case "array":
|
|
126
|
-
case "set":
|
|
127
|
-
return `must contain ${
|
|
128
|
-
issue.exact ? "exactly" : issue.inclusive ? "at least" : "more than"
|
|
129
|
-
} ${issue.minimum} item${issue.minimum === 1 ? "" : "s"}`;
|
|
130
|
-
|
|
131
|
-
case "date":
|
|
132
|
-
return `must be ${
|
|
133
|
-
issue.exact ? "exactly" : issue.inclusive ? "at or after" : "after"
|
|
134
|
-
} ${formatDateConstraint(issue.minimum)}`;
|
|
135
|
-
|
|
136
|
-
default:
|
|
137
|
-
return "is too small";
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function getMaximumMessage(
|
|
142
|
-
issue: z.ZodIssue & { code: typeof z.ZodIssueCode.too_big }
|
|
143
|
-
) {
|
|
144
|
-
switch (issue.type) {
|
|
145
|
-
case "string":
|
|
146
|
-
return `must be ${
|
|
147
|
-
issue.exact ? "exactly" : issue.inclusive ? "at most" : "less than"
|
|
148
|
-
} ${issue.maximum} character${issue.maximum === 1 ? "" : "s"}`;
|
|
149
|
-
|
|
150
|
-
case "number":
|
|
151
|
-
return `must be ${
|
|
152
|
-
issue.exact
|
|
153
|
-
? "exactly"
|
|
154
|
-
: issue.inclusive
|
|
155
|
-
? "less than or equal to"
|
|
156
|
-
: "less than"
|
|
157
|
-
} ${issue.maximum.toString()}`;
|
|
158
|
-
|
|
159
|
-
case "array":
|
|
160
|
-
case "set":
|
|
161
|
-
return `must contain ${
|
|
162
|
-
issue.exact ? "exactly" : issue.inclusive ? "at most" : "fewer than"
|
|
163
|
-
} ${issue.maximum} item${issue.maximum === 1 ? "" : "s"}`;
|
|
164
|
-
|
|
165
|
-
case "date":
|
|
166
|
-
return `must be ${
|
|
167
|
-
issue.exact ? "exactly" : issue.inclusive ? "at or before" : "before"
|
|
168
|
-
} ${formatDateConstraint(issue.maximum)}`;
|
|
169
|
-
|
|
170
|
-
default:
|
|
171
|
-
return "is too big";
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function formatDateConstraint(value: number | bigint): string {
|
|
176
|
-
try {
|
|
177
|
-
if (typeof value === "bigint") {
|
|
178
|
-
if (
|
|
179
|
-
value > BigInt(Number.MAX_SAFE_INTEGER) ||
|
|
180
|
-
value < BigInt(Number.MIN_SAFE_INTEGER)
|
|
181
|
-
) {
|
|
182
|
-
return value.toString();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return new Date(Number(value)).toISOString();
|
|
186
|
-
} catch {
|
|
187
|
-
return value.toString();
|
|
188
|
-
}
|
|
189
|
-
}
|
package/tsconfig.json
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
"outDir": "dist",
|
|
7
7
|
"sourceMap": true,
|
|
8
8
|
"lib": ["esnext", "dom"],
|
|
9
|
+
|
|
10
|
+
// NOTE(Haze, 251106): SSE 관련 fastify 타입 이슈로 명시적으로 추가함.
|
|
11
|
+
"types": ["fastify-sse-v2"],
|
|
12
|
+
|
|
9
13
|
"declaration": true,
|
|
10
14
|
"declarationMap": true,
|
|
11
15
|
|
|
@@ -24,6 +28,8 @@
|
|
|
24
28
|
"noUnusedParameters": true,
|
|
25
29
|
"noImplicitReturns": true,
|
|
26
30
|
"noFallthroughCasesInSwitch": true,
|
|
31
|
+
"skipLibCheck": true,
|
|
32
|
+
// "noUncheckedIndexedAccess": true, // FIXME
|
|
27
33
|
|
|
28
34
|
/* Module Resolution Options */
|
|
29
35
|
"moduleResolution": "node",
|
package/tsup.config.js
CHANGED
|
@@ -11,7 +11,10 @@ export default defineConfig({
|
|
|
11
11
|
"src/database/drivers/kysely/base-model.ts",
|
|
12
12
|
],
|
|
13
13
|
dts: true,
|
|
14
|
-
format: [
|
|
14
|
+
format: [
|
|
15
|
+
"cjs",
|
|
16
|
+
// "esm"
|
|
17
|
+
],
|
|
15
18
|
target: "esnext",
|
|
16
19
|
clean: true,
|
|
17
20
|
sourcemap: true,
|
|
@@ -24,7 +27,6 @@ export default defineConfig({
|
|
|
24
27
|
"dotenv",
|
|
25
28
|
"fast-deep-equal",
|
|
26
29
|
"fastify",
|
|
27
|
-
"fs-extra",
|
|
28
30
|
"glob",
|
|
29
31
|
"inflection",
|
|
30
32
|
"knex",
|