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
|
@@ -6,6 +6,7 @@ description: Writing Sonamu Model classes. BaseModelClass inheritance, CRUD meth
|
|
|
6
6
|
# Model Class
|
|
7
7
|
|
|
8
8
|
**Reference working code:**
|
|
9
|
+
|
|
9
10
|
- `sonamu/examples/miomock/api/src/application/project/project.model.ts` - ManyToMany save implementation
|
|
10
11
|
- `sonamu/examples/miomock/api/src/application/employee/employee.model.ts` - basic CRUD pattern
|
|
11
12
|
- `sonamu/examples/miomock/api/src/application/project/project.model.test.ts` - test examples
|
|
@@ -36,12 +37,12 @@ export const UserModel = new UserModelClass();
|
|
|
36
37
|
|
|
37
38
|
Sonamu Model provides the following basic methods:
|
|
38
39
|
|
|
39
|
-
| Method
|
|
40
|
-
|
|
41
|
-
| `findById` | Retrieve single record |
|
|
42
|
-
| `findMany` | Retrieve list
|
|
43
|
-
| `save`
|
|
44
|
-
| `del`
|
|
40
|
+
| Method | Purpose | Notes |
|
|
41
|
+
| ---------- | ---------------------- | ------------------ |
|
|
42
|
+
| `findById` | Retrieve single record | |
|
|
43
|
+
| `findMany` | Retrieve list | |
|
|
44
|
+
| `save` | Create/update | upsert behavior |
|
|
45
|
+
| `del` | Delete | Note: not `delete` |
|
|
45
46
|
|
|
46
47
|
**Avoiding JavaScript reserved words:** `delete` is a JS reserved word, so it is named `del`. While TypeScript allows `delete` as a method name without a compile error, it can cause runtime issues, so Sonamu uses `del`.
|
|
47
48
|
|
|
@@ -103,13 +104,13 @@ async del(ids: number[]): Promise<number> {
|
|
|
103
104
|
|
|
104
105
|
## BaseModel Methods
|
|
105
106
|
|
|
106
|
-
| Method
|
|
107
|
-
|
|
108
|
-
| `getPuri("r")`
|
|
109
|
-
| `getPuri("w")`
|
|
110
|
-
| `getSubsetQueries(subset)`
|
|
111
|
-
| `executeSubsetQuery(options)` | Execute subset query
|
|
112
|
-
| `createEnhancers(enhancers)`
|
|
107
|
+
| Method | Description |
|
|
108
|
+
| ----------------------------- | ------------------------------------------------- |
|
|
109
|
+
| `getPuri("r")` | Read query builder |
|
|
110
|
+
| `getPuri("w")` | Write query builder |
|
|
111
|
+
| `getSubsetQueries(subset)` | Subset query builder (returns `{ qb, onSubset }`) |
|
|
112
|
+
| `executeSubsetQuery(options)` | Execute subset query |
|
|
113
|
+
| `createEnhancers(enhancers)` | Enhancer object creation helper (type inference) |
|
|
113
114
|
|
|
114
115
|
## getSubsetQueries
|
|
115
116
|
|
|
@@ -120,19 +121,19 @@ const { qb, onSubset } = this.getSubsetQueries(subset);
|
|
|
120
121
|
qb.where("users.status", "active");
|
|
121
122
|
|
|
122
123
|
// onSubset: when you need the type for a specific subset
|
|
123
|
-
const typedQb = onSubset("A");
|
|
124
|
+
const typedQb = onSubset("A"); // infers as subset A's type
|
|
124
125
|
```
|
|
125
126
|
|
|
126
127
|
## executeSubsetQuery Options
|
|
127
128
|
|
|
128
129
|
```typescript
|
|
129
130
|
return this.executeSubsetQuery({
|
|
130
|
-
subset,
|
|
131
|
-
qb,
|
|
132
|
-
params,
|
|
133
|
-
debug: true,
|
|
134
|
-
optimizeCountQuery: true,
|
|
135
|
-
enhancers,
|
|
131
|
+
subset, // subset key
|
|
132
|
+
qb, // query builder
|
|
133
|
+
params, // ListParams (num, page, queryMode, sonamuFilter, etc.)
|
|
134
|
+
debug: true, // print query log (default: false)
|
|
135
|
+
optimizeCountQuery: true, // COUNT query optimization - removes unnecessary LEFT JOINs (default: false)
|
|
136
|
+
enhancers, // Enhancer function object (optional)
|
|
136
137
|
});
|
|
137
138
|
```
|
|
138
139
|
|
|
@@ -183,11 +184,11 @@ const params = {
|
|
|
183
184
|
num: 10,
|
|
184
185
|
page: 1,
|
|
185
186
|
sonamuFilter: {
|
|
186
|
-
status: "active",
|
|
187
|
-
age: { gte: 18 },
|
|
187
|
+
status: "active", // eq (default)
|
|
188
|
+
age: { gte: 18 }, // >=
|
|
188
189
|
role: { in: ["admin", "user"] },
|
|
189
|
-
email: { contains: "@test" },
|
|
190
|
-
}
|
|
190
|
+
email: { contains: "@test" }, // LIKE %...%
|
|
191
|
+
},
|
|
191
192
|
};
|
|
192
193
|
|
|
193
194
|
// Automatically applied in the Model
|
|
@@ -196,31 +197,31 @@ return this.executeSubsetQuery({ subset, qb, params });
|
|
|
196
197
|
|
|
197
198
|
**Allowed operators by type:**
|
|
198
199
|
|
|
199
|
-
| Type
|
|
200
|
-
|
|
201
|
-
| `string`
|
|
202
|
-
| `integer`
|
|
203
|
-
| `numeric`
|
|
204
|
-
| `boolean`
|
|
205
|
-
| `date`/`datetime` | eq, ne, before, after, between, isNull, isNotNull
|
|
206
|
-
| `enum`
|
|
207
|
-
| `json`
|
|
200
|
+
| Type | Operators |
|
|
201
|
+
| ----------------- | -------------------------------------------------------------------- |
|
|
202
|
+
| `string` | eq, ne, contains, startsWith, endsWith, in, notIn, isNull, isNotNull |
|
|
203
|
+
| `integer` | eq, ne, gt, gte, lt, lte, in, notIn, between, isNull, isNotNull |
|
|
204
|
+
| `numeric` | eq, ne, gt, gte, lt, lte, in, notIn, between, isNull, isNotNull |
|
|
205
|
+
| `boolean` | eq, ne, isNull, isNotNull |
|
|
206
|
+
| `date`/`datetime` | eq, ne, before, after, between, isNull, isNotNull |
|
|
207
|
+
| `enum` | eq, ne, in, notIn, isNull, isNotNull |
|
|
208
|
+
| `json` | isNull, isNotNull |
|
|
208
209
|
|
|
209
210
|
**Operator examples:**
|
|
210
211
|
|
|
211
|
-
| Operator
|
|
212
|
-
|
|
213
|
-
| `eq` (default)
|
|
214
|
-
| `ne`
|
|
215
|
-
| `gt`, `gte`
|
|
216
|
-
| `lt`, `lte`
|
|
217
|
-
| `in`, `notIn`
|
|
218
|
-
| `contains`
|
|
219
|
-
| `startsWith`
|
|
220
|
-
| `endsWith`
|
|
221
|
-
| `isNull`, `isNotNull` | `IS NULL`
|
|
222
|
-
| `before`, `after`
|
|
223
|
-
| `between`
|
|
212
|
+
| Operator | SQL | Example |
|
|
213
|
+
| --------------------- | --------------- | ----------------------------------------- |
|
|
214
|
+
| `eq` (default) | `=` | `{ status: "active" }` |
|
|
215
|
+
| `ne` | `!=` | `{ status: { ne: "deleted" } }` |
|
|
216
|
+
| `gt`, `gte` | `>`, `>=` | `{ age: { gte: 18 } }` |
|
|
217
|
+
| `lt`, `lte` | `<`, `<=` | `{ price: { lte: 1000 } }` |
|
|
218
|
+
| `in`, `notIn` | `IN`, `NOT IN` | `{ role: { in: ["a", "b"] } }` |
|
|
219
|
+
| `contains` | `LIKE %...%` | `{ name: { contains: "kim" } }` |
|
|
220
|
+
| `startsWith` | `LIKE ...%` | `{ code: { startsWith: "A" } }` |
|
|
221
|
+
| `endsWith` | `LIKE %...` | `{ ext: { endsWith: ".pdf" } }` |
|
|
222
|
+
| `isNull`, `isNotNull` | `IS NULL` | `{ deleted_at: { isNull: true } }` |
|
|
223
|
+
| `before`, `after` | `<`, `>` (date) | `{ created_at: { after: "2024-01-01" } }` |
|
|
224
|
+
| `between` | `BETWEEN` | `{ price: { between: [100, 500] } }` |
|
|
224
225
|
|
|
225
226
|
**Type definition (`ApplySonamuFilter`):**
|
|
226
227
|
|
|
@@ -232,9 +233,9 @@ type ProjectListParams = {
|
|
|
232
233
|
num: number;
|
|
233
234
|
page: number;
|
|
234
235
|
sonamuFilter?: ApplySonamuFilter<
|
|
235
|
-
ProjectSubsetA,
|
|
236
|
-
"id" | "created_at",
|
|
237
|
-
"budget"
|
|
236
|
+
ProjectSubsetA, // entity type
|
|
237
|
+
"id" | "created_at", // fields to exclude (TOmitKeys)
|
|
238
|
+
"budget" // fields to treat as numeric (TNumericKeys)
|
|
238
239
|
>;
|
|
239
240
|
};
|
|
240
241
|
```
|
|
@@ -265,7 +266,12 @@ return this.executeSubsetQuery({ subset, qb, params, enhancers });
|
|
|
265
266
|
```typescript
|
|
266
267
|
// user.types.ts
|
|
267
268
|
import { z } from "zod";
|
|
268
|
-
import {
|
|
269
|
+
import {
|
|
270
|
+
UserOrderBy,
|
|
271
|
+
UserSearchField,
|
|
272
|
+
UserBaseSchema,
|
|
273
|
+
UserBaseListParams,
|
|
274
|
+
} from "../sonamu.generated";
|
|
269
275
|
|
|
270
276
|
export const UserListParams = UserBaseListParams;
|
|
271
277
|
export type UserListParams = z.infer<typeof UserListParams>;
|
|
@@ -281,6 +287,7 @@ export type UserSaveParams = z.infer<typeof UserSaveParams>;
|
|
|
281
287
|
### SaveParams Patterns
|
|
282
288
|
|
|
283
289
|
**Basic pattern (no relations):**
|
|
290
|
+
|
|
284
291
|
```typescript
|
|
285
292
|
import { UserBaseSchema, UserBaseListParams } from "../sonamu.generated";
|
|
286
293
|
|
|
@@ -295,6 +302,7 @@ export type UserSaveParams = z.infer<typeof UserSaveParams>;
|
|
|
295
302
|
```
|
|
296
303
|
|
|
297
304
|
**If a ManyToMany relation exists:**
|
|
305
|
+
|
|
298
306
|
```typescript
|
|
299
307
|
// ManyToMany relation: add {relation_name}_ids array
|
|
300
308
|
export const ProjectSaveParams = ProjectBaseSchema.partial({
|
|
@@ -313,23 +321,26 @@ export type ProjectSaveParams = z.infer<typeof ProjectSaveParams>;
|
|
|
313
321
|
```
|
|
314
322
|
|
|
315
323
|
**Handling nullable fields in BelongsToOne relations:**
|
|
324
|
+
|
|
316
325
|
```typescript
|
|
317
326
|
// Nullable relations are automatically optional, so no extra partial is needed
|
|
318
327
|
export const ResponseSaveParams = ResponseBaseSchema.partial({
|
|
319
328
|
id: true,
|
|
320
329
|
created_at: true,
|
|
321
|
-
updated_at: true,
|
|
330
|
+
updated_at: true, // also make timestamp fields partial
|
|
322
331
|
});
|
|
323
332
|
export type ResponseSaveParams = z.infer<typeof ResponseSaveParams>;
|
|
324
333
|
```
|
|
325
334
|
|
|
326
335
|
**Reference working code:**
|
|
336
|
+
|
|
327
337
|
- `sonamu/examples/miomock/api/src/application/project/project.types.ts` - ManyToMany SaveParams example
|
|
328
338
|
- `sonamu/examples/miomock/api/src/application/employee/employee.types.ts` - BelongsToOne SaveParams example
|
|
329
339
|
|
|
330
340
|
### Handling Relations in the Model
|
|
331
341
|
|
|
332
342
|
**Removing relation objects on update:**
|
|
343
|
+
|
|
333
344
|
```typescript
|
|
334
345
|
// Pattern used in tests for updates
|
|
335
346
|
const original = await UserModel.findById("A", userId);
|
|
@@ -340,13 +351,14 @@ const { institution, ...userData } = original;
|
|
|
340
351
|
await UserModel.save([
|
|
341
352
|
{
|
|
342
353
|
...userData,
|
|
343
|
-
institution_id: institution?.id ?? null,
|
|
354
|
+
institution_id: institution?.id ?? null, // explicitly add FK
|
|
344
355
|
name: "Updated Name",
|
|
345
356
|
},
|
|
346
357
|
]);
|
|
347
358
|
```
|
|
348
359
|
|
|
349
360
|
**ManyToMany save:**
|
|
361
|
+
|
|
350
362
|
```typescript
|
|
351
363
|
// ManyToMany is passed as an _ids array
|
|
352
364
|
await ProjectModel.save([
|
|
@@ -360,6 +372,7 @@ await ProjectModel.save([
|
|
|
360
372
|
```
|
|
361
373
|
|
|
362
374
|
**Reference working code:**
|
|
375
|
+
|
|
363
376
|
- `sonamu/examples/miomock/api/src/application/project/project.model.ts` - ManyToMany save implementation
|
|
364
377
|
- `sonamu/examples/miomock/api/src/application/project/project.model.test.ts` - Save test example
|
|
365
378
|
|
|
@@ -385,19 +398,19 @@ async enroll(courseId: number, userId: number): Promise<Enrollment> {
|
|
|
385
398
|
course_id: courseId,
|
|
386
399
|
user_id: userId,
|
|
387
400
|
});
|
|
388
|
-
|
|
401
|
+
|
|
389
402
|
if (existing) {
|
|
390
403
|
throw new Error("Already enrolled in this course");
|
|
391
404
|
}
|
|
392
|
-
|
|
405
|
+
|
|
393
406
|
// Step 2: Capacity check
|
|
394
407
|
const course = await CourseModel.findById("A", courseId);
|
|
395
408
|
const { total } = await this.findMany({ course_id: courseId });
|
|
396
|
-
|
|
409
|
+
|
|
397
410
|
if (total >= course.max_students) {
|
|
398
411
|
throw new Error("The course is full");
|
|
399
412
|
}
|
|
400
|
-
|
|
413
|
+
|
|
401
414
|
// Step 3: Execute
|
|
402
415
|
const [id] = await this.save([{ course_id: courseId, user_id: userId }]);
|
|
403
416
|
return this.findById("A", id);
|
|
@@ -415,17 +428,17 @@ async save(spa: TaskSaveParams[]): Promise<number[]> {
|
|
|
415
428
|
if (sp.status === "completed" && !sp.completed_at) {
|
|
416
429
|
throw new Error("A completion date is required for completed status");
|
|
417
430
|
}
|
|
418
|
-
|
|
431
|
+
|
|
419
432
|
// Check amount range only when budget is present
|
|
420
433
|
if (sp.budget !== null && sp.budget < 0) {
|
|
421
434
|
throw new Error("Budget must be 0 or greater");
|
|
422
435
|
}
|
|
423
436
|
}
|
|
424
|
-
|
|
437
|
+
|
|
425
438
|
// Save after validation passes
|
|
426
439
|
const wdb = this.getPuri("w");
|
|
427
440
|
spa.forEach((sp) => wdb.ubRegister("tasks", sp));
|
|
428
|
-
|
|
441
|
+
|
|
429
442
|
return wdb.transaction(async (trx) => {
|
|
430
443
|
return trx.ubUpsert("tasks");
|
|
431
444
|
});
|
|
@@ -441,22 +454,22 @@ async save(spa: ResponseSaveParams[]): Promise<number[]> {
|
|
|
441
454
|
for (const sp of spa) {
|
|
442
455
|
// Check if the survey is still open
|
|
443
456
|
const collection = await CollectionModel.findById("A", sp.collection_id);
|
|
444
|
-
|
|
457
|
+
|
|
445
458
|
if (collection.status === "closed") {
|
|
446
459
|
throw new Error("This survey has already ended");
|
|
447
460
|
}
|
|
448
|
-
|
|
461
|
+
|
|
449
462
|
// Check response period
|
|
450
463
|
const now = new Date();
|
|
451
464
|
if (now < collection.begin_date || now > collection.end_date) {
|
|
452
465
|
throw new Error("This is not within the response period");
|
|
453
466
|
}
|
|
454
467
|
}
|
|
455
|
-
|
|
468
|
+
|
|
456
469
|
// Save after validation passes
|
|
457
470
|
const wdb = this.getPuri("w");
|
|
458
471
|
spa.forEach((sp) => wdb.ubRegister("responses", sp));
|
|
459
|
-
|
|
472
|
+
|
|
460
473
|
return wdb.transaction(async (trx) => {
|
|
461
474
|
return trx.ubUpsert("responses");
|
|
462
475
|
});
|
|
@@ -464,6 +477,7 @@ async save(spa: ResponseSaveParams[]): Promise<number[]> {
|
|
|
464
477
|
```
|
|
465
478
|
|
|
466
479
|
**Key points:**
|
|
480
|
+
|
|
467
481
|
- Clear error messages when validation fails
|
|
468
482
|
- Only save after all validations pass
|
|
469
483
|
- Enforce business rules through code
|
|
@@ -517,6 +531,7 @@ if (params.orderBy) {
|
|
|
517
531
|
Use `this.modelName` instead of hardcoding the model name in error messages.
|
|
518
532
|
|
|
519
533
|
**BAD: hardcoded model name**
|
|
534
|
+
|
|
520
535
|
```typescript
|
|
521
536
|
// department.model.ts
|
|
522
537
|
if (!rows[0]) {
|
|
@@ -530,6 +545,7 @@ if (!rows[0]) {
|
|
|
530
545
|
```
|
|
531
546
|
|
|
532
547
|
**GOOD: use this.modelName**
|
|
548
|
+
|
|
533
549
|
```typescript
|
|
534
550
|
// Common to all Models
|
|
535
551
|
if (!rows[0]) {
|
|
@@ -538,6 +554,7 @@ if (!rows[0]) {
|
|
|
538
554
|
```
|
|
539
555
|
|
|
540
556
|
**Benefits:**
|
|
557
|
+
|
|
541
558
|
- Prevents copy-paste mistakes: no need to update the model name when copying from another model
|
|
542
559
|
- Consistency: all models use the same pattern
|
|
543
560
|
- Maintainability: changing modelName in the constructor automatically reflects in all error messages
|
|
@@ -547,6 +564,7 @@ if (!rows[0]) {
|
|
|
547
564
|
Use the same i18n keys consistently for the same purpose across the entire project.
|
|
548
565
|
|
|
549
566
|
**BAD: duplicate i18n keys**
|
|
567
|
+
|
|
550
568
|
```typescript
|
|
551
569
|
// Different keys used across models
|
|
552
570
|
throw new NotFoundException(SD("error.entityNotFound")(this.modelName, id));
|
|
@@ -559,6 +577,7 @@ throw new BadRequestException(SD("error.invalidSearchField")(params.search));
|
|
|
559
577
|
```
|
|
560
578
|
|
|
561
579
|
**GOOD: use standard i18n keys**
|
|
580
|
+
|
|
562
581
|
```typescript
|
|
563
582
|
// Entity lookup failure - short and clear
|
|
564
583
|
throw new NotFoundException(SD("notFound")(this.modelName, id));
|
|
@@ -581,18 +600,21 @@ throw new BadRequestException(SD("search.invalidField")(params.search));
|
|
|
581
600
|
When consistently modifying multiple model files, use sed for automation:
|
|
582
601
|
|
|
583
602
|
**Step 1: Confirm pattern**
|
|
603
|
+
|
|
584
604
|
```bash
|
|
585
605
|
# Find files to modify
|
|
586
606
|
grep -r 'SD("error.entityNotFound")' packages/api/src/application/*/
|
|
587
607
|
```
|
|
588
608
|
|
|
589
609
|
**Step 2: Validate changes (dry-run)**
|
|
610
|
+
|
|
590
611
|
```bash
|
|
591
612
|
# Preview changes before applying
|
|
592
613
|
sed -n 's/SD("error.entityNotFound")(\(.*\), id)/SD("notFound")(this.modelName, id)/p' file.ts
|
|
593
614
|
```
|
|
594
615
|
|
|
595
616
|
**Step 3: Apply in bulk**
|
|
617
|
+
|
|
596
618
|
```bash
|
|
597
619
|
# Modify all model files
|
|
598
620
|
find packages/api/src/application -name "*.model.ts" -exec sed -i '' \
|
|
@@ -600,6 +622,7 @@ find packages/api/src/application -name "*.model.ts" -exec sed -i '' \
|
|
|
600
622
|
```
|
|
601
623
|
|
|
602
624
|
**Step 4: Validate with build**
|
|
625
|
+
|
|
603
626
|
```bash
|
|
604
627
|
# TypeScript type check
|
|
605
628
|
pnpm typecheck
|
|
@@ -609,6 +632,7 @@ pnpm build
|
|
|
609
632
|
```
|
|
610
633
|
|
|
611
634
|
**Cautions:**
|
|
635
|
+
|
|
612
636
|
- Always run after a git commit (to allow rollback)
|
|
613
637
|
- Confirm changes with dry-run first
|
|
614
638
|
- Check for type errors with build
|
|
@@ -624,7 +648,7 @@ const params = {
|
|
|
624
648
|
num: 24,
|
|
625
649
|
page: 1,
|
|
626
650
|
search: "id" as const,
|
|
627
|
-
orderBy: "wrong-value" as const,
|
|
651
|
+
orderBy: "wrong-value" as const, // error not detected
|
|
628
652
|
...rawParams,
|
|
629
653
|
} as RoleListParams;
|
|
630
654
|
|
|
@@ -633,12 +657,13 @@ const params = {
|
|
|
633
657
|
num: 24,
|
|
634
658
|
page: 1,
|
|
635
659
|
search: "id" as const,
|
|
636
|
-
orderBy: "wrong-value" as const,
|
|
660
|
+
orderBy: "wrong-value" as const, // compile error!
|
|
637
661
|
...rawParams,
|
|
638
662
|
} satisfies RoleListParams;
|
|
639
663
|
```
|
|
640
664
|
|
|
641
665
|
**Recommended usage locations:**
|
|
666
|
+
|
|
642
667
|
- Default values for params in findMany
|
|
643
668
|
- Complex object literals (where type checking is important)
|
|
644
669
|
|
|
@@ -651,6 +676,7 @@ The following three must always remain consistent. If any one is out of sync, th
|
|
|
651
676
|
3. Filter/search handling code in `findMany` in `model.ts`
|
|
652
677
|
|
|
653
678
|
**Checklist:**
|
|
679
|
+
|
|
654
680
|
- [ ] Are all values declared in SearchField implemented in findMany?
|
|
655
681
|
- [ ] If any filter branch is commented out, either remove it or implement it
|
|
656
682
|
- [ ] Are "filter by ~", "search by ~" features from requirements reflected in ListParams?
|
|
@@ -673,6 +699,7 @@ if (params.submitter_id) qb.where("achievements.submitter_id", params.submitter_
|
|
|
673
699
|
```
|
|
674
700
|
|
|
675
701
|
**DO NOT - declaration/implementation mismatch:**
|
|
702
|
+
|
|
676
703
|
```typescript
|
|
677
704
|
// SearchField "title" declared in entity.json
|
|
678
705
|
// model.ts only handles "id" case, "title" is commented out
|
|
@@ -686,17 +713,19 @@ if (params.search === "id") {
|
|
|
686
713
|
### Code Review Checklist
|
|
687
714
|
|
|
688
715
|
When writing a new Model:
|
|
716
|
+
|
|
689
717
|
- [ ] Use `this.modelName` (no hardcoding)
|
|
690
718
|
- [ ] Use standard i18n keys (`notFound`, `search.invalidField`)
|
|
691
719
|
- [ ] Use the `satisfies` keyword (type safety)
|
|
692
720
|
- [ ] Do not unnecessarily specify the debug option
|
|
693
721
|
- [ ] Exhaustively handle all orderBy cases
|
|
694
|
-
- [ ] If a ManyToMany relation exists, add _ids array to SaveParams
|
|
722
|
+
- [ ] If a ManyToMany relation exists, add \_ids array to SaveParams
|
|
695
723
|
- [ ] Does the `@upload` method have `@api` on it? (`@upload` is used standalone; using both together causes a build error)
|
|
696
724
|
- [ ] Do the SearchField enum and findMany implementation match?
|
|
697
725
|
- [ ] For entities with approval workflows, are status/type filters present in both ListParams and findMany?
|
|
698
726
|
|
|
699
727
|
When bulk-modifying 20+ Models:
|
|
728
|
+
|
|
700
729
|
- [ ] Compare patterns with reference code like miomock
|
|
701
730
|
- [ ] Prioritize inconsistent patterns
|
|
702
731
|
- [ ] Write an automation script using sed or similar
|
|
@@ -711,12 +740,14 @@ When bulk-modifying 20+ Models:
|
|
|
711
740
|
The `any` type neutralizes TypeScript's type safety and must **never be used**.
|
|
712
741
|
|
|
713
742
|
**BAD: using any**
|
|
743
|
+
|
|
714
744
|
```typescript
|
|
715
745
|
const { category_ids, ...data } = sp as any;
|
|
716
746
|
function process(input: any) { ... }
|
|
717
747
|
```
|
|
718
748
|
|
|
719
749
|
**GOOD: use precise types or unknown**
|
|
750
|
+
|
|
720
751
|
```typescript
|
|
721
752
|
// Destructure with a precise type
|
|
722
753
|
const { category_ids, ...data } = sp as QuestionCollectionSaveParams;
|
|
@@ -728,6 +759,7 @@ function process(input: unknown) {
|
|
|
728
759
|
```
|
|
729
760
|
|
|
730
761
|
**Rules:**
|
|
762
|
+
|
|
731
763
|
- `any` is prohibited
|
|
732
764
|
- When the type is unknown, use `unknown` and narrow with a type guard
|
|
733
765
|
- When a type assertion is needed during destructuring, specify the exact type name (`as ConcreteType`)
|
|
@@ -10,6 +10,7 @@ Naite is a tracing system for recording values in source code and verifying them
|
|
|
10
10
|
**Source code:** `modules/sonamu/src/naite/naite.ts`
|
|
11
11
|
|
|
12
12
|
**How it works:**
|
|
13
|
+
|
|
13
14
|
1. **Source code**: Record values with `Naite.t("key", value)`
|
|
14
15
|
2. **Test code**: Retrieve recorded values with `Naite.get("key")`
|
|
15
16
|
|
|
@@ -49,19 +50,19 @@ expect(trace).toMatchObject({ tableName: "users", rowCount: 3 });
|
|
|
49
50
|
|
|
50
51
|
## Built-in Naite Keys (Sonamu)
|
|
51
52
|
|
|
52
|
-
| Key
|
|
53
|
-
|
|
54
|
-
| `esq-query`
|
|
55
|
-
| `puri:executed-query`
|
|
56
|
-
| `puri:ub-register`
|
|
57
|
-
| `puri:ub-upserted`
|
|
58
|
-
| `puri:ub-ref-resolved`
|
|
59
|
-
| `puri:ub-batch-updated`
|
|
60
|
-
| `puri:ub-clean-orphans`
|
|
61
|
-
| `puri:ub-inherit`
|
|
62
|
-
| `mock:fs/promises:virtualFileSystem` | Virtual file system path
|
|
63
|
-
| `fs/promises:writeFile`
|
|
64
|
-
| `fs/promises:rm`
|
|
53
|
+
| Key | Description | Data |
|
|
54
|
+
| ------------------------------------ | ------------------------------ | --------------------------------------------------- |
|
|
55
|
+
| `esq-query` | Executed SQL query | Query string |
|
|
56
|
+
| `puri:executed-query` | Query executed by Puri | Query string |
|
|
57
|
+
| `puri:ub-register` | UpsertBuilder register call | `{ tableName, uuid, isUuidReused, row }` |
|
|
58
|
+
| `puri:ub-upserted` | UpsertBuilder upsert complete | `{ tableName, mode, rowCount, returnedIds }` |
|
|
59
|
+
| `puri:ub-ref-resolved` | UBRef → actual ID substitution | `{ tableName, field, from, to }` |
|
|
60
|
+
| `puri:ub-batch-updated` | updateBatch complete | `{ tableName, rowCount, whereColumns }` |
|
|
61
|
+
| `puri:ub-clean-orphans` | cleanOrphans executed | `{ tableName, cleanOrphans, deletedCount }` |
|
|
62
|
+
| `puri:ub-inherit` | inherit option applied | `{ tableName, inheritColumns, excludedFromUpdate }` |
|
|
63
|
+
| `mock:fs/promises:virtualFileSystem` | Virtual file system path | File path string |
|
|
64
|
+
| `fs/promises:writeFile` | writeFile call | `{ path, data }` |
|
|
65
|
+
| `fs/promises:rm` | rm call | `{ path, options }` |
|
|
65
66
|
|
|
66
67
|
---
|
|
67
68
|
|
|
@@ -81,15 +82,15 @@ Naite.t("mock:fs/promises:virtualFileSystem", "/path/to/virtual/file.ts");
|
|
|
81
82
|
|
|
82
83
|
```typescript
|
|
83
84
|
// Basic retrieval
|
|
84
|
-
Naite.get("key").first()
|
|
85
|
-
Naite.get("key").last()
|
|
86
|
-
Naite.get("key").at(2)
|
|
87
|
-
Naite.get("key").result()
|
|
88
|
-
Naite.get("key").getTraces() // raw trace array (includes call stack)
|
|
85
|
+
Naite.get("key").first(); // first entry
|
|
86
|
+
Naite.get("key").last(); // last entry
|
|
87
|
+
Naite.get("key").at(2); // nth entry
|
|
88
|
+
Naite.get("key").result(); // all entries as an array
|
|
89
|
+
Naite.get("key").getTraces(); // raw trace array (includes call stack)
|
|
89
90
|
|
|
90
91
|
// Wildcard patterns
|
|
91
|
-
Naite.get("puri:*").result()
|
|
92
|
-
Naite.get("syncer:*:user").result()
|
|
92
|
+
Naite.get("puri:*").result(); // all with puri: prefix
|
|
93
|
+
Naite.get("syncer:*:user").result(); // syncer:XXX:user pattern
|
|
93
94
|
```
|
|
94
95
|
|
|
95
96
|
---
|
|
@@ -99,29 +100,29 @@ Naite.get("syncer:*:user").result() // syncer:XXX:user pattern
|
|
|
99
100
|
```typescript
|
|
100
101
|
// Filter by file name
|
|
101
102
|
Naite.get("esq-query")
|
|
102
|
-
.fromFile("user.model.ts")
|
|
103
|
+
.fromFile("user.model.ts") // only entries recorded from this file
|
|
103
104
|
.result();
|
|
104
105
|
|
|
105
106
|
// Filter by function name
|
|
106
107
|
Naite.get("puri:executed-query")
|
|
107
|
-
.fromFunction("findById")
|
|
108
|
+
.fromFunction("findById") // only entries called from this function
|
|
108
109
|
.result();
|
|
109
110
|
|
|
110
111
|
// fromFunction options
|
|
111
112
|
Naite.get("key")
|
|
112
|
-
.fromFunction("save", { from: "direct" })
|
|
113
|
-
.fromFunction("save", { from: "indirect" })
|
|
114
|
-
.fromFunction("save", { from: "both" })
|
|
113
|
+
.fromFunction("save", { from: "direct" }) // direct calls only (stack[0])
|
|
114
|
+
.fromFunction("save", { from: "indirect" }) // indirect calls only (stack[1+])
|
|
115
|
+
.fromFunction("save", { from: "both" }); // both (default)
|
|
115
116
|
|
|
116
117
|
// Filter by data path (radash get path)
|
|
117
118
|
Naite.get("puri:ub-register")
|
|
118
|
-
.where("data.tableName", "=", "users")
|
|
119
|
-
.where("data.rowCount", ">", 5)
|
|
119
|
+
.where("data.tableName", "=", "users") // only where tableName is "users"
|
|
120
|
+
.where("data.rowCount", ">", 5) // rowCount > 5
|
|
120
121
|
.result();
|
|
121
122
|
|
|
122
123
|
// where operators: ">", "<", ">=", "<=", "=", "!=", "includes"
|
|
123
124
|
Naite.get("key")
|
|
124
|
-
.where("data.query", "includes", "WHERE")
|
|
125
|
+
.where("data.query", "includes", "WHERE") // check if string includes substring
|
|
125
126
|
.result();
|
|
126
127
|
|
|
127
128
|
// Combining filters
|
|
@@ -167,7 +168,7 @@ test("trace UpsertBuilder register", async () => {
|
|
|
167
168
|
|
|
168
169
|
test("trace upsert completion", async () => {
|
|
169
170
|
// ... run upsert ...
|
|
170
|
-
|
|
171
|
+
|
|
171
172
|
const trace = Naite.get("puri:ub-upserted").first();
|
|
172
173
|
expect(trace).toMatchObject({
|
|
173
174
|
tableName: "users",
|
|
@@ -189,6 +190,7 @@ sonamu test user.model -t
|
|
|
189
190
|
```
|
|
190
191
|
|
|
191
192
|
Example output:
|
|
193
|
+
|
|
192
194
|
```
|
|
193
195
|
Tests: 5 passed, 0 failed, 5 total
|
|
194
196
|
Duration: 791ms
|
|
@@ -221,14 +223,14 @@ type NaiteStore = Map<string, NaiteTrace[]>;
|
|
|
221
223
|
interface NaiteTrace {
|
|
222
224
|
key: string;
|
|
223
225
|
data: any;
|
|
224
|
-
stack: StackFrame[];
|
|
226
|
+
stack: StackFrame[]; // call stack information
|
|
225
227
|
at: Date;
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
interface StackFrame {
|
|
229
231
|
functionName: string | null;
|
|
230
|
-
filePath: string;
|
|
231
|
-
lineNumber: number;
|
|
232
|
+
filePath: string; // path relative to TS file
|
|
233
|
+
lineNumber: number; // line number in TS file
|
|
232
234
|
}
|
|
233
235
|
```
|
|
234
236
|
|