@goast/typescript 0.4.3 → 0.5.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/LICENSE +21 -21
- package/README.md +52 -52
- package/assets/client/angular/angular-service.utils.ts +82 -82
- package/assets/client/angular/request-builder.ts +377 -377
- package/assets/client/fetch/fetch-client.utils.ts +52 -52
- package/assets/client/k6/request-builder.js +418 -418
- package/assets/stubs/easy-network-stub/easy-network-stub.utils.ts +259 -259
- package/esm/_dnt.test_polyfills.d.ts +29 -0
- package/esm/_dnt.test_polyfills.d.ts.map +1 -0
- package/esm/_dnt.test_polyfills.js +31 -0
- package/esm/_dnt.test_shims.d.ts +6 -0
- package/esm/_dnt.test_shims.d.ts.map +1 -0
- package/esm/_dnt.test_shims.js +61 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/equal.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/equal.js +183 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/equals.d.ts +35 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/equals.js +58 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/false.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/false.js +22 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/is_error.d.ts +25 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/is_error.js +54 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/match.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.js +32 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/rejects.d.ts +42 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/rejects.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.js +57 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_equals.d.ts +20 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_equals.js +29 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.d.ts +14 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.js +43 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.d.ts +17 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.js +26 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assertions.d.ts +4 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assertions.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_assertions.js +13 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.d.ts +46 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.js +161 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_build_message.d.ts +6 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_build_message.js +29 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.d.ts +4 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.js +11 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_equal.d.ts +9 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_equal.js +191 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_extend.d.ts +4 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_extend.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_extend.js +11 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_inspect_args.d.ts +3 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_inspect_args.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_inspect_args.js +12 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_matchers.d.ts +34 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_matchers.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_matchers.js +714 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_mock_util.d.ts +11 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_mock_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_mock_util.js +10 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_serializer.d.ts +4 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_serializer.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_serializer.js +10 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_types.d.ts +843 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_types.js +3 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_utils.d.ts +9 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/_utils.js +218 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/expect.d.ts +60 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/expect.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/expect.js +523 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/fn.d.ts +29 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/fn.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/fn.js +85 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/mod.d.ts +86 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/expect/1.0.13/mod.js +88 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts +160 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.js +199 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +82 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js +111 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +140 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js +277 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +99 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js +180 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts +2 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.js +37 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +159 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js +207 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts +16 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.js +2 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/_mock_utils.d.ts +15 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/_mock_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/_mock_utils.js +35 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts +79 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.js +380 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts +738 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.js +654 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/mock.d.ts +674 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/mock.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/mock.js +1083 -0
- package/esm/src/assets.js +1 -1
- package/esm/src/ast/nodes/argument.test.d.ts +2 -0
- package/esm/src/ast/nodes/argument.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/argument.test.js +34 -0
- package/esm/src/ast/nodes/array-type.test.d.ts +2 -0
- package/esm/src/ast/nodes/array-type.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/array-type.test.js +26 -0
- package/esm/src/ast/nodes/arrow-function.test.d.ts +2 -0
- package/esm/src/ast/nodes/arrow-function.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/arrow-function.test.js +62 -0
- package/esm/src/ast/nodes/class.test.d.ts +2 -0
- package/esm/src/ast/nodes/class.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/class.test.js +150 -0
- package/esm/src/ast/nodes/constructor-parameter.test.d.ts +2 -0
- package/esm/src/ast/nodes/constructor-parameter.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/constructor-parameter.test.js +99 -0
- package/esm/src/ast/nodes/constructor.test.d.ts +2 -0
- package/esm/src/ast/nodes/constructor.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/constructor.test.js +102 -0
- package/esm/src/ast/nodes/decorator.test.d.ts +2 -0
- package/esm/src/ast/nodes/decorator.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/decorator.test.js +47 -0
- package/esm/src/ast/nodes/doc-tag.test.d.ts +2 -0
- package/esm/src/ast/nodes/doc-tag.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/doc-tag.test.js +30 -0
- package/esm/src/ast/nodes/doc.test.d.ts +2 -0
- package/esm/src/ast/nodes/doc.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/doc.test.js +31 -0
- package/esm/src/ast/nodes/enum-value.test.d.ts +2 -0
- package/esm/src/ast/nodes/enum-value.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/enum-value.test.js +52 -0
- package/esm/src/ast/nodes/enum.test.d.ts +2 -0
- package/esm/src/ast/nodes/enum.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/enum.test.js +66 -0
- package/esm/src/ast/nodes/export.test.d.ts +2 -0
- package/esm/src/ast/nodes/export.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/export.test.js +22 -0
- package/esm/src/ast/nodes/function-type.test.d.ts +2 -0
- package/esm/src/ast/nodes/function-type.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/function-type.test.js +48 -0
- package/esm/src/ast/nodes/function.test.d.ts +2 -0
- package/esm/src/ast/nodes/function.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/function.test.js +108 -0
- package/esm/src/ast/nodes/generic-parameter.test.d.ts +2 -0
- package/esm/src/ast/nodes/generic-parameter.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/generic-parameter.test.js +70 -0
- package/esm/src/ast/nodes/indexer.test.d.ts +2 -0
- package/esm/src/ast/nodes/indexer.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/indexer.test.js +32 -0
- package/esm/src/ast/nodes/interface.test.d.ts +2 -0
- package/esm/src/ast/nodes/interface.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/interface.test.js +115 -0
- package/esm/src/ast/nodes/intersection-type.test.d.ts +2 -0
- package/esm/src/ast/nodes/intersection-type.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/intersection-type.test.js +38 -0
- package/esm/src/ast/nodes/method.test.d.ts +2 -0
- package/esm/src/ast/nodes/method.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/method.test.js +148 -0
- package/esm/src/ast/nodes/object-type.test.d.ts +2 -0
- package/esm/src/ast/nodes/object-type.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/object-type.test.js +30 -0
- package/esm/src/ast/nodes/object.test.d.ts +2 -0
- package/esm/src/ast/nodes/object.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/object.test.js +30 -0
- package/esm/src/ast/nodes/parameter.test.d.ts +2 -0
- package/esm/src/ast/nodes/parameter.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/parameter.test.js +71 -0
- package/esm/src/ast/nodes/property-accessor.test.d.ts +2 -0
- package/esm/src/ast/nodes/property-accessor.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/property-accessor.test.js +102 -0
- package/esm/src/ast/nodes/property.test.d.ts +2 -0
- package/esm/src/ast/nodes/property.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/property.test.js +89 -0
- package/esm/src/ast/nodes/reference.test.d.ts +2 -0
- package/esm/src/ast/nodes/reference.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/reference.test.js +31 -0
- package/esm/src/ast/nodes/string.test.d.ts +2 -0
- package/esm/src/ast/nodes/string.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/string.test.js +28 -0
- package/esm/src/ast/nodes/tuple.test.d.ts +2 -0
- package/esm/src/ast/nodes/tuple.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/tuple.test.js +33 -0
- package/esm/src/ast/nodes/type-alias.test.d.ts +2 -0
- package/esm/src/ast/nodes/type-alias.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/type-alias.test.js +27 -0
- package/esm/src/ast/nodes/union-type.test.d.ts +2 -0
- package/esm/src/ast/nodes/union-type.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/union-type.test.js +38 -0
- package/esm/src/ast/nodes/variable.test.d.ts +2 -0
- package/esm/src/ast/nodes/variable.test.d.ts.map +1 -0
- package/esm/src/ast/nodes/variable.test.js +38 -0
- package/esm/src/generators/services/angular-services/angular-service-generator.d.ts +1 -0
- package/esm/src/generators/services/angular-services/angular-service-generator.d.ts.map +1 -1
- package/esm/src/generators/services/angular-services/angular-service-generator.js +31 -30
- package/esm/src/generators/services/angular-services/models.d.ts +6 -1
- package/esm/src/generators/services/angular-services/models.d.ts.map +1 -1
- package/esm/src/generators/services/angular-services/models.js +2 -1
- package/esm/src/generators/services/easy-network-stub/easy-network-stub-generator.js +9 -9
- package/esm/src/generators/services/fetch-clients/fetch-client-generator.js +2 -2
- package/esm/src/generators/services/k6-clients/k6-client-generator.js +6 -6
- package/esm/src/import-collection.test.d.ts +2 -0
- package/esm/src/import-collection.test.d.ts.map +1 -0
- package/esm/src/import-collection.test.js +64 -0
- package/esm/tests/openapi-models.test.d.ts +2 -0
- package/esm/tests/openapi-models.test.d.ts.map +1 -0
- package/esm/tests/openapi-models.test.js +45 -0
- package/package.json +2 -2
- package/script/_dnt.test_polyfills.d.ts +29 -0
- package/script/_dnt.test_polyfills.d.ts.map +1 -0
- package/script/_dnt.test_polyfills.js +32 -0
- package/script/_dnt.test_shims.d.ts +6 -0
- package/script/_dnt.test_shims.d.ts.map +1 -0
- package/script/_dnt.test_shims.js +65 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts +26 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.js +34 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/equal.d.ts +17 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/equal.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/equal.js +187 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/equals.d.ts +35 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/equals.js +61 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/false.d.ts +18 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/false.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/false.js +25 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts +23 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.js +56 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/is_error.d.ts +25 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/is_error.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/is_error.js +57 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/match.d.ts +18 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/match.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/match.js +29 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts +20 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.js +32 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts +18 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_match.js +29 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts +23 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.js +35 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/rejects.d.ts +42 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/rejects.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/rejects.js +56 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts +24 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.js +60 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_equals.d.ts +20 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_equals.js +32 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.d.ts +14 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.js +46 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.d.ts +17 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.js +29 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assertions.d.ts +4 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assertions.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_assertions.js +18 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.d.ts +46 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.js +183 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_build_message.d.ts +6 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_build_message.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_build_message.js +33 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.d.ts +4 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.js +15 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_equal.d.ts +9 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_equal.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_equal.js +194 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_extend.d.ts +4 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_extend.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_extend.js +15 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_inspect_args.d.ts +3 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_inspect_args.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_inspect_args.js +17 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_matchers.d.ts +34 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_matchers.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_matchers.js +748 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_mock_util.d.ts +11 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_mock_util.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_mock_util.js +14 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_serializer.d.ts +4 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_serializer.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_serializer.js +14 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_types.d.ts +843 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_types.js +4 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_utils.d.ts +9 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_utils.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/_utils.js +226 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/expect.d.ts +60 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/expect.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/expect.js +527 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/fn.d.ts +29 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/fn.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/fn.js +88 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/mod.d.ts +86 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/expect/1.0.13/mod.js +91 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts +160 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.js +204 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +82 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/build_message.js +116 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +140 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/diff.js +284 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +99 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.js +186 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts +2 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/format.js +41 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +159 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/styles.js +220 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts +16 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/types.js +3 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/_mock_utils.d.ts +15 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/_mock_utils.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/_mock_utils.js +41 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts +79 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.js +385 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts +738 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/bdd.js +665 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/mock.d.ts +674 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/mock.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/mock.js +1102 -0
- package/script/src/assets.js +1 -1
- package/script/src/ast/nodes/argument.test.d.ts +2 -0
- package/script/src/ast/nodes/argument.test.d.ts.map +1 -0
- package/script/src/ast/nodes/argument.test.js +36 -0
- package/script/src/ast/nodes/array-type.test.d.ts +2 -0
- package/script/src/ast/nodes/array-type.test.d.ts.map +1 -0
- package/script/src/ast/nodes/array-type.test.js +28 -0
- package/script/src/ast/nodes/arrow-function.test.d.ts +2 -0
- package/script/src/ast/nodes/arrow-function.test.d.ts.map +1 -0
- package/script/src/ast/nodes/arrow-function.test.js +64 -0
- package/script/src/ast/nodes/class.test.d.ts +2 -0
- package/script/src/ast/nodes/class.test.d.ts.map +1 -0
- package/script/src/ast/nodes/class.test.js +152 -0
- package/script/src/ast/nodes/constructor-parameter.test.d.ts +2 -0
- package/script/src/ast/nodes/constructor-parameter.test.d.ts.map +1 -0
- package/script/src/ast/nodes/constructor-parameter.test.js +101 -0
- package/script/src/ast/nodes/constructor.test.d.ts +2 -0
- package/script/src/ast/nodes/constructor.test.d.ts.map +1 -0
- package/script/src/ast/nodes/constructor.test.js +104 -0
- package/script/src/ast/nodes/decorator.test.d.ts +2 -0
- package/script/src/ast/nodes/decorator.test.d.ts.map +1 -0
- package/script/src/ast/nodes/decorator.test.js +49 -0
- package/script/src/ast/nodes/doc-tag.test.d.ts +2 -0
- package/script/src/ast/nodes/doc-tag.test.d.ts.map +1 -0
- package/script/src/ast/nodes/doc-tag.test.js +32 -0
- package/script/src/ast/nodes/doc.test.d.ts +2 -0
- package/script/src/ast/nodes/doc.test.d.ts.map +1 -0
- package/script/src/ast/nodes/doc.test.js +33 -0
- package/script/src/ast/nodes/enum-value.test.d.ts +2 -0
- package/script/src/ast/nodes/enum-value.test.d.ts.map +1 -0
- package/script/src/ast/nodes/enum-value.test.js +54 -0
- package/script/src/ast/nodes/enum.test.d.ts +2 -0
- package/script/src/ast/nodes/enum.test.d.ts.map +1 -0
- package/script/src/ast/nodes/enum.test.js +68 -0
- package/script/src/ast/nodes/export.test.d.ts +2 -0
- package/script/src/ast/nodes/export.test.d.ts.map +1 -0
- package/script/src/ast/nodes/export.test.js +24 -0
- package/script/src/ast/nodes/function-type.test.d.ts +2 -0
- package/script/src/ast/nodes/function-type.test.d.ts.map +1 -0
- package/script/src/ast/nodes/function-type.test.js +50 -0
- package/script/src/ast/nodes/function.test.d.ts +2 -0
- package/script/src/ast/nodes/function.test.d.ts.map +1 -0
- package/script/src/ast/nodes/function.test.js +110 -0
- package/script/src/ast/nodes/generic-parameter.test.d.ts +2 -0
- package/script/src/ast/nodes/generic-parameter.test.d.ts.map +1 -0
- package/script/src/ast/nodes/generic-parameter.test.js +72 -0
- package/script/src/ast/nodes/indexer.test.d.ts +2 -0
- package/script/src/ast/nodes/indexer.test.d.ts.map +1 -0
- package/script/src/ast/nodes/indexer.test.js +34 -0
- package/script/src/ast/nodes/interface.test.d.ts +2 -0
- package/script/src/ast/nodes/interface.test.d.ts.map +1 -0
- package/script/src/ast/nodes/interface.test.js +117 -0
- package/script/src/ast/nodes/intersection-type.test.d.ts +2 -0
- package/script/src/ast/nodes/intersection-type.test.d.ts.map +1 -0
- package/script/src/ast/nodes/intersection-type.test.js +40 -0
- package/script/src/ast/nodes/method.test.d.ts +2 -0
- package/script/src/ast/nodes/method.test.d.ts.map +1 -0
- package/script/src/ast/nodes/method.test.js +150 -0
- package/script/src/ast/nodes/object-type.test.d.ts +2 -0
- package/script/src/ast/nodes/object-type.test.d.ts.map +1 -0
- package/script/src/ast/nodes/object-type.test.js +32 -0
- package/script/src/ast/nodes/object.test.d.ts +2 -0
- package/script/src/ast/nodes/object.test.d.ts.map +1 -0
- package/script/src/ast/nodes/object.test.js +32 -0
- package/script/src/ast/nodes/parameter.test.d.ts +2 -0
- package/script/src/ast/nodes/parameter.test.d.ts.map +1 -0
- package/script/src/ast/nodes/parameter.test.js +73 -0
- package/script/src/ast/nodes/property-accessor.test.d.ts +2 -0
- package/script/src/ast/nodes/property-accessor.test.d.ts.map +1 -0
- package/script/src/ast/nodes/property-accessor.test.js +104 -0
- package/script/src/ast/nodes/property.test.d.ts +2 -0
- package/script/src/ast/nodes/property.test.d.ts.map +1 -0
- package/script/src/ast/nodes/property.test.js +91 -0
- package/script/src/ast/nodes/reference.test.d.ts +2 -0
- package/script/src/ast/nodes/reference.test.d.ts.map +1 -0
- package/script/src/ast/nodes/reference.test.js +33 -0
- package/script/src/ast/nodes/string.test.d.ts +2 -0
- package/script/src/ast/nodes/string.test.d.ts.map +1 -0
- package/script/src/ast/nodes/string.test.js +30 -0
- package/script/src/ast/nodes/tuple.test.d.ts +2 -0
- package/script/src/ast/nodes/tuple.test.d.ts.map +1 -0
- package/script/src/ast/nodes/tuple.test.js +35 -0
- package/script/src/ast/nodes/type-alias.test.d.ts +2 -0
- package/script/src/ast/nodes/type-alias.test.d.ts.map +1 -0
- package/script/src/ast/nodes/type-alias.test.js +29 -0
- package/script/src/ast/nodes/union-type.test.d.ts +2 -0
- package/script/src/ast/nodes/union-type.test.d.ts.map +1 -0
- package/script/src/ast/nodes/union-type.test.js +40 -0
- package/script/src/ast/nodes/variable.test.d.ts +2 -0
- package/script/src/ast/nodes/variable.test.d.ts.map +1 -0
- package/script/src/ast/nodes/variable.test.js +40 -0
- package/script/src/generators/services/angular-services/angular-service-generator.d.ts +1 -0
- package/script/src/generators/services/angular-services/angular-service-generator.d.ts.map +1 -1
- package/script/src/generators/services/angular-services/angular-service-generator.js +31 -30
- package/script/src/generators/services/angular-services/models.d.ts +6 -1
- package/script/src/generators/services/angular-services/models.d.ts.map +1 -1
- package/script/src/generators/services/angular-services/models.js +2 -1
- package/script/src/generators/services/easy-network-stub/easy-network-stub-generator.js +9 -9
- package/script/src/generators/services/fetch-clients/fetch-client-generator.js +2 -2
- package/script/src/generators/services/k6-clients/k6-client-generator.js +6 -6
- package/script/src/import-collection.test.d.ts +2 -0
- package/script/src/import-collection.test.d.ts.map +1 -0
- package/script/src/import-collection.test.js +66 -0
- package/script/tests/openapi-models.test.d.ts +2 -0
- package/script/tests/openapi-models.test.d.ts.map +1 -0
- package/script/tests/openapi-models.test.js +48 -0
- package/src/_dnt.test_polyfills.ts +70 -0
- package/src/_dnt.test_shims.ts +64 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/assertion_error.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/equal.ts +210 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/equals.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/false.ts +26 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/instance_of.ts +64 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/is_error.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/not_instance_of.ts +33 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/not_match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.ts +42 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/rejects.ts +123 -0
- package/src/deps/jsr.io/@std/assert/1.0.11/strict_equals.ts +67 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_assert_equals.ts +38 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_assert_is_error.ts +54 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_assert_not_equals.ts +35 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_assertions.ts +18 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_asymmetric_matchers.ts +198 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_build_message.ts +51 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_custom_equality_tester.ts +19 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_equal.ts +230 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_extend.ts +16 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_inspect_args.ts +15 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_matchers.ts +1028 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_mock_util.ts +22 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_serializer.ts +15 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_types.ts +923 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/_utils.ts +283 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/expect.ts +620 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/fn.ts +91 -0
- package/src/deps/jsr.io/@std/expect/1.0.13/mod.ts +89 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/assertion_state.ts +214 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/build_message.ts +134 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/diff.ts +317 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/diff_str.ts +204 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/format.ts +39 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/styles.ts +233 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/types.ts +18 -0
- package/src/deps/jsr.io/@std/testing/1.0.9/_mock_utils.ts +43 -0
- package/src/deps/jsr.io/@std/testing/1.0.9/_test_suite.ts +448 -0
- package/src/deps/jsr.io/@std/testing/1.0.9/bdd.ts +1288 -0
- package/src/deps/jsr.io/@std/testing/1.0.9/mock.ts +1807 -0
- package/src/mod.ts +7 -0
- package/src/src/assets.ts +9 -0
- package/src/src/ast/_index.ts +54 -0
- package/src/src/ast/common.ts +1 -0
- package/src/src/ast/index.ts +1 -0
- package/src/src/ast/node.ts +10 -0
- package/src/src/ast/nodes/argument.test.ts +43 -0
- package/src/src/ast/nodes/argument.ts +40 -0
- package/src/src/ast/nodes/array-type.test.ts +34 -0
- package/src/src/ast/nodes/array-type.ts +49 -0
- package/src/src/ast/nodes/arrow-function.test.ts +79 -0
- package/src/src/ast/nodes/arrow-function.ts +91 -0
- package/src/src/ast/nodes/call.ts +55 -0
- package/src/src/ast/nodes/class.test.ts +185 -0
- package/src/src/ast/nodes/class.ts +133 -0
- package/src/src/ast/nodes/constructor-parameter.test.ts +122 -0
- package/src/src/ast/nodes/constructor-parameter.ts +70 -0
- package/src/src/ast/nodes/constructor.test.ts +131 -0
- package/src/src/ast/nodes/constructor.ts +77 -0
- package/src/src/ast/nodes/decorator.test.ts +59 -0
- package/src/src/ast/nodes/decorator.ts +76 -0
- package/src/src/ast/nodes/doc-tag.test.ts +40 -0
- package/src/src/ast/nodes/doc-tag.ts +291 -0
- package/src/src/ast/nodes/doc.test.ts +40 -0
- package/src/src/ast/nodes/doc.ts +102 -0
- package/src/src/ast/nodes/enum-value.test.ts +66 -0
- package/src/src/ast/nodes/enum-value.ts +72 -0
- package/src/src/ast/nodes/enum.test.ts +85 -0
- package/src/src/ast/nodes/enum.ts +77 -0
- package/src/src/ast/nodes/export.test.ts +29 -0
- package/src/src/ast/nodes/export.ts +54 -0
- package/src/src/ast/nodes/function-type.test.ts +61 -0
- package/src/src/ast/nodes/function-type.ts +60 -0
- package/src/src/ast/nodes/function.test.ts +135 -0
- package/src/src/ast/nodes/function.ts +107 -0
- package/src/src/ast/nodes/generic-parameter.test.ts +86 -0
- package/src/src/ast/nodes/generic-parameter.ts +71 -0
- package/src/src/ast/nodes/indexer.test.ts +42 -0
- package/src/src/ast/nodes/indexer.ts +60 -0
- package/src/src/ast/nodes/interface.test.ts +142 -0
- package/src/src/ast/nodes/interface.ts +117 -0
- package/src/src/ast/nodes/intersection-type.test.ts +52 -0
- package/src/src/ast/nodes/intersection-type.ts +67 -0
- package/src/src/ast/nodes/lookup-type.ts +53 -0
- package/src/src/ast/nodes/method.test.ts +185 -0
- package/src/src/ast/nodes/method.ts +138 -0
- package/src/src/ast/nodes/object-type.test.ts +40 -0
- package/src/src/ast/nodes/object-type.ts +52 -0
- package/src/src/ast/nodes/object.test.ts +40 -0
- package/src/src/ast/nodes/object.ts +48 -0
- package/src/src/ast/nodes/parameter.test.ts +88 -0
- package/src/src/ast/nodes/parameter.ts +85 -0
- package/src/src/ast/nodes/property-accessor.test.ts +132 -0
- package/src/src/ast/nodes/property-accessor.ts +173 -0
- package/src/src/ast/nodes/property.test.ts +113 -0
- package/src/src/ast/nodes/property.ts +192 -0
- package/src/src/ast/nodes/reference.test.ts +42 -0
- package/src/src/ast/nodes/reference.ts +194 -0
- package/src/src/ast/nodes/string.test.ts +35 -0
- package/src/src/ast/nodes/string.ts +49 -0
- package/src/src/ast/nodes/tuple.test.ts +45 -0
- package/src/src/ast/nodes/tuple.ts +53 -0
- package/src/src/ast/nodes/type-alias.test.ts +35 -0
- package/src/src/ast/nodes/type-alias.ts +75 -0
- package/src/src/ast/nodes/typeof.ts +42 -0
- package/src/src/ast/nodes/types.ts +40 -0
- package/src/src/ast/nodes/union-type.test.ts +50 -0
- package/src/src/ast/nodes/union-type.ts +62 -0
- package/src/src/ast/nodes/variable.test.ts +49 -0
- package/src/src/ast/nodes/variable.ts +73 -0
- package/src/src/ast/references/angular.ts +24 -0
- package/src/src/ast/references/easy-network-stub.ts +21 -0
- package/src/src/ast/references/index.ts +5 -0
- package/src/src/ast/references/k6.ts +8 -0
- package/src/src/ast/references/rxjs.ts +7 -0
- package/src/src/ast/references/typescript.ts +35 -0
- package/src/src/ast/utils/get-type-script-builder-options.ts +19 -0
- package/src/src/ast/utils/to-ts-node.ts +27 -0
- package/src/src/ast/utils/write-ts-generic-parameters.ts +25 -0
- package/src/src/ast/utils/write-ts-members.ts +28 -0
- package/src/src/ast/utils/write-ts-nodes.ts +35 -0
- package/src/src/ast/utils/write-ts-parameters.ts +25 -0
- package/src/src/common-results.ts +26 -0
- package/src/src/config.ts +89 -0
- package/src/src/file-builder.ts +136 -0
- package/src/src/generators/file-generator.ts +15 -0
- package/src/src/generators/index.ts +6 -0
- package/src/src/generators/models/index.ts +3 -0
- package/src/src/generators/models/model-generator.ts +469 -0
- package/src/src/generators/models/models-generator.ts +108 -0
- package/src/src/generators/models/models.ts +112 -0
- package/src/src/generators/services/angular-services/angular-service-generator.ts +406 -0
- package/src/src/generators/services/angular-services/angular-services-generator.ts +295 -0
- package/src/src/generators/services/angular-services/index.ts +3 -0
- package/src/src/generators/services/angular-services/models.ts +277 -0
- package/src/src/generators/services/angular-services/refs.ts +54 -0
- package/src/src/generators/services/easy-network-stub/easy-network-stub-generator.ts +242 -0
- package/src/src/generators/services/easy-network-stub/easy-network-stubs-generator.ts +211 -0
- package/src/src/generators/services/easy-network-stub/index.ts +3 -0
- package/src/src/generators/services/easy-network-stub/models.ts +124 -0
- package/src/src/generators/services/easy-network-stub/refs.ts +45 -0
- package/src/src/generators/services/fetch-clients/fetch-client-generator.ts +267 -0
- package/src/src/generators/services/fetch-clients/fetch-clients-generator.ts +163 -0
- package/src/src/generators/services/fetch-clients/index.ts +3 -0
- package/src/src/generators/services/fetch-clients/models.ts +130 -0
- package/src/src/generators/services/fetch-clients/refs.ts +21 -0
- package/src/src/generators/services/k6-clients/index.ts +3 -0
- package/src/src/generators/services/k6-clients/k6-client-generator.ts +409 -0
- package/src/src/generators/services/k6-clients/k6-clients-generator.ts +165 -0
- package/src/src/generators/services/k6-clients/models.ts +241 -0
- package/src/src/generators/services/k6-clients/refs.ts +15 -0
- package/src/src/import-collection.test.ts +78 -0
- package/src/src/import-collection.ts +236 -0
- package/src/src/utils.ts +72 -0
- package/src/tests/openapi-models.test.ts +64 -0
- package/test_runner.js +239 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ApiSchema,
|
|
3
|
+
ApiService,
|
|
4
|
+
DefaultGenerationProviderConfig,
|
|
5
|
+
ExtendedStringCasing,
|
|
6
|
+
Nullable,
|
|
7
|
+
OpenApiServicesGenerationProviderContext,
|
|
8
|
+
} from '@goast/core';
|
|
9
|
+
|
|
10
|
+
import type { ts } from '../../../ast/index.js';
|
|
11
|
+
import type { TypeScriptExportOutput } from '../../../common-results.js';
|
|
12
|
+
import { defaultTypeScriptGeneratorConfig, type TypeScriptGeneratorConfig } from '../../../config.js';
|
|
13
|
+
import type { TypeScriptFileBuilder } from '../../../file-builder.js';
|
|
14
|
+
import type { TypeScriptModelsGeneratorOutput } from '../../models/index.js';
|
|
15
|
+
import type { getReferenceFactories } from './refs.js';
|
|
16
|
+
|
|
17
|
+
export type TypeScriptK6ClientsGeneratorConfig = TypeScriptGeneratorConfig & {
|
|
18
|
+
/**
|
|
19
|
+
* Whether to use strict response types for the services.
|
|
20
|
+
* If enabled only the status codes are included that are defined in the OpenAPI specification or the `defaultStatusCodeResponseTypes` option.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
strictResponseTypes: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The default response types for status codes that are not defined in the OpenAPI specification.
|
|
27
|
+
* @example
|
|
28
|
+
* {
|
|
29
|
+
* 400: {
|
|
30
|
+
* parser: 'json',
|
|
31
|
+
* type: schemas =>
|
|
32
|
+
* schemas.find(s => s.name === 'BadRequestResponse')
|
|
33
|
+
* ?? throwExp('BadRequestResponse not found'),
|
|
34
|
+
* },
|
|
35
|
+
* 404: null,
|
|
36
|
+
* 500: {
|
|
37
|
+
* parser: 'json',
|
|
38
|
+
* type: ts.refs.any(),
|
|
39
|
+
* },
|
|
40
|
+
* }
|
|
41
|
+
* @default
|
|
42
|
+
* {
|
|
43
|
+
* 401: null,
|
|
44
|
+
* 403: null,
|
|
45
|
+
* 500: null,
|
|
46
|
+
* }
|
|
47
|
+
*/
|
|
48
|
+
defaultStatusCodeResponseTypes: Record<
|
|
49
|
+
number,
|
|
50
|
+
{
|
|
51
|
+
parser: 'text' | 'json';
|
|
52
|
+
// deno-lint-ignore ban-types
|
|
53
|
+
type: Exclude<ts.Type<TypeScriptFileBuilder>, Function> | ((schemas: readonly ApiSchema[]) => ApiSchema);
|
|
54
|
+
} | null
|
|
55
|
+
>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The possible status codes that any API endpoint can return.
|
|
59
|
+
* This is only used when `strictResponseTypes` is set to `false`.
|
|
60
|
+
* @default
|
|
61
|
+
* [100, 101, 102, 103, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 421, 422, 423, 424, 425, 426, 428, 429, 431, 451, 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, 511]
|
|
62
|
+
*/
|
|
63
|
+
possibleStatusCodes: number[];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The casing of the client file names. If nullish, the `fileNameCasing` is used.
|
|
67
|
+
* @default { casing: 'kebab', suffix: '-client' }
|
|
68
|
+
*/
|
|
69
|
+
clientFileNameCasing: Nullable<ExtendedStringCasing>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The casing of the file names for the response models. If nullish, the `fileNameCasing` is used.
|
|
73
|
+
* @default { casing: 'kebab', suffix: '-responses' }
|
|
74
|
+
*/
|
|
75
|
+
responseModelFileNameCasing: Nullable<ExtendedStringCasing>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The casing of the client names. If nullish, the `typeNameCasing` is used.
|
|
79
|
+
* @default { casing: 'pascal', suffix: 'Client' }
|
|
80
|
+
*/
|
|
81
|
+
clientNameCasing: Nullable<ExtendedStringCasing>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The directory where the client files should be saved. The path is relative to the output directory.
|
|
85
|
+
* @default 'clients'
|
|
86
|
+
*/
|
|
87
|
+
clientDir: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The directory where the response models should be saved. The path is relative to the output directory.
|
|
91
|
+
* @default 'models/responses'
|
|
92
|
+
*/
|
|
93
|
+
responseModelsDir: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The index file where all clients should be exported. The path is relative to the output directory. If nullish, no index file will be generated.
|
|
97
|
+
* @default 'clients.ts'
|
|
98
|
+
*/
|
|
99
|
+
clientsIndexFile: Nullable<string>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The path to the index file where all response models should be exported. The path is relative to the output directory. If nullish, no index file will be generated.
|
|
103
|
+
* @default 'responses.ts'
|
|
104
|
+
*/
|
|
105
|
+
responseModelsIndexFile: Nullable<string>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The directory where the utilies should be saved. The path is relative to the output directory.
|
|
109
|
+
* @default 'utils'
|
|
110
|
+
*/
|
|
111
|
+
utilsDir: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Whether to generate clients calling the async API of k6.
|
|
115
|
+
* @default true
|
|
116
|
+
*/
|
|
117
|
+
async: boolean;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const defaultTypeScriptK6ClientsGeneratorConfig: DefaultGenerationProviderConfig<
|
|
121
|
+
TypeScriptK6ClientsGeneratorConfig
|
|
122
|
+
> = {
|
|
123
|
+
...defaultTypeScriptGeneratorConfig,
|
|
124
|
+
importModuleTransformer: 'js-extension',
|
|
125
|
+
|
|
126
|
+
strictResponseTypes: true,
|
|
127
|
+
defaultStatusCodeResponseTypes: {
|
|
128
|
+
401: null,
|
|
129
|
+
403: null,
|
|
130
|
+
500: null,
|
|
131
|
+
},
|
|
132
|
+
possibleStatusCodes: [
|
|
133
|
+
100,
|
|
134
|
+
101,
|
|
135
|
+
102,
|
|
136
|
+
103,
|
|
137
|
+
200,
|
|
138
|
+
201,
|
|
139
|
+
202,
|
|
140
|
+
203,
|
|
141
|
+
204,
|
|
142
|
+
205,
|
|
143
|
+
206,
|
|
144
|
+
207,
|
|
145
|
+
208,
|
|
146
|
+
226,
|
|
147
|
+
300,
|
|
148
|
+
301,
|
|
149
|
+
302,
|
|
150
|
+
303,
|
|
151
|
+
304,
|
|
152
|
+
305,
|
|
153
|
+
306,
|
|
154
|
+
307,
|
|
155
|
+
308,
|
|
156
|
+
400,
|
|
157
|
+
401,
|
|
158
|
+
402,
|
|
159
|
+
403,
|
|
160
|
+
404,
|
|
161
|
+
405,
|
|
162
|
+
406,
|
|
163
|
+
407,
|
|
164
|
+
408,
|
|
165
|
+
409,
|
|
166
|
+
410,
|
|
167
|
+
411,
|
|
168
|
+
412,
|
|
169
|
+
413,
|
|
170
|
+
414,
|
|
171
|
+
415,
|
|
172
|
+
416,
|
|
173
|
+
417,
|
|
174
|
+
421,
|
|
175
|
+
422,
|
|
176
|
+
423,
|
|
177
|
+
424,
|
|
178
|
+
425,
|
|
179
|
+
426,
|
|
180
|
+
428,
|
|
181
|
+
429,
|
|
182
|
+
431,
|
|
183
|
+
451,
|
|
184
|
+
500,
|
|
185
|
+
501,
|
|
186
|
+
502,
|
|
187
|
+
503,
|
|
188
|
+
504,
|
|
189
|
+
505,
|
|
190
|
+
506,
|
|
191
|
+
507,
|
|
192
|
+
508,
|
|
193
|
+
510,
|
|
194
|
+
511,
|
|
195
|
+
],
|
|
196
|
+
|
|
197
|
+
clientFileNameCasing: { casing: 'kebab', suffix: '-client' },
|
|
198
|
+
responseModelFileNameCasing: { casing: 'kebab', suffix: '-responses' },
|
|
199
|
+
clientNameCasing: { casing: 'pascal', suffix: 'Client' },
|
|
200
|
+
clientDir: 'clients',
|
|
201
|
+
responseModelsDir: 'models/responses',
|
|
202
|
+
clientsIndexFile: 'clients.js',
|
|
203
|
+
responseModelsIndexFile: 'responses.ts',
|
|
204
|
+
utilsDir: 'utils',
|
|
205
|
+
async: true,
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export type TypeScriptK6ClientsGeneratorInput = TypeScriptModelsGeneratorOutput;
|
|
209
|
+
|
|
210
|
+
export type TypeScriptK6ClientsGeneratorOutput = {
|
|
211
|
+
typescript: {
|
|
212
|
+
k6Clients: {
|
|
213
|
+
[serviceId: string]: TypeScriptK6ClientGeneratorOutput;
|
|
214
|
+
};
|
|
215
|
+
indexFiles: {
|
|
216
|
+
k6Clients: Nullable<string>;
|
|
217
|
+
k6ResponseModels: Nullable<string>;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export type TypeScriptK6ClientGeneratorOutput = TypeScriptExportOutput & {
|
|
223
|
+
responseModels: {
|
|
224
|
+
[operationId: string]: TypeScriptExportOutput;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export type TypeScriptK6ClientsGeneratorContext =
|
|
229
|
+
& OpenApiServicesGenerationProviderContext<
|
|
230
|
+
TypeScriptK6ClientsGeneratorInput,
|
|
231
|
+
TypeScriptK6ClientsGeneratorOutput,
|
|
232
|
+
TypeScriptK6ClientsGeneratorConfig,
|
|
233
|
+
TypeScriptK6ClientGeneratorOutput
|
|
234
|
+
>
|
|
235
|
+
& {
|
|
236
|
+
refs: ReturnType<typeof getReferenceFactories>;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export type TypeScriptK6ClientGeneratorContext = TypeScriptK6ClientsGeneratorContext & {
|
|
240
|
+
readonly service: ApiService;
|
|
241
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { join, resolve } from 'node:path';
|
|
2
|
+
|
|
3
|
+
import { ts } from '../../../ast/index.js';
|
|
4
|
+
import type { TypeScriptK6ClientsGeneratorConfig } from './models.js';
|
|
5
|
+
|
|
6
|
+
export function getReferenceFactories(options: TypeScriptK6ClientsGeneratorConfig): {
|
|
7
|
+
requestBuilder: ts.ModuleReferenceFactory;
|
|
8
|
+
httpStatusCode: ts.ModuleReferenceFactory;
|
|
9
|
+
} {
|
|
10
|
+
const utilsDirPath = resolve(options.outputDir, options.utilsDir);
|
|
11
|
+
return {
|
|
12
|
+
requestBuilder: ts.reference.factory('RequestBuilder', join(utilsDirPath, 'request-builder.js')),
|
|
13
|
+
httpStatusCode: ts.reference.factory('HttpStatusCode', join(utilsDirPath, 'http-status-code.ts')),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import "../_dnt.test_polyfills.js";
|
|
2
|
+
import type { SourceBuilderOptions } from '@goast/core';
|
|
3
|
+
|
|
4
|
+
import { expect } from '../deps/jsr.io/@std/expect/1.0.13/mod.js';
|
|
5
|
+
import { beforeEach, describe, it } from '../deps/jsr.io/@std/testing/1.0.9/bdd.js';
|
|
6
|
+
|
|
7
|
+
import { ImportExportCollection } from './import-collection.js';
|
|
8
|
+
|
|
9
|
+
describe('ImportExportCollection', () => {
|
|
10
|
+
let collection: ImportExportCollection;
|
|
11
|
+
let sourceBuilderOptions: Partial<SourceBuilderOptions>;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
collection = new ImportExportCollection({ importModuleTransformer: 'omit-extension' });
|
|
15
|
+
sourceBuilderOptions = { newLine: '\n' };
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('addImport', () => {
|
|
19
|
+
it('should add a new import to the collection', () => {
|
|
20
|
+
collection.addImport('myImport', 'myModule');
|
|
21
|
+
expect(collection.hasImports).toBe(true);
|
|
22
|
+
expect(collection.hasExports).toBe(false);
|
|
23
|
+
expect(collection.toString(sourceBuilderOptions)).toBe("import { myImport } from 'myModule';\n");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should add a new import to an existing module', () => {
|
|
27
|
+
collection.addImport('myImport1', 'myModule');
|
|
28
|
+
collection.addImport('myImport2', 'myModule');
|
|
29
|
+
expect(collection.hasImports).toBe(true);
|
|
30
|
+
expect(collection.hasExports).toBe(false);
|
|
31
|
+
expect(collection.toString(sourceBuilderOptions)).toBe("import { myImport1, myImport2 } from 'myModule';\n");
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('addExport', () => {
|
|
36
|
+
it('should add a new export to the collection', () => {
|
|
37
|
+
collection.addExport('myExport', 'myModule');
|
|
38
|
+
expect(collection.hasImports).toBe(false);
|
|
39
|
+
expect(collection.hasExports).toBe(true);
|
|
40
|
+
expect(collection.toString(sourceBuilderOptions)).toBe("export { myExport } from 'myModule';\n");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should add a new export to an existing module', () => {
|
|
44
|
+
collection.addExport('myExport1', 'myModule');
|
|
45
|
+
collection.addExport('myExport2', 'myModule');
|
|
46
|
+
expect(collection.hasImports).toBe(false);
|
|
47
|
+
expect(collection.hasExports).toBe(true);
|
|
48
|
+
expect(collection.toString(sourceBuilderOptions)).toBe("export { myExport1, myExport2 } from 'myModule';\n");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('clear', () => {
|
|
53
|
+
it('should clear the collection', () => {
|
|
54
|
+
collection.addImport('myImport', 'myModule');
|
|
55
|
+
collection.addExport('myExport', 'myModule');
|
|
56
|
+
expect(collection.hasImports).toBe(true);
|
|
57
|
+
expect(collection.hasExports).toBe(true);
|
|
58
|
+
collection.clear();
|
|
59
|
+
expect(collection.hasImports).toBe(false);
|
|
60
|
+
expect(collection.hasExports).toBe(false);
|
|
61
|
+
expect(collection.toString(sourceBuilderOptions)).toBe('');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('toString', () => {
|
|
66
|
+
it('should return an empty string if the collection is empty', () => {
|
|
67
|
+
expect(collection.toString(sourceBuilderOptions)).toBe('');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should return a string representation of the collection', () => {
|
|
71
|
+
collection.addImport('myImport', 'myModule');
|
|
72
|
+
collection.addExport('myExport', 'myModule');
|
|
73
|
+
expect(collection.toString(sourceBuilderOptions)).toBe(
|
|
74
|
+
"import { myImport } from 'myModule';\n\nexport { myExport } from 'myModule';\n",
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { extname } from 'node:path';
|
|
2
|
+
|
|
3
|
+
import { type SourceBuilderOptions, StringBuilder } from '@goast/core';
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
TypeScriptExportType,
|
|
7
|
+
TypeScriptImport,
|
|
8
|
+
TypeScriptImportKind,
|
|
9
|
+
TypeScriptImportType,
|
|
10
|
+
} from './common-results.js';
|
|
11
|
+
import { defaultTypeScriptGeneratorConfig } from './config.js';
|
|
12
|
+
import { getModulePathRelativeToFile, type ImportModuleTransformer } from './utils.js';
|
|
13
|
+
|
|
14
|
+
export type ImportExportCollectionOptions = {
|
|
15
|
+
filePath?: string;
|
|
16
|
+
importModuleTransformer: ImportModuleTransformer;
|
|
17
|
+
useSingleQuotes: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const defaultImportExportCollectionOptions: ImportExportCollectionOptions = {
|
|
21
|
+
importModuleTransformer: defaultTypeScriptGeneratorConfig.importModuleTransformer,
|
|
22
|
+
useSingleQuotes: defaultTypeScriptGeneratorConfig.useSingleQuotes,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type TypeScriptImportOptions = { type?: TypeScriptImportType };
|
|
26
|
+
export type TypeScriptExportOptions = { type?: TypeScriptExportType };
|
|
27
|
+
|
|
28
|
+
export class ImportExportCollection {
|
|
29
|
+
private readonly _imports: Map<string, Set<string>> = new Map();
|
|
30
|
+
private readonly _typeImports: Map<string, Set<string>> = new Map();
|
|
31
|
+
private readonly _jsDocImports: Map<string, Set<string>> = new Map();
|
|
32
|
+
private readonly _exports: Map<string, Set<string>> = new Map();
|
|
33
|
+
private readonly _typeExports: Map<string, Set<string>> = new Map();
|
|
34
|
+
private readonly _options: ImportExportCollectionOptions;
|
|
35
|
+
|
|
36
|
+
constructor(options?: Partial<ImportExportCollectionOptions>) {
|
|
37
|
+
this._options = { ...defaultImportExportCollectionOptions, ...options };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public get hasImports(): boolean {
|
|
41
|
+
return this._imports.size > 0 || this._typeImports.size > 0 || this._jsDocImports.size > 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public get hasExports(): boolean {
|
|
45
|
+
return this._exports.size > 0 || this._typeExports.size > 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public get imports(): TypeScriptImport[] {
|
|
49
|
+
return [
|
|
50
|
+
...this.toImport('import', this._imports),
|
|
51
|
+
...this.toImport('type-import', this._typeImports),
|
|
52
|
+
...this.toImport('js-doc', this._jsDocImports),
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private toImport(type: TypeScriptImportType, map: Map<string, Set<string>>): TypeScriptImport[] {
|
|
57
|
+
return Array.from(map.entries())
|
|
58
|
+
.map(([fromModule, importNames]) =>
|
|
59
|
+
Array.from(importNames).map(
|
|
60
|
+
(importName) => ({
|
|
61
|
+
kind: this.getImportKind(fromModule),
|
|
62
|
+
type,
|
|
63
|
+
modulePath: fromModule,
|
|
64
|
+
name: importName,
|
|
65
|
+
} satisfies TypeScriptImport),
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
.flat();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public addImport(importName: string, fromModule: string, options?: TypeScriptImportOptions): void {
|
|
72
|
+
const map = this.getImportMap(options?.type ?? 'import');
|
|
73
|
+
const existingImport = map.get(fromModule);
|
|
74
|
+
if (existingImport) {
|
|
75
|
+
existingImport.add(importName);
|
|
76
|
+
} else {
|
|
77
|
+
map.set(fromModule, new Set([importName]));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public addExport(exportName: string, fromModule: string, options?: TypeScriptExportOptions): void {
|
|
82
|
+
const map = this.getExportMap(options?.type ?? 'export');
|
|
83
|
+
const existingExport = map.get(fromModule);
|
|
84
|
+
if (existingExport) {
|
|
85
|
+
existingExport.add(exportName);
|
|
86
|
+
} else {
|
|
87
|
+
map.set(fromModule, new Set([exportName]));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public clear(): void {
|
|
92
|
+
this._imports.clear();
|
|
93
|
+
this._typeImports.clear();
|
|
94
|
+
this._jsDocImports.clear();
|
|
95
|
+
this._exports.clear();
|
|
96
|
+
this._typeExports.clear();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public toString(options: Partial<SourceBuilderOptions>): string {
|
|
100
|
+
const builder = new StringBuilder(options);
|
|
101
|
+
this.writeTo(builder);
|
|
102
|
+
return builder.toString();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public writeTo(builder: StringBuilder) {
|
|
106
|
+
const { filePath, importModuleTransformer, useSingleQuotes } = this._options;
|
|
107
|
+
let hasPrevious = false;
|
|
108
|
+
|
|
109
|
+
if (this._imports.size > 0) {
|
|
110
|
+
const sortedImports = this.sortAndResolve(this._imports, filePath, importModuleTransformer);
|
|
111
|
+
this.writeImportsExports(builder, 'import', sortedImports, { useSingleQuotes });
|
|
112
|
+
hasPrevious = true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this._typeImports.size > 0) {
|
|
116
|
+
if (hasPrevious) {
|
|
117
|
+
builder.appendLine();
|
|
118
|
+
}
|
|
119
|
+
const sortedImports = this.sortAndResolve(this._typeImports, filePath, importModuleTransformer);
|
|
120
|
+
this.writeImportsExports(builder, 'import type', sortedImports, { useSingleQuotes });
|
|
121
|
+
hasPrevious = true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (this._jsDocImports.size > 0) {
|
|
125
|
+
if (hasPrevious) {
|
|
126
|
+
builder.appendLine();
|
|
127
|
+
}
|
|
128
|
+
const sortedImports = this.sortAndResolve(this._jsDocImports, filePath, importModuleTransformer);
|
|
129
|
+
builder.appendLine('/**');
|
|
130
|
+
this.writeImportsExports(builder, ' * @import', sortedImports, { useSingleQuotes });
|
|
131
|
+
builder.appendLine(' */');
|
|
132
|
+
hasPrevious = true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (this._exports.size > 0) {
|
|
136
|
+
if (hasPrevious) {
|
|
137
|
+
builder.appendLine();
|
|
138
|
+
}
|
|
139
|
+
const sortedExports = this.sortAndResolve(this._exports, filePath, importModuleTransformer);
|
|
140
|
+
this.writeImportsExports(builder, 'export', sortedExports, { useSingleQuotes });
|
|
141
|
+
hasPrevious = true;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (this._typeExports.size > 0) {
|
|
145
|
+
if (hasPrevious) {
|
|
146
|
+
builder.appendLine();
|
|
147
|
+
}
|
|
148
|
+
const sortedExports = this.sortAndResolve(this._typeExports, filePath, importModuleTransformer);
|
|
149
|
+
this.writeImportsExports(builder, 'export type', sortedExports, { useSingleQuotes });
|
|
150
|
+
hasPrevious = true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
protected writeImportsExports(
|
|
155
|
+
builder: StringBuilder,
|
|
156
|
+
keyword: 'import' | 'export' | 'import type' | 'export type' | ' * @import',
|
|
157
|
+
data: (readonly [string, TypeScriptImportKind, string[]])[],
|
|
158
|
+
options: { useSingleQuotes: boolean },
|
|
159
|
+
) {
|
|
160
|
+
const moduleData: (readonly [string, TypeScriptImportKind, string[]])[] = [];
|
|
161
|
+
const fileData: (readonly [string, TypeScriptImportKind, string[]])[] = [];
|
|
162
|
+
for (const x of data) {
|
|
163
|
+
if (x[1] === 'module') {
|
|
164
|
+
moduleData.push(x);
|
|
165
|
+
} else {
|
|
166
|
+
fileData.push(x);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const quote = options.useSingleQuotes ? "'" : '"';
|
|
171
|
+
|
|
172
|
+
for (const [fromModule, _, names] of moduleData) {
|
|
173
|
+
builder.appendLine(`${keyword} { ${names.join(', ')} } from ${quote}${fromModule}${quote};`);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (moduleData.length > 0 && fileData.length > 0) {
|
|
177
|
+
builder.appendLine();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
for (const [fromModule, _, names] of fileData) {
|
|
181
|
+
builder.appendLine(`${keyword} { ${names.join(', ')} } from ${quote}${fromModule}${quote};`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
protected sortAndResolve(
|
|
186
|
+
data: Map<string, Set<string>>,
|
|
187
|
+
filePath: string | undefined,
|
|
188
|
+
importModuleTransformer: ImportModuleTransformer,
|
|
189
|
+
): (readonly [string, TypeScriptImportKind, string[]])[] {
|
|
190
|
+
return Array.from(data.entries())
|
|
191
|
+
.sort(([fromModuleA], [fromModuleB]) => fromModuleA.localeCompare(fromModuleB))
|
|
192
|
+
.map(
|
|
193
|
+
([fromModule, names]) =>
|
|
194
|
+
[...this.resolveModulePath(fromModule, filePath, importModuleTransformer), Array.from(names).sort()] as const,
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
protected getImportKind(fromModule: string): TypeScriptImportKind {
|
|
199
|
+
const extName = extname(fromModule).toUpperCase();
|
|
200
|
+
return extName === '.TS' || extName === '.JS' || extName === '.JSON' ? 'file' : 'module';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
protected resolveModulePath(
|
|
204
|
+
fromModule: string,
|
|
205
|
+
filePath: string | undefined,
|
|
206
|
+
importModuleTransformer: ImportModuleTransformer,
|
|
207
|
+
): [string, TypeScriptImportKind] {
|
|
208
|
+
const kind = this.getImportKind(fromModule);
|
|
209
|
+
return [
|
|
210
|
+
filePath && kind === 'file'
|
|
211
|
+
? getModulePathRelativeToFile(filePath, fromModule, importModuleTransformer)
|
|
212
|
+
: fromModule,
|
|
213
|
+
kind,
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
protected getImportMap(type: TypeScriptImportType): Map<string, Set<string>> {
|
|
218
|
+
switch (type) {
|
|
219
|
+
case 'import':
|
|
220
|
+
return this._imports;
|
|
221
|
+
case 'type-import':
|
|
222
|
+
return this._typeImports;
|
|
223
|
+
case 'js-doc':
|
|
224
|
+
return this._jsDocImports;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
protected getExportMap(type: TypeScriptExportType): Map<string, Set<string>> {
|
|
229
|
+
switch (type) {
|
|
230
|
+
case 'export':
|
|
231
|
+
return this._exports;
|
|
232
|
+
case 'type-export':
|
|
233
|
+
return this._typeExports;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
package/src/src/utils.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { dirname, relative } from 'node:path';
|
|
2
|
+
|
|
3
|
+
import type { Nullable } from '@goast/core';
|
|
4
|
+
|
|
5
|
+
export type ImportModuleTransformer =
|
|
6
|
+
| 'omit-extension'
|
|
7
|
+
| 'with-extension'
|
|
8
|
+
| 'js-extension'
|
|
9
|
+
| ((module: string) => string);
|
|
10
|
+
|
|
11
|
+
function doubleQuotedToSingleQuoted(value: string): string {
|
|
12
|
+
return `'${value.slice(1, -1).replace(/'/g, "\\'")}'`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function toTypeScriptStringLiteral(value: string, useSingleQuotes: boolean): string {
|
|
16
|
+
return useSingleQuotes ? doubleQuotedToSingleQuoted(JSON.stringify(value)) : JSON.stringify(value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function toTypeScriptPropertyName(value: string, useSingleQuotes: boolean): string {
|
|
20
|
+
if (value.match(/^[a-zA-Z_$][a-zA-Z_$0-9]*$/)) {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
return useSingleQuotes ? doubleQuotedToSingleQuoted(JSON.stringify(value)) : JSON.stringify(value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getModulePathRelativeToFile(from: string, to: string, transformer: ImportModuleTransformer): string {
|
|
27
|
+
return transformModulePath(relative(dirname(from), to).replace(/\\/g, '/'), transformer);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function getModulePathRelativeToDirectory(
|
|
31
|
+
from: string,
|
|
32
|
+
to: string,
|
|
33
|
+
transformer: ImportModuleTransformer,
|
|
34
|
+
): string {
|
|
35
|
+
return transformModulePath(relative(from, to).replace(/\\/g, '/'), transformer);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function transformModulePath(modulePath: string, transformer: ImportModuleTransformer) {
|
|
39
|
+
if (!modulePath.startsWith('.')) {
|
|
40
|
+
modulePath = `./${modulePath}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (transformer === 'omit-extension') {
|
|
44
|
+
return modulePath.replace(/\.[^/.]+$/, '');
|
|
45
|
+
} else if (transformer === 'with-extension') {
|
|
46
|
+
return modulePath;
|
|
47
|
+
} else if (transformer === 'js-extension') {
|
|
48
|
+
return modulePath.replace(/\.[^/.]+$/, '.js');
|
|
49
|
+
} else if (typeof transformer === 'function') {
|
|
50
|
+
return transformer(modulePath);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return modulePath;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function modifyString<TArgs extends unknown[]>(
|
|
57
|
+
value: string,
|
|
58
|
+
modifier: Nullable<string | RegExp | ((value: string, ...args: TArgs) => string)>,
|
|
59
|
+
...args: TArgs
|
|
60
|
+
): string {
|
|
61
|
+
if (typeof modifier === 'string') {
|
|
62
|
+
return modifier;
|
|
63
|
+
}
|
|
64
|
+
if (modifier instanceof RegExp) {
|
|
65
|
+
const match = value.match(modifier);
|
|
66
|
+
return match?.[0] ?? value;
|
|
67
|
+
}
|
|
68
|
+
if (typeof modifier === 'function') {
|
|
69
|
+
return modifier(value, ...args);
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}
|