sonamu 0.6.0 → 0.7.0
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.project-default +18 -0
- package/bin/cli.js +24 -0
- package/dist/ai/agents/agent.d.ts +11 -0
- package/dist/ai/agents/agent.d.ts.map +1 -0
- package/dist/ai/agents/agent.js +65 -0
- package/dist/ai/agents/index.d.ts +3 -0
- package/dist/ai/agents/index.d.ts.map +1 -0
- package/dist/ai/agents/index.js +4 -0
- package/dist/ai/agents/types.d.ts +43 -0
- package/dist/ai/agents/types.d.ts.map +1 -0
- package/dist/ai/agents/types.js +3 -0
- package/dist/ai/index.d.ts +2 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +3 -0
- package/dist/ai/providers/rtzr/api.d.ts +22 -0
- package/dist/ai/providers/rtzr/api.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/api.js +28 -0
- package/dist/ai/providers/rtzr/error.d.ts +18 -0
- package/dist/ai/providers/rtzr/error.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/error.js +29 -0
- package/dist/ai/providers/rtzr/index.d.ts +5 -0
- package/dist/ai/providers/rtzr/index.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/index.js +6 -0
- package/dist/ai/providers/rtzr/model.d.ts +52 -0
- package/dist/ai/providers/rtzr/model.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/model.js +137 -0
- package/dist/ai/providers/rtzr/options.d.ts +7 -0
- package/dist/ai/providers/rtzr/options.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/options.js +47 -0
- package/dist/ai/providers/rtzr/provider.d.ts +18 -0
- package/dist/ai/providers/rtzr/provider.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/provider.js +54 -0
- package/dist/ai/providers/rtzr/utils.d.ts +19 -0
- package/dist/ai/providers/rtzr/utils.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/utils.js +88 -0
- package/dist/api/base-frame.d.ts +2 -2
- package/dist/api/base-frame.d.ts.map +1 -1
- package/dist/api/base-frame.js +2 -1
- package/dist/api/caster.d.ts.map +1 -1
- package/dist/api/caster.js +6 -1
- package/dist/api/code-converters.d.ts +58 -14
- package/dist/api/code-converters.d.ts.map +1 -1
- package/dist/api/code-converters.js +178 -409
- package/dist/api/config.d.ts +27 -13
- package/dist/api/config.d.ts.map +1 -1
- package/dist/api/config.js +19 -26
- package/dist/api/context.d.ts +4 -3
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/context.js +1 -1
- package/dist/api/decorators.d.ts +20 -6
- package/dist/api/decorators.d.ts.map +1 -1
- package/dist/api/decorators.js +111 -18
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +3 -3
- package/dist/api/sonamu.d.ts +7 -7
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +83 -51
- package/dist/api/validator.d.ts +6 -0
- package/dist/api/validator.d.ts.map +1 -0
- package/dist/api/validator.js +81 -0
- package/dist/bin/build-config.d.ts +5 -1
- package/dist/bin/build-config.d.ts.map +1 -1
- package/dist/bin/build-config.js +5 -2
- package/dist/bin/cli.js +165 -64
- package/dist/bin/loader-register.d.ts +2 -0
- package/dist/bin/loader-register.d.ts.map +1 -0
- package/dist/bin/loader-register.js +34 -0
- package/dist/database/_batch_update.d.ts +5 -3
- package/dist/database/_batch_update.d.ts.map +1 -1
- package/dist/database/_batch_update.js +30 -13
- package/dist/database/base-model.d.ts +96 -10
- package/dist/database/base-model.d.ts.map +1 -1
- package/dist/database/base-model.js +232 -89
- package/dist/database/base-model.types.d.ts +93 -0
- package/dist/database/base-model.types.d.ts.map +1 -0
- package/dist/database/base-model.types.js +10 -0
- package/dist/database/code-generator.d.ts +1 -1
- package/dist/database/code-generator.d.ts.map +1 -1
- package/dist/database/code-generator.js +11 -10
- package/dist/database/db.d.ts +5 -6
- package/dist/database/db.d.ts.map +1 -1
- package/dist/database/db.js +22 -25
- package/dist/database/puri-subset.test-d.js +81 -0
- package/dist/database/puri-subset.types.d.ts +123 -0
- package/dist/database/puri-subset.types.d.ts.map +1 -0
- package/dist/database/puri-subset.types.js +16 -0
- package/dist/database/puri-wrapper.d.ts +13 -11
- package/dist/database/puri-wrapper.d.ts.map +1 -1
- package/dist/database/puri-wrapper.js +2 -2
- package/dist/database/puri.d.ts +25 -14
- package/dist/database/puri.d.ts.map +1 -1
- package/dist/database/puri.js +83 -21
- package/dist/database/puri.types.d.ts +21 -7
- package/dist/database/puri.types.d.ts.map +1 -1
- package/dist/database/puri.types.js +4 -1
- package/dist/database/transaction-context.d.ts +1 -1
- package/dist/database/transaction-context.d.ts.map +1 -1
- package/dist/database/transaction-context.js +1 -1
- package/dist/database/upsert-builder.d.ts +9 -3
- package/dist/database/upsert-builder.d.ts.map +1 -1
- package/dist/database/upsert-builder.js +228 -78
- package/dist/entity/entity-manager.d.ts +165 -2
- package/dist/entity/entity-manager.d.ts.map +1 -1
- package/dist/entity/entity-manager.js +26 -10
- package/dist/entity/entity.d.ts +5 -3
- package/dist/entity/entity.d.ts.map +1 -1
- package/dist/entity/entity.js +153 -54
- package/dist/exceptions/error-handler.d.ts +1 -1
- package/dist/exceptions/error-handler.d.ts.map +1 -1
- package/dist/exceptions/error-handler.js +1 -1
- package/dist/exceptions/so-exceptions.d.ts +1 -1
- package/dist/exceptions/so-exceptions.d.ts.map +1 -1
- package/dist/exceptions/so-exceptions.js +1 -1
- package/dist/file-storage/driver.d.ts +1 -1
- package/dist/file-storage/driver.d.ts.map +1 -1
- package/dist/file-storage/driver.js +1 -1
- package/dist/file-storage/file-storage.js +2 -2
- package/dist/index.d.ts +18 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -13
- package/dist/migration/code-generation.d.ts +1 -1
- package/dist/migration/code-generation.d.ts.map +1 -1
- package/dist/migration/code-generation.js +123 -67
- package/dist/migration/migration-set.d.ts +2 -10
- package/dist/migration/migration-set.d.ts.map +1 -1
- package/dist/migration/migration-set.js +67 -218
- package/dist/migration/migrator.d.ts +24 -73
- package/dist/migration/migrator.d.ts.map +1 -1
- package/dist/migration/migrator.js +121 -301
- package/dist/migration/postgresql-schema-reader.d.ts +51 -0
- package/dist/migration/postgresql-schema-reader.d.ts.map +1 -0
- package/dist/migration/postgresql-schema-reader.js +245 -0
- package/dist/migration/types.d.ts +6 -38
- package/dist/migration/types.d.ts.map +1 -1
- package/dist/migration/types.js +1 -1
- package/dist/naite/messaging-types.d.ts +43 -0
- package/dist/naite/messaging-types.d.ts.map +1 -0
- package/dist/naite/messaging-types.js +7 -0
- package/dist/naite/naite-reporter.d.ts +41 -0
- package/dist/naite/naite-reporter.d.ts.map +1 -0
- package/dist/naite/naite-reporter.js +102 -0
- package/dist/naite/naite.d.ts +91 -8
- package/dist/naite/naite.d.ts.map +1 -1
- package/dist/naite/naite.js +285 -41
- package/dist/stream/sse.d.ts +2 -2
- package/dist/stream/sse.d.ts.map +1 -1
- package/dist/stream/sse.js +1 -1
- package/dist/syncer/api-parser.d.ts +3 -13
- package/dist/syncer/api-parser.d.ts.map +1 -1
- package/dist/syncer/api-parser.js +67 -56
- package/dist/syncer/checksum.d.ts +2 -2
- package/dist/syncer/checksum.d.ts.map +1 -1
- package/dist/syncer/checksum.js +11 -11
- package/dist/syncer/code-generator.d.ts +3 -3
- package/dist/syncer/code-generator.d.ts.map +1 -1
- package/dist/syncer/code-generator.js +37 -17
- package/dist/syncer/entity-operations.d.ts +2 -2
- package/dist/syncer/entity-operations.d.ts.map +1 -1
- package/dist/syncer/entity-operations.js +9 -8
- package/dist/syncer/file-patterns.d.ts +1 -1
- package/dist/syncer/file-patterns.d.ts.map +1 -1
- package/dist/syncer/file-patterns.js +1 -1
- package/dist/syncer/index.d.ts +4 -4
- package/dist/syncer/index.d.ts.map +1 -1
- package/dist/syncer/index.js +5 -5
- package/dist/syncer/module-loader.d.ts +4 -4
- package/dist/syncer/module-loader.d.ts.map +1 -1
- package/dist/syncer/module-loader.js +17 -12
- package/dist/syncer/syncer.d.ts +31 -24
- package/dist/syncer/syncer.d.ts.map +1 -1
- package/dist/syncer/syncer.js +92 -45
- package/dist/template/entity-converter.d.ts +1 -1
- package/dist/template/entity-converter.d.ts.map +1 -1
- package/dist/template/entity-converter.js +15 -8
- package/dist/template/helpers.d.ts +2 -2
- package/dist/template/helpers.d.ts.map +1 -1
- package/dist/template/helpers.js +3 -3
- package/dist/template/implementations/entity.template.d.ts +2 -2
- package/dist/template/implementations/entity.template.d.ts.map +1 -1
- package/dist/template/implementations/entity.template.js +4 -5
- package/dist/template/implementations/generated.template.d.ts +2 -3
- package/dist/template/implementations/generated.template.d.ts.map +1 -1
- package/dist/template/implementations/generated.template.js +46 -29
- package/dist/template/implementations/generated_http.template.d.ts +2 -3
- package/dist/template/implementations/generated_http.template.d.ts.map +1 -1
- package/dist/template/implementations/generated_http.template.js +9 -9
- package/dist/template/implementations/generated_sso.template.d.ts +3 -4
- package/dist/template/implementations/generated_sso.template.d.ts.map +1 -1
- package/dist/template/implementations/generated_sso.template.js +54 -25
- package/dist/template/implementations/init_types.template.d.ts +2 -2
- package/dist/template/implementations/init_types.template.d.ts.map +1 -1
- package/dist/template/implementations/init_types.template.js +2 -2
- package/dist/template/implementations/model.template.d.ts +2 -2
- package/dist/template/implementations/model.template.d.ts.map +1 -1
- package/dist/template/implementations/model.template.js +47 -37
- package/dist/template/implementations/model_test.template.d.ts +2 -2
- package/dist/template/implementations/model_test.template.d.ts.map +1 -1
- package/dist/template/implementations/model_test.template.js +2 -2
- package/dist/template/implementations/service.template.d.ts +4 -4
- package/dist/template/implementations/service.template.d.ts.map +1 -1
- package/dist/template/implementations/service.template.js +24 -16
- package/dist/template/implementations/view_enums_buttonset.template.d.ts +2 -2
- package/dist/template/implementations/view_enums_buttonset.template.d.ts.map +1 -1
- package/dist/template/implementations/view_enums_buttonset.template.js +1 -1
- package/dist/template/implementations/view_enums_dropdown.template.d.ts +2 -2
- package/dist/template/implementations/view_enums_dropdown.template.d.ts.map +1 -1
- package/dist/template/implementations/view_enums_dropdown.template.js +2 -2
- package/dist/template/implementations/view_enums_select.template.d.ts +2 -2
- package/dist/template/implementations/view_enums_select.template.d.ts.map +1 -1
- package/dist/template/implementations/view_enums_select.template.js +2 -2
- package/dist/template/implementations/view_form.template.d.ts +2 -2
- package/dist/template/implementations/view_form.template.d.ts.map +1 -1
- package/dist/template/implementations/view_form.template.js +4 -4
- package/dist/template/implementations/view_id_all_select.template.d.ts +2 -2
- package/dist/template/implementations/view_id_all_select.template.d.ts.map +1 -1
- package/dist/template/implementations/view_id_all_select.template.js +1 -1
- package/dist/template/implementations/view_id_async_select.template.d.ts +2 -2
- package/dist/template/implementations/view_id_async_select.template.d.ts.map +1 -1
- package/dist/template/implementations/view_id_async_select.template.js +1 -1
- package/dist/template/implementations/view_list.template.d.ts +2 -2
- package/dist/template/implementations/view_list.template.d.ts.map +1 -1
- package/dist/template/implementations/view_list.template.js +29 -19
- package/dist/template/implementations/view_list_columns.template.d.ts +3 -3
- package/dist/template/implementations/view_list_columns.template.d.ts.map +1 -1
- package/dist/template/implementations/view_list_columns.template.js +1 -1
- package/dist/template/implementations/view_search_input.template.d.ts +2 -2
- package/dist/template/implementations/view_search_input.template.d.ts.map +1 -1
- package/dist/template/implementations/view_search_input.template.js +1 -1
- package/dist/template/index.d.ts +4 -2
- package/dist/template/index.d.ts.map +1 -1
- package/dist/template/index.js +5 -3
- package/dist/template/template-manager.d.ts +56 -0
- package/dist/template/template-manager.d.ts.map +1 -0
- package/dist/template/template-manager.js +125 -0
- package/dist/template/template-types.d.ts +16 -0
- package/dist/template/template-types.d.ts.map +1 -0
- package/dist/template/template-types.js +7 -0
- package/dist/template/template.d.ts +12 -2
- package/dist/template/template.d.ts.map +1 -1
- package/dist/template/template.js +19 -6
- package/dist/template/zod-converter.d.ts +40 -7
- package/dist/template/zod-converter.d.ts.map +1 -1
- package/dist/template/zod-converter.js +341 -58
- package/dist/testing/_relation-graph.d.ts +1 -1
- package/dist/testing/_relation-graph.d.ts.map +1 -1
- package/dist/testing/_relation-graph.js +12 -3
- package/dist/testing/fixture-manager.d.ts +42 -11
- package/dist/testing/fixture-manager.d.ts.map +1 -1
- package/dist/testing/fixture-manager.js +338 -236
- package/dist/types/types.d.ts +709 -104
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +309 -52
- package/dist/typings/knex.d.js +2 -2
- package/dist/utils/async-utils.d.ts.map +1 -1
- package/dist/utils/async-utils.js +3 -3
- package/dist/utils/console-util.js +1 -1
- package/dist/utils/controller.d.ts +1 -0
- package/dist/utils/controller.d.ts.map +1 -1
- package/dist/utils/controller.js +4 -1
- package/dist/utils/esm-utils.d.ts +0 -6
- package/dist/utils/esm-utils.d.ts.map +1 -1
- package/dist/utils/esm-utils.js +2 -9
- package/dist/utils/formatter.d.ts +3 -0
- package/dist/utils/formatter.d.ts.map +1 -0
- package/dist/utils/formatter.js +110 -0
- package/dist/utils/fs-utils.d.ts +1 -1
- package/dist/utils/fs-utils.d.ts.map +1 -1
- package/dist/utils/fs-utils.js +1 -1
- package/dist/utils/lodash-able.d.ts.map +1 -1
- package/dist/utils/lodash-able.js +1 -1
- package/dist/utils/object-utils.d.ts +44 -0
- package/dist/utils/object-utils.d.ts.map +1 -0
- package/dist/utils/object-utils.js +191 -0
- package/dist/utils/path-utils.d.ts +1 -1
- package/dist/utils/path-utils.d.ts.map +1 -1
- package/dist/utils/path-utils.js +3 -3
- package/dist/utils/process-utils.js +1 -1
- package/dist/utils/sql-parser.d.ts +5 -1
- package/dist/utils/sql-parser.d.ts.map +1 -1
- package/dist/utils/sql-parser.js +14 -3
- package/dist/utils/type-utils.d.ts +23 -0
- package/dist/utils/type-utils.d.ts.map +1 -0
- package/dist/utils/type-utils.js +45 -0
- package/dist/utils/utils.d.ts +7 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +44 -5
- package/dist/utils/zod-error.d.ts +1 -1
- package/dist/utils/zod-error.d.ts.map +1 -1
- package/dist/utils/zod-error.js +1 -1
- package/package.json +54 -29
- package/src/ai/agents/agent.ts +87 -0
- package/src/ai/agents/index.ts +2 -0
- package/src/ai/agents/types.ts +47 -0
- package/src/ai/index.ts +1 -0
- package/src/ai/providers/rtzr/api.ts +37 -0
- package/src/ai/providers/rtzr/error.ts +34 -0
- package/src/ai/providers/rtzr/index.ts +4 -0
- package/src/ai/providers/rtzr/model.ts +201 -0
- package/src/ai/providers/rtzr/options.ts +49 -0
- package/src/ai/providers/rtzr/provider.ts +91 -0
- package/src/ai/providers/rtzr/utils.ts +127 -0
- package/src/api/base-frame.ts +4 -2
- package/src/api/caster.ts +17 -23
- package/src/api/code-converters.ts +176 -533
- package/src/api/config.ts +39 -56
- package/src/api/context.ts +7 -18
- package/src/api/decorators.ts +175 -46
- package/src/api/index.ts +2 -2
- package/src/api/sonamu.ts +133 -124
- package/src/api/validator.ts +83 -0
- package/src/bin/build-config.ts +7 -1
- package/src/bin/cli.ts +192 -110
- package/src/bin/loader-register.ts +38 -0
- package/src/database/_batch_update.ts +46 -31
- package/src/database/base-model.ts +390 -182
- package/src/database/base-model.types.ts +155 -0
- package/src/database/code-generator.ts +13 -32
- package/src/database/db.ts +36 -50
- package/src/database/puri-subset.test-d.ts +471 -0
- package/src/database/puri-subset.types.ts +195 -0
- package/src/database/puri-wrapper.ts +58 -67
- package/src/database/puri.ts +182 -126
- package/src/database/puri.types.ts +64 -31
- package/src/database/transaction-context.ts +1 -1
- package/src/database/upsert-builder.ts +262 -132
- package/src/entity/entity-manager.ts +36 -28
- package/src/entity/entity.ts +330 -249
- package/src/exceptions/error-handler.ts +3 -3
- package/src/exceptions/so-exceptions.ts +11 -11
- package/src/file-storage/driver.ts +5 -5
- package/src/file-storage/file-storage.ts +2 -2
- package/src/index.ts +18 -12
- package/src/migration/code-generation.ts +185 -172
- package/src/migration/migration-set.ts +80 -293
- package/src/migration/migrator.ts +182 -425
- package/src/migration/mysql-schema-reader.ts.txt +272 -0
- package/src/migration/postgresql-schema-reader.ts +310 -0
- package/src/migration/types.ts +6 -39
- package/src/naite/messaging-types.ts +51 -0
- package/src/naite/naite-reporter.ts +128 -0
- package/src/naite/naite.ts +378 -33
- package/src/shared/web.shared.ts.txt +20 -24
- package/src/stream/sse.ts +5 -5
- package/src/syncer/api-parser.ts +52 -69
- package/src/syncer/checksum.ts +25 -37
- package/src/syncer/code-generator.ts +58 -62
- package/src/syncer/entity-operations.ts +12 -15
- package/src/syncer/file-patterns.ts +2 -2
- package/src/syncer/index.ts +4 -4
- package/src/syncer/module-loader.ts +28 -25
- package/src/syncer/syncer.ts +155 -162
- package/src/template/entity-converter.ts +18 -27
- package/src/template/helpers.ts +8 -11
- package/src/template/implementations/entity.template.ts +6 -6
- package/src/template/implementations/generated.template.ts +99 -99
- package/src/template/implementations/generated_http.template.ts +21 -54
- package/src/template/implementations/generated_sso.template.ts +78 -65
- package/src/template/implementations/init_types.template.ts +4 -6
- package/src/template/implementations/model.template.ts +47 -38
- package/src/template/implementations/model_test.template.ts +3 -3
- package/src/template/implementations/service.template.ts +56 -80
- package/src/template/implementations/view_enums_buttonset.template.ts +2 -2
- package/src/template/implementations/view_enums_dropdown.template.ts +4 -4
- package/src/template/implementations/view_enums_select.template.ts +3 -3
- package/src/template/implementations/view_form.template.ts +34 -75
- package/src/template/implementations/view_id_all_select.template.ts +2 -2
- package/src/template/implementations/view_id_async_select.template.ts +9 -23
- package/src/template/implementations/view_list.template.ts +54 -95
- package/src/template/implementations/view_list_columns.template.ts +4 -10
- package/src/template/implementations/view_search_input.template.ts +2 -2
- package/src/template/index.ts +4 -2
- package/src/template/template-manager.ts +166 -0
- package/src/template/template-types.ts +16 -0
- package/src/template/template.ts +29 -10
- package/src/template/zod-converter.ts +407 -101
- package/src/testing/_relation-graph.ts +18 -11
- package/src/testing/fixture-manager.ts +468 -362
- package/src/types/types.ts +516 -248
- package/src/typings/knex.d.ts +7 -9
- package/src/utils/async-utils.ts +8 -12
- package/src/utils/console-util.ts +1 -1
- package/src/utils/controller.ts +3 -0
- package/src/utils/esm-utils.ts +8 -18
- package/src/utils/formatter.ts +109 -0
- package/src/utils/fs-utils.ts +1 -1
- package/src/utils/lodash-able.ts +1 -4
- package/src/utils/object-utils.ts +217 -0
- package/src/utils/path-utils.ts +3 -6
- package/src/utils/process-utils.ts +1 -1
- package/src/utils/sql-parser.ts +23 -5
- package/src/utils/type-utils.ts +83 -0
- package/src/utils/utils.ts +58 -9
- package/src/utils/zod-error.ts +3 -3
- package/dist/bin/cli-wrapper.d.ts +0 -3
- package/dist/bin/cli-wrapper.d.ts.map +0 -1
- package/dist/bin/cli-wrapper.js +0 -72
- package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts +0 -2
- package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts.map +0 -1
- package/dist/database/knex-plugins/knex-on-duplicate-update.js +0 -39
- package/dist/entity/entity-utils.d.ts +0 -61
- package/dist/entity/entity-utils.d.ts.map +0 -1
- package/dist/entity/entity-utils.js +0 -210
- package/src/bin/cli-wrapper.ts +0 -82
- package/src/database/knex-plugins/knex-on-duplicate-update.ts +0 -45
- package/src/entity/entity-utils.ts +0 -291
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FastifyInstance } from "fastify";
|
|
2
|
-
import
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type z from "zod";
|
|
3
3
|
import { isSoException } from "./so-exceptions";
|
|
4
4
|
|
|
5
5
|
export function setupErrorHandler(server: FastifyInstance) {
|
|
@@ -7,7 +7,7 @@ export function setupErrorHandler(server: FastifyInstance) {
|
|
|
7
7
|
error.statusCode ??= 400;
|
|
8
8
|
|
|
9
9
|
if (isSoException(error) && error.payload && Array.isArray(error.payload)) {
|
|
10
|
-
const issues = error.payload as ZodIssue[];
|
|
10
|
+
const issues = error.payload as z.core.$ZodIssue[];
|
|
11
11
|
const [issue] = issues;
|
|
12
12
|
const message = `${issue.message} (${issue.path.join("/")})`;
|
|
13
13
|
|
|
@@ -2,14 +2,14 @@ export abstract class SoException extends Error {
|
|
|
2
2
|
constructor(
|
|
3
3
|
public readonly statusCode: number,
|
|
4
4
|
public message: string,
|
|
5
|
-
public payload?: unknown
|
|
5
|
+
public payload?: unknown,
|
|
6
6
|
) {
|
|
7
7
|
super(message);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function isSoException(err:
|
|
12
|
-
return err.statusCode !== undefined;
|
|
11
|
+
export function isSoException(err: unknown): err is SoException {
|
|
12
|
+
return (err as SoException).statusCode !== undefined;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/*
|
|
@@ -18,7 +18,7 @@ export function isSoException(err: any): err is SoException {
|
|
|
18
18
|
export class BadRequestException extends SoException {
|
|
19
19
|
constructor(
|
|
20
20
|
public message = "Bad Request",
|
|
21
|
-
public payload?: unknown
|
|
21
|
+
public payload?: unknown,
|
|
22
22
|
) {
|
|
23
23
|
super(400, message, payload);
|
|
24
24
|
}
|
|
@@ -30,7 +30,7 @@ export class BadRequestException extends SoException {
|
|
|
30
30
|
export class UnauthorizedException extends SoException {
|
|
31
31
|
constructor(
|
|
32
32
|
public message = "Unauthorized",
|
|
33
|
-
public payload?: unknown
|
|
33
|
+
public payload?: unknown,
|
|
34
34
|
) {
|
|
35
35
|
super(401, message, payload);
|
|
36
36
|
}
|
|
@@ -42,7 +42,7 @@ export class UnauthorizedException extends SoException {
|
|
|
42
42
|
export class NotFoundException extends SoException {
|
|
43
43
|
constructor(
|
|
44
44
|
public message = "Not Found",
|
|
45
|
-
public payload?: unknown
|
|
45
|
+
public payload?: unknown,
|
|
46
46
|
) {
|
|
47
47
|
super(404, message, payload);
|
|
48
48
|
}
|
|
@@ -54,7 +54,7 @@ export class NotFoundException extends SoException {
|
|
|
54
54
|
export class ServiceUnavailableException extends SoException {
|
|
55
55
|
constructor(
|
|
56
56
|
public message = "Service Unavailable",
|
|
57
|
-
public payload?: unknown
|
|
57
|
+
public payload?: unknown,
|
|
58
58
|
) {
|
|
59
59
|
super(503, message, payload);
|
|
60
60
|
}
|
|
@@ -66,7 +66,7 @@ export class ServiceUnavailableException extends SoException {
|
|
|
66
66
|
export class InternalServerErrorException extends SoException {
|
|
67
67
|
constructor(
|
|
68
68
|
public message = "Internal Server Error",
|
|
69
|
-
public payload?: unknown
|
|
69
|
+
public payload?: unknown,
|
|
70
70
|
) {
|
|
71
71
|
super(500, message, payload);
|
|
72
72
|
}
|
|
@@ -78,7 +78,7 @@ export class InternalServerErrorException extends SoException {
|
|
|
78
78
|
export class AlreadyProcessedException extends SoException {
|
|
79
79
|
constructor(
|
|
80
80
|
public message = "Already Processed",
|
|
81
|
-
public payload?: unknown
|
|
81
|
+
public payload?: unknown,
|
|
82
82
|
) {
|
|
83
83
|
super(541, message, payload);
|
|
84
84
|
}
|
|
@@ -90,7 +90,7 @@ export class AlreadyProcessedException extends SoException {
|
|
|
90
90
|
export class DuplicateRowException extends SoException {
|
|
91
91
|
constructor(
|
|
92
92
|
public message = "Duplicate Row",
|
|
93
|
-
public payload?: unknown
|
|
93
|
+
public payload?: unknown,
|
|
94
94
|
) {
|
|
95
95
|
super(542, message, payload);
|
|
96
96
|
}
|
|
@@ -102,7 +102,7 @@ export class DuplicateRowException extends SoException {
|
|
|
102
102
|
export class TargetNotFoundException extends SoException {
|
|
103
103
|
constructor(
|
|
104
104
|
public message = "Target Not Found",
|
|
105
|
-
public payload?: unknown
|
|
105
|
+
public payload?: unknown,
|
|
106
106
|
) {
|
|
107
107
|
super(520, message, payload);
|
|
108
108
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
GetObjectCommand,
|
|
4
4
|
PutObjectCommand,
|
|
5
5
|
S3Client,
|
|
6
|
-
S3ClientConfig,
|
|
6
|
+
type S3ClientConfig,
|
|
7
7
|
} from "@aws-sdk/client-s3";
|
|
8
8
|
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|
9
9
|
import fs from "fs/promises";
|
|
@@ -16,7 +16,7 @@ export interface Driver {
|
|
|
16
16
|
put(
|
|
17
17
|
key: string,
|
|
18
18
|
contents: Buffer,
|
|
19
|
-
options?: { contentType?: string; visibility?: "public" | "private" }
|
|
19
|
+
options?: { contentType?: string; visibility?: "public" | "private" },
|
|
20
20
|
): Promise<void>;
|
|
21
21
|
|
|
22
22
|
del(key: string): Promise<void>;
|
|
@@ -80,7 +80,7 @@ export class S3Driver implements Driver {
|
|
|
80
80
|
async put(
|
|
81
81
|
key: string,
|
|
82
82
|
contents: Buffer,
|
|
83
|
-
options?: { contentType?: string; visibility?: "public" | "private" }
|
|
83
|
+
options?: { contentType?: string; visibility?: "public" | "private" },
|
|
84
84
|
): Promise<void> {
|
|
85
85
|
await this.s3.send(
|
|
86
86
|
new PutObjectCommand({
|
|
@@ -89,7 +89,7 @@ export class S3Driver implements Driver {
|
|
|
89
89
|
Body: contents,
|
|
90
90
|
ContentType: options?.contentType,
|
|
91
91
|
ACL: this.getAcl(options?.visibility),
|
|
92
|
-
})
|
|
92
|
+
}),
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -98,7 +98,7 @@ export class S3Driver implements Driver {
|
|
|
98
98
|
new DeleteObjectCommand({
|
|
99
99
|
Bucket: this.config.bucket,
|
|
100
100
|
Key: key,
|
|
101
|
-
})
|
|
101
|
+
}),
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MultipartFile } from "@fastify/multipart";
|
|
2
|
-
import mime from "mime-types";
|
|
3
2
|
import { createHash } from "crypto";
|
|
3
|
+
import mime from "mime-types";
|
|
4
4
|
import type { Driver } from "./driver";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -82,7 +82,7 @@ export class FileStorage {
|
|
|
82
82
|
*/
|
|
83
83
|
async saveToDisk(
|
|
84
84
|
key: string,
|
|
85
|
-
options?: { contentType?: string; visibility?: "public" | "private" }
|
|
85
|
+
options?: { contentType?: string; visibility?: "public" | "private" },
|
|
86
86
|
): Promise<string> {
|
|
87
87
|
const buffer = await this.toBuffer();
|
|
88
88
|
|
package/src/index.ts
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./api/base-frame";
|
|
2
2
|
export * from "./api/config";
|
|
3
|
+
export type * from "./api/context";
|
|
3
4
|
export * from "./api/decorators";
|
|
4
5
|
export * from "./api/sonamu";
|
|
5
6
|
export * from "./database/base-model";
|
|
6
|
-
export * from "./api/base-frame";
|
|
7
7
|
export * from "./database/db";
|
|
8
|
-
export * from "./database/upsert-builder";
|
|
9
8
|
export * from "./database/puri";
|
|
10
|
-
export * from "./database/puri-wrapper";
|
|
11
9
|
export * from "./database/puri.types";
|
|
10
|
+
export * from "./database/puri-subset.types";
|
|
11
|
+
export * from "./database/puri-wrapper";
|
|
12
|
+
export * from "./database/upsert-builder";
|
|
13
|
+
export * from "./entity/entity";
|
|
14
|
+
export * from "./entity/entity-manager";
|
|
12
15
|
export * from "./exceptions/error-handler";
|
|
13
16
|
export * from "./exceptions/so-exceptions";
|
|
17
|
+
export * from "./file-storage/driver";
|
|
18
|
+
export * from "./migration/migration-set";
|
|
19
|
+
export * from "./migration/migrator";
|
|
20
|
+
export * from "./migration/postgresql-schema-reader";
|
|
21
|
+
export * from "./migration/types";
|
|
22
|
+
export * from "./naite/naite";
|
|
23
|
+
export * from "./naite/naite-reporter";
|
|
14
24
|
export * from "./stream/sse";
|
|
25
|
+
export * from "./template/template";
|
|
26
|
+
export * from "./template/template-manager";
|
|
27
|
+
export * from "./testing/fixture-manager";
|
|
15
28
|
export * from "./types/types";
|
|
16
29
|
export * from "./utils/controller";
|
|
17
30
|
export * from "./utils/model";
|
|
31
|
+
export * from "./utils/type-utils";
|
|
18
32
|
export * from "./utils/utils";
|
|
19
|
-
export * from "./testing/fixture-manager";
|
|
20
|
-
export * from "./entity/entity-manager";
|
|
21
|
-
export * from "./entity/entity";
|
|
22
|
-
export * from "./migration/migrator";
|
|
23
|
-
export * from "./migration/types";
|
|
24
|
-
export * from "./file-storage/driver";
|
|
25
|
-
export * from "./naite/naite";
|
|
26
33
|
|
|
27
34
|
// export * from "./api/code-converters";
|
|
28
|
-
// export * from "./entity/entity-utils";
|
|
29
35
|
// export * from "./syncer/syncer";
|