@goast/core 0.4.0 → 0.4.1-springwebclient1
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 +67 -67
- package/esm/src/transform/helpers.d.ts.map +1 -1
- package/esm/src/transform/helpers.js +5 -1
- package/esm/src/utils/asset-manager.d.ts +1 -0
- package/esm/src/utils/asset-manager.d.ts.map +1 -1
- package/esm/src/utils/asset-manager.js +1 -1
- package/esm/src/utils/source-builder.d.ts +2 -0
- package/esm/src/utils/source-builder.d.ts.map +1 -1
- package/esm/src/utils/source-builder.js +7 -1
- package/package.json +2 -5
- package/script/src/transform/helpers.d.ts.map +1 -1
- package/script/src/transform/helpers.js +5 -1
- package/script/src/utils/asset-manager.d.ts +1 -0
- package/script/src/utils/asset-manager.d.ts.map +1 -1
- package/script/src/utils/asset-manager.js +1 -1
- package/script/src/utils/source-builder.d.ts +2 -0
- package/script/src/utils/source-builder.d.ts.map +1 -1
- package/script/src/utils/source-builder.js +8 -1
- package/esm/_dnt.test_polyfills.d.ts +0 -18
- package/esm/_dnt.test_polyfills.d.ts.map +0 -1
- package/esm/_dnt.test_polyfills.js +0 -17
- package/esm/_dnt.test_shims.d.ts +0 -14
- package/esm/_dnt.test_shims.d.ts.map +0 -1
- package/esm/_dnt.test_shims.js +0 -69
- package/esm/deps/jsr.io/@std/assert/1.0.6/assertion_error.d.ts +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.6/assertion_error.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/assertion_error.js +0 -30
- package/esm/deps/jsr.io/@std/assert/1.0.6/equal.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.6/equal.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/equal.js +0 -136
- package/esm/deps/jsr.io/@std/assert/1.0.6/equals.d.ts +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.6/equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/equals.js +0 -45
- package/esm/deps/jsr.io/@std/assert/1.0.6/false.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.6/false.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/false.js +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.6/instance_of.d.ts +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.6/instance_of.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/instance_of.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.6/is_error.d.ts +0 -25
- package/esm/deps/jsr.io/@std/assert/1.0.6/is_error.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/is_error.js +0 -54
- package/esm/deps/jsr.io/@std/assert/1.0.6/match.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.6/match.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_instance_of.d.ts +0 -20
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_instance_of.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_instance_of.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_match.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_match.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_strict_equals.d.ts +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_strict_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_strict_equals.js +0 -32
- package/esm/deps/jsr.io/@std/assert/1.0.6/object_match.d.ts +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.6/object_match.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/object_match.js +0 -159
- package/esm/deps/jsr.io/@std/assert/1.0.6/strict_equals.d.ts +0 -24
- package/esm/deps/jsr.io/@std/assert/1.0.6/strict_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.6/strict_equals.js +0 -57
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assert_equals.d.ts +0 -20
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assert_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assert_equals.js +0 -29
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assert_not_equals.d.ts +0 -17
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assert_not_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assert_not_equals.js +0 -26
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assertion.d.ts +0 -3
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assertion.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_assertion.js +0 -9
- package/esm/deps/jsr.io/@std/expect/1.0.5/_asymmetric_matchers.d.ts +0 -36
- package/esm/deps/jsr.io/@std/expect/1.0.5/_asymmetric_matchers.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_asymmetric_matchers.js +0 -124
- package/esm/deps/jsr.io/@std/expect/1.0.5/_build_message.d.ts +0 -6
- package/esm/deps/jsr.io/@std/expect/1.0.5/_build_message.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_build_message.js +0 -29
- package/esm/deps/jsr.io/@std/expect/1.0.5/_custom_equality_tester.d.ts +0 -4
- package/esm/deps/jsr.io/@std/expect/1.0.5/_custom_equality_tester.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_custom_equality_tester.js +0 -11
- package/esm/deps/jsr.io/@std/expect/1.0.5/_equal.d.ts +0 -9
- package/esm/deps/jsr.io/@std/expect/1.0.5/_equal.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_equal.js +0 -191
- package/esm/deps/jsr.io/@std/expect/1.0.5/_extend.d.ts +0 -4
- package/esm/deps/jsr.io/@std/expect/1.0.5/_extend.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_extend.js +0 -11
- package/esm/deps/jsr.io/@std/expect/1.0.5/_inspect_args.d.ts +0 -3
- package/esm/deps/jsr.io/@std/expect/1.0.5/_inspect_args.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_inspect_args.js +0 -12
- package/esm/deps/jsr.io/@std/expect/1.0.5/_matchers.d.ts +0 -34
- package/esm/deps/jsr.io/@std/expect/1.0.5/_matchers.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_matchers.js +0 -564
- package/esm/deps/jsr.io/@std/expect/1.0.5/_mock_util.d.ts +0 -11
- package/esm/deps/jsr.io/@std/expect/1.0.5/_mock_util.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_mock_util.js +0 -10
- package/esm/deps/jsr.io/@std/expect/1.0.5/_types.d.ts +0 -838
- package/esm/deps/jsr.io/@std/expect/1.0.5/_types.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_types.js +0 -3
- package/esm/deps/jsr.io/@std/expect/1.0.5/_utils.d.ts +0 -8
- package/esm/deps/jsr.io/@std/expect/1.0.5/_utils.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/_utils.js +0 -159
- package/esm/deps/jsr.io/@std/expect/1.0.5/expect.d.ts +0 -51
- package/esm/deps/jsr.io/@std/expect/1.0.5/expect.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/expect.js +0 -425
- package/esm/deps/jsr.io/@std/expect/1.0.5/fn.d.ts +0 -29
- package/esm/deps/jsr.io/@std/expect/1.0.5/fn.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/fn.js +0 -85
- package/esm/deps/jsr.io/@std/expect/1.0.5/mod.d.ts +0 -85
- package/esm/deps/jsr.io/@std/expect/1.0.5/mod.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/expect/1.0.5/mod.js +0 -87
- package/esm/deps/jsr.io/@std/internal/1.0.4/assertion_state.d.ts +0 -75
- package/esm/deps/jsr.io/@std/internal/1.0.4/assertion_state.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.4/assertion_state.js +0 -101
- package/esm/deps/jsr.io/@std/internal/1.0.4/build_message.d.ts +0 -82
- package/esm/deps/jsr.io/@std/internal/1.0.4/build_message.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.4/build_message.js +0 -111
- package/esm/deps/jsr.io/@std/internal/1.0.4/diff.d.ts +0 -140
- package/esm/deps/jsr.io/@std/internal/1.0.4/diff.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.4/diff.js +0 -277
- package/esm/deps/jsr.io/@std/internal/1.0.4/diff_str.d.ts +0 -99
- package/esm/deps/jsr.io/@std/internal/1.0.4/diff_str.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.4/diff_str.js +0 -180
- package/esm/deps/jsr.io/@std/internal/1.0.4/format.d.ts +0 -2
- package/esm/deps/jsr.io/@std/internal/1.0.4/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.4/format.js +0 -37
- package/esm/deps/jsr.io/@std/internal/1.0.4/styles.d.ts +0 -159
- package/esm/deps/jsr.io/@std/internal/1.0.4/styles.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.4/styles.js +0 -207
- package/esm/deps/jsr.io/@std/internal/1.0.4/types.d.ts +0 -16
- package/esm/deps/jsr.io/@std/internal/1.0.4/types.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.4/types.js +0 -2
- package/esm/deps/jsr.io/@std/testing/1.0.3/_test_suite.d.ts +0 -74
- package/esm/deps/jsr.io/@std/testing/1.0.3/_test_suite.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.3/_test_suite.js +0 -340
- package/esm/deps/jsr.io/@std/testing/1.0.3/bdd.d.ts +0 -731
- package/esm/deps/jsr.io/@std/testing/1.0.3/bdd.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.3/bdd.js +0 -576
- package/esm/src/collect/helpers.test.d.ts +0 -2
- package/esm/src/collect/helpers.test.d.ts.map +0 -1
- package/esm/src/collect/helpers.test.js +0 -77
- package/esm/src/transform/helpers.test.d.ts +0 -2
- package/esm/src/transform/helpers.test.d.ts.map +0 -1
- package/esm/src/transform/helpers.test.js +0 -265
- package/esm/src/utils/action-provider.test.d.ts +0 -2
- package/esm/src/utils/action-provider.test.d.ts.map +0 -1
- package/esm/src/utils/action-provider.test.js +0 -28
- package/esm/src/utils/common.utils.test.d.ts +0 -2
- package/esm/src/utils/common.utils.test.d.ts.map +0 -1
- package/esm/src/utils/common.utils.test.js +0 -18
- package/esm/src/utils/condition.test.d.ts +0 -2
- package/esm/src/utils/condition.test.d.ts.map +0 -1
- package/esm/src/utils/condition.test.js +0 -31
- package/esm/src/utils/endpoint.utils.test.d.ts +0 -2
- package/esm/src/utils/endpoint.utils.test.d.ts.map +0 -1
- package/esm/src/utils/endpoint.utils.test.js +0 -31
- package/esm/src/utils/factory.test.d.ts +0 -2
- package/esm/src/utils/factory.test.d.ts.map +0 -1
- package/esm/src/utils/factory.test.js +0 -34
- package/esm/src/utils/generator.utils.test.d.ts +0 -2
- package/esm/src/utils/generator.utils.test.d.ts.map +0 -1
- package/esm/src/utils/generator.utils.test.js +0 -13
- package/esm/src/utils/object.utils.test.d.ts +0 -2
- package/esm/src/utils/object.utils.test.d.ts.map +0 -1
- package/esm/src/utils/object.utils.test.js +0 -29
- package/esm/src/utils/schema.utils.test.d.ts +0 -2
- package/esm/src/utils/schema.utils.test.d.ts.map +0 -1
- package/esm/src/utils/schema.utils.test.js +0 -78
- package/esm/src/utils/source-builder.test.d.ts +0 -2
- package/esm/src/utils/source-builder.test.d.ts.map +0 -1
- package/esm/src/utils/source-builder.test.js +0 -506
- package/esm/src/utils/string-builder/string-builder.test.d.ts +0 -2
- package/esm/src/utils/string-builder/string-builder.test.d.ts.map +0 -1
- package/esm/src/utils/string-builder/string-builder.test.js +0 -164
- package/esm/src/utils/string.utils.test.d.ts +0 -2
- package/esm/src/utils/string.utils.test.d.ts.map +0 -1
- package/esm/src/utils/string.utils.test.js +0 -528
- package/esm/tests/openapi.test.d.ts +0 -2
- package/esm/tests/openapi.test.d.ts.map +0 -1
- package/esm/tests/openapi.test.js +0 -33
- package/esm/tests/schema-factory.d.ts +0 -42
- package/esm/tests/schema-factory.d.ts.map +0 -1
- package/esm/tests/schema-factory.js +0 -138
- package/script/_dnt.test_polyfills.d.ts +0 -18
- package/script/_dnt.test_polyfills.d.ts.map +0 -1
- package/script/_dnt.test_polyfills.js +0 -18
- package/script/_dnt.test_shims.d.ts +0 -14
- package/script/_dnt.test_shims.d.ts.map +0 -1
- package/script/_dnt.test_shims.js +0 -79
- package/script/deps/jsr.io/@std/assert/1.0.6/assertion_error.d.ts +0 -26
- package/script/deps/jsr.io/@std/assert/1.0.6/assertion_error.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/assertion_error.js +0 -34
- package/script/deps/jsr.io/@std/assert/1.0.6/equal.d.ts +0 -17
- package/script/deps/jsr.io/@std/assert/1.0.6/equal.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/equal.js +0 -139
- package/script/deps/jsr.io/@std/assert/1.0.6/equals.d.ts +0 -22
- package/script/deps/jsr.io/@std/assert/1.0.6/equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/equals.js +0 -48
- package/script/deps/jsr.io/@std/assert/1.0.6/false.d.ts +0 -18
- package/script/deps/jsr.io/@std/assert/1.0.6/false.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/false.js +0 -25
- package/script/deps/jsr.io/@std/assert/1.0.6/instance_of.d.ts +0 -23
- package/script/deps/jsr.io/@std/assert/1.0.6/instance_of.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/instance_of.js +0 -56
- package/script/deps/jsr.io/@std/assert/1.0.6/is_error.d.ts +0 -25
- package/script/deps/jsr.io/@std/assert/1.0.6/is_error.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/is_error.js +0 -57
- package/script/deps/jsr.io/@std/assert/1.0.6/match.d.ts +0 -18
- package/script/deps/jsr.io/@std/assert/1.0.6/match.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/match.js +0 -29
- package/script/deps/jsr.io/@std/assert/1.0.6/not_instance_of.d.ts +0 -20
- package/script/deps/jsr.io/@std/assert/1.0.6/not_instance_of.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/not_instance_of.js +0 -32
- package/script/deps/jsr.io/@std/assert/1.0.6/not_match.d.ts +0 -18
- package/script/deps/jsr.io/@std/assert/1.0.6/not_match.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/not_match.js +0 -29
- package/script/deps/jsr.io/@std/assert/1.0.6/not_strict_equals.d.ts +0 -23
- package/script/deps/jsr.io/@std/assert/1.0.6/not_strict_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/not_strict_equals.js +0 -35
- package/script/deps/jsr.io/@std/assert/1.0.6/object_match.d.ts +0 -28
- package/script/deps/jsr.io/@std/assert/1.0.6/object_match.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/object_match.js +0 -162
- package/script/deps/jsr.io/@std/assert/1.0.6/strict_equals.d.ts +0 -24
- package/script/deps/jsr.io/@std/assert/1.0.6/strict_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.6/strict_equals.js +0 -60
- package/script/deps/jsr.io/@std/expect/1.0.5/_assert_equals.d.ts +0 -20
- package/script/deps/jsr.io/@std/expect/1.0.5/_assert_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_assert_equals.js +0 -32
- package/script/deps/jsr.io/@std/expect/1.0.5/_assert_not_equals.d.ts +0 -17
- package/script/deps/jsr.io/@std/expect/1.0.5/_assert_not_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_assert_not_equals.js +0 -29
- package/script/deps/jsr.io/@std/expect/1.0.5/_assertion.d.ts +0 -3
- package/script/deps/jsr.io/@std/expect/1.0.5/_assertion.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_assertion.js +0 -13
- package/script/deps/jsr.io/@std/expect/1.0.5/_asymmetric_matchers.d.ts +0 -36
- package/script/deps/jsr.io/@std/expect/1.0.5/_asymmetric_matchers.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_asymmetric_matchers.js +0 -140
- package/script/deps/jsr.io/@std/expect/1.0.5/_build_message.d.ts +0 -6
- package/script/deps/jsr.io/@std/expect/1.0.5/_build_message.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_build_message.js +0 -33
- package/script/deps/jsr.io/@std/expect/1.0.5/_custom_equality_tester.d.ts +0 -4
- package/script/deps/jsr.io/@std/expect/1.0.5/_custom_equality_tester.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_custom_equality_tester.js +0 -15
- package/script/deps/jsr.io/@std/expect/1.0.5/_equal.d.ts +0 -9
- package/script/deps/jsr.io/@std/expect/1.0.5/_equal.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_equal.js +0 -194
- package/script/deps/jsr.io/@std/expect/1.0.5/_extend.d.ts +0 -4
- package/script/deps/jsr.io/@std/expect/1.0.5/_extend.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_extend.js +0 -15
- package/script/deps/jsr.io/@std/expect/1.0.5/_inspect_args.d.ts +0 -3
- package/script/deps/jsr.io/@std/expect/1.0.5/_inspect_args.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_inspect_args.js +0 -17
- package/script/deps/jsr.io/@std/expect/1.0.5/_matchers.d.ts +0 -34
- package/script/deps/jsr.io/@std/expect/1.0.5/_matchers.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_matchers.js +0 -598
- package/script/deps/jsr.io/@std/expect/1.0.5/_mock_util.d.ts +0 -11
- package/script/deps/jsr.io/@std/expect/1.0.5/_mock_util.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_mock_util.js +0 -14
- package/script/deps/jsr.io/@std/expect/1.0.5/_types.d.ts +0 -838
- package/script/deps/jsr.io/@std/expect/1.0.5/_types.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_types.js +0 -4
- package/script/deps/jsr.io/@std/expect/1.0.5/_utils.d.ts +0 -8
- package/script/deps/jsr.io/@std/expect/1.0.5/_utils.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/_utils.js +0 -166
- package/script/deps/jsr.io/@std/expect/1.0.5/expect.d.ts +0 -51
- package/script/deps/jsr.io/@std/expect/1.0.5/expect.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/expect.js +0 -429
- package/script/deps/jsr.io/@std/expect/1.0.5/fn.d.ts +0 -29
- package/script/deps/jsr.io/@std/expect/1.0.5/fn.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/fn.js +0 -88
- package/script/deps/jsr.io/@std/expect/1.0.5/mod.d.ts +0 -85
- package/script/deps/jsr.io/@std/expect/1.0.5/mod.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/expect/1.0.5/mod.js +0 -90
- package/script/deps/jsr.io/@std/internal/1.0.4/assertion_state.d.ts +0 -75
- package/script/deps/jsr.io/@std/internal/1.0.4/assertion_state.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.4/assertion_state.js +0 -106
- package/script/deps/jsr.io/@std/internal/1.0.4/build_message.d.ts +0 -82
- package/script/deps/jsr.io/@std/internal/1.0.4/build_message.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.4/build_message.js +0 -116
- package/script/deps/jsr.io/@std/internal/1.0.4/diff.d.ts +0 -140
- package/script/deps/jsr.io/@std/internal/1.0.4/diff.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.4/diff.js +0 -284
- package/script/deps/jsr.io/@std/internal/1.0.4/diff_str.d.ts +0 -99
- package/script/deps/jsr.io/@std/internal/1.0.4/diff_str.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.4/diff_str.js +0 -186
- package/script/deps/jsr.io/@std/internal/1.0.4/format.d.ts +0 -2
- package/script/deps/jsr.io/@std/internal/1.0.4/format.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.4/format.js +0 -41
- package/script/deps/jsr.io/@std/internal/1.0.4/styles.d.ts +0 -159
- package/script/deps/jsr.io/@std/internal/1.0.4/styles.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.4/styles.js +0 -220
- package/script/deps/jsr.io/@std/internal/1.0.4/types.d.ts +0 -16
- package/script/deps/jsr.io/@std/internal/1.0.4/types.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.4/types.js +0 -3
- package/script/deps/jsr.io/@std/testing/1.0.3/_test_suite.d.ts +0 -74
- package/script/deps/jsr.io/@std/testing/1.0.3/_test_suite.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.3/_test_suite.js +0 -345
- package/script/deps/jsr.io/@std/testing/1.0.3/bdd.d.ts +0 -731
- package/script/deps/jsr.io/@std/testing/1.0.3/bdd.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.3/bdd.js +0 -587
- package/script/src/collect/helpers.test.d.ts +0 -2
- package/script/src/collect/helpers.test.d.ts.map +0 -1
- package/script/src/collect/helpers.test.js +0 -79
- package/script/src/transform/helpers.test.d.ts +0 -2
- package/script/src/transform/helpers.test.d.ts.map +0 -1
- package/script/src/transform/helpers.test.js +0 -267
- package/script/src/utils/action-provider.test.d.ts +0 -2
- package/script/src/utils/action-provider.test.d.ts.map +0 -1
- package/script/src/utils/action-provider.test.js +0 -30
- package/script/src/utils/common.utils.test.d.ts +0 -2
- package/script/src/utils/common.utils.test.d.ts.map +0 -1
- package/script/src/utils/common.utils.test.js +0 -20
- package/script/src/utils/condition.test.d.ts +0 -2
- package/script/src/utils/condition.test.d.ts.map +0 -1
- package/script/src/utils/condition.test.js +0 -33
- package/script/src/utils/endpoint.utils.test.d.ts +0 -2
- package/script/src/utils/endpoint.utils.test.d.ts.map +0 -1
- package/script/src/utils/endpoint.utils.test.js +0 -33
- package/script/src/utils/factory.test.d.ts +0 -2
- package/script/src/utils/factory.test.d.ts.map +0 -1
- package/script/src/utils/factory.test.js +0 -36
- package/script/src/utils/generator.utils.test.d.ts +0 -2
- package/script/src/utils/generator.utils.test.d.ts.map +0 -1
- package/script/src/utils/generator.utils.test.js +0 -15
- package/script/src/utils/object.utils.test.d.ts +0 -2
- package/script/src/utils/object.utils.test.d.ts.map +0 -1
- package/script/src/utils/object.utils.test.js +0 -31
- package/script/src/utils/schema.utils.test.d.ts +0 -2
- package/script/src/utils/schema.utils.test.d.ts.map +0 -1
- package/script/src/utils/schema.utils.test.js +0 -80
- package/script/src/utils/source-builder.test.d.ts +0 -2
- package/script/src/utils/source-builder.test.d.ts.map +0 -1
- package/script/src/utils/source-builder.test.js +0 -508
- package/script/src/utils/string-builder/string-builder.test.d.ts +0 -2
- package/script/src/utils/string-builder/string-builder.test.d.ts.map +0 -1
- package/script/src/utils/string-builder/string-builder.test.js +0 -166
- package/script/src/utils/string.utils.test.d.ts +0 -2
- package/script/src/utils/string.utils.test.d.ts.map +0 -1
- package/script/src/utils/string.utils.test.js +0 -530
- package/script/tests/openapi.test.d.ts +0 -2
- package/script/tests/openapi.test.d.ts.map +0 -1
- package/script/tests/openapi.test.js +0 -35
- package/script/tests/schema-factory.d.ts +0 -42
- package/script/tests/schema-factory.d.ts.map +0 -1
- package/script/tests/schema-factory.js +0 -162
- package/src/_dnt.shims.ts +0 -69
- package/src/_dnt.test_polyfills.ts +0 -43
- package/src/_dnt.test_shims.ts +0 -72
- package/src/deps/jsr.io/@std/assert/1.0.6/assertion_error.ts +0 -31
- package/src/deps/jsr.io/@std/assert/1.0.6/equal.ts +0 -152
- package/src/deps/jsr.io/@std/assert/1.0.6/equals.ts +0 -52
- package/src/deps/jsr.io/@std/assert/1.0.6/false.ts +0 -26
- package/src/deps/jsr.io/@std/assert/1.0.6/instance_of.ts +0 -64
- package/src/deps/jsr.io/@std/assert/1.0.6/is_error.ts +0 -65
- package/src/deps/jsr.io/@std/assert/1.0.6/match.ts +0 -30
- package/src/deps/jsr.io/@std/assert/1.0.6/not_instance_of.ts +0 -33
- package/src/deps/jsr.io/@std/assert/1.0.6/not_match.ts +0 -30
- package/src/deps/jsr.io/@std/assert/1.0.6/not_strict_equals.ts +0 -42
- package/src/deps/jsr.io/@std/assert/1.0.6/object_match.ts +0 -202
- package/src/deps/jsr.io/@std/assert/1.0.6/strict_equals.ts +0 -67
- package/src/deps/jsr.io/@std/expect/1.0.5/_assert_equals.ts +0 -38
- package/src/deps/jsr.io/@std/expect/1.0.5/_assert_not_equals.ts +0 -35
- package/src/deps/jsr.io/@std/expect/1.0.5/_assertion.ts +0 -13
- package/src/deps/jsr.io/@std/expect/1.0.5/_asymmetric_matchers.ts +0 -147
- package/src/deps/jsr.io/@std/expect/1.0.5/_build_message.ts +0 -51
- package/src/deps/jsr.io/@std/expect/1.0.5/_custom_equality_tester.ts +0 -19
- package/src/deps/jsr.io/@std/expect/1.0.5/_equal.ts +0 -229
- package/src/deps/jsr.io/@std/expect/1.0.5/_extend.ts +0 -16
- package/src/deps/jsr.io/@std/expect/1.0.5/_inspect_args.ts +0 -15
- package/src/deps/jsr.io/@std/expect/1.0.5/_matchers.ts +0 -828
- package/src/deps/jsr.io/@std/expect/1.0.5/_mock_util.ts +0 -22
- package/src/deps/jsr.io/@std/expect/1.0.5/_types.ts +0 -917
- package/src/deps/jsr.io/@std/expect/1.0.5/_utils.ts +0 -201
- package/src/deps/jsr.io/@std/expect/1.0.5/expect.ts +0 -511
- package/src/deps/jsr.io/@std/expect/1.0.5/fn.ts +0 -91
- package/src/deps/jsr.io/@std/expect/1.0.5/mod.ts +0 -88
- package/src/deps/jsr.io/@std/internal/1.0.4/assertion_state.ts +0 -111
- package/src/deps/jsr.io/@std/internal/1.0.4/build_message.ts +0 -134
- package/src/deps/jsr.io/@std/internal/1.0.4/diff.ts +0 -317
- package/src/deps/jsr.io/@std/internal/1.0.4/diff_str.ts +0 -204
- package/src/deps/jsr.io/@std/internal/1.0.4/format.ts +0 -39
- package/src/deps/jsr.io/@std/internal/1.0.4/styles.ts +0 -233
- package/src/deps/jsr.io/@std/internal/1.0.4/types.ts +0 -18
- package/src/deps/jsr.io/@std/testing/1.0.3/_test_suite.ts +0 -389
- package/src/deps/jsr.io/@std/testing/1.0.3/bdd.ts +0 -1202
- package/src/mod.ts +0 -33
- package/src/src/ast/node.ts +0 -46
- package/src/src/codegen/config.ts +0 -28
- package/src/src/codegen/endpoints-generator.ts +0 -72
- package/src/src/codegen/generator.ts +0 -181
- package/src/src/codegen/internal-utils.ts +0 -6
- package/src/src/codegen/schemas-generator.ts +0 -87
- package/src/src/codegen/services-generator.ts +0 -77
- package/src/src/codegen/types.ts +0 -37
- package/src/src/collect/collector.ts +0 -142
- package/src/src/collect/helpers.test.ts +0 -91
- package/src/src/collect/helpers.ts +0 -36
- package/src/src/collect/types.ts +0 -21
- package/src/src/internal-utils.ts +0 -5
- package/src/src/parse/deref-proxy.ts +0 -64
- package/src/src/parse/openapi-types.ts +0 -949
- package/src/src/parse/parser.ts +0 -220
- package/src/src/parse/types.ts +0 -27
- package/src/src/transform/api-types.ts +0 -243
- package/src/src/transform/helpers.test.ts +0 -316
- package/src/src/transform/helpers.ts +0 -211
- package/src/src/transform/transform-document.ts +0 -35
- package/src/src/transform/transform-endpoint.ts +0 -331
- package/src/src/transform/transform-schema.ts +0 -217
- package/src/src/transform/transformer.ts +0 -52
- package/src/src/transform/types.ts +0 -52
- package/src/src/utils/action-provider.test.ts +0 -32
- package/src/src/utils/action-provider.ts +0 -58
- package/src/src/utils/array.utils.ts +0 -7
- package/src/src/utils/asset-manager.ts +0 -51
- package/src/src/utils/class.utils.ts +0 -40
- package/src/src/utils/common.utils.test.ts +0 -22
- package/src/src/utils/common.utils.ts +0 -86
- package/src/src/utils/condition.test.ts +0 -36
- package/src/src/utils/condition.ts +0 -7
- package/src/src/utils/endpoint.utils.test.ts +0 -36
- package/src/src/utils/endpoint.utils.ts +0 -10
- package/src/src/utils/error.utils.ts +0 -3
- package/src/src/utils/factory.test.ts +0 -31
- package/src/src/utils/factory.ts +0 -42
- package/src/src/utils/file-system.utils.ts +0 -48
- package/src/src/utils/generator.utils.test.ts +0 -16
- package/src/src/utils/generator.utils.ts +0 -6
- package/src/src/utils/object.utils.test.ts +0 -33
- package/src/src/utils/object.utils.ts +0 -32
- package/src/src/utils/schema.utils.test.ts +0 -87
- package/src/src/utils/schema.utils.ts +0 -142
- package/src/src/utils/source-builder.test.ts +0 -658
- package/src/src/utils/source-builder.ts +0 -589
- package/src/src/utils/string-builder/options.ts +0 -19
- package/src/src/utils/string-builder/string-builder.test.ts +0 -189
- package/src/src/utils/string-builder/string-builder.ts +0 -165
- package/src/src/utils/string-builder/utils.ts +0 -69
- package/src/src/utils/string.utils.test.ts +0 -691
- package/src/src/utils/string.utils.ts +0 -369
- package/src/src/utils/string.utils.types.ts +0 -179
- package/src/src/utils/type.utils.ts +0 -93
- package/src/tests/openapi.test.ts +0 -50
- package/src/tests/schema-factory.ts +0 -185
- package/test_runner.js +0 -221
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
import { isNullish } from './common.utils.js';
|
|
2
|
-
import type {
|
|
3
|
-
BaseCaseOptions,
|
|
4
|
-
CamelCaseOptions,
|
|
5
|
-
CaseOptions,
|
|
6
|
-
CustomCaseOptions,
|
|
7
|
-
KebabCaseOptions,
|
|
8
|
-
PascalCaseOptions,
|
|
9
|
-
SnakeCaseOptions,
|
|
10
|
-
StringCasing,
|
|
11
|
-
StringCasingWithOptions,
|
|
12
|
-
WordCasing,
|
|
13
|
-
} from './string.utils.types.js';
|
|
14
|
-
import type { Nullable } from './type.utils.js';
|
|
15
|
-
|
|
16
|
-
export function adjustCasing(a: StringCasing, b: StringCasing): StringCasing;
|
|
17
|
-
export function adjustCasing(
|
|
18
|
-
a: StringCasing | StringCasingWithOptions,
|
|
19
|
-
b: StringCasing | Partial<StringCasingWithOptions>,
|
|
20
|
-
): StringCasingWithOptions;
|
|
21
|
-
export function adjustCasing(
|
|
22
|
-
a: StringCasing | StringCasingWithOptions,
|
|
23
|
-
b: StringCasing | Partial<StringCasingWithOptions>,
|
|
24
|
-
): StringCasing | StringCasingWithOptions {
|
|
25
|
-
if (typeof a === 'string') {
|
|
26
|
-
if (typeof b === 'string') {
|
|
27
|
-
return b;
|
|
28
|
-
} else {
|
|
29
|
-
return { casing: a, ...b };
|
|
30
|
-
}
|
|
31
|
-
} else if (typeof b === 'string') {
|
|
32
|
-
return { ...a, casing: b };
|
|
33
|
-
} else {
|
|
34
|
-
return { ...a, ...b };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function lowercase<T extends string>(str: T): Lowercase<T> {
|
|
39
|
-
return str.toLowerCase() as Lowercase<T>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function uppercase<T extends string>(str: T): Uppercase<T> {
|
|
43
|
-
return str.toUpperCase() as Uppercase<T>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function capitalize<T extends string>(str: T): Capitalize<T> {
|
|
47
|
-
return (str.charAt(0).toUpperCase() + str.slice(1)) as Capitalize<T>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function uncapitalize<T extends string>(str: T): Uncapitalize<T> {
|
|
51
|
-
return (str.charAt(0).toLowerCase() + str.slice(1)) as Uncapitalize<T>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Gets the words from a string. Words are separated by capital letters. Leading numbers are removed. Non-alphanumerical characters are removed and interpreted as word seperators. Multiple uppercase letters are interpreted as one word.
|
|
56
|
-
* @param str The string to get the words from.
|
|
57
|
-
* @returns The words.
|
|
58
|
-
* @example
|
|
59
|
-
* getWords('fooBar') // => ['foo', 'Bar']
|
|
60
|
-
* getWords('fooBarBaz') // => ['foo', 'Bar', 'Baz']
|
|
61
|
-
* getWords('fooBarBaz123') // => ['foo', 'Bar', 'Baz', '123']
|
|
62
|
-
* getWords('123Foo###Bar###') // => ['Foo', 'Bar']
|
|
63
|
-
* getWords('fooBARBaz') // => ['foo', 'BAR', 'Baz']
|
|
64
|
-
*/
|
|
65
|
-
export function getWords(str: Nullable<string>): string[] {
|
|
66
|
-
if (isNullish(str)) return [];
|
|
67
|
-
|
|
68
|
-
// Remove non-alphanumerical characters
|
|
69
|
-
str = str.replace(/[^a-zA-Z0-9]+/g, '-');
|
|
70
|
-
str = str.replace(/^[0-9-]+/, '');
|
|
71
|
-
|
|
72
|
-
// Split into words
|
|
73
|
-
return str.match(/[A-Z]{2,}(?=[A-Z0-9-]|$)|[a-zA-Z][a-z]*|[0-9]+/g) ?? [];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Converts a word to a given casing.
|
|
78
|
-
* @param str The word to convert.
|
|
79
|
-
* @param casing The casing to convert to.
|
|
80
|
-
* @returns The converted word.
|
|
81
|
-
* @example
|
|
82
|
-
* toCasing('fooBar', 'unchanged') // => 'fooBar'
|
|
83
|
-
* toCasing('fooBar', 'all-lower') // => 'foobar'
|
|
84
|
-
* toCasing('fooBar', 'all-upper') // => 'FOOBAR'
|
|
85
|
-
* toCasing('fooBar', 'first-upper') // => 'FooBar'
|
|
86
|
-
* toCasing('FooBar', 'first-lower') // => 'fooBar'
|
|
87
|
-
* toCasing('fooBar', 'first-upper-then-lower') // => 'Foobar'
|
|
88
|
-
* toCasing('FooBar', 'first-lower-then-upper') // => 'fOOBAR'
|
|
89
|
-
* toCasing('fooBar', 'first-upper-alternating') // => 'FoObAr'
|
|
90
|
-
* toCasing('FooBar', 'first-lower-alternating') // => 'fOoBaR'
|
|
91
|
-
*/
|
|
92
|
-
export function wordToCasing(str: Nullable<string>, casing: WordCasing): string {
|
|
93
|
-
str ??= '';
|
|
94
|
-
switch (casing) {
|
|
95
|
-
case 'unchanged':
|
|
96
|
-
return str;
|
|
97
|
-
case 'all-lower':
|
|
98
|
-
return str.toLowerCase();
|
|
99
|
-
case 'all-upper':
|
|
100
|
-
return str.toUpperCase();
|
|
101
|
-
case 'first-upper':
|
|
102
|
-
return str[0].toUpperCase() + str.slice(1);
|
|
103
|
-
case 'first-lower':
|
|
104
|
-
return str[0].toLowerCase() + str.slice(1);
|
|
105
|
-
case 'first-upper-then-lower':
|
|
106
|
-
return str[0].toUpperCase() + str.slice(1).toLowerCase();
|
|
107
|
-
case 'first-lower-then-upper':
|
|
108
|
-
return str[0].toLowerCase() + str.slice(1).toUpperCase();
|
|
109
|
-
case 'first-upper-alternating':
|
|
110
|
-
return str
|
|
111
|
-
.split('')
|
|
112
|
-
.map((c, i) => (i % 2 === 0 ? c.toUpperCase() : c.toLowerCase()))
|
|
113
|
-
.join('');
|
|
114
|
-
case 'first-lower-alternating':
|
|
115
|
-
return str
|
|
116
|
-
.split('')
|
|
117
|
-
.map((c, i) => (i % 2 === 0 ? c.toLowerCase() : c.toUpperCase()))
|
|
118
|
-
.join('');
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function toCasing<T extends StringCasing>(
|
|
123
|
-
str: Nullable<string>,
|
|
124
|
-
casing: T | StringCasingWithOptions<T>,
|
|
125
|
-
): string {
|
|
126
|
-
let options: CaseOptions<T> | undefined;
|
|
127
|
-
let casingType: StringCasing;
|
|
128
|
-
if (typeof casing === 'string') {
|
|
129
|
-
casingType = casing;
|
|
130
|
-
} else {
|
|
131
|
-
options = casing;
|
|
132
|
-
casingType = casing.casing;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
switch (casingType) {
|
|
136
|
-
case 'camel':
|
|
137
|
-
return toCamelCase(str, options as CaseOptions<'camel'>);
|
|
138
|
-
case 'pascal':
|
|
139
|
-
return toPascalCase(str, options as CaseOptions<'pascal'>);
|
|
140
|
-
case 'kebab':
|
|
141
|
-
return toKebabCase(str, options as CaseOptions<'kebab'>);
|
|
142
|
-
case 'snake':
|
|
143
|
-
return toSnakeCase(str, options as CaseOptions<'snake'>);
|
|
144
|
-
case 'custom':
|
|
145
|
-
return toCustomCase(str, options as CaseOptions<'custom'>);
|
|
146
|
-
default:
|
|
147
|
-
return wordToCasing(getWords(str).join(''), casingType);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function addPrefixAndSuffix(str: string, { prefix, suffix }: BaseCaseOptions): string {
|
|
152
|
-
if (prefix) {
|
|
153
|
-
str = prefix + str;
|
|
154
|
-
}
|
|
155
|
-
if (suffix) {
|
|
156
|
-
str = str + suffix;
|
|
157
|
-
}
|
|
158
|
-
return str;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Converts a string to camel case.
|
|
163
|
-
* @param str The string to convert.
|
|
164
|
-
* @param options The options.
|
|
165
|
-
* @returns The converted string.
|
|
166
|
-
* @example
|
|
167
|
-
* toCamelCase('Foo bAR') // => 'fooBar'
|
|
168
|
-
* toCamelCase('Foo bAR', { keepOriginalCase: true }) // => 'fooBAR'
|
|
169
|
-
* toCamelCase('Foo bAR', { keepOriginalCase: false }) // => 'fooBar'
|
|
170
|
-
* toCamelCase('Foo bAR', { prefix: 'bar' }) // => 'barfooBar'
|
|
171
|
-
* toCamelCase('Foo bAR', { suffix: 'bar' }) // => 'fooBarbar'
|
|
172
|
-
*/
|
|
173
|
-
export function toCamelCase(str: Nullable<string>, options?: Partial<CamelCaseOptions>): string {
|
|
174
|
-
const opts: CamelCaseOptions = { keepOriginalCase: false, ...options };
|
|
175
|
-
const words = getWords(str);
|
|
176
|
-
const camelCase = words
|
|
177
|
-
.map((word, index) =>
|
|
178
|
-
index === 0
|
|
179
|
-
? wordToCasing(word, opts.keepOriginalCase ? 'first-lower' : 'all-lower')
|
|
180
|
-
: wordToCasing(word, opts.keepOriginalCase ? 'first-upper' : 'first-upper-then-lower')
|
|
181
|
-
)
|
|
182
|
-
.join('');
|
|
183
|
-
return addPrefixAndSuffix(camelCase, opts);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Converts a string to pascal case.
|
|
188
|
-
* @param str The string to convert.
|
|
189
|
-
* @param options The options.
|
|
190
|
-
* @returns The converted string.
|
|
191
|
-
* @example
|
|
192
|
-
* toPascalCase('foo bAR') // => 'FooBar'
|
|
193
|
-
* toPascalCase('foo bAR', { keepOriginalCase: true }) // => 'FooBAR'
|
|
194
|
-
* toPascalCase('foo bAR', { keepOriginalCase: false }) // => 'FooBar'
|
|
195
|
-
* toPascalCase('foo bAR', { prefix: 'bar' }) // => 'barFooBar'
|
|
196
|
-
* toPascalCase('foo bAR', { suffix: 'bar' }) // => 'FooBarbar'
|
|
197
|
-
*/
|
|
198
|
-
export function toPascalCase(str: Nullable<string>, options?: Partial<PascalCaseOptions>): string {
|
|
199
|
-
const opts: PascalCaseOptions = { keepOriginalCase: false, ...options };
|
|
200
|
-
const words = getWords(str);
|
|
201
|
-
const pascalCase = words
|
|
202
|
-
.map((word) => wordToCasing(word, opts.keepOriginalCase ? 'first-upper' : 'first-upper-then-lower'))
|
|
203
|
-
.join('');
|
|
204
|
-
return addPrefixAndSuffix(pascalCase, opts);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Converts a string to kebab case.
|
|
209
|
-
* @param str The string to convert.
|
|
210
|
-
* @param options The options.
|
|
211
|
-
* @returns The converted string.
|
|
212
|
-
* @example
|
|
213
|
-
* toKebabCase('Foo bAR') // => 'foo-bar'
|
|
214
|
-
* toKebabCase('Foo bAR', { wordCasing: 'all-upper' }) // => 'FOO-BAR'
|
|
215
|
-
* toKebabCase('Foo bAR', { firstWordCasing: 'all-upper' }) // => 'FOO-bar'
|
|
216
|
-
* toKebabCase('Foo bAR', { casing: 'all-upper', firstWordCasing: 'all-lower' }) // => 'foo-BAR'
|
|
217
|
-
* toKebabCase('Foo bAR', { prefix: 'bar' }) // => 'barfoo-bar'
|
|
218
|
-
* toKebabCase('Foo bAR', { suffix: 'bar' }) // => 'foo-barbar'
|
|
219
|
-
*/
|
|
220
|
-
export function toKebabCase(str: Nullable<string>, options?: Partial<KebabCaseOptions>): string {
|
|
221
|
-
const opts: KebabCaseOptions = { wordCasing: 'all-lower', ...options };
|
|
222
|
-
const words = getWords(str);
|
|
223
|
-
const kebabCase = words
|
|
224
|
-
.map((word, index) =>
|
|
225
|
-
index === 0 ? wordToCasing(word, opts.firstWordCasing ?? opts.wordCasing) : wordToCasing(word, opts.wordCasing)
|
|
226
|
-
)
|
|
227
|
-
.join('-');
|
|
228
|
-
return addPrefixAndSuffix(kebabCase, opts);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Converts a string to snake case.
|
|
233
|
-
* @param str The string to convert.
|
|
234
|
-
* @param options The options.
|
|
235
|
-
* @returns The converted string.
|
|
236
|
-
* @example
|
|
237
|
-
* toSnakeCase('Foo bAR') // => 'FOO_BAR'
|
|
238
|
-
* toSnakeCase('Foo bAR', { wordCasing: 'all-lower' }) // => 'foo_bar'
|
|
239
|
-
* toSnakeCase('Foo bAR', { firstWordCasing: 'all-lower' }) // => 'foo_BAR'
|
|
240
|
-
* toSnakeCase('Foo bAR', { casing: 'all-lower', firstWordCasing: 'all-upper' }) // => 'FOO_bar'
|
|
241
|
-
* toSnakeCase('Foo bAR', { prefix: 'bar' }) // => 'barFOO_BAR'
|
|
242
|
-
* toSnakeCase('Foo bAR', { suffix: 'bar' }) // => 'FOO_BARbar'
|
|
243
|
-
*/
|
|
244
|
-
export function toSnakeCase(str: Nullable<string>, options?: Partial<SnakeCaseOptions>): string {
|
|
245
|
-
const opts: SnakeCaseOptions = { wordCasing: 'all-upper', ...options };
|
|
246
|
-
const words = getWords(str);
|
|
247
|
-
const snakeCase = words
|
|
248
|
-
.map((word, index) =>
|
|
249
|
-
index === 0 ? wordToCasing(word, opts.firstWordCasing ?? opts.wordCasing) : wordToCasing(word, opts.wordCasing)
|
|
250
|
-
)
|
|
251
|
-
.join('_');
|
|
252
|
-
return addPrefixAndSuffix(snakeCase, opts);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Converts a string to a custom case.
|
|
257
|
-
* @param str The string to convert.
|
|
258
|
-
* @param options The options.
|
|
259
|
-
* @returns The converted string.
|
|
260
|
-
* @example
|
|
261
|
-
* toCustomCase('Foo bAR', { wordCasing: 'first-upper-then-lower' }) // => 'FooBar'
|
|
262
|
-
* toCustomCase('Foo bAR', { wordCasing: 'first-upper-then-lower', wordSeparator: '~' }) // => 'Foo~Bar'
|
|
263
|
-
* toCustomCase('Foo bAR', { wordCasing: 'first-upper-then-lower', wordSeparator: '~', prefix: 'bar' }) // => 'barFoo~Bar'
|
|
264
|
-
* toCustomCase('Foo bAR', { wordCasing: 'first-upper-then-lower', wordSeparator: '~', suffix: 'bar' }) // => 'Foo~Barbar'
|
|
265
|
-
* toCustomCase('Foo bAR', { wordCasing: 'all-upper', firstWordCasing: 'all-lower' }) // => 'fooBAR'
|
|
266
|
-
* toCustomCase('Foo bAR baz', { wordCasing: (wordIndex) => (wordIndex % 2 === 0 ? 'all-upper' : 'all-lower') }) // => 'FOObarBAZ'
|
|
267
|
-
*/
|
|
268
|
-
export function toCustomCase(str: Nullable<string>, options: CustomCaseOptions): string {
|
|
269
|
-
const words = getWords(str);
|
|
270
|
-
const wordMapFn: (word: string, index: number) => string = typeof options.wordCasing === 'function'
|
|
271
|
-
? (word, index) => wordToCasing(word, options.wordCasing(index))
|
|
272
|
-
: (word, index) =>
|
|
273
|
-
index === 0
|
|
274
|
-
? wordToCasing(word, options.firstWordCasing ?? options.wordCasing)
|
|
275
|
-
: wordToCasing(word, options.wordCasing);
|
|
276
|
-
const customCase = words.map(wordMapFn).join(options.wordSeparator ?? '');
|
|
277
|
-
return addPrefixAndSuffix(customCase, options);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Escapes a string to be used in a regular expression.
|
|
282
|
-
* @param str The string to escape.
|
|
283
|
-
*/
|
|
284
|
-
export function escapeRegExp(str: string): string {
|
|
285
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Removes characters from a string and, if necessary, inserts new characters in their place, returning the spliced string.
|
|
290
|
-
* @param str The string to splice.
|
|
291
|
-
* @param start The index at which to start changing the string.
|
|
292
|
-
* @param deleteCount The number of characters to remove.
|
|
293
|
-
* @param insert The string to insert.
|
|
294
|
-
* @returns The spliced string.
|
|
295
|
-
*/
|
|
296
|
-
export function spliceString(str: string, start: number, deleteCount: number, insert: string): string {
|
|
297
|
-
return str.slice(0, start) + insert + str.slice(start + deleteCount);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Removes leading indentation based on the last line. Also removes the first line if it is empty.
|
|
302
|
-
* @param str The string to trim.
|
|
303
|
-
*/
|
|
304
|
-
export function trimIndent(str: string): string {
|
|
305
|
-
const indent = str.match(/\n( *).*$/)?.[1] ?? '';
|
|
306
|
-
if (indent.length === 0) return str;
|
|
307
|
-
return str.replace(/^\r?\n/, '').replace(new RegExp(`^ {0,${indent.length}}`, 'gm'), '');
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function isNonLineBreakWhitespaceChar(char: string): boolean {
|
|
311
|
-
return (
|
|
312
|
-
char === ' ' ||
|
|
313
|
-
char === '\t' ||
|
|
314
|
-
char === '\f' ||
|
|
315
|
-
char === '\v' ||
|
|
316
|
-
char === '\u00a0' ||
|
|
317
|
-
char === '\u1680' ||
|
|
318
|
-
char === '\u2000' ||
|
|
319
|
-
char === '\u2001' ||
|
|
320
|
-
char === '\u2002' ||
|
|
321
|
-
char === '\u2003' ||
|
|
322
|
-
char === '\u2004' ||
|
|
323
|
-
char === '\u2005' ||
|
|
324
|
-
char === '\u2006' ||
|
|
325
|
-
char === '\u2007' ||
|
|
326
|
-
char === '\u2008' ||
|
|
327
|
-
char === '\u2009' ||
|
|
328
|
-
char === '\u200a' ||
|
|
329
|
-
char === '\u2028' ||
|
|
330
|
-
char === '\u2029' ||
|
|
331
|
-
char === '\u202f' ||
|
|
332
|
-
char === '\u205f' ||
|
|
333
|
-
char === '\u3000' ||
|
|
334
|
-
char === '\ufeff'
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
export function trimEnd(str: string, includeNewLine: boolean = true): string {
|
|
338
|
-
if (includeNewLine) return str.trimEnd();
|
|
339
|
-
let i = str.length;
|
|
340
|
-
for (; isNonLineBreakWhitespaceChar(str[i - 1]); i--);
|
|
341
|
-
return str.substring(0, i);
|
|
342
|
-
}
|
|
343
|
-
export function trimStart(str: string, includeNewLine: boolean = true): string {
|
|
344
|
-
if (includeNewLine) return str.trimStart();
|
|
345
|
-
let i = 0;
|
|
346
|
-
for (; isNonLineBreakWhitespaceChar(str[i]); i++);
|
|
347
|
-
return str.substring(i);
|
|
348
|
-
}
|
|
349
|
-
export function trim(str: string, includeNewLine: boolean = true): string {
|
|
350
|
-
if (includeNewLine) return str.trim();
|
|
351
|
-
let s = 0;
|
|
352
|
-
for (; isNonLineBreakWhitespaceChar(str[s]); s++);
|
|
353
|
-
let e = str.length;
|
|
354
|
-
for (; isNonLineBreakWhitespaceChar(str[e - 1]); e--);
|
|
355
|
-
return str.substring(s, e);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
export function removeStr(str: string, rem: string): string {
|
|
359
|
-
let i = str.indexOf(rem);
|
|
360
|
-
if (i === -1) return str;
|
|
361
|
-
let result = '';
|
|
362
|
-
let s = 0;
|
|
363
|
-
while (i !== -1) {
|
|
364
|
-
result += str.substring(s, i);
|
|
365
|
-
s = i + rem.length;
|
|
366
|
-
i = str.indexOf(rem, s);
|
|
367
|
-
}
|
|
368
|
-
return result + str.substring(s);
|
|
369
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a casing for a word.
|
|
3
|
-
* @example
|
|
4
|
-
* toCasing('fooBar', 'unchanged') // => 'fooBar'
|
|
5
|
-
* toCasing('fooBar', 'all-lower') // => 'foobar'
|
|
6
|
-
* toCasing('fooBar', 'all-upper') // => 'FOOBAR'
|
|
7
|
-
* toCasing('fooBar', 'first-upper') // => 'FooBar'
|
|
8
|
-
* toCasing('FooBar', 'first-lower') // => 'fooBar'
|
|
9
|
-
* toCasing('fooBar', 'first-upper-then-lower') // => 'Foobar'
|
|
10
|
-
* toCasing('FooBar', 'first-lower-then-upper') // => 'fOOBAR'
|
|
11
|
-
* toCasing('fooBar', 'first-upper-alternating') // => 'FoObAr'
|
|
12
|
-
* toCasing('FooBar', 'first-lower-alternating') // => 'fOoBaR'
|
|
13
|
-
*/
|
|
14
|
-
export type WordCasing =
|
|
15
|
-
| 'unchanged'
|
|
16
|
-
| 'all-lower'
|
|
17
|
-
| 'all-upper'
|
|
18
|
-
| 'first-upper'
|
|
19
|
-
| 'first-lower'
|
|
20
|
-
| 'first-upper-then-lower'
|
|
21
|
-
| 'first-lower-then-upper'
|
|
22
|
-
| 'first-upper-alternating'
|
|
23
|
-
| 'first-lower-alternating';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Represents a casing for a string.
|
|
27
|
-
* @example
|
|
28
|
-
* toCase('fooBar', 'unchanged') // => 'fooBar'
|
|
29
|
-
* toCase('fooBar', 'all-lower') // => 'foobar'
|
|
30
|
-
* toCase('fooBar', 'all-upper') // => 'FOOBAR'
|
|
31
|
-
* toCase('fooBar', 'first-upper') // => 'FooBar'
|
|
32
|
-
* toCase('FooBar', 'first-lower') // => 'fooBar'
|
|
33
|
-
* toCase('fooBar', 'first-upper-then-lower') // => 'Foobar'
|
|
34
|
-
* toCase('FooBar', 'first-lower-then-upper') // => 'fOOBAR'
|
|
35
|
-
* toCase('fooBar', 'first-upper-alternating') // => 'FoObAr'
|
|
36
|
-
* toCase('FooBar', 'first-lower-alternating') // => 'fOoBaR'
|
|
37
|
-
* toCase('fooBar', 'camel') // => 'fooBar'
|
|
38
|
-
* toCase('fooBar', 'pascal') // => 'FooBar'
|
|
39
|
-
* toCase('fooBar', 'kebab') // => 'foo-bar'
|
|
40
|
-
* toCase('fooBar', 'snake') // => 'foo_bar'
|
|
41
|
-
*/
|
|
42
|
-
export type StringCasing = WordCasing | 'camel' | 'pascal' | 'kebab' | 'snake' | 'custom';
|
|
43
|
-
|
|
44
|
-
export type StringCasingWithOptions<T extends StringCasing = StringCasing> = {
|
|
45
|
-
casing: T;
|
|
46
|
-
} & CaseOptions<T>;
|
|
47
|
-
|
|
48
|
-
export type ExtendedStringCasing = StringCasing | StringCasingWithOptions;
|
|
49
|
-
|
|
50
|
-
export type CaseOptions<T extends StringCasing> = T extends 'camel' ? Partial<CamelCaseOptions>
|
|
51
|
-
: T extends 'pascal' ? Partial<PascalCaseOptions>
|
|
52
|
-
: T extends 'kebab' ? Partial<KebabCaseOptions>
|
|
53
|
-
: T extends 'snake' ? Partial<SnakeCaseOptions>
|
|
54
|
-
: T extends 'custom' ? CustomCaseOptions
|
|
55
|
-
: never;
|
|
56
|
-
|
|
57
|
-
export type BaseCaseOptions = {
|
|
58
|
-
/**
|
|
59
|
-
* Specifies a prefix to add to the string.
|
|
60
|
-
* @default undefined
|
|
61
|
-
* @example
|
|
62
|
-
* toCase('foo', { prefix: 'bar' }) // => 'barfoo'
|
|
63
|
-
*/
|
|
64
|
-
prefix?: string;
|
|
65
|
-
/**
|
|
66
|
-
* Specifies a suffix to add to the string.
|
|
67
|
-
* @default undefined
|
|
68
|
-
* @example
|
|
69
|
-
* toCase('foo', { suffix: 'bar' }) // => 'foobar'
|
|
70
|
-
*/
|
|
71
|
-
suffix?: string;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export type CamelCaseOptions = BaseCaseOptions & {
|
|
75
|
-
/**
|
|
76
|
-
* Controls the casing of all characters except the first one for each word.
|
|
77
|
-
*
|
|
78
|
-
* If true, all characters except the first one will remain unchanged; otherwise, all characters except the first one will be converted to lowercase.
|
|
79
|
-
*
|
|
80
|
-
* @default false
|
|
81
|
-
* @example
|
|
82
|
-
* toCamelCase('fooBAR') // => 'fooBar'
|
|
83
|
-
* toCamelCase('fooBAR', { keepOriginalCase: false }) // => 'fooBar'
|
|
84
|
-
* toCamelCase('fooBAR', { keepOriginalCase: true }) // => 'fooBAR'
|
|
85
|
-
*/
|
|
86
|
-
keepOriginalCase: boolean;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export type PascalCaseOptions = BaseCaseOptions & {
|
|
90
|
-
/**
|
|
91
|
-
* Controls the casing of all characters except the first one for each word.
|
|
92
|
-
*
|
|
93
|
-
* If true, all characters except the first one will remain unchanged; otherwise, all characters except the first one will be converted to lowercase.
|
|
94
|
-
*
|
|
95
|
-
* @default false
|
|
96
|
-
* @example
|
|
97
|
-
* toCamelCase('FooBAR') // => 'FooBar'
|
|
98
|
-
* toCamelCase('FooBAR', { keepOriginalCase: false }) // => 'FooBar'
|
|
99
|
-
* toCamelCase('FooBAR', { keepOriginalCase: true }) // => 'FooBAR'
|
|
100
|
-
*/
|
|
101
|
-
keepOriginalCase: boolean;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export type KebabCaseOptions = BaseCaseOptions & {
|
|
105
|
-
/**
|
|
106
|
-
* Specifies the casing of words.
|
|
107
|
-
* @default 'all-lower'
|
|
108
|
-
* @example
|
|
109
|
-
* toKebabCase('Foo bAR') // => 'foo-bar'
|
|
110
|
-
* toKebabCase('Foo bAR', { wordCasing: 'all-upper' }) // => 'FOO-BAR'
|
|
111
|
-
*/
|
|
112
|
-
wordCasing: WordCasing;
|
|
113
|
-
/**
|
|
114
|
-
* Specifies the casing of the first word. If undefined uses the casing option.
|
|
115
|
-
* @default undefined
|
|
116
|
-
* @example
|
|
117
|
-
* toKebabCase('Foo bAR') // => 'foo-bar'
|
|
118
|
-
* toKebabCase('Foo bAR', { firstWordCasing: 'all-upper' }) // => 'FOO-bar'
|
|
119
|
-
* toKebabCase('Foo bAR', { wordCasing: 'all-upper', firstWordCasing: 'all-lower' }) // => 'foo-BAR'
|
|
120
|
-
*/
|
|
121
|
-
firstWordCasing?: WordCasing;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export type SnakeCaseOptions = BaseCaseOptions & {
|
|
125
|
-
/**
|
|
126
|
-
* Specifies the casing of words.
|
|
127
|
-
* @default 'all-upper'
|
|
128
|
-
* @example
|
|
129
|
-
* toSnakeCase('Foo bAR') // => 'FOO_BAR'
|
|
130
|
-
* toSnakeCase('Foo bAR', { wordCasing: 'all-lower' }) // => 'foo_bar'
|
|
131
|
-
*/
|
|
132
|
-
wordCasing: WordCasing;
|
|
133
|
-
/**
|
|
134
|
-
* Specifies the casing of the first word. If undefined uses the casing option.
|
|
135
|
-
* @default undefined
|
|
136
|
-
* @example
|
|
137
|
-
* toSnakeCase('Foo bAR') // => 'FOO_BAR'
|
|
138
|
-
* toSnakeCase('Foo bAR', { firstWordCasing: 'all-lower' }) // => 'foo_BAR'
|
|
139
|
-
* toSnakeCase('Foo bAR', { wordCasing: 'all-lower', firstWordCasing: 'all-upper' }) // => 'FOO_bar'
|
|
140
|
-
*/
|
|
141
|
-
firstWordCasing?: WordCasing;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export type CustomCaseOptions =
|
|
145
|
-
& BaseCaseOptions
|
|
146
|
-
& {
|
|
147
|
-
/**
|
|
148
|
-
* Specifies the separator between words.
|
|
149
|
-
* @default undefined
|
|
150
|
-
* @example
|
|
151
|
-
* toCustomCase('Foo bAR', { wordCasing: 'first-upper-then-lower', wordSeparator: '~' }) // => 'Foo~Bar'
|
|
152
|
-
*/
|
|
153
|
-
wordSeparator?: string;
|
|
154
|
-
}
|
|
155
|
-
& (
|
|
156
|
-
| {
|
|
157
|
-
/**
|
|
158
|
-
* Specifies the casing of words.
|
|
159
|
-
* @example
|
|
160
|
-
* toCustomCase('Foo bAR', { wordCasing: 'first-upper-then-lower' }) // => 'FooBar'
|
|
161
|
-
*/
|
|
162
|
-
wordCasing: WordCasing;
|
|
163
|
-
/**
|
|
164
|
-
* Specifies the casing of the first word. If undefined uses the casing option.
|
|
165
|
-
* @default undefined
|
|
166
|
-
* @example
|
|
167
|
-
* toCustomCase('Foo bAR', { wordCasing: 'first-upper-then-lower', firstWordCasing: 'all-upper' }) // => 'FOOBar'
|
|
168
|
-
*/
|
|
169
|
-
firstWordCasing?: WordCasing;
|
|
170
|
-
}
|
|
171
|
-
| {
|
|
172
|
-
/**
|
|
173
|
-
* Specifies the casing of words.
|
|
174
|
-
* @example
|
|
175
|
-
* toCustomCase('Foo bAR baz', { wordCasing: (wordIndex) => (wordIndex % 2 === 0 ? 'all-upper' : 'all-lower') }) // => 'FOObarBAZ'
|
|
176
|
-
*/
|
|
177
|
-
wordCasing: (wordIndex: number) => WordCasing;
|
|
178
|
-
}
|
|
179
|
-
);
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// deno-lint-ignore-file no-explicit-any ban-types
|
|
2
|
-
export type Merge<U extends unknown[]> = U extends [infer A, ...infer R] ? A & Merge<R> : {};
|
|
3
|
-
|
|
4
|
-
export type OptionalProperties<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
5
|
-
export type RequiredProperties<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
6
|
-
|
|
7
|
-
export type ArrayItem<T> = T extends (infer U)[] ? U : never;
|
|
8
|
-
export type SingleOrMultiple<T> = T | T[];
|
|
9
|
-
export type Single<T> = T extends (infer U)[] ? U : T;
|
|
10
|
-
export type Multiple<T> = T extends (infer U)[] ? U[] : T[];
|
|
11
|
-
|
|
12
|
-
export type Nullable<T> = T | null | undefined;
|
|
13
|
-
|
|
14
|
-
export interface Constructor<T, TArgs extends any[] = any[]> extends Function {
|
|
15
|
-
new (...args: TArgs): T;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type EmptyConstructor<T> = Constructor<T, []>;
|
|
19
|
-
|
|
20
|
-
export type FunctionNames<T> = {
|
|
21
|
-
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
22
|
-
}[keyof T];
|
|
23
|
-
|
|
24
|
-
export type Prettify<T> =
|
|
25
|
-
& {
|
|
26
|
-
[K in keyof T]: T[K];
|
|
27
|
-
}
|
|
28
|
-
& {};
|
|
29
|
-
|
|
30
|
-
export type ValueOf<T> = T[keyof T];
|
|
31
|
-
|
|
32
|
-
export type NonEmptyArray<T> = [T, ...T[]];
|
|
33
|
-
|
|
34
|
-
type MustInclude<T, U extends T[]> = [T] extends [ValueOf<U>] ? U : never;
|
|
35
|
-
export function stringUnionToArray<T>(): <U extends NonEmptyArray<T>>(
|
|
36
|
-
...elements: MustInclude<T, U>
|
|
37
|
-
) => MustInclude<T, U> {
|
|
38
|
-
return (...elements) => elements;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type StringSuggestions<T extends string> = T | Omit<string, T>;
|
|
42
|
-
export function suggestionsAsString<T>(
|
|
43
|
-
value: T,
|
|
44
|
-
): T extends StringSuggestions<infer U> ? Exclude<T, StringSuggestions<U>> | string : T {
|
|
45
|
-
return value as any;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type ParametersWithOverloads<T extends (...args: any[]) => any> = T extends {
|
|
49
|
-
(...args: infer A1): any;
|
|
50
|
-
(...args: infer A2): any;
|
|
51
|
-
(...args: infer A3): any;
|
|
52
|
-
(...args: infer A4): any;
|
|
53
|
-
(...args: infer A5): any;
|
|
54
|
-
(...args: infer A6): any;
|
|
55
|
-
} ? A1 | A2 | A3 | A4 | A5 | A6
|
|
56
|
-
: T extends {
|
|
57
|
-
(...args: infer A1): any;
|
|
58
|
-
(...args: infer A2): any;
|
|
59
|
-
(...args: infer A3): any;
|
|
60
|
-
(...args: infer A4): any;
|
|
61
|
-
(...args: infer A5): any;
|
|
62
|
-
} ? A1 | A2 | A3 | A4 | A5
|
|
63
|
-
: T extends {
|
|
64
|
-
(...args: infer A1): any;
|
|
65
|
-
(...args: infer A2): any;
|
|
66
|
-
(...args: infer A3): any;
|
|
67
|
-
(...args: infer A4): any;
|
|
68
|
-
} ? A1 | A2 | A3 | A4
|
|
69
|
-
: T extends {
|
|
70
|
-
(...args: infer A1): any;
|
|
71
|
-
(...args: infer A2): any;
|
|
72
|
-
(...args: infer A3): any;
|
|
73
|
-
} ? A1 | A2 | A3
|
|
74
|
-
: T extends {
|
|
75
|
-
(...args: infer A1): any;
|
|
76
|
-
(...args: infer A2): any;
|
|
77
|
-
} ? A1 | A2
|
|
78
|
-
: T extends {
|
|
79
|
-
(...args: infer A1): any;
|
|
80
|
-
} ? A1
|
|
81
|
-
: never;
|
|
82
|
-
|
|
83
|
-
type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : _TupleOf<T, N, [T, ...R]>;
|
|
84
|
-
export type TupleWithCount<T, N extends number | number[]> = N extends number ? number extends N ? T[]
|
|
85
|
-
: _TupleOf<T, N, []>
|
|
86
|
-
: N extends [infer A, ...infer R]
|
|
87
|
-
? A extends number ? R extends number[] ? TupleWithCount<T, A> | TupleWithCount<T, R>
|
|
88
|
-
: never
|
|
89
|
-
: never
|
|
90
|
-
: N extends [] ? never
|
|
91
|
-
: T[];
|
|
92
|
-
|
|
93
|
-
export type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import "../_dnt.test_polyfills.js";
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
declutterApiData,
|
|
6
|
-
openApiV2FilesDir,
|
|
7
|
-
openApiV3_1FilesDir,
|
|
8
|
-
openApiV3FilesDir,
|
|
9
|
-
type OpenApiVersion,
|
|
10
|
-
verify,
|
|
11
|
-
} from '@goast/test-utils';
|
|
12
|
-
|
|
13
|
-
import { describe, it } from '../deps/jsr.io/@std/testing/1.0.3/bdd.js';
|
|
14
|
-
import { OpenApiParser, toCustomCase } from '../mod.js';
|
|
15
|
-
|
|
16
|
-
const filePaths: { [P in OpenApiVersion]: string } = {
|
|
17
|
-
'2.0': openApiV2FilesDir,
|
|
18
|
-
'3.0': openApiV3FilesDir,
|
|
19
|
-
'3.1': openApiV3_1FilesDir,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const testFilesAllVersions: string[] = ['simple-schemas.yml', 'detailed-schemas.yml', 'object-schemas.yml'];
|
|
23
|
-
const testFilesV3x: string[] = ['oneof-schemas.yml', 'discriminated-schemas.yml'];
|
|
24
|
-
|
|
25
|
-
for (const [version, path] of Object.entries(filePaths)) {
|
|
26
|
-
describe(`OpenAPI V${version}`, () => {
|
|
27
|
-
const testFiles = version.startsWith('3') ? testFilesAllVersions.concat(testFilesV3x) : testFilesAllVersions;
|
|
28
|
-
for (const file of testFiles) {
|
|
29
|
-
const fileWithoutExt = file.replace(/\.[^/.]+$/, '');
|
|
30
|
-
it(
|
|
31
|
-
toCustomCase(fileWithoutExt, {
|
|
32
|
-
wordCasing: 'all-lower',
|
|
33
|
-
wordSeparator: ' ',
|
|
34
|
-
}),
|
|
35
|
-
async (t) => {
|
|
36
|
-
const filePath = join(path, file);
|
|
37
|
-
const data = await new OpenApiParser().parseApisAndTransform(filePath);
|
|
38
|
-
|
|
39
|
-
// Remove properties that do not need to be verified
|
|
40
|
-
for (const schema of Object.values(data.schemas)) {
|
|
41
|
-
delete (schema.$src as Record<string, unknown>).document;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declutterApiData(data);
|
|
45
|
-
await verify(t, data);
|
|
46
|
-
},
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|