@goast/kotlin 0.4.13 → 0.4.14-beta1
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/LICENSE +21 -21
- package/README.md +45 -45
- package/assets/client/okhttp3/ApiClient.kt +252 -252
- package/esm/src/generators/models/model-generator.d.ts.map +1 -1
- package/esm/src/generators/models/model-generator.js +18 -3
- package/esm/src/generators/services/okhttp3-clients/okhttp3-client-generator.js +28 -28
- package/esm/src/generators/services/spring-controllers/spring-controller-generator.js +9 -9
- package/package.json +6 -6
- package/script/src/generators/models/model-generator.d.ts.map +1 -1
- package/script/src/generators/models/model-generator.js +17 -2
- package/script/src/generators/services/okhttp3-clients/okhttp3-client-generator.js +28 -28
- package/script/src/generators/services/spring-controllers/spring-controller-generator.js +9 -9
- package/esm/_dnt.test_polyfills.d.ts +0 -29
- package/esm/_dnt.test_polyfills.d.ts.map +0 -1
- package/esm/_dnt.test_polyfills.js +0 -31
- package/esm/_dnt.test_shims.d.ts +0 -6
- package/esm/_dnt.test_shims.d.ts.map +0 -1
- package/esm/_dnt.test_shims.js +0 -61
- package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.js +0 -30
- package/esm/deps/jsr.io/@std/assert/1.0.11/equal.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.11/equal.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/equal.js +0 -183
- package/esm/deps/jsr.io/@std/assert/1.0.11/equals.d.ts +0 -35
- package/esm/deps/jsr.io/@std/assert/1.0.11/equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/equals.js +0 -58
- package/esm/deps/jsr.io/@std/assert/1.0.11/false.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.11/false.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/false.js +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.11/is_error.d.ts +0 -25
- package/esm/deps/jsr.io/@std/assert/1.0.11/is_error.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/is_error.js +0 -54
- package/esm/deps/jsr.io/@std/assert/1.0.11/match.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.11/match.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts +0 -20
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.js +0 -32
- package/esm/deps/jsr.io/@std/assert/1.0.11/rejects.d.ts +0 -42
- package/esm/deps/jsr.io/@std/assert/1.0.11/rejects.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/rejects.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts +0 -24
- package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.js +0 -57
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_equals.d.ts +0 -20
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_equals.js +0 -29
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.d.ts +0 -14
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.js +0 -43
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.d.ts +0 -17
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.js +0 -26
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assertions.d.ts +0 -4
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assertions.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assertions.js +0 -13
- package/esm/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.d.ts +0 -46
- package/esm/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.js +0 -161
- package/esm/deps/jsr.io/@std/expect/1.0.13/_build_message.d.ts +0 -6
- package/esm/deps/jsr.io/@std/expect/1.0.13/_build_message.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_build_message.js +0 -29
- package/esm/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.d.ts +0 -4
- package/esm/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.js +0 -11
- package/esm/deps/jsr.io/@std/expect/1.0.13/_equal.d.ts +0 -9
- package/esm/deps/jsr.io/@std/expect/1.0.13/_equal.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_equal.js +0 -191
- package/esm/deps/jsr.io/@std/expect/1.0.13/_extend.d.ts +0 -4
- package/esm/deps/jsr.io/@std/expect/1.0.13/_extend.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_extend.js +0 -11
- package/esm/deps/jsr.io/@std/expect/1.0.13/_inspect_args.d.ts +0 -3
- package/esm/deps/jsr.io/@std/expect/1.0.13/_inspect_args.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_inspect_args.js +0 -12
- package/esm/deps/jsr.io/@std/expect/1.0.13/_matchers.d.ts +0 -34
- package/esm/deps/jsr.io/@std/expect/1.0.13/_matchers.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_matchers.js +0 -714
- package/esm/deps/jsr.io/@std/expect/1.0.13/_mock_util.d.ts +0 -11
- package/esm/deps/jsr.io/@std/expect/1.0.13/_mock_util.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_mock_util.js +0 -10
- package/esm/deps/jsr.io/@std/expect/1.0.13/_serializer.d.ts +0 -4
- package/esm/deps/jsr.io/@std/expect/1.0.13/_serializer.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_serializer.js +0 -10
- package/esm/deps/jsr.io/@std/expect/1.0.13/_types.d.ts +0 -843
- package/esm/deps/jsr.io/@std/expect/1.0.13/_types.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_types.js +0 -3
- package/esm/deps/jsr.io/@std/expect/1.0.13/_utils.d.ts +0 -9
- package/esm/deps/jsr.io/@std/expect/1.0.13/_utils.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/_utils.js +0 -218
- package/esm/deps/jsr.io/@std/expect/1.0.13/expect.d.ts +0 -60
- package/esm/deps/jsr.io/@std/expect/1.0.13/expect.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.13/expect.js +0 -523
- package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts +0 -160
- package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.js +0 -199
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +0 -82
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js +0 -111
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +0 -140
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js +0 -277
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +0 -99
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js +0 -180
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts +0 -2
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.js +0 -37
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +0 -159
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js +0 -207
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts +0 -16
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.js +0 -2
- package/esm/deps/jsr.io/@std/testing/1.0.9/_mock_utils.d.ts +0 -15
- package/esm/deps/jsr.io/@std/testing/1.0.9/_mock_utils.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.9/_mock_utils.js +0 -35
- package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts +0 -79
- package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.js +0 -380
- package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts +0 -738
- package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.js +0 -654
- package/esm/deps/jsr.io/@std/testing/1.0.9/mock.d.ts +0 -674
- package/esm/deps/jsr.io/@std/testing/1.0.9/mock.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.9/mock.js +0 -1083
- package/esm/src/ast/nodes/annotation.test.d.ts +0 -2
- package/esm/src/ast/nodes/annotation.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/annotation.test.js +0 -56
- package/esm/src/ast/nodes/argument.test.d.ts +0 -2
- package/esm/src/ast/nodes/argument.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/argument.test.js +0 -33
- package/esm/src/ast/nodes/call.test.d.ts +0 -2
- package/esm/src/ast/nodes/call.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/call.test.js +0 -35
- package/esm/src/ast/nodes/class.test.d.ts +0 -2
- package/esm/src/ast/nodes/class.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/class.test.js +0 -219
- package/esm/src/ast/nodes/constructor.test.d.ts +0 -2
- package/esm/src/ast/nodes/constructor.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/constructor.test.js +0 -139
- package/esm/src/ast/nodes/doc-tag.test.d.ts +0 -2
- package/esm/src/ast/nodes/doc-tag.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/doc-tag.test.js +0 -67
- package/esm/src/ast/nodes/doc.test.d.ts +0 -2
- package/esm/src/ast/nodes/doc.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/doc.test.js +0 -33
- package/esm/src/ast/nodes/enum-value.test.d.ts +0 -2
- package/esm/src/ast/nodes/enum-value.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/enum-value.test.js +0 -115
- package/esm/src/ast/nodes/enum.test.d.ts +0 -2
- package/esm/src/ast/nodes/enum.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/enum.test.js +0 -129
- package/esm/src/ast/nodes/function.test.d.ts +0 -2
- package/esm/src/ast/nodes/function.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/function.test.js +0 -160
- package/esm/src/ast/nodes/generic-parameter.test.d.ts +0 -2
- package/esm/src/ast/nodes/generic-parameter.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/generic-parameter.test.js +0 -49
- package/esm/src/ast/nodes/init-block.test.d.ts +0 -2
- package/esm/src/ast/nodes/init-block.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/init-block.test.js +0 -28
- package/esm/src/ast/nodes/interface.test.d.ts +0 -2
- package/esm/src/ast/nodes/interface.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/interface.test.js +0 -121
- package/esm/src/ast/nodes/object.test.d.ts +0 -2
- package/esm/src/ast/nodes/object.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/object.test.js +0 -78
- package/esm/src/ast/nodes/parameter.test.d.ts +0 -2
- package/esm/src/ast/nodes/parameter.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/parameter.test.js +0 -152
- package/esm/src/ast/nodes/property.test.d.ts +0 -2
- package/esm/src/ast/nodes/property.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/property.test.js +0 -206
- package/esm/src/ast/nodes/reference.test.d.ts +0 -2
- package/esm/src/ast/nodes/reference.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/reference.test.js +0 -36
- package/esm/src/ast/nodes/string.test.d.ts +0 -2
- package/esm/src/ast/nodes/string.test.d.ts.map +0 -1
- package/esm/src/ast/nodes/string.test.js +0 -48
- package/esm/src/import-collection.test.d.ts +0 -2
- package/esm/src/import-collection.test.d.ts.map +0 -1
- package/esm/src/import-collection.test.js +0 -99
- package/esm/tests/openapi-models.test.d.ts +0 -2
- package/esm/tests/openapi-models.test.d.ts.map +0 -1
- package/esm/tests/openapi-models.test.js +0 -45
- package/script/_dnt.test_polyfills.d.ts +0 -29
- package/script/_dnt.test_polyfills.d.ts.map +0 -1
- package/script/_dnt.test_polyfills.js +0 -32
- package/script/_dnt.test_shims.d.ts +0 -6
- package/script/_dnt.test_shims.d.ts.map +0 -1
- package/script/_dnt.test_shims.js +0 -65
- package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts +0 -26
- package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.js +0 -34
- package/script/deps/jsr.io/@std/assert/1.0.11/equal.d.ts +0 -17
- package/script/deps/jsr.io/@std/assert/1.0.11/equal.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/equal.js +0 -187
- package/script/deps/jsr.io/@std/assert/1.0.11/equals.d.ts +0 -35
- package/script/deps/jsr.io/@std/assert/1.0.11/equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/equals.js +0 -61
- package/script/deps/jsr.io/@std/assert/1.0.11/false.d.ts +0 -18
- package/script/deps/jsr.io/@std/assert/1.0.11/false.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/false.js +0 -25
- package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts +0 -23
- package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.js +0 -56
- package/script/deps/jsr.io/@std/assert/1.0.11/is_error.d.ts +0 -25
- package/script/deps/jsr.io/@std/assert/1.0.11/is_error.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/is_error.js +0 -57
- package/script/deps/jsr.io/@std/assert/1.0.11/match.d.ts +0 -18
- package/script/deps/jsr.io/@std/assert/1.0.11/match.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/match.js +0 -29
- package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts +0 -20
- package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.js +0 -32
- package/script/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts +0 -18
- package/script/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/not_match.js +0 -29
- package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts +0 -23
- package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.js +0 -35
- package/script/deps/jsr.io/@std/assert/1.0.11/rejects.d.ts +0 -42
- package/script/deps/jsr.io/@std/assert/1.0.11/rejects.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/rejects.js +0 -56
- package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts +0 -24
- package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.js +0 -60
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_equals.d.ts +0 -20
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_equals.js +0 -32
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.d.ts +0 -14
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.js +0 -46
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.d.ts +0 -17
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.js +0 -29
- package/script/deps/jsr.io/@std/expect/1.0.13/_assertions.d.ts +0 -4
- package/script/deps/jsr.io/@std/expect/1.0.13/_assertions.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_assertions.js +0 -18
- package/script/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.d.ts +0 -46
- package/script/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.js +0 -183
- package/script/deps/jsr.io/@std/expect/1.0.13/_build_message.d.ts +0 -6
- package/script/deps/jsr.io/@std/expect/1.0.13/_build_message.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_build_message.js +0 -33
- package/script/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.d.ts +0 -4
- package/script/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.js +0 -15
- package/script/deps/jsr.io/@std/expect/1.0.13/_equal.d.ts +0 -9
- package/script/deps/jsr.io/@std/expect/1.0.13/_equal.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_equal.js +0 -194
- package/script/deps/jsr.io/@std/expect/1.0.13/_extend.d.ts +0 -4
- package/script/deps/jsr.io/@std/expect/1.0.13/_extend.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_extend.js +0 -15
- package/script/deps/jsr.io/@std/expect/1.0.13/_inspect_args.d.ts +0 -3
- package/script/deps/jsr.io/@std/expect/1.0.13/_inspect_args.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_inspect_args.js +0 -17
- package/script/deps/jsr.io/@std/expect/1.0.13/_matchers.d.ts +0 -34
- package/script/deps/jsr.io/@std/expect/1.0.13/_matchers.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_matchers.js +0 -748
- package/script/deps/jsr.io/@std/expect/1.0.13/_mock_util.d.ts +0 -11
- package/script/deps/jsr.io/@std/expect/1.0.13/_mock_util.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_mock_util.js +0 -14
- package/script/deps/jsr.io/@std/expect/1.0.13/_serializer.d.ts +0 -4
- package/script/deps/jsr.io/@std/expect/1.0.13/_serializer.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_serializer.js +0 -14
- package/script/deps/jsr.io/@std/expect/1.0.13/_types.d.ts +0 -843
- package/script/deps/jsr.io/@std/expect/1.0.13/_types.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_types.js +0 -4
- package/script/deps/jsr.io/@std/expect/1.0.13/_utils.d.ts +0 -9
- package/script/deps/jsr.io/@std/expect/1.0.13/_utils.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/_utils.js +0 -226
- package/script/deps/jsr.io/@std/expect/1.0.13/expect.d.ts +0 -60
- package/script/deps/jsr.io/@std/expect/1.0.13/expect.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.13/expect.js +0 -527
- package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts +0 -160
- package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.js +0 -204
- package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +0 -82
- package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/build_message.js +0 -116
- package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +0 -140
- package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/diff.js +0 -284
- package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +0 -99
- package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.js +0 -186
- package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts +0 -2
- package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/format.js +0 -41
- package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +0 -159
- package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/styles.js +0 -220
- package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts +0 -16
- package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/types.js +0 -3
- package/script/deps/jsr.io/@std/testing/1.0.9/_mock_utils.d.ts +0 -15
- package/script/deps/jsr.io/@std/testing/1.0.9/_mock_utils.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.9/_mock_utils.js +0 -41
- package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts +0 -79
- package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.js +0 -385
- package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts +0 -738
- package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.9/bdd.js +0 -665
- package/script/deps/jsr.io/@std/testing/1.0.9/mock.d.ts +0 -674
- package/script/deps/jsr.io/@std/testing/1.0.9/mock.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.9/mock.js +0 -1102
- package/script/src/ast/nodes/annotation.test.d.ts +0 -2
- package/script/src/ast/nodes/annotation.test.d.ts.map +0 -1
- package/script/src/ast/nodes/annotation.test.js +0 -58
- package/script/src/ast/nodes/argument.test.d.ts +0 -2
- package/script/src/ast/nodes/argument.test.d.ts.map +0 -1
- package/script/src/ast/nodes/argument.test.js +0 -35
- package/script/src/ast/nodes/call.test.d.ts +0 -2
- package/script/src/ast/nodes/call.test.d.ts.map +0 -1
- package/script/src/ast/nodes/call.test.js +0 -37
- package/script/src/ast/nodes/class.test.d.ts +0 -2
- package/script/src/ast/nodes/class.test.d.ts.map +0 -1
- package/script/src/ast/nodes/class.test.js +0 -221
- package/script/src/ast/nodes/constructor.test.d.ts +0 -2
- package/script/src/ast/nodes/constructor.test.d.ts.map +0 -1
- package/script/src/ast/nodes/constructor.test.js +0 -141
- package/script/src/ast/nodes/doc-tag.test.d.ts +0 -2
- package/script/src/ast/nodes/doc-tag.test.d.ts.map +0 -1
- package/script/src/ast/nodes/doc-tag.test.js +0 -69
- package/script/src/ast/nodes/doc.test.d.ts +0 -2
- package/script/src/ast/nodes/doc.test.d.ts.map +0 -1
- package/script/src/ast/nodes/doc.test.js +0 -35
- package/script/src/ast/nodes/enum-value.test.d.ts +0 -2
- package/script/src/ast/nodes/enum-value.test.d.ts.map +0 -1
- package/script/src/ast/nodes/enum-value.test.js +0 -117
- package/script/src/ast/nodes/enum.test.d.ts +0 -2
- package/script/src/ast/nodes/enum.test.d.ts.map +0 -1
- package/script/src/ast/nodes/enum.test.js +0 -131
- package/script/src/ast/nodes/function.test.d.ts +0 -2
- package/script/src/ast/nodes/function.test.d.ts.map +0 -1
- package/script/src/ast/nodes/function.test.js +0 -162
- package/script/src/ast/nodes/generic-parameter.test.d.ts +0 -2
- package/script/src/ast/nodes/generic-parameter.test.d.ts.map +0 -1
- package/script/src/ast/nodes/generic-parameter.test.js +0 -51
- package/script/src/ast/nodes/init-block.test.d.ts +0 -2
- package/script/src/ast/nodes/init-block.test.d.ts.map +0 -1
- package/script/src/ast/nodes/init-block.test.js +0 -30
- package/script/src/ast/nodes/interface.test.d.ts +0 -2
- package/script/src/ast/nodes/interface.test.d.ts.map +0 -1
- package/script/src/ast/nodes/interface.test.js +0 -123
- package/script/src/ast/nodes/object.test.d.ts +0 -2
- package/script/src/ast/nodes/object.test.d.ts.map +0 -1
- package/script/src/ast/nodes/object.test.js +0 -80
- package/script/src/ast/nodes/parameter.test.d.ts +0 -2
- package/script/src/ast/nodes/parameter.test.d.ts.map +0 -1
- package/script/src/ast/nodes/parameter.test.js +0 -154
- package/script/src/ast/nodes/property.test.d.ts +0 -2
- package/script/src/ast/nodes/property.test.d.ts.map +0 -1
- package/script/src/ast/nodes/property.test.js +0 -208
- package/script/src/ast/nodes/reference.test.d.ts +0 -2
- package/script/src/ast/nodes/reference.test.d.ts.map +0 -1
- package/script/src/ast/nodes/reference.test.js +0 -38
- package/script/src/ast/nodes/string.test.d.ts +0 -2
- package/script/src/ast/nodes/string.test.d.ts.map +0 -1
- package/script/src/ast/nodes/string.test.js +0 -50
- package/script/src/import-collection.test.d.ts +0 -2
- package/script/src/import-collection.test.d.ts.map +0 -1
- package/script/src/import-collection.test.js +0 -101
- package/script/tests/openapi-models.test.d.ts +0 -2
- package/script/tests/openapi-models.test.d.ts.map +0 -1
- package/script/tests/openapi-models.test.js +0 -48
- package/src/_dnt.test_polyfills.ts +0 -70
- package/src/_dnt.test_shims.ts +0 -64
- package/src/deps/jsr.io/@std/assert/1.0.11/assertion_error.ts +0 -31
- package/src/deps/jsr.io/@std/assert/1.0.11/equal.ts +0 -210
- package/src/deps/jsr.io/@std/assert/1.0.11/equals.ts +0 -65
- package/src/deps/jsr.io/@std/assert/1.0.11/false.ts +0 -26
- package/src/deps/jsr.io/@std/assert/1.0.11/instance_of.ts +0 -64
- package/src/deps/jsr.io/@std/assert/1.0.11/is_error.ts +0 -65
- package/src/deps/jsr.io/@std/assert/1.0.11/match.ts +0 -30
- package/src/deps/jsr.io/@std/assert/1.0.11/not_instance_of.ts +0 -33
- package/src/deps/jsr.io/@std/assert/1.0.11/not_match.ts +0 -30
- package/src/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.ts +0 -42
- package/src/deps/jsr.io/@std/assert/1.0.11/rejects.ts +0 -123
- package/src/deps/jsr.io/@std/assert/1.0.11/strict_equals.ts +0 -67
- package/src/deps/jsr.io/@std/expect/1.0.13/_assert_equals.ts +0 -38
- package/src/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.ts +0 -54
- package/src/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.ts +0 -35
- package/src/deps/jsr.io/@std/expect/1.0.13/_assertions.ts +0 -18
- package/src/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.ts +0 -198
- package/src/deps/jsr.io/@std/expect/1.0.13/_build_message.ts +0 -51
- package/src/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.ts +0 -19
- package/src/deps/jsr.io/@std/expect/1.0.13/_equal.ts +0 -230
- package/src/deps/jsr.io/@std/expect/1.0.13/_extend.ts +0 -16
- package/src/deps/jsr.io/@std/expect/1.0.13/_inspect_args.ts +0 -15
- package/src/deps/jsr.io/@std/expect/1.0.13/_matchers.ts +0 -1028
- package/src/deps/jsr.io/@std/expect/1.0.13/_mock_util.ts +0 -22
- package/src/deps/jsr.io/@std/expect/1.0.13/_serializer.ts +0 -15
- package/src/deps/jsr.io/@std/expect/1.0.13/_types.ts +0 -923
- package/src/deps/jsr.io/@std/expect/1.0.13/_utils.ts +0 -283
- package/src/deps/jsr.io/@std/expect/1.0.13/expect.ts +0 -620
- package/src/deps/jsr.io/@std/internal/1.0.5/assertion_state.ts +0 -214
- package/src/deps/jsr.io/@std/internal/1.0.5/build_message.ts +0 -134
- package/src/deps/jsr.io/@std/internal/1.0.5/diff.ts +0 -317
- package/src/deps/jsr.io/@std/internal/1.0.5/diff_str.ts +0 -204
- package/src/deps/jsr.io/@std/internal/1.0.5/format.ts +0 -39
- package/src/deps/jsr.io/@std/internal/1.0.5/styles.ts +0 -233
- package/src/deps/jsr.io/@std/internal/1.0.5/types.ts +0 -18
- package/src/deps/jsr.io/@std/testing/1.0.9/_mock_utils.ts +0 -43
- package/src/deps/jsr.io/@std/testing/1.0.9/_test_suite.ts +0 -448
- package/src/deps/jsr.io/@std/testing/1.0.9/bdd.ts +0 -1288
- package/src/deps/jsr.io/@std/testing/1.0.9/mock.ts +0 -1807
- package/src/mod.ts +0 -8
- package/src/src/assets.ts +0 -9
- package/src/src/ast/_index.ts +0 -66
- package/src/src/ast/common.ts +0 -1
- package/src/src/ast/index.ts +0 -1
- package/src/src/ast/node.ts +0 -10
- package/src/src/ast/nodes/annotation.test.ts +0 -69
- package/src/src/ast/nodes/annotation.ts +0 -79
- package/src/src/ast/nodes/argument.test.ts +0 -41
- package/src/src/ast/nodes/argument.ts +0 -62
- package/src/src/ast/nodes/call.test.ts +0 -44
- package/src/src/ast/nodes/call.ts +0 -66
- package/src/src/ast/nodes/class.test.ts +0 -274
- package/src/src/ast/nodes/class.ts +0 -178
- package/src/src/ast/nodes/collection-literal.ts +0 -49
- package/src/src/ast/nodes/constructor.test.ts +0 -178
- package/src/src/ast/nodes/constructor.ts +0 -126
- package/src/src/ast/nodes/doc-tag.test.ts +0 -84
- package/src/src/ast/nodes/doc-tag.ts +0 -138
- package/src/src/ast/nodes/doc.test.ts +0 -42
- package/src/src/ast/nodes/doc.ts +0 -111
- package/src/src/ast/nodes/enum-value.test.ts +0 -146
- package/src/src/ast/nodes/enum-value.ts +0 -100
- package/src/src/ast/nodes/enum.test.ts +0 -167
- package/src/src/ast/nodes/enum.ts +0 -163
- package/src/src/ast/nodes/function.test.ts +0 -194
- package/src/src/ast/nodes/function.ts +0 -178
- package/src/src/ast/nodes/generic-parameter.test.ts +0 -60
- package/src/src/ast/nodes/generic-parameter.ts +0 -54
- package/src/src/ast/nodes/init-block.test.ts +0 -36
- package/src/src/ast/nodes/init-block.ts +0 -38
- package/src/src/ast/nodes/interface.test.ts +0 -151
- package/src/src/ast/nodes/interface.ts +0 -133
- package/src/src/ast/nodes/lambda-type.ts +0 -68
- package/src/src/ast/nodes/lambda.ts +0 -68
- package/src/src/ast/nodes/object.test.ts +0 -101
- package/src/src/ast/nodes/object.ts +0 -102
- package/src/src/ast/nodes/parameter.test.ts +0 -191
- package/src/src/ast/nodes/parameter.ts +0 -118
- package/src/src/ast/nodes/property.test.ts +0 -253
- package/src/src/ast/nodes/property.ts +0 -225
- package/src/src/ast/nodes/reference.test.ts +0 -47
- package/src/src/ast/nodes/reference.ts +0 -178
- package/src/src/ast/nodes/string.test.ts +0 -61
- package/src/src/ast/nodes/string.ts +0 -114
- package/src/src/ast/nodes/types.ts +0 -23
- package/src/src/ast/references/index.ts +0 -8
- package/src/src/ast/references/jackson.ts +0 -16
- package/src/src/ast/references/jakarta.ts +0 -14
- package/src/src/ast/references/java.ts +0 -19
- package/src/src/ast/references/kotlin.ts +0 -41
- package/src/src/ast/references/okhttp3.ts +0 -5
- package/src/src/ast/references/reactor.ts +0 -5
- package/src/src/ast/references/spring.ts +0 -72
- package/src/src/ast/references/swagger.ts +0 -23
- package/src/src/ast/utils/get-kotlin-builder-options.ts +0 -19
- package/src/src/ast/utils/to-kt-node.ts +0 -31
- package/src/src/ast/utils/write-kt-annotations.ts +0 -15
- package/src/src/ast/utils/write-kt-arguments.ts +0 -45
- package/src/src/ast/utils/write-kt-enum-values.ts +0 -27
- package/src/src/ast/utils/write-kt-generic-parameters.ts +0 -12
- package/src/src/ast/utils/write-kt-members.ts +0 -25
- package/src/src/ast/utils/write-kt-node.ts +0 -37
- package/src/src/ast/utils/write-kt-parameters.ts +0 -25
- package/src/src/common-results.ts +0 -4
- package/src/src/config.ts +0 -41
- package/src/src/file-builder.ts +0 -108
- package/src/src/generators/file-generator.ts +0 -29
- package/src/src/generators/index.ts +0 -4
- package/src/src/generators/models/args.ts +0 -123
- package/src/src/generators/models/index.ts +0 -4
- package/src/src/generators/models/model-generator.ts +0 -633
- package/src/src/generators/models/models-generator.ts +0 -65
- package/src/src/generators/models/models.ts +0 -95
- package/src/src/generators/services/okhttp3-clients/args.ts +0 -78
- package/src/src/generators/services/okhttp3-clients/index.ts +0 -4
- package/src/src/generators/services/okhttp3-clients/models.ts +0 -62
- package/src/src/generators/services/okhttp3-clients/okhttp3-client-generator.ts +0 -567
- package/src/src/generators/services/okhttp3-clients/okhttp3-clients-generator.ts +0 -130
- package/src/src/generators/services/okhttp3-clients/refs.ts +0 -55
- package/src/src/generators/services/spring-controllers/args.ts +0 -88
- package/src/src/generators/services/spring-controllers/index.ts +0 -4
- package/src/src/generators/services/spring-controllers/models.ts +0 -71
- package/src/src/generators/services/spring-controllers/refs.ts +0 -17
- package/src/src/generators/services/spring-controllers/spring-controller-generator.ts +0 -782
- package/src/src/generators/services/spring-controllers/spring-controllers-generator.ts +0 -117
- package/src/src/import-collection.test.ts +0 -116
- package/src/src/import-collection.ts +0 -98
- package/src/src/types.ts +0 -3
- package/src/src/utils.ts +0 -39
- package/src/tests/openapi-models.test.ts +0 -63
- package/test_runner.js +0 -227
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import fs from 'fs-extra';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
type ApiService,
|
|
6
|
-
type AppendValueGroup,
|
|
7
|
-
appendValueGroup,
|
|
8
|
-
Factory,
|
|
9
|
-
type MaybePromise,
|
|
10
|
-
type OpenApiGeneratorContext,
|
|
11
|
-
OpenApiServicesGenerationProviderBase,
|
|
12
|
-
} from '@goast/core';
|
|
13
|
-
|
|
14
|
-
import { kt } from '../../../ast/index.js';
|
|
15
|
-
import { KotlinFileBuilder } from '../../../file-builder.js';
|
|
16
|
-
import {
|
|
17
|
-
defaultKotlinServicesGeneratorConfig,
|
|
18
|
-
type KotlinServiceGeneratorOutput,
|
|
19
|
-
type KotlinServicesGeneratorConfig,
|
|
20
|
-
type KotlinServicesGeneratorContext,
|
|
21
|
-
type KotlinServicesGeneratorInput,
|
|
22
|
-
type KotlinServicesGeneratorOutput,
|
|
23
|
-
} from './models.js';
|
|
24
|
-
import { getReferenceFactories } from './refs.js';
|
|
25
|
-
import {
|
|
26
|
-
DefaultKotlinSpringControllerGenerator,
|
|
27
|
-
type KotlinSpringControllerGenerator,
|
|
28
|
-
} from './spring-controller-generator.js';
|
|
29
|
-
|
|
30
|
-
type Input = KotlinServicesGeneratorInput;
|
|
31
|
-
type Output = KotlinServicesGeneratorOutput;
|
|
32
|
-
type Config = KotlinServicesGeneratorConfig;
|
|
33
|
-
type ServiceOutput = KotlinServiceGeneratorOutput;
|
|
34
|
-
type Context = KotlinServicesGeneratorContext;
|
|
35
|
-
|
|
36
|
-
export class KotlinSpringControllersGenerator extends OpenApiServicesGenerationProviderBase<
|
|
37
|
-
Input,
|
|
38
|
-
Output,
|
|
39
|
-
Config,
|
|
40
|
-
ServiceOutput,
|
|
41
|
-
Context
|
|
42
|
-
> {
|
|
43
|
-
private readonly _serviceGeneratorFactory: Factory<KotlinSpringControllerGenerator, []>;
|
|
44
|
-
|
|
45
|
-
constructor(serviceGeneratorFactory?: Factory<KotlinSpringControllerGenerator, []>) {
|
|
46
|
-
super();
|
|
47
|
-
this._serviceGeneratorFactory = serviceGeneratorFactory ??
|
|
48
|
-
Factory.fromValue(new DefaultKotlinSpringControllerGenerator());
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
protected initResult(): Output {
|
|
52
|
-
return {
|
|
53
|
-
kotlin: {
|
|
54
|
-
services: {},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
protected generateService(ctx: Context, service: ApiService): MaybePromise<ServiceOutput> {
|
|
60
|
-
const serviceGenerator = this._serviceGeneratorFactory.create();
|
|
61
|
-
return serviceGenerator.generate({
|
|
62
|
-
...ctx,
|
|
63
|
-
service,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
protected addServiceResult(ctx: Context, service: ApiService, result: ServiceOutput): void {
|
|
68
|
-
ctx.output.kotlin.services[service.id] = result;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
protected buildContext(
|
|
72
|
-
context: OpenApiGeneratorContext<KotlinServicesGeneratorInput>,
|
|
73
|
-
config?: Partial<Config> | undefined,
|
|
74
|
-
): Context {
|
|
75
|
-
context.data.services = context.data.services.filter((x) => x.name !== 'exclude-from-generation');
|
|
76
|
-
const providerContext = this.getProviderContext(context, config, defaultKotlinServicesGeneratorConfig);
|
|
77
|
-
return Object.assign(providerContext, {
|
|
78
|
-
refs: getReferenceFactories(providerContext.config),
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
protected override generateAdditionalFiles(ctx: KotlinServicesGeneratorContext): void {
|
|
83
|
-
this.generateApiExceptionHandler(ctx);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
protected generateApiExceptionHandler(ctx: Context): void {
|
|
87
|
-
const packageName = ctx.refs.apiExceptionHandler.packageName ?? ctx.config.packageName;
|
|
88
|
-
const dir = `${ctx.config.outputDir}/${packageName.replace(/\./g, '/')}`;
|
|
89
|
-
const fileName = `${ctx.refs.apiExceptionHandler.refName}.kt`;
|
|
90
|
-
console.log(`Generating Api Exception Handler to ${fileName}...`);
|
|
91
|
-
|
|
92
|
-
const builder = new KotlinFileBuilder(packageName, ctx.config);
|
|
93
|
-
builder.append(this.getApiExceptionHandlerInterface(ctx));
|
|
94
|
-
fs.writeFileSync(`${dir}/${fileName}`, builder.toString());
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
protected getApiExceptionHandlerFileContent(ctx: Context): AppendValueGroup<KotlinFileBuilder> {
|
|
98
|
-
return appendValueGroup([this.getApiExceptionHandlerInterface(ctx)], '\n');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
protected getApiExceptionHandlerInterface(ctx: Context): kt.Interface<KotlinFileBuilder> {
|
|
102
|
-
return kt.interface(ctx.refs.apiExceptionHandler.refName, {
|
|
103
|
-
members: [
|
|
104
|
-
kt.function('handleApiException', {
|
|
105
|
-
doc: kt.doc('Handler for API exceptions.', [kt.docTag('return', 'Response entity.')]),
|
|
106
|
-
suspend: true,
|
|
107
|
-
parameters: [
|
|
108
|
-
kt.parameter('exception', kt.refs.throwable(), {
|
|
109
|
-
description: 'Exception that has been thrown by the API.',
|
|
110
|
-
}),
|
|
111
|
-
],
|
|
112
|
-
returnType: kt.refs.spring.responseEntity(['*']),
|
|
113
|
-
}),
|
|
114
|
-
],
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import "../_dnt.test_polyfills.js";
|
|
2
|
-
import { EOL } from 'node:os';
|
|
3
|
-
|
|
4
|
-
import { expect } from '../deps/jsr.io/@std/expect/1.0.13/expect.js';
|
|
5
|
-
import { describe, it } from '../deps/jsr.io/@std/testing/1.0.9/bdd.js';
|
|
6
|
-
|
|
7
|
-
import { StringBuilder } from '@goast/core';
|
|
8
|
-
|
|
9
|
-
import { ImportCollection } from './import-collection.js';
|
|
10
|
-
|
|
11
|
-
describe('ImportCollection', () => {
|
|
12
|
-
describe('hasImport', () => {
|
|
13
|
-
it('should return false when no imports are added', () => {
|
|
14
|
-
const importCollection = new ImportCollection();
|
|
15
|
-
expect(importCollection.hasImports).toBe(false);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should return true when imports are added', () => {
|
|
19
|
-
const importCollection = new ImportCollection();
|
|
20
|
-
importCollection.addImport('SomeClass', 'some.package');
|
|
21
|
-
expect(importCollection.hasImports).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('imports', () => {
|
|
26
|
-
it('should return an empty array when no imports are added', () => {
|
|
27
|
-
const importCollection = new ImportCollection();
|
|
28
|
-
expect(importCollection.imports).toEqual([]);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should return an array of imports when imports are added', () => {
|
|
32
|
-
const importCollection = new ImportCollection();
|
|
33
|
-
importCollection.addImport('SomeClass', 'some.package');
|
|
34
|
-
importCollection.addImport('AnotherClass', 'another.package');
|
|
35
|
-
expect(importCollection.imports).toEqual([
|
|
36
|
-
{ packageName: 'some.package', typeName: 'SomeClass' },
|
|
37
|
-
{ packageName: 'another.package', typeName: 'AnotherClass' },
|
|
38
|
-
]);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('addImport', () => {
|
|
43
|
-
it('should add an import to the collection', () => {
|
|
44
|
-
const importCollection = new ImportCollection();
|
|
45
|
-
importCollection.addImport('SomeClass', 'some.package');
|
|
46
|
-
expect(importCollection.imports).toEqual([{ packageName: 'some.package', typeName: 'SomeClass' }]);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should add an import to the collection using an object', () => {
|
|
50
|
-
const importCollection = new ImportCollection();
|
|
51
|
-
importCollection.addImport({ packageName: 'some.package', typeName: 'SomeClass' });
|
|
52
|
-
expect(importCollection.imports).toEqual([{ packageName: 'some.package', typeName: 'SomeClass' }]);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe('addImports', () => {
|
|
57
|
-
it('should add multiple imports to the collection', () => {
|
|
58
|
-
const importCollection = new ImportCollection();
|
|
59
|
-
importCollection.addImports([
|
|
60
|
-
{ packageName: 'some.package', typeName: 'SomeClass' },
|
|
61
|
-
{ packageName: 'another.package', typeName: 'AnotherClass' },
|
|
62
|
-
]);
|
|
63
|
-
expect(importCollection.imports).toEqual([
|
|
64
|
-
{ packageName: 'some.package', typeName: 'SomeClass' },
|
|
65
|
-
{ packageName: 'another.package', typeName: 'AnotherClass' },
|
|
66
|
-
]);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe('clear', () => {
|
|
71
|
-
it('should clear all imports', () => {
|
|
72
|
-
const importCollection = new ImportCollection();
|
|
73
|
-
importCollection.addImport('SomeClass', 'some.package');
|
|
74
|
-
importCollection.clear();
|
|
75
|
-
expect(importCollection.imports).toEqual([]);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
describe('toString', () => {
|
|
80
|
-
it('should return an empty string when no imports are added', () => {
|
|
81
|
-
const importCollection = new ImportCollection();
|
|
82
|
-
expect(importCollection.toString()).toBe('');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('should return a string of imports when imports are added', () => {
|
|
86
|
-
const importCollection = new ImportCollection();
|
|
87
|
-
importCollection.addImport('SomeClass', 'some.package');
|
|
88
|
-
importCollection.addImport('AnotherClass', 'another.package');
|
|
89
|
-
expect(importCollection.toString()).toBe(
|
|
90
|
-
`import another.package.AnotherClass${EOL}import some.package.SomeClass${EOL}`,
|
|
91
|
-
);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
describe('writeTo', () => {
|
|
96
|
-
it('should write imports to a StringBuilder', () => {
|
|
97
|
-
const importCollection = new ImportCollection();
|
|
98
|
-
importCollection.addImport('SomeClass', 'some.package');
|
|
99
|
-
importCollection.addImport('AnotherClass', 'another.package');
|
|
100
|
-
const builder = new StringBuilder();
|
|
101
|
-
importCollection.writeTo(builder);
|
|
102
|
-
expect(builder.toString()).toBe(`import another.package.AnotherClass${EOL}import some.package.SomeClass${EOL}`);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('should ignore global imports', () => {
|
|
107
|
-
const importCollection = new ImportCollection({
|
|
108
|
-
globalImports: ['kotlin.*', 'myPackage.MyClass'],
|
|
109
|
-
});
|
|
110
|
-
importCollection.addImport('String', 'kotlin');
|
|
111
|
-
importCollection.addImport('Int', 'kotlin');
|
|
112
|
-
importCollection.addImport('MyClass', 'myPackage');
|
|
113
|
-
importCollection.addImport('MyOtherClass', 'myPackage');
|
|
114
|
-
expect(importCollection.toString()).toBe(`import myPackage.MyOtherClass${EOL}`);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { type SourceBuilderOptions, StringBuilder } from '@goast/core';
|
|
2
|
-
|
|
3
|
-
import type { KotlinImport } from './common-results.js';
|
|
4
|
-
import { defaultKotlinGeneratorConfig } from './config.js';
|
|
5
|
-
|
|
6
|
-
export type ImportCollectionOptions = {
|
|
7
|
-
globalImports: string[];
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const defaultImportCollectionOptions: ImportCollectionOptions = {
|
|
11
|
-
globalImports: defaultKotlinGeneratorConfig.globalImports,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export class ImportCollection {
|
|
15
|
-
private readonly _imports: Map<string, Set<string>> = new Map();
|
|
16
|
-
private readonly _options: ImportCollectionOptions;
|
|
17
|
-
|
|
18
|
-
constructor(options: Partial<ImportCollectionOptions> = {}) {
|
|
19
|
-
this._options = { ...defaultImportCollectionOptions, ...options };
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public get hasImports(): boolean {
|
|
23
|
-
return this._imports.size > 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public get imports(): KotlinImport[] {
|
|
27
|
-
return Array.from(this._imports.entries())
|
|
28
|
-
.map(([fromPackage, importNames]) =>
|
|
29
|
-
Array.from(importNames).map((importName) => ({
|
|
30
|
-
packageName: fromPackage,
|
|
31
|
-
typeName: importName,
|
|
32
|
-
}))
|
|
33
|
-
)
|
|
34
|
-
.flat();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public addImport(importName: string, fromModule: string): void;
|
|
38
|
-
public addImport(importObj: KotlinImport): void;
|
|
39
|
-
public addImport(importOrImportName: KotlinImport | string, fromModule?: string): void {
|
|
40
|
-
const importName = typeof importOrImportName === 'string' ? importOrImportName : importOrImportName.typeName;
|
|
41
|
-
fromModule = typeof importOrImportName === 'string' ? fromModule : importOrImportName.packageName;
|
|
42
|
-
|
|
43
|
-
if (!fromModule) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const existingImport = this._imports.get(fromModule);
|
|
48
|
-
if (existingImport) {
|
|
49
|
-
existingImport.add(importName);
|
|
50
|
-
} else {
|
|
51
|
-
this._imports.set(fromModule!, new Set([importName]));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public addImports(imports: KotlinImport[]): void {
|
|
56
|
-
for (const importObj of imports) {
|
|
57
|
-
this.addImport(importObj);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public clear(): void {
|
|
62
|
-
this._imports.clear();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public toString(options?: Partial<SourceBuilderOptions>): string {
|
|
66
|
-
const builder = new StringBuilder(options);
|
|
67
|
-
this.writeTo(builder);
|
|
68
|
-
return builder.toString();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public writeTo(builder: StringBuilder) {
|
|
72
|
-
if (this._imports.size > 0) {
|
|
73
|
-
const globalPackages = this._options.globalImports
|
|
74
|
-
.filter((g) => g.endsWith('.*'))
|
|
75
|
-
.map((g) => g.substring(0, g.length - 2));
|
|
76
|
-
const globalImports = this._options.globalImports.filter((g) => !g.endsWith('.*'));
|
|
77
|
-
|
|
78
|
-
Array.from(this._imports.entries())
|
|
79
|
-
.filter(([packageName]) => !globalPackages.includes(packageName))
|
|
80
|
-
.flatMap(([packageName, importNames]) => Array.from(importNames).map((importName) => [packageName, importName]))
|
|
81
|
-
.map(([packageName, importName]) => `${packageName}.${importName}`)
|
|
82
|
-
.filter((importPath) => !globalImports.includes(importPath))
|
|
83
|
-
.sort((a, b) => {
|
|
84
|
-
if (isCoreImport(a) && !isCoreImport(b)) {
|
|
85
|
-
return 1;
|
|
86
|
-
} else if (!isCoreImport(a) && isCoreImport(b)) {
|
|
87
|
-
return -1;
|
|
88
|
-
}
|
|
89
|
-
return a.localeCompare(b);
|
|
90
|
-
})
|
|
91
|
-
.forEach((importPath) => builder.appendLine(`import ${importPath}`));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function isCoreImport(importPath: string): boolean {
|
|
97
|
-
return importPath.startsWith('kotlin.') || importPath.startsWith('java.') || importPath.startsWith('javax.');
|
|
98
|
-
}
|
package/src/src/types.ts
DELETED
package/src/src/utils.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { Nullable } from '@goast/core';
|
|
2
|
-
|
|
3
|
-
export function toKotlinStringLiteral(value: Nullable<string>): string {
|
|
4
|
-
if (!value) {
|
|
5
|
-
return '""';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const escaped = value
|
|
9
|
-
.replace(/(["\\$])/g, '\\$1')
|
|
10
|
-
.replace(/\n/g, '\\n')
|
|
11
|
-
.replace(/\r/g, '\\r')
|
|
12
|
-
.replace(/\t/g, '\\t');
|
|
13
|
-
return `"${escaped}"`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function toKotlinPropertyName(value: string): string {
|
|
17
|
-
if (value.match(/^[a-zA-Z_$][a-zA-Z_$0-9]*$/)) {
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
return `\`${value}\``;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function modifyString<TArgs extends unknown[]>(
|
|
24
|
-
value: string,
|
|
25
|
-
modifier: string | RegExp | ((value: string, ...args: TArgs) => string) | undefined,
|
|
26
|
-
...args: TArgs
|
|
27
|
-
): string {
|
|
28
|
-
if (typeof modifier === 'string') {
|
|
29
|
-
return modifier;
|
|
30
|
-
}
|
|
31
|
-
if (modifier instanceof RegExp) {
|
|
32
|
-
const match = value.match(modifier);
|
|
33
|
-
return match?.[0] ?? value;
|
|
34
|
-
}
|
|
35
|
-
if (typeof modifier === 'function') {
|
|
36
|
-
return modifier(value, ...args);
|
|
37
|
-
}
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import "../_dnt.test_polyfills.js";
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
import { afterEach, describe, test } from '../deps/jsr.io/@std/testing/1.0.9/bdd.js';
|
|
5
|
-
import { restore, stub } from '../deps/jsr.io/@std/testing/1.0.9/mock.js';
|
|
6
|
-
|
|
7
|
-
import fs from 'fs-extra';
|
|
8
|
-
|
|
9
|
-
import { OpenApiGenerator, toCustomCase } from '@goast/core';
|
|
10
|
-
import {
|
|
11
|
-
MultipartData,
|
|
12
|
-
openApiV2FilesDir,
|
|
13
|
-
openApiV3_1FilesDir,
|
|
14
|
-
openApiV3FilesDir,
|
|
15
|
-
type OpenApiVersion,
|
|
16
|
-
verify,
|
|
17
|
-
} from '@goast/test-utils';
|
|
18
|
-
|
|
19
|
-
import { KotlinModelsGenerator } from '../src/generators/models/models-generator.js';
|
|
20
|
-
|
|
21
|
-
const filePaths: { [P in OpenApiVersion]: string } = {
|
|
22
|
-
'2.0': openApiV2FilesDir,
|
|
23
|
-
'3.0': openApiV3FilesDir,
|
|
24
|
-
'3.1': openApiV3_1FilesDir,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const testFilesAllVersions: string[] = ['simple-schemas.yml', 'detailed-schemas.yml', 'object-schemas.yml'];
|
|
28
|
-
const testFilesV3x: string[] = ['oneof-schemas.yml', 'discriminated-schemas.yml'];
|
|
29
|
-
|
|
30
|
-
for (const [version, path] of Object.entries(filePaths)) {
|
|
31
|
-
describe(`OpenAPI V${version}`, () => {
|
|
32
|
-
afterEach(() => {
|
|
33
|
-
restore();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const testFiles = version.startsWith('3') ? testFilesAllVersions.concat(testFilesV3x) : testFilesAllVersions;
|
|
37
|
-
for (const file of testFiles) {
|
|
38
|
-
const fileWithoutExt = file.replace(/\.[^/.]+$/, '');
|
|
39
|
-
test(toCustomCase(fileWithoutExt, { wordCasing: 'all-lower', wordSeparator: ' ' }), async (t) => {
|
|
40
|
-
const filePath = join(path, file);
|
|
41
|
-
|
|
42
|
-
const result = new MultipartData();
|
|
43
|
-
stub(fs, 'ensureDirSync');
|
|
44
|
-
stub(fs, 'writeFileSync', (path: fs.PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView) => {
|
|
45
|
-
result.push([path.toString(), data.toString()]);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const generatorOptions = {
|
|
49
|
-
outputDir: 'out',
|
|
50
|
-
newLine: '\n',
|
|
51
|
-
};
|
|
52
|
-
const state = await new OpenApiGenerator(generatorOptions)
|
|
53
|
-
// deno-lint-ignore no-explicit-any
|
|
54
|
-
.useType(KotlinModelsGenerator, { __test__: true } as any)
|
|
55
|
-
.parseAndGenerate(filePath);
|
|
56
|
-
result.splice(0, 0, ['state', state]);
|
|
57
|
-
|
|
58
|
-
restore();
|
|
59
|
-
await verify(t, result);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
package/test_runner.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
const pc = require("picocolors");
|
|
2
|
-
const process = require("process");
|
|
3
|
-
const { pathToFileURL } = require("url");
|
|
4
|
-
const { testDefinitions } = require("@deno/shim-deno-test");
|
|
5
|
-
const filePaths = [
|
|
6
|
-
"src/ast/nodes/annotation.test.js",
|
|
7
|
-
"src/ast/nodes/argument.test.js",
|
|
8
|
-
"src/ast/nodes/call.test.js",
|
|
9
|
-
"src/ast/nodes/class.test.js",
|
|
10
|
-
"src/ast/nodes/constructor.test.js",
|
|
11
|
-
"src/ast/nodes/doc-tag.test.js",
|
|
12
|
-
"src/ast/nodes/doc.test.js",
|
|
13
|
-
"src/ast/nodes/enum-value.test.js",
|
|
14
|
-
"src/ast/nodes/enum.test.js",
|
|
15
|
-
"src/ast/nodes/function.test.js",
|
|
16
|
-
"src/ast/nodes/generic-parameter.test.js",
|
|
17
|
-
"src/ast/nodes/init-block.test.js",
|
|
18
|
-
"src/ast/nodes/interface.test.js",
|
|
19
|
-
"src/ast/nodes/object.test.js",
|
|
20
|
-
"src/ast/nodes/parameter.test.js",
|
|
21
|
-
"src/ast/nodes/property.test.js",
|
|
22
|
-
"src/ast/nodes/reference.test.js",
|
|
23
|
-
"src/ast/nodes/string.test.js",
|
|
24
|
-
"src/import-collection.test.js",
|
|
25
|
-
"tests/openapi-models.test.js",
|
|
26
|
-
];
|
|
27
|
-
async function main() {
|
|
28
|
-
const testContext = {
|
|
29
|
-
process,
|
|
30
|
-
pc,
|
|
31
|
-
};
|
|
32
|
-
for (const [i, filePath] of filePaths.entries()) {
|
|
33
|
-
if (i > 0) {
|
|
34
|
-
console.log("");
|
|
35
|
-
}
|
|
36
|
-
const scriptPath = "./script/" + filePath;
|
|
37
|
-
console.log("Running tests in " + pc.underline(scriptPath) + "...\n");
|
|
38
|
-
process.chdir(__dirname + "/script");
|
|
39
|
-
const scriptTestContext = {
|
|
40
|
-
origin: pathToFileURL(filePath).toString(),
|
|
41
|
-
...testContext,
|
|
42
|
-
};
|
|
43
|
-
try {
|
|
44
|
-
require(scriptPath);
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
console.error(err);
|
|
48
|
-
process.exit(1);
|
|
49
|
-
}
|
|
50
|
-
await runTestDefinitions(testDefinitions.splice(0, testDefinitions.length), scriptTestContext);
|
|
51
|
-
const esmPath = "./esm/" + filePath;
|
|
52
|
-
console.log("\nRunning tests in " + pc.underline(esmPath) + "...\n");
|
|
53
|
-
process.chdir(__dirname + "/esm");
|
|
54
|
-
const esmTestContext = {
|
|
55
|
-
origin: pathToFileURL(filePath).toString(),
|
|
56
|
-
...testContext,
|
|
57
|
-
};
|
|
58
|
-
await import(esmPath);
|
|
59
|
-
await runTestDefinitions(testDefinitions.splice(0, testDefinitions.length), esmTestContext);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async function runTestDefinitions(testDefinitions, options) {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
const testFailures = [];
|
|
65
|
-
const hasOnly = testDefinitions.some((d) => d.only);
|
|
66
|
-
if (hasOnly) {
|
|
67
|
-
testDefinitions = testDefinitions.filter((d) => d.only);
|
|
68
|
-
}
|
|
69
|
-
for (const definition of testDefinitions) {
|
|
70
|
-
options.process.stdout.write("test " + definition.name + " ...");
|
|
71
|
-
if (definition.ignore) {
|
|
72
|
-
options.process.stdout.write(` ${options.pc.gray("ignored")}\n`);
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const context = getTestContext(definition, undefined);
|
|
76
|
-
let pass = false;
|
|
77
|
-
try {
|
|
78
|
-
await definition.fn(context);
|
|
79
|
-
if (context.hasFailingChild) {
|
|
80
|
-
testFailures.push({
|
|
81
|
-
name: definition.name,
|
|
82
|
-
err: new Error("Had failing test step.")
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
pass = true;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
testFailures.push({
|
|
91
|
-
name: definition.name,
|
|
92
|
-
err
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
const testStepOutput = context.getOutput();
|
|
96
|
-
if (testStepOutput.length > 0) {
|
|
97
|
-
options.process.stdout.write(testStepOutput);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
options.process.stdout.write(" ");
|
|
101
|
-
}
|
|
102
|
-
options.process.stdout.write(getStatusText(pass ? "ok" : "fail"));
|
|
103
|
-
options.process.stdout.write("\n");
|
|
104
|
-
}
|
|
105
|
-
if (testFailures.length > 0) {
|
|
106
|
-
options.process.stdout.write("\nFAILURES");
|
|
107
|
-
for (const failure of testFailures) {
|
|
108
|
-
options.process.stdout.write("\n\n");
|
|
109
|
-
options.process.stdout.write(failure.name + "\n");
|
|
110
|
-
options.process.stdout.write(indentText(((_b = (_a = failure.err) === null || _a === void 0 ? void 0 : _a.stack) !== null && _b !== void 0 ? _b : failure.err).toString(), 1));
|
|
111
|
-
}
|
|
112
|
-
options.process.exit(1);
|
|
113
|
-
}
|
|
114
|
-
else if (hasOnly) {
|
|
115
|
-
options.process.stdout.write('error: Test failed because the "only" option was used.\n');
|
|
116
|
-
options.process.exit(1);
|
|
117
|
-
}
|
|
118
|
-
function getTestContext(definition, parent) {
|
|
119
|
-
return {
|
|
120
|
-
name: definition.name,
|
|
121
|
-
parent,
|
|
122
|
-
origin: options.origin,
|
|
123
|
-
/** @type {any} */ err: undefined,
|
|
124
|
-
status: "ok",
|
|
125
|
-
children: [],
|
|
126
|
-
get hasFailingChild() {
|
|
127
|
-
return this.children.some((c) => c.status === "fail" || c.status === "pending");
|
|
128
|
-
},
|
|
129
|
-
getOutput() {
|
|
130
|
-
var _a;
|
|
131
|
-
let output = "";
|
|
132
|
-
if (this.parent) {
|
|
133
|
-
output += "test " + this.name + " ...";
|
|
134
|
-
}
|
|
135
|
-
if (this.children.length > 0) {
|
|
136
|
-
output += "\n" + this.children.map((c) => indentText(c.getOutput(), 1)).join("\n") + "\n";
|
|
137
|
-
}
|
|
138
|
-
else if (!this.err) {
|
|
139
|
-
output += " ";
|
|
140
|
-
}
|
|
141
|
-
if (this.parent && this.err) {
|
|
142
|
-
output += "\n";
|
|
143
|
-
}
|
|
144
|
-
if (this.err) {
|
|
145
|
-
output += indentText(((_a = this.err.stack) !== null && _a !== void 0 ? _a : this.err).toString(), 1);
|
|
146
|
-
if (this.parent) {
|
|
147
|
-
output += "\n";
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (this.parent) {
|
|
151
|
-
output += getStatusText(this.status);
|
|
152
|
-
}
|
|
153
|
-
return output;
|
|
154
|
-
},
|
|
155
|
-
async step(nameOrTestDefinition, fn) {
|
|
156
|
-
const definition = getDefinition();
|
|
157
|
-
const context = getTestContext(definition, this);
|
|
158
|
-
context.status = "pending";
|
|
159
|
-
this.children.push(context);
|
|
160
|
-
if (definition.ignore) {
|
|
161
|
-
context.status = "ignored";
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
try {
|
|
165
|
-
await definition.fn(context);
|
|
166
|
-
context.status = "ok";
|
|
167
|
-
if (context.hasFailingChild) {
|
|
168
|
-
context.status = "fail";
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
catch (err) {
|
|
174
|
-
context.status = "fail";
|
|
175
|
-
context.err = err;
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
/** @returns {TestDefinition} */ function getDefinition() {
|
|
179
|
-
if (typeof nameOrTestDefinition === "string") {
|
|
180
|
-
if (!(fn instanceof Function)) {
|
|
181
|
-
throw new TypeError("Expected function for second argument.");
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
name: nameOrTestDefinition,
|
|
185
|
-
fn
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
else if (typeof nameOrTestDefinition === "object") {
|
|
189
|
-
return nameOrTestDefinition;
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
throw new TypeError("Expected a test definition or name and function.");
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
function getStatusText(status) {
|
|
199
|
-
switch (status) {
|
|
200
|
-
case "ok":
|
|
201
|
-
return options.pc.green(status);
|
|
202
|
-
case "fail":
|
|
203
|
-
case "pending":
|
|
204
|
-
return options.pc.red(status);
|
|
205
|
-
case "ignored":
|
|
206
|
-
return options.pc.gray(status);
|
|
207
|
-
default:
|
|
208
|
-
{
|
|
209
|
-
const _assertNever = status;
|
|
210
|
-
return status;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function indentText(text, indentLevel) {
|
|
215
|
-
if (text === undefined) {
|
|
216
|
-
text = "[undefined]";
|
|
217
|
-
}
|
|
218
|
-
else if (text === null) {
|
|
219
|
-
text = "[null]";
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
text = text.toString();
|
|
223
|
-
}
|
|
224
|
-
return text.split(/\r?\n/).map((line) => " ".repeat(indentLevel) + line).join("\n");
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
main();
|