sonamu 0.8.26 → 0.9.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/bin/cli.js +60 -13
- package/dist/_virtual/rolldown_runtime.js +39 -0
- package/dist/ai/agents/agent.d.ts +3 -3
- package/dist/ai/agents/agent.d.ts.map +1 -1
- package/dist/ai/agents/agent.js +76 -73
- package/dist/ai/agents/index.js +3 -3
- package/dist/ai/agents/types.d.ts +3 -3
- package/dist/ai/agents/types.d.ts.map +1 -1
- package/dist/ai/agents/types.js +1 -3
- package/dist/ai/index.js +3 -2
- package/dist/ai/providers/rtzr/api.js +25 -25
- package/dist/ai/providers/rtzr/error.js +25 -26
- package/dist/ai/providers/rtzr/index.js +5 -5
- package/dist/ai/providers/rtzr/model.d.ts +1 -1
- package/dist/ai/providers/rtzr/model.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/model.js +117 -133
- package/dist/ai/providers/rtzr/options.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/options.js +35 -41
- package/dist/ai/providers/rtzr/provider.d.ts +1 -1
- package/dist/ai/providers/rtzr/provider.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/provider.js +53 -51
- package/dist/ai/providers/rtzr/utils.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/utils.js +84 -84
- 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 +29 -19
- package/dist/api/caster.d.ts +1 -1
- package/dist/api/caster.d.ts.map +1 -1
- package/dist/api/caster.js +51 -61
- package/dist/api/code-converters.d.ts +4 -3
- package/dist/api/code-converters.d.ts.map +1 -1
- package/dist/api/code-converters.js +226 -249
- package/dist/api/config.d.ts +17 -17
- package/dist/api/config.d.ts.map +1 -1
- package/dist/api/config.js +37 -30
- package/dist/api/context.d.ts +10 -10
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/context.js +8 -2
- package/dist/api/decorators.d.ts +8 -8
- package/dist/api/decorators.d.ts.map +1 -1
- package/dist/api/decorators.js +245 -268
- package/dist/api/index.js +39 -7
- package/dist/api/secret.js +22 -15
- package/dist/api/sonamu.d.ts +15 -15
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +1012 -1131
- package/dist/api/validator.js +88 -79
- package/dist/auth/auth-generator.d.ts.map +1 -1
- package/dist/auth/auth-generator.js +203 -200
- package/dist/auth/better-auth-entities.d.ts +2 -2
- package/dist/auth/better-auth-entities.d.ts.map +1 -1
- package/dist/auth/better-auth-entities.js +369 -429
- package/dist/auth/index.js +21 -6
- package/dist/auth/knex-adapter.d.ts +2 -2
- package/dist/auth/knex-adapter.d.ts.map +1 -1
- package/dist/auth/knex-adapter.js +153 -157
- package/dist/auth/plugins/entity-definitions/admin.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/admin.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/admin.js +58 -56
- package/dist/auth/plugins/entity-definitions/anonymous.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/anonymous.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/anonymous.js +20 -20
- package/dist/auth/plugins/entity-definitions/api-key.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/api-key.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/api-key.js +185 -196
- package/dist/auth/plugins/entity-definitions/index.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/index.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/index.js +26 -29
- package/dist/auth/plugins/entity-definitions/jwt.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/jwt.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/jwt.js +62 -64
- package/dist/auth/plugins/entity-definitions/organization.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/organization.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/organization.js +362 -421
- package/dist/auth/plugins/entity-definitions/passkey.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/passkey.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/passkey.js +115 -126
- package/dist/auth/plugins/entity-definitions/phone-number.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/phone-number.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/phone-number.js +31 -40
- package/dist/auth/plugins/entity-definitions/sso.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/sso.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/sso.js +94 -107
- package/dist/auth/plugins/entity-definitions/two-factor.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/two-factor.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/two-factor.js +78 -92
- package/dist/auth/plugins/entity-definitions/types.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/types.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/types.js +1 -10
- package/dist/auth/plugins/entity-definitions/username.d.ts +1 -1
- package/dist/auth/plugins/entity-definitions/username.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/username.js +31 -40
- package/dist/auth/plugins/index.js +12 -3
- package/dist/auth/plugins/wrappers/admin.d.ts +2 -2
- package/dist/auth/plugins/wrappers/admin.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/admin.js +28 -29
- package/dist/auth/plugins/wrappers/anonymous.d.ts +2 -1
- package/dist/auth/plugins/wrappers/anonymous.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/anonymous.js +23 -22
- package/dist/auth/plugins/wrappers/api-key.d.ts +2 -1
- package/dist/auth/plugins/wrappers/api-key.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/api-key.js +39 -34
- package/dist/auth/plugins/wrappers/index.js +11 -11
- package/dist/auth/plugins/wrappers/jwt.d.ts +2 -1
- package/dist/auth/plugins/wrappers/jwt.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/jwt.js +31 -26
- package/dist/auth/plugins/wrappers/organization.d.ts +2 -1
- package/dist/auth/plugins/wrappers/organization.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/organization.js +65 -62
- package/dist/auth/plugins/wrappers/passkey.d.ts +2 -1
- package/dist/auth/plugins/wrappers/passkey.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/passkey.js +33 -28
- package/dist/auth/plugins/wrappers/phone-number.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/phone-number.js +26 -23
- package/dist/auth/plugins/wrappers/sso.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/sso.js +37 -31
- package/dist/auth/plugins/wrappers/two-factor.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/two-factor.js +31 -28
- package/dist/auth/plugins/wrappers/username.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/username.js +23 -23
- package/dist/bin/build-config.js +31 -31
- package/dist/bin/cli.js +1063 -1204
- package/dist/bin/fixture.d.ts.map +1 -1
- package/dist/bin/fixture.js +266 -259
- package/dist/bin/hmr-hook-register.d.ts.map +1 -1
- package/dist/bin/hmr-hook-register.js +19 -18
- package/dist/bin/test-command.d.ts.map +1 -1
- package/dist/bin/test-command.js +180 -177
- package/dist/bin/ts-loader-register.js +13 -6
- package/dist/bin/ts-loader-registration.d.ts.map +1 -1
- package/dist/bin/ts-loader-registration.js +28 -38
- package/dist/cache/cache-manager.d.ts +1 -1
- package/dist/cache/cache-manager.d.ts.map +1 -1
- package/dist/cache/cache-manager.js +20 -15
- package/dist/cache/decorator.d.ts +1 -1
- package/dist/cache/decorator.d.ts.map +1 -1
- package/dist/cache/decorator.js +84 -76
- package/dist/cache/drivers.js +21 -34
- package/dist/cache/index.js +10 -7
- package/dist/cache/types.d.ts +2 -2
- package/dist/cache/types.d.ts.map +1 -1
- package/dist/cache/types.js +1 -6
- package/dist/cache-control/cache-control.d.ts +2 -2
- package/dist/cache-control/cache-control.d.ts.map +1 -1
- package/dist/cache-control/cache-control.js +106 -122
- package/dist/cache-control/types.d.ts +2 -2
- package/dist/cache-control/types.d.ts.map +1 -1
- package/dist/cache-control/types.js +1 -19
- package/dist/compress/compress.d.ts +1 -1
- package/dist/compress/compress.d.ts.map +1 -1
- package/dist/compress/compress.js +58 -56
- package/dist/compress/index.js +7 -2
- package/dist/compress/types.js +1 -11
- package/dist/cone/cone-generator.d.ts +1 -1
- package/dist/cone/cone-generator.d.ts.map +1 -1
- package/dist/cone/cone-generator.js +216 -219
- package/dist/database/_batch_update.d.ts +1 -1
- package/dist/database/_batch_update.d.ts.map +1 -1
- package/dist/database/_batch_update.js +107 -102
- package/dist/database/base-model.d.ts +8 -9
- package/dist/database/base-model.d.ts.map +1 -1
- package/dist/database/base-model.js +371 -392
- package/dist/database/base-model.types.d.ts +5 -5
- package/dist/database/base-model.types.d.ts.map +1 -1
- package/dist/database/base-model.types.js +1 -20
- package/dist/database/db.d.ts +5 -2
- package/dist/database/db.d.ts.map +1 -1
- package/dist/database/db.js +185 -171
- package/dist/database/knex.d.ts +1 -1
- package/dist/database/knex.d.ts.map +1 -1
- package/dist/database/knex.js +48 -42
- package/dist/database/puri-subset.types.d.ts +6 -7
- package/dist/database/puri-subset.types.d.ts.map +1 -1
- package/dist/database/puri-subset.types.js +1 -16
- package/dist/database/puri-wrapper.d.ts +6 -6
- package/dist/database/puri-wrapper.d.ts.map +1 -1
- package/dist/database/puri-wrapper.js +99 -101
- package/dist/database/puri.d.ts +4 -5
- package/dist/database/puri.d.ts.map +1 -1
- package/dist/database/puri.js +1021 -1227
- package/dist/database/puri.types.d.ts +6 -6
- package/dist/database/puri.types.d.ts.map +1 -1
- package/dist/database/puri.types.js +15 -6
- package/dist/database/transaction-context.d.ts +2 -2
- package/dist/database/transaction-context.d.ts.map +1 -1
- package/dist/database/transaction-context.js +22 -13
- package/dist/database/upsert-builder.d.ts +3 -3
- package/dist/database/upsert-builder.d.ts.map +1 -1
- package/dist/database/upsert-builder.js +405 -465
- package/dist/dict/en.js +72 -74
- package/dist/dict/index.js +13 -13
- package/dist/dict/ko.js +72 -74
- package/dist/dict/rc-keys.js +150 -168
- package/dist/dict/sd.d.ts +3 -1
- package/dist/dict/sd.d.ts.map +1 -1
- package/dist/dict/sd.js +54 -40
- package/dist/dict/sonamu-dictionary.d.ts +1 -1
- package/dist/dict/sonamu-dictionary.d.ts.map +1 -1
- package/dist/dict/sonamu-dictionary.js +887 -955
- package/dist/dict/types.js +1 -7
- package/dist/dict/utils.js +26 -24
- package/dist/entity/entity-manager.d.ts +9 -9
- package/dist/entity/entity-manager.d.ts.map +1 -1
- package/dist/entity/entity-manager.js +226 -223
- package/dist/entity/entity-template-cone.d.ts +1 -1
- package/dist/entity/entity-template-cone.d.ts.map +1 -1
- package/dist/entity/entity-template-cone.js +152 -151
- package/dist/entity/entity.d.ts.map +1 -1
- package/dist/entity/entity.js +952 -1089
- 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 +32 -27
- 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 +61 -68
- package/dist/filter/index.js +9 -3
- package/dist/filter/types.js +92 -88
- package/dist/filter/utils.d.ts +1 -1
- package/dist/filter/utils.d.ts.map +1 -1
- package/dist/filter/utils.js +147 -161
- package/dist/index.js +87 -40
- package/dist/logger/category.d.ts.map +1 -1
- package/dist/logger/category.js +30 -29
- package/dist/logger/configure.d.ts.map +1 -1
- package/dist/logger/configure.js +83 -107
- package/dist/migration/code-generation.d.ts +2 -2
- package/dist/migration/code-generation.d.ts.map +1 -1
- package/dist/migration/code-generation.js +1385 -1578
- package/dist/migration/migration-set.d.ts +1 -1
- package/dist/migration/migration-set.d.ts.map +1 -1
- package/dist/migration/migration-set.js +177 -227
- package/dist/migration/migrator.d.ts +4 -3
- package/dist/migration/migrator.d.ts.map +1 -1
- package/dist/migration/migrator.js +340 -345
- package/dist/migration/postgresql-schema-reader.d.ts +2 -2
- package/dist/migration/postgresql-schema-reader.d.ts.map +1 -1
- package/dist/migration/postgresql-schema-reader.js +506 -564
- package/dist/migration/slack-confirm.d.ts +2 -2
- package/dist/migration/slack-confirm.d.ts.map +1 -1
- package/dist/migration/slack-confirm.js +205 -193
- package/dist/migration/types.d.ts +2 -2
- package/dist/migration/types.d.ts.map +1 -1
- package/dist/migration/types.js +1 -3
- package/dist/naite/messaging-types.d.ts +1 -0
- package/dist/naite/messaging-types.d.ts.map +1 -1
- package/dist/naite/messaging-types.js +1 -7
- package/dist/naite/naite-reporter.d.ts +2 -2
- package/dist/naite/naite-reporter.d.ts.map +1 -1
- package/dist/naite/naite-reporter.js +127 -120
- package/dist/naite/naite.d.ts +3 -2
- package/dist/naite/naite.d.ts.map +1 -1
- package/dist/naite/naite.js +266 -300
- package/dist/ssr/index.d.ts +2 -2
- package/dist/ssr/index.d.ts.map +1 -1
- package/dist/ssr/index.js +13 -3
- package/dist/ssr/registry.d.ts +1 -1
- package/dist/ssr/registry.d.ts.map +1 -1
- package/dist/ssr/registry.js +45 -37
- package/dist/ssr/renderer.d.ts +4 -4
- package/dist/ssr/renderer.d.ts.map +1 -1
- package/dist/ssr/renderer.js +84 -91
- package/dist/ssr/types.d.ts +2 -2
- package/dist/ssr/types.d.ts.map +1 -1
- package/dist/ssr/types.js +1 -3
- package/dist/storage/base-file.js +54 -41
- package/dist/storage/buffered-file.d.ts +2 -2
- package/dist/storage/buffered-file.d.ts.map +1 -1
- package/dist/storage/buffered-file.js +51 -44
- package/dist/storage/drivers.d.ts +2 -2
- package/dist/storage/drivers.d.ts.map +1 -1
- package/dist/storage/drivers.js +12 -7
- package/dist/storage/index.js +14 -7
- package/dist/storage/s3-driver.d.ts +2 -2
- package/dist/storage/s3-driver.d.ts.map +1 -1
- package/dist/storage/s3-driver.js +52 -48
- package/dist/storage/storage-manager.d.ts +2 -2
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/storage-manager.js +33 -25
- package/dist/storage/types.d.ts +2 -2
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/types.js +1 -5
- package/dist/storage/uploaded-file.d.ts +1 -1
- package/dist/storage/uploaded-file.d.ts.map +1 -1
- package/dist/storage/uploaded-file.js +45 -35
- package/dist/stream/index.js +7 -2
- package/dist/stream/sse.d.ts +2 -2
- package/dist/stream/sse.d.ts.map +1 -1
- package/dist/stream/sse.js +72 -67
- package/dist/syncer/api-parser.d.ts +1 -1
- package/dist/syncer/api-parser.d.ts.map +1 -1
- package/dist/syncer/api-parser.js +224 -245
- package/dist/syncer/checksum.d.ts +1 -1
- package/dist/syncer/checksum.d.ts.map +1 -1
- package/dist/syncer/checksum.js +86 -72
- package/dist/syncer/code-generator.d.ts +2 -2
- package/dist/syncer/code-generator.d.ts.map +1 -1
- package/dist/syncer/code-generator.js +154 -160
- package/dist/syncer/entity-operations.d.ts +1 -1
- package/dist/syncer/entity-operations.d.ts.map +1 -1
- package/dist/syncer/entity-operations.js +63 -54
- 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 +38 -38
- package/dist/syncer/index.js +19 -8
- package/dist/syncer/module-loader.d.ts +5 -5
- package/dist/syncer/module-loader.d.ts.map +1 -1
- package/dist/syncer/module-loader.js +83 -78
- package/dist/syncer/syncer-actions.d.ts +2 -2
- package/dist/syncer/syncer-actions.d.ts.map +1 -1
- package/dist/syncer/syncer-actions.js +76 -91
- package/dist/syncer/syncer.d.ts +7 -6
- package/dist/syncer/syncer.d.ts.map +1 -1
- package/dist/syncer/syncer.js +426 -492
- package/dist/tasks/decorator.d.ts +3 -3
- package/dist/tasks/decorator.d.ts.map +1 -1
- package/dist/tasks/decorator.js +32 -28
- package/dist/tasks/step-wrapper.d.ts +1 -1
- package/dist/tasks/step-wrapper.d.ts.map +1 -1
- package/dist/tasks/step-wrapper.js +42 -41
- package/dist/tasks/workflow-manager.d.ts +2 -2
- package/dist/tasks/workflow-manager.d.ts.map +1 -1
- package/dist/tasks/workflow-manager.js +192 -221
- 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 +103 -103
- package/dist/template/helpers.d.ts.map +1 -1
- package/dist/template/helpers.js +163 -163
- package/dist/template/implementations/entity.template.d.ts +1 -1
- package/dist/template/implementations/entity.template.d.ts.map +1 -1
- package/dist/template/implementations/entity.template.js +76 -85
- package/dist/template/implementations/entry-server.template.d.ts +1 -1
- package/dist/template/implementations/entry-server.template.d.ts.map +1 -1
- package/dist/template/implementations/entry-server.template.js +32 -27
- package/dist/template/implementations/generated.template.d.ts +1 -1
- package/dist/template/implementations/generated.template.d.ts.map +1 -1
- package/dist/template/implementations/generated.template.js +254 -275
- package/dist/template/implementations/generated_http.template.d.ts +2 -2
- package/dist/template/implementations/generated_http.template.d.ts.map +1 -1
- package/dist/template/implementations/generated_http.template.js +114 -133
- package/dist/template/implementations/generated_sso.template.d.ts.map +1 -1
- package/dist/template/implementations/generated_sso.template.js +249 -275
- package/dist/template/implementations/init_types.template.d.ts +1 -1
- package/dist/template/implementations/init_types.template.d.ts.map +1 -1
- package/dist/template/implementations/init_types.template.js +40 -34
- package/dist/template/implementations/model.template.d.ts +1 -1
- package/dist/template/implementations/model.template.d.ts.map +1 -1
- package/dist/template/implementations/model.template.js +56 -53
- package/dist/template/implementations/model_test.template.d.ts +1 -1
- package/dist/template/implementations/model_test.template.d.ts.map +1 -1
- package/dist/template/implementations/model_test.template.js +32 -24
- package/dist/template/implementations/queries.template.d.ts +1 -1
- package/dist/template/implementations/queries.template.d.ts.map +1 -1
- package/dist/template/implementations/queries.template.js +84 -89
- package/dist/template/implementations/sd.template.d.ts +1 -1
- package/dist/template/implementations/sd.template.d.ts.map +1 -1
- package/dist/template/implementations/sd.template.js +137 -144
- package/dist/template/implementations/services.template.d.ts +1 -1
- package/dist/template/implementations/services.template.d.ts.map +1 -1
- package/dist/template/implementations/services.template.js +164 -189
- package/dist/template/implementations/view_form.template.d.ts +1 -1
- package/dist/template/implementations/view_form.template.d.ts.map +1 -1
- package/dist/template/implementations/view_form.template.js +258 -285
- package/dist/template/implementations/view_id_all_select.template.d.ts +1 -1
- package/dist/template/implementations/view_id_all_select.template.d.ts.map +1 -1
- package/dist/template/implementations/view_id_all_select.template.js +31 -25
- package/dist/template/implementations/view_list.template.d.ts +1 -1
- package/dist/template/implementations/view_list.template.d.ts.map +1 -1
- package/dist/template/implementations/view_list.template.js +304 -355
- package/dist/template/implementations/view_search_input.template.d.ts +1 -1
- package/dist/template/implementations/view_search_input.template.d.ts.map +1 -1
- package/dist/template/implementations/view_search_input.template.js +31 -27
- package/dist/template/index.js +21 -7
- package/dist/template/template-manager.d.ts +1 -1
- package/dist/template/template-manager.d.ts.map +1 -1
- package/dist/template/template-manager.js +132 -123
- package/dist/template/template-types.js +8 -6
- package/dist/template/template.d.ts +2 -2
- package/dist/template/template.d.ts.map +1 -1
- package/dist/template/template.js +73 -68
- package/dist/template/zod-converter.d.ts.map +1 -1
- package/dist/template/zod-converter.js +603 -657
- 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 +93 -88
- package/dist/testing/bootstrap.d.ts +22 -13
- package/dist/testing/bootstrap.d.ts.map +1 -1
- package/dist/testing/bootstrap.js +114 -114
- package/dist/testing/data-explorer.d.ts +3 -3
- package/dist/testing/data-explorer.d.ts.map +1 -1
- package/dist/testing/data-explorer.js +237 -265
- package/dist/testing/dev-test-routes.d.ts +2 -2
- package/dist/testing/dev-test-routes.d.ts.map +1 -1
- package/dist/testing/dev-test-routes.js +258 -249
- package/dist/testing/dev-vitest-manager.d.ts +1 -1
- package/dist/testing/dev-vitest-manager.d.ts.map +1 -1
- package/dist/testing/dev-vitest-manager.js +514 -539
- package/dist/testing/faker-mappings.js +422 -420
- package/dist/testing/fixture-generator.d.ts +3 -3
- package/dist/testing/fixture-generator.d.ts.map +1 -1
- package/dist/testing/fixture-generator.js +1216 -1346
- package/dist/testing/fixture-loader.js +26 -25
- package/dist/testing/fixture-manager.d.ts +3 -3
- package/dist/testing/fixture-manager.d.ts.map +1 -1
- package/dist/testing/fixture-manager.js +706 -776
- package/dist/testing/global-setup.js +53 -49
- package/dist/testing/index.js +19 -11
- package/dist/testing/naite-vitest-reporter.js +18 -13
- package/dist/testing/parallel-db-manager.d.ts +1 -1
- package/dist/testing/parallel-db-manager.d.ts.map +1 -1
- package/dist/testing/parallel-db-manager.js +63 -78
- package/dist/testing/vitest-helpers.d.ts +1 -1
- package/dist/testing/vitest-helpers.d.ts.map +1 -1
- package/dist/testing/vitest-helpers.js +37 -33
- package/dist/types/types.d.ts +28 -28
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +764 -890
- package/dist/ui/ai-api.d.ts +1 -1
- package/dist/ui/ai-api.d.ts.map +1 -1
- package/dist/ui/ai-api.js +52 -42
- package/dist/ui/ai-client.d.ts +1 -2
- package/dist/ui/ai-client.d.ts.map +1 -1
- package/dist/ui/ai-client.js +353 -388
- package/dist/ui/api.d.ts +1 -1
- package/dist/ui/api.d.ts.map +1 -1
- package/dist/ui/api.js +903 -1145
- package/dist/ui/cdd-service.d.ts +1 -1
- package/dist/ui/cdd-service.d.ts.map +1 -1
- package/dist/ui/cdd-service.js +406 -407
- package/dist/ui/cdd-types.js +1 -3
- package/dist/ui-web/assets/index-C-Zz-wYg.css +1 -0
- package/dist/ui-web/assets/index-DejDON8K.js +238 -0
- package/dist/ui-web/index.html +3 -3
- package/dist/utils/async-utils.js +57 -45
- package/dist/utils/console-util.d.ts.map +1 -1
- package/dist/utils/console-util.js +104 -87
- package/dist/utils/controller.js +26 -19
- package/dist/utils/esm-utils.js +49 -38
- package/dist/utils/formatter.d.ts +1 -2
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +89 -115
- package/dist/utils/fs-utils.d.ts.map +1 -1
- package/dist/utils/fs-utils.js +68 -65
- package/dist/utils/lodash-able.js +11 -4
- package/dist/utils/model.d.ts +1 -1
- package/dist/utils/model.d.ts.map +1 -1
- package/dist/utils/model.js +21 -19
- package/dist/utils/object-utils.js +148 -186
- package/dist/utils/path-utils.js +67 -57
- package/dist/utils/process-utils.d.ts.map +1 -1
- package/dist/utils/process-utils.js +37 -31
- package/dist/utils/sql-parser.d.ts +1 -1
- package/dist/utils/sql-parser.d.ts.map +1 -1
- package/dist/utils/sql-parser.js +40 -40
- package/dist/utils/type-utils.js +44 -43
- package/dist/utils/utils.d.ts +2 -3
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +81 -93
- 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 +24 -17
- package/dist/vector/chunking.d.ts +1 -1
- package/dist/vector/chunking.d.ts.map +1 -1
- package/dist/vector/chunking.js +100 -94
- package/dist/vector/config.d.ts +1 -1
- package/dist/vector/config.d.ts.map +1 -1
- package/dist/vector/config.js +76 -78
- package/dist/vector/embedding.d.ts +1 -1
- package/dist/vector/embedding.d.ts.map +1 -1
- package/dist/vector/embedding.js +128 -125
- package/dist/vector/index.js +5 -5
- package/dist/vector/types.js +1 -5
- package/package.json +31 -36
- package/src/ai/agents/agent.ts +12 -5
- package/src/ai/agents/types.ts +5 -5
- package/src/ai/providers/rtzr/model.ts +8 -10
- package/src/ai/providers/rtzr/options.ts +2 -1
- package/src/ai/providers/rtzr/provider.ts +5 -3
- package/src/ai/providers/rtzr/utils.ts +2 -7
- package/src/api/__tests__/config.test.ts +15 -8
- package/src/api/base-frame.ts +5 -3
- package/src/api/caster.ts +7 -6
- package/src/api/code-converters.ts +23 -26
- package/src/api/config.ts +23 -17
- package/src/api/context.ts +18 -11
- package/src/api/decorators.ts +17 -18
- package/src/api/sonamu.ts +44 -49
- package/src/auth/auth-generator.ts +4 -6
- package/src/auth/better-auth-entities.ts +3 -2
- package/src/auth/knex-adapter.ts +6 -5
- package/src/auth/plugins/entity-definitions/admin.ts +1 -1
- package/src/auth/plugins/entity-definitions/anonymous.ts +1 -1
- package/src/auth/plugins/entity-definitions/api-key.ts +1 -1
- package/src/auth/plugins/entity-definitions/index.ts +1 -1
- package/src/auth/plugins/entity-definitions/jwt.ts +1 -1
- package/src/auth/plugins/entity-definitions/organization.ts +1 -1
- package/src/auth/plugins/entity-definitions/passkey.ts +1 -1
- package/src/auth/plugins/entity-definitions/phone-number.ts +1 -1
- package/src/auth/plugins/entity-definitions/sso.ts +1 -1
- package/src/auth/plugins/entity-definitions/two-factor.ts +1 -1
- package/src/auth/plugins/entity-definitions/types.ts +1 -1
- package/src/auth/plugins/entity-definitions/username.ts +1 -1
- package/src/auth/plugins/wrappers/admin.ts +3 -1
- package/src/auth/plugins/wrappers/anonymous.ts +3 -1
- package/src/auth/plugins/wrappers/api-key.ts +3 -1
- package/src/auth/plugins/wrappers/jwt.ts +3 -1
- package/src/auth/plugins/wrappers/organization.ts +3 -1
- package/src/auth/plugins/wrappers/passkey.ts +3 -1
- package/src/auth/plugins/wrappers/phone-number.ts +3 -1
- package/src/auth/plugins/wrappers/sso.ts +2 -1
- package/src/auth/plugins/wrappers/two-factor.ts +3 -1
- package/src/auth/plugins/wrappers/username.ts +3 -1
- package/src/bin/__tests__/ts-loader-register.test.ts +7 -12
- package/src/bin/build-config.ts +3 -3
- package/src/bin/cli.ts +27 -25
- package/src/bin/fixture.ts +4 -2
- package/src/bin/hmr-hook-register.ts +1 -0
- package/src/bin/test-command.ts +4 -2
- package/src/bin/ts-loader-registration.ts +6 -22
- package/src/cache/cache-manager.ts +2 -1
- package/src/cache/decorator.ts +2 -2
- package/src/cache/types.ts +3 -3
- package/src/cache-control/cache-control.ts +3 -2
- package/src/cache-control/types.ts +2 -2
- package/src/compress/compress.ts +1 -1
- package/src/cone/cone-generator.ts +5 -3
- package/src/database/_batch_update.ts +1 -1
- package/src/database/base-model.ts +20 -14
- package/src/database/base-model.types.ts +12 -11
- package/src/database/db.ts +56 -21
- package/src/database/knex.ts +2 -2
- package/src/database/puri-subset.test-d.ts +33 -32
- package/src/database/puri-subset.types.ts +6 -7
- package/src/database/puri-wrapper.ts +29 -26
- package/src/database/puri.ts +36 -34
- package/src/database/puri.types.test-d.ts +6 -5
- package/src/database/puri.types.ts +9 -12
- package/src/database/transaction-context.ts +2 -2
- package/src/database/upsert-builder.ts +17 -10
- package/src/dict/sd.ts +17 -4
- package/src/dict/sonamu-dictionary.ts +23 -17
- package/src/entity/entity-manager.ts +9 -7
- package/src/entity/entity-template-cone.ts +10 -3
- package/src/entity/entity.ts +20 -16
- package/src/exceptions/error-handler.ts +2 -1
- package/src/exceptions/so-exceptions.ts +1 -1
- package/src/filter/utils.ts +3 -2
- package/src/logger/category.ts +1 -0
- package/src/logger/configure.ts +5 -5
- package/src/migration/__tests__/code-generation.search-text.test.ts +2 -3
- package/src/migration/code-generation.ts +26 -25
- package/src/migration/migration-set.ts +16 -18
- package/src/migration/migrator.ts +38 -33
- package/src/migration/postgresql-schema-reader.ts +12 -12
- package/src/migration/slack-confirm.ts +5 -4
- package/src/migration/types.ts +2 -2
- package/src/naite/messaging-types.ts +1 -1
- package/src/naite/naite-reporter.ts +5 -3
- package/src/naite/naite.ts +12 -7
- package/src/shared/app.shared.ts.txt +2 -2
- package/src/shared/web.shared.ts.txt +2 -2
- package/src/skills/AGENTS.md +19 -18
- package/src/skills/commands/sonamu-skills.md +9 -9
- package/src/skills/sonamu/SKILL.md +111 -104
- package/src/skills/sonamu/ai-agents.md +27 -26
- package/src/skills/sonamu/api.md +81 -69
- package/src/skills/sonamu/auth-migration.md +13 -27
- package/src/skills/sonamu/auth-plugins.md +41 -31
- package/src/skills/sonamu/auth.md +30 -24
- package/src/skills/sonamu/cdd.md +26 -17
- package/src/skills/sonamu/cone.md +50 -50
- package/src/skills/sonamu/config.md +74 -51
- package/src/skills/sonamu/create-sonamu.md +31 -19
- package/src/skills/sonamu/database.md +43 -26
- package/src/skills/sonamu/entity-basic.md +61 -61
- package/src/skills/sonamu/entity-relations.md +84 -80
- package/src/skills/sonamu/entity-validation-checklist.md +19 -15
- package/src/skills/sonamu/fixture-cli.md +52 -30
- package/src/skills/sonamu/framework-change.md +9 -7
- package/src/skills/sonamu/frontend.md +64 -82
- package/src/skills/sonamu/i18n.md +45 -37
- package/src/skills/sonamu/migration.md +54 -31
- package/src/skills/sonamu/model.md +98 -66
- package/src/skills/sonamu/naite.md +34 -32
- package/src/skills/sonamu/project-init.md +28 -8
- package/src/skills/sonamu/puri.md +82 -91
- package/src/skills/sonamu/scaffolding.md +44 -32
- package/src/skills/sonamu/skill-contribution.md +50 -45
- package/src/skills/sonamu/subset.md +13 -13
- package/src/skills/sonamu/tasks.md +73 -58
- package/src/skills/sonamu/testing-devrunner.md +56 -36
- package/src/skills/sonamu/testing.md +23 -58
- package/src/skills/sonamu/upsert.md +32 -31
- package/src/skills/sonamu/vector.md +37 -36
- package/src/ssr/index.ts +2 -12
- package/src/ssr/registry.ts +1 -1
- package/src/ssr/renderer.ts +7 -5
- package/src/ssr/types.ts +2 -2
- package/src/storage/buffered-file.ts +4 -2
- package/src/storage/drivers.ts +3 -2
- package/src/storage/s3-driver.ts +7 -4
- package/src/storage/storage-manager.ts +3 -2
- package/src/storage/types.ts +3 -2
- package/src/storage/uploaded-file.ts +1 -1
- package/src/stream/sse.ts +2 -2
- package/src/syncer/api-parser.ts +8 -5
- package/src/syncer/checksum.ts +9 -5
- package/src/syncer/code-generator.ts +16 -8
- package/src/syncer/entity-operations.ts +5 -3
- package/src/syncer/file-patterns.ts +2 -1
- package/src/syncer/module-loader.ts +9 -6
- package/src/syncer/syncer-actions.ts +5 -3
- package/src/syncer/syncer.ts +18 -24
- package/src/tasks/decorator.ts +10 -8
- package/src/tasks/step-wrapper.ts +1 -1
- package/src/tasks/workflow-manager.ts +18 -15
- package/src/template/__tests__/generated.template.search-text.test.ts +1 -0
- package/src/template/entity-converter.ts +4 -2
- package/src/template/generated.template.test-d.ts +2 -1
- package/src/template/helpers.ts +5 -2
- package/src/template/implementations/entity.template.ts +9 -8
- package/src/template/implementations/entry-server.template.ts +1 -1
- package/src/template/implementations/generated.template.ts +21 -29
- package/src/template/implementations/generated_http.template.ts +9 -6
- package/src/template/implementations/generated_sso.template.ts +6 -4
- package/src/template/implementations/init_types.template.ts +3 -2
- package/src/template/implementations/model.template.ts +4 -2
- package/src/template/implementations/model_test.template.ts +3 -2
- package/src/template/implementations/queries.template.ts +6 -14
- package/src/template/implementations/sd.template.ts +4 -2
- package/src/template/implementations/services.template.ts +7 -11
- package/src/template/implementations/view_form.template.ts +5 -3
- package/src/template/implementations/view_id_all_select.template.ts +3 -2
- package/src/template/implementations/view_list.template.ts +7 -5
- package/src/template/implementations/view_search_input.template.ts +3 -2
- package/src/template/template-manager.ts +4 -3
- package/src/template/template.ts +4 -3
- package/src/template/zod-converter.ts +10 -7
- package/src/testing/__tests__/dev-test-routes.test.ts +3 -2
- package/src/testing/__tests__/dev-vitest-manager.test.ts +1 -0
- package/src/testing/_relation-graph.ts +2 -2
- package/src/testing/bootstrap.ts +55 -27
- package/src/testing/data-explorer.ts +5 -4
- package/src/testing/dev-test-routes.ts +8 -5
- package/src/testing/dev-vitest-manager.ts +13 -12
- package/src/testing/fixture-generator.ts +11 -17
- package/src/testing/fixture-manager.ts +21 -17
- package/src/testing/parallel-db-manager.ts +2 -1
- package/src/testing/vitest-helpers.ts +2 -1
- package/src/types/__tests__/entity-json-schema-search-text.test.ts +1 -0
- package/src/types/types.ts +8 -8
- package/src/typings/knex.d.ts +4 -4
- package/src/ui/ai-api.ts +5 -3
- package/src/ui/ai-client.ts +6 -5
- package/src/ui/api.ts +25 -23
- package/src/ui/cdd-service.ts +12 -11
- package/src/utils/console-util.ts +3 -1
- package/src/utils/formatter.ts +94 -102
- package/src/utils/fs-utils.ts +2 -1
- package/src/utils/model.ts +2 -2
- package/src/utils/object-utils.ts +3 -3
- package/src/utils/process-utils.ts +2 -1
- package/src/utils/sql-parser.ts +10 -1
- package/src/utils/type-utils.ts +3 -3
- package/src/utils/utils.ts +9 -7
- package/src/utils/zod-error.ts +1 -1
- package/src/vector/chunking.ts +1 -1
- package/src/vector/config.ts +1 -1
- package/src/vector/embedding.ts +11 -9
- package/tsdown.api.config.ts +50 -0
- package/.swcrc.project-default +0 -18
- package/dist/api/__tests__/config.test.js +0 -189
- package/dist/bin/__tests__/test-command.test.js +0 -112
- package/dist/bin/__tests__/ts-loader-register.test.js +0 -45
- package/dist/database/puri-subset.test-d.js +0 -89
- package/dist/database/puri.types.test-d.js +0 -129
- package/dist/migration/__tests__/code-generation.search-text.test.js +0 -435
- package/dist/template/__tests__/generated.template.search-text.test.js +0 -99
- package/dist/template/generated.template.test-d.js +0 -24
- package/dist/testing/__tests__/dev-test-routes.test.js +0 -144
- package/dist/testing/__tests__/dev-vitest-manager.test.js +0 -152
- package/dist/types/__tests__/entity-json-schema-search-text.test.js +0 -256
- package/dist/typings/knex.d.js +0 -3
- package/dist/ui-web/assets/index-CKo0Z2Iu.css +0 -1
- package/dist/ui-web/assets/index-DK-2aacv.js +0 -257
|
@@ -23,23 +23,23 @@ pnpm create sonamu [project-name] --yes
|
|
|
23
23
|
|
|
24
24
|
### General Options
|
|
25
25
|
|
|
26
|
-
| Option
|
|
27
|
-
|
|
28
|
-
| `--yes`, `-y`
|
|
29
|
-
| `--skip-pnpm`
|
|
30
|
-
| `--skip-docker` | Skip Docker setup
|
|
31
|
-
| `--pnpm y/n`
|
|
32
|
-
| `--docker y/n`
|
|
26
|
+
| Option | Description | Default |
|
|
27
|
+
| --------------- | ----------------------------------- | ------- |
|
|
28
|
+
| `--yes`, `-y` | Use all options with default values | - |
|
|
29
|
+
| `--skip-pnpm` | Skip pnpm install | false |
|
|
30
|
+
| `--skip-docker` | Skip Docker setup | false |
|
|
31
|
+
| `--pnpm y/n` | Whether to install pnpm | y |
|
|
32
|
+
| `--docker y/n` | Whether to configure Docker | y |
|
|
33
33
|
|
|
34
34
|
### Docker/DB Options
|
|
35
35
|
|
|
36
|
-
| Option
|
|
37
|
-
|
|
38
|
-
| `--docker-project` | Docker project name | `[project-name]-docker`
|
|
39
|
-
| `--container-name` | Container name
|
|
40
|
-
| `--db-name`
|
|
41
|
-
| `--db-user`
|
|
42
|
-
| `--db-password`
|
|
36
|
+
| Option | Description | Default |
|
|
37
|
+
| ------------------ | ------------------- | -------------------------- |
|
|
38
|
+
| `--docker-project` | Docker project name | `[project-name]-docker` |
|
|
39
|
+
| `--container-name` | Container name | `[project-name]-container` |
|
|
40
|
+
| `--db-name` | Database name | `[project-name]` |
|
|
41
|
+
| `--db-user` | DB user | `postgres` |
|
|
42
|
+
| `--db-password` | DB password | `1234` |
|
|
43
43
|
|
|
44
44
|
## Usage Examples
|
|
45
45
|
|
|
@@ -97,20 +97,25 @@ pnpm create sonamu my_project \
|
|
|
97
97
|
## Next Steps After Creation
|
|
98
98
|
|
|
99
99
|
1. Start the DB container (if Docker was configured)
|
|
100
|
+
|
|
100
101
|
```bash
|
|
101
102
|
cd [project-name]/packages/api/
|
|
102
103
|
pnpm docker:up
|
|
103
104
|
```
|
|
105
|
+
|
|
104
106
|
> If a port conflict error occurs → see `database.md`
|
|
105
107
|
|
|
106
108
|
2. Sync Skills
|
|
109
|
+
|
|
107
110
|
```bash
|
|
108
111
|
cd [project-name]/packages/api
|
|
109
112
|
pnpm sonamu skills sync
|
|
110
113
|
```
|
|
114
|
+
|
|
111
115
|
> Will fail if sonamu is an npm version. See "Sonamu Link Setup" below.
|
|
112
116
|
|
|
113
117
|
3. Start the dev server
|
|
118
|
+
|
|
114
119
|
```bash
|
|
115
120
|
cd [project-name]/packages/api
|
|
116
121
|
pnpm dev
|
|
@@ -137,6 +142,7 @@ Check the sonamu dependency in `packages/api/package.json`:
|
|
|
137
142
|
### How to change to a link
|
|
138
143
|
|
|
139
144
|
1. Change the sonamu version to a link in `packages/api/package.json`:
|
|
145
|
+
|
|
140
146
|
```json
|
|
141
147
|
"dependencies": {
|
|
142
148
|
"sonamu": "link:/path/to/sonamu/modules/sonamu"
|
|
@@ -149,10 +155,10 @@ Check the sonamu dependency in `packages/api/package.json`:
|
|
|
149
155
|
|
|
150
156
|
### Link path examples
|
|
151
157
|
|
|
152
|
-
| sonamu location
|
|
153
|
-
|
|
154
|
-
| `~/Development/sonamu`
|
|
155
|
-
| Same directory as project | `link:../../sonamu/modules/sonamu`
|
|
158
|
+
| sonamu location | Link path |
|
|
159
|
+
| ------------------------- | ------------------------------------------ |
|
|
160
|
+
| `~/Development/sonamu` | `link:~/Development/sonamu/modules/sonamu` |
|
|
161
|
+
| Same directory as project | `link:../../sonamu/modules/sonamu` |
|
|
156
162
|
|
|
157
163
|
## Renaming the Project (when creating a new project)
|
|
158
164
|
|
|
@@ -161,28 +167,34 @@ After generating the project, you need to replace the "Sonamu" text in the front
|
|
|
161
167
|
**4 files to update:**
|
|
162
168
|
|
|
163
169
|
1. **`packages/web/index.html`** - Browser tab title
|
|
170
|
+
|
|
164
171
|
```html
|
|
165
172
|
<title>{project-name}</title>
|
|
166
173
|
```
|
|
167
174
|
|
|
168
175
|
2. **`packages/web/src/routes/__root.tsx`** - TanStack Router head configuration (most important!)
|
|
176
|
+
|
|
169
177
|
```typescript
|
|
170
178
|
head: () => ({
|
|
171
179
|
meta: [{ title: "{project-name}" }],
|
|
172
180
|
}),
|
|
173
181
|
```
|
|
182
|
+
|
|
174
183
|
**Important:** If you don't update `__root.tsx`, the title will revert to "Sonamu" on HMR!
|
|
175
184
|
|
|
176
185
|
3. **`packages/web/src/routes/index.tsx`** - Main page title
|
|
186
|
+
|
|
177
187
|
```tsx
|
|
178
|
-
<h1 className="text-2xl font-bold mb-4">Welcome to {project-name}</h1>
|
|
188
|
+
<h1 className="text-2xl font-bold mb-4">Welcome to {project - name}</h1>
|
|
179
189
|
```
|
|
180
190
|
|
|
181
191
|
4. **`packages/web/src/components/Sidebar.tsx`** - Sidebar app name
|
|
192
|
+
|
|
182
193
|
```typescript
|
|
183
194
|
const title = isAdmin ? "Admin" : "{project-name}";
|
|
184
195
|
```
|
|
185
196
|
|
|
186
197
|
**How to verify:**
|
|
198
|
+
|
|
187
199
|
- Check that the project name is shown in the browser tab
|
|
188
200
|
- Confirm that the tab title does not change on file save via HMR (if it does, `__root.tsx` is missing)
|
|
@@ -26,34 +26,40 @@ production/development master (actual DB)
|
|
|
26
26
|
|
|
27
27
|
### Role of Each DB
|
|
28
28
|
|
|
29
|
-
| DB
|
|
30
|
-
|
|
31
|
-
| `project`
|
|
29
|
+
| DB | Purpose | Data Source | Command |
|
|
30
|
+
| ----------------- | -------------------------------- | --------------------------------------------- | ------------------------------- |
|
|
31
|
+
| `project` | Production/development actual DB | Real user data | Created directly |
|
|
32
32
|
| `project_fixture` | Reference data store for testing | Fetched from production or generated with gen | `pnpm sonamu fixture gen/fetch` |
|
|
33
|
-
| `project_test`
|
|
33
|
+
| `project_test` | Test execution environment | Synced from fixture | `pnpm sonamu fixture sync` |
|
|
34
34
|
|
|
35
35
|
### Data Flow
|
|
36
36
|
|
|
37
37
|
**1. fixture fetch (fetch real data)**
|
|
38
|
+
|
|
38
39
|
```bash
|
|
39
40
|
pnpm sonamu fixture fetch --include User --limit 10
|
|
40
41
|
```
|
|
42
|
+
|
|
41
43
|
- production/development master → fixture DB
|
|
42
44
|
- Copies actual production data for testing
|
|
43
45
|
- Related data (FKs) is also fetched
|
|
44
46
|
|
|
45
47
|
**2. fixture gen (generate dummy data)**
|
|
48
|
+
|
|
46
49
|
```bash
|
|
47
50
|
pnpm sonamu fixture gen --include Department --count 5
|
|
48
51
|
```
|
|
52
|
+
|
|
49
53
|
- Generated inside fixture DB using faker
|
|
50
54
|
- Automatically resolves reference relationships (FKs)
|
|
51
55
|
- Supports Korean data generation
|
|
52
56
|
|
|
53
57
|
**3. fixture sync (sync test DB)**
|
|
58
|
+
|
|
54
59
|
```bash
|
|
55
60
|
pnpm sonamu fixture sync
|
|
56
61
|
```
|
|
62
|
+
|
|
57
63
|
- fixture DB → test DB
|
|
58
64
|
- Sync to the latest state before running tests
|
|
59
65
|
- Each test is isolated with a transaction that auto-rolls back
|
|
@@ -67,6 +73,7 @@ pnpm sonamu fixture sync
|
|
|
67
73
|
- Incorrect configuration causes FK reference errors
|
|
68
74
|
|
|
69
75
|
**Example (correct configuration)**:
|
|
76
|
+
|
|
70
77
|
```typescript
|
|
71
78
|
// fixture gen: reference and save within fixture DB
|
|
72
79
|
const fixtureDb = createKnexInstance(Sonamu.dbConfig.fixture);
|
|
@@ -90,10 +97,10 @@ Base data for testing (seed data) is managed by adding it to dump files.
|
|
|
90
97
|
|
|
91
98
|
Seed data management proceeds in 2 phases:
|
|
92
99
|
|
|
93
|
-
| Phase
|
|
94
|
-
|
|
100
|
+
| Phase | Purpose | Target DB |
|
|
101
|
+
| ----------- | ------------------------------------ | --------------------------------- |
|
|
95
102
|
| **Phase 1** | Prepare seed for development/testing | `project_test`, `project_fixture` |
|
|
96
|
-
| **Phase 2** | Apply seed to the actual DB
|
|
103
|
+
| **Phase 2** | Apply seed to the actual DB | `project` (actual DB) |
|
|
97
104
|
|
|
98
105
|
---
|
|
99
106
|
|
|
@@ -108,6 +115,7 @@ pnpm dump
|
|
|
108
115
|
```
|
|
109
116
|
|
|
110
117
|
The `database/scripts/dump.sql` generated at this point contains:
|
|
118
|
+
|
|
111
119
|
- CREATE TABLE statements
|
|
112
120
|
- CREATE SEQUENCE statements
|
|
113
121
|
- ALTER TABLE ... PRIMARY KEY
|
|
@@ -119,6 +127,7 @@ The `database/scripts/dump.sql` generated at this point contains:
|
|
|
119
127
|
Open `database/scripts/dump.sql` and add INSERT statements **before the FK CONSTRAINT** section.
|
|
120
128
|
|
|
121
129
|
**Important: Write in order considering FK dependency order**
|
|
130
|
+
|
|
122
131
|
```sql
|
|
123
132
|
-- Independent tables first
|
|
124
133
|
INSERT INTO public.institutions (id, created_at, name, code) VALUES
|
|
@@ -140,6 +149,7 @@ pnpm seed
|
|
|
140
149
|
```
|
|
141
150
|
|
|
142
151
|
`database/scripts/seed.sh` runs and:
|
|
152
|
+
|
|
143
153
|
- `SOURCE_DB="${DATABASE_NAME}_test"` → applies dump.sql to the test DB
|
|
144
154
|
|
|
145
155
|
#### 1-4. Sync to Fixture DB
|
|
@@ -155,11 +165,13 @@ Copies test DB data to the fixture DB.
|
|
|
155
165
|
### Phase 2: Apply Seed to Actual DB
|
|
156
166
|
|
|
157
167
|
**⚠️ CRITICAL WARNING:**
|
|
168
|
+
|
|
158
169
|
- This step inserts data into the actual DB (`project`)
|
|
159
170
|
- Existing data may be overwritten
|
|
160
171
|
- **You must confirm with the user before proceeding**
|
|
161
172
|
|
|
162
173
|
**Claude Code Rules:**
|
|
174
|
+
|
|
163
175
|
```
|
|
164
176
|
Before applying seed to the actual DB:
|
|
165
177
|
1. Ask the user: "Would you like to apply seed data to the actual database (project)?"
|
|
@@ -225,13 +237,13 @@ FIXTURE_DB="${DATABASE_NAME}_fixture" # restored
|
|
|
225
237
|
|
|
226
238
|
### Summary: Phase 1 vs Phase 2
|
|
227
239
|
|
|
228
|
-
| Item
|
|
229
|
-
|
|
230
|
-
| **Timing**
|
|
231
|
-
| **Dump count**
|
|
232
|
-
| **Target DB**
|
|
233
|
-
| **seed.sh**
|
|
234
|
-
| **User approval** | Not required
|
|
240
|
+
| Item | Phase 1 (Development/Testing) | Phase 2 (Actual DB) |
|
|
241
|
+
| ----------------- | --------------------------------------- | --------------------------------------------------- |
|
|
242
|
+
| **Timing** | Preparing test data during development | Preparing actual data after development is complete |
|
|
243
|
+
| **Dump count** | 1 time (table structure) | 2 times (includes data) |
|
|
244
|
+
| **Target DB** | `project_test` → `project_fixture` | `project` |
|
|
245
|
+
| **seed.sh** | `FIXTURE_DB="${DATABASE_NAME}_fixture"` | `FIXTURE_DB="${DATABASE_NAME}"` |
|
|
246
|
+
| **User approval** | Not required | **Required** |
|
|
235
247
|
|
|
236
248
|
---
|
|
237
249
|
|
|
@@ -288,7 +300,7 @@ ALTER TABLE ONLY public.companies ADD CONSTRAINT companies_pkey PRIMARY KEY (id)
|
|
|
288
300
|
CREATE INDEX projects_name_description_pgroonga_index ON public.projects ...;
|
|
289
301
|
|
|
290
302
|
-- 2024~: ALTER TABLE ... FOREIGN KEY (FK constraint - data must exist before this!)
|
|
291
|
-
ALTER TABLE ONLY public.departments
|
|
303
|
+
ALTER TABLE ONLY public.departments
|
|
292
304
|
ADD CONSTRAINT departments_company_id_foreign FOREIGN KEY (company_id) REFERENCES public.companies(id);
|
|
293
305
|
```
|
|
294
306
|
|
|
@@ -296,10 +308,10 @@ ALTER TABLE ONLY public.departments
|
|
|
296
308
|
|
|
297
309
|
**Seed data must be added before FK CONSTRAINTs.**
|
|
298
310
|
|
|
299
|
-
| Position
|
|
300
|
-
|
|
301
|
-
| Before FK CONSTRAINT | OK - FK check after data insertion
|
|
302
|
-
| After FK CONSTRAINT
|
|
311
|
+
| Position | Result |
|
|
312
|
+
| -------------------- | -------------------------------------------------------- |
|
|
313
|
+
| Before FK CONSTRAINT | OK - FK check after data insertion |
|
|
314
|
+
| After FK CONSTRAINT | FAIL - FK violation because referenced table has no data |
|
|
303
315
|
|
|
304
316
|
### Table Dependency Order
|
|
305
317
|
|
|
@@ -330,11 +342,11 @@ SELECT pg_catalog.setval('public.departments_id_seq', 5, true);
|
|
|
330
342
|
|
|
331
343
|
```sql
|
|
332
344
|
-- institutions (independent)
|
|
333
|
-
INSERT INTO public.institutions (id, created_at, name, code) VALUES
|
|
345
|
+
INSERT INTO public.institutions (id, created_at, name, code) VALUES
|
|
334
346
|
(1, '2024-01-01 00:00:00+09', 'Headquarters', 'HQ');
|
|
335
347
|
|
|
336
348
|
-- departments (references institutions)
|
|
337
|
-
INSERT INTO public.departments (id, created_at, name, code, institution_id, is_active) VALUES
|
|
349
|
+
INSERT INTO public.departments (id, created_at, name, code, institution_id, is_active) VALUES
|
|
338
350
|
(1, '2024-01-01 00:00:00+09', 'Research', 'RND', 1, true);
|
|
339
351
|
|
|
340
352
|
-- Set sequences
|
|
@@ -357,6 +369,7 @@ docker ps --format "table {{.Names}}\t{{.Ports}}"
|
|
|
357
369
|
### Step 2: Compare Container Names
|
|
358
370
|
|
|
359
371
|
**Check the current project's container name:**
|
|
372
|
+
|
|
360
373
|
```bash
|
|
361
374
|
# Check CONTAINER_NAME in packages/api/.env
|
|
362
375
|
cat packages/api/.env | grep CONTAINER_NAME
|
|
@@ -381,6 +394,7 @@ Another project is using the same port. The new project's port must be changed.
|
|
|
381
394
|
**Two files to modify:**
|
|
382
395
|
|
|
383
396
|
1. `packages/api/.env`
|
|
397
|
+
|
|
384
398
|
```bash
|
|
385
399
|
# Before
|
|
386
400
|
DB_PORT=5432
|
|
@@ -390,6 +404,7 @@ DB_PORT=5433
|
|
|
390
404
|
```
|
|
391
405
|
|
|
392
406
|
2. `packages/api/database/docker-compose.yml`
|
|
407
|
+
|
|
393
408
|
```yaml
|
|
394
409
|
# Before
|
|
395
410
|
ports:
|
|
@@ -401,6 +416,7 @@ ports:
|
|
|
401
416
|
```
|
|
402
417
|
|
|
403
418
|
3. `packages/api/src/sonamu.config.ts`
|
|
419
|
+
|
|
404
420
|
```typescript
|
|
405
421
|
// Before
|
|
406
422
|
port: 5432,
|
|
@@ -410,6 +426,7 @@ port: 5433,
|
|
|
410
426
|
```
|
|
411
427
|
|
|
412
428
|
**Port Selection Guide:**
|
|
429
|
+
|
|
413
430
|
- PostgreSQL default port: 5432
|
|
414
431
|
- Available range: 5433 ~ 5439
|
|
415
432
|
- Check currently used ports with `docker ps` and choose a number that is not duplicated
|
|
@@ -422,11 +439,11 @@ pnpm docker:up
|
|
|
422
439
|
|
|
423
440
|
## DB Connection Configuration Files
|
|
424
441
|
|
|
425
|
-
| File
|
|
426
|
-
|
|
427
|
-
| `packages/api/.env`
|
|
428
|
-
| `packages/api/database/docker-compose.yml` | Docker container configuration
|
|
429
|
-
| `packages/api/src/sonamu.config.ts`
|
|
442
|
+
| File | Purpose |
|
|
443
|
+
| ------------------------------------------ | ------------------------------------------------------- |
|
|
444
|
+
| `packages/api/.env` | Environment variables (DB_HOST, DB_PORT, DB_USER, etc.) |
|
|
445
|
+
| `packages/api/database/docker-compose.yml` | Docker container configuration |
|
|
446
|
+
| `packages/api/src/sonamu.config.ts` | Sonamu DB connection configuration |
|
|
430
447
|
|
|
431
448
|
## .env Default Settings
|
|
432
449
|
|
|
@@ -216,12 +216,12 @@ A top-level option used when a child entity is managed as a dependent of a paren
|
|
|
216
216
|
|
|
217
217
|
### When to use parentId
|
|
218
218
|
|
|
219
|
-
| Situation
|
|
220
|
-
|
|
221
|
-
| Cannot exist without a parent
|
|
222
|
-
| Created and deleted together with parent | Yes
|
|
223
|
-
| Can be independently CRUD'd
|
|
224
|
-
| Can belong to multiple parents
|
|
219
|
+
| Situation | parentId | Example |
|
|
220
|
+
| ---------------------------------------- | -------- | ---------------------------------- |
|
|
221
|
+
| Cannot exist without a parent | Yes | OrderItem → Order |
|
|
222
|
+
| Created and deleted together with parent | Yes | Chapter → Course, Lesson → Chapter |
|
|
223
|
+
| Can be independently CRUD'd | No | Comment → Post |
|
|
224
|
+
| Can belong to multiple parents | No | Tag → Post (ManyToMany) |
|
|
225
225
|
|
|
226
226
|
### parentId usage example
|
|
227
227
|
|
|
@@ -243,12 +243,12 @@ Child entities with parentId set (e.g., Chapter, Lesson) do not get their own `t
|
|
|
243
243
|
|
|
244
244
|
Child entities with parentId must be placed **in the same folder as the root parent entity**.
|
|
245
245
|
|
|
246
|
-
| Structure
|
|
247
|
-
|
|
248
|
-
| `course/course.entity.json`
|
|
249
|
-
| `course/chapter.entity.json` | parentId: "Course" → same folder
|
|
250
|
-
| `course/lesson.entity.json`
|
|
251
|
-
| `course/course.types.ts`
|
|
246
|
+
| Structure | Description |
|
|
247
|
+
| ---------------------------- | ------------------------------------------------- |
|
|
248
|
+
| `course/course.entity.json` | Root entity |
|
|
249
|
+
| `course/chapter.entity.json` | parentId: "Course" → same folder |
|
|
250
|
+
| `course/lesson.entity.json` | parentId: "Chapter" → same folder (based on root) |
|
|
251
|
+
| `course/course.types.ts` | types.ts generated only for root |
|
|
252
252
|
|
|
253
253
|
**Note:** Do not create child entities in a separate folder (e.g., `chapter/chapter.entity.json`).
|
|
254
254
|
|
|
@@ -344,8 +344,8 @@ Sonamu's `ubUpsert` uses PostgreSQL `ON CONFLICT ... DO UPDATE`, so **all requir
|
|
|
344
344
|
// example
|
|
345
345
|
{
|
|
346
346
|
"props": [
|
|
347
|
-
{ "name": "title", "type": "string" },
|
|
348
|
-
{ "name": "content", "type": "string" },
|
|
347
|
+
{ "name": "title", "type": "string" }, // required (no nullable)
|
|
348
|
+
{ "name": "content", "type": "string" }, // required (no nullable)
|
|
349
349
|
{ "name": "category", "type": "string", "nullable": true } // optional
|
|
350
350
|
]
|
|
351
351
|
}
|
|
@@ -382,7 +382,7 @@ A dedicated prop type that consolidates multiple columns into a single generated
|
|
|
382
382
|
"props": [
|
|
383
383
|
{ "name": "title_ko", "type": "string" },
|
|
384
384
|
{ "name": "title_en", "type": "string" },
|
|
385
|
-
{ "name": "tags",
|
|
385
|
+
{ "name": "tags", "type": "string[]" },
|
|
386
386
|
{
|
|
387
387
|
"name": "search_text",
|
|
388
388
|
"type": "searchText",
|
|
@@ -406,10 +406,10 @@ A dedicated prop type that consolidates multiple columns into a single generated
|
|
|
406
406
|
|
|
407
407
|
SQL expressions per source column type:
|
|
408
408
|
|
|
409
|
-
| source type
|
|
410
|
-
|
|
411
|
-
| `string`
|
|
412
|
-
| `string[]`
|
|
409
|
+
| source type | caseInsensitive: true | caseInsensitive: false (default) |
|
|
410
|
+
| ---------------------------- | ----------------------------- | ------------------------------------ |
|
|
411
|
+
| `string` | `lower(COALESCE(col, ''))` | `COALESCE(col, '')` |
|
|
412
|
+
| `string[]` | `sonamu_text_array_agg(col)` | `sonamu_text_array_agg(col, false)` |
|
|
413
413
|
| `json` (z.array(z.string())) | `sonamu_jsonb_array_agg(col)` | `sonamu_jsonb_array_agg(col, false)` |
|
|
414
414
|
|
|
415
415
|
- If a `string[]` or `json(string[])` source is present, helper function DDL is automatically inserted in the migration
|
|
@@ -440,9 +440,9 @@ SQL expressions per source column type:
|
|
|
440
440
|
|
|
441
441
|
**The way FK columns are referenced differs between indexes and subsets. Do not confuse them.**
|
|
442
442
|
|
|
443
|
-
| Location
|
|
444
|
-
|
|
445
|
-
| `indexes` | Actual DB column name
|
|
443
|
+
| Location | Format | Example |
|
|
444
|
+
| --------- | -------------------------- | ------------------------------------- |
|
|
445
|
+
| `indexes` | Actual DB column name | `role_id`, `user_id`, `department_id` |
|
|
446
446
|
| `subsets` | FieldExpr (relation.field) | `role.id`, `user.id`, `department.id` |
|
|
447
447
|
|
|
448
448
|
**DO NOT:**
|
|
@@ -476,20 +476,20 @@ Not a technical decision — ask **"What if the same combination is inserted twi
|
|
|
476
476
|
|
|
477
477
|
## Common Mistakes
|
|
478
478
|
|
|
479
|
-
| Mistake
|
|
480
|
-
|
|
481
|
-
| Missing `id` prop
|
|
482
|
-
| Missing `created_at` prop
|
|
483
|
-
| Missing `OrderBy` enum
|
|
484
|
-
| Missing `SearchField` enum
|
|
485
|
-
| enum prop `id` not defined in enums
|
|
486
|
-
| Missing `id` on json prop
|
|
487
|
-
| Using `"type": "text"` directly
|
|
488
|
-
| Adding multiple values to `OrderBy` enum
|
|
489
|
-
| Defining fixed-choice fields as `string`
|
|
490
|
-
| Yearly/mapping tables without unique constraints | Add composite unique based on business rules
|
|
491
|
-
| Using `number` type for integer fields
|
|
492
|
-
| Using `role.id` format in indexes
|
|
479
|
+
| Mistake | Fix |
|
|
480
|
+
| ------------------------------------------------ | ------------------------------------------------------------------------------------- |
|
|
481
|
+
| Missing `id` prop | Recommended to add (needed by most Model logic) |
|
|
482
|
+
| Missing `created_at` prop | Recommended to add with `dbDefault: "CURRENT_TIMESTAMP"` |
|
|
483
|
+
| Missing `OrderBy` enum | Add `{EntityId}OrderBy` (needed for findMany sorting) |
|
|
484
|
+
| Missing `SearchField` enum | Add `{EntityId}SearchField` (needed for search) |
|
|
485
|
+
| enum prop `id` not defined in enums | Add definition to the enums section |
|
|
486
|
+
| Missing `id` on json prop | Add the `id` field |
|
|
487
|
+
| Using `"type": "text"` directly | `text` is invalid. Use `"type": "string"` without a length |
|
|
488
|
+
| Adding multiple values to `OrderBy` enum | **Default is `id-desc` only** (see below) |
|
|
489
|
+
| Defining fixed-choice fields as `string` | Convert to enum (check for fields with arrayElement-style fixtureGenerator) |
|
|
490
|
+
| Yearly/mapping tables without unique constraints | Add composite unique based on business rules |
|
|
491
|
+
| Using `number` type for integer fields | Use `integer` (use `numeric` only when decimal precision is needed) |
|
|
492
|
+
| Using `role.id` format in indexes | indexes use actual DB column name (`role_id`); only subsets use FieldExpr (`role.id`) |
|
|
493
493
|
|
|
494
494
|
## Resolving Entity Schema Validation Errors
|
|
495
495
|
|
|
@@ -556,10 +556,10 @@ PostgreSQL mapping:
|
|
|
556
556
|
- `integer` → DB `integer` (whole numbers)
|
|
557
557
|
- `number` → DB `numeric(p,s)` (precise decimal numbers)
|
|
558
558
|
|
|
559
|
-
| Use case
|
|
560
|
-
|
|
561
|
-
| PK, FK, count, order, quantity
|
|
562
|
-
| Amount, ratio, values requiring decimal | `number` (+ `precision`, `scale`) | price, rate, weight, score
|
|
559
|
+
| Use case | Entity type | Example |
|
|
560
|
+
| --------------------------------------- | --------------------------------- | -------------------------------- |
|
|
561
|
+
| PK, FK, count, order, quantity | `integer` | id, user_id, order_num, quantity |
|
|
562
|
+
| Amount, ratio, values requiring decimal | `number` (+ `precision`, `scale`) | price, rate, weight, score |
|
|
563
563
|
|
|
564
564
|
**DO NOT:**
|
|
565
565
|
|
|
@@ -586,30 +586,30 @@ PostgreSQL mapping:
|
|
|
586
586
|
|
|
587
587
|
Options applicable to all prop types:
|
|
588
588
|
|
|
589
|
-
| Option
|
|
590
|
-
|
|
591
|
-
| `name`
|
|
592
|
-
| `desc`
|
|
593
|
-
| `nullable` | boolean | Whether NULL is allowed (default: false)
|
|
594
|
-
| `toFilter` | true
|
|
595
|
-
| `cone`
|
|
589
|
+
| Option | Type | Description |
|
|
590
|
+
| ---------- | ------- | --------------------------------------------------------- |
|
|
591
|
+
| `name` | string | Field name (required) |
|
|
592
|
+
| `desc` | string | Field description |
|
|
593
|
+
| `nullable` | boolean | Whether NULL is allowed (default: false) |
|
|
594
|
+
| `toFilter` | true | Register as a sonamuFilter filtering target. See model.md |
|
|
595
|
+
| `cone` | Cone | LLM-based fixture generation metadata. See cone.md |
|
|
596
596
|
|
|
597
597
|
## Required Options by Type
|
|
598
598
|
|
|
599
|
-
| Type
|
|
600
|
-
|
|
601
|
-
| `string`
|
|
602
|
-
| `integer`
|
|
603
|
-
| `bigInteger` | —
|
|
604
|
-
| `number`
|
|
605
|
-
| `numeric`
|
|
606
|
-
| `enum`
|
|
607
|
-
| `json`
|
|
608
|
-
| `date`
|
|
609
|
-
| `boolean`
|
|
610
|
-
| `virtual`
|
|
611
|
-
| `vector`
|
|
612
|
-
| `tsvector`
|
|
599
|
+
| Type | Required | Optional |
|
|
600
|
+
| ------------ | ------------ | ------------------------------------------------------------------ |
|
|
601
|
+
| `string` | — | `length` (text if omitted), `zodFormat` (email, uuid, etc.) |
|
|
602
|
+
| `integer` | — | — |
|
|
603
|
+
| `bigInteger` | — | — |
|
|
604
|
+
| `number` | — | `precision`, `scale`, `numberType` (real/double precision/numeric) |
|
|
605
|
+
| `numeric` | — | `precision`, `scale` |
|
|
606
|
+
| `enum` | `id` | `nullable`, `dbDefault`, `length` |
|
|
607
|
+
| `json` | `id` | `dbDefault: "{}"` |
|
|
608
|
+
| `date` | — | `dbDefault`, `precision` |
|
|
609
|
+
| `boolean` | — | `dbDefault: "false"` |
|
|
610
|
+
| `virtual` | `id` | `virtualType` (query/code, default: code) |
|
|
611
|
+
| `vector` | `dimensions` | — |
|
|
612
|
+
| `tsvector` | — | — |
|
|
613
613
|
|
|
614
614
|
## IMPORTANT: ENUM Type dbDefault Setting
|
|
615
615
|
|