sonamu 0.5.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.swcrc.project-default +18 -0
- package/bin/cli.js +24 -0
- package/dist/ai/agents/agent.d.ts +11 -0
- package/dist/ai/agents/agent.d.ts.map +1 -0
- package/dist/ai/agents/agent.js +65 -0
- package/dist/ai/agents/index.d.ts +3 -0
- package/dist/ai/agents/index.d.ts.map +1 -0
- package/dist/ai/agents/index.js +4 -0
- package/dist/ai/agents/types.d.ts +43 -0
- package/dist/ai/agents/types.d.ts.map +1 -0
- package/dist/ai/agents/types.js +3 -0
- package/dist/ai/index.d.ts +2 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +3 -0
- package/dist/ai/providers/rtzr/api.d.ts +22 -0
- package/dist/ai/providers/rtzr/api.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/api.js +28 -0
- package/dist/ai/providers/rtzr/error.d.ts +18 -0
- package/dist/ai/providers/rtzr/error.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/error.js +29 -0
- package/dist/ai/providers/rtzr/index.d.ts +5 -0
- package/dist/ai/providers/rtzr/index.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/index.js +6 -0
- package/dist/ai/providers/rtzr/model.d.ts +52 -0
- package/dist/ai/providers/rtzr/model.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/model.js +137 -0
- package/dist/ai/providers/rtzr/options.d.ts +7 -0
- package/dist/ai/providers/rtzr/options.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/options.js +47 -0
- package/dist/ai/providers/rtzr/provider.d.ts +18 -0
- package/dist/ai/providers/rtzr/provider.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/provider.js +54 -0
- package/dist/ai/providers/rtzr/utils.d.ts +19 -0
- package/dist/ai/providers/rtzr/utils.d.ts.map +1 -0
- package/dist/ai/providers/rtzr/utils.js +88 -0
- package/dist/api/base-frame.d.ts +2 -2
- package/dist/api/base-frame.d.ts.map +1 -1
- package/dist/api/base-frame.js +13 -2
- package/dist/api/caster.d.ts.map +1 -1
- package/dist/api/caster.js +71 -2
- package/dist/api/code-converters.d.ts +58 -14
- package/dist/api/code-converters.d.ts.map +1 -1
- package/dist/api/code-converters.js +258 -2
- package/dist/api/config.d.ts +90 -0
- package/dist/api/config.d.ts.map +1 -0
- package/dist/api/config.js +25 -0
- package/dist/api/context.d.ts +4 -2
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/context.js +3 -2
- package/dist/api/decorators.d.ts +20 -6
- package/dist/api/decorators.d.ts.map +1 -1
- package/dist/api/decorators.js +235 -2
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +9 -2
- package/dist/api/sonamu.d.ts +10 -24
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +514 -2
- package/dist/api/validator.d.ts +6 -0
- package/dist/api/validator.d.ts.map +1 -0
- package/dist/api/validator.js +81 -0
- package/dist/bin/build-config.d.ts +6 -1
- package/dist/bin/build-config.d.ts.map +1 -1
- package/dist/bin/build-config.js +15 -2
- package/dist/bin/cli.js +519 -2
- package/dist/bin/hot-hook-register.d.ts +11 -0
- package/dist/bin/hot-hook-register.d.ts.map +1 -0
- package/dist/bin/hot-hook-register.js +21 -0
- package/dist/bin/loader-register.d.ts +2 -0
- package/dist/bin/loader-register.d.ts.map +1 -0
- package/dist/bin/loader-register.js +34 -0
- package/dist/database/_batch_update.d.ts +5 -3
- package/dist/database/_batch_update.d.ts.map +1 -1
- package/dist/database/_batch_update.js +95 -2
- package/dist/database/base-model.d.ts +96 -10
- package/dist/database/base-model.d.ts.map +1 -1
- package/dist/database/base-model.js +390 -2
- package/dist/database/base-model.types.d.ts +93 -0
- package/dist/database/base-model.types.d.ts.map +1 -0
- package/dist/database/base-model.types.js +10 -0
- package/dist/database/code-generator.d.ts +1 -1
- package/dist/database/code-generator.d.ts.map +1 -1
- package/dist/database/code-generator.js +54 -2
- package/dist/database/db.d.ts +6 -21
- package/dist/database/db.d.ts.map +1 -1
- package/dist/database/db.js +129 -2
- package/dist/database/puri-subset.test-d.js +81 -0
- package/dist/database/puri-subset.types.d.ts +123 -0
- package/dist/database/puri-subset.types.d.ts.map +1 -0
- package/dist/database/puri-subset.types.js +16 -0
- package/dist/database/puri-wrapper.d.ts +13 -11
- package/dist/database/puri-wrapper.d.ts.map +1 -1
- package/dist/database/puri-wrapper.js +109 -2
- package/dist/database/puri.d.ts +41 -23
- package/dist/database/puri.d.ts.map +1 -1
- package/dist/database/puri.js +601 -2
- package/dist/database/puri.types.d.ts +25 -6
- package/dist/database/puri.types.d.ts.map +1 -1
- package/dist/database/puri.types.js +6 -2
- package/dist/database/transaction-context.d.ts +1 -1
- package/dist/database/transaction-context.d.ts.map +1 -1
- package/dist/database/transaction-context.js +14 -2
- package/dist/database/upsert-builder.d.ts +9 -3
- package/dist/database/upsert-builder.d.ts.map +1 -1
- package/dist/database/upsert-builder.js +365 -2
- package/dist/entity/entity-manager.d.ts +167 -2
- package/dist/entity/entity-manager.d.ts.map +1 -1
- package/dist/entity/entity-manager.js +130 -2
- package/dist/entity/entity.d.ts +5 -3
- package/dist/entity/entity.d.ts.map +1 -1
- package/dist/entity/entity.js +750 -2
- package/dist/exceptions/error-handler.d.ts +1 -1
- package/dist/exceptions/error-handler.d.ts.map +1 -1
- package/dist/exceptions/error-handler.js +29 -2
- package/dist/exceptions/so-exceptions.d.ts +1 -1
- package/dist/exceptions/so-exceptions.d.ts.map +1 -1
- package/dist/exceptions/so-exceptions.js +85 -2
- package/dist/file-storage/driver.d.ts +1 -1
- package/dist/file-storage/driver.d.ts.map +1 -1
- package/dist/file-storage/driver.js +79 -2
- package/dist/file-storage/file-storage.js +75 -2
- package/dist/index.d.ts +18 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -2
- package/dist/migration/code-generation.d.ts +1 -1
- package/dist/migration/code-generation.d.ts.map +1 -1
- package/dist/migration/code-generation.js +614 -2
- package/dist/migration/migration-set.d.ts +2 -10
- package/dist/migration/migration-set.d.ts.map +1 -1
- package/dist/migration/migration-set.js +213 -2
- package/dist/migration/migrator.d.ts +24 -82
- package/dist/migration/migrator.d.ts.map +1 -1
- package/dist/migration/migrator.js +330 -2
- package/dist/migration/postgresql-schema-reader.d.ts +51 -0
- package/dist/migration/postgresql-schema-reader.d.ts.map +1 -0
- package/dist/migration/postgresql-schema-reader.js +245 -0
- package/dist/migration/types.d.ts +6 -38
- package/dist/migration/types.d.ts.map +1 -1
- package/dist/migration/types.js +3 -2
- package/dist/naite/messaging-types.d.ts +43 -0
- package/dist/naite/messaging-types.d.ts.map +1 -0
- package/dist/naite/messaging-types.js +7 -0
- package/dist/naite/naite-reporter.d.ts +41 -0
- package/dist/naite/naite-reporter.d.ts.map +1 -0
- package/dist/naite/naite-reporter.js +102 -0
- package/dist/naite/naite.d.ts +95 -0
- package/dist/naite/naite.d.ts.map +1 -0
- package/dist/naite/naite.js +316 -0
- package/dist/stream/index.js +3 -2
- package/dist/stream/sse.d.ts +2 -2
- package/dist/stream/sse.d.ts.map +1 -1
- package/dist/stream/sse.js +38 -2
- package/dist/syncer/api-parser.d.ts +10 -0
- package/dist/syncer/api-parser.d.ts.map +1 -0
- package/dist/syncer/api-parser.js +240 -0
- package/dist/syncer/checksum.d.ts +21 -0
- package/dist/syncer/checksum.d.ts.map +1 -0
- package/dist/syncer/checksum.js +98 -0
- package/dist/syncer/code-generator.d.ts +20 -0
- package/dist/syncer/code-generator.d.ts.map +1 -0
- package/dist/syncer/code-generator.js +161 -0
- package/dist/syncer/entity-operations.d.ts +17 -0
- package/dist/syncer/entity-operations.d.ts.map +1 -0
- package/dist/syncer/entity-operations.js +59 -0
- package/dist/syncer/file-patterns.d.ts +29 -0
- package/dist/syncer/file-patterns.d.ts.map +1 -0
- package/dist/syncer/file-patterns.js +38 -0
- package/dist/syncer/index.d.ts +6 -0
- package/dist/syncer/index.d.ts.map +1 -1
- package/dist/syncer/index.js +9 -2
- package/dist/syncer/module-loader.d.ts +35 -0
- package/dist/syncer/module-loader.d.ts.map +1 -0
- package/dist/syncer/module-loader.js +87 -0
- package/dist/syncer/syncer.d.ts +98 -106
- package/dist/syncer/syncer.d.ts.map +1 -1
- package/dist/syncer/syncer.js +422 -2
- package/dist/template/entity-converter.d.ts +14 -0
- package/dist/template/entity-converter.d.ts.map +1 -0
- package/dist/template/entity-converter.js +108 -0
- package/dist/template/helpers.d.ts +23 -0
- package/dist/template/helpers.d.ts.map +1 -0
- package/dist/template/helpers.js +64 -0
- package/dist/{templates → template/implementations}/entity.template.d.ts +3 -3
- package/dist/template/implementations/entity.template.d.ts.map +1 -0
- package/dist/template/implementations/entity.template.js +86 -0
- package/dist/{templates → template/implementations}/generated.template.d.ts +3 -4
- package/dist/template/implementations/generated.template.d.ts.map +1 -0
- package/dist/template/implementations/generated.template.js +249 -0
- package/dist/{templates → template/implementations}/generated_http.template.d.ts +3 -4
- package/dist/template/implementations/generated_http.template.d.ts.map +1 -0
- package/dist/template/implementations/generated_http.template.js +131 -0
- package/dist/{templates → template/implementations}/generated_sso.template.d.ts +4 -5
- package/dist/template/implementations/generated_sso.template.d.ts.map +1 -0
- package/dist/template/implementations/generated_sso.template.js +134 -0
- package/dist/{templates → template/implementations}/init_types.template.d.ts +3 -3
- package/dist/template/implementations/init_types.template.d.ts.map +1 -0
- package/dist/template/implementations/init_types.template.js +38 -0
- package/dist/template/implementations/model.template.d.ts +17 -0
- package/dist/template/implementations/model.template.d.ts.map +1 -0
- package/dist/template/implementations/model.template.js +181 -0
- package/dist/{templates → template/implementations}/model_test.template.d.ts +3 -3
- package/dist/template/implementations/model_test.template.d.ts.map +1 -0
- package/dist/template/implementations/model_test.template.js +35 -0
- package/dist/{templates → template/implementations}/service.template.d.ts +6 -6
- package/dist/template/implementations/service.template.d.ts.map +1 -0
- package/dist/template/implementations/service.template.js +201 -0
- package/dist/{templates → template/implementations}/view_enums_buttonset.template.d.ts +3 -3
- package/dist/template/implementations/view_enums_buttonset.template.d.ts.map +1 -0
- package/dist/template/implementations/view_enums_buttonset.template.js +31 -0
- package/dist/{templates → template/implementations}/view_enums_dropdown.template.d.ts +3 -4
- package/dist/template/implementations/view_enums_dropdown.template.d.ts.map +1 -0
- package/dist/template/implementations/view_enums_dropdown.template.js +50 -0
- package/dist/{templates → template/implementations}/view_enums_select.template.d.ts +3 -3
- package/dist/template/implementations/view_enums_select.template.d.ts.map +1 -0
- package/dist/template/implementations/view_enums_select.template.js +55 -0
- package/dist/{templates → template/implementations}/view_form.template.d.ts +5 -5
- package/dist/template/implementations/view_form.template.d.ts.map +1 -0
- package/dist/template/implementations/view_form.template.js +337 -0
- package/dist/{templates → template/implementations}/view_id_all_select.template.d.ts +3 -3
- package/dist/template/implementations/view_id_all_select.template.d.ts.map +1 -0
- package/dist/template/implementations/view_id_all_select.template.js +31 -0
- package/dist/{templates → template/implementations}/view_id_async_select.template.d.ts +3 -3
- package/dist/template/implementations/view_id_async_select.template.d.ts.map +1 -0
- package/dist/template/implementations/view_id_async_select.template.js +105 -0
- package/dist/{templates → template/implementations}/view_list.template.d.ts +5 -13
- package/dist/template/implementations/view_list.template.d.ts.map +1 -0
- package/dist/template/implementations/view_list.template.js +475 -0
- package/dist/template/implementations/view_list_columns.template.d.ts +17 -0
- package/dist/template/implementations/view_list_columns.template.d.ts.map +1 -0
- package/dist/template/implementations/view_list_columns.template.js +49 -0
- package/dist/{templates → template/implementations}/view_search_input.template.d.ts +3 -3
- package/dist/template/implementations/view_search_input.template.d.ts.map +1 -0
- package/dist/template/implementations/view_search_input.template.js +64 -0
- package/dist/template/index.d.ts +7 -0
- package/dist/template/index.d.ts.map +1 -0
- package/dist/template/index.js +8 -0
- package/dist/template/template-manager.d.ts +56 -0
- package/dist/template/template-manager.d.ts.map +1 -0
- package/dist/template/template-manager.js +125 -0
- package/dist/template/template-types.d.ts +16 -0
- package/dist/template/template-types.d.ts.map +1 -0
- package/dist/template/template-types.js +7 -0
- package/dist/template/template.d.ts +49 -0
- package/dist/template/template.d.ts.map +1 -0
- package/dist/template/template.js +60 -0
- package/dist/template/zod-converter.d.ts +51 -0
- package/dist/template/zod-converter.d.ts.map +1 -0
- package/dist/template/zod-converter.js +449 -0
- package/dist/testing/_relation-graph.d.ts +1 -1
- package/dist/testing/_relation-graph.d.ts.map +1 -1
- package/dist/testing/_relation-graph.js +89 -2
- package/dist/testing/fixture-manager.d.ts +42 -11
- package/dist/testing/fixture-manager.d.ts.map +1 -1
- package/dist/testing/fixture-manager.js +623 -2
- package/dist/types/types.d.ts +747 -143
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +546 -2
- package/dist/typings/knex.d.js +3 -2
- package/dist/utils/async-utils.d.ts +7 -0
- package/dist/utils/async-utils.d.ts.map +1 -1
- package/dist/utils/async-utils.js +57 -2
- package/dist/utils/console-util.d.ts +2 -0
- package/dist/utils/console-util.d.ts.map +1 -0
- package/dist/utils/console-util.js +6 -0
- package/dist/utils/controller.d.ts +1 -0
- package/dist/utils/controller.d.ts.map +1 -1
- package/dist/utils/controller.js +29 -2
- package/dist/utils/esm-utils.d.ts +39 -0
- package/dist/utils/esm-utils.d.ts.map +1 -0
- package/dist/utils/esm-utils.js +49 -0
- package/dist/utils/formatter.d.ts +3 -0
- package/dist/utils/formatter.d.ts.map +1 -0
- package/dist/utils/formatter.js +110 -0
- package/dist/utils/fs-utils.d.ts +1 -1
- package/dist/utils/fs-utils.d.ts.map +1 -1
- package/dist/utils/fs-utils.js +17 -2
- package/dist/utils/lodash-able.d.ts.map +1 -1
- package/dist/utils/lodash-able.js +6 -2
- package/dist/utils/model.js +22 -2
- package/dist/utils/object-utils.d.ts +44 -0
- package/dist/utils/object-utils.d.ts.map +1 -0
- package/dist/utils/object-utils.js +191 -0
- package/dist/utils/path-utils.d.ts +89 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +60 -0
- package/dist/utils/process-utils.d.ts +13 -0
- package/dist/utils/process-utils.d.ts.map +1 -0
- package/dist/utils/process-utils.js +36 -0
- package/dist/utils/sql-parser.d.ts +5 -1
- package/dist/utils/sql-parser.d.ts.map +1 -1
- package/dist/utils/sql-parser.js +46 -2
- package/dist/utils/type-utils.d.ts +23 -0
- package/dist/utils/type-utils.d.ts.map +1 -0
- package/dist/utils/type-utils.js +45 -0
- package/dist/utils/utils.d.ts +10 -7
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +72 -2
- package/dist/utils/zod-error.d.ts +1 -1
- package/dist/utils/zod-error.d.ts.map +1 -1
- package/dist/utils/zod-error.js +19 -2
- package/package.json +65 -27
- package/src/ai/agents/agent.ts +87 -0
- package/src/ai/agents/index.ts +2 -0
- package/src/ai/agents/types.ts +47 -0
- package/src/ai/index.ts +1 -0
- package/src/ai/providers/rtzr/api.ts +37 -0
- package/src/ai/providers/rtzr/error.ts +34 -0
- package/src/ai/providers/rtzr/index.ts +4 -0
- package/src/ai/providers/rtzr/model.ts +201 -0
- package/src/ai/providers/rtzr/options.ts +49 -0
- package/src/ai/providers/rtzr/provider.ts +91 -0
- package/src/ai/providers/rtzr/utils.ts +127 -0
- package/src/api/base-frame.ts +4 -2
- package/src/api/caster.ts +17 -23
- package/src/api/code-converters.ts +178 -535
- package/src/api/config.ts +125 -0
- package/src/api/context.ts +7 -17
- package/src/api/decorators.ts +176 -46
- package/src/api/index.ts +2 -2
- package/src/api/sonamu.ts +190 -167
- package/src/api/validator.ts +83 -0
- package/src/bin/build-config.ts +8 -1
- package/src/bin/cli.ts +258 -124
- package/src/bin/hot-hook-register.ts +22 -0
- package/src/bin/loader-register.ts +38 -0
- package/src/database/_batch_update.ts +46 -31
- package/src/database/base-model.ts +390 -182
- package/src/database/base-model.types.ts +155 -0
- package/src/database/code-generator.ts +13 -32
- package/src/database/db.ts +40 -96
- package/src/database/puri-subset.test-d.ts +471 -0
- package/src/database/puri-subset.types.ts +195 -0
- package/src/database/puri-wrapper.ts +58 -67
- package/src/database/puri.ts +229 -148
- package/src/database/puri.types.ts +76 -30
- package/src/database/transaction-context.ts +1 -1
- package/src/database/upsert-builder.ts +262 -132
- package/src/entity/entity-manager.ts +48 -36
- package/src/entity/entity.ts +330 -248
- package/src/exceptions/error-handler.ts +3 -3
- package/src/exceptions/so-exceptions.ts +11 -11
- package/src/file-storage/driver.ts +5 -5
- package/src/file-storage/file-storage.ts +2 -2
- package/src/index.ts +18 -10
- package/src/migration/code-generation.ts +185 -172
- package/src/migration/migration-set.ts +80 -293
- package/src/migration/migrator.ts +199 -571
- package/src/migration/mysql-schema-reader.ts.txt +272 -0
- package/src/migration/postgresql-schema-reader.ts +310 -0
- package/src/migration/types.ts +6 -39
- package/src/naite/messaging-types.ts +51 -0
- package/src/naite/naite-reporter.ts +128 -0
- package/src/naite/naite.ts +415 -0
- package/src/shared/web.shared.ts.txt +20 -24
- package/src/stream/sse.ts +5 -5
- package/src/syncer/api-parser.ts +282 -0
- package/src/syncer/checksum.ts +140 -0
- package/src/syncer/code-generator.ts +198 -0
- package/src/syncer/entity-operations.ts +65 -0
- package/src/syncer/file-patterns.ts +56 -0
- package/src/syncer/index.ts +6 -0
- package/src/syncer/module-loader.ts +128 -0
- package/src/syncer/syncer.ts +389 -1453
- package/src/template/entity-converter.ts +114 -0
- package/src/template/helpers.ts +81 -0
- package/src/{templates → template/implementations}/entity.template.ts +7 -7
- package/src/{templates → template/implementations}/generated.template.ts +101 -101
- package/src/{templates → template/implementations}/generated_http.template.ts +27 -57
- package/src/template/implementations/generated_sso.template.ts +151 -0
- package/src/{templates → template/implementations}/init_types.template.ts +5 -7
- package/src/{templates → template/implementations}/model.template.ts +52 -43
- package/src/{templates → template/implementations}/model_test.template.ts +5 -5
- package/src/{templates → template/implementations}/service.template.ts +66 -82
- package/src/{templates → template/implementations}/view_enums_buttonset.template.ts +3 -3
- package/src/{templates → template/implementations}/view_enums_dropdown.template.ts +4 -20
- package/src/{templates → template/implementations}/view_enums_select.template.ts +4 -4
- package/src/{templates → template/implementations}/view_form.template.ts +40 -83
- package/src/{templates → template/implementations}/view_id_all_select.template.ts +3 -3
- package/src/{templates → template/implementations}/view_id_async_select.template.ts +10 -24
- package/src/{templates → template/implementations}/view_list.template.ts +60 -152
- package/src/{templates → template/implementations}/view_list_columns.template.ts +5 -11
- package/src/{templates → template/implementations}/view_search_input.template.ts +3 -3
- package/src/template/index.ts +6 -0
- package/src/template/template-manager.ts +166 -0
- package/src/template/template-types.ts +16 -0
- package/src/template/template.ts +105 -0
- package/src/template/zod-converter.ts +525 -0
- package/src/testing/_relation-graph.ts +18 -11
- package/src/testing/fixture-manager.ts +472 -359
- package/src/types/types.ts +553 -308
- package/src/typings/knex.d.ts +7 -9
- package/src/utils/async-utils.ts +23 -10
- package/src/utils/console-util.ts +4 -0
- package/src/utils/controller.ts +3 -0
- package/src/utils/esm-utils.ts +59 -0
- package/src/utils/formatter.ts +109 -0
- package/src/utils/fs-utils.ts +1 -1
- package/src/utils/lodash-able.ts +1 -4
- package/src/utils/object-utils.ts +217 -0
- package/src/utils/path-utils.ts +99 -0
- package/src/utils/process-utils.ts +46 -0
- package/src/utils/sql-parser.ts +23 -5
- package/src/utils/type-utils.ts +83 -0
- package/src/utils/utils.ts +66 -43
- package/src/utils/zod-error.ts +3 -4
- package/dist/api/base-frame.js.map +0 -1
- package/dist/api/caster.js.map +0 -1
- package/dist/api/code-converters.js.map +0 -1
- package/dist/api/context.js.map +0 -1
- package/dist/api/decorators.js.map +0 -1
- package/dist/api/index.js.map +0 -1
- package/dist/api/sonamu.js.map +0 -1
- package/dist/bin/build-config.js.map +0 -1
- package/dist/bin/cli-wrapper.d.ts +0 -3
- package/dist/bin/cli-wrapper.d.ts.map +0 -1
- package/dist/bin/cli-wrapper.js +0 -3
- package/dist/bin/cli-wrapper.js.map +0 -1
- package/dist/bin/cli.js.map +0 -1
- package/dist/database/_batch_update.js.map +0 -1
- package/dist/database/base-model.js.map +0 -1
- package/dist/database/code-generator.js.map +0 -1
- package/dist/database/db.js.map +0 -1
- package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts +0 -2
- package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts.map +0 -1
- package/dist/database/knex-plugins/knex-on-duplicate-update.js +0 -2
- package/dist/database/knex-plugins/knex-on-duplicate-update.js.map +0 -1
- package/dist/database/puri-wrapper.js.map +0 -1
- package/dist/database/puri.js.map +0 -1
- package/dist/database/puri.types.js.map +0 -1
- package/dist/database/transaction-context.js.map +0 -1
- package/dist/database/upsert-builder.js.map +0 -1
- package/dist/entity/entity-manager.js.map +0 -1
- package/dist/entity/entity-utils.d.ts +0 -61
- package/dist/entity/entity-utils.d.ts.map +0 -1
- package/dist/entity/entity-utils.js +0 -2
- package/dist/entity/entity-utils.js.map +0 -1
- package/dist/entity/entity.js.map +0 -1
- package/dist/exceptions/error-handler.js.map +0 -1
- package/dist/exceptions/so-exceptions.js.map +0 -1
- package/dist/file-storage/driver.js.map +0 -1
- package/dist/file-storage/file-storage.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/migration/code-generation.js.map +0 -1
- package/dist/migration/migration-set.js.map +0 -1
- package/dist/migration/migrator.js.map +0 -1
- package/dist/migration/types.js.map +0 -1
- package/dist/stream/index.js.map +0 -1
- package/dist/stream/sse.js.map +0 -1
- package/dist/syncer/index.js.map +0 -1
- package/dist/syncer/syncer.js.map +0 -1
- package/dist/templates/base-template.d.ts +0 -13
- package/dist/templates/base-template.d.ts.map +0 -1
- package/dist/templates/base-template.js +0 -2
- package/dist/templates/base-template.js.map +0 -1
- package/dist/templates/entity.template.d.ts.map +0 -1
- package/dist/templates/entity.template.js +0 -2
- package/dist/templates/entity.template.js.map +0 -1
- package/dist/templates/generated.template.d.ts.map +0 -1
- package/dist/templates/generated.template.js +0 -2
- package/dist/templates/generated.template.js.map +0 -1
- package/dist/templates/generated_http.template.d.ts.map +0 -1
- package/dist/templates/generated_http.template.js +0 -2
- package/dist/templates/generated_http.template.js.map +0 -1
- package/dist/templates/generated_sso.template.d.ts.map +0 -1
- package/dist/templates/generated_sso.template.js +0 -2
- package/dist/templates/generated_sso.template.js.map +0 -1
- package/dist/templates/index.d.ts +0 -2
- package/dist/templates/index.d.ts.map +0 -1
- package/dist/templates/index.js +0 -2
- package/dist/templates/index.js.map +0 -1
- package/dist/templates/init_types.template.d.ts.map +0 -1
- package/dist/templates/init_types.template.js +0 -2
- package/dist/templates/init_types.template.js.map +0 -1
- package/dist/templates/model.template.d.ts +0 -17
- package/dist/templates/model.template.d.ts.map +0 -1
- package/dist/templates/model.template.js +0 -2
- package/dist/templates/model.template.js.map +0 -1
- package/dist/templates/model_test.template.d.ts.map +0 -1
- package/dist/templates/model_test.template.js +0 -2
- package/dist/templates/model_test.template.js.map +0 -1
- package/dist/templates/service.template.d.ts.map +0 -1
- package/dist/templates/service.template.js +0 -2
- package/dist/templates/service.template.js.map +0 -1
- package/dist/templates/view_enums_buttonset.template.d.ts.map +0 -1
- package/dist/templates/view_enums_buttonset.template.js +0 -2
- package/dist/templates/view_enums_buttonset.template.js.map +0 -1
- package/dist/templates/view_enums_dropdown.template.d.ts.map +0 -1
- package/dist/templates/view_enums_dropdown.template.js +0 -2
- package/dist/templates/view_enums_dropdown.template.js.map +0 -1
- package/dist/templates/view_enums_select.template.d.ts.map +0 -1
- package/dist/templates/view_enums_select.template.js +0 -2
- package/dist/templates/view_enums_select.template.js.map +0 -1
- package/dist/templates/view_form.template.d.ts.map +0 -1
- package/dist/templates/view_form.template.js +0 -2
- package/dist/templates/view_form.template.js.map +0 -1
- package/dist/templates/view_id_all_select.template.d.ts.map +0 -1
- package/dist/templates/view_id_all_select.template.js +0 -2
- package/dist/templates/view_id_all_select.template.js.map +0 -1
- package/dist/templates/view_id_async_select.template.d.ts.map +0 -1
- package/dist/templates/view_id_async_select.template.js +0 -2
- package/dist/templates/view_id_async_select.template.js.map +0 -1
- package/dist/templates/view_list.template.d.ts.map +0 -1
- package/dist/templates/view_list.template.js +0 -2
- package/dist/templates/view_list.template.js.map +0 -1
- package/dist/templates/view_list_columns.template.d.ts +0 -17
- package/dist/templates/view_list_columns.template.d.ts.map +0 -1
- package/dist/templates/view_list_columns.template.js +0 -2
- package/dist/templates/view_list_columns.template.js.map +0 -1
- package/dist/templates/view_search_input.template.d.ts.map +0 -1
- package/dist/templates/view_search_input.template.js +0 -2
- package/dist/templates/view_search_input.template.js.map +0 -1
- package/dist/testing/_relation-graph.js.map +0 -1
- package/dist/testing/fixture-manager.js.map +0 -1
- package/dist/types/types.js.map +0 -1
- package/dist/typings/knex.d.js.map +0 -1
- package/dist/utils/async-utils.js.map +0 -1
- package/dist/utils/controller.js.map +0 -1
- package/dist/utils/fs-utils.js.map +0 -1
- package/dist/utils/lodash-able.js.map +0 -1
- package/dist/utils/model.js.map +0 -1
- package/dist/utils/sql-parser.js.map +0 -1
- package/dist/utils/utils.js.map +0 -1
- package/dist/utils/zod-error.js.map +0 -1
- package/src/bin/cli-wrapper.ts +0 -75
- package/src/database/knex-plugins/knex-on-duplicate-update.ts +0 -45
- package/src/entity/entity-utils.ts +0 -291
- package/src/templates/base-template.ts +0 -19
- package/src/templates/generated_sso.template.ts +0 -138
- package/src/templates/index.ts +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { RenderingNode, TemplateOptions } from "../types/types";
|
|
2
|
-
import { EntityNamesRecord } from "../entity/entity-manager";
|
|
3
|
-
import { Template } from "./base-template";
|
|
4
|
-
export declare class Template__model extends Template {
|
|
5
|
-
constructor();
|
|
6
|
-
getTargetAndPath(names: EntityNamesRecord): {
|
|
7
|
-
target: string;
|
|
8
|
-
path: string;
|
|
9
|
-
};
|
|
10
|
-
render({ entityId }: TemplateOptions["model"], _columnsNode: RenderingNode, listParamsNode: RenderingNode): {
|
|
11
|
-
body: string;
|
|
12
|
-
importKeys: never[];
|
|
13
|
-
target: string;
|
|
14
|
-
path: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=model.template.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.template.d.ts","sourceRoot":"","sources":["../../src/templates/model.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAiB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAI3C,qBAAa,eAAgB,SAAQ,QAAQ;;IAK3C,gBAAgB,CAAC,KAAK,EAAE,iBAAiB;;;;IASzC,MAAM,CACJ,EAAE,QAAQ,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,EACtC,YAAY,EAAE,aAAa,EAC3B,cAAc,EAAE,aAAa;;;;;;CAyJhC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Template__model",{enumerable:true,get:function(){return Template__model}});var _entitymanager=require("../entity/entity-manager");var _basetemplate=require("./base-template");var _view_listtemplate=require("./view_list.template");var _api=require("../api");function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__model=/*#__PURE__*/function(Template){"use strict";_inherits(Template__model,Template);function Template__model(){_class_call_check(this,Template__model);return _call_super(this,Template__model,["model"])}_create_class(Template__model,[{key:"getTargetAndPath",value:function getTargetAndPath(names){var dir=_api.Sonamu.config.api.dir;return{target:"".concat(dir,"/src/application"),path:"".concat(names.fs,"/").concat(names.fs,".model.ts")}}},{key:"render",value:function render(param,_columnsNode,listParamsNode){var entityId=param.entityId;var names=_entitymanager.EntityManager.getNamesFromId(entityId);var entity=_entitymanager.EntityManager.get(entityId);var vlTpl=new _view_listtemplate.Template__view_list;if((listParamsNode===null||listParamsNode===void 0?void 0:listParamsNode.children)===undefined){throw new Error("listParamsNode가 없습니다. ".concat(entityId))}var def=vlTpl.getDefault(listParamsNode.children);return _object_spread_props(_object_spread({},this.getTargetAndPath(names)),{body:"\nimport { BaseModelClass, ListResult, asArray, NotFoundException, BadRequestException, api } from 'sonamu';\nimport {\n ".concat(entityId,"SubsetKey,\n ").concat(entityId,'SubsetMapping,\n} from "../sonamu.generated";\nimport {\n ').concat(names.camel,'SubsetQueries,\n} from "../sonamu.generated.sso";\nimport { ').concat(entityId,"ListParams, ").concat(entityId,'SaveParams } from "./').concat(names.fs,'.types";\n\n/*\n ').concat(entityId," Model\n*/\nclass ").concat(entityId,'ModelClass extends BaseModelClass {\n modelName = "').concat(entityId,'";\n\n @api({ httpMethod: "GET", clients: ["axios", "swr"], resourceName: "').concat(entityId,'" })\n async findById<T extends ').concat(entityId,"SubsetKey>(\n subset: T,\n id: number\n ): Promise<").concat(entityId,"SubsetMapping[T]> {\n const { rows } = await this.findMany(subset, {\n id,\n num: 1,\n page: 1,\n });\n if (!rows[0]) {\n throw new NotFoundException(`존재하지 않는 ").concat(names.capital," ID ${id}`);\n }\n\n return rows[0];\n }\n\n async findOne<T extends ").concat(entityId,"SubsetKey>(\n subset: T,\n listParams: ").concat(entityId,"ListParams\n ): Promise<").concat(entityId,'SubsetMapping[T] | null> {\n const { rows } = await this.findMany(subset, {\n ...listParams,\n num: 1,\n page: 1,\n });\n\n return rows[0] ?? null;\n }\n\n @api({ httpMethod: "GET", clients: ["axios", "swr"], resourceName: "').concat(names.capitalPlural,'" })\n async findMany<T extends ').concat(entityId,"SubsetKey>(\n subset: T,\n params: ").concat(entityId,"ListParams = {}\n ): Promise<ListResult<").concat(entityId,'SubsetMapping[T]>> {\n // params with defaults\n params = {\n num: 24,\n page: 1,\n search: "').concat(def.search,'",\n orderBy: "').concat(def.orderBy,'",\n ...params,\n };\n\n // build queries\n let { rows, total } = await this.runSubsetQuery({\n subset,\n params,\n subsetQuery: ').concat(names.camel,'SubsetQueries[subset],\n build: ({ qb }) => {\n // id\n if (params.id) {\n qb.whereIn("').concat(entity.table,'.id", asArray(params.id));\n }\n\n // search-keyword\n if (params.search && params.keyword && params.keyword.length > 0) {\n if (params.search === "id") {\n qb.where("').concat(entity.table,'.id", params.keyword);\n // } else if (params.search === "field") {\n // qb.where("').concat(entity.table,'.field", "like", `%${params.keyword}%`);\n } else {\n throw new BadRequestException(\n `구현되지 않은 검색 필드 ${params.search}`\n );\n }\n }\n\n // orderBy\n if (params.orderBy) {\n // default orderBy\n const [orderByField, orderByDirec] = params.orderBy.split("-");\n qb.orderBy("').concat(entity.table,'." + orderByField, orderByDirec);\n }\n\n return qb;\n },\n debug: false,\n });\n\n return {\n rows,\n total,\n };\n }\n\n @api({ httpMethod: "POST" })\n async save(\n spa: ').concat(entityId,'SaveParams[]\n ): Promise<number[]> {\n const wdb = this.getPuri("w");\n\n // register\n spa.map((sp) => {\n wdb.ubRegister("').concat(entity.table,'", sp);\n });\n\n // transaction\n return wdb.transaction(async (trx) => {\n const ids = await trx.ubUpsert("').concat(entity.table,'");\n\n return ids;\n });\n }\n\n @api({ httpMethod: "POST", guards: [ "admin" ] })\n async del(ids: number[]): Promise<number> {\n const wdb = this.getPuri("w");\n\n // transaction\n await wdb.transaction(async (trx) => {\n return trx.table("').concat(entity.table,'").whereIn("').concat(entity.table,'.id", ids).delete();\n });\n\n return ids.length;\n }\n}\n\nexport const ').concat(entityId,"Model = new ").concat(entityId,"ModelClass();\n ").trim(),importKeys:[]})}}]);return Template__model}(_basetemplate.Template);
|
|
2
|
-
//# sourceMappingURL=model.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/model.template.ts"],"sourcesContent":["import { RenderingNode, TemplateOptions } from \"../types/types\";\nimport { EntityManager, EntityNamesRecord } from \"../entity/entity-manager\";\nimport { Template } from \"./base-template\";\nimport { Template__view_list } from \"./view_list.template\";\nimport { Sonamu } from \"../api\";\n\nexport class Template__model extends Template {\n constructor() {\n super(\"model\");\n }\n\n getTargetAndPath(names: EntityNamesRecord) {\n const { dir } = Sonamu.config.api;\n\n return {\n target: `${dir}/src/application`,\n path: `${names.fs}/${names.fs}.model.ts`,\n };\n }\n\n render(\n { entityId }: TemplateOptions[\"model\"],\n _columnsNode: RenderingNode,\n listParamsNode: RenderingNode\n ) {\n const names = EntityManager.getNamesFromId(entityId);\n const entity = EntityManager.get(entityId);\n\n const vlTpl = new Template__view_list();\n if (listParamsNode?.children === undefined) {\n throw new Error(`listParamsNode가 없습니다. ${entityId}`);\n }\n const def = vlTpl.getDefault(listParamsNode.children);\n\n return {\n ...this.getTargetAndPath(names),\n body: `\nimport { BaseModelClass, ListResult, asArray, NotFoundException, BadRequestException, api } from 'sonamu';\nimport {\n ${entityId}SubsetKey,\n ${entityId}SubsetMapping,\n} from \"../sonamu.generated\";\nimport {\n ${names.camel}SubsetQueries,\n} from \"../sonamu.generated.sso\";\nimport { ${entityId}ListParams, ${entityId}SaveParams } from \"./${names.fs}.types\";\n\n/*\n ${entityId} Model\n*/\nclass ${entityId}ModelClass extends BaseModelClass {\n modelName = \"${entityId}\";\n\n @api({ httpMethod: \"GET\", clients: [\"axios\", \"swr\"], resourceName: \"${entityId}\" })\n async findById<T extends ${entityId}SubsetKey>(\n subset: T,\n id: number\n ): Promise<${entityId}SubsetMapping[T]> {\n const { rows } = await this.findMany(subset, {\n id,\n num: 1,\n page: 1,\n });\n if (!rows[0]) {\n throw new NotFoundException(\\`존재하지 않는 ${names.capital} ID \\${id}\\`);\n }\n\n return rows[0];\n }\n\n async findOne<T extends ${entityId}SubsetKey>(\n subset: T,\n listParams: ${entityId}ListParams\n ): Promise<${entityId}SubsetMapping[T] | null> {\n const { rows } = await this.findMany(subset, {\n ...listParams,\n num: 1,\n page: 1,\n });\n\n return rows[0] ?? null;\n }\n\n @api({ httpMethod: \"GET\", clients: [\"axios\", \"swr\"], resourceName: \"${names.capitalPlural}\" })\n async findMany<T extends ${entityId}SubsetKey>(\n subset: T,\n params: ${entityId}ListParams = {}\n ): Promise<ListResult<${entityId}SubsetMapping[T]>> {\n // params with defaults\n params = {\n num: 24,\n page: 1,\n search: \"${def.search}\",\n orderBy: \"${def.orderBy}\",\n ...params,\n };\n\n // build queries\n let { rows, total } = await this.runSubsetQuery({\n subset,\n params,\n subsetQuery: ${names.camel}SubsetQueries[subset],\n build: ({ qb }) => {\n // id\n if (params.id) {\n qb.whereIn(\"${entity.table}.id\", asArray(params.id));\n }\n\n // search-keyword\n if (params.search && params.keyword && params.keyword.length > 0) {\n if (params.search === \"id\") {\n qb.where(\"${entity.table}.id\", params.keyword);\n // } else if (params.search === \"field\") {\n // qb.where(\"${entity.table}.field\", \"like\", \\`%\\${params.keyword}%\\`);\n } else {\n throw new BadRequestException(\n \\`구현되지 않은 검색 필드 \\${params.search}\\`\n );\n }\n }\n\n // orderBy\n if (params.orderBy) {\n // default orderBy\n const [orderByField, orderByDirec] = params.orderBy.split(\"-\");\n qb.orderBy(\"${entity.table}.\" + orderByField, orderByDirec);\n }\n\n return qb;\n },\n debug: false,\n });\n\n return {\n rows,\n total,\n };\n }\n\n @api({ httpMethod: \"POST\" })\n async save(\n spa: ${entityId}SaveParams[]\n ): Promise<number[]> {\n const wdb = this.getPuri(\"w\");\n\n // register\n spa.map((sp) => {\n wdb.ubRegister(\"${entity.table}\", sp);\n });\n\n // transaction\n return wdb.transaction(async (trx) => {\n const ids = await trx.ubUpsert(\"${entity.table}\");\n\n return ids;\n });\n }\n\n @api({ httpMethod: \"POST\", guards: [ \"admin\" ] })\n async del(ids: number[]): Promise<number> {\n const wdb = this.getPuri(\"w\");\n\n // transaction\n await wdb.transaction(async (trx) => {\n return trx.table(\"${entity.table}\").whereIn(\"${entity.table}.id\", ids).delete();\n });\n\n return ids.length;\n }\n}\n\nexport const ${entityId}Model = new ${entityId}ModelClass();\n `.trim(),\n importKeys: [],\n };\n }\n}\n"],"names":["Template__model","getTargetAndPath","names","dir","Sonamu","config","api","target","path","fs","render","_columnsNode","listParamsNode","entityId","EntityManager","getNamesFromId","entity","get","vlTpl","Template__view_list","children","undefined","Error","def","getDefault","body","camel","capital","capitalPlural","search","orderBy","table","trim","importKeys","Template"],"mappings":"oGAMaA,yDAAAA,8CALoC,sDACxB,kDACW,yCACb,g7GAEhB,IAAA,AAAMA,6BAAN,0CAAMA,mCAAAA,yCAAAA,iBAET,OAAA,iBAFSA,iBAEH,wBAFGA,kBAKXC,IAAAA,yBAAAA,SAAAA,iBAAiBC,KAAwB,EACvC,IAAM,AAAEC,IAAQC,WAAM,CAACC,MAAM,CAACC,GAAG,CAAzBH,IAER,MAAO,CACLI,OAAQ,AAAC,GAAM,OAAJJ,IAAI,oBACfK,KAAM,AAAC,GAAcN,OAAZA,MAAMO,EAAE,CAAC,KAAY,OAATP,MAAMO,EAAE,CAAC,YAChC,CACF,IAEAC,IAAAA,eAAAA,SAAAA,OACE,KAAsC,CACtCC,YAA2B,CAC3BC,cAA6B,MAF7B,AAAEC,SAAF,MAAEA,SAIF,IAAMX,MAAQY,4BAAa,CAACC,cAAc,CAACF,UAC3C,IAAMG,OAASF,4BAAa,CAACG,GAAG,CAACJ,UAEjC,IAAMK,MAAQ,IAAIC,sCAAmB,CACrC,GAAIP,CAAAA,uBAAAA,+BAAAA,eAAgBQ,QAAQ,IAAKC,UAAW,CAC1C,MAAM,IAAIC,MAAM,AAAC,yBAAiC,O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.ts","sourceRoot":"","sources":["../../src/templates/model_test.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAiB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,qBAAa,oBAAqB,SAAQ,QAAQ;;IAKhD,gBAAgB,CAAC,KAAK,EAAE,iBAAiB;;;;IASzC,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,eAAe,CAAC,YAAY,CAAC;;;;;;CAmBnD"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Template__model_test",{enumerable:true,get:function(){return Template__model_test}});var _entitymanager=require("../entity/entity-manager");var _basetemplate=require("./base-template");var _api=require("../api");function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__model_test=/*#__PURE__*/function(Template){"use strict";_inherits(Template__model_test,Template);function Template__model_test(){_class_call_check(this,Template__model_test);return _call_super(this,Template__model_test,["model_test"])}_create_class(Template__model_test,[{key:"getTargetAndPath",value:function getTargetAndPath(names){var dir=_api.Sonamu.config.api.dir;return{target:"".concat(dir,"/src/application"),path:"".concat(names.fs,"/").concat(names.fs,".model.test.ts")}}},{key:"render",value:function render(param){var entityId=param.entityId;var names=_entitymanager.EntityManager.getNamesFromId(entityId);return _object_spread_props(_object_spread({},this.getTargetAndPath(names)),{body:'\nimport { describe, test, expect } from "vitest";\nimport { bootstrap } from \'../../testing/bootstrap\';\n\nbootstrap([]);\ndescribe.skip("'.concat(entityId,'ModelTest", () => {\n test("Query", async () => {\n expect(true).toBe(true);\n });\n});\n ').trim(),importKeys:[]})}}]);return Template__model_test}(_basetemplate.Template);
|
|
2
|
-
//# sourceMappingURL=model_test.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/model_test.template.ts"],"sourcesContent":["import { TemplateOptions } from \"../types/types\";\nimport { EntityManager, EntityNamesRecord } from \"../entity/entity-manager\";\nimport { Template } from \"./base-template\";\nimport { Sonamu } from \"../api\";\n\nexport class Template__model_test extends Template {\n constructor() {\n super(\"model_test\");\n }\n\n getTargetAndPath(names: EntityNamesRecord) {\n const { dir } = Sonamu.config.api;\n\n return {\n target: `${dir}/src/application`,\n path: `${names.fs}/${names.fs}.model.test.ts`,\n };\n }\n\n render({ entityId }: TemplateOptions[\"model_test\"]) {\n const names = EntityManager.getNamesFromId(entityId);\n\n return {\n ...this.getTargetAndPath(names),\n body: `\nimport { describe, test, expect } from \"vitest\";\nimport { bootstrap } from '../../testing/bootstrap';\n\nbootstrap([]);\ndescribe.skip(\"${entityId}ModelTest\", () => {\n test(\"Query\", async () => {\n expect(true).toBe(true);\n });\n});\n `.trim(),\n importKeys: [],\n };\n }\n}\n"],"names":["Template__model_test","getTargetAndPath","names","dir","Sonamu","config","api","target","path","fs","render","entityId","EntityManager","getNamesFromId","body","trim","importKeys","Template"],"mappings":"oGAKaA,8DAAAA,mDAJoC,sDACxB,oCACF,g7GAEhB,IAAA,AAAMA,kCAAN,0CAAMA,wCAAAA,8CAAAA,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EAAE,CAAC;KACtB;IAyHD,WAAW,CACT,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM;IA8BpB,oBAAoB,CAClB,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,oBAAoB,EAAE,QAAQ,EAAE;IA6ClC,SAAS,CACP,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM;IAsBpB,iBAAiB,CACf,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM;IAapB,YAAY,CACV,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,MAAM;CAuB5B"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Template__service",{enumerable:true,get:function(){return Template__service}});var _inflection=/*#__PURE__*/_interop_require_default(require("inflection"));var _lodash=/*#__PURE__*/_interop_require_default(require("lodash"));var _types=require("../types/types");var _codeconverters=require("../api/code-converters");var _basetemplate=require("./base-template");var _sonamu=require("../api/sonamu");function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(arr)}function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _interop_require_default(obj){return obj&&obj.__esModule?obj:{default:obj}}function _iterable_to_array(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__service=/*#__PURE__*/function(Template){"use strict";_inherits(Template__service,Template);function Template__service(){_class_call_check(this,Template__service);return _call_super(this,Template__service,["service"])}_create_class(Template__service,[{key:"getTargetAndPath",value:function getTargetAndPath(names){return{target:":target/src/services",path:"".concat(names.fs,"/").concat(names.fs,".service.ts")}}},{key:"render",value:function render(param,apis){var namesRecord=param.namesRecord;var _this_getTypeSource=this.getTypeSource(apis),lines=_this_getTypeSource.lines,importKeys=_this_getTypeSource.importKeys;var hasAxiosProgressEvent=apis.find(function(api){var _api_options_clients;return((_api_options_clients=api.options.clients)!==null&&_api_options_clients!==void 0?_api_options_clients:[]).includes("axios-multipart")});return _object_spread_props(_object_spread({},this.getTargetAndPath(namesRecord)),{body:lines.join("\n"),importKeys:importKeys.filter(function(key){return["ListResult"].includes(key)===false}),customHeaders:["import { z } from 'zod';",'import qs from "qs";','import useSWR, { SWRResponse } from "swr";',"import { fetch, ListResult, SWRError, SwrOptions, handleConditional, swrPostFetcher, EventHandlers, SSEStreamOptions, useSSEStream } from '../sonamu.shared';"].concat(_to_consumable_array(hasAxiosProgressEvent?["import { AxiosProgressEvent } from 'axios';"]:[]))})}},{key:"getTypeSource",value:function getTypeSource(apis){var _this=this;var importKeys=[];var typeParamNames=[];var groups=_lodash.default.groupBy(apis,function(api){return api.modelName});var body=Object.keys(groups).map(function(modelName){var methods=groups[modelName];var methodCodes=methods.map(function(api){var paramsWithoutContext=api.parameters.filter(function(param){return!_types.ApiParamType.isContext(param.type)&&!_types.ApiParamType.isRefKnex(param.type)&&!(param.optional===true&¶m.name.startsWith("_"))});var typeParamsDef=api.typeParameters.map(function(typeParam){return(0,_codeconverters.apiParamTypeToTsType)(typeParam,importKeys)}).join(", ");typeParamNames=typeParamNames.concat(api.typeParameters.map(function(typeParam){return typeParam.id}));var paramsDef=(0,_codeconverters.apiParamToTsCode)(paramsWithoutContext,importKeys);var paramsDefAsObject=(0,_codeconverters.apiParamToTsCodeAsObject)(paramsWithoutContext,importKeys);var returnTypeDef=(0,_codeconverters.apiParamTypeToTsType)((0,_codeconverters.unwrapPromiseOnce)(api.returnType),importKeys);var payloadDef="{ ".concat(paramsWithoutContext.map(function(param){return param.name}).join(", ")," }");var apiBaseUrl="".concat(_sonamu.Sonamu.config.route.prefix).concat(api.path);return _to_consumable_array(_lodash.default.sortBy(api.options.clients,function(client){return client==="swr"?0:1}).map(function(client){switch(client){case"axios":return _this.renderAxios(api,apiBaseUrl,typeParamsDef,paramsDef,returnTypeDef,payloadDef);case"axios-multipart":return _this.renderAxiosMultipart(api,apiBaseUrl,typeParamsDef,paramsDef,returnTypeDef,paramsWithoutContext);case"swr":return _this.renderSwr(api,apiBaseUrl,typeParamsDef,paramsDef,returnTypeDef,payloadDef);case"window-fetch":return _this.renderWindowFetch(api,apiBaseUrl,typeParamsDef,paramsDef,payloadDef);default:return"// Not supported ".concat(_inflection.default.camelize(client,true)," yet.")}})).concat(_to_consumable_array(api.streamOptions?[_this.renderStream(api,apiBaseUrl,paramsDefAsObject)]:[])).join("\n")}).join("\n\n");return"export namespace ".concat(modelName.replace(/Model$/,"Service").replace(/Frame$/,"Service")," {\n").concat(methodCodes,"\n}")}).join("\n\n");return{lines:[body],importKeys:_lodash.default.difference(_lodash.default.uniq(importKeys),typeParamNames)}}},{key:"renderAxios",value:function renderAxios(api,apiBaseUrl,typeParamsDef,paramsDef,returnTypeDef,payloadDef){var methodNameAxios=api.options.resourceName?"get"+_inflection.default.camelize(api.options.resourceName):api.methodName;if(api.options.httpMethod==="GET"){return"\nexport async function ".concat(methodNameAxios).concat(typeParamsDef,"(").concat(paramsDef,"): Promise<").concat(returnTypeDef,'> {\n return fetch({\n method: "GET",\n url: `').concat(apiBaseUrl,"?${qs.stringify(").concat(payloadDef,")}`,\n ").concat(api.options.timeout?"signal: AbortSignal.timeout(".concat(api.options.timeout,"),"):"","\n });\n}\n ").trim()}else{return"\nexport async function ".concat(methodNameAxios).concat(typeParamsDef,"(").concat(paramsDef,"): Promise<").concat(returnTypeDef,"> {\n return fetch({\n method: '").concat(api.options.httpMethod,"',\n url: `").concat(apiBaseUrl,"`,\n data: ").concat(payloadDef,",\n ").concat(api.options.timeout?"signal: AbortSignal.timeout(".concat(api.options.timeout,"),"):"","\n });\n}\n ").trim()}}},{key:"renderAxiosMultipart",value:function renderAxiosMultipart(api,apiBaseUrl,typeParamsDef,paramsDef,returnTypeDef,paramsWithoutContext){var _api_uploadOptions;var isMultiple=((_api_uploadOptions=api.uploadOptions)===null||_api_uploadOptions===void 0?void 0:_api_uploadOptions.mode)==="multiple";var fileParamName=isMultiple?"files":"file";var fileParamType=isMultiple?"File[]":"File";var formDataDef=isMultiple?["".concat(fileParamName,'.forEach(f => formData.append("').concat(fileParamName,'", f));')].concat(_to_consumable_array(paramsWithoutContext.map(function(param){return"formData.append('".concat(param.name,"', String(").concat(param.name,"));")}))).join("\n"):['formData.append("'.concat(fileParamName,'", ').concat(fileParamName,");")].concat(_to_consumable_array(paramsWithoutContext.map(function(param){return"formData.append('".concat(param.name,"', String(").concat(param.name,"));")}))).join("\n");var paramsDefComma=paramsDef!==""?", ":"";return"\nexport async function ".concat(api.methodName).concat(typeParamsDef,"(\n ").concat(paramsDef).concat(paramsDefComma,"\n ").concat(fileParamName,": ").concat(fileParamType,",\n onUploadProgress?: (pe:AxiosProgressEvent) => void\n ): Promise<").concat(returnTypeDef,"> {\n const formData = new FormData();\n ").concat(formDataDef,"\n return fetch({\n method: 'POST',\n url: `").concat(apiBaseUrl,'`,\n headers: {\n "Content-Type": "multipart/form-data",\n },\n onUploadProgress,\n data: formData,\n ').concat(api.options.timeout?"signal: AbortSignal.timeout(".concat(api.options.timeout,"),"):"","\n });\n }\n ").trim()}},{key:"renderSwr",value:function renderSwr(api,apiBaseUrl,typeParamsDef,paramsDef,returnTypeDef,payloadDef){var methodNameSwr=api.options.resourceName?"use"+_inflection.default.camelize(api.options.resourceName):"use"+_inflection.default.camelize(api.methodName);return" export function ".concat(_inflection.default.camelize(methodNameSwr,true)).concat(typeParamsDef,"(").concat([paramsDef,"swrOptions?: SwrOptions"].filter(function(p){return p!==""}).join(","),", ): SWRResponse<").concat(returnTypeDef,", SWRError> {\n return useSWR(handleConditional([\n `").concat(apiBaseUrl,"`,\n ").concat(payloadDef,",\n ], swrOptions?.conditional)").concat(api.options.httpMethod==="POST"?", swrPostFetcher":"").concat(api.options.timeout?", { loadingTimeout: ".concat(api.options.timeout," }"):"",");\n }")}},{key:"renderWindowFetch",value:function renderWindowFetch(api,apiBaseUrl,typeParamsDef,paramsDef,payloadDef){return"\nexport async function ".concat(api.methodName).concat(typeParamsDef,"(").concat(paramsDef,"): Promise<Response> {\n return window.fetch(`").concat(apiBaseUrl,"?${qs.stringify(").concat(payloadDef,")}`").concat(api.options.timeout?", { signal: AbortSignal.timeout(".concat(api.options.timeout,") }"):"",");\n}\n ").trim()}},{key:"renderStream",value:function renderStream(api,apiBaseUrl,paramsDefAsObject){if(!api.streamOptions){return"// streamOptions not found"}var methodNameStream=api.options.resourceName?"use"+_inflection.default.camelize(api.options.resourceName):"use"+_inflection.default.camelize(api.methodName);var methodNameStreamCamelized=_inflection.default.camelize(methodNameStream,true);var eventsTypeDef=(0,_codeconverters.zodTypeToTsTypeDef)(api.streamOptions.events);return" export function ".concat(methodNameStreamCamelized,"(\n params: ").concat(paramsDefAsObject,",\n handlers: EventHandlers<").concat(eventsTypeDef," & { end?: () => void }>,\n options: SSEStreamOptions) {\n return useSSEStream<").concat(eventsTypeDef,">(`").concat(apiBaseUrl,"`, params, handlers, options);\n }")}}]);return Template__service}(_basetemplate.Template);
|
|
2
|
-
//# sourceMappingURL=service.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/service.template.ts"],"sourcesContent":["import inflection from \"inflection\";\nimport _ from \"lodash\";\nimport { TemplateOptions } from \"../types/types\";\nimport { EntityNamesRecord } from \"../entity/entity-manager\";\nimport { ApiParamType, ApiParam } from \"../types/types\";\nimport {\n apiParamTypeToTsType,\n apiParamToTsCode,\n unwrapPromiseOnce,\n zodTypeToTsTypeDef,\n apiParamToTsCodeAsObject,\n} from \"../api/code-converters\";\nimport { ExtendedApi } from \"../api/decorators\";\nimport { Template } from \"./base-template\";\nimport { Sonamu } from \"../api/sonamu\";\n\nexport class Template__service extends Template {\n constructor() {\n super(\"service\");\n }\n\n getTargetAndPath(names: EntityNamesRecord) {\n return {\n target: \":target/src/services\",\n path: `${names.fs}/${names.fs}.service.ts`,\n };\n }\n\n render({ namesRecord }: TemplateOptions[\"service\"], apis: ExtendedApi[]) {\n // 서비스 TypeSource\n const { lines, importKeys } = this.getTypeSource(apis);\n\n // AxiosProgressEvent 있는지 확인\n const hasAxiosProgressEvent = apis.find((api) =>\n (api.options.clients ?? []).includes(\"axios-multipart\")\n );\n\n return {\n ...this.getTargetAndPath(namesRecord),\n body: lines.join(\"\\n\"),\n importKeys: importKeys.filter(\n (key) => [\"ListResult\"].includes(key) === false\n ),\n customHeaders: [\n `import { z } from 'zod';`,\n `import qs from \"qs\";`,\n `import useSWR, { SWRResponse } from \"swr\";`,\n `import { fetch, ListResult, SWRError, SwrOptions, handleConditional, swrPostFetcher, EventHandlers, SSEStreamOptions, useSSEStream } from '../sonamu.shared';`,\n ...(hasAxiosProgressEvent\n ? [`import { AxiosProgressEvent } from 'axios';`]\n : []),\n ],\n };\n }\n\n getTypeSource(apis: ExtendedApi[]): {\n lines: string[];\n importKeys: string[];\n } {\n const importKeys: string[] = [];\n\n // 제네릭에서 선언한 타입, importKeys에서 제외 필요\n let typeParamNames: string[] = [];\n\n const groups = _.groupBy(apis, (api) => api.modelName);\n const body = Object.keys(groups)\n .map((modelName) => {\n const methods = groups[modelName];\n const methodCodes = methods\n .map((api) => {\n // 컨텍스트 제외된 파라미터 리스트\n const paramsWithoutContext = api.parameters.filter(\n (param) =>\n !ApiParamType.isContext(param.type) &&\n !ApiParamType.isRefKnex(param.type) &&\n !(param.optional === true && param.name.startsWith(\"_\")) // _로 시작하는 파라미터는 제외\n );\n\n // 파라미터 타입 정의\n const typeParamsDef = api.typeParameters\n .map((typeParam) => {\n return apiParamTypeToTsType(typeParam, importKeys);\n })\n .join(\", \");\n typeParamNames = typeParamNames.concat(\n api.typeParameters.map((typeParam) => typeParam.id)\n );\n\n // 파라미터 정의\n const paramsDef = apiParamToTsCode(\n paramsWithoutContext,\n importKeys\n );\n\n // 파라미터 정의 (객체 형태)\n const paramsDefAsObject = apiParamToTsCodeAsObject(\n paramsWithoutContext,\n importKeys\n );\n\n // 리턴 타입 정의\n const returnTypeDef = apiParamTypeToTsType(\n unwrapPromiseOnce(api.returnType),\n importKeys\n );\n\n // 페이로드 데이터 정의\n const payloadDef = `{ ${paramsWithoutContext\n .map((param) => param.name)\n .join(\", \")} }`;\n\n // 기본 URL\n const apiBaseUrl = `${Sonamu.config.route.prefix}${api.path}`;\n\n return [\n // 클라이언트별로 생성\n ..._.sortBy(api.options.clients, (client) =>\n client === \"swr\" ? 0 : 1\n ).map((client) => {\n switch (client) {\n case \"axios\":\n return this.renderAxios(\n api,\n apiBaseUrl,\n typeParamsDef,\n paramsDef,\n returnTypeDef,\n payloadDef\n );\n case \"axios-multipart\":\n return this.renderAxiosMultipart(\n api,\n apiBaseUrl,\n typeParamsDef,\n paramsDef,\n returnTypeDef,\n paramsWithoutContext\n );\n case \"swr\":\n return this.renderSwr(\n api,\n apiBaseUrl,\n typeParamsDef,\n paramsDef,\n returnTypeDef,\n payloadDef\n );\n case \"window-fetch\":\n return this.renderWindowFetch(\n api,\n apiBaseUrl,\n typeParamsDef,\n paramsDef,\n payloadDef\n );\n default:\n return `// Not supported ${inflection.camelize(client, true)} yet.`;\n }\n }),\n // 스트리밍인 경우\n ...(api.streamOptions\n ? [this.renderStream(api, apiBaseUrl, paramsDefAsObject)]\n : []),\n ].join(\"\\n\");\n })\n .join(\"\\n\\n\");\n\n return `export namespace ${modelName.replace(/Model$/, \"Service\").replace(/Frame$/, \"Service\")} {\n${methodCodes}\n}`;\n })\n .join(\"\\n\\n\");\n\n return {\n lines: [body],\n importKeys: _.difference(_.uniq(importKeys), typeParamNames),\n };\n }\n\n renderAxios(\n api: ExtendedApi,\n apiBaseUrl: string,\n typeParamsDef: string,\n paramsDef: string,\n returnTypeDef: string,\n payloadDef: string\n ) {\n const methodNameAxios = api.options.resourceName\n ? \"get\" + inflection.camelize(api.options.resourceName)\n : api.methodName;\n\n if (api.options.httpMethod === \"GET\") {\n return `\nexport async function ${methodNameAxios}${typeParamsDef}(${paramsDef}): Promise<${returnTypeDef}> {\n return fetch({\n method: \"GET\",\n url: \\`${apiBaseUrl}?\\${qs.stringify(${payloadDef})}\\`,\n ${api.options.timeout ? `signal: AbortSignal.timeout(${api.options.timeout}),` : \"\"}\n });\n}\n `.trim();\n } else {\n return `\nexport async function ${methodNameAxios}${typeParamsDef}(${paramsDef}): Promise<${returnTypeDef}> {\n return fetch({\n method: '${api.options.httpMethod}',\n url: \\`${apiBaseUrl}\\`,\n data: ${payloadDef},\n ${api.options.timeout ? `signal: AbortSignal.timeout(${api.options.timeout}),` : \"\"}\n });\n}\n `.trim();\n }\n }\n\n renderAxiosMultipart(\n api: ExtendedApi,\n apiBaseUrl: string,\n typeParamsDef: string,\n paramsDef: string,\n returnTypeDef: string,\n paramsWithoutContext: ApiParam[]\n ) {\n const isMultiple = api.uploadOptions?.mode === \"multiple\";\n const fileParamName = isMultiple ? \"files\" : \"file\";\n const fileParamType = isMultiple ? \"File[]\" : \"File\";\n\n const formDataDef = isMultiple\n ? [\n `${fileParamName}.forEach(f => formData.append(\"${fileParamName}\", f));`,\n ...paramsWithoutContext.map(\n (param) =>\n `formData.append('${param.name}', String(${param.name}));`\n ),\n ].join(\"\\n\")\n : [\n `formData.append(\"${fileParamName}\", ${fileParamName});`,\n ...paramsWithoutContext.map(\n (param) =>\n `formData.append('${param.name}', String(${param.name}));`\n ),\n ].join(\"\\n\");\n\n const paramsDefComma = paramsDef !== \"\" ? \", \" : \"\";\n return `\nexport async function ${api.methodName}${typeParamsDef}(\n ${paramsDef}${paramsDefComma}\n ${fileParamName}: ${fileParamType},\n onUploadProgress?: (pe:AxiosProgressEvent) => void\n ): Promise<${returnTypeDef}> {\n const formData = new FormData();\n ${formDataDef}\n return fetch({\n method: 'POST',\n url: \\`${apiBaseUrl}\\`,\n headers: {\n \"Content-Type\": \"multipart/form-data\",\n },\n onUploadProgress,\n data: formData,\n ${api.options.timeout ? `signal: AbortSignal.timeout(${api.options.timeout}),` : \"\"}\n });\n }\n `.trim();\n }\n\n renderSwr(\n api: ExtendedApi,\n apiBaseUrl: string,\n typeParamsDef: string,\n paramsDef: string,\n returnTypeDef: string,\n payloadDef: string\n ) {\n const methodNameSwr = api.options.resourceName\n ? \"use\" + inflection.camelize(api.options.resourceName)\n : \"use\" + inflection.camelize(api.methodName);\n return ` export function ${inflection.camelize(\n methodNameSwr,\n true\n )}${typeParamsDef}(${[paramsDef, \"swrOptions?: SwrOptions\"]\n .filter((p) => p !== \"\")\n .join(\",\")}, ): SWRResponse<${returnTypeDef}, SWRError> {\n return useSWR(handleConditional([\n \\`${apiBaseUrl}\\`,\n ${payloadDef},\n ], swrOptions?.conditional)${\n api.options.httpMethod === \"POST\" ? \", swrPostFetcher\" : \"\"\n }${\n api.options.timeout ? `, { loadingTimeout: ${api.options.timeout} }` : \"\"\n });\n }`;\n }\n\n renderWindowFetch(\n api: ExtendedApi,\n apiBaseUrl: string,\n typeParamsDef: string,\n paramsDef: string,\n payloadDef: string\n ) {\n return `\nexport async function ${api.methodName}${typeParamsDef}(${paramsDef}): Promise<Response> {\n return window.fetch(\\`${apiBaseUrl}?\\${qs.stringify(${payloadDef})}\\`${\n api.options.timeout\n ? `, { signal: AbortSignal.timeout(${api.options.timeout}) }`\n : \"\"\n });\n}\n `.trim();\n }\n\n renderStream(\n api: ExtendedApi,\n apiBaseUrl: string,\n paramsDefAsObject: string\n ) {\n if (!api.streamOptions) {\n return \"// streamOptions not found\";\n }\n\n const methodNameStream = api.options.resourceName\n ? \"use\" + inflection.camelize(api.options.resourceName)\n : \"use\" + inflection.camelize(api.methodName);\n const methodNameStreamCamelized = inflection.camelize(\n methodNameStream,\n true\n );\n\n const eventsTypeDef = zodTypeToTsTypeDef(api.streamOptions.events);\n\n return ` export function ${methodNameStreamCamelized}(\n params: ${paramsDefAsObject},\n handlers: EventHandlers<${eventsTypeDef} & { end?: () => void }>,\n options: SSEStreamOptions) {\n return useSSEStream<${eventsTypeDef}>(\\`${apiBaseUrl}\\`, params, handlers, options);\n }`;\n }\n}\n"],"names":["Template__service","getTargetAndPath","names","target","path","fs","render","apis","namesRecord","getTypeSource","lines","importKeys","hasAxiosProgressEvent","find","api","options","clients","includes","body","join","filter","key","customHeaders","typeParamNames","groups","_","groupBy","modelName","Object","keys","map","methods","methodCodes","paramsWithoutContext","parameters","param","ApiParamType","isContext","type","isRefKnex","optional","name","startsWith","typeParamsDef","typeParameters","typeParam","apiParamTypeToTsType","concat","id","paramsDef","apiParamToTsCode","paramsDefAsObject","apiParamToTsCodeAsObject","returnTypeDef","unwrapPromiseOnce","returnType","payloadDef","apiBaseUrl","Sonamu","config","route","prefix","sortBy","client","renderAxios","renderAxiosMultipart","renderSwr","renderWindowFetch","inflection","camelize","streamOptions","renderStream","replace","difference","uniq","methodNameAxios","resourceName","methodName","httpMethod","timeout","trim","isMultiple","uploadOptions","mode","fileParamName","fileParamType","formDataDef","paramsDefComma","methodNameSwr","p","methodNameStream","methodNameStreamCamelized","eventsTypeDef","zodTypeToTsTypeDef","events","Template"],"mappings":"oGAgBaA,2DAAAA,mFAhBU,yEACT,8BAGyB,8CAOhC,oDAEkB,uCACF,kmJAEhB,IAAA,AAAMA,+BAAN,0CAAMA,qCAAAA,2CAAAA,mBAET,OAAA,iBAFSA,mBAEH,0BAFGA,oBAKXC,IAAAA,yBAAAA,SAAAA,iBAAiBC,KAAwB,EACvC,MAAO,CACLC,OAAQ,uBACRC,KAAM,AAAC,GAAcF,OAAZA,MAAMG,EAAE,CAAC,KAAY,OAATH,MAAMG,EAAE,CAAC,cAChC,CACF,IAEAC,IAAAA,eAAAA,SAAAA,OAAO,KAA2C,CAAEC,IAAmB,MAAhE,AAAEC,YAAF,MAAEA,YAEP,IAA8B,oBAAA,IAAI,CAACC,aAAa,CAACF,MAAzCG,MAAsB,oBAAtBA,MAAOC,WAAe,oBAAfA,WAGf,IAAMC,sBAAwBL,KAAKM,IAAI,CAAC,SAACC,SACtCA,2BAAD,AAACA,CAAAA,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4BvB,mBAAU,CAACC,QAAQ,CACnDqB,iBACA,MAGF,IAAME,cAAgBC,GAAAA,kCAAkB,EAAC/E,IAAIwD,aAAa,CAACwB,MAAM,EAEjE,MAAO,AAAC,qBACA3C,OADoBwC,0BAA0B,iBAE9BC,OADhBzC,kBAAkB,iCAGJyC,OAFEA,cAAc,uFAEInC,OAApBmC,cAAc,OAAiB,OAAXnC,WAAW,sCAEvD,YAjUWzD,mBAA0B+F,sBAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view_enums_buttonset.template.d.ts","sourceRoot":"","sources":["../../src/templates/view_enums_buttonset.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAiB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,qBAAa,8BAA+B,SAAQ,QAAQ;;IAK1D,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM;;;;IAO9D,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,sBAAsB,CAAC;;;;;;CAiBrE"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Template__view_enums_buttonset",{enumerable:true,get:function(){return Template__view_enums_buttonset}});var _entitymanager=require("../entity/entity-manager");var _basetemplate=require("./base-template");function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__view_enums_buttonset=/*#__PURE__*/function(Template){"use strict";_inherits(Template__view_enums_buttonset,Template);function Template__view_enums_buttonset(){_class_call_check(this,Template__view_enums_buttonset);return _call_super(this,Template__view_enums_buttonset,["view_enums_buttonset"])}_create_class(Template__view_enums_buttonset,[{key:"getTargetAndPath",value:function getTargetAndPath(names,componentId){return{target:"web/src/components",path:"".concat(names.fs,"/").concat(componentId,"ButtonSet.tsx")}}},{key:"render",value:function render(param){var entityId=param.entityId,enumId=param.enumId;var names=_entitymanager.EntityManager.getNamesFromId(entityId);return _object_spread_props(_object_spread({},this.getTargetAndPath(names,enumId)),{body:"\n/*\nview_enums_buttonset\n".concat(JSON.stringify({key:this.key,options:entityId}),"\n*/\n ").trim(),importKeys:[]})}}]);return Template__view_enums_buttonset}(_basetemplate.Template);
|
|
2
|
-
//# sourceMappingURL=view_enums_buttonset.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/view_enums_buttonset.template.ts"],"sourcesContent":["import { TemplateOptions } from \"../types/types\";\nimport { EntityManager, EntityNamesRecord } from \"../entity/entity-manager\";\nimport { Template } from \"./base-template\";\n\nexport class Template__view_enums_buttonset extends Template {\n constructor() {\n super(\"view_enums_buttonset\");\n }\n\n getTargetAndPath(names: EntityNamesRecord, componentId: string) {\n return {\n target: \"web/src/components\",\n path: `${names.fs}/${componentId}ButtonSet.tsx`,\n };\n }\n\n render({ entityId, enumId }: TemplateOptions[\"view_enums_buttonset\"]) {\n const names = EntityManager.getNamesFromId(entityId);\n\n return {\n ...this.getTargetAndPath(names, enumId),\n body: `\n/*\nview_enums_buttonset\n${JSON.stringify({\n key: this.key,\n options: entityId,\n})}\n*/\n `.trim(),\n importKeys: [],\n };\n }\n}\n"],"names":["Template__view_enums_buttonset","getTargetAndPath","names","componentId","target","path","fs","render","entityId","enumId","EntityManager","getNamesFromId","body","JSON","stringify","key","options","trim","importKeys","Template"],"mappings":"oGAIaA,wEAAAA,6DAHoC,sDACxB,y7GAElB,IAAA,AAAMA,4CAAN,0CAAMA,kDAAAA,wDAAAA,gCAET,OAAA,iBAFSA,gCAEH,uCAFGA,iCAKXC,IAAAA,yBAAAA,SAAAA,iBAAiBC,KAAwB,CAAEC,WAAmB,EAC5D,MAAO,CACLC,OAAQ,qBACRC,KAAM,AAAC,GAAcF,OAAZD,MAAMI,EAAE,CAAC,KAAe,OAAZH,YAAY,gBACnC,CACF,IAEAI,IAAAA,eAAAA,SAAAA,OAAO,KAA6D,MAA3DC,SAAF,MAAEA,SAAUC,OAAZ,MAAYA,OACjB,IAAMP,MAAQQ,4BAAa,CAACC,cAAc,CAACH,UAE3C,OAAO,uCACF,IAAI,CAACP,gBAAgB,CAACC,MAAOO,UAChCG,KAAM,AAAC,+BAMV,OAHDC,KAAKC,SAAS,CAAC,CACfC,IAAK,IAAI,CAACA,GAAG,CACbC,QAASR,QACX,GAAG,gBAEKS,IAAI,GACNC,WAAY,EAAE,EAElB,YA5BWlB,gCAAuCmB,sBAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view_enums_dropdown.template.d.ts","sourceRoot":"","sources":["../../src/templates/view_enums_dropdown.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAiB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,qBAAa,6BAA8B,SAAQ,QAAQ;;IAKzD,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM;;;;IAOzD,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,qBAAqB,CAAC;;;;;;CAmCpE;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAcjE"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get Template__view_enums_dropdown(){return Template__view_enums_dropdown},get getLabel(){return getLabel}});var _entitymanager=require("../entity/entity-manager");var _basetemplate=require("./base-template");var _inflection=/*#__PURE__*/_interop_require_default(require("inflection"));function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _interop_require_default(obj){return obj&&obj.__esModule?obj:{default:obj}}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__view_enums_dropdown=/*#__PURE__*/function(Template){"use strict";_inherits(Template__view_enums_dropdown,Template);function Template__view_enums_dropdown(){_class_call_check(this,Template__view_enums_dropdown);return _call_super(this,Template__view_enums_dropdown,["view_enums_dropdown"])}_create_class(Template__view_enums_dropdown,[{key:"getTargetAndPath",value:function getTargetAndPath(names,enumId){return{target:"web/src/components",path:"".concat(names.fs,"/").concat(enumId,"Dropdown.tsx")}}},{key:"render",value:function render(param){var entityId=param.entityId,enumId=param.enumId;var names=_entitymanager.EntityManager.getNamesFromId(entityId);var label=getLabel(entityId,enumId);return _object_spread_props(_object_spread({},this.getTargetAndPath(names,enumId)),{body:"\nimport React from 'react';\nimport {\n Dropdown,\n DropdownProps,\n} from 'semantic-ui-react';\n\nimport { ".concat(enumId,"Label } from 'src/services/sonamu.generated';\n\nexport function ").concat(enumId,"Dropdown(props: DropdownProps) {\n const options = Object.entries(").concat(enumId,'Label).map(([key, label]) => {\n return {\n key,\n value: key,\n text: "').concat(label,': " + label,\n };\n });\n return (\n <Dropdown\n className="label"\n options={options}\n {...props}\n />\n );\n}\n ').trim(),importKeys:[]})}}]);return Template__view_enums_dropdown}(_basetemplate.Template);function getLabel(entityId,enumId){if(enumId.endsWith("OrderBy")){return"정렬"}else if(enumId.endsWith("SearchField")){return"검색"}else{var enumProp=_entitymanager.EntityManager.get(entityId).props.find(function(prop){return"".concat(entityId).concat(_inflection.default.camelize(prop.name))===enumId});if(enumProp&&enumProp.desc){return enumProp.desc}return enumId}}
|
|
2
|
-
//# sourceMappingURL=view_enums_dropdown.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/view_enums_dropdown.template.ts"],"sourcesContent":["import { TemplateOptions } from \"../types/types\";\nimport { EntityManager, EntityNamesRecord } from \"../entity/entity-manager\";\nimport { Template } from \"./base-template\";\nimport inflection from \"inflection\";\n\nexport class Template__view_enums_dropdown extends Template {\n constructor() {\n super(\"view_enums_dropdown\");\n }\n\n getTargetAndPath(names: EntityNamesRecord, enumId: string) {\n return {\n target: \"web/src/components\",\n path: `${names.fs}/${enumId}Dropdown.tsx`,\n };\n }\n\n render({ entityId, enumId }: TemplateOptions[\"view_enums_dropdown\"]) {\n const names = EntityManager.getNamesFromId(entityId);\n const label = getLabel(entityId, enumId);\n\n return {\n ...this.getTargetAndPath(names, enumId),\n body: `\nimport React from 'react';\nimport {\n Dropdown,\n DropdownProps,\n} from 'semantic-ui-react';\n\nimport { ${enumId}Label } from 'src/services/sonamu.generated';\n\nexport function ${enumId}Dropdown(props: DropdownProps) {\n const options = Object.entries(${enumId}Label).map(([key, label]) => {\n return {\n key,\n value: key,\n text: \"${label}: \" + label,\n };\n });\n return (\n <Dropdown\n className=\"label\"\n options={options}\n {...props}\n />\n );\n}\n `.trim(),\n importKeys: [],\n };\n }\n}\n\nexport function getLabel(entityId: string, enumId: string): string {\n if (enumId.endsWith(\"OrderBy\")) {\n return \"정렬\";\n } else if (enumId.endsWith(\"SearchField\")) {\n return \"검색\";\n } else {\n const enumProp = EntityManager.get(entityId).props.find(\n (prop) => `${entityId}${inflection.camelize(prop.name)}` === enumId\n );\n if (enumProp && enumProp.desc) {\n return enumProp.desc;\n }\n return enumId;\n }\n}\n"],"names":["Template__view_enums_dropdown","getLabel","getTargetAndPath","names","enumId","target","path","fs","render","entityId","EntityManager","getNamesFromId","label","body","trim","importKeys","Template","endsWith","enumProp","get","props","find","prop","inflection","camelize","name","desc"],"mappings":"mPAKaA,uCAAAA,mCAiDGC,kBAAAA,uCArDiC,sDACxB,iFACF,ygHAEhB,IAAA,AAAMD,2CAAN,0CAAMA,iDAAAA,uDAAAA,+BAET,OAAA,iBAFSA,+BAEH,sCAFGA,gCAKXE,IAAAA,yBAAAA,SAAAA,iBAAiBC,KAAwB,CAAEC,MAAc,EACvD,MAAO,CACLC,OAAQ,qBACRC,KAAM,AAAC,GAAcF,OAAZD,MAAMI,EAAE,CAAC,KAAU,OAAPH,OAAO,eAC9B,CACF,IAEAI,IAAAA,eAAAA,SAAAA,OAAO,KAA4D,MAA1DC,SAAF,MAAEA,SAAUL,OAAZ,MAAYA,OACjB,IAAMD,MAAQO,4BAAa,CAACC,cAAc,CAACF,UAC3C,IAAMG,MAAQX,SAASQ,SAAUL,QAEjC,OAAO,uCACF,IAAI,CAACF,gBAAgB,CAACC,MAAOC,UAChCS,KAAM,AAAC,kHASKT,OAFPA,OAAO,qEAGiBA,OADjBA,OAAO,uEAKVQ,OAJoBR,OAAO,8FAIrB,OAANQ,MAAM,uJAWbE,IAAI,GACNC,WAAY,EAAE,EAElB,YA9CWf,+BAAsCgB,sBAAQ,EAiDpD,SAASf,SAASQ,QAAgB,CAAEL,MAAc,EACvD,GAAIA,OAAOa,QAAQ,CAAC,WAAY,CAC9B,MAAO,IACT,MAAO,GAAIb,OAAOa,QAAQ,CAAC,eAAgB,CACzC,MAAO,IACT,KAAO,CACL,IAAMC,SAAWR,4BAAa,CAACS,GAAG,CAACV,UAAUW,KAAK,CAACC,IAAI,CACrD,SAACC,YAAS,AAAC,GAAaC,OAAXd,UAA0C,OAA/Bc,mBAAU,CAACC,QAAQ,CAACF,KAAKG,IAAI,KAAQrB,SAE/D,GAAIc,UAAYA,SAASQ,IAAI,CAAE,CAC7B,OAAOR,SAASQ,IAAI,AACtB,CACA,OAAOtB,MACT,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view_enums_select.template.d.ts","sourceRoot":"","sources":["../../src/templates/view_enums_select.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAiB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,qBAAa,2BAA4B,SAAQ,QAAQ;;IAKvD,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM;;;;IAOzD,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,mBAAmB,CAAC;;;;;;CAwClE"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Template__view_enums_select",{enumerable:true,get:function(){return Template__view_enums_select}});var _entitymanager=require("../entity/entity-manager");var _basetemplate=require("./base-template");var _view_enums_dropdowntemplate=require("./view_enums_dropdown.template");function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__view_enums_select=/*#__PURE__*/function(Template){"use strict";_inherits(Template__view_enums_select,Template);function Template__view_enums_select(){_class_call_check(this,Template__view_enums_select);return _call_super(this,Template__view_enums_select,["view_enums_select"])}_create_class(Template__view_enums_select,[{key:"getTargetAndPath",value:function getTargetAndPath(names,enumId){return{target:"web/src/components",path:"".concat(names.fs,"/").concat(enumId,"Select.tsx")}}},{key:"render",value:function render(param){var entityId=param.entityId,enumId=param.enumId;var names=_entitymanager.EntityManager.getNamesFromId(entityId);var label=(0,_view_enums_dropdowntemplate.getLabel)(entityId,enumId);return _object_spread_props(_object_spread({},this.getTargetAndPath(names,enumId)),{body:"\nimport React from 'react';\nimport {\n Dropdown,\n DropdownProps,\n} from 'semantic-ui-react';\n\nimport { ".concat(enumId,", ").concat(enumId,"Label } from 'src/services/sonamu.generated';\n\nexport type ").concat(enumId,"SelectProps = {\n placeholder?: string;\n textPrefix?: string;\n} & DropdownProps;\nexport function ").concat(enumId,"Select({placeholder, textPrefix, ...props}: ").concat(enumId,"SelectProps) {\n const typeOptions = ").concat(enumId,".options.map((key) => ({\n key,\n value: key,\n text: (textPrefix ?? '").concat(label,": ') + ").concat(enumId,'Label[key],\n }));\n\n return (\n <Dropdown\n placeholder={placeholder ?? "').concat(label,'"}\n selection\n options={typeOptions}\n selectOnBlur={false}\n {...props}\n />\n );\n}\n ').trim(),importKeys:[]})}}]);return Template__view_enums_select}(_basetemplate.Template);
|
|
2
|
-
//# sourceMappingURL=view_enums_select.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/view_enums_select.template.ts"],"sourcesContent":["import { TemplateOptions } from \"../types/types\";\nimport { EntityManager, EntityNamesRecord } from \"../entity/entity-manager\";\nimport { Template } from \"./base-template\";\nimport { getLabel } from \"./view_enums_dropdown.template\";\n\nexport class Template__view_enums_select extends Template {\n constructor() {\n super(\"view_enums_select\");\n }\n\n getTargetAndPath(names: EntityNamesRecord, enumId: string) {\n return {\n target: \"web/src/components\",\n path: `${names.fs}/${enumId}Select.tsx`,\n };\n }\n\n render({ entityId, enumId }: TemplateOptions[\"view_enums_select\"]) {\n const names = EntityManager.getNamesFromId(entityId);\n const label = getLabel(entityId, enumId);\n\n return {\n ...this.getTargetAndPath(names, enumId),\n body: `\nimport React from 'react';\nimport {\n Dropdown,\n DropdownProps,\n} from 'semantic-ui-react';\n\nimport { ${enumId}, ${enumId}Label } from 'src/services/sonamu.generated';\n\nexport type ${enumId}SelectProps = {\n placeholder?: string;\n textPrefix?: string;\n} & DropdownProps;\nexport function ${enumId}Select({placeholder, textPrefix, ...props}: ${enumId}SelectProps) {\n const typeOptions = ${enumId}.options.map((key) => ({\n key,\n value: key,\n text: (textPrefix ?? '${label}: ') + ${enumId}Label[key],\n }));\n\n return (\n <Dropdown\n placeholder={placeholder ?? \"${label}\"}\n selection\n options={typeOptions}\n selectOnBlur={false}\n {...props}\n />\n );\n}\n `.trim(),\n importKeys: [],\n };\n }\n}\n"],"names":["Template__view_enums_select","getTargetAndPath","names","enumId","target","path","fs","render","entityId","EntityManager","getNamesFromId","label","getLabel","body","trim","importKeys","Template"],"mappings":"oGAKaA,qEAAAA,0DAJoC,sDACxB,4DACA,w8GAElB,IAAA,AAAMA,yCAAN,0CAAMA,+CAAAA,qDAAAA,6BAET,OAAA,iBAFSA,6BAEH,oCAFGA,8BAKXC,IAAAA,yBAAAA,SAAAA,iBAAiBC,KAAwB,CAAEC,MAAc,EACvD,MAAO,CACLC,OAAQ,qBACRC,KAAM,AAAC,GAAcF,OAAZD,MAAMI,EAAE,CAAC,KAAU,OAAPH,OAAO,aAC9B,CACF,IAEAI,IAAAA,eAAAA,SAAAA,OAAO,KAA0D,MAAxDC,SAAF,MAAEA,SAAUL,OAAZ,MAAYA,OACjB,IAAMD,MAAQO,4BAAa,CAACC,cAAc,CAACF,UAC3C,IAAMG,MAAQC,GAAAA,qCAAQ,EAACJ,SAAUL,QAEjC,OAAO,uCACF,IAAI,CAACF,gBAAgB,CAACC,MAAOC,UAChCU,KAAM,AAAC,kHAOSV,OAAXA,OAAO,MAEJA,OAFQA,OAAO,iEAMXA,OAJJA,OAAO,0GAIkDA,OAArDA,OAAO,gDACDA,OAD+CA,OAAO,0CAIlDQ,OAHJR,OAAO,mFAGYA,OAAfQ,MAAM,WAKGA,OALMR,OAAO,yFAKP,OAANQ,MAAM,2HAQnCG,IAAI,GACNC,WAAY,EAAE,EAElB,YAnDWf,6BAAoCgB,sBAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view_form.template.d.ts","sourceRoot":"","sources":["../../src/templates/view_form.template.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAiB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAO3C,qBAAa,mBAAoB,SAAQ,QAAQ;;IAK/C,gBAAgB,CAAC,KAAK,EAAE,iBAAiB;;;;IAOzC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAO5C,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAQ5C,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa;IAyBvD,YAAY,CACV,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,iBAAiB,EACxB,MAAM,GAAE,MAAW,GAClB,MAAM;IAqET,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,MAAM;IAqCrD,MAAM,CACJ,EAAE,QAAQ,EAAE,EAAE,eAAe,CAAC,WAAW,CAAC,EAC1C,cAAc,EAAE,aAAa;;;;;;;;;;CAyPhC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Template__view_form",{enumerable:true,get:function(){return Template__view_form}});var _inflection=/*#__PURE__*/_interop_require_default(require("inflection"));var _zod=require("zod");var _entitymanager=require("../entity/entity-manager");var _basetemplate=require("./base-template");var _view_listtemplate=require("./view_list.template");var _lodash=/*#__PURE__*/_interop_require_default(require("lodash"));function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _instanceof(left,right){if(right!=null&&typeof Symbol!=="undefined"&&right[Symbol.hasInstance]){return!!right[Symbol.hasInstance](left)}else{return left instanceof right}}function _interop_require_default(obj){return obj&&obj.__esModule?obj:{default:obj}}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__view_form=/*#__PURE__*/function(Template){"use strict";_inherits(Template__view_form,Template);function Template__view_form(){_class_call_check(this,Template__view_form);return _call_super(this,Template__view_form,["view_form"])}_create_class(Template__view_form,[{key:"getTargetAndPath",value:function getTargetAndPath(names){return{target:"web/src/pages/admin",path:"".concat(names.fsPlural,"/form.tsx")}}},{key:"wrapFC",value:function wrapFC(body,label){return["<Form.Field>".concat(label?"\n <label>".concat(label,"</label>"):""),body,"</Form.Field>"].join("\n")}},{key:"wrapFG",value:function wrapFG(body,label){return['<Form.Group widths="equal">',this.wrapFC(body,label),"</Form.Group>"].join("\n")}},{key:"renderColumnImport",value:function renderColumnImport(entityId,col){if(col.renderType==="enums"){var _getEnumInfoFromColName=(0,_view_listtemplate.getEnumInfoFromColName)(entityId,col.name),id=_getEnumInfoFromColName.id,targetEntityNames=_getEnumInfoFromColName.targetEntityNames;var componentId="".concat(id,"Select");return"import { ".concat(componentId,' } from "src/components/').concat(targetEntityNames.fs,"/").concat(componentId,'";')}else if(col.renderType==="number-fk_id"){try{var relProp=(0,_view_listtemplate.getRelationPropFromColName)(entityId,col.name.replace("_id",""));var targetNames=_entitymanager.EntityManager.getNamesFromId(relProp.with);var componentId1="".concat(relProp.with,"IdAsyncSelect");return"import { ".concat(componentId1,' } from "src/components/').concat(targetNames.fs,"/").concat(componentId1,'";')}catch(e){return""}}else{throw new Error("렌더 불가능한 임포트 ".concat(col.name," ").concat(col.renderType))}}},{key:"renderColumn",value:function renderColumn(entityId,col,names){var parent=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";var regExpr="";regExpr="{...register(`".concat(parent).concat(col.name,"`)}");switch(col.renderType){case"string-plain":var _col_zodType_maxLength;if(_instanceof(col.zodType,_zod.z.ZodString)&&((_col_zodType_maxLength=col.zodType.maxLength)!==null&&_col_zodType_maxLength!==void 0?_col_zodType_maxLength:0)<=512){return'<Input placeholder="'.concat(col.label,'" ').concat(regExpr," />")}else{return'<TextArea rows={8} placeholder="'.concat(col.label,'" ').concat(regExpr," />")}case"datetime":return'<Input type="datetime-local" '.concat(regExpr," />");case"string-datetime":return"<SQLDateTimeInput ".concat(regExpr," />");case"string-date":return"<SQLDateInput ".concat(regExpr," />");case"number-id":return'<input type="hidden" '.concat(regExpr," />");case"number-plain":return'<NumberInput placeholder="'.concat(col.label,'" ').concat(regExpr," />");case"boolean":return"<BooleanToggle ".concat(regExpr," />");case"string-image":return"<ImageUploader multiple={false} ".concat(regExpr," />");case"array-images":return"<ImageUploader multiple={true} ".concat(regExpr," maxSize={5} />");case"enums":try{var enumId;if(col.name==="orderBy"){enumId="".concat(names.capital).concat(_inflection.default.camelize(col.name),"Select")}else{var id=(0,_view_listtemplate.getEnumInfoFromColName)(entityId,col.name).id;enumId="".concat(id,"Select")}return"<".concat(enumId," ").concat(regExpr," ").concat(col.optional||col.nullable?"clearable":"",' textPrefix="" />')}catch(e){return"<>찾을 수 없는 Enum ".concat(col.name,"</>")}case"number-fk_id":try{var relProp=(0,_view_listtemplate.getRelationPropFromColName)(entityId,col.name.replace("_id",""));var fkId="".concat(relProp.with,"IdAsyncSelect");return"<".concat(fkId," {...register('").concat(col.name,"')} ").concat(col.optional||col.nullable?"clearable":"",' subset="A" />')}catch(e){return"<Input ".concat(regExpr," />")}case"array":return"<>".concat(col.name," array</>");case"object":return"<>".concat(col.name," object</>");default:throw new Error("대응 불가능한 렌더 타입 ".concat(col.renderType," on ").concat(col.name))}}},{key:"resolveDefaultValue",value:function resolveDefaultValue(columns){return columns.reduce(function(result,col){if(col.optional){return result}var value;if(col.nullable===true){value=null}else if(_instanceof(col.zodType,_zod.z.ZodNumber)){value=0}else if(_instanceof(col.zodType,_zod.z.ZodEnum)){value=Object.keys(col.zodType.options)[0]}else if(_instanceof(col.zodType,_zod.z.ZodBoolean)){value=false}else if(_instanceof(col.zodType,_zod.z.ZodDate)){value=new Date}else if(_instanceof(col.zodType,_zod.z.ZodString)){if(col.renderType==="string-datetime"){value="now()"}else{value=""}}else if(_instanceof(col.zodType,_zod.z.ZodArray)){value=[]}else if(_instanceof(col.zodType,_zod.z.ZodObject)){value={}}result[col.name]=value;return result},{})}},{key:"render",value:function render(param,saveParamsNode){var _this=this;var entityId=param.entityId;var entity=_entitymanager.EntityManager.get(entityId);var names=_entitymanager.EntityManager.getNamesFromId(entityId);var columns=saveParamsNode.children.filter(function(col){return col.name!=="id"}).map(function(col){var propCandidate=entity.props.find(function(prop){return prop.name===col.name});var _propCandidate_desc;col.label=(_propCandidate_desc=propCandidate===null||propCandidate===void 0?void 0:propCandidate.desc)!==null&&_propCandidate_desc!==void 0?_propCandidate_desc:col.label;return col});var defaultValue=this.resolveDefaultValue(columns);var preTemplates=columns.filter(function(col){if(col.name==="id"){return false}else if(col.name.endsWith("_id")||col.renderType==="number-id"){try{(0,_view_listtemplate.getRelationPropFromColName)(entityId,col.name.replace("_id",""));return true}catch(e){return false}}else if(col.renderType==="enums"){try{(0,_view_listtemplate.getEnumInfoFromColName)(entityId,col.name);return true}catch(e){return false}}return false}).map(function(col){var key;var targetMdId=entityId;var enumId;if(col.renderType==="enums"){key="view_enums_select";var _getEnumInfoFromColName=(0,_view_listtemplate.getEnumInfoFromColName)(entityId,col.name),targetMDNames=_getEnumInfoFromColName.targetEntityNames,id=_getEnumInfoFromColName.id;targetMdId=targetMDNames.capital;enumId=id}else{key="view_id_async_select";var relProp=(0,_view_listtemplate.getRelationPropFromColName)(entityId,col.name.replace("_id",""));targetMdId=relProp.with}return{key:key,options:{entityId:targetMdId,node:col,enumId:enumId}}}).filter(function(preTemplate){if(preTemplate.key==="view_id_async_select"){try{_entitymanager.EntityManager.get(preTemplate.options.entityId);return true}catch(e){return false}}return true});var _entity_title;return _object_spread_props(_object_spread({},this.getTargetAndPath(names)),{body:"\nimport React, { useEffect, useState, Dispatch, SetStateAction, forwardRef, Ref, useImperativeHandle, useCallback } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n Button,\n Checkbox,\n Form,\n Header,\n Input,\n Segment,\n TextArea,\n Label,\n} from 'semantic-ui-react';\nimport { DateTime } from \"luxon\";\n\nimport { BackLink, LinkInput, NumberInput, BooleanToggle, SQLDateTimeInput, SQLDateInput, useTypeForm, useGoBack, formatDateTime } from \"@sonamu-kit/react-sui\";\nimport { defaultCatch } from 'src/services/sonamu.shared';\n// import { ImageUploader } from 'src/admin-common/ImageUploader';\n// import { useCommonModal } from \"src/admin-common/CommonModal\";\n\nimport { ".concat(names.capital,"SaveParams } from 'src/services/").concat(names.fs,"/").concat(names.fs,".types';\nimport { ").concat(names.capital,"Service } from 'src/services/").concat(names.fs,"/").concat(names.fs,".service';\nimport { ").concat(names.capital,"SubsetA } from 'src/services/sonamu.generated';\n").concat(_lodash.default.uniq(columns.filter(function(col){return["number-fk_id","enums"].includes(col.renderType)}).map(function(col){return _this.renderColumnImport(entityId,col)})).join("\n"),"\n\nexport default function ").concat(names.capitalPlural,"FormPage() {\n // 라우팅 searchParams\n const [searchParams] = useSearchParams();\n const query = {\n id: searchParams.get('id') ?? undefined,\n };\n\n return <").concat(names.capitalPlural,"Form id={query?.id ? Number(query.id) : undefined} />;\n}\ntype ").concat(names.capitalPlural,"FormProps = {\n id?: number;\n mode?: 'page' | 'modal';\n};\nexport function ").concat(names.capitalPlural,"Form({ id, mode }: ").concat(names.capitalPlural,"FormProps) {\n // 편집시 기존 row\n const [row, setRow] = useState<").concat(names.capital,"SubsetA | undefined>();\n\n // ").concat(names.capital,"SaveParams 폼\n const { form, setForm, register } = useTypeForm(").concat(names.capital,"SaveParams, ").concat(JSON.stringify(defaultValue).replace(/"now\(\)"/g,"DateTime.local().toSQL()!.slice(0, 19)"),");\n\n // 수정일 때 기존 row 콜\n useEffect(() => {\n if (id) {\n ").concat(names.capital,"Service.get").concat(names.capital,"('A', id).then((row) => {\n setRow(row);\n setForm({\n ...row,\n ").concat(columns.filter(function(col){return col.renderType==="number-fk_id"}).map(function(col){if(col.nullable){return"".concat(col.name,": row.").concat(col.name.replace("_id","?.id")," ?? null")}else{return"".concat(col.name,": row.").concat(col.name.replace("_id",".id"))}}).join(",\n"),"\n });\n });\n }\n }, [id]);\n\n // CommonModal\n // const { doneModal, closeModal } = useCommonModal();\n\n // 저장\n const { goBack } = useGoBack();\n const handleSubmit = useCallback(() => {\n ").concat(names.capital,"Service.save([form]).then(([id]) => {\n if( mode === 'modal' ) {\n // doneModal();\n } else {\n goBack('/admin/").concat(names.fsPlural,"');\n }\n }).catch(defaultCatch);\n }, [ form, mode, id ]);\n\n // 페이지\n const PAGE = {\n title: `").concat((_entity_title=entity.title)!==null&&_entity_title!==void 0?_entity_title:names.capital,'${id ? `#${id} 수정` : \' 등록\'}`,\n }\n\n return (\n <div className="form">\n <Segment padded basic>\n <Segment padded color="grey">\n <div className="header-row">\n <Header>\n {PAGE.title}\n </Header>\n { mode !== \'modal\' && <div className="buttons">\n <BackLink primary size="tiny" to="/admin/').concat(names.fsPlural,'" content="목록" icon="list" />\n </div>}\n </div>\n <Form>\n ').concat(columns.map(function(col){if(col.name==="created_at"){return"{form.id && (".concat(_this.wrapFG('<div className="p-8px">{formatDateTime(form.'.concat(col.name,")}</div>"),"등록일시"),")}")}else{return _this.wrapFG(_this.renderColumn(entityId,col,names),function(){if(col.label.endsWith("Id")){try{var entity=_entitymanager.EntityManager.get(col.label.replace("Id",""));var _entity_title;return(_entity_title=entity.title)!==null&&_entity_title!==void 0?_entity_title:col.label}catch(e){return col.label}}return col.label}())}}).join("\n"),'\n <Segment basic textAlign="center">\n <Button type="submit" primary onClick={handleSubmit} content="저장" icon="save" />\n </Segment>\n </Form>\n </Segment>\n </Segment>\n </div>\n );\n};\n ').trim(),importKeys:[],preTemplates:preTemplates})}}]);return Template__view_form}(_basetemplate.Template);
|
|
2
|
-
//# sourceMappingURL=view_form.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/view_form.template.ts"],"sourcesContent":["import inflection from \"inflection\";\nimport { z } from \"zod\";\nimport { RenderingNode, TemplateKey, TemplateOptions } from \"../types/types\";\nimport { EntityManager, EntityNamesRecord } from \"../entity/entity-manager\";\nimport { RenderedTemplate } from \"../syncer/syncer\";\nimport { Template } from \"./base-template\";\nimport {\n getEnumInfoFromColName,\n getRelationPropFromColName,\n} from \"./view_list.template\";\nimport _ from \"lodash\";\n\nexport class Template__view_form extends Template {\n constructor() {\n super(\"view_form\");\n }\n\n getTargetAndPath(names: EntityNamesRecord) {\n return {\n target: \"web/src/pages/admin\",\n path: `${names.fsPlural}/form.tsx`,\n };\n }\n\n wrapFC(body: string, label?: string): string {\n return [\n `<Form.Field>${label ? `\\n <label>${label}</label>` : \"\"}`,\n body,\n `</Form.Field>`,\n ].join(\"\\n\");\n }\n wrapFG(body: string, label?: string): string {\n return [\n `<Form.Group widths=\"equal\">`,\n this.wrapFC(body, label),\n `</Form.Group>`,\n ].join(\"\\n\");\n }\n\n renderColumnImport(entityId: string, col: RenderingNode) {\n if (col.renderType === \"enums\") {\n const { id, targetEntityNames } = getEnumInfoFromColName(\n entityId,\n col.name\n );\n const componentId = `${id}Select`;\n return `import { ${componentId} } from \"src/components/${targetEntityNames.fs}/${componentId}\";`;\n } else if (col.renderType === \"number-fk_id\") {\n try {\n const relProp = getRelationPropFromColName(\n entityId,\n col.name.replace(\"_id\", \"\")\n );\n const targetNames = EntityManager.getNamesFromId(relProp.with);\n const componentId = `${relProp.with}IdAsyncSelect`;\n return `import { ${componentId} } from \"src/components/${targetNames.fs}/${componentId}\";`;\n } catch {\n return \"\";\n }\n } else {\n throw new Error(`렌더 불가능한 임포트 ${col.name} ${col.renderType}`);\n }\n }\n\n renderColumn(\n entityId: string,\n col: RenderingNode,\n names: EntityNamesRecord,\n parent: string = \"\"\n ): string {\n let regExpr: string = \"\";\n regExpr = `{...register(\\`${parent}${col.name}\\`)}`;\n\n switch (col.renderType) {\n case \"string-plain\":\n if (\n col.zodType instanceof z.ZodString &&\n (col.zodType.maxLength ?? 0) <= 512\n ) {\n return `<Input placeholder=\"${col.label}\" ${regExpr} />`;\n } else {\n return `<TextArea rows={8} placeholder=\"${col.label}\" ${regExpr} />`;\n }\n case \"datetime\":\n return `<Input type=\"datetime-local\" ${regExpr} />`;\n case \"string-datetime\":\n return `<SQLDateTimeInput ${regExpr} />`;\n case \"string-date\":\n return `<SQLDateInput ${regExpr} />`;\n case \"number-id\":\n return `<input type=\"hidden\" ${regExpr} />`;\n case \"number-plain\":\n return `<NumberInput placeholder=\"${col.label}\" ${regExpr} />`;\n case \"boolean\":\n return `<BooleanToggle ${regExpr} />`;\n case \"string-image\":\n return `<ImageUploader multiple={false} ${regExpr} />`;\n case \"array-images\":\n return `<ImageUploader multiple={true} ${regExpr} maxSize={5} />`;\n case \"enums\":\n try {\n let enumId: string;\n if (col.name === \"orderBy\") {\n enumId = `${names.capital}${inflection.camelize(col.name)}Select`;\n } else {\n const { id } = getEnumInfoFromColName(entityId, col.name);\n enumId = `${id}Select`;\n }\n return `<${enumId} ${regExpr} ${\n col.optional || col.nullable ? \"clearable\" : \"\"\n } textPrefix=\"\" />`;\n } catch {\n return `<>찾을 수 없는 Enum ${col.name}</>`;\n }\n case \"number-fk_id\":\n try {\n const relProp = getRelationPropFromColName(\n entityId,\n col.name.replace(\"_id\", \"\")\n );\n const fkId = `${relProp.with}IdAsyncSelect`;\n return `<${fkId} {...register('${col.name}')} ${\n col.optional || col.nullable ? \"clearable\" : \"\"\n } subset=\"A\" />`;\n } catch {\n return `<Input ${regExpr} />`;\n }\n case \"array\":\n return `<>${col.name} array</>`;\n case \"object\":\n return `<>${col.name} object</>`;\n default:\n throw new Error(\n `대응 불가능한 렌더 타입 ${col.renderType} on ${col.name}`\n );\n }\n }\n\n resolveDefaultValue(columns: RenderingNode[]): object {\n return columns.reduce(\n (result, col) => {\n if (col.optional) {\n return result;\n }\n\n let value: unknown;\n if (col.nullable === true) {\n value = null;\n } else if (col.zodType instanceof z.ZodNumber) {\n value = 0;\n } else if (col.zodType instanceof z.ZodEnum) {\n value = Object.keys(col.zodType.options)[0];\n } else if (col.zodType instanceof z.ZodBoolean) {\n value = false;\n } else if (col.zodType instanceof z.ZodDate) {\n value = new Date();\n } else if (col.zodType instanceof z.ZodString) {\n if (col.renderType === \"string-datetime\") {\n value = \"now()\";\n } else {\n value = \"\";\n }\n } else if (col.zodType instanceof z.ZodArray) {\n value = [];\n } else if (col.zodType instanceof z.ZodObject) {\n value = {};\n }\n\n result[col.name] = value;\n return result;\n },\n {} as { [key: string]: unknown }\n );\n }\n\n render(\n { entityId }: TemplateOptions[\"view_form\"],\n saveParamsNode: RenderingNode\n ) {\n const entity = EntityManager.get(entityId);\n const names = EntityManager.getNamesFromId(entityId);\n const columns = (saveParamsNode.children as RenderingNode[])\n .filter((col) => col.name !== \"id\")\n .map((col) => {\n const propCandidate = entity.props.find(\n (prop) => prop.name === col.name\n );\n col.label = propCandidate?.desc ?? col.label;\n return col;\n });\n\n const defaultValue = this.resolveDefaultValue(columns);\n\n // 프리 템플릿\n const preTemplates: RenderedTemplate[\"preTemplates\"] = (\n columns as RenderingNode[]\n )\n .filter((col) => {\n if (col.name === \"id\") {\n return false;\n } else if (col.name.endsWith(\"_id\") || col.renderType === \"number-id\") {\n try {\n getRelationPropFromColName(entityId, col.name.replace(\"_id\", \"\"));\n return true;\n } catch {\n return false;\n }\n } else if (col.renderType === \"enums\") {\n try {\n getEnumInfoFromColName(entityId, col.name);\n return true;\n } catch {\n return false;\n }\n }\n return false;\n })\n .map((col) => {\n let key: TemplateKey;\n let targetMdId = entityId;\n let enumId: string | undefined;\n if (col.renderType === \"enums\") {\n key = \"view_enums_select\";\n const { targetEntityNames: targetMDNames, id } =\n getEnumInfoFromColName(entityId, col.name);\n targetMdId = targetMDNames.capital;\n enumId = id;\n } else {\n key = \"view_id_async_select\";\n const relProp = getRelationPropFromColName(\n entityId,\n col.name.replace(\"_id\", \"\")\n );\n targetMdId = relProp.with;\n }\n\n return {\n key: key as TemplateKey,\n options: {\n entityId: targetMdId,\n node: col,\n enumId,\n },\n };\n })\n .filter((preTemplate) => {\n if (preTemplate.key === \"view_id_async_select\") {\n try {\n EntityManager.get(preTemplate.options.entityId);\n return true;\n } catch {\n return false;\n }\n }\n return true;\n });\n\n return {\n ...this.getTargetAndPath(names),\n body: `\nimport React, { useEffect, useState, Dispatch, SetStateAction, forwardRef, Ref, useImperativeHandle, useCallback } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n Button,\n Checkbox,\n Form,\n Header,\n Input,\n Segment,\n TextArea,\n Label,\n} from 'semantic-ui-react';\nimport { DateTime } from \"luxon\";\n\nimport { BackLink, LinkInput, NumberInput, BooleanToggle, SQLDateTimeInput, SQLDateInput, useTypeForm, useGoBack, formatDateTime } from \"@sonamu-kit/react-sui\";\nimport { defaultCatch } from 'src/services/sonamu.shared';\n// import { ImageUploader } from 'src/admin-common/ImageUploader';\n// import { useCommonModal } from \"src/admin-common/CommonModal\";\n\nimport { ${names.capital}SaveParams } from 'src/services/${names.fs}/${\n names.fs\n }.types';\nimport { ${names.capital}Service } from 'src/services/${names.fs}/${\n names.fs\n }.service';\nimport { ${names.capital}SubsetA } from 'src/services/sonamu.generated';\n${_.uniq(\n columns\n .filter((col) => [\"number-fk_id\", \"enums\"].includes(col.renderType))\n .map((col) => {\n return this.renderColumnImport(entityId, col);\n })\n).join(\"\\n\")}\n\nexport default function ${names.capitalPlural}FormPage() {\n // 라우팅 searchParams\n const [searchParams] = useSearchParams();\n const query = {\n id: searchParams.get('id') ?? undefined,\n };\n\n return <${\n names.capitalPlural\n }Form id={query?.id ? Number(query.id) : undefined} />;\n}\ntype ${names.capitalPlural}FormProps = {\n id?: number;\n mode?: 'page' | 'modal';\n};\nexport function ${names.capitalPlural}Form({ id, mode }: ${\n names.capitalPlural\n }FormProps) {\n // 편집시 기존 row\n const [row, setRow] = useState<${names.capital}SubsetA | undefined>();\n\n // ${names.capital}SaveParams 폼\n const { form, setForm, register } = useTypeForm(${\n names.capital\n }SaveParams, ${JSON.stringify(defaultValue).replace(\n /\"now\\(\\)\"/g,\n \"DateTime.local().toSQL()!.slice(0, 19)\"\n )});\n\n // 수정일 때 기존 row 콜\n useEffect(() => {\n if (id) {\n ${names.capital}Service.get${names.capital}('A', id).then((row) => {\n setRow(row);\n setForm({\n ...row,\n ${columns\n .filter((col) => col.renderType === \"number-fk_id\")\n .map((col) => {\n if (col.nullable) {\n return `${col.name}: row.${col.name.replace(\n \"_id\",\n \"?.id\"\n )} ?? null`;\n } else {\n return `${col.name}: row.${col.name.replace(\"_id\", \".id\")}`;\n }\n })\n .join(\",\\n\")}\n });\n });\n }\n }, [id]);\n\n // CommonModal\n // const { doneModal, closeModal } = useCommonModal();\n\n // 저장\n const { goBack } = useGoBack();\n const handleSubmit = useCallback(() => {\n ${names.capital}Service.save([form]).then(([id]) => {\n if( mode === 'modal' ) {\n // doneModal();\n } else {\n goBack('/admin/${names.fsPlural}');\n }\n }).catch(defaultCatch);\n }, [ form, mode, id ]);\n\n // 페이지\n const PAGE = {\n title: \\`${\n entity.title ?? names.capital\n }\\${id ? \\`#\\${id} 수정\\` : ' 등록'}\\`,\n }\n\n return (\n <div className=\"form\">\n <Segment padded basic>\n <Segment padded color=\"grey\">\n <div className=\"header-row\">\n <Header>\n {PAGE.title}\n </Header>\n { mode !== 'modal' && <div className=\"buttons\">\n <BackLink primary size=\"tiny\" to=\"/admin/${\n names.fsPlural\n }\" content=\"목록\" icon=\"list\" />\n </div>}\n </div>\n <Form>\n ${columns\n .map((col) => {\n if (col.name === \"created_at\") {\n return `{form.id && (${this.wrapFG(\n `<div className=\"p-8px\">{formatDateTime(form.${col.name})}</div>`,\n \"등록일시\"\n )})}`;\n } else {\n return this.wrapFG(\n this.renderColumn(entityId, col, names),\n (() => {\n if (col.label.endsWith(\"Id\")) {\n try {\n const entity = EntityManager.get(\n col.label.replace(\"Id\", \"\")\n );\n return entity.title ?? col.label;\n } catch {\n return col.label;\n }\n }\n return col.label;\n })()\n );\n }\n })\n .join(\"\\n\")}\n <Segment basic textAlign=\"center\">\n <Button type=\"submit\" primary onClick={handleSubmit} content=\"저장\" icon=\"save\" />\n </Segment>\n </Form>\n </Segment>\n </Segment>\n </div>\n );\n};\n `.trim(),\n importKeys: [],\n preTemplates,\n };\n }\n}\n"],"names":["Template__view_form","getTargetAndPath","names","target","path","fsPlural","wrapFC","body","label","join","wrapFG","renderColumnImport","entityId","col","renderType","getEnumInfoFromColName","name","id","targetEntityNames","componentId","fs","relProp","getRelationPropFromColName","replace","targetNames","EntityManager","getNamesFromId","with","Error","renderColumn","parent","regExpr","zodType","z","ZodString","maxLength","enumId","inflection","capital","camelize","optional","nullable","fkId","resolveDefaultValue","columns","reduce","result","value","ZodNumber","ZodEnum","Object","keys","options","ZodBoolean","ZodDate","Date","ZodArray","ZodObject","render","saveParamsNode","entity","get","children","filter","map","propCandidate","props","find","prop","desc","defaultValue","preTemplates","endsWith","key","targetMdId","targetMDNames","node","preTemplate","_","uniq","includes","capitalPlural","JSON","stringify","title","trim","importKeys","Template"],"mappings":"oGAYaA,6DAAAA,qFAZU,gCACL,kCAE+B,sDAExB,kDAIlB,kFACO,yrHAEP,IAAA,AAAMA,iCAAN,0CAAMA,uCAAAA,6CAAAA,qBAET,OAAA,iBAFSA,qBAEH,4BAFGA,sBAKXC,IAAAA,yBAAAA,SAAAA,iBAAiBC,KAAwB,EACvC,MAAO,CACLC,OAAQ,sBACRC,KAAM,AAAC,GAAiB,OAAfF,MAAMG,QAAQ,CAAC,YAC1B,CACF,IAEAC,IAAAA,eAAAA,SAAAA,OAAOC,I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aAAAA,cAEJ,YA7ZWvE,qBAA4BuF,sBAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view_id_all_select.template.d.ts","sourceRoot":"","sources":["../../src/templates/view_id_all_select.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAiB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,qBAAa,4BAA6B,SAAQ,QAAQ;;IAKxD,gBAAgB,CAAC,KAAK,EAAE,iBAAiB;;;;IAOzC,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,eAAe,CAAC,oBAAoB,CAAC;;;;;;CAiB3D"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Template__view_id_all_select",{enumerable:true,get:function(){return Template__view_id_all_select}});var _entitymanager=require("../entity/entity-manager");var _basetemplate=require("./base-template");function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__view_id_all_select=/*#__PURE__*/function(Template){"use strict";_inherits(Template__view_id_all_select,Template);function Template__view_id_all_select(){_class_call_check(this,Template__view_id_all_select);return _call_super(this,Template__view_id_all_select,["view_id_all_select"])}_create_class(Template__view_id_all_select,[{key:"getTargetAndPath",value:function getTargetAndPath(names){return{target:"web/src/components",path:"".concat(names.fs,"/").concat(names.capital,"IdAllSelect.tsx")}}},{key:"render",value:function render(param){var entityId=param.entityId;var names=_entitymanager.EntityManager.getNamesFromId(entityId);return _object_spread_props(_object_spread({},this.getTargetAndPath(names)),{body:"\n/*\nview_id_all_select\n".concat(JSON.stringify({key:this.key,options:entityId}),"\n*/\n ").trim(),importKeys:[]})}}]);return Template__view_id_all_select}(_basetemplate.Template);
|
|
2
|
-
//# sourceMappingURL=view_id_all_select.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/view_id_all_select.template.ts"],"sourcesContent":["import { TemplateOptions } from \"../types/types\";\nimport { EntityManager, EntityNamesRecord } from \"../entity/entity-manager\";\nimport { Template } from \"./base-template\";\n\nexport class Template__view_id_all_select extends Template {\n constructor() {\n super(\"view_id_all_select\");\n }\n\n getTargetAndPath(names: EntityNamesRecord) {\n return {\n target: \"web/src/components\",\n path: `${names.fs}/${names.capital}IdAllSelect.tsx`,\n };\n }\n\n render({ entityId }: TemplateOptions[\"view_id_all_select\"]) {\n const names = EntityManager.getNamesFromId(entityId);\n\n return {\n ...this.getTargetAndPath(names),\n body: `\n/*\nview_id_all_select\n${JSON.stringify({\n key: this.key,\n options: entityId,\n})}\n*/\n `.trim(),\n importKeys: [],\n };\n }\n}\n"],"names":["Template__view_id_all_select","getTargetAndPath","names","target","path","fs","capital","render","entityId","EntityManager","getNamesFromId","body","JSON","stringify","key","options","trim","importKeys","Template"],"mappings":"oGAIaA,sEAAAA,2DAHoC,sDACxB,y7GAElB,IAAA,AAAMA,0CAAN,0CAAMA,gDAAAA,sDAAAA,8BAET,OAAA,iBAFSA,8BAEH,qCAFGA,+BAKXC,IAAAA,yBAAAA,SAAAA,iBAAiBC,KAAwB,EACvC,MAAO,CACLC,OAAQ,qBACRC,KAAM,AAAC,GAAcF,OAAZA,MAAMG,EAAE,CAAC,KAAiB,OAAdH,MAAMI,OAAO,CAAC,kBACrC,CACF,IAEAC,IAAAA,eAAAA,SAAAA,OAAO,KAAmD,MAAnD,AAAEC,SAAF,MAAEA,SACP,IAAMN,MAAQO,4BAAa,CAACC,cAAc,CAACF,UAE3C,OAAO,uCACF,IAAI,CAACP,gBAAgB,CAACC,SACzBS,KAAM,AAAC,6BAMV,OAHDC,KAAKC,SAAS,CAAC,CACfC,IAAK,IAAI,CAACA,GAAG,CACbC,QAASP,QACX,GAAG,gBAEKQ,IAAI,GACNC,WAAY,EAAE,EAElB,YA5BWjB,8BAAqCkB,sBAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view_id_async_select.template.d.ts","sourceRoot":"","sources":["../../src/templates/view_id_async_select.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAiB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,qBAAa,8BAA+B,SAAQ,QAAQ;;IAK1D,gBAAgB,CAAC,KAAK,EAAE,iBAAiB;;;;IAOzC,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,eAAe,CAAC,sBAAsB,CAAC;;;;;;CAyGxE"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Template__view_id_async_select",{enumerable:true,get:function(){return Template__view_id_async_select}});var _entitymanager=require("../entity/entity-manager");var _basetemplate=require("./base-template");function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__view_id_async_select=/*#__PURE__*/function(Template){"use strict";_inherits(Template__view_id_async_select,Template);function Template__view_id_async_select(){_class_call_check(this,Template__view_id_async_select);return _call_super(this,Template__view_id_async_select,["view_id_async_select"])}_create_class(Template__view_id_async_select,[{key:"getTargetAndPath",value:function getTargetAndPath(names){return{target:"web/src/components",path:"".concat(names.fs,"/").concat(names.capital,"IdAsyncSelect.tsx")}}},{key:"render",value:function render(param){var entityId=param.entityId,textField=param.textField;var names=_entitymanager.EntityManager.getNamesFromId(entityId);var entity=_entitymanager.EntityManager.get(entityId);if(!textField){var pickedProp=entity.props.find(function(prop){return["name","title"].includes(prop.name)});if(pickedProp){textField=pickedProp.name}else{var candidateProp=entity.props.find(function(prop){return prop.type==="string"});if(candidateProp){textField=candidateProp.name}else{console.log("textField 찾을 수 없음")}}}var _entity_title;return _object_spread_props(_object_spread({},this.getTargetAndPath(names)),{body:'\nimport React, { useState, useEffect, SyntheticEvent } from "react";\nimport { DropdownProps, DropdownItemProps, DropdownOnSearchChangeData, Dropdown } from "semantic-ui-react";\nimport { '.concat(names.capital,"SubsetKey, ").concat(names.capital,'SubsetMapping } from "src/services/sonamu.generated";\nimport { ').concat(names.capital,'Service } from "src/services/').concat(names.fs,"/").concat(names.fs,'.service";\nimport { ').concat(names.capital,'ListParams } from "src/services/').concat(names.fs,"/").concat(names.fs,'.types";\n\nexport function ').concat(names.capital,"IdAsyncSelect<T extends ").concat(names.capital,"SubsetKey>(\n { subset, baseListParams, textField, valueField, ...props }: DropdownProps & {\n subset: T;\n baseListParams?: ").concat(names.capital,"ListParams;\n textField").concat(textField?"?":"",": keyof ").concat(names.capital,"SubsetMapping[T];\n valueField?: keyof ").concat(names.capital,"SubsetMapping[T];\n },\n) {\n const [options, setOptions] = useState<DropdownItemProps[]>([]);\n const [listParams, setListParams] = useState<").concat(names.capital,"ListParams>(\n baseListParams ?? {},\n );\n\n const { data, error } = ").concat(names.capital,"Service.use").concat(names.capitalPlural,"(subset, listParams);\n const { rows: ").concat(names.camelPlural,", total } = data ?? {};\n\n useEffect(() => {\n setOptions(\n (").concat(names.camelPlural," ?? []).map((").concat(names.camel,") => {\n return {\n key: ").concat(names.camel,".id,\n value: ").concat(names.camel,"[valueField ?? 'id'] as string | number,\n text: String(").concat(names.camel,"[textField").concat(textField?" ?? '".concat(textField,"'"):"","]),\n };\n }),\n );\n }, [").concat(names.camelPlural,']);\n\n useEffect(() => {\n setListParams({\n ...listParams,\n ...baseListParams,\n });\n }, [baseListParams]);\n\n const handleSearchChange = (\n e: SyntheticEvent<HTMLElement, Event>,\n data: DropdownOnSearchChangeData,\n ) => {\n setListParams({\n ...listParams,\n keyword: data.searchQuery,\n });\n };\n\n return (\n <Dropdown\n placeholder="').concat((_entity_title=entity.title)!==null&&_entity_title!==void 0?_entity_title:names.constant,'"\n selection\n options={options}\n onSearchChange={handleSearchChange}\n disabled={!').concat(names.camelPlural,"}\n loading={!").concat(names.camelPlural,"}\n selectOnBlur={false}\n {...props}\n />\n );\n}\n ").trim(),importKeys:[]})}}]);return Template__view_id_async_select}(_basetemplate.Template);
|
|
2
|
-
//# sourceMappingURL=view_id_async_select.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/templates/view_id_async_select.template.ts"],"sourcesContent":["import { TemplateOptions } from \"../types/types\";\nimport { EntityManager, EntityNamesRecord } from \"../entity/entity-manager\";\nimport { Template } from \"./base-template\";\n\nexport class Template__view_id_async_select extends Template {\n constructor() {\n super(\"view_id_async_select\");\n }\n\n getTargetAndPath(names: EntityNamesRecord) {\n return {\n target: \"web/src/components\",\n path: `${names.fs}/${names.capital}IdAsyncSelect.tsx`,\n };\n }\n\n render({ entityId, textField }: TemplateOptions[\"view_id_async_select\"]) {\n const names = EntityManager.getNamesFromId(entityId);\n\n const entity = EntityManager.get(entityId);\n if (!textField) {\n const pickedProp = entity.props.find((prop) =>\n [\"name\", \"title\"].includes(prop.name)\n );\n if (pickedProp) {\n textField = pickedProp.name;\n } else {\n const candidateProp = entity.props.find(\n (prop) => prop.type === \"string\"\n );\n if (candidateProp) {\n textField = candidateProp.name;\n } else {\n console.log(\"textField 찾을 수 없음\");\n }\n }\n }\n\n return {\n ...this.getTargetAndPath(names),\n body: `\nimport React, { useState, useEffect, SyntheticEvent } from \"react\";\nimport { DropdownProps, DropdownItemProps, DropdownOnSearchChangeData, Dropdown } from \"semantic-ui-react\";\nimport { ${names.capital}SubsetKey, ${\n names.capital\n }SubsetMapping } from \"src/services/sonamu.generated\";\nimport { ${names.capital}Service } from \"src/services/${names.fs}/${\n names.fs\n }.service\";\nimport { ${names.capital}ListParams } from \"src/services/${names.fs}/${\n names.fs\n }.types\";\n\nexport function ${names.capital}IdAsyncSelect<T extends ${\n names.capital\n }SubsetKey>(\n { subset, baseListParams, textField, valueField, ...props }: DropdownProps & {\n subset: T;\n baseListParams?: ${names.capital}ListParams;\n textField${textField ? \"?\" : \"\"}: keyof ${names.capital}SubsetMapping[T];\n valueField?: keyof ${names.capital}SubsetMapping[T];\n },\n) {\n const [options, setOptions] = useState<DropdownItemProps[]>([]);\n const [listParams, setListParams] = useState<${names.capital}ListParams>(\n baseListParams ?? {},\n );\n\n const { data, error } = ${names.capital}Service.use${\n names.capitalPlural\n }(subset, listParams);\n const { rows: ${names.camelPlural}, total } = data ?? {};\n\n useEffect(() => {\n setOptions(\n (${names.camelPlural} ?? []).map((${names.camel}) => {\n return {\n key: ${names.camel}.id,\n value: ${names.camel}[valueField ?? 'id'] as string | number,\n text: String(${names.camel}[textField${\n textField ? ` ?? '${textField}'` : \"\"\n }]),\n };\n }),\n );\n }, [${names.camelPlural}]);\n\n useEffect(() => {\n setListParams({\n ...listParams,\n ...baseListParams,\n });\n }, [baseListParams]);\n\n const handleSearchChange = (\n e: SyntheticEvent<HTMLElement, Event>,\n data: DropdownOnSearchChangeData,\n ) => {\n setListParams({\n ...listParams,\n keyword: data.searchQuery,\n });\n };\n\n return (\n <Dropdown\n placeholder=\"${entity.title ?? names.constant}\"\n selection\n options={options}\n onSearchChange={handleSearchChange}\n disabled={!${names.camelPlural}}\n loading={!${names.camelPlural}}\n selectOnBlur={false}\n {...props}\n />\n );\n}\n `.trim(),\n importKeys: [],\n };\n }\n}\n"],"names":["Template__view_id_async_select","getTargetAndPath","names","target","path","fs","capital","render","entityId","textField","EntityManager","getNamesFromId","entity","get","pickedProp","props","find","prop","includes","name","candidateProp","type","console","log","body","capitalPlural","camelPlural","camel","title","constant","trim","importKeys","Template"],"mappings":"oGAIaA,wEAAAA,6DAHoC,sDACxB,y7GAElB,IAAA,AAAMA,4CAAN,0CAAMA,kDAAAA,wDAAAA,gCAET,OAAA,iBAFSA,gCAEH,uCAFGA,iCAKXC,IAAAA,yBAAAA,SAAAA,iBAAiBC,KAAwB,EACvC,MAAO,CACLC,OAAQ,qBACRC,KAAM,AAAC,GAAcF,OAAZA,MAAMG,EAAE,CAAC,KAAiB,OAAdH,MAAMI,OAAO,CAAC,oBACrC,CACF,IAEAC,IAAAA,eAAAA,SAAAA,OAAO,KAAgE,MAA9DC,SAAF,MAAEA,SAAUC,UAAZ,MAAYA,UACjB,IAAMP,MAAQQ,4BAAa,CAACC,cAAc,CAACH,UAE3C,IAAMI,OAASF,4BAAa,CAACG,GAAG,CAACL,UACjC,GAAI,CAACC,UAAW,CACd,IAAMK,WAAaF,OA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,KAAK,EAAE,iBAAiB;IAuC1B,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB;IAyC3E,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG;QACpC,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB;IAkBD,MAAM,CACJ,EAAE,QAAQ,EAAE,EAAE,eAAe,CAAC,WAAW,CAAC,EAC1C,WAAW,EAAE,aAAa,EAC1B,cAAc,EAAE,aAAa;;;;;;;;;;CAuUhC;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd;IACD,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CA0BA;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,YAAY,CAYd"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get Template__view_list(){return Template__view_list},get getEnumInfoFromColName(){return getEnumInfoFromColName},get getRelationPropFromColName(){return getRelationPropFromColName}});var _inflection=/*#__PURE__*/_interop_require_default(require("inflection"));var _lodash=/*#__PURE__*/_interop_require_default(require("lodash"));var _zod=require("zod");var _entitymanager=require("../entity/entity-manager");var _types=require("../types/types");var _basetemplate=require("./base-template");function _assert_this_initialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _call_super(_this,derived,args){derived=_get_prototype_of(derived);return _possible_constructor_return(_this,_is_native_reflect_construct()?Reflect.construct(derived,args||[],_get_prototype_of(_this).constructor):derived.apply(_this,args))}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _get_prototype_of(o){_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _get_prototype_of(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_set_prototype_of(subClass,superClass)}function _instanceof(left,right){if(right!=null&&typeof Symbol!=="undefined"&&right[Symbol.hasInstance]){return!!right[Symbol.hasInstance](left)}else{return left instanceof right}}function _interop_require_default(obj){return obj&&obj.__esModule?obj:{default:obj}}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _possible_constructor_return(self,call){if(call&&(_type_of(call)==="object"||typeof call==="function")){return call}return _assert_this_initialized(self)}function _set_prototype_of(o,p){_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){o.__proto__=p;return o};return _set_prototype_of(o,p)}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(_){}return(_is_native_reflect_construct=function(){return!!result})()}var Template__view_list=/*#__PURE__*/function(Template){"use strict";_inherits(Template__view_list,Template);function Template__view_list(){_class_call_check(this,Template__view_list);return _call_super(this,Template__view_list,["view_list"])}_create_class(Template__view_list,[{key:"getTargetAndPath",value:function getTargetAndPath(names){return{target:"web/src/pages/admin",path:"".concat(names.fsPlural,"/index.tsx")}}},{key:"wrapTc",value:function wrapTc(body,key){var collapsing=arguments.length>2&&arguments[2]!==void 0?arguments[2]:true,className=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";return'<Table.Cell key="'.concat(key,'"').concat(collapsing?" collapsing":"").concat(className?" className={`".concat(className,"`}"):"",">").concat(body,"</Table.Cell>")}},{key:"renderColumn",value:function renderColumn(entityId,col,names){var parentObj=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"row",withoutName=arguments.length>4&&arguments[4]!==void 0?arguments[4]:false;var colName=withoutName?"".concat(parentObj):"".concat(parentObj,".").concat(col.name);switch(col.renderType){case"string-plain":case"string-date":case"number-id":return"<>{".concat(colName,"}</>");case"number-fk_id":var relPropFk=getRelationPropFromColName(entityId,col.name.replace("_id",""));return"<>".concat(relPropFk.with,"#{").concat(colName,"}</>");case"string-image":return"<>{".concat(col.nullable?"".concat(colName," && "):"","<img src={").concat(colName,"} />}</>");case"datetime":if(col.nullable){return'<span className="text-tiny">{'.concat(colName," === null ? '-' : formatDateTime(").concat(colName,")}</span>")}else{return'<span className="text-tiny">{formatDateTime('.concat(colName,")}</span>")}case"string-datetime":if(col.nullable){return'<span className="text-tiny">{'.concat(colName," === null ? '-' : dateF(").concat(colName,")}</span>")}else{return'<span className="text-tiny">{dateF('.concat(colName,")}</span>")}case"boolean":return"<>{".concat(colName," ? <Label color='green' circular>O</Label> : <Label color='grey' circular>X</Label> }</>");case"enums":var _getEnumInfoFromColName=getEnumInfoFromColName(entityId,col.name),enumId=_getEnumInfoFromColName.id;return"<>{".concat(col.nullable?"".concat(colName," && "):"").concat(enumId,"Label[").concat(colName,"]}</>");case"array-images":return"<>{ ".concat(colName,".map(r => ").concat(col.nullable?"r && ":"","<img src={r} />) }</>");case"number-plain":return"<>{".concat(col.nullable?"".concat(colName," && "):"","numF(").concat(colName,")}</>");case"object":return"<>{/* object ".concat(colName," */}</>");case"object-pick":var pickedChild=col.children.find(function(child){var _col_config;return child.name===((_col_config=col.config)===null||_col_config===void 0?void 0:_col_config.picked)});if(!pickedChild){throw new Error("object-pick 선택 실패 (오브젝트: ".concat(col.name,")"))}return this.renderColumn(entityId,pickedChild,names,"".concat(colName).concat(col.nullable?"?":""));case"array":return"<>{ /* array ".concat(colName," */ }</>");default:throw new Error("렌더 불가 컬럼 ".concat(col.renderType))}}},{key:"renderColumnImport",value:function renderColumnImport(entityId,col,names){var _this=this;if(col.renderType==="enums"){var _getEnumInfoFromColName=getEnumInfoFromColName(names.capital,col.name),enumId=_getEnumInfoFromColName.id;return["import { ".concat(enumId,"Label } from 'src/services/sonamu.generated';")]}else if(col.renderType==="object"){try{var relProp=getRelationPropFromColName(entityId,col.name);var result=col.children.map(function(child){entityId=relProp.with;names=_entitymanager.EntityManager.getNamesFromId(relProp.with);return _this.renderColumnImport(entityId,child,names)});return _lodash.default.flattenDeep(result)}catch(e){return[null]}}else if(col.renderType==="array"){return this.renderColumnImport(entityId,col.element,names)}return[null]}},{key:"renderFilterImport",value:function renderFilterImport(entityId,col,names){if(col.name==="search"){return"import { ".concat(names.capital,'SearchInput } from "src/components/').concat(names.fs,"/").concat(names.capital,'SearchInput";')}else if(col.renderType==="enums"){if(col.name==="orderBy"){var componentId="".concat(names.capital).concat(_inflection.default.camelize(col.name),"Select");return"import { ".concat(componentId,' } from "src/components/').concat(names.fs,"/").concat(componentId,'";')}else{try{var _getEnumInfoFromColName=getEnumInfoFromColName(entityId,col.name),id=_getEnumInfoFromColName.id,targetMDNames=_getEnumInfoFromColName.targetEntityNames;var componentId1="".concat(id,"Select");return"import { ".concat(componentId1,' } from "src/components/').concat(targetMDNames.fs,"/").concat(componentId1,'";')}catch(e){return""}}}else if(col.renderType==="number-fk_id"){try{var relProp=getRelationPropFromColName(entityId,col.name.replace("_id",""));var targetNames=_entitymanager.EntityManager.getNamesFromId(relProp.with);var componentId2="".concat(relProp.with,"IdAsyncSelect");return"import { ".concat(componentId2,' } from "src/components/').concat(targetNames.fs,"/").concat(componentId2,'";')}catch(e){return""}}else{throw new Error("렌더 불가능한 필터 임포트 ".concat(col.name," ").concat(col.renderType))}}},{key:"renderFilter",value:function renderFilter(entityId,col,names){if(col.name==="search"){return""}var isClearable=col.optional===true&&col.name!=="orderBy";var componentId;if(col.renderType==="enums"){if(col.name==="orderBy"){componentId="".concat(names.capital).concat(_inflection.default.camelize(col.name),"Select")}else{try{var id=getEnumInfoFromColName(entityId,col.name).id;componentId="".concat(id,"Select")}catch(e){return""}}return"<".concat(componentId," {...register('").concat(col.name,"')} ").concat(isClearable?"clearable":""," />")}else if(col.renderType==="number-fk_id"){try{var relProp=getRelationPropFromColName(entityId,col.name.replace("_id",""));componentId="".concat(relProp.with,"IdAsyncSelect");return"<".concat(componentId," {...register('").concat(col.name,"')} ").concat(isClearable?"clearable":"",' subset="A" />')}catch(e){return""}}else{throw new Error("렌더 불가능한 필터 임포트 ".concat(col.name," ").concat(col.renderType))}}},{key:"getDefault",value:function getDefault(columns){var _columns_find,_columns_find1;var def={orderBy:"id-desc",search:"title"};var orderByZodType=(_columns_find=columns.find(function(col){return col.name==="orderBy"}))===null||_columns_find===void 0?void 0:_columns_find.zodType;if(orderByZodType&&_instanceof(orderByZodType,_zod.z.ZodEnum)){def.orderBy=orderByZodType.options[0].toString()}var searchZodType=(_columns_find1=columns.find(function(col){return col.name==="search"}))===null||_columns_find1===void 0?void 0:_columns_find1.zodType;if(searchZodType&&_instanceof(searchZodType,_zod.z.ZodEnum)){def.search=searchZodType.options[0].toString()}return def}},{key:"render",value:function render(param,columnsNode,listParamsNode){var _this=this;var entityId=param.entityId;var names=_entitymanager.EntityManager.getNamesFromId(entityId);var entity=_entitymanager.EntityManager.get(entityId);var columns=columnsNode.children.filter(function(col){return col.name!=="id"}).map(function(col){var propCandidate=entity.props.find(function(p){return p.name===col.name});var _propCandidate_desc;return{name:col.name,label:(_propCandidate_desc=propCandidate===null||propCandidate===void 0?void 0:propCandidate.desc)!==null&&_propCandidate_desc!==void 0?_propCandidate_desc:col.label,tc:"(row) => ".concat(_this.renderColumn(entityId,col,names))}});var filterColumns=listParamsNode.children.filter(function(col){return col.name!=="id"&&col.name!=="queryMode"&&(["enums","number-id"].includes(col.renderType)||col.name.endsWith("_id"))}).sort(function(a){return a.name=="orderBy"?1:-1});var preTemplates=[];var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=filterColumns[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var col=_step.value;var key=void 0;var targetEntityId=entityId;var enumId=void 0;if(col.renderType==="enums"){if(col.name==="search"){key="view_enums_dropdown";enumId="".concat(names.capital,"SearchField");targetEntityId=names.capital}else{key="view_enums_select";try{var _getEnumInfoFromColName=getEnumInfoFromColName(entityId,col.name),targetEntityNames=_getEnumInfoFromColName.targetEntityNames,id=_getEnumInfoFromColName.id;targetEntityId=targetEntityNames.capital;enumId=id}catch(e){continue}}}else{key="view_id_async_select";try{var relProp=getRelationPropFromColName(entityId,col.name.replace("_id",""));targetEntityId=relProp.with}catch(e){continue}}preTemplates.push({key:key,options:{entityId:targetEntityId,enumId:enumId}})}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}var columnImports=_lodash.default.uniq(columnsNode.children.map(function(col){return _this.renderColumnImport(entityId,col,names)}).flat().filter(function(col){return col!==null})).join("\n");preTemplates.push({key:"view_search_input",options:{entityId:entityId}});var def=this.getDefault(filterColumns);var _entity_title;return _object_spread_props(_object_spread({},this.getTargetAndPath(names)),{body:"\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport {\n Breadcrumb,\n Checkbox,\n Pagination,\n Segment,\n Table,\n TableRow,\n Message,\n Transition,\n Button,\n Label,\n} from 'semantic-ui-react';\nimport classNames from 'classnames';\nimport { DateTime } from \"luxon\";\nimport { DelButton, EditButton, AppBreadcrumbs, AddButton, useSelection, useListParams, SonamuCol, numF, formatDate, formatDateTime } from '@sonamu-kit/react-sui';\n\nimport { ".concat(names.capital,'SubsetA } from "src/services/sonamu.generated";\nimport { ').concat(names.capital,"Service } from 'src/services/").concat(names.fs,"/").concat(names.fs,".service';\nimport { ").concat(names.capital,"ListParams } from 'src/services/").concat(names.fs,"/").concat(names.fs,".types';\n").concat(columnImports,"\n").concat(filterColumns.map(function(col){return _this.renderFilterImport(entityId,col,names)}).join("\n"),"\n\ntype ").concat(names.capital,"ListProps = {};\nexport default function ").concat(names.capital,"List({}: ").concat(names.capital,"ListProps) {\n // 리스트 필터\n const { listParams, register } = useListParams(").concat(names.capital,"ListParams, {\n num: 12,\n page: 1,\n orderBy: '").concat(def.orderBy,"',\n search: '").concat(def.search,"',\n });\n\n // 리스트 쿼리\n const { data, mutate, error, isLoading } = ").concat(names.capital,"Service.use").concat(names.capitalPlural,"('A', listParams);\n const { rows, total } = data ?? {};\n\n // 삭제\n const confirmDel = (ids: number[]) => {\n const answer = confirm('삭제하시겠습니까?');\n if (!answer) {\n return;\n }\n\n ").concat(names.capital,"Service.del(ids).then(() => {\n mutate();\n });\n };\n\n // 일괄 삭제\n const confirmDelSelected = () => {\n const answer = confirm(`${selectedKeys.length}건을 일괄 삭제하시겠습니까?`);\n if (!answer) {\n return;\n }\n\n ").concat(names.capital,"Service.del(selectedKeys).then(() => {\n mutate();\n });\n };\n\n // 현재 경로와 타이틀\n const PAGE = {\n route: '/admin/").concat(names.fsPlural,"',\n title: '").concat((_entity_title=entity.title)!==null&&_entity_title!==void 0?_entity_title:names.capital,"',\n };\n\n // 선택\n const {\n getSelected,\n isAllSelected,\n selectedKeys,\n toggle,\n selectAll,\n deselectAll,\n handleCheckboxClick,\n } = useSelection((rows ?? []).map((row) => row.id));\n\n // 컬럼\n const columns:SonamuCol<").concat(names.capital,"SubsetA>[] = [").concat(columns.map(function(col){return['{ label: "'.concat(col.label,'",'),"tc: ".concat(col.tc,", "),"collapsing: ".concat(["Title","Name"].includes(col.label)===false,", }")].join("\n")}).join(",\n"),'];\n\n return (\n <div className="list ').concat(names.fsPlural,'-index">\n <div className="top-nav">\n <div className="header-row">\n <div className="header">{PAGE.title}</div>\n <AppBreadcrumbs>\n <Breadcrumb.Section active>{PAGE.title}</Breadcrumb.Section>\n </AppBreadcrumbs>\n <').concat(names.capital,"SearchInput\n input={register('keyword')}\n dropdown={register('search')}\n />\n </div>\n <div className=\"filters-row\">\n ").concat(filterColumns.map(function(col){return _this.renderFilter(entityId,col,names)}).join(" \n"),'\n </div>\n </div>\n\n <Segment basic padded className="contents-segment" loading={isLoading}>\n <div className="buttons-row">\n <div className={classNames(\'count\', { hidden: isLoading })}>\n {total} 건\n </div>\n <div className="buttons">\n <AddButton currentRoute={PAGE.route} icon="write" label="추가" />\n </div>\n </div>\n\n <Table\n celled\n compact\n selectable\n className={classNames({ hidden: total === undefined || total === 0 })}\n >\n <Table.Header>\n <TableRow>\n <Table.HeaderCell collapsing>\n <Checkbox\n label="ID"\n checked={isAllSelected}\n onChange={isAllSelected ? deselectAll : selectAll}\n />\n </Table.HeaderCell>\n {\n /* Header */\n columns.map((col, index) => col.th ?? <Table.HeaderCell key={index} collapsing={col.collapsing}>{ col.label }</Table.HeaderCell>)\n }\n <Table.HeaderCell>관리</Table.HeaderCell>\n </TableRow>\n </Table.Header>\n <Table.Body>\n {rows &&\n rows.map((row, rowIndex) => (\n <Table.Row key={row.id}>\n <Table.Cell>\n <Checkbox\n label={row.id}\n checked={getSelected(row.id)}\n onChange={() => toggle(row.id)}\n onClick={(e) =>\n handleCheckboxClick(e, rowIndex)\n }\n />\n </Table.Cell>\n {\n /* Body */\n columns.map((col, colIndex) => (\n <Table.Cell key={colIndex} collapsing={col.collapsing} className={col.className}>\n {col.tc(row, rowIndex)}\n </Table.Cell>\n ))\n }\n <Table.Cell collapsing>\n <EditButton\n as={Link}\n to={`${PAGE.route}/form?id=${row.id}`}\n state={{ from: PAGE.route }}\n />\n <DelButton onClick={() => confirmDel([row.id])} />\n </Table.Cell>\n </Table.Row>\n ))}\n </Table.Body>\n </Table>\n <div\n className={classNames(\'pagination-row\', {\n hidden: (total ?? 0) === 0,\n })}\n >\n <Pagination\n totalPages={Math.ceil((total ?? 0) / (listParams.num ?? 24))}\n {...register(\'page\')}\n />\n </div>\n </Segment>\n\n <div className="fixed-menu">\n <Transition\n visible={selectedKeys.length > 0}\n animation="slide left"\n duration={500}\n >\n <Message size="small" color="violet" className="text-center">\n <span className="px-4">{selectedKeys.length}개 선택됨</span>\n <Button size="tiny" color="violet" onClick={() => deselectAll()}>\n 선택 해제\n </Button>\n <Button size="tiny" color="red" onClick={confirmDelSelected}>\n 일괄 삭제\n </Button>\n </Message>\n </Transition>\n </div>\n </div>\n );\n}\n ').trim(),importKeys:[],preTemplates:preTemplates})}}]);return Template__view_list}(_basetemplate.Template);function getEnumInfoFromColName(entityId,colName){var baseEntity=_entitymanager.EntityManager.get(entityId);var prop=baseEntity.props.find(function(p){return p.name===colName});if(prop&&(0,_types.isEnumProp)(prop)){var _prop_desc;return{id:prop.id,targetEntityId:entityId,targetEntityNames:_entitymanager.EntityManager.getNamesFromId(entityId),title:(_prop_desc=prop.desc)!==null&&_prop_desc!==void 0?_prop_desc:prop.id}}else{var idCandidate=_inflection.default.camelize(_inflection.default.underscore(entityId)+"_"+_inflection.default.underscore(colName),false);try{var targetEntityNames=_entitymanager.EntityManager.getNamesFromId(entityId);return{id:idCandidate,targetEntityId:entityId,targetEntityNames:targetEntityNames,title:idCandidate}}catch(e){}throw new Error("찾을 수 없는 EnumProp ".concat(colName))}}function getRelationPropFromColName(entityId,colName){var baseEntity=_entitymanager.EntityManager.get(entityId);var relProp=baseEntity.props.find(function(prop){return prop.name===colName});if((0,_types.isRelationProp)(relProp)){var relEntity=_entitymanager.EntityManager.get(relProp.with);if(relEntity.parentId!==undefined){throw new Error("Only parent entities can be used as relation props")}return relProp}else{throw new Error("찾을 수 없는 Relation ".concat(colName))}}
|
|
2
|
-
//# sourceMappingURL=view_list.template.js.map
|