sonamu 0.10.12 → 0.11.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/dist/ai/agents/agent.d.ts +1 -1
- package/dist/ai/agents/agent.d.ts.map +1 -1
- package/dist/ai/agents/agent.js +5 -6
- package/dist/ai/agents/types.d.ts +1 -1
- package/dist/ai/agents/types.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/api.js +18 -18
- package/dist/ai/providers/rtzr/error.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/error.js +17 -15
- package/dist/ai/providers/rtzr/model.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/model.js +3 -2
- package/dist/ai/providers/rtzr/options.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/options.js +16 -16
- package/dist/ai/providers/rtzr/provider.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/provider.js +9 -9
- package/dist/ai/providers/rtzr/utils.d.ts.map +1 -1
- package/dist/ai/providers/rtzr/utils.js +1 -1
- package/dist/api/base-frame.d.ts.map +1 -1
- package/dist/api/caster.d.ts.map +1 -1
- package/dist/api/caster.js +17 -17
- package/dist/api/code-converters.d.ts +4 -2
- package/dist/api/code-converters.d.ts.map +1 -1
- package/dist/api/code-converters.js +100 -19
- package/dist/api/config.d.ts +16 -1
- package/dist/api/config.d.ts.map +1 -1
- package/dist/api/config.js +28 -21
- package/dist/api/context.d.ts +2 -2
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/context.js +1 -1
- package/dist/api/decorators.d.ts.map +1 -1
- package/dist/api/decorators.js +18 -11
- package/dist/api/http-validator.d.ts +36 -0
- package/dist/api/http-validator.d.ts.map +1 -0
- package/dist/api/http-validator.js +72 -0
- package/dist/api/index.js +6 -4
- package/dist/api/sonamu.d.ts +59 -20
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +252 -107
- package/dist/api/validator.d.ts.map +1 -1
- package/dist/api/websocket-helpers.d.ts +7 -5
- package/dist/api/websocket-helpers.d.ts.map +1 -1
- package/dist/api/websocket-helpers.js +6 -6
- package/dist/auth/audit-log/builders.d.ts.map +1 -1
- package/dist/auth/audit-log/builders.js +1 -1
- package/dist/auth/audit-log/client-ip.d.ts +1 -1
- package/dist/auth/audit-log/client-ip.d.ts.map +1 -1
- package/dist/auth/audit-log/client-ip.js +4 -2
- package/dist/auth/audit-log/events.d.ts +5 -1
- package/dist/auth/audit-log/events.d.ts.map +1 -1
- package/dist/auth/audit-log/events.js +1 -1
- package/dist/auth/audit-log/plugin.d.ts +0 -8
- package/dist/auth/audit-log/plugin.d.ts.map +1 -1
- package/dist/auth/audit-log/plugin.js +48 -52
- package/dist/auth/audit-log-ingestor.d.ts.map +1 -1
- package/dist/auth/audit-log-ingestor.js +16 -12
- package/dist/auth/auth-generator.d.ts.map +1 -1
- package/dist/auth/auth-generator.js +1 -1
- package/dist/auth/better-auth-request.d.ts.map +1 -1
- package/dist/auth/better-auth-request.js +6 -5
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -3
- package/dist/auth/knex-adapter.d.ts.map +1 -1
- package/dist/auth/knex-adapter.js +1 -1
- package/dist/auth/plugins/entity-definitions/index.d.ts +13 -1
- package/dist/auth/plugins/entity-definitions/index.d.ts.map +1 -1
- package/dist/auth/plugins/entity-definitions/index.js +1 -1
- package/dist/auth/plugins/wrappers/admin.d.ts +4 -4
- package/dist/auth/plugins/wrappers/admin.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/anonymous.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/api-key.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/jwt.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/organization.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/passkey.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/phone-number.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/sso.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/two-factor.d.ts.map +1 -1
- package/dist/auth/plugins/wrappers/username.d.ts.map +1 -1
- package/dist/bin/build-config.d.ts +35 -0
- package/dist/bin/build-config.d.ts.map +1 -1
- package/dist/bin/build-config.js +232 -5
- package/dist/bin/compiler-policy.d.ts +3 -0
- package/dist/bin/compiler-policy.d.ts.map +1 -0
- package/dist/bin/compiler-policy.js +24 -0
- package/dist/bin/fixture.d.ts +7 -4
- package/dist/bin/fixture.d.ts.map +1 -1
- package/dist/bin/fixture.js +165 -15
- package/dist/bin/test-command.d.ts +29 -1
- package/dist/bin/test-command.d.ts.map +1 -1
- package/dist/bin/test-command.js +33 -11
- package/dist/bin/ts-loader-registration.d.ts +7 -1
- package/dist/bin/ts-loader-registration.d.ts.map +1 -1
- package/dist/bin/ts-loader-registration.js +13 -4
- package/dist/bin/typecheck-web.d.ts +2 -0
- package/dist/bin/typecheck-web.d.ts.map +1 -0
- package/dist/bin/typecheck-web.js +36 -0
- package/dist/cache/decorator.d.ts.map +1 -1
- package/dist/cache/decorator.js +11 -4
- package/dist/cache/drivers.d.ts.map +1 -1
- package/dist/cache-control/cache-control.d.ts.map +1 -1
- package/dist/compress/compress.d.ts.map +1 -1
- package/dist/compress/compress.js +1 -1
- package/dist/cone/cone-generator.d.ts +14 -1
- package/dist/cone/cone-generator.d.ts.map +1 -1
- package/dist/cone/cone-generator.js +14 -10
- package/dist/database/_batch_update.js +1 -1
- package/dist/database/base-model.d.ts +22 -10
- package/dist/database/base-model.d.ts.map +1 -1
- package/dist/database/base-model.js +26 -16
- package/dist/database/base-model.types.d.ts +15 -4
- package/dist/database/base-model.types.d.ts.map +1 -1
- package/dist/database/db.d.ts +12 -2
- package/dist/database/db.d.ts.map +1 -1
- package/dist/database/db.js +10 -7
- package/dist/database/knex.d.ts.map +1 -1
- package/dist/database/knex.js +17 -14
- package/dist/database/puri-subset.types.d.ts +0 -1
- package/dist/database/puri-subset.types.d.ts.map +1 -1
- package/dist/database/puri-wrapper.d.ts +0 -1
- package/dist/database/puri-wrapper.d.ts.map +1 -1
- package/dist/database/puri.d.ts +11 -10
- package/dist/database/puri.d.ts.map +1 -1
- package/dist/database/puri.js +93 -79
- package/dist/database/puri.types.d.ts +21 -22
- package/dist/database/puri.types.d.ts.map +1 -1
- package/dist/database/puri.types.js +1 -1
- package/dist/database/transaction-context.d.ts.map +1 -1
- package/dist/database/upsert-builder.d.ts +12 -10
- package/dist/database/upsert-builder.d.ts.map +1 -1
- package/dist/database/upsert-builder.js +20 -12
- package/dist/dict/en.d.ts +58 -58
- package/dist/dict/en.d.ts.map +1 -1
- package/dist/dict/ko.d.ts +58 -58
- package/dist/dict/ko.d.ts.map +1 -1
- package/dist/dict/rc-keys.d.ts.map +1 -1
- package/dist/dict/sd.d.ts.map +1 -1
- package/dist/dict/sd.js +1 -1
- package/dist/dict/sonamu-dictionary.d.ts.map +1 -1
- package/dist/dict/sonamu-dictionary.js +2 -2
- package/dist/dict/utils.d.ts.map +1 -1
- package/dist/dict/utils.js +7 -2
- package/dist/entity/entity-manager.d.ts +126 -115
- package/dist/entity/entity-manager.d.ts.map +1 -1
- package/dist/entity/entity-manager.js +42 -28
- package/dist/entity/entity-template-cone.d.ts +73 -5
- package/dist/entity/entity-template-cone.d.ts.map +1 -1
- package/dist/entity/entity-template-cone.js +4 -2
- package/dist/entity/entity.d.ts +12 -3
- package/dist/entity/entity.d.ts.map +1 -1
- package/dist/entity/entity.js +37 -30
- package/dist/env.d.ts +3 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -1
- package/dist/exceptions/error-handler.d.ts.map +1 -1
- package/dist/exceptions/error-handler.js +7 -2
- package/dist/exceptions/so-exceptions.d.ts +24 -20
- package/dist/exceptions/so-exceptions.d.ts.map +1 -1
- package/dist/exceptions/so-exceptions.js +4 -2
- package/dist/filter/types.d.ts.map +1 -1
- package/dist/filter/utils.d.ts +7 -2
- package/dist/filter/utils.d.ts.map +1 -1
- package/dist/filter/utils.js +8 -6
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -11
- package/dist/logger/configure.d.ts +10 -1
- package/dist/logger/configure.d.ts.map +1 -1
- package/dist/logger/configure.js +39 -14
- package/dist/migration/code-generation.d.ts.map +1 -1
- package/dist/migration/code-generation.js +50 -46
- package/dist/migration/index-where-predicate.d.ts.map +1 -1
- package/dist/migration/index-where-predicate.js +22 -8
- package/dist/migration/migration-set.d.ts.map +1 -1
- package/dist/migration/migration-set.js +1 -1
- package/dist/migration/migrator.d.ts +15 -3
- package/dist/migration/migrator.d.ts.map +1 -1
- package/dist/migration/migrator.js +102 -49
- package/dist/migration/postgresql-schema-reader.d.ts.map +1 -1
- package/dist/migration/postgresql-schema-reader.js +51 -36
- package/dist/migration/slack-confirm.d.ts.map +1 -1
- package/dist/migration/slack-confirm.js +1 -1
- package/dist/naite/messaging-types.d.ts +0 -1
- package/dist/naite/messaging-types.d.ts.map +1 -1
- package/dist/naite/naite-reporter.d.ts +0 -1
- package/dist/naite/naite-reporter.d.ts.map +1 -1
- package/dist/naite/naite-reporter.js +2 -2
- package/dist/naite/naite.d.ts +74 -15
- package/dist/naite/naite.d.ts.map +1 -1
- package/dist/naite/naite.js +5 -19
- package/dist/runtime-type.d.ts +6 -0
- package/dist/runtime-type.d.ts.map +1 -0
- package/dist/runtime-type.js +26 -0
- package/dist/ssr/hmr-opt-out.d.ts +26 -0
- package/dist/ssr/hmr-opt-out.d.ts.map +1 -0
- package/dist/ssr/hmr-opt-out.js +59 -0
- package/dist/ssr/renderer.d.ts.map +1 -1
- package/dist/ssr/renderer.js +4 -1
- package/dist/storage/base-file.d.ts.map +1 -1
- package/dist/storage/base-file.js +14 -14
- 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 +12 -12
- package/dist/storage/drivers.d.ts.map +1 -1
- package/dist/storage/s3-driver.d.ts.map +1 -1
- package/dist/storage/s3-driver.js +1 -1
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/uploaded-file.d.ts +2 -2
- package/dist/storage/uploaded-file.d.ts.map +1 -1
- package/dist/storage/uploaded-file.js +8 -8
- package/dist/stream/sse.js +11 -11
- package/dist/stream/ws-audience-resolver.d.ts.map +1 -1
- package/dist/stream/ws-audience.d.ts.map +1 -1
- package/dist/stream/ws-cluster-bus.d.ts.map +1 -1
- package/dist/stream/ws-core.d.ts +1 -1
- package/dist/stream/ws-core.d.ts.map +1 -1
- package/dist/stream/ws-delivery.d.ts +1 -1
- package/dist/stream/ws-delivery.d.ts.map +1 -1
- package/dist/stream/ws-delivery.js +6 -4
- package/dist/stream/ws-local-connection-store.d.ts.map +1 -1
- package/dist/stream/ws-local-connection-store.js +4 -2
- package/dist/stream/ws-presence-store.d.ts.map +1 -1
- package/dist/stream/ws-presence-store.js +1 -1
- package/dist/stream/ws-registry.d.ts +4 -4
- package/dist/stream/ws-registry.d.ts.map +1 -1
- package/dist/stream/ws-registry.js +4 -2
- package/dist/stream/ws-telemetry-memory.d.ts.map +1 -1
- package/dist/stream/ws-telemetry.d.ts +16 -12
- package/dist/stream/ws-telemetry.d.ts.map +1 -1
- package/dist/stream/ws-telemetry.js +22 -18
- package/dist/stream/ws.d.ts +18 -12
- package/dist/stream/ws.d.ts.map +1 -1
- package/dist/stream/ws.js +26 -22
- package/dist/syncer/api-parser.js +2 -2
- package/dist/syncer/checksum.d.ts.map +1 -1
- package/dist/syncer/checksum.js +7 -8
- package/dist/syncer/code-generator.d.ts.map +1 -1
- package/dist/syncer/code-generator.js +13 -14
- package/dist/syncer/entity-operations.d.ts.map +1 -1
- package/dist/syncer/entity-operations.js +5 -6
- package/dist/syncer/file-copy.d.ts +5 -0
- package/dist/syncer/file-copy.d.ts.map +1 -0
- package/dist/syncer/file-copy.js +36 -0
- package/dist/syncer/file-patterns.d.ts +17 -16
- package/dist/syncer/file-patterns.d.ts.map +1 -1
- package/dist/syncer/file-patterns.js +5 -2
- package/dist/syncer/file-tracking.d.ts.map +1 -1
- package/dist/syncer/file-tracking.js +5 -4
- package/dist/syncer/filesystem-dependencies.d.ts +15 -0
- package/dist/syncer/filesystem-dependencies.d.ts.map +1 -0
- package/dist/syncer/filesystem-dependencies.js +53 -0
- package/dist/syncer/module-loader.d.ts +1 -1
- package/dist/syncer/module-loader.d.ts.map +1 -1
- package/dist/syncer/module-loader.js +6 -4
- package/dist/syncer/syncer-actions.d.ts +4 -0
- package/dist/syncer/syncer-actions.d.ts.map +1 -1
- package/dist/syncer/syncer-actions.js +34 -17
- package/dist/syncer/syncer.d.ts +17 -6
- package/dist/syncer/syncer.d.ts.map +1 -1
- package/dist/syncer/syncer.js +71 -29
- package/dist/syncer/watcher.d.ts.map +1 -1
- package/dist/syncer/watcher.js +3 -3
- package/dist/tasks/decorator.d.ts +6 -6
- package/dist/tasks/decorator.d.ts.map +1 -1
- package/dist/tasks/decorator.js +4 -4
- package/dist/tasks/step-wrapper.d.ts +6 -4
- package/dist/tasks/step-wrapper.d.ts.map +1 -1
- package/dist/tasks/step-wrapper.js +5 -5
- package/dist/tasks/workflow-manager.d.ts.map +1 -1
- package/dist/tasks/workflow-manager.js +13 -7
- 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 +2 -2
- package/dist/template/helpers.d.ts +8 -6
- package/dist/template/helpers.d.ts.map +1 -1
- package/dist/template/helpers.js +1 -1
- package/dist/template/implementations/entity.template.d.ts +2 -2
- package/dist/template/implementations/entity.template.d.ts.map +1 -1
- package/dist/template/implementations/entry-server.template.d.ts +2 -2
- package/dist/template/implementations/entry-server.template.d.ts.map +1 -1
- package/dist/template/implementations/generated.template.d.ts +2 -2
- package/dist/template/implementations/generated.template.d.ts.map +1 -1
- package/dist/template/implementations/generated.template.js +4 -4
- package/dist/template/implementations/generated_http.template.d.ts +9 -6
- package/dist/template/implementations/generated_http.template.d.ts.map +1 -1
- package/dist/template/implementations/generated_http.template.js +21 -21
- package/dist/template/implementations/generated_sso.template.d.ts +2 -2
- package/dist/template/implementations/generated_sso.template.d.ts.map +1 -1
- package/dist/template/implementations/generated_sso.template.js +6 -3
- package/dist/template/implementations/http_validators.template.d.ts +18 -0
- package/dist/template/implementations/http_validators.template.d.ts.map +1 -0
- package/dist/template/implementations/http_validators.template.js +127 -0
- package/dist/template/implementations/init_types.template.d.ts +2 -2
- package/dist/template/implementations/init_types.template.d.ts.map +1 -1
- package/dist/template/implementations/model.template.d.ts +2 -2
- package/dist/template/implementations/model.template.d.ts.map +1 -1
- package/dist/template/implementations/model.template.js +1 -1
- package/dist/template/implementations/model_test.template.d.ts +2 -2
- package/dist/template/implementations/model_test.template.d.ts.map +1 -1
- package/dist/template/implementations/queries.template.d.ts +2 -2
- package/dist/template/implementations/queries.template.d.ts.map +1 -1
- package/dist/template/implementations/queries.template.js +1 -1
- package/dist/template/implementations/sd.template.d.ts +2 -2
- package/dist/template/implementations/sd.template.d.ts.map +1 -1
- package/dist/template/implementations/sd.template.js +80 -40
- package/dist/template/implementations/services.template.d.ts +2 -2
- package/dist/template/implementations/services.template.d.ts.map +1 -1
- package/dist/template/implementations/services.template.js +6 -4
- package/dist/template/implementations/view_form.template.d.ts +9 -4
- package/dist/template/implementations/view_form.template.d.ts.map +1 -1
- package/dist/template/implementations/view_form.template.js +23 -15
- package/dist/template/implementations/view_id_all_select.template.d.ts +2 -2
- package/dist/template/implementations/view_id_all_select.template.d.ts.map +1 -1
- package/dist/template/implementations/view_list.template.d.ts +2 -2
- package/dist/template/implementations/view_list.template.d.ts.map +1 -1
- package/dist/template/implementations/view_list.template.js +11 -6
- package/dist/template/implementations/view_search_input.template.d.ts +2 -2
- package/dist/template/implementations/view_search_input.template.d.ts.map +1 -1
- package/dist/template/template-manager.d.ts.map +1 -1
- package/dist/template/template-manager.js +9 -7
- package/dist/template/template-types.d.ts +12 -5
- package/dist/template/template-types.d.ts.map +1 -1
- package/dist/template/template-types.js +1 -1
- package/dist/template/template.d.ts +2 -2
- package/dist/template/template.d.ts.map +1 -1
- package/dist/template/template.js +6 -4
- package/dist/template/zod-converter.d.ts +0 -19
- package/dist/template/zod-converter.d.ts.map +1 -1
- package/dist/template/zod-converter.js +100 -84
- package/dist/testing/_relation-graph.d.ts.map +1 -1
- package/dist/testing/_relation-graph.js +2 -1
- package/dist/testing/bootstrap.d.ts.map +1 -1
- package/dist/testing/bootstrap.js +9 -6
- package/dist/testing/data-explorer.d.ts +32 -7
- package/dist/testing/data-explorer.d.ts.map +1 -1
- package/dist/testing/data-explorer.js +77 -31
- package/dist/testing/dev-test-routes.d.ts +8 -1
- package/dist/testing/dev-test-routes.d.ts.map +1 -1
- package/dist/testing/dev-test-routes.js +125 -108
- package/dist/testing/dev-vitest-manager.d.ts +54 -8
- package/dist/testing/dev-vitest-manager.d.ts.map +1 -1
- package/dist/testing/dev-vitest-manager.js +24 -9
- package/dist/testing/faker-mappings.d.ts +412 -1
- package/dist/testing/faker-mappings.d.ts.map +1 -1
- package/dist/testing/faker-mappings.js +1 -1
- package/dist/testing/filesystem.d.ts +2 -0
- package/dist/testing/filesystem.d.ts.map +1 -0
- package/dist/testing/filesystem.js +7 -0
- package/dist/testing/fixture-generator.d.ts +25 -8
- package/dist/testing/fixture-generator.d.ts.map +1 -1
- package/dist/testing/fixture-generator.js +133 -74
- package/dist/testing/fixture-loader.d.ts +3 -1
- package/dist/testing/fixture-loader.d.ts.map +1 -1
- package/dist/testing/fixture-loader.js +1 -20
- package/dist/testing/fixture-manager.d.ts +12 -7
- package/dist/testing/fixture-manager.d.ts.map +1 -1
- package/dist/testing/fixture-manager.js +179 -73
- package/dist/testing/global-setup.d.ts.map +1 -1
- package/dist/testing/global-setup.js +5 -2
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6 -3
- package/dist/testing/naite-vitest-reporter.d.ts.map +1 -1
- package/dist/testing/parallel-db-manager.d.ts.map +1 -1
- package/dist/tooling/__tests__/helpers/sonamu-test-root.d.ts +10 -0
- package/dist/tooling/__tests__/helpers/sonamu-test-root.d.ts.map +1 -0
- package/dist/tooling/__tests__/helpers/sonamu-test-root.js +42 -0
- package/dist/tooling/cdd-service.d.ts +87 -0
- package/dist/tooling/cdd-service.d.ts.map +1 -0
- package/dist/tooling/cdd-service.js +215 -0
- package/dist/tooling/cli-tooling.d.ts +11 -0
- package/dist/tooling/cli-tooling.d.ts.map +1 -0
- package/dist/tooling/cli-tooling.js +901 -0
- package/dist/tooling/fixture-service.d.ts +29 -0
- package/dist/tooling/fixture-service.d.ts.map +1 -0
- package/dist/tooling/fixture-service.js +53 -0
- package/dist/tooling/index.d.ts +2 -0
- package/dist/tooling/index.d.ts.map +1 -0
- package/dist/tooling/index.js +2 -0
- package/dist/tooling/test-run-client.d.ts +27 -0
- package/dist/tooling/test-run-client.d.ts.map +1 -0
- package/dist/tooling/test-run-client.js +120 -0
- package/dist/tsdown.api.config.js +48 -0
- package/dist/types/types.d.ts +620 -618
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +234 -225
- package/dist/ui/ai-api.d.ts.map +1 -1
- package/dist/ui/ai-api.js +1 -1
- package/dist/ui/ai-client.d.ts.map +1 -1
- package/dist/ui/ai-client.js +28 -18
- package/dist/ui/api.d.ts.map +1 -1
- package/dist/ui/api.js +135 -128
- package/dist/ui/async-route.d.ts +3 -0
- package/dist/ui/async-route.d.ts.map +1 -0
- package/dist/ui/async-route.js +12 -0
- package/dist/ui/cdd-service.d.ts +9 -7
- package/dist/ui/cdd-service.d.ts.map +1 -1
- package/dist/ui/cdd-service.js +7 -5
- package/dist/ui/migrations-api.d.ts.map +1 -1
- package/dist/ui/migrations-api.js +17 -15
- package/dist/ui-web/assets/index-DV1AAq6W.js +178 -0
- package/dist/ui-web/index.html +1 -1
- package/dist/utils/formatter.d.ts +6 -0
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +46 -13
- package/dist/utils/fs-utils.d.ts +3 -3
- package/dist/utils/fs-utils.d.ts.map +1 -1
- package/dist/utils/fs-utils.js +6 -6
- package/dist/utils/model.d.ts +4 -6
- package/dist/utils/model.d.ts.map +1 -1
- package/dist/utils/model.js +1 -1
- package/dist/utils/object-utils.d.ts +1 -1
- package/dist/utils/object-utils.d.ts.map +1 -1
- package/dist/utils/object-utils.js +17 -16
- package/dist/utils/process-utils.d.ts.map +1 -1
- package/dist/utils/process-utils.js +4 -2
- package/dist/utils/runtime-value.d.ts +13 -0
- package/dist/utils/runtime-value.d.ts.map +1 -0
- package/dist/utils/runtime-value.js +40 -0
- package/dist/utils/sql-parser.d.ts +8 -1
- package/dist/utils/sql-parser.d.ts.map +1 -1
- package/dist/utils/sql-parser.js +6 -3
- package/dist/utils/type-utils.d.ts.map +1 -1
- package/dist/utils/type-utils.js +10 -8
- package/dist/utils/utils.d.ts +2 -2
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +11 -8
- package/dist/utils/zod-error.d.ts.map +1 -1
- package/dist/utils/zod-error.js +7 -4
- package/dist/vector/chunking.d.ts.map +1 -1
- package/dist/vector/chunking.js +1 -1
- package/dist/vector/embedding.d.ts.map +1 -1
- package/dist/vector/embedding.js +1 -1
- package/dist/vector/types.d.ts +3 -2
- package/dist/vector/types.d.ts.map +1 -1
- package/package.json +17 -14
- package/src/ai/agents/agent.ts +5 -5
- package/src/ai/agents/types.ts +1 -1
- package/src/ai/providers/rtzr/__tests__/model.test.ts +2 -2
- package/src/ai/providers/rtzr/error.ts +5 -3
- package/src/ai/providers/rtzr/model.ts +3 -2
- package/src/ai/providers/rtzr/options.ts +10 -5
- package/src/ai/providers/rtzr/provider.ts +10 -10
- package/src/ai/providers/rtzr/utils.ts +3 -1
- package/src/api/__tests__/config.test.ts +11 -21
- package/src/api/__tests__/sonamu.http-validator.test.ts +512 -0
- package/src/api/__tests__/sonamu.websocket.test.ts +51 -41
- package/src/api/__tests__/zod-compiler-policy.test.ts +95 -0
- package/src/api/caster.ts +6 -8
- package/src/api/code-converters.ts +136 -36
- package/src/api/config.ts +62 -4
- package/src/api/context.ts +3 -3
- package/src/api/decorators.ts +28 -17
- package/src/api/http-validator.ts +149 -0
- package/src/api/sonamu.ts +461 -153
- package/src/api/websocket-helpers.ts +24 -17
- package/src/auth/audit-log/builders.ts +3 -2
- package/src/auth/audit-log/client-ip.ts +4 -2
- package/src/auth/audit-log/events.ts +15 -1
- package/src/auth/audit-log/plugin.ts +129 -200
- package/src/auth/audit-log-ingestor.ts +19 -15
- package/src/auth/auth-generator.ts +10 -5
- package/src/auth/better-auth-request.ts +4 -3
- package/src/auth/index.ts +1 -1
- package/src/auth/knex-adapter.ts +8 -2
- package/src/auth/plugins/entity-definitions/index.ts +6 -5
- package/src/bin/__tests__/http-validator-benchmark.test.ts +94 -0
- package/src/bin/__tests__/test-command.test.ts +9 -15
- package/src/bin/__tests__/ts-loader-register.test.ts +15 -17
- package/src/bin/__tests__/zod-compiler-build.test.ts +374 -0
- package/src/bin/build-config.ts +317 -4
- package/src/bin/compiler-policy.ts +35 -0
- package/src/bin/fixture.ts +218 -24
- package/src/bin/test-command.ts +100 -32
- package/src/bin/ts-loader-registration.ts +22 -4
- package/src/bin/typecheck-web.ts +56 -0
- package/src/cache/decorator.ts +10 -3
- package/src/compress/compress.ts +17 -4
- package/src/cone/cone-generator.ts +34 -6
- package/src/database/__tests__/db.test.ts +1 -0
- package/src/database/__tests__/puri.test.ts +16 -15
- package/src/database/__tests__/transaction-scope.test.ts +5 -0
- package/src/database/_batch_update.ts +1 -0
- package/src/database/base-model.ts +81 -50
- package/src/database/base-model.types.ts +6 -6
- package/src/database/db.ts +29 -19
- package/src/database/knex.ts +30 -17
- package/src/database/puri-subset.test-d.ts +17 -0
- package/src/database/puri.ts +181 -143
- package/src/database/puri.types.test-d.ts +31 -1
- package/src/database/puri.types.ts +23 -21
- package/src/database/upsert-builder.ts +75 -53
- package/src/dict/sd.ts +15 -5
- package/src/dict/sonamu-dictionary.ts +7 -7
- package/src/dict/utils.ts +9 -1
- package/src/entity/__tests__/entity-manager-autoload.contract.test.ts +55 -0
- package/src/entity/__tests__/entity-manager-explicit-root-registration.contract.test.ts +107 -0
- package/src/entity/entity-manager.ts +56 -27
- package/src/entity/entity-template-cone.ts +5 -10
- package/src/entity/entity.ts +57 -36
- package/src/env.ts +7 -3
- package/src/exceptions/error-handler.ts +17 -2
- package/src/exceptions/so-exceptions.ts +26 -20
- package/src/filter/utils.ts +21 -11
- package/src/index.ts +3 -0
- package/src/logger/__tests__/configure.test.ts +33 -0
- package/src/logger/configure.ts +69 -19
- package/src/migration/__tests__/migrator.test.ts +101 -57
- package/src/migration/code-generation.ts +132 -104
- package/src/migration/index-where-predicate.ts +51 -24
- package/src/migration/migration-set.ts +11 -5
- package/src/migration/migrator.ts +166 -70
- package/src/migration/postgresql-schema-reader.ts +52 -47
- package/src/migration/slack-confirm.ts +17 -15
- package/src/naite/naite-reporter.ts +1 -1
- package/src/naite/naite.ts +97 -24
- package/src/runtime-type.ts +34 -0
- package/src/ssr/hmr-opt-out.ts +78 -0
- package/src/ssr/renderer.ts +6 -0
- package/src/storage/base-file.ts +13 -13
- package/src/storage/buffered-file.ts +11 -11
- package/src/storage/s3-driver.ts +4 -1
- package/src/storage/uploaded-file.ts +8 -8
- package/src/stream/__tests__/ws-contracts.test.ts +4 -2
- package/src/stream/__tests__/ws-telemetry.test.ts +1 -1
- package/src/stream/__tests__/ws.test.ts +30 -6
- package/src/stream/sse.ts +12 -11
- package/src/stream/ws-core.ts +1 -1
- package/src/stream/ws-delivery.ts +16 -7
- package/src/stream/ws-local-connection-store.ts +2 -3
- package/src/stream/ws-presence-store.ts +6 -1
- package/src/stream/ws-registry.ts +16 -7
- package/src/stream/ws-telemetry.ts +66 -43
- package/src/stream/ws.ts +73 -39
- package/src/syncer/__tests__/api-parser.websocket-type-ref.test.ts +3 -2
- package/src/syncer/__tests__/http-validator-registry.test.ts +137 -0
- package/src/syncer/api-parser.ts +68 -28
- package/src/syncer/checksum.ts +17 -11
- package/src/syncer/code-generator.ts +25 -17
- package/src/syncer/entity-operations.ts +3 -5
- package/src/syncer/file-copy.ts +46 -0
- package/src/syncer/file-patterns.ts +11 -8
- package/src/syncer/file-tracking.ts +3 -4
- package/src/syncer/filesystem-dependencies.ts +73 -0
- package/src/syncer/module-loader.ts +8 -4
- package/src/syncer/syncer-actions.ts +56 -18
- package/src/syncer/syncer.ts +116 -43
- package/src/syncer/watcher.ts +8 -4
- package/src/tasks/decorator.ts +20 -12
- package/src/tasks/step-wrapper.ts +19 -9
- package/src/tasks/workflow-manager.ts +15 -9
- package/src/template/__tests__/http_validators.template.test.ts +160 -0
- package/src/template/__tests__/services.template.mutation.test.ts +24 -23
- package/src/template/__tests__/services.template.websocket.test.ts +21 -25
- package/src/template/entity-converter.ts +5 -2
- package/src/template/helpers.ts +8 -9
- package/src/template/implementations/generated.template.ts +5 -4
- package/src/template/implementations/generated_http.template.ts +61 -15
- package/src/template/implementations/generated_sso.template.ts +15 -4
- package/src/template/implementations/http_validators.template.ts +175 -0
- package/src/template/implementations/model.template.ts +3 -1
- package/src/template/implementations/sd.template.ts +81 -41
- package/src/template/implementations/services.template.ts +2 -2
- package/src/template/implementations/view_form.template.ts +56 -39
- package/src/template/implementations/view_list.template.ts +31 -23
- package/src/template/template-manager.ts +15 -13
- package/src/template/template-types.ts +13 -5
- package/src/template/template.ts +4 -3
- package/src/template/zod-converter.ts +206 -91
- package/src/testing/__tests__/dev-test-routes.test.ts +85 -25
- package/src/testing/__tests__/dev-vitest-manager.test.ts +15 -15
- package/src/testing/_relation-graph.ts +4 -1
- package/src/testing/bootstrap.ts +12 -5
- package/src/testing/data-explorer.ts +102 -53
- package/src/testing/dev-test-routes.ts +87 -50
- package/src/testing/dev-vitest-manager.ts +88 -32
- package/src/testing/faker-mappings.ts +2 -2
- package/src/testing/filesystem.ts +1 -0
- package/src/testing/fixture-generator.ts +191 -131
- package/src/testing/fixture-loader.ts +5 -1
- package/src/testing/fixture-manager.ts +237 -106
- package/src/testing/global-setup.ts +7 -3
- package/src/testing/index.ts +5 -0
- package/src/tooling/__tests__/cdd-rule-bootstrap.contract.test.ts +118 -0
- package/src/tooling/__tests__/cli-tooling-auth.contract.test.ts +72 -0
- package/src/tooling/__tests__/cli-tooling-cone-locale.contract.test.ts +150 -0
- package/src/tooling/__tests__/cli-tooling-entity-patch.contract.test.ts +131 -0
- package/src/tooling/__tests__/cli-tooling-fixture-transfer.contract.test.ts +255 -0
- package/src/tooling/__tests__/cli-tooling-i18n-update.contract.test.ts +104 -0
- package/src/tooling/__tests__/cli-tooling-scaffold.contract.test.ts +86 -0
- package/src/tooling/__tests__/cli-tooling-stub-practice.contract.test.ts +147 -0
- package/src/tooling/__tests__/default-cdd-adapter.contract.test.ts +73 -0
- package/src/tooling/__tests__/helpers/sonamu-test-root.ts +42 -0
- package/src/tooling/__tests__/test-run-client-config.contract.test.ts +154 -0
- package/src/tooling/cdd-service.ts +256 -0
- package/src/tooling/cli-tooling.ts +937 -0
- package/src/tooling/fixture-service.ts +72 -0
- package/src/tooling/index.ts +1 -0
- package/src/tooling/test-run-client.ts +196 -0
- package/src/types/__tests__/entity-json-schema-search-text.test.ts +9 -3
- package/src/types/types.ts +184 -158
- package/src/ui/ai-api.ts +9 -7
- package/src/ui/ai-client.ts +61 -56
- package/src/ui/api.ts +727 -616
- package/src/ui/async-route.ts +4 -0
- package/src/ui/cdd-service.ts +35 -12
- package/src/ui/migrations-api.ts +63 -51
- package/src/utils/__tests__/formatter-bin.test.ts +99 -0
- package/src/utils/formatter.ts +80 -12
- package/src/utils/fs-utils.ts +5 -5
- package/src/utils/model.ts +4 -5
- package/src/utils/object-utils.ts +32 -22
- package/src/utils/process-utils.ts +4 -1
- package/src/utils/runtime-value.ts +43 -0
- package/src/utils/sql-parser.ts +13 -6
- package/src/utils/type-utils.ts +9 -7
- package/src/utils/utils.ts +19 -21
- package/src/utils/zod-error.ts +4 -2
- package/src/vector/chunking.ts +6 -1
- package/src/vector/embedding.ts +2 -1
- package/src/vector/types.ts +4 -2
- package/tsdown.api.config.ts +12 -11
- package/bin/cli.js +0 -75
- package/dist/bin/cli.d.ts +0 -2
- package/dist/bin/cli.d.ts.map +0 -1
- package/dist/bin/cli.js +0 -852
- package/dist/ui-web/assets/index-C0m1pk6K.js +0 -177
- package/src/bin/cli.ts +0 -1049
package/src/bin/build-config.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import assert from "node:assert";
|
|
2
|
+
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
import { type UserConfig } from "tsdown";
|
|
8
|
+
|
|
9
|
+
import { type NormalizedZodCompilerPolicy } from "../api/config";
|
|
10
|
+
import {
|
|
11
|
+
execWithLinePrefix,
|
|
12
|
+
printBuildSummary,
|
|
13
|
+
printTaskFailed,
|
|
14
|
+
printTaskHeader,
|
|
15
|
+
printTaskStart,
|
|
16
|
+
printTaskSuccess,
|
|
17
|
+
} from "../utils/console-util";
|
|
18
|
+
import { exists } from "../utils/fs-utils";
|
|
19
|
+
import { findApiRootPath, findAppRootPath } from "../utils/utils";
|
|
20
|
+
import { loadBuildCompilerPolicy } from "./compiler-policy";
|
|
21
|
+
|
|
1
22
|
export type BuildArtifact<BuildCommandArgs = {}> = {
|
|
2
23
|
name: string;
|
|
3
24
|
description: string;
|
|
@@ -7,6 +28,179 @@ export type BuildArtifact<BuildCommandArgs = {}> = {
|
|
|
7
28
|
postBuildCommand?: () => string;
|
|
8
29
|
};
|
|
9
30
|
|
|
31
|
+
export type ApiTsdownBuildConfig = Pick<UserConfig, "entry" | "plugins">;
|
|
32
|
+
|
|
33
|
+
export function quoteShellArgument(value: string): string {
|
|
34
|
+
// 작은따옴표 자체만 셸 경계를 닫지 못하도록 분리해 리터럴 인수를 보존합니다.
|
|
35
|
+
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function createWebTypecheckCommand(): string {
|
|
39
|
+
const isSourceModule = path.extname(import.meta.filename) === ".ts";
|
|
40
|
+
const scriptPath = path.join(
|
|
41
|
+
import.meta.dirname,
|
|
42
|
+
`typecheck-web.${isSourceModule ? "ts" : "js"}`,
|
|
43
|
+
);
|
|
44
|
+
const runner = isSourceModule ? "pnpm exec tsx" : quoteShellArgument(process.execPath);
|
|
45
|
+
return `${runner} ${quoteShellArgument(scriptPath)}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type ZodCompilerPluginFactory = (typeof import("zod-compiler/rolldown"))["default"];
|
|
49
|
+
|
|
50
|
+
export interface ApiZodCompilerBuildDependencies {
|
|
51
|
+
loadCompilerPlugin: () => Promise<ZodCompilerPluginFactory>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const apiZodCompilerBuildDependencies: ApiZodCompilerBuildDependencies = {
|
|
55
|
+
async loadCompilerPlugin() {
|
|
56
|
+
return (await import("zod-compiler/rolldown")).default;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export async function composeApiZodCompilerBuildConfig<T extends ApiTsdownBuildConfig>(
|
|
61
|
+
baseConfig: T,
|
|
62
|
+
options: {
|
|
63
|
+
policy: NormalizedZodCompilerPolicy;
|
|
64
|
+
registryPath?: string;
|
|
65
|
+
},
|
|
66
|
+
dependencies: ApiZodCompilerBuildDependencies = apiZodCompilerBuildDependencies,
|
|
67
|
+
): Promise<T & ApiTsdownBuildConfig> {
|
|
68
|
+
if (options.policy.api !== "aot") {
|
|
69
|
+
return baseConfig;
|
|
70
|
+
}
|
|
71
|
+
if (options.registryPath === undefined) {
|
|
72
|
+
throw new Error("validation.zodCompiler.api requires the generated HTTP validator registry");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const zodCompiler = await dependencies.loadCompilerPlugin();
|
|
76
|
+
const compilerPlugin = zodCompiler({
|
|
77
|
+
codegenMode: "inline",
|
|
78
|
+
include: [options.registryPath],
|
|
79
|
+
output: "compact",
|
|
80
|
+
schemas: "explicit",
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
let configuredPlugins: Exclude<UserConfig["plugins"], undefined>[];
|
|
84
|
+
if (Array.isArray(baseConfig.plugins)) {
|
|
85
|
+
configuredPlugins = baseConfig.plugins;
|
|
86
|
+
} else if (baseConfig.plugins === undefined) {
|
|
87
|
+
configuredPlugins = [];
|
|
88
|
+
} else {
|
|
89
|
+
configuredPlugins = [baseConfig.plugins];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
...baseConfig,
|
|
94
|
+
plugins: [...configuredPlugins, compilerPlugin],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function assertApiZodCompilerBuildOutput(
|
|
99
|
+
outputs: readonly { code: string; path: string }[],
|
|
100
|
+
): void {
|
|
101
|
+
for (const output of outputs) {
|
|
102
|
+
if (/\bcompile\s*\(/.test(output.code)) {
|
|
103
|
+
throw new Error(`zod-compiler compile boundary remains in ${output.path}`);
|
|
104
|
+
}
|
|
105
|
+
if (output.code.includes("virtual:zod-compiler/runtime")) {
|
|
106
|
+
throw new Error(`zod-compiler virtual runtime import remains in ${output.path}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const HTTP_VALIDATOR_REGISTRY_SOURCE_PATH = "src/application/sonamu.validators.generated.ts";
|
|
112
|
+
export const HTTP_VALIDATOR_REGISTRY_BUILD_PATH = "dist/application/sonamu.validators.generated.js";
|
|
113
|
+
|
|
114
|
+
export async function assertApiZodCompilerSourceRegistry(registryPath: string): Promise<void> {
|
|
115
|
+
if (!(await exists(registryPath))) {
|
|
116
|
+
throw new Error(`Generated HTTP validator registry not found: ${registryPath}`);
|
|
117
|
+
}
|
|
118
|
+
const source = await readFile(registryPath, "utf8");
|
|
119
|
+
if (!/fingerprint\s*=\s*["'][a-f0-9]{64}["']/.test(source)) {
|
|
120
|
+
throw new Error(`Generated HTTP validator registry fingerprint is invalid: ${registryPath}`);
|
|
121
|
+
}
|
|
122
|
+
const declaresZeroRoutes = /\brouteIds\s*=\s*\{\s*\}\s*;/.test(source);
|
|
123
|
+
if (!declaresZeroRoutes && !/\bcompile\s*\(/.test(source)) {
|
|
124
|
+
throw new Error(`Generated HTTP validator registry has no compile boundary: ${registryPath}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export async function createApiZodCompilerBuildWrapper(options: {
|
|
129
|
+
apiRootPath: string;
|
|
130
|
+
baseConfigPath: string;
|
|
131
|
+
policy: NormalizedZodCompilerPolicy;
|
|
132
|
+
registryPath: string;
|
|
133
|
+
}): Promise<string> {
|
|
134
|
+
if (options.policy.api !== "aot") {
|
|
135
|
+
return options.baseConfigPath;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
await assertApiZodCompilerSourceRegistry(options.registryPath);
|
|
139
|
+
const wrapperPath = path.join(
|
|
140
|
+
options.apiRootPath,
|
|
141
|
+
`.sonamu-zod-compiler-${process.pid}-${Date.now()}.mjs`,
|
|
142
|
+
);
|
|
143
|
+
const baseConfigUrl = pathToFileURL(options.baseConfigPath).href;
|
|
144
|
+
const source = [
|
|
145
|
+
`import path from "node:path";`,
|
|
146
|
+
`import baseConfig from ${JSON.stringify(baseConfigUrl)};`,
|
|
147
|
+
`import zodCompiler from "zod-compiler/rolldown";`,
|
|
148
|
+
"",
|
|
149
|
+
`const compilerPlugin = zodCompiler(${JSON.stringify({
|
|
150
|
+
codegenMode: "inline",
|
|
151
|
+
include: [options.registryPath],
|
|
152
|
+
output: "compact",
|
|
153
|
+
schemas: "explicit",
|
|
154
|
+
})});`,
|
|
155
|
+
`const registryPath = ${JSON.stringify(options.registryPath)};`,
|
|
156
|
+
`const apiRootPath = ${JSON.stringify(options.apiRootPath)};`,
|
|
157
|
+
`const canonicalOutDir = path.join(apiRootPath, "dist");`,
|
|
158
|
+
`const registryEntryName = "application/sonamu.validators.generated";`,
|
|
159
|
+
`const defaultEntry = { index: "src/index.ts" };`,
|
|
160
|
+
"const resolvesToRegistry = (entry) =>",
|
|
161
|
+
' typeof entry === "string" && path.resolve(apiRootPath, entry) === registryPath;',
|
|
162
|
+
"const appendRegistryEntry = (entry) => {",
|
|
163
|
+
" if (Array.isArray(entry)) {",
|
|
164
|
+
" return entry.some(resolvesToRegistry) ? entry : [...entry, registryPath];",
|
|
165
|
+
" }",
|
|
166
|
+
' if (typeof entry === "string") {',
|
|
167
|
+
" return resolvesToRegistry(entry) ? entry : [entry, registryPath];",
|
|
168
|
+
" }",
|
|
169
|
+
' if (typeof entry === "object" && entry !== null) {',
|
|
170
|
+
" if (Object.values(entry).some(resolvesToRegistry)) return entry;",
|
|
171
|
+
" if (registryEntryName in entry) {",
|
|
172
|
+
" throw new Error(`tsdown entry collision: ${registryEntryName}`);",
|
|
173
|
+
" }",
|
|
174
|
+
" return { ...entry, [registryEntryName]: registryPath };",
|
|
175
|
+
" }",
|
|
176
|
+
" if (entry === undefined) {",
|
|
177
|
+
" return { ...defaultEntry, [registryEntryName]: registryPath };",
|
|
178
|
+
" }",
|
|
179
|
+
" return { [registryEntryName]: registryPath };",
|
|
180
|
+
"};",
|
|
181
|
+
"const appendPlugin = (config) => ({",
|
|
182
|
+
" ...config,",
|
|
183
|
+
" // 런타임 loader가 참조하는 registry 경로를 빌드 설정과 일치시킵니다.",
|
|
184
|
+
" outDir: canonicalOutDir,",
|
|
185
|
+
" fixedExtension: false,",
|
|
186
|
+
" entry: appendRegistryEntry(config.entry),",
|
|
187
|
+
" plugins: [...(config.plugins ?? []), compilerPlugin],",
|
|
188
|
+
"});",
|
|
189
|
+
"const appendToResolvedConfig = (config) =>",
|
|
190
|
+
" Array.isArray(config) ? config.map(appendPlugin) : appendPlugin(config);",
|
|
191
|
+
"",
|
|
192
|
+
"export default async (...args) => {",
|
|
193
|
+
' const resolved = typeof baseConfig === "function"',
|
|
194
|
+
" ? await baseConfig(...args)",
|
|
195
|
+
" : await baseConfig;",
|
|
196
|
+
" return appendToResolvedConfig(resolved);",
|
|
197
|
+
"};",
|
|
198
|
+
"",
|
|
199
|
+
].join("\n");
|
|
200
|
+
await writeFile(wrapperPath, source, "utf8");
|
|
201
|
+
return wrapperPath;
|
|
202
|
+
}
|
|
203
|
+
|
|
10
204
|
/**
|
|
11
205
|
* API 프로젝트 빌드 산출물에 대한 규칙들.
|
|
12
206
|
* cli.ts의 build_api 함수가 이것을 보고 그대로 실행합니다.
|
|
@@ -17,8 +211,11 @@ export const API_ARTIFACTS: BuildArtifact<{ configFilePath: string }>[] = [
|
|
|
17
211
|
description: "API 프로젝트 빌드 산출물",
|
|
18
212
|
projectPath: "api",
|
|
19
213
|
preBuildCommand: () => "rm -rf dist",
|
|
20
|
-
buildCommand: ({ configFilePath }) =>
|
|
21
|
-
|
|
214
|
+
buildCommand: ({ configFilePath }) => {
|
|
215
|
+
const configExtension = path.extname(configFilePath);
|
|
216
|
+
const configLoader = [".ts", ".tsx"].includes(configExtension) ? " --config-loader tsx" : "";
|
|
217
|
+
return `tsc --noEmit && pnpm exec tsdown --config ${JSON.stringify(configFilePath)}${configLoader}`;
|
|
218
|
+
},
|
|
22
219
|
},
|
|
23
220
|
];
|
|
24
221
|
|
|
@@ -33,7 +230,7 @@ export const WEB_ARTIFACTS: BuildArtifact[] = [
|
|
|
33
230
|
projectPath: "web",
|
|
34
231
|
preBuildCommand: () => "rm -rf dist/client",
|
|
35
232
|
buildCommand: () =>
|
|
36
|
-
|
|
233
|
+
`${createWebTypecheckCommand()} && vite build --config vite.config.ts --outDir dist/client`,
|
|
37
234
|
},
|
|
38
235
|
{
|
|
39
236
|
name: "Web Server",
|
|
@@ -41,8 +238,124 @@ export const WEB_ARTIFACTS: BuildArtifact[] = [
|
|
|
41
238
|
projectPath: "web",
|
|
42
239
|
preBuildCommand: () => "rm -rf dist/server",
|
|
43
240
|
buildCommand: () =>
|
|
44
|
-
|
|
241
|
+
`${createWebTypecheckCommand()} && vite build --config vite.config.ts --ssr src/entry-server.generated.tsx --outDir dist/server`,
|
|
45
242
|
postBuildCommand: () =>
|
|
46
243
|
"rm -rf ../api/web-dist && mkdir -p ../api/web-dist && cp -r dist/* ../api/web-dist",
|
|
47
244
|
},
|
|
48
245
|
];
|
|
246
|
+
|
|
247
|
+
export async function resolveApiBuildConfigPath(
|
|
248
|
+
apiRootPath: string,
|
|
249
|
+
dependencies: {
|
|
250
|
+
exists: (candidatePath: string) => Promise<boolean>;
|
|
251
|
+
moduleDir: string;
|
|
252
|
+
} = {
|
|
253
|
+
exists,
|
|
254
|
+
moduleDir: import.meta.dirname,
|
|
255
|
+
},
|
|
256
|
+
): Promise<string> {
|
|
257
|
+
const localConfigPath = path.join(apiRootPath, "tsdown.config.ts");
|
|
258
|
+
if (await dependencies.exists(localConfigPath)) {
|
|
259
|
+
console.log(chalk.dim("Using tsdown.config.ts from project root..."));
|
|
260
|
+
return localConfigPath;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
console.log(chalk.dim("Using default tsdown API config from sonamu package..."));
|
|
264
|
+
const compiledConfigPath = path.join(dependencies.moduleDir, "..", "tsdown.api.config.js");
|
|
265
|
+
if (await dependencies.exists(compiledConfigPath)) {
|
|
266
|
+
return compiledConfigPath;
|
|
267
|
+
}
|
|
268
|
+
return path.join(dependencies.moduleDir, "..", "..", "tsdown.api.config.ts");
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async function runBuildSteps<T>(
|
|
272
|
+
artifact: BuildArtifact<T>,
|
|
273
|
+
options: { cwd: string; buildCommandArgs: T },
|
|
274
|
+
) {
|
|
275
|
+
const steps = [
|
|
276
|
+
{ name: "pre-build", cmd: artifact.preBuildCommand?.() },
|
|
277
|
+
{ name: "build", cmd: artifact.buildCommand(options.buildCommandArgs) },
|
|
278
|
+
{ name: "post-build", cmd: artifact.postBuildCommand?.() },
|
|
279
|
+
].filter((step) => step.cmd !== undefined);
|
|
280
|
+
|
|
281
|
+
for (let index = 0; index < steps.length; index++) {
|
|
282
|
+
const step = steps[index];
|
|
283
|
+
const isLast = index === steps.length - 1;
|
|
284
|
+
try {
|
|
285
|
+
assert(step.cmd);
|
|
286
|
+
printTaskStart(step.name, step.cmd, isLast);
|
|
287
|
+
await execWithLinePrefix(step.cmd, { cwd: options.cwd });
|
|
288
|
+
printTaskSuccess(step.name, isLast);
|
|
289
|
+
} catch (error) {
|
|
290
|
+
printTaskFailed(step.name, isLast);
|
|
291
|
+
throw new Error(`${step.name} failed`, { cause: error });
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export async function buildApiCommand(): Promise<void> {
|
|
297
|
+
const apiRootPath = findApiRootPath();
|
|
298
|
+
const baseConfigPath = await resolveApiBuildConfigPath(apiRootPath);
|
|
299
|
+
const policy = await loadBuildCompilerPolicy(apiRootPath);
|
|
300
|
+
const registryPath = path.join(apiRootPath, HTTP_VALIDATOR_REGISTRY_SOURCE_PATH);
|
|
301
|
+
const configFilePath = await createApiZodCompilerBuildWrapper({
|
|
302
|
+
apiRootPath,
|
|
303
|
+
baseConfigPath,
|
|
304
|
+
policy,
|
|
305
|
+
registryPath,
|
|
306
|
+
});
|
|
307
|
+
const temporaryConfigPath = configFilePath === baseConfigPath ? undefined : configFilePath;
|
|
308
|
+
const startedAt = Date.now();
|
|
309
|
+
|
|
310
|
+
try {
|
|
311
|
+
for (const artifact of API_ARTIFACTS) {
|
|
312
|
+
printTaskHeader(artifact.name, artifact.description, apiRootPath);
|
|
313
|
+
await runBuildSteps(artifact, {
|
|
314
|
+
cwd: apiRootPath,
|
|
315
|
+
buildCommandArgs: { configFilePath },
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
if (policy.api === "aot") {
|
|
319
|
+
const outputPath = path.join(apiRootPath, HTTP_VALIDATOR_REGISTRY_BUILD_PATH);
|
|
320
|
+
if (!(await exists(outputPath))) {
|
|
321
|
+
throw new Error(`Built HTTP validator registry not found: ${outputPath}`);
|
|
322
|
+
}
|
|
323
|
+
assertApiZodCompilerBuildOutput([
|
|
324
|
+
{ code: await readFile(outputPath, "utf8"), path: outputPath },
|
|
325
|
+
]);
|
|
326
|
+
}
|
|
327
|
+
printBuildSummary("API", true, Date.now() - startedAt);
|
|
328
|
+
} catch (error) {
|
|
329
|
+
printBuildSummary("API", false, Date.now() - startedAt);
|
|
330
|
+
throw error;
|
|
331
|
+
} finally {
|
|
332
|
+
if (temporaryConfigPath !== undefined) await rm(temporaryConfigPath, { force: true });
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export async function buildWebCommand({
|
|
337
|
+
skipIfMissing = false,
|
|
338
|
+
}: { skipIfMissing?: boolean } = {}): Promise<void> {
|
|
339
|
+
const appRootPath = findAppRootPath();
|
|
340
|
+
const webPath = path.join(appRootPath, "web");
|
|
341
|
+
if (!(await exists(webPath))) {
|
|
342
|
+
if (skipIfMissing) {
|
|
343
|
+
console.log(chalk.gray("Web 디렉토리가 없으므로 Web 빌드를 건너뜁니다."));
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
throw new Error(`web 디렉토리를 찾을 수 없습니다: ${webPath}`);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const startedAt = Date.now();
|
|
350
|
+
try {
|
|
351
|
+
for (const artifact of WEB_ARTIFACTS) {
|
|
352
|
+
const cwd = path.join(appRootPath, artifact.projectPath);
|
|
353
|
+
printTaskHeader(artifact.name, artifact.description, cwd);
|
|
354
|
+
await runBuildSteps(artifact, { cwd, buildCommandArgs: {} });
|
|
355
|
+
}
|
|
356
|
+
printBuildSummary("Web", true, Date.now() - startedAt);
|
|
357
|
+
} catch (error) {
|
|
358
|
+
printBuildSummary("Web", false, Date.now() - startedAt);
|
|
359
|
+
throw error;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url";
|
|
2
|
+
|
|
3
|
+
import { normalizeZodCompilerPolicy, type NormalizedZodCompilerPolicy } from "../api/config";
|
|
4
|
+
import { applyCurrentSnapshotToProcessEnv } from "../env";
|
|
5
|
+
import { isFunctionValue, isObjectValue } from "../utils/runtime-value";
|
|
6
|
+
import { ensureTsLoaderRegistered } from "./ts-loader-registration";
|
|
7
|
+
|
|
8
|
+
type BuildSourceConfig = {
|
|
9
|
+
validation?: {
|
|
10
|
+
zodCompiler?: unknown;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export async function loadBuildCompilerPolicy(
|
|
15
|
+
apiRootPath: string,
|
|
16
|
+
): Promise<NormalizedZodCompilerPolicy> {
|
|
17
|
+
applyCurrentSnapshotToProcessEnv(apiRootPath);
|
|
18
|
+
await ensureTsLoaderRegistered(apiRootPath);
|
|
19
|
+
|
|
20
|
+
const configUrl = pathToFileURL(`${apiRootPath}/src/sonamu.config.ts`);
|
|
21
|
+
configUrl.searchParams.set("sonamu-build", `${Date.now()}-${Math.random()}`);
|
|
22
|
+
const imported =
|
|
23
|
+
/* SAFETY: CLI 파서와 빌드 도구 입력 계약이 이 값의 타입을 보장한다. */ (await import(
|
|
24
|
+
configUrl.href
|
|
25
|
+
)) as { default: unknown };
|
|
26
|
+
const configured = isFunctionValue(imported.default)
|
|
27
|
+
? await Promise.resolve(imported.default())
|
|
28
|
+
: await Promise.resolve(imported.default);
|
|
29
|
+
if (!isObjectValue(configured) || configured === null || Array.isArray(configured)) {
|
|
30
|
+
throw new Error("sonamu.config.ts must export a configuration object");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const config: BuildSourceConfig = configured;
|
|
34
|
+
return normalizeZodCompilerPolicy(config.validation?.zodCompiler);
|
|
35
|
+
}
|