sonamu 0.10.12 → 0.10.13
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/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 +250 -106
- 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/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 +1 -1
- package/dist/bin/build-config.d.ts +25 -0
- package/dist/bin/build-config.d.ts.map +1 -1
- package/dist/bin/build-config.js +105 -2
- package/dist/bin/cli.js +131 -27
- 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.map +1 -1
- package/dist/bin/fixture.js +5 -3
- package/dist/bin/test-command.d.ts +22 -1
- package/dist/bin/test-command.d.ts.map +1 -1
- package/dist/bin/test-command.js +18 -10
- 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/cache/decorator.d.ts.map +1 -1
- package/dist/cache/decorator.js +11 -4
- 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 +13 -9
- 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 -3
- 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.d.ts +11 -9
- package/dist/database/puri.d.ts.map +1 -1
- package/dist/database/puri.js +93 -79
- package/dist/database/puri.types.d.ts +21 -21
- package/dist/database/puri.types.d.ts.map +1 -1
- package/dist/database/puri.types.js +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/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 +1 -1
- package/dist/dict/utils.d.ts.map +1 -1
- package/dist/dict/utils.js +7 -2
- package/dist/entity/entity-manager.d.ts +13 -4
- package/dist/entity/entity-manager.d.ts.map +1 -1
- package/dist/entity/entity-manager.js +19 -11
- 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 +6 -2
- package/dist/entity/entity.d.ts.map +1 -1
- package/dist/entity/entity.js +30 -28
- 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/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 +12 -6
- package/dist/logger/configure.d.ts.map +1 -1
- package/dist/logger/configure.js +10 -10
- 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 +3 -2
- package/dist/migration/migrator.d.ts.map +1 -1
- package/dist/migration/migrator.js +27 -21
- 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/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.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/s3-driver.d.ts.map +1 -1
- package/dist/storage/s3-driver.js +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-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.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.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 +1 -1
- 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 +1 -0
- 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/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 +7 -4
- 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.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/model.template.d.ts.map +1 -1
- package/dist/template/implementations/model.template.js +1 -1
- package/dist/template/implementations/queries.template.js +1 -1
- package/dist/template/implementations/sd.template.d.ts.map +1 -1
- package/dist/template/implementations/sd.template.js +79 -39
- 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 +6 -1
- 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_list.template.d.ts.map +1 -1
- package/dist/template/implementations/view_list.template.js +11 -6
- 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 +132 -73
- 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 +8 -7
- package/dist/testing/fixture-manager.d.ts.map +1 -1
- package/dist/testing/fixture-manager.js +91 -59
- 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/types/types.d.ts +101 -99
- 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.map +1 -1
- package/dist/utils/formatter.js +7 -5
- 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 +3 -5
- 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 +5 -3
- 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 +459 -152
- 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/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 +307 -0
- package/src/bin/build-config.ts +167 -0
- package/src/bin/cli.ts +153 -36
- package/src/bin/compiler-policy.ts +35 -0
- package/src/bin/fixture.ts +14 -3
- package/src/bin/test-command.ts +74 -29
- package/src/bin/ts-loader-registration.ts +22 -4
- 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 +6 -6
- package/src/dict/utils.ts +9 -1
- package/src/entity/entity-manager.ts +26 -9
- package/src/entity/entity-template-cone.ts +5 -10
- package/src/entity/entity.ts +50 -34
- 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/configure.ts +26 -18
- package/src/migration/__tests__/migrator.test.ts +50 -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 +68 -41
- 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 +67 -27
- 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 +129 -90
- package/src/testing/global-setup.ts +7 -3
- package/src/testing/index.ts +5 -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/formatter.ts +7 -3
- 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 +5 -2
- package/dist/ui-web/assets/index-C0m1pk6K.js +0 -177
|
@@ -2,8 +2,9 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
|
|
3
3
|
import { type Knex } from "knex";
|
|
4
4
|
|
|
5
|
+
import { isStringValue } from "../utils/runtime-value";
|
|
5
6
|
import { getValidClientIp } from "./audit-log/client-ip";
|
|
6
|
-
import { type AuditLogEvent } from "./audit-log/events";
|
|
7
|
+
import { type AuditEventData, type AuditLogEvent } from "./audit-log/events";
|
|
7
8
|
|
|
8
9
|
const AUDIT_EVENT_SOURCE = "better_auth";
|
|
9
10
|
const AUDIT_EVENT_SOURCE_VERSION = "better-auth|@better-auth/infra";
|
|
@@ -54,12 +55,12 @@ const USER_EVENT_TYPES = new Set<string>([
|
|
|
54
55
|
"user_deleted",
|
|
55
56
|
]);
|
|
56
57
|
|
|
57
|
-
function pickString(source:
|
|
58
|
+
function pickString(source: AuditEventData, key: string): string | null {
|
|
58
59
|
const value = source[key];
|
|
59
|
-
return
|
|
60
|
+
return isStringValue(value) ? value : null;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
function pickFirstString(source:
|
|
63
|
+
function pickFirstString(source: AuditEventData, keys: readonly string[]): string | null {
|
|
63
64
|
for (const key of keys) {
|
|
64
65
|
const value = pickString(source, key);
|
|
65
66
|
if (value !== null) {
|
|
@@ -69,11 +70,11 @@ function pickFirstString(source: Record<string, unknown>, keys: readonly string[
|
|
|
69
70
|
return null;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
function parseOccurredAt(raw:
|
|
73
|
+
function parseOccurredAt<Value>(raw: Value): Date {
|
|
73
74
|
if (raw instanceof Date && !Number.isNaN(raw.getTime())) {
|
|
74
75
|
return raw;
|
|
75
76
|
}
|
|
76
|
-
if (
|
|
77
|
+
if (isStringValue(raw)) {
|
|
77
78
|
const parsed = new Date(raw);
|
|
78
79
|
if (!Number.isNaN(parsed.getTime())) {
|
|
79
80
|
return parsed;
|
|
@@ -120,24 +121,27 @@ function computeDedupeKey(parts: {
|
|
|
120
121
|
action: string | null;
|
|
121
122
|
occurred_at: Date;
|
|
122
123
|
}): string {
|
|
123
|
-
const norm = (v: string | null): string => v ?? "";
|
|
124
124
|
const raw = [
|
|
125
125
|
parts.source,
|
|
126
126
|
parts.event_type,
|
|
127
127
|
parts.event_key,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
normalizeNullableKeyPart(parts.actor_user_id),
|
|
129
|
+
normalizeNullableKeyPart(parts.subject_user_id),
|
|
130
|
+
normalizeNullableKeyPart(parts.organization_id),
|
|
131
|
+
normalizeNullableKeyPart(parts.team_id),
|
|
132
|
+
normalizeNullableKeyPart(parts.session_id),
|
|
133
|
+
normalizeNullableKeyPart(parts.identifier),
|
|
134
|
+
normalizeNullableKeyPart(parts.reason),
|
|
135
|
+
normalizeNullableKeyPart(parts.action),
|
|
136
136
|
parts.occurred_at.toISOString(),
|
|
137
137
|
].join("|");
|
|
138
138
|
return createHash("sha256").update(raw).digest("hex");
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
function normalizeNullableKeyPart(value: string | null): string {
|
|
142
|
+
return value ?? "";
|
|
143
|
+
}
|
|
144
|
+
|
|
141
145
|
function computeEventIdDedupeKey(source: string, eventId: string): string {
|
|
142
146
|
return createHash("sha256").update(`${source}|${eventId}`).digest("hex");
|
|
143
147
|
}
|
|
@@ -7,6 +7,10 @@ import { betterAuthV1 } from "./better-auth-entities";
|
|
|
7
7
|
import { ENTITY_DEFINITIONS, isValidPluginId } from "./plugins/entity-definitions";
|
|
8
8
|
import { type BetterAuthPluginId } from "./plugins/entity-definitions";
|
|
9
9
|
|
|
10
|
+
interface SubsetFields {
|
|
11
|
+
[subsetKey: string]: string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* 누락된 props 찾기
|
|
12
16
|
*/
|
|
@@ -55,10 +59,10 @@ function findMissingIndexes(
|
|
|
55
59
|
* 누락된 subsets 찾기
|
|
56
60
|
*/
|
|
57
61
|
function findMissingSubsets(
|
|
58
|
-
existingSubsets:
|
|
59
|
-
requiredSubsets:
|
|
60
|
-
):
|
|
61
|
-
const missing:
|
|
62
|
+
existingSubsets: SubsetFields,
|
|
63
|
+
requiredSubsets: SubsetFields,
|
|
64
|
+
): SubsetFields {
|
|
65
|
+
const missing: SubsetFields = {};
|
|
62
66
|
for (const [key, fields] of Object.entries(requiredSubsets)) {
|
|
63
67
|
if (!existingSubsets[key]) {
|
|
64
68
|
missing[key] = fields;
|
|
@@ -125,7 +129,8 @@ async function createOrUpdateEntity(entityJson: EntityJson): Promise<void> {
|
|
|
125
129
|
// 누락된 subsets 추가
|
|
126
130
|
const missingSubsets = findMissingSubsets(
|
|
127
131
|
entity.subsets,
|
|
128
|
-
|
|
132
|
+
/* SAFETY: better-auth 훅과 어댑터 계약이 이 값의 타입을 보장한다. */ (entityJson.subsets ??
|
|
133
|
+
{}) as { [key: string]: string[] },
|
|
129
134
|
);
|
|
130
135
|
for (const [key, fields] of Object.entries(missingSubsets)) {
|
|
131
136
|
entity.subsets[key] = fields;
|
|
@@ -12,9 +12,10 @@ export function createBetterAuthRequest(
|
|
|
12
12
|
|
|
13
13
|
replaceClientIpHeaders(headers, request.ip, ipAddressHeaders);
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const init: RequestInit = {
|
|
16
16
|
method: request.method,
|
|
17
17
|
headers,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
};
|
|
19
|
+
if (request.body) init.body = JSON.stringify(request.body);
|
|
20
|
+
return new Request(url.toString(), init);
|
|
20
21
|
}
|
package/src/auth/knex-adapter.ts
CHANGED
|
@@ -190,12 +190,18 @@ function applyCondition(
|
|
|
190
190
|
case "in":
|
|
191
191
|
return query[method === "orWhere" ? "orWhereIn" : "whereIn"](
|
|
192
192
|
field,
|
|
193
|
-
value as (
|
|
193
|
+
/* SAFETY: better-auth 훅과 어댑터 계약이 이 값의 타입을 보장한다. */ value as (
|
|
194
|
+
| string
|
|
195
|
+
| number
|
|
196
|
+
)[],
|
|
194
197
|
);
|
|
195
198
|
case "not_in":
|
|
196
199
|
return query[method === "orWhere" ? "orWhereNotIn" : "whereNotIn"](
|
|
197
200
|
field,
|
|
198
|
-
value as (
|
|
201
|
+
/* SAFETY: better-auth 훅과 어댑터 계약이 이 값의 타입을 보장한다. */ value as (
|
|
202
|
+
| string
|
|
203
|
+
| number
|
|
204
|
+
)[],
|
|
199
205
|
);
|
|
200
206
|
case "contains":
|
|
201
207
|
return query[method](field, "like", `%${value}%`);
|
|
@@ -28,7 +28,7 @@ import { usernameEntityDef } from "./username";
|
|
|
28
28
|
* 엔티티 정의 레지스트리
|
|
29
29
|
* 플러그인 ID로 엔티티 정의에 접근할 수 있습니다.
|
|
30
30
|
*/
|
|
31
|
-
export const ENTITY_DEFINITIONS
|
|
31
|
+
export const ENTITY_DEFINITIONS = {
|
|
32
32
|
admin: adminEntityDef,
|
|
33
33
|
username: usernameEntityDef,
|
|
34
34
|
"phone-number": phoneNumberEntityDef,
|
|
@@ -40,14 +40,15 @@ export const ENTITY_DEFINITIONS: Record<BetterAuthPluginId, BetterAuthEntityDef>
|
|
|
40
40
|
jwt: jwtEntityDef,
|
|
41
41
|
anonymous: anonymousEntityDef,
|
|
42
42
|
"audit-log": auditLogEntityDef,
|
|
43
|
-
}
|
|
43
|
+
} satisfies Record<BetterAuthPluginId, BetterAuthEntityDef>;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* 지원하는 플러그인 ID 목록
|
|
47
47
|
*/
|
|
48
|
-
export const SUPPORTED_PLUGIN_IDS: BetterAuthPluginId[] =
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
export const SUPPORTED_PLUGIN_IDS: BetterAuthPluginId[] =
|
|
49
|
+
/* SAFETY: better-auth 훅과 어댑터 계약이 이 값의 타입을 보장한다. */ Object.keys(
|
|
50
|
+
ENTITY_DEFINITIONS,
|
|
51
|
+
) as BetterAuthPluginId[];
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* 플러그인 ID가 유효한지 확인합니다.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
|
|
5
|
+
import { beforeAll, describe, expect, it } from "vitest";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
|
|
8
|
+
const isolatedModeNames = ["cachedPlain", "eagerJit", "aot"] as const;
|
|
9
|
+
type IsolatedModeName = (typeof isolatedModeNames)[number];
|
|
10
|
+
|
|
11
|
+
const ProcessMetricSchema = z.object({
|
|
12
|
+
startupMs: z.number(),
|
|
13
|
+
rssAtStartBytes: z.number(),
|
|
14
|
+
rssReadyBytes: z.number(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const ModeRunResultSchema = z.object({
|
|
18
|
+
mode: z.enum(isolatedModeNames),
|
|
19
|
+
parity: z.literal(true),
|
|
20
|
+
fixtureAssertions: z.object({
|
|
21
|
+
validAccepted: z.literal(true),
|
|
22
|
+
invalidRejected: z.literal(true),
|
|
23
|
+
}),
|
|
24
|
+
process: ProcessMetricSchema,
|
|
25
|
+
resultChecksum: z.number(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
type ModeRunResult = z.infer<typeof ModeRunResultSchema>;
|
|
29
|
+
|
|
30
|
+
const packageRoot = path.resolve(import.meta.dirname, "../../..");
|
|
31
|
+
const benchmarkArtifactPath = path.join(packageRoot, "benchmarks/dist/http-validator.bench.mjs");
|
|
32
|
+
|
|
33
|
+
function parseModeOutput(output: string): ModeRunResult {
|
|
34
|
+
const outputLine = output
|
|
35
|
+
.split("\n")
|
|
36
|
+
.map((line) => line.trim())
|
|
37
|
+
.filter((line) => line.length > 0)
|
|
38
|
+
.at(-1);
|
|
39
|
+
if (outputLine === undefined) {
|
|
40
|
+
throw new Error("benchmark child process가 결과를 출력하지 않았습니다");
|
|
41
|
+
}
|
|
42
|
+
return ModeRunResultSchema.parse(JSON.parse(outputLine));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function runBenchmarkMode(mode: IsolatedModeName): ModeRunResult {
|
|
46
|
+
const output = execFileSync(process.execPath, [benchmarkArtifactPath], {
|
|
47
|
+
cwd: packageRoot,
|
|
48
|
+
encoding: "utf8",
|
|
49
|
+
env: {
|
|
50
|
+
...process.env,
|
|
51
|
+
BENCHMARK_MODE: mode,
|
|
52
|
+
BENCHMARK_RUN_INDEX: "0",
|
|
53
|
+
ZOD_COMPILER: undefined,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
return parseModeOutput(output);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe("HTTP validator benchmark RSS 계약", () => {
|
|
60
|
+
const results = new Map<IsolatedModeName, ModeRunResult>();
|
|
61
|
+
|
|
62
|
+
beforeAll(() => {
|
|
63
|
+
execFileSync("pnpm", ["exec", "tsdown", "--config", "benchmarks/tsdown.config.ts"], {
|
|
64
|
+
cwd: packageRoot,
|
|
65
|
+
encoding: "utf8",
|
|
66
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
for (const mode of isolatedModeNames) {
|
|
70
|
+
results.set(mode, runBenchmarkMode(mode));
|
|
71
|
+
}
|
|
72
|
+
}, 120_000);
|
|
73
|
+
|
|
74
|
+
it("각 validator mode를 실제 child process로 실행한다", () => {
|
|
75
|
+
expect([...results.keys()]).toEqual(isolatedModeNames);
|
|
76
|
+
for (const mode of isolatedModeNames) {
|
|
77
|
+
expect(results.get(mode)).toMatchObject({
|
|
78
|
+
mode,
|
|
79
|
+
parity: true,
|
|
80
|
+
fixtureAssertions: { validAccepted: true, invalidRejected: true },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("각 mode의 시작 및 준비 시점 RSS를 보고한다", () => {
|
|
86
|
+
for (const mode of isolatedModeNames) {
|
|
87
|
+
expect(results.get(mode)?.process).toMatchObject({
|
|
88
|
+
startupMs: expect.any(Number),
|
|
89
|
+
rssAtStartBytes: expect.any(Number),
|
|
90
|
+
rssReadyBytes: expect.any(Number),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
|
|
3
|
+
import { testCommand } from "../test-command";
|
|
4
|
+
|
|
3
5
|
const originalArgv = process.argv;
|
|
4
6
|
const originalNodeEnv = process.env.NODE_ENV;
|
|
5
7
|
const originalVitest = process.env.VITEST;
|
|
6
|
-
const originalFetch = globalThis.fetch;
|
|
7
8
|
|
|
8
9
|
// process.argv 파싱 로직을 검증하는 유닛 테스트
|
|
9
10
|
// test-command.ts의 파싱 로직을 동일하게 구현하여 독립 검증
|
|
10
|
-
function parseArgs(args: string[])
|
|
11
|
-
files: string[];
|
|
12
|
-
pattern: string | undefined;
|
|
13
|
-
showTraces: boolean;
|
|
14
|
-
} {
|
|
11
|
+
function parseArgs(args: string[]) {
|
|
15
12
|
const files: string[] = [];
|
|
16
13
|
let pattern: string | undefined;
|
|
17
14
|
let showTraces = false;
|
|
@@ -91,7 +88,6 @@ describe("test-command argument parsing", () => {
|
|
|
91
88
|
|
|
92
89
|
describe("test-command dev server endpoint resolution", () => {
|
|
93
90
|
beforeEach(() => {
|
|
94
|
-
vi.resetModules();
|
|
95
91
|
vi.restoreAllMocks();
|
|
96
92
|
process.argv = [process.execPath, "sonamu", "test", "--status"];
|
|
97
93
|
process.env.NODE_ENV = "development";
|
|
@@ -99,10 +95,8 @@ describe("test-command dev server endpoint resolution", () => {
|
|
|
99
95
|
});
|
|
100
96
|
|
|
101
97
|
afterEach(() => {
|
|
102
|
-
vi.resetModules();
|
|
103
98
|
vi.restoreAllMocks();
|
|
104
99
|
process.argv = originalArgv;
|
|
105
|
-
globalThis.fetch = originalFetch;
|
|
106
100
|
|
|
107
101
|
if (originalNodeEnv === undefined) {
|
|
108
102
|
delete process.env.NODE_ENV;
|
|
@@ -136,7 +130,7 @@ describe("test-command dev server endpoint resolution", () => {
|
|
|
136
130
|
},
|
|
137
131
|
};
|
|
138
132
|
});
|
|
139
|
-
const fetch = vi.fn(async () => {
|
|
133
|
+
const fetch = vi.fn(async (_input: RequestInfo | URL, _init?: RequestInit) => {
|
|
140
134
|
return new Response(
|
|
141
135
|
JSON.stringify({
|
|
142
136
|
ready: true,
|
|
@@ -151,13 +145,13 @@ describe("test-command dev server endpoint resolution", () => {
|
|
|
151
145
|
);
|
|
152
146
|
});
|
|
153
147
|
|
|
154
|
-
vi.doMock("../../api/config", () => ({ loadConfig }));
|
|
155
|
-
vi.doMock("../../utils/utils", () => ({ findApiRootPath: () => "/tmp/api" }));
|
|
156
148
|
vi.spyOn(console, "log").mockImplementation(() => {});
|
|
157
|
-
globalThis.fetch = fetch as typeof globalThis.fetch;
|
|
158
149
|
|
|
159
|
-
|
|
160
|
-
|
|
150
|
+
await testCommand({
|
|
151
|
+
fetch,
|
|
152
|
+
findApiRootPath: () => "/tmp/api",
|
|
153
|
+
loadConfig,
|
|
154
|
+
});
|
|
161
155
|
|
|
162
156
|
expect(loadConfig).toHaveBeenCalledWith("/tmp/api");
|
|
163
157
|
expect(fetch).toHaveBeenCalledWith("http://127.0.0.1:4401/__dev_test__/status");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
|
|
3
|
+
import { ensureTsLoaderRegistered } from "../ts-loader-registration";
|
|
4
|
+
|
|
3
5
|
const tsLoaderRegisterStateKey = Symbol.for("sonamu.ts-loader-register.state");
|
|
4
6
|
|
|
5
7
|
type TsLoaderRegisterState = {
|
|
@@ -11,47 +13,43 @@ type GlobalWithTsLoaderRegisterState = typeof globalThis & {
|
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
function resetRegisterState() {
|
|
14
|
-
const globalState =
|
|
16
|
+
const globalState =
|
|
17
|
+
/* SAFETY: CLI 파서와 빌드 도구 입력 계약이 이 값의 타입을 보장한다. */ globalThis as GlobalWithTsLoaderRegisterState;
|
|
15
18
|
delete globalState[tsLoaderRegisterStateKey];
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
describe("ensureTsLoaderRegistered", () => {
|
|
19
22
|
beforeEach(() => {
|
|
20
|
-
vi.resetModules();
|
|
21
23
|
vi.restoreAllMocks();
|
|
22
|
-
vi.unmock("node:module");
|
|
23
24
|
resetRegisterState();
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
afterEach(() => {
|
|
27
|
-
vi.resetModules();
|
|
28
28
|
vi.restoreAllMocks();
|
|
29
|
-
vi.unmock("node:module");
|
|
30
29
|
resetRegisterState();
|
|
31
30
|
});
|
|
32
31
|
|
|
33
32
|
it("중복 등록하지 않는다", async () => {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const module = await import("../ts-loader-registration");
|
|
33
|
+
const registerFake = vi.fn();
|
|
34
|
+
const dependencies = {
|
|
35
|
+
registerLoader: registerFake,
|
|
36
|
+
resolveLoaderPath: () => "/modules/ts-loader/dist/loader.js",
|
|
37
|
+
};
|
|
40
38
|
|
|
41
|
-
expect(
|
|
39
|
+
expect(registerFake).not.toHaveBeenCalled();
|
|
42
40
|
|
|
43
|
-
await
|
|
41
|
+
await ensureTsLoaderRegistered("/tmp/fixture-api", dependencies);
|
|
44
42
|
|
|
45
|
-
expect(
|
|
46
|
-
expect(
|
|
43
|
+
expect(registerFake).toHaveBeenCalledTimes(1);
|
|
44
|
+
expect(registerFake).toHaveBeenCalledWith(
|
|
47
45
|
expect.stringContaining("/modules/ts-loader/dist/loader.js"),
|
|
48
46
|
{
|
|
49
47
|
parentURL: expect.stringContaining("/src/bin/ts-loader-registration"),
|
|
50
48
|
},
|
|
51
49
|
);
|
|
52
50
|
|
|
53
|
-
await
|
|
51
|
+
await ensureTsLoaderRegistered("/tmp/another-api", dependencies);
|
|
54
52
|
|
|
55
|
-
expect(
|
|
53
|
+
expect(registerFake).toHaveBeenCalledTimes(1);
|
|
56
54
|
});
|
|
57
55
|
});
|