sonamu 0.5.7 → 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 +13 -2
- package/dist/api/caster.d.ts.map +1 -1
- package/dist/api/caster.js +71 -2
- 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 +258 -2
- package/dist/api/config.d.ts +90 -0
- package/dist/api/config.d.ts.map +1 -0
- package/dist/api/config.js +25 -0
- package/dist/api/context.d.ts +4 -2
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/context.js +3 -2
- package/dist/api/decorators.d.ts +20 -6
- package/dist/api/decorators.d.ts.map +1 -1
- package/dist/api/decorators.js +235 -2
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +9 -2
- package/dist/api/sonamu.d.ts +10 -24
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +514 -2
- 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 +6 -1
- package/dist/bin/build-config.d.ts.map +1 -1
- package/dist/bin/build-config.js +15 -2
- package/dist/bin/cli.js +519 -2
- package/dist/bin/hot-hook-register.d.ts +11 -0
- package/dist/bin/hot-hook-register.d.ts.map +1 -0
- package/dist/bin/hot-hook-register.js +21 -0
- 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 +95 -2
- 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 +390 -2
- 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 +54 -2
- package/dist/database/db.d.ts +6 -21
- package/dist/database/db.d.ts.map +1 -1
- package/dist/database/db.js +129 -2
- 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 +109 -2
- package/dist/database/puri.d.ts +41 -23
- package/dist/database/puri.d.ts.map +1 -1
- package/dist/database/puri.js +601 -2
- package/dist/database/puri.types.d.ts +25 -6
- package/dist/database/puri.types.d.ts.map +1 -1
- package/dist/database/puri.types.js +6 -2
- 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 +14 -2
- 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 +365 -2
- package/dist/entity/entity-manager.d.ts +167 -2
- package/dist/entity/entity-manager.d.ts.map +1 -1
- package/dist/entity/entity-manager.js +130 -2
- package/dist/entity/entity.d.ts +5 -3
- package/dist/entity/entity.d.ts.map +1 -1
- package/dist/entity/entity.js +750 -2
- 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 +29 -2
- 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 +85 -2
- 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 +79 -2
- package/dist/file-storage/file-storage.js +75 -2
- package/dist/index.d.ts +18 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -2
- 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 +614 -2
- 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 +213 -2
- package/dist/migration/migrator.d.ts +24 -82
- package/dist/migration/migrator.d.ts.map +1 -1
- package/dist/migration/migrator.js +330 -2
- 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 +3 -2
- 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 +95 -0
- package/dist/naite/naite.d.ts.map +1 -0
- package/dist/naite/naite.js +316 -0
- package/dist/stream/index.js +3 -2
- package/dist/stream/sse.d.ts +2 -2
- package/dist/stream/sse.d.ts.map +1 -1
- package/dist/stream/sse.js +38 -2
- package/dist/syncer/api-parser.d.ts +10 -0
- package/dist/syncer/api-parser.d.ts.map +1 -0
- package/dist/syncer/api-parser.js +240 -0
- package/dist/syncer/checksum.d.ts +21 -0
- package/dist/syncer/checksum.d.ts.map +1 -0
- package/dist/syncer/checksum.js +98 -0
- package/dist/syncer/code-generator.d.ts +20 -0
- package/dist/syncer/code-generator.d.ts.map +1 -0
- package/dist/syncer/code-generator.js +161 -0
- package/dist/syncer/entity-operations.d.ts +17 -0
- package/dist/syncer/entity-operations.d.ts.map +1 -0
- package/dist/syncer/entity-operations.js +59 -0
- package/dist/syncer/file-patterns.d.ts +29 -0
- package/dist/syncer/file-patterns.d.ts.map +1 -0
- package/dist/syncer/file-patterns.js +38 -0
- package/dist/syncer/index.d.ts +6 -0
- package/dist/syncer/index.d.ts.map +1 -1
- package/dist/syncer/index.js +9 -2
- package/dist/syncer/module-loader.d.ts +35 -0
- package/dist/syncer/module-loader.d.ts.map +1 -0
- package/dist/syncer/module-loader.js +87 -0
- package/dist/syncer/syncer.d.ts +98 -106
- package/dist/syncer/syncer.d.ts.map +1 -1
- package/dist/syncer/syncer.js +422 -2
- package/dist/template/entity-converter.d.ts +14 -0
- package/dist/template/entity-converter.d.ts.map +1 -0
- package/dist/template/entity-converter.js +108 -0
- package/dist/template/helpers.d.ts +23 -0
- package/dist/template/helpers.d.ts.map +1 -0
- package/dist/template/helpers.js +64 -0
- package/dist/{templates → template/implementations}/entity.template.d.ts +3 -3
- package/dist/template/implementations/entity.template.d.ts.map +1 -0
- package/dist/template/implementations/entity.template.js +86 -0
- package/dist/{templates → template/implementations}/generated.template.d.ts +3 -4
- package/dist/template/implementations/generated.template.d.ts.map +1 -0
- package/dist/template/implementations/generated.template.js +249 -0
- package/dist/{templates → template/implementations}/generated_http.template.d.ts +3 -4
- package/dist/template/implementations/generated_http.template.d.ts.map +1 -0
- package/dist/template/implementations/generated_http.template.js +131 -0
- package/dist/{templates → template/implementations}/generated_sso.template.d.ts +4 -5
- package/dist/template/implementations/generated_sso.template.d.ts.map +1 -0
- package/dist/template/implementations/generated_sso.template.js +134 -0
- package/dist/{templates → template/implementations}/init_types.template.d.ts +3 -3
- package/dist/template/implementations/init_types.template.d.ts.map +1 -0
- package/dist/template/implementations/init_types.template.js +38 -0
- package/dist/template/implementations/model.template.d.ts +17 -0
- package/dist/template/implementations/model.template.d.ts.map +1 -0
- package/dist/template/implementations/model.template.js +181 -0
- package/dist/{templates → template/implementations}/model_test.template.d.ts +3 -3
- package/dist/template/implementations/model_test.template.d.ts.map +1 -0
- package/dist/template/implementations/model_test.template.js +35 -0
- package/dist/{templates → template/implementations}/service.template.d.ts +6 -6
- package/dist/template/implementations/service.template.d.ts.map +1 -0
- package/dist/template/implementations/service.template.js +201 -0
- package/dist/{templates → template/implementations}/view_enums_buttonset.template.d.ts +3 -3
- package/dist/template/implementations/view_enums_buttonset.template.d.ts.map +1 -0
- package/dist/template/implementations/view_enums_buttonset.template.js +31 -0
- package/dist/{templates → template/implementations}/view_enums_dropdown.template.d.ts +3 -4
- package/dist/template/implementations/view_enums_dropdown.template.d.ts.map +1 -0
- package/dist/template/implementations/view_enums_dropdown.template.js +50 -0
- package/dist/{templates → template/implementations}/view_enums_select.template.d.ts +3 -3
- package/dist/template/implementations/view_enums_select.template.d.ts.map +1 -0
- package/dist/template/implementations/view_enums_select.template.js +55 -0
- package/dist/{templates → template/implementations}/view_form.template.d.ts +5 -5
- package/dist/template/implementations/view_form.template.d.ts.map +1 -0
- package/dist/template/implementations/view_form.template.js +337 -0
- package/dist/{templates → template/implementations}/view_id_all_select.template.d.ts +3 -3
- package/dist/template/implementations/view_id_all_select.template.d.ts.map +1 -0
- package/dist/template/implementations/view_id_all_select.template.js +31 -0
- package/dist/{templates → template/implementations}/view_id_async_select.template.d.ts +3 -3
- package/dist/template/implementations/view_id_async_select.template.d.ts.map +1 -0
- package/dist/template/implementations/view_id_async_select.template.js +105 -0
- package/dist/{templates → template/implementations}/view_list.template.d.ts +5 -13
- package/dist/template/implementations/view_list.template.d.ts.map +1 -0
- package/dist/template/implementations/view_list.template.js +475 -0
- package/dist/template/implementations/view_list_columns.template.d.ts +17 -0
- package/dist/template/implementations/view_list_columns.template.d.ts.map +1 -0
- package/dist/template/implementations/view_list_columns.template.js +49 -0
- package/dist/{templates → template/implementations}/view_search_input.template.d.ts +3 -3
- package/dist/template/implementations/view_search_input.template.d.ts.map +1 -0
- package/dist/template/implementations/view_search_input.template.js +64 -0
- package/dist/template/index.d.ts +7 -0
- package/dist/template/index.d.ts.map +1 -0
- package/dist/template/index.js +8 -0
- 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 +49 -0
- package/dist/template/template.d.ts.map +1 -0
- package/dist/template/template.js +60 -0
- package/dist/template/zod-converter.d.ts +51 -0
- package/dist/template/zod-converter.d.ts.map +1 -0
- package/dist/template/zod-converter.js +449 -0
- 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 +89 -2
- 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 +623 -2
- package/dist/types/types.d.ts +747 -143
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +546 -2
- package/dist/typings/knex.d.js +3 -2
- package/dist/utils/async-utils.d.ts +7 -0
- package/dist/utils/async-utils.d.ts.map +1 -1
- package/dist/utils/async-utils.js +57 -2
- package/dist/utils/console-util.d.ts +2 -0
- package/dist/utils/console-util.d.ts.map +1 -0
- package/dist/utils/console-util.js +6 -0
- package/dist/utils/controller.d.ts +1 -0
- package/dist/utils/controller.d.ts.map +1 -1
- package/dist/utils/controller.js +29 -2
- package/dist/utils/esm-utils.d.ts +39 -0
- package/dist/utils/esm-utils.d.ts.map +1 -0
- package/dist/utils/esm-utils.js +49 -0
- 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 +17 -2
- package/dist/utils/lodash-able.d.ts.map +1 -1
- package/dist/utils/lodash-able.js +6 -2
- package/dist/utils/model.js +22 -2
- 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 +89 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +60 -0
- package/dist/utils/process-utils.d.ts +13 -0
- package/dist/utils/process-utils.d.ts.map +1 -0
- package/dist/utils/process-utils.js +36 -0
- 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 +46 -2
- 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 +10 -7
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +72 -2
- 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 +19 -2
- package/package.json +65 -27
- 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 +178 -535
- package/src/api/config.ts +125 -0
- package/src/api/context.ts +7 -17
- package/src/api/decorators.ts +176 -46
- package/src/api/index.ts +2 -2
- package/src/api/sonamu.ts +190 -167
- package/src/api/validator.ts +83 -0
- package/src/bin/build-config.ts +8 -1
- package/src/bin/cli.ts +258 -124
- package/src/bin/hot-hook-register.ts +22 -0
- 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 +40 -96
- 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 +229 -148
- package/src/database/puri.types.ts +76 -30
- package/src/database/transaction-context.ts +1 -1
- package/src/database/upsert-builder.ts +262 -132
- package/src/entity/entity-manager.ts +48 -36
- package/src/entity/entity.ts +330 -248
- 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 -10
- package/src/migration/code-generation.ts +185 -172
- package/src/migration/migration-set.ts +80 -293
- package/src/migration/migrator.ts +199 -571
- 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 +415 -0
- package/src/shared/web.shared.ts.txt +20 -24
- package/src/stream/sse.ts +5 -5
- package/src/syncer/api-parser.ts +282 -0
- package/src/syncer/checksum.ts +140 -0
- package/src/syncer/code-generator.ts +198 -0
- package/src/syncer/entity-operations.ts +65 -0
- package/src/syncer/file-patterns.ts +56 -0
- package/src/syncer/index.ts +6 -0
- package/src/syncer/module-loader.ts +128 -0
- package/src/syncer/syncer.ts +389 -1453
- package/src/template/entity-converter.ts +114 -0
- package/src/template/helpers.ts +81 -0
- package/src/{templates → template/implementations}/entity.template.ts +7 -7
- package/src/{templates → template/implementations}/generated.template.ts +101 -101
- package/src/{templates → template/implementations}/generated_http.template.ts +27 -57
- package/src/template/implementations/generated_sso.template.ts +151 -0
- package/src/{templates → template/implementations}/init_types.template.ts +5 -7
- package/src/{templates → template/implementations}/model.template.ts +52 -43
- package/src/{templates → template/implementations}/model_test.template.ts +5 -5
- package/src/{templates → template/implementations}/service.template.ts +66 -82
- package/src/{templates → template/implementations}/view_enums_buttonset.template.ts +3 -3
- package/src/{templates → template/implementations}/view_enums_dropdown.template.ts +4 -20
- package/src/{templates → template/implementations}/view_enums_select.template.ts +4 -4
- package/src/{templates → template/implementations}/view_form.template.ts +40 -83
- package/src/{templates → template/implementations}/view_id_all_select.template.ts +3 -3
- package/src/{templates → template/implementations}/view_id_async_select.template.ts +10 -24
- package/src/{templates → template/implementations}/view_list.template.ts +60 -152
- package/src/{templates → template/implementations}/view_list_columns.template.ts +5 -11
- package/src/{templates → template/implementations}/view_search_input.template.ts +3 -3
- package/src/template/index.ts +6 -0
- package/src/template/template-manager.ts +166 -0
- package/src/template/template-types.ts +16 -0
- package/src/template/template.ts +105 -0
- package/src/template/zod-converter.ts +525 -0
- package/src/testing/_relation-graph.ts +18 -11
- package/src/testing/fixture-manager.ts +472 -359
- package/src/types/types.ts +553 -308
- package/src/typings/knex.d.ts +7 -9
- package/src/utils/async-utils.ts +23 -10
- package/src/utils/console-util.ts +4 -0
- package/src/utils/controller.ts +3 -0
- package/src/utils/esm-utils.ts +59 -0
- 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 +99 -0
- package/src/utils/process-utils.ts +46 -0
- package/src/utils/sql-parser.ts +23 -5
- package/src/utils/type-utils.ts +83 -0
- package/src/utils/utils.ts +66 -43
- package/src/utils/zod-error.ts +3 -4
- package/dist/api/base-frame.js.map +0 -1
- package/dist/api/caster.js.map +0 -1
- package/dist/api/code-converters.js.map +0 -1
- package/dist/api/context.js.map +0 -1
- package/dist/api/decorators.js.map +0 -1
- package/dist/api/index.js.map +0 -1
- package/dist/api/sonamu.js.map +0 -1
- package/dist/bin/build-config.js.map +0 -1
- 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 -3
- package/dist/bin/cli-wrapper.js.map +0 -1
- package/dist/bin/cli.js.map +0 -1
- package/dist/database/_batch_update.js.map +0 -1
- package/dist/database/base-model.js.map +0 -1
- package/dist/database/code-generator.js.map +0 -1
- package/dist/database/db.js.map +0 -1
- 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 -2
- package/dist/database/knex-plugins/knex-on-duplicate-update.js.map +0 -1
- package/dist/database/puri-wrapper.js.map +0 -1
- package/dist/database/puri.js.map +0 -1
- package/dist/database/puri.types.js.map +0 -1
- package/dist/database/transaction-context.js.map +0 -1
- package/dist/database/upsert-builder.js.map +0 -1
- package/dist/entity/entity-manager.js.map +0 -1
- 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 -2
- package/dist/entity/entity-utils.js.map +0 -1
- package/dist/entity/entity.js.map +0 -1
- package/dist/exceptions/error-handler.js.map +0 -1
- package/dist/exceptions/so-exceptions.js.map +0 -1
- package/dist/file-storage/driver.js.map +0 -1
- package/dist/file-storage/file-storage.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/migration/code-generation.js.map +0 -1
- package/dist/migration/migration-set.js.map +0 -1
- package/dist/migration/migrator.js.map +0 -1
- package/dist/migration/types.js.map +0 -1
- package/dist/stream/index.js.map +0 -1
- package/dist/stream/sse.js.map +0 -1
- package/dist/syncer/index.js.map +0 -1
- package/dist/syncer/syncer.js.map +0 -1
- package/dist/templates/base-template.d.ts +0 -13
- package/dist/templates/base-template.d.ts.map +0 -1
- package/dist/templates/base-template.js +0 -2
- package/dist/templates/base-template.js.map +0 -1
- package/dist/templates/entity.template.d.ts.map +0 -1
- package/dist/templates/entity.template.js +0 -2
- package/dist/templates/entity.template.js.map +0 -1
- package/dist/templates/generated.template.d.ts.map +0 -1
- package/dist/templates/generated.template.js +0 -2
- package/dist/templates/generated.template.js.map +0 -1
- package/dist/templates/generated_http.template.d.ts.map +0 -1
- package/dist/templates/generated_http.template.js +0 -2
- package/dist/templates/generated_http.template.js.map +0 -1
- package/dist/templates/generated_sso.template.d.ts.map +0 -1
- package/dist/templates/generated_sso.template.js +0 -2
- package/dist/templates/generated_sso.template.js.map +0 -1
- package/dist/templates/index.d.ts +0 -2
- package/dist/templates/index.d.ts.map +0 -1
- package/dist/templates/index.js +0 -2
- package/dist/templates/index.js.map +0 -1
- package/dist/templates/init_types.template.d.ts.map +0 -1
- package/dist/templates/init_types.template.js +0 -2
- package/dist/templates/init_types.template.js.map +0 -1
- package/dist/templates/model.template.d.ts +0 -17
- package/dist/templates/model.template.d.ts.map +0 -1
- package/dist/templates/model.template.js +0 -2
- package/dist/templates/model.template.js.map +0 -1
- package/dist/templates/model_test.template.d.ts.map +0 -1
- package/dist/templates/model_test.template.js +0 -2
- package/dist/templates/model_test.template.js.map +0 -1
- package/dist/templates/service.template.d.ts.map +0 -1
- package/dist/templates/service.template.js +0 -2
- package/dist/templates/service.template.js.map +0 -1
- package/dist/templates/view_enums_buttonset.template.d.ts.map +0 -1
- package/dist/templates/view_enums_buttonset.template.js +0 -2
- package/dist/templates/view_enums_buttonset.template.js.map +0 -1
- package/dist/templates/view_enums_dropdown.template.d.ts.map +0 -1
- package/dist/templates/view_enums_dropdown.template.js +0 -2
- package/dist/templates/view_enums_dropdown.template.js.map +0 -1
- package/dist/templates/view_enums_select.template.d.ts.map +0 -1
- package/dist/templates/view_enums_select.template.js +0 -2
- package/dist/templates/view_enums_select.template.js.map +0 -1
- package/dist/templates/view_form.template.d.ts.map +0 -1
- package/dist/templates/view_form.template.js +0 -2
- package/dist/templates/view_form.template.js.map +0 -1
- package/dist/templates/view_id_all_select.template.d.ts.map +0 -1
- package/dist/templates/view_id_all_select.template.js +0 -2
- package/dist/templates/view_id_all_select.template.js.map +0 -1
- package/dist/templates/view_id_async_select.template.d.ts.map +0 -1
- package/dist/templates/view_id_async_select.template.js +0 -2
- package/dist/templates/view_id_async_select.template.js.map +0 -1
- package/dist/templates/view_list.template.d.ts.map +0 -1
- package/dist/templates/view_list.template.js +0 -2
- package/dist/templates/view_list.template.js.map +0 -1
- package/dist/templates/view_list_columns.template.d.ts +0 -17
- package/dist/templates/view_list_columns.template.d.ts.map +0 -1
- package/dist/templates/view_list_columns.template.js +0 -2
- package/dist/templates/view_list_columns.template.js.map +0 -1
- package/dist/templates/view_search_input.template.d.ts.map +0 -1
- package/dist/templates/view_search_input.template.js +0 -2
- package/dist/templates/view_search_input.template.js.map +0 -1
- package/dist/testing/_relation-graph.js.map +0 -1
- package/dist/testing/fixture-manager.js.map +0 -1
- package/dist/types/types.js.map +0 -1
- package/dist/typings/knex.d.js.map +0 -1
- package/dist/utils/async-utils.js.map +0 -1
- package/dist/utils/controller.js.map +0 -1
- package/dist/utils/fs-utils.js.map +0 -1
- package/dist/utils/lodash-able.js.map +0 -1
- package/dist/utils/model.js.map +0 -1
- package/dist/utils/sql-parser.js.map +0 -1
- package/dist/utils/utils.js.map +0 -1
- package/dist/utils/zod-error.js.map +0 -1
- package/src/bin/cli-wrapper.ts +0 -75
- package/src/database/knex-plugins/knex-on-duplicate-update.ts +0 -45
- package/src/entity/entity-utils.ts +0 -291
- package/src/templates/base-template.ts +0 -19
- package/src/templates/generated_sso.template.ts +0 -138
- package/src/templates/index.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,wBAAsB,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAG7D;AAED,wBAAgB,eAAe,IAAI,YAAY,CAyB9C;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAEhE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,QAEvC;AAGD,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAKhF;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAKrE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAK1E;AAGD,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAExD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EACjC,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GACvB,CAAC,EAAE,CAGL;AAED,wBAAgB,cAAc,CAAC,CAAC,EAC9B,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAClC,CAAC,EAAE,CAEL"}
|
package/dist/utils/utils.js
CHANGED
|
@@ -1,2 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { cluster } from "radashi";
|
|
4
|
+
export async function findAppRootPath() {
|
|
5
|
+
const apiRootPath = findApiRootPath();
|
|
6
|
+
return apiRootPath.split(path.sep).slice(0, -1).join(path.sep);
|
|
7
|
+
}
|
|
8
|
+
export function findApiRootPath() {
|
|
9
|
+
// NOTE: for support npm / yarn / pnpm workspaces
|
|
10
|
+
// 하지만 workspace 쓰면 process.cwd() 하면 되는데... 이건 나중에 협의 후 수정하는걸로
|
|
11
|
+
const workspacePath = process.env.PNPM_SCRIPT_SRC_DIR ?? process.env.INIT_CWD;
|
|
12
|
+
if (nonNullable(workspacePath)) {
|
|
13
|
+
return workspacePath;
|
|
14
|
+
}
|
|
15
|
+
if (nonNullable(process.env.PNPM_PACKAGE_NAME)) {
|
|
16
|
+
return process.cwd().split(path.sep).join(path.sep);
|
|
17
|
+
}
|
|
18
|
+
const basePath = import.meta.filename;
|
|
19
|
+
let dir = path.dirname(basePath);
|
|
20
|
+
if (dir.includes("/.yarn/")) {
|
|
21
|
+
dir = dir.split("/.yarn/")[0];
|
|
22
|
+
}
|
|
23
|
+
do {
|
|
24
|
+
if (fs.existsSync(path.join(dir, "/package.json"))) {
|
|
25
|
+
return dir.split(path.sep).join(path.sep);
|
|
26
|
+
}
|
|
27
|
+
dir = dir.split(path.sep).slice(0, -1).join(path.sep);
|
|
28
|
+
}while (dir.split(path.sep).length > 1)
|
|
29
|
+
throw new Error("Cannot find AppRoot using Sonamu -2");
|
|
30
|
+
}
|
|
31
|
+
export function nonNullable(value) {
|
|
32
|
+
return value !== null && value !== undefined;
|
|
33
|
+
}
|
|
34
|
+
export function exhaustive(_param) {
|
|
35
|
+
throw new Error(`exhaustive`);
|
|
36
|
+
}
|
|
37
|
+
// 일반 버전
|
|
38
|
+
export function assertExists(value, message) {
|
|
39
|
+
if (value === null || value === undefined) {
|
|
40
|
+
throw new Error(message ?? "Value must exist");
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
// null만 체크
|
|
45
|
+
export function assertNotNull(value, message) {
|
|
46
|
+
if (value === null) {
|
|
47
|
+
throw new Error(message ?? "Value must not be null");
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
// undefined만 체크
|
|
52
|
+
export function assertDefined(value, message) {
|
|
53
|
+
if (value === undefined) {
|
|
54
|
+
throw new Error(message ?? "Value must be defined");
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
// lodash chunk 대체 (radash cluster 사용)
|
|
59
|
+
export function chunk(array, size) {
|
|
60
|
+
return cluster(array, Math.ceil(array.length / size));
|
|
61
|
+
}
|
|
62
|
+
// lodash intersectionBy 대체
|
|
63
|
+
export function intersectionBy(arr1, arr2, iteratee) {
|
|
64
|
+
const arr2Keys = new Set(arr2.map(iteratee));
|
|
65
|
+
return arr1.filter((item)=>arr2Keys.has(iteratee(item)));
|
|
66
|
+
}
|
|
67
|
+
// lodash differenceWith 대체
|
|
68
|
+
export function differenceWith(arr1, arr2, comparator) {
|
|
69
|
+
return arr1.filter((itemA)=>!arr2.some((itemB)=>comparator(itemA, itemB)));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy91dGlscy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgZnMgZnJvbSBcImZzXCI7XG5pbXBvcnQgcGF0aCBmcm9tIFwicGF0aFwiO1xuaW1wb3J0IHsgY2x1c3RlciB9IGZyb20gXCJyYWRhc2hpXCI7XG5pbXBvcnQgdHlwZSB7IEFic29sdXRlUGF0aCB9IGZyb20gXCIuL3BhdGgtdXRpbHNcIjtcblxuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIGZpbmRBcHBSb290UGF0aCgpOiBQcm9taXNlPEFic29sdXRlUGF0aD4ge1xuICBjb25zdCBhcGlSb290UGF0aCA9IGZpbmRBcGlSb290UGF0aCgpO1xuICByZXR1cm4gYXBpUm9vdFBhdGguc3BsaXQocGF0aC5zZXApLnNsaWNlKDAsIC0xKS5qb2luKHBhdGguc2VwKSBhcyBBYnNvbHV0ZVBhdGg7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBmaW5kQXBpUm9vdFBhdGgoK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TUMsV0FBVyxJQUFJQyxJQUFJSCxLQUFLSSxHQUFHLENBQUNIO0lBQ2xDLE9BQU9GLEtBQUtNLE1BQU0sQ0FBQyxDQUFDQyxPQUFTSixTQUFTSyxHQUFHLENBQUNOLFNBQVNLO0FBQ3JEO0FBQ0EsMkJBQTJCO0FBQzNCLE9BQU8sU0FBU0UsZUFDZFQsSUFBa0IsRUFDbEJDLElBQWtCLEVBQ2xCUyxVQUFtQztJQUVuQyxPQUFPVixLQUFLTSxNQUFNLENBQUMsQ0FBQ0ssUUFBVSxDQUFDVixLQUFLVyxJQUFJLENBQUMsQ0FBQ0MsUUFBVUgsV0FBV0MsT0FBT0U7QUFDeEUifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-error.d.ts","sourceRoot":"","sources":["../../src/utils/zod-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zod-error.d.ts","sourceRoot":"","sources":["../../src/utils/zod-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,eAAe,EAAE,CAgBrE"}
|
package/dist/utils/zod-error.js
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export function humanizeZodError(error) {
|
|
2
|
+
return error.issues.map(({ path: originPath, message })=>{
|
|
3
|
+
const path = originPath.map((item)=>{
|
|
4
|
+
if (typeof item === "symbol") {
|
|
5
|
+
return item.description ?? item.toString();
|
|
6
|
+
}
|
|
7
|
+
if (typeof item === "number") {
|
|
8
|
+
return `[${item}]`;
|
|
9
|
+
}
|
|
10
|
+
return item;
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
path,
|
|
14
|
+
message: message
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy96b2QtZXJyb3IudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyB6IH0gZnJvbSBcInpvZFwiO1xuXG50eXBlIFZhbGlkYXRpb25FcnJvciA9IHtcbiAgcGF0aDogc3RyaW5nW107XG4gIG1lc3NhZ2U6IHN0cmluZztcbn07XG5cbmV4cG9ydCBmdW5jdGlvbiBodW1hbml6ZVpvZEVycm9yKGVycm9yOiB6LlpvZEVycm9yKTogVmFsaWRhdGlvbkVycm9yW10ge1xuICByZXR1cm4gZXJyb3IuaXNzdWVzLm1hcCgoeyBwYXRoOiBvcmlnaW5QYXRoLCBtZXNzYWdlIH0pID0+IHtcbiAgICBjb25zdCBwYXRoID0gb3JpZ2luUGF0aC5tYXAoKGl0ZW0pID0+IHtcbiAgICAgIGlmICh0eXBlb2YgaXRlbSA9PT0gXCJzeW1ib2xcIikge1xuICAgICAgICByZXR1cm4gaXRlbS5kZXNjcmlwdGlvbiA/PyBpdGVtLnRvU3RyaW5nKCk7XG4gICAgICB9XG5cbiAgICAgIGlmICh0eXBlb2YgaXRlbSA9PT0gXCJudW1iZXJcIikge1xuICAgICAgICByZXR1cm4gYFske2l0ZW19XWA7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBpdGVtO1xuICAgIH0pO1xuXG4gICAgcmV0dXJuIHsgcGF0aCwgbWVzc2FnZTogbWVzc2FnZSB9O1xuICB9KTtcbn1cbiJdLCJuYW1lcyI6WyJodW1hbml6ZVpvZEVycm9yIiwiZXJyb3IiLCJpc3N1ZXMiLCJtYXAiLCJwYXRoIiwib3JpZ2luUGF0aCIsIm1lc3NhZ2UiLCJpdGVtIiwiZGVzY3JpcHRpb24iLCJ0b1N0cmluZyJdLCJtYXBwaW5ncyI6IkFBT0EsT0FBTyxTQUFTQSxpQkFBaUJDLEtBQWlCO0lBQ2hELE9BQU9BLE1BQU1DLE1BQU0sQ0FBQ0MsR0FBRyxDQUFDLENBQUMsRUFBRUMsTUFBTUMsVUFBVSxFQUFFQyxPQUFPLEVBQUU7UUFDcEQsTUFBTUYsT0FBT0MsV0FBV0YsR0FBRyxDQUFDLENBQUNJO1lBQzNCLElBQUksT0FBT0EsU0FBUyxVQUFVO2dCQUM1QixPQUFPQSxLQUFLQyxXQUFXLElBQUlELEtBQUtFLFFBQVE7WUFDMUM7WUFFQSxJQUFJLE9BQU9GLFNBQVMsVUFBVTtnQkFDNUIsT0FBTyxDQUFDLENBQUMsRUFBRUEsS0FBSyxDQUFDLENBQUM7WUFDcEI7WUFFQSxPQUFPQTtRQUNUO1FBRUEsT0FBTztZQUFFSDtZQUFNRSxTQUFTQTtRQUFRO0lBQ2xDO0FBQ0YifQ==
|
package/package.json
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonamu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Sonamu — TypeScript Fullstack API Framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
7
7
|
"framework",
|
|
8
8
|
"orm"
|
|
9
9
|
],
|
|
10
|
-
"
|
|
11
|
-
"exports":
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./ai": {
|
|
17
|
+
"import": "./dist/ai/index.js",
|
|
18
|
+
"types": "./dist/ai/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./ai/providers/rtzr": {
|
|
21
|
+
"import": "./dist/ai/providers/rtzr/index.js",
|
|
22
|
+
"types": "./dist/ai/providers/rtzr/index.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./loader-register": {
|
|
25
|
+
"default": "./dist/bin/loader-register.js"
|
|
26
|
+
},
|
|
27
|
+
"./hot-hook-register": {
|
|
28
|
+
"default": "./dist/bin/hot-hook-register.js"
|
|
29
|
+
}
|
|
16
30
|
},
|
|
17
31
|
"license": "MIT",
|
|
18
32
|
"author": {
|
|
@@ -24,66 +38,90 @@
|
|
|
24
38
|
"type": "git",
|
|
25
39
|
"url": "https://github.com/ping-alive/sonamu.git"
|
|
26
40
|
},
|
|
27
|
-
"bin": "./
|
|
41
|
+
"bin": "./bin/cli.js",
|
|
28
42
|
"files": [
|
|
29
43
|
"dist",
|
|
30
|
-
"src"
|
|
44
|
+
"src",
|
|
45
|
+
"bin",
|
|
46
|
+
".swcrc.project-default"
|
|
31
47
|
],
|
|
32
48
|
"dependencies": {
|
|
33
49
|
"@aws-sdk/client-s3": "^3.921.0",
|
|
34
50
|
"@aws-sdk/s3-request-presigner": "^3.921.0",
|
|
51
|
+
"@biomejs/js-api": "^4.0.0",
|
|
52
|
+
"@biomejs/wasm-nodejs": "^2.3.7",
|
|
35
53
|
"@fastify/cors": "^8.1.0",
|
|
36
54
|
"@fastify/formbody": "^7.1.0",
|
|
37
55
|
"@fastify/multipart": "^8",
|
|
38
56
|
"@fastify/passport": "^2.2.0",
|
|
39
|
-
"@fastify/secure-session": "^
|
|
57
|
+
"@fastify/secure-session": "^7",
|
|
40
58
|
"@fastify/static": "^7",
|
|
41
59
|
"@swc/core": "^1.13.19",
|
|
42
60
|
"chalk": "^4.1.2",
|
|
43
61
|
"chokidar": "^4.0.3",
|
|
44
|
-
"date-fns": "^4.1.0",
|
|
45
62
|
"date-fns-tz": "^3.2.0",
|
|
46
63
|
"dotenv": "^16.0.2",
|
|
47
64
|
"fast-deep-equal": "^3.1.3",
|
|
48
65
|
"fastify": "^4.23.2",
|
|
49
66
|
"fastify-qs": "^4.0.0",
|
|
50
67
|
"fastify-sse-v2": "^4.2.1",
|
|
51
|
-
"flydrive": "^1.3.0",
|
|
52
68
|
"inflection": "^1.13.2",
|
|
53
69
|
"knex": "^3.1.0",
|
|
54
|
-
"lodash": "^4.17.21",
|
|
55
|
-
"luxon": "^3.0.3",
|
|
56
70
|
"mime-types": "^3.0.1",
|
|
57
71
|
"minimatch": "^10.0.3",
|
|
58
|
-
"mysql2": "^3.6.1",
|
|
59
72
|
"node-sql-parser": "^5.2.0",
|
|
60
|
-
"
|
|
73
|
+
"pg": "^8.16.3",
|
|
61
74
|
"prompts": "^2.4.2",
|
|
62
75
|
"qs": "^6.11.0",
|
|
63
|
-
"
|
|
76
|
+
"radashi": "^12.2.0",
|
|
64
77
|
"tsicli": "^1.0.5",
|
|
65
|
-
"
|
|
78
|
+
"vitest": "^4.0.10",
|
|
79
|
+
"zod": "^4.1.12",
|
|
80
|
+
"@sonamu-kit/hot-runner": "^0.1.1",
|
|
81
|
+
"@sonamu-kit/loader": "^2.1.3",
|
|
82
|
+
"@sonamu-kit/hot-hook": "^0.4.1"
|
|
66
83
|
},
|
|
67
84
|
"devDependencies": {
|
|
68
|
-
"@
|
|
85
|
+
"@biomejs/biome": "^2.3.7",
|
|
69
86
|
"@swc/cli": "^0.7.8",
|
|
70
87
|
"@types/inflection": "^1.13.0",
|
|
71
|
-
"@types/lodash": "^4.14.198",
|
|
72
|
-
"@types/luxon": "^3.0.1",
|
|
73
88
|
"@types/mime-types": "^3.0.1",
|
|
74
89
|
"@types/node": "^22",
|
|
75
|
-
"@types/
|
|
90
|
+
"@types/pg": "^8.15.6",
|
|
76
91
|
"@types/prompts": "^2.0.14",
|
|
77
92
|
"@types/qs": "^6.9.7",
|
|
78
|
-
"
|
|
93
|
+
"nodemon": "3.1.10",
|
|
79
94
|
"tsup": "^8.1.0",
|
|
80
|
-
"typescript": "^5.
|
|
95
|
+
"typescript": "^5.9.3"
|
|
81
96
|
},
|
|
82
97
|
"peerDependencies": {
|
|
98
|
+
"@swc/cli": "^0.7.8",
|
|
99
|
+
"@swc/core": "^1.13.5",
|
|
83
100
|
"fastify": "^4.23.2",
|
|
84
101
|
"knex": "^3.1.0",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
102
|
+
"typescript": "^5.9.3",
|
|
103
|
+
"@ai-sdk/openai": "3.0.0-beta.75",
|
|
104
|
+
"@ai-sdk/provider": "3.0.0-beta.22",
|
|
105
|
+
"@ai-sdk/provider-utils": "4.0.0-beta.40",
|
|
106
|
+
"ai": "^6.0.0-beta.99"
|
|
107
|
+
},
|
|
108
|
+
"peerDependenciesMeta": {
|
|
109
|
+
"@ai-sdk/openai": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"@ai-sdk/provider": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"@ai-sdk/provider-utils": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"ai": {
|
|
119
|
+
"optional": true
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"scripts": {
|
|
123
|
+
"dev": "nodemon exec",
|
|
124
|
+
"build": "rm -rf dist && swc src -d dist --strip-leading-paths && tsc --emitDeclarationOnly",
|
|
125
|
+
"test:type": "vitest --typecheck test-d.ts"
|
|
88
126
|
}
|
|
89
127
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Tool, ToolCallOptions } from "@ai-sdk/provider-utils";
|
|
2
|
+
import { tool } from "@ai-sdk/provider-utils";
|
|
3
|
+
import type { Agent, ToolSet } from "ai";
|
|
4
|
+
import { ToolLoopAgent } from "ai";
|
|
5
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
6
|
+
import inflection from "inflection";
|
|
7
|
+
import type { AgentConfig, RegisteredToolDefinition, ToolDecoratorOptions } from "./types";
|
|
8
|
+
|
|
9
|
+
const toolDefinitions: RegisteredToolDefinition[] = [];
|
|
10
|
+
|
|
11
|
+
// TODO(Haze, 251205): 텍스트가 아닌 structured output일 경우에 대한 지원이 필요
|
|
12
|
+
export class BaseAgentClass<TStore> {
|
|
13
|
+
private _als = new AsyncLocalStorage<TStore>();
|
|
14
|
+
|
|
15
|
+
public get store() {
|
|
16
|
+
return this._als.getStore();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// NOTE: [schemaSymbol] 추론 불가로 인해 캐스팅
|
|
20
|
+
protected get toolSet() {
|
|
21
|
+
const targeted = toolDefinitions.filter((def) => def.from === this.constructor.name);
|
|
22
|
+
return targeted.reduce<Record<string, Tool>>((acc, def) => {
|
|
23
|
+
acc[def.name] = tool({
|
|
24
|
+
description: def.description,
|
|
25
|
+
inputSchema: def.schema.input,
|
|
26
|
+
outputSchema: def.schema.output,
|
|
27
|
+
needsApproval: def.needsApproval ?? false,
|
|
28
|
+
toModelOutput: def.toModelOutput,
|
|
29
|
+
providerOptions: def.providerOptions,
|
|
30
|
+
execute: (input: unknown, options: ToolCallOptions) => {
|
|
31
|
+
const bound = def.method.bind(this);
|
|
32
|
+
return bound.length >= 2 ? bound(input, options) : bound(input);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return acc;
|
|
36
|
+
}, {}) as ToolSet;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public get tools(): ToolSet {
|
|
40
|
+
return this.toolSet;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public use<TReturn>(
|
|
44
|
+
config: AgentConfig,
|
|
45
|
+
initialStatus: TStore,
|
|
46
|
+
callback: (agent: Agent<never, ToolSet>) => Promise<TReturn>,
|
|
47
|
+
) {
|
|
48
|
+
const agent = new ToolLoopAgent({
|
|
49
|
+
...config,
|
|
50
|
+
tools: this.tools,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return this._als.run(initialStatus, () => callback(agent));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function tools<INPUT, OUTPUT = unknown>(options: ToolDecoratorOptions<INPUT, OUTPUT>) {
|
|
58
|
+
const { name, description, schema, needsApproval, toModelOutput, providerOptions } = options;
|
|
59
|
+
return (target: BaseAgentClass<unknown>, propertyKey: string, descriptor: PropertyDescriptor) => {
|
|
60
|
+
if (!(target instanceof BaseAgentClass)) {
|
|
61
|
+
throw new Error("Target must be a subclass of BaseAgentClass");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const method = descriptor.value;
|
|
65
|
+
const modelName = target.constructor.name.match(/(.+)Class$/)?.[1];
|
|
66
|
+
const methodName = propertyKey;
|
|
67
|
+
|
|
68
|
+
const defaultPath =
|
|
69
|
+
modelName !== undefined
|
|
70
|
+
? `${inflection.camelize(
|
|
71
|
+
(modelName ?? "").replace(/Model$/, "").replace(/Frame$/, ""),
|
|
72
|
+
true,
|
|
73
|
+
)}.${inflection.camelize(methodName, true)}`
|
|
74
|
+
: inflection.camelize(methodName, true);
|
|
75
|
+
|
|
76
|
+
toolDefinitions.push({
|
|
77
|
+
name: name ?? defaultPath,
|
|
78
|
+
description,
|
|
79
|
+
schema,
|
|
80
|
+
needsApproval,
|
|
81
|
+
toModelOutput,
|
|
82
|
+
providerOptions,
|
|
83
|
+
method,
|
|
84
|
+
from: target.constructor.name,
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ProviderOptions, Schema, Tool } from "@ai-sdk/provider-utils";
|
|
2
|
+
import type { LanguageModel, StopCondition, ToolSet } from "ai";
|
|
3
|
+
|
|
4
|
+
export type ToolChoiceLimited = "auto" | "none" | "required";
|
|
5
|
+
|
|
6
|
+
export interface ToolDecoratorSchema<INPUT, OUTPUT = unknown> {
|
|
7
|
+
input: Schema<INPUT>;
|
|
8
|
+
output?: Schema<OUTPUT>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ToolDecoratorOptions<INPUT, OUTPUT = unknown> {
|
|
12
|
+
name?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
schema: ToolDecoratorSchema<INPUT, OUTPUT>;
|
|
15
|
+
needsApproval?: Tool<INPUT, OUTPUT>["needsApproval"];
|
|
16
|
+
toModelOutput?: Tool<INPUT, OUTPUT>["toModelOutput"];
|
|
17
|
+
providerOptions?: ProviderOptions;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type RegisteredToolDefinition = {
|
|
21
|
+
name: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
schema: ToolDecoratorSchema<unknown, unknown>;
|
|
24
|
+
needsApproval?: Tool["needsApproval"];
|
|
25
|
+
toModelOutput?: Tool["toModelOutput"];
|
|
26
|
+
providerOptions?: ProviderOptions;
|
|
27
|
+
method: (...args: unknown[]) => unknown;
|
|
28
|
+
from: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export interface AgentConfig {
|
|
32
|
+
model: LanguageModel;
|
|
33
|
+
instructions?: string;
|
|
34
|
+
toolChoice?: ToolChoiceLimited;
|
|
35
|
+
providerOptions?: ProviderOptions;
|
|
36
|
+
stopWhen?: StopCondition<ToolSet> | Array<StopCondition<ToolSet>>;
|
|
37
|
+
activeTools?: Array<string>;
|
|
38
|
+
maxOutputTokens?: number;
|
|
39
|
+
temperature?: number;
|
|
40
|
+
topP?: number;
|
|
41
|
+
topK?: number;
|
|
42
|
+
presencePenalty?: number;
|
|
43
|
+
frequencyPenalty?: number;
|
|
44
|
+
stopSequences?: string[];
|
|
45
|
+
seed?: number;
|
|
46
|
+
headers?: Record<string, string | undefined>;
|
|
47
|
+
}
|
package/src/ai/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./agents";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const rtzrAuthResponseSchema = z.object({
|
|
5
|
+
access_token: z.string(),
|
|
6
|
+
expire_at: z.number(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const rtzrTranscriptionResponseSchema = lazySchema(() =>
|
|
10
|
+
zodSchema(
|
|
11
|
+
z.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
}),
|
|
14
|
+
),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const rtzrTranscriptionResultResponseSchema = lazySchema(() =>
|
|
18
|
+
zodSchema(
|
|
19
|
+
z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
status: z.enum(["transcribing", "completed", "failed"]),
|
|
22
|
+
results: z
|
|
23
|
+
.object({
|
|
24
|
+
utterances: z.array(
|
|
25
|
+
z.object({
|
|
26
|
+
start_at: z.number(),
|
|
27
|
+
duration: z.number(),
|
|
28
|
+
msg: z.string(),
|
|
29
|
+
spk: z.number(),
|
|
30
|
+
lang: z.string().optional(),
|
|
31
|
+
}),
|
|
32
|
+
),
|
|
33
|
+
})
|
|
34
|
+
.nullish(),
|
|
35
|
+
}),
|
|
36
|
+
),
|
|
37
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AISDKError } from "@ai-sdk/provider";
|
|
2
|
+
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
export const rtzrErrorDataSchema = z.object({
|
|
6
|
+
error: z.object({
|
|
7
|
+
msg: z.string(),
|
|
8
|
+
type: z.string().nullish(),
|
|
9
|
+
param: z.any().nullish(),
|
|
10
|
+
code: z.union([z.string(), z.number()]).nullish(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type RtzrErrorData = z.infer<typeof rtzrErrorDataSchema>;
|
|
15
|
+
|
|
16
|
+
export const rtzrFailedResponseHandler = createJsonErrorResponseHandler({
|
|
17
|
+
errorSchema: rtzrErrorDataSchema,
|
|
18
|
+
errorToMessage: (data) => data.error.msg,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export class RtzrClientError extends AISDKError {
|
|
22
|
+
constructor(
|
|
23
|
+
message: string,
|
|
24
|
+
options?: {
|
|
25
|
+
cause?: Error;
|
|
26
|
+
},
|
|
27
|
+
) {
|
|
28
|
+
super({
|
|
29
|
+
name: "RtzrClientError",
|
|
30
|
+
message,
|
|
31
|
+
cause: options?.cause,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|