typia 13.0.1-dev.20260703.1 → 13.0.2
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 +169 -171
- package/lib/TypeGuardError.mjs +42 -3
- package/lib/TypeGuardError.mjs.map +1 -1
- package/lib/_virtual/_rolldown/runtime.mjs +17 -0
- package/lib/compare.mjs +39 -3
- package/lib/compare.mjs.map +1 -1
- package/lib/executable/TypiaGenerateWizard.js +7 -2
- package/lib/executable/TypiaGenerateWizard.js.map +1 -1
- package/lib/executable/TypiaGenerateWizard.mjs +474 -3
- package/lib/executable/TypiaGenerateWizard.mjs.map +1 -1
- package/lib/executable/generate/ttsc.js +11 -8
- package/lib/executable/generate/ttsc.js.map +1 -1
- package/lib/executable/generate/ttsc.mjs +37 -3
- package/lib/executable/generate/ttsc.mjs.map +1 -1
- package/lib/executable/typia.js +10 -4
- package/lib/executable/typia.js.map +1 -1
- package/lib/executable/typia.mjs +59 -3
- package/lib/executable/typia.mjs.map +1 -1
- package/lib/functional.mjs +99 -3
- package/lib/functional.mjs.map +1 -1
- package/lib/http.mjs +139 -3
- package/lib/http.mjs.map +1 -1
- package/lib/index.mjs +18 -2
- package/lib/index.mjs.map +1 -1
- package/lib/internal/_IProtobufWriter.mjs +0 -3
- package/lib/internal/_ProtobufReader.js +7 -6
- package/lib/internal/_ProtobufReader.js.map +1 -1
- package/lib/internal/_ProtobufReader.mjs +140 -3
- package/lib/internal/_ProtobufReader.mjs.map +1 -1
- package/lib/internal/_ProtobufSizer.mjs +84 -3
- package/lib/internal/_ProtobufSizer.mjs.map +1 -1
- package/lib/internal/_ProtobufWriter.mjs +94 -3
- package/lib/internal/_ProtobufWriter.mjs.map +1 -1
- package/lib/internal/_accessExpressionAsString.mjs +46 -3
- package/lib/internal/_accessExpressionAsString.mjs.map +1 -1
- package/lib/internal/_assertGuard.mjs +11 -3
- package/lib/internal/_assertGuard.mjs.map +1 -1
- package/lib/internal/_coerceLlmArguments.mjs +7 -3
- package/lib/internal/_coerceLlmArguments.mjs.map +1 -1
- package/lib/internal/_createStandardSchema.mjs +64 -3
- package/lib/internal/_createStandardSchema.mjs.map +1 -1
- package/lib/internal/_functionalTypeGuardErrorFactory.mjs +7 -3
- package/lib/internal/_functionalTypeGuardErrorFactory.mjs.map +1 -1
- package/lib/internal/_httpFormDataReadArray.mjs +6 -3
- package/lib/internal/_httpFormDataReadArray.mjs.map +1 -1
- package/lib/internal/_httpFormDataReadBigint.mjs +13 -3
- package/lib/internal/_httpFormDataReadBigint.mjs.map +1 -1
- package/lib/internal/_httpFormDataReadBlob.mjs +6 -3
- package/lib/internal/_httpFormDataReadBlob.mjs.map +1 -1
- package/lib/internal/_httpFormDataReadBoolean.mjs +6 -3
- package/lib/internal/_httpFormDataReadBoolean.mjs.map +1 -1
- package/lib/internal/_httpFormDataReadFile.mjs +6 -3
- package/lib/internal/_httpFormDataReadFile.mjs.map +1 -1
- package/lib/internal/_httpFormDataReadNumber.mjs +10 -3
- package/lib/internal/_httpFormDataReadNumber.mjs.map +1 -1
- package/lib/internal/_httpFormDataReadString.mjs +6 -3
- package/lib/internal/_httpFormDataReadString.mjs.map +1 -1
- package/lib/internal/_httpHeaderReadBigint.mjs +13 -3
- package/lib/internal/_httpHeaderReadBigint.mjs.map +1 -1
- package/lib/internal/_httpHeaderReadBoolean.mjs +6 -3
- package/lib/internal/_httpHeaderReadBoolean.mjs.map +1 -1
- package/lib/internal/_httpHeaderReadNumber.mjs +10 -3
- package/lib/internal/_httpHeaderReadNumber.mjs.map +1 -1
- package/lib/internal/_httpParameterReadBigint.mjs +13 -3
- package/lib/internal/_httpParameterReadBigint.mjs.map +1 -1
- package/lib/internal/_httpParameterReadBoolean.mjs +6 -3
- package/lib/internal/_httpParameterReadBoolean.mjs.map +1 -1
- package/lib/internal/_httpParameterReadNumber.mjs +10 -3
- package/lib/internal/_httpParameterReadNumber.mjs.map +1 -1
- package/lib/internal/_httpParameterReadString.mjs +6 -3
- package/lib/internal/_httpParameterReadString.mjs.map +1 -1
- package/lib/internal/_httpQueryParseURLSearchParams.mjs +13 -3
- package/lib/internal/_httpQueryParseURLSearchParams.mjs.map +1 -1
- package/lib/internal/_httpQueryReadArray.mjs +6 -3
- package/lib/internal/_httpQueryReadArray.mjs.map +1 -1
- package/lib/internal/_httpQueryReadBigint.mjs +13 -3
- package/lib/internal/_httpQueryReadBigint.mjs.map +1 -1
- package/lib/internal/_httpQueryReadBoolean.mjs +6 -3
- package/lib/internal/_httpQueryReadBoolean.mjs.map +1 -1
- package/lib/internal/_httpQueryReadNumber.mjs +10 -3
- package/lib/internal/_httpQueryReadNumber.mjs.map +1 -1
- package/lib/internal/_httpQueryReadString.mjs +6 -3
- package/lib/internal/_httpQueryReadString.mjs.map +1 -1
- package/lib/internal/_isBetween.mjs +6 -3
- package/lib/internal/_isBetween.mjs.map +1 -1
- package/lib/internal/_isBigintString.mjs +13 -3
- package/lib/internal/_isBigintString.mjs.map +1 -1
- package/lib/internal/_isFormatByte.mjs +10 -3
- package/lib/internal/_isFormatByte.mjs.map +1 -1
- package/lib/internal/_isFormatDate.mjs +7 -3
- package/lib/internal/_isFormatDate.mjs.map +1 -1
- package/lib/internal/_isFormatDateTime.mjs +7 -3
- package/lib/internal/_isFormatDateTime.mjs.map +1 -1
- package/lib/internal/_isFormatDuration.mjs +7 -3
- package/lib/internal/_isFormatDuration.mjs.map +1 -1
- package/lib/internal/_isFormatEmail.mjs +7 -3
- package/lib/internal/_isFormatEmail.mjs.map +1 -1
- package/lib/internal/_isFormatHostname.mjs +7 -3
- package/lib/internal/_isFormatHostname.mjs.map +1 -1
- package/lib/internal/_isFormatIdnEmail.mjs +7 -3
- package/lib/internal/_isFormatIdnEmail.mjs.map +1 -1
- package/lib/internal/_isFormatIdnHostname.mjs +7 -3
- package/lib/internal/_isFormatIdnHostname.mjs.map +1 -1
- package/lib/internal/_isFormatIpv4.mjs +7 -3
- package/lib/internal/_isFormatIpv4.mjs.map +1 -1
- package/lib/internal/_isFormatIpv6.mjs +7 -3
- package/lib/internal/_isFormatIpv6.mjs.map +1 -1
- package/lib/internal/_isFormatIri.mjs +7 -3
- package/lib/internal/_isFormatIri.mjs.map +1 -1
- package/lib/internal/_isFormatIriReference.mjs +7 -3
- package/lib/internal/_isFormatIriReference.mjs.map +1 -1
- package/lib/internal/_isFormatJsonPointer.mjs +7 -3
- package/lib/internal/_isFormatJsonPointer.mjs.map +1 -1
- package/lib/internal/_isFormatPassword.mjs +6 -3
- package/lib/internal/_isFormatPassword.mjs.map +1 -1
- package/lib/internal/_isFormatRegex.mjs +13 -3
- package/lib/internal/_isFormatRegex.mjs.map +1 -1
- package/lib/internal/_isFormatRelativeJsonPointer.mjs +7 -3
- package/lib/internal/_isFormatRelativeJsonPointer.mjs.map +1 -1
- package/lib/internal/_isFormatTime.mjs +7 -3
- package/lib/internal/_isFormatTime.mjs.map +1 -1
- package/lib/internal/_isFormatUri.mjs +8 -3
- package/lib/internal/_isFormatUri.mjs.map +1 -1
- package/lib/internal/_isFormatUriReference.mjs +7 -3
- package/lib/internal/_isFormatUriReference.mjs.map +1 -1
- package/lib/internal/_isFormatUriTemplate.mjs +7 -3
- package/lib/internal/_isFormatUriTemplate.mjs.map +1 -1
- package/lib/internal/_isFormatUrl.mjs +7 -3
- package/lib/internal/_isFormatUrl.mjs.map +1 -1
- package/lib/internal/_isFormatUuid.mjs +7 -3
- package/lib/internal/_isFormatUuid.mjs.map +1 -1
- package/lib/internal/_isTypeFloat.mjs +8 -3
- package/lib/internal/_isTypeFloat.mjs.map +1 -1
- package/lib/internal/_isTypeInt16.mjs +8 -3
- package/lib/internal/_isTypeInt16.mjs.map +1 -1
- package/lib/internal/_isTypeInt32.mjs +8 -3
- package/lib/internal/_isTypeInt32.mjs.map +1 -1
- package/lib/internal/_isTypeInt64.mjs +8 -3
- package/lib/internal/_isTypeInt64.mjs.map +1 -1
- package/lib/internal/_isTypeInt8.mjs +8 -3
- package/lib/internal/_isTypeInt8.mjs.map +1 -1
- package/lib/internal/_isTypeUint16.mjs +8 -3
- package/lib/internal/_isTypeUint16.mjs.map +1 -1
- package/lib/internal/_isTypeUint32.mjs +8 -3
- package/lib/internal/_isTypeUint32.mjs.map +1 -1
- package/lib/internal/_isTypeUint64.mjs +8 -3
- package/lib/internal/_isTypeUint64.mjs.map +1 -1
- package/lib/internal/_isTypeUint8.mjs +8 -3
- package/lib/internal/_isTypeUint8.mjs.map +1 -1
- package/lib/internal/_isUniqueItems.mjs +67 -3
- package/lib/internal/_isUniqueItems.mjs.map +1 -1
- package/lib/internal/_jsonStringifyNumber.mjs +6 -3
- package/lib/internal/_jsonStringifyNumber.mjs.map +1 -1
- package/lib/internal/_jsonStringifyRest.mjs +8 -3
- package/lib/internal/_jsonStringifyRest.mjs.map +1 -1
- package/lib/internal/_jsonStringifyString.mjs +34 -3
- package/lib/internal/_jsonStringifyString.mjs.map +1 -1
- package/lib/internal/_jsonStringifyTail.mjs +6 -3
- package/lib/internal/_jsonStringifyTail.mjs.map +1 -1
- package/lib/internal/_llmApplicationFinalize.mjs +19 -3
- package/lib/internal/_llmApplicationFinalize.mjs.map +1 -1
- package/lib/internal/_notationAny.mjs +18 -3
- package/lib/internal/_notationAny.mjs.map +1 -1
- package/lib/internal/_notationCamel.mjs +11 -3
- package/lib/internal/_notationCamel.mjs.map +1 -1
- package/lib/internal/_notationPascal.mjs +11 -3
- package/lib/internal/_notationPascal.mjs.map +1 -1
- package/lib/internal/_notationSnake.mjs +32 -3
- package/lib/internal/_notationSnake.mjs.map +1 -1
- package/lib/internal/_parseLlmArguments.mjs +7 -3
- package/lib/internal/_parseLlmArguments.mjs.map +1 -1
- package/lib/internal/_plainCloneAny.mjs +35 -3
- package/lib/internal/_plainCloneAny.mjs.map +1 -1
- package/lib/internal/_randomArray.mjs +22 -3
- package/lib/internal/_randomArray.mjs.map +1 -1
- package/lib/internal/_randomBigint.mjs +7 -3
- package/lib/internal/_randomBigint.mjs.map +1 -1
- package/lib/internal/_randomBoolean.mjs +6 -3
- package/lib/internal/_randomBoolean.mjs.map +1 -1
- package/lib/internal/_randomFormatByte.mjs +7 -3
- package/lib/internal/_randomFormatByte.mjs.map +1 -1
- package/lib/internal/_randomFormatDate.mjs +11 -3
- package/lib/internal/_randomFormatDate.mjs.map +1 -1
- package/lib/internal/_randomFormatDatetime.mjs +11 -3
- package/lib/internal/_randomFormatDatetime.mjs.map +1 -1
- package/lib/internal/_randomFormatDuration.mjs +26 -3
- package/lib/internal/_randomFormatDuration.mjs.map +1 -1
- package/lib/internal/_randomFormatEmail.mjs +12 -3
- package/lib/internal/_randomFormatEmail.mjs.map +1 -1
- package/lib/internal/_randomFormatHostname.mjs +12 -3
- package/lib/internal/_randomFormatHostname.mjs.map +1 -1
- package/lib/internal/_randomFormatIdnEmail.mjs +7 -3
- package/lib/internal/_randomFormatIdnEmail.mjs.map +1 -1
- package/lib/internal/_randomFormatIdnHostname.mjs +7 -3
- package/lib/internal/_randomFormatIdnHostname.mjs.map +1 -1
- package/lib/internal/_randomFormatIpv4.mjs +12 -3
- package/lib/internal/_randomFormatIpv4.mjs.map +1 -1
- package/lib/internal/_randomFormatIpv6.mjs +12 -3
- package/lib/internal/_randomFormatIpv6.mjs.map +1 -1
- package/lib/internal/_randomFormatIri.mjs +7 -3
- package/lib/internal/_randomFormatIri.mjs.map +1 -1
- package/lib/internal/_randomFormatIriReference.mjs +7 -3
- package/lib/internal/_randomFormatIriReference.mjs.map +1 -1
- package/lib/internal/_randomFormatJsonPointer.mjs +12 -3
- package/lib/internal/_randomFormatJsonPointer.mjs.map +1 -1
- package/lib/internal/_randomFormatPassword.mjs +11 -3
- package/lib/internal/_randomFormatPassword.mjs.map +1 -1
- package/lib/internal/_randomFormatRegex.mjs +7 -3
- package/lib/internal/_randomFormatRegex.mjs.map +1 -1
- package/lib/internal/_randomFormatRelativeJsonPointer.mjs +11 -3
- package/lib/internal/_randomFormatRelativeJsonPointer.mjs.map +1 -1
- package/lib/internal/_randomFormatTime.mjs +12 -3
- package/lib/internal/_randomFormatTime.mjs.map +1 -1
- package/lib/internal/_randomFormatUri.mjs +7 -3
- package/lib/internal/_randomFormatUri.mjs.map +1 -1
- package/lib/internal/_randomFormatUriReference.mjs +7 -3
- package/lib/internal/_randomFormatUriReference.mjs.map +1 -1
- package/lib/internal/_randomFormatUriTemplate.mjs +7 -3
- package/lib/internal/_randomFormatUriTemplate.mjs.map +1 -1
- package/lib/internal/_randomFormatUrl.mjs +12 -3
- package/lib/internal/_randomFormatUrl.mjs.map +1 -1
- package/lib/internal/_randomFormatUuid.mjs +9 -3
- package/lib/internal/_randomFormatUuid.mjs.map +1 -1
- package/lib/internal/_randomInteger.mjs +31 -3
- package/lib/internal/_randomInteger.mjs.map +1 -1
- package/lib/internal/_randomNumber.mjs +45 -3
- package/lib/internal/_randomNumber.mjs.map +1 -1
- package/lib/internal/_randomPattern.mjs +14 -3
- package/lib/internal/_randomPattern.mjs.map +1 -1
- package/lib/internal/_randomPick.mjs +12 -3
- package/lib/internal/_randomPick.mjs.map +1 -1
- package/lib/internal/_randomString.mjs +23 -3
- package/lib/internal/_randomString.mjs.map +1 -1
- package/lib/internal/_throwTypeGuardError.mjs +9 -3
- package/lib/internal/_throwTypeGuardError.mjs.map +1 -1
- package/lib/internal/_validateReport.mjs +23 -3
- package/lib/internal/_validateReport.mjs.map +1 -1
- package/lib/internal/private/__notationCapitalize.mjs +6 -3
- package/lib/internal/private/__notationCapitalize.mjs.map +1 -1
- package/lib/internal/private/__notationUnsnake.mjs +15 -3
- package/lib/internal/private/__notationUnsnake.mjs.map +1 -1
- package/lib/json.mjs +94 -3
- package/lib/json.mjs.map +1 -1
- package/lib/llm.mjs +54 -3
- package/lib/llm.mjs.map +1 -1
- package/lib/module.mjs +131 -2
- package/lib/module.mjs.map +1 -1
- package/lib/notations.mjs +169 -3
- package/lib/notations.mjs.map +1 -1
- package/lib/plain.mjs +119 -3
- package/lib/plain.mjs.map +1 -1
- package/lib/protobuf.mjs +94 -3
- package/lib/protobuf.mjs.map +1 -1
- package/lib/re-exports.d.ts +2 -1
- package/lib/re-exports.js +5 -1
- package/lib/re-exports.js.map +1 -1
- package/lib/re-exports.mjs +2 -2
- package/lib/reflect.mjs +29 -3
- package/lib/reflect.mjs.map +1 -1
- package/lib/transform.mjs +15 -2
- package/lib/transform.mjs.map +1 -1
- package/lib/transformers/NoTransformConfigurationError.mjs +19 -3
- package/lib/transformers/NoTransformConfigurationError.mjs.map +1 -1
- package/native/adapter/adapter.go +29 -29
- package/native/adapter/adapter_options_branch_matrix_test.go +54 -54
- package/native/adapter/visit.go +173 -173
- package/native/adapter/visit_property_chain_edges_test.go +129 -129
- package/native/cmd/ttsc-typia/any_array_type_tags_transform_test.go +204 -204
- package/native/cmd/ttsc-typia/atomic_intersection_schema_transform_test.go +148 -148
- package/native/cmd/ttsc-typia/boolean_literal_discriminant_schema_transform_test.go +374 -374
- package/native/cmd/ttsc-typia/build.go +188 -188
- package/native/cmd/ttsc-typia/build_reports_semantic_diagnostics_test.go +34 -34
- package/native/cmd/ttsc-typia/build_reports_syntactic_diagnostics_test.go +34 -34
- package/native/cmd/ttsc-typia/command_routes_and_diagnostics_coverage_test.go +314 -314
- package/native/cmd/ttsc-typia/compare_equal_cover_transform_test.go +271 -271
- package/native/cmd/ttsc-typia/compare_less_transform_test.go +180 -180
- package/native/cmd/ttsc-typia/compare_method_delegation_transform_test.go +173 -173
- package/native/cmd/ttsc-typia/demo_rejects_bad_flag_test.go +25 -25
- package/native/cmd/ttsc-typia/diagnostics.go +51 -51
- package/native/cmd/ttsc-typia/dynamic_key_path_helper_alias_transform_test.go +159 -159
- package/native/cmd/ttsc-typia/exclude_type_tag_transform_test.go +176 -176
- package/native/cmd/ttsc-typia/inline_type_display_name_transform_test.go +290 -290
- package/native/cmd/ttsc-typia/instance_union_create_is_transform_test.go +248 -248
- package/native/cmd/ttsc-typia/intersection_all_never_union_transform_test.go +168 -168
- package/native/cmd/ttsc-typia/intersection_brand_transform_test.go +267 -267
- package/native/cmd/ttsc-typia/intersection_nonsensible_backstop_transform_test.go +157 -132
- package/native/cmd/ttsc-typia/intersection_union_validation_transform_test.go +590 -590
- package/native/cmd/ttsc-typia/json_is_stringify_scoped_checker_transform_test.go +206 -0
- package/native/cmd/ttsc-typia/json_stringify_constant_atomic_union_transform_test.go +171 -171
- package/native/cmd/ttsc-typia/main.go +97 -97
- package/native/cmd/ttsc-typia/main_wasm.go +226 -226
- package/native/cmd/ttsc-typia/non_trailing_rest_tuple_transform_test.go +156 -156
- package/native/cmd/ttsc-typia/notation_kebab_case_transform_test.go +186 -186
- package/native/cmd/ttsc-typia/nullable_primitive_property_is_transform_test.go +236 -236
- package/native/cmd/ttsc-typia/object_custom_tag_validation_transform_test.go +332 -332
- package/native/cmd/ttsc-typia/object_union_explicit_pointer_schema_transform_test.go +269 -269
- package/native/cmd/ttsc-typia/plain_classify_class_ref_transform_test.go +261 -261
- package/native/cmd/ttsc-typia/plain_classify_container_seed_transform_test.go +144 -144
- package/native/cmd/ttsc-typia/plain_classify_cross_module_extra_transform_test.go +211 -211
- package/native/cmd/ttsc-typia/plain_classify_deep_nested_transform_test.go +184 -184
- package/native/cmd/ttsc-typia/plain_classify_field_copy_transform_test.go +204 -204
- package/native/cmd/ttsc-typia/plain_classify_from_new_transform_test.go +465 -465
- package/native/cmd/ttsc-typia/plain_classify_strategy_edges_transform_test.go +519 -519
- package/native/cmd/ttsc-typia/plain_classify_union_transform_test.go +149 -149
- package/native/cmd/ttsc-typia/plain_classify_validated_union_transform_test.go +212 -212
- package/native/cmd/ttsc-typia/plain_clone_bigint_wrapper_transform_test.go +153 -153
- package/native/cmd/ttsc-typia/plugin_options_missing_config_test.go +26 -26
- package/native/cmd/ttsc-typia/plugin_options_undefined_false_test.go +36 -36
- package/native/cmd/ttsc-typia/project_catalog_transform_coverage_test.go +73 -73
- package/native/cmd/ttsc-typia/protobuf_object_generic_union_encode_transform_test.go +248 -248
- package/native/cmd/ttsc-typia/protobuf_sequence_field_numbers_transform_test.go +107 -107
- package/native/cmd/ttsc-typia/random_recursive_min_items_diagnostic_test.go +234 -234
- package/native/cmd/ttsc-typia/random_unsatisfiable_recursive_diagnostic_test.go +146 -146
- package/native/cmd/ttsc-typia/recursive_visit_tracking_transform_test.go +473 -473
- package/native/cmd/ttsc-typia/run_default_build_route_test.go +31 -31
- package/native/cmd/ttsc-typia/schema_dts_role_transform_test.go +404 -404
- package/native/cmd/ttsc-typia/shallow_depth_argument_error_transform_test.go +88 -88
- package/native/cmd/ttsc-typia/shallow_depth_limit_transform_test.go +278 -278
- package/native/cmd/ttsc-typia/shallow_depth_runtime_test.go +173 -173
- package/native/cmd/ttsc-typia/shallow_factory_depth_runtime_test.go +171 -171
- package/native/cmd/ttsc-typia/shallow_nested_depth_transform_test.go +148 -148
- package/native/cmd/ttsc-typia/template_interpolation_type_tags_transform_test.go +322 -322
- package/native/cmd/ttsc-typia/template_literal_type_tags_transform_test.go +162 -162
- package/native/cmd/ttsc-typia/transform.go +270 -270
- package/native/cmd/ttsc-typia/transform_declaration_source_produces_no_js_test.go +59 -59
- package/native/cmd/ttsc-typia/transform_diagnostics_preserve_details_test.go +203 -203
- package/native/cmd/ttsc-typia/transform_fixtures_emit_coverage_test.go +528 -528
- package/native/cmd/ttsc-typia/transform_helpers_test.go +155 -155
- package/native/core/context/EmitFactory.go +39 -39
- package/native/core/context/IProgrammerProps.go +14 -14
- package/native/core/context/ITransformOptions.go +9 -9
- package/native/core/context/ITypiaContext.go +36 -36
- package/native/core/context/ImportProgrammer.go +388 -354
- package/native/core/context/TransformerError.go +117 -117
- package/native/core/context/import_programmer_module_identifier_test.go +29 -0
- package/native/core/context/import_programmer_statement_coverage_test.go +71 -71
- package/native/core/context/index.go +1 -1
- package/native/core/context/transformer_error_formatting_test.go +100 -100
- package/native/core/factories/CommentFactory.go +27 -27
- package/native/core/factories/ExpressionFactory.go +357 -357
- package/native/core/factories/FormatCheatSheet.go +30 -30
- package/native/core/factories/IdentifierFactory.go +172 -172
- package/native/core/factories/JsonMetadataFactory.go +154 -154
- package/native/core/factories/LiteralFactory.go +319 -282
- package/native/core/factories/MetadataCommentTagFactory.go +446 -446
- package/native/core/factories/MetadataFactory.go +543 -543
- package/native/core/factories/MetadataTypeTagFactory.go +560 -560
- package/native/core/factories/MetadataTypeTagSchemaFactory.go +117 -117
- package/native/core/factories/NumericRangeFactory.go +132 -132
- package/native/core/factories/ProtobufFactory.go +1090 -1090
- package/native/core/factories/StatementFactory.go +114 -114
- package/native/core/factories/TemplateFactory.go +82 -82
- package/native/core/factories/TypeFactory.go +176 -176
- package/native/core/factories/ValueFactory.go +43 -43
- package/native/core/factories/factory_utility_coverage_test.go +1006 -1006
- package/native/core/factories/index.go +1 -1
- package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +70 -70
- package/native/core/factories/internal/metadata/MetadataHelper.go +425 -425
- package/native/core/factories/internal/metadata/comment_tags_coverage_test.go +184 -184
- package/native/core/factories/internal/metadata/emend_metadata_atomics.go +80 -80
- package/native/core/factories/internal/metadata/emplace_metadata_alias.go +41 -41
- package/native/core/factories/internal/metadata/emplace_metadata_array_type.go +44 -44
- package/native/core/factories/internal/metadata/emplace_metadata_object.go +599 -599
- package/native/core/factories/internal/metadata/emplace_metadata_tuple.go +69 -69
- package/native/core/factories/internal/metadata/explore_metadata.go +75 -75
- package/native/core/factories/internal/metadata/iterate_metadata.go +55 -55
- package/native/core/factories/internal/metadata/iterate_metadata_alias.go +36 -36
- package/native/core/factories/internal/metadata/iterate_metadata_array.go +77 -77
- package/native/core/factories/internal/metadata/iterate_metadata_atomic.go +63 -63
- package/native/core/factories/internal/metadata/iterate_metadata_coalesce.go +30 -30
- package/native/core/factories/internal/metadata/iterate_metadata_collection.go +366 -366
- package/native/core/factories/internal/metadata/iterate_metadata_collection_branch_matrix_test.go +201 -201
- package/native/core/factories/internal/metadata/iterate_metadata_comment_tags.go +34 -34
- package/native/core/factories/internal/metadata/iterate_metadata_constant.go +139 -139
- package/native/core/factories/internal/metadata/iterate_metadata_escape.go +56 -56
- package/native/core/factories/internal/metadata/iterate_metadata_function.go +93 -93
- package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +1054 -1054
- package/native/core/factories/internal/metadata/iterate_metadata_intersection_brand_coverage_test.go +114 -114
- package/native/core/factories/internal/metadata/iterate_metadata_intersection_coverage_test.go +106 -106
- package/native/core/factories/internal/metadata/iterate_metadata_intersection_shareable_name_test.go +22 -22
- package/native/core/factories/internal/metadata/iterate_metadata_map.go +55 -55
- package/native/core/factories/internal/metadata/iterate_metadata_native.go +122 -122
- package/native/core/factories/internal/metadata/iterate_metadata_object.go +35 -35
- package/native/core/factories/internal/metadata/iterate_metadata_set.go +41 -41
- package/native/core/factories/internal/metadata/iterate_metadata_sort.go +202 -202
- package/native/core/factories/internal/metadata/iterate_metadata_template.go +41 -41
- package/native/core/factories/internal/metadata/iterate_metadata_tuple.go +24 -24
- package/native/core/factories/internal/metadata/iterate_metadata_union.go +40 -40
- package/native/core/factories/internal/metadata/js_doc_parameter_name_reads_qualified_name_test.go +55 -55
- package/native/core/factories/internal/metadata/optional_coalesce_coverage_test.go +38 -38
- package/native/core/factories/internal/metadata/sort_constants_coverage_test.go +63 -63
- package/native/core/factories/json_metadata_factory_dedupes_bigint_diagnostics_test.go +36 -36
- package/native/core/factories/json_metadata_factory_rejects_bigint_native_test.go +29 -29
- package/native/core/factories/literal_factory_ordered_object_marshals_json_test.go +40 -0
- package/native/core/factories/metadata_comment_tag_factory_coverage_test.go +239 -239
- package/native/core/factories/protobuf_factory_rejects_invalid_field_names_test.go +75 -75
- package/native/core/index.go +1 -1
- package/native/core/programmers/AssertProgrammer.go +511 -511
- package/native/core/programmers/IsProgrammer.go +418 -419
- package/native/core/programmers/RandomProgrammer.go +1448 -1448
- package/native/core/programmers/ValidateProgrammer.go +488 -488
- package/native/core/programmers/compare/CompareEqualProgrammer.go +668 -668
- package/native/core/programmers/compare/CompareLessProgrammer.go +489 -489
- package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +172 -172
- package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +135 -135
- package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +131 -131
- package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +106 -106
- package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +222 -222
- package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +129 -129
- package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +172 -172
- package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +252 -252
- package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +147 -147
- package/native/core/programmers/functional/functional_assert_helper_coverage_test.go +26 -26
- package/native/core/programmers/functional/index.go +1 -1
- package/native/core/programmers/functional/internal/FunctionalGeneralProgrammer.go +53 -53
- package/native/core/programmers/helpers/AtomicPredicator.go +75 -75
- package/native/core/programmers/helpers/ClassifyJoiner.go +174 -174
- package/native/core/programmers/helpers/CloneJoiner.go +307 -307
- package/native/core/programmers/helpers/FunctionProgrammer.go +218 -218
- package/native/core/programmers/helpers/HttpMetadataUtil.go +30 -30
- package/native/core/programmers/helpers/ICheckEntry.go +14 -14
- package/native/core/programmers/helpers/IExpressionEntry.go +15 -15
- package/native/core/programmers/helpers/ModuloText.go +26 -26
- package/native/core/programmers/helpers/NotationJoiner.go +204 -204
- package/native/core/programmers/helpers/OptionPredicator.go +39 -39
- package/native/core/programmers/helpers/ProtobufUtil.go +273 -273
- package/native/core/programmers/helpers/ProtobufWire.go +14 -14
- package/native/core/programmers/helpers/PruneJoiner.go +290 -290
- package/native/core/programmers/helpers/RandomJoiner.go +805 -805
- package/native/core/programmers/helpers/StringifyJoinder.go +409 -409
- package/native/core/programmers/helpers/StringifyPredicator.go +25 -25
- package/native/core/programmers/helpers/UnionExplorer.go +966 -966
- package/native/core/programmers/helpers/UnionPredicator.go +92 -92
- package/native/core/programmers/helpers/clone_joiner_optional_condition_test.go +70 -70
- package/native/core/programmers/helpers/disable_function_programmer_declare.go +10 -10
- package/native/core/programmers/helpers/function_programmer_unique_names_test.go +54 -54
- package/native/core/programmers/helpers/joiner_branch_coverage_test.go +147 -147
- package/native/core/programmers/helpers/random_joiner_recursive_array_guard_test.go +166 -166
- package/native/core/programmers/helpers/union_explorer_coverage_test.go +135 -135
- package/native/core/programmers/helpers/union_predicator_checks_neighbor_flag_test.go +34 -34
- package/native/core/programmers/helpers/union_predicator_skips_atomic_like_native_fields_test.go +65 -65
- package/native/core/programmers/helpers/union_predicator_skips_collection_bucket_fields_test.go +72 -72
- package/native/core/programmers/helpers/union_predicator_skips_shared_native_names_test.go +239 -239
- package/native/core/programmers/helpers/union_predicator_skips_shared_object_fields_test.go +43 -43
- package/native/core/programmers/helpers/union_predicator_skips_shared_template_fields_test.go +57 -57
- package/native/core/programmers/http/HttpAssertFormDataProgrammer.go +116 -116
- package/native/core/programmers/http/HttpAssertHeadersProgrammer.go +59 -59
- package/native/core/programmers/http/HttpAssertQueryProgrammer.go +71 -71
- package/native/core/programmers/http/HttpFormDataProgrammer.go +416 -416
- package/native/core/programmers/http/HttpHeadersProgrammer.go +428 -428
- package/native/core/programmers/http/HttpIsFormDataProgrammer.go +142 -142
- package/native/core/programmers/http/HttpIsHeadersProgrammer.go +53 -53
- package/native/core/programmers/http/HttpIsQueryProgrammer.go +65 -65
- package/native/core/programmers/http/HttpParameterProgrammer.go +190 -190
- package/native/core/programmers/http/HttpQueryProgrammer.go +484 -484
- package/native/core/programmers/http/HttpValidateFormDataProgrammer.go +110 -110
- package/native/core/programmers/http/HttpValidateHeadersProgrammer.go +56 -56
- package/native/core/programmers/http/HttpValidateQueryProgrammer.go +68 -68
- package/native/core/programmers/http/http_programmer_helper_coverage_test.go +120 -120
- package/native/core/programmers/http/index.go +1 -1
- package/native/core/programmers/index.go +1 -1
- package/native/core/programmers/internal/CheckerProgrammer.go +2064 -2064
- package/native/core/programmers/internal/FeatureProgrammer.go +1361 -1361
- package/native/core/programmers/internal/feature_programmer_visit_guard_test.go +70 -70
- package/native/core/programmers/internal/internal_utility_coverage_test.go +384 -384
- package/native/core/programmers/iterate/check_array_length.go +64 -64
- package/native/core/programmers/iterate/check_bigint.go +78 -78
- package/native/core/programmers/iterate/check_dynamic_key.go +271 -271
- package/native/core/programmers/iterate/check_dynamic_key_tag_rows_test.go +46 -46
- package/native/core/programmers/iterate/check_dynamic_properties.go +292 -292
- package/native/core/programmers/iterate/check_everything.go +33 -33
- package/native/core/programmers/iterate/check_exclude.go +88 -88
- package/native/core/programmers/iterate/check_native.go +38 -38
- package/native/core/programmers/iterate/check_number.go +180 -180
- package/native/core/programmers/iterate/check_object.go +113 -113
- package/native/core/programmers/iterate/check_object_strict_optional_undefined_test.go +74 -74
- package/native/core/programmers/iterate/check_object_type_tags.go +64 -64
- package/native/core/programmers/iterate/check_string.go +78 -78
- package/native/core/programmers/iterate/check_template.go +346 -346
- package/native/core/programmers/iterate/check_union_array_like.go +422 -422
- package/native/core/programmers/iterate/decode_union_object.go +157 -157
- package/native/core/programmers/iterate/feature_object_entries.go +188 -188
- package/native/core/programmers/iterate/iterate_check_coverage_test.go +178 -178
- package/native/core/programmers/iterate/iterate_utility_coverage_test.go +302 -302
- package/native/core/programmers/iterate/json_schema_alias.go +62 -62
- package/native/core/programmers/iterate/json_schema_array.go +66 -66
- package/native/core/programmers/iterate/json_schema_bigint.go +17 -17
- package/native/core/programmers/iterate/json_schema_boolean.go +17 -17
- package/native/core/programmers/iterate/json_schema_constant.go +53 -53
- package/native/core/programmers/iterate/json_schema_description.go +21 -21
- package/native/core/programmers/iterate/json_schema_discriminator.go +57 -57
- package/native/core/programmers/iterate/json_schema_escaped.go +68 -68
- package/native/core/programmers/iterate/json_schema_jsDocTags.go +48 -48
- package/native/core/programmers/iterate/json_schema_native.go +106 -106
- package/native/core/programmers/iterate/json_schema_number.go +17 -17
- package/native/core/programmers/iterate/json_schema_object.go +187 -184
- package/native/core/programmers/iterate/json_schema_plugin.go +47 -47
- package/native/core/programmers/iterate/json_schema_station.go +251 -251
- package/native/core/programmers/iterate/json_schema_string.go +17 -17
- package/native/core/programmers/iterate/json_schema_template.go +63 -63
- package/native/core/programmers/iterate/json_schema_title.go +25 -25
- package/native/core/programmers/iterate/json_schema_tuple.go +41 -41
- package/native/core/programmers/iterate/metadata_to_pattern.go +64 -64
- package/native/core/programmers/iterate/postfix_of_tuple.go +12 -12
- package/native/core/programmers/iterate/prune_object_properties.go +105 -105
- package/native/core/programmers/iterate/stringify_dynamic_properties.go +219 -219
- package/native/core/programmers/iterate/stringify_native.go +14 -14
- package/native/core/programmers/iterate/stringify_regular_properties.go +112 -112
- package/native/core/programmers/iterate/template_interpolation_tags_test.go +495 -495
- package/native/core/programmers/iterate/template_runtime_pattern.go +262 -262
- package/native/core/programmers/iterate/template_to_pattern.go +29 -29
- package/native/core/programmers/iterate/wrap_metadata_rest_tuple.go +23 -23
- package/native/core/programmers/json/JsonApplicationProgrammer.go +380 -380
- package/native/core/programmers/json/JsonAssertParseProgrammer.go +115 -115
- package/native/core/programmers/json/JsonAssertStringifyProgrammer.go +108 -108
- package/native/core/programmers/json/JsonIsParseProgrammer.go +162 -162
- package/native/core/programmers/json/JsonIsStringifyProgrammer.go +113 -113
- package/native/core/programmers/json/JsonSchemaProgrammer.go +94 -94
- package/native/core/programmers/json/JsonSchemasProgrammer.go +142 -142
- package/native/core/programmers/json/JsonStringifyProgrammer.go +1528 -1508
- package/native/core/programmers/json/JsonValidateParseProgrammer.go +105 -105
- package/native/core/programmers/json/JsonValidateStringifyProgrammer.go +126 -126
- package/native/core/programmers/json/index.go +1 -1
- package/native/core/programmers/json/json_schema_programmer_coverage_test.go +198 -198
- package/native/core/programmers/json/json_schemas_programmer_dedupes_bigint_diagnostics_test.go +37 -37
- package/native/core/programmers/json/json_schemas_programmer_rejects_bigint_native_test.go +29 -29
- package/native/core/programmers/json/json_stringify_programmer_coverage_test.go +422 -422
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +526 -526
- package/native/core/programmers/llm/LlmCoerceProgrammer.go +109 -109
- package/native/core/programmers/llm/LlmControllerProgrammer.go +51 -51
- package/native/core/programmers/llm/LlmMetadataFactory.go +89 -89
- package/native/core/programmers/llm/LlmParametersProgrammer.go +141 -141
- package/native/core/programmers/llm/LlmParseProgrammer.go +121 -121
- package/native/core/programmers/llm/LlmSchemaProgrammer.go +902 -846
- package/native/core/programmers/llm/LlmStructuredOutputProgrammer.go +147 -147
- package/native/core/programmers/llm/index.go +1 -1
- package/native/core/programmers/llm/llm_application_programmer_coverage_test.go +166 -166
- package/native/core/programmers/llm/llm_schema_programmer_coverage_test.go +282 -282
- package/native/core/programmers/llm/llm_schema_programmer_dedupes_bigint_diagnostics_test.go +38 -38
- package/native/core/programmers/llm/llm_schema_programmer_rejects_bigint_native_test.go +30 -30
- package/native/core/programmers/llm/llm_schema_programmer_rejects_exclude_tag_in_strict_test.go +52 -52
- package/native/core/programmers/notations/NotationAssertGeneralProgrammer.go +107 -107
- package/native/core/programmers/notations/NotationGeneralProgrammer.go +1441 -1441
- package/native/core/programmers/notations/NotationIsGeneralProgrammer.go +112 -112
- package/native/core/programmers/notations/NotationValidateGeneralProgrammer.go +131 -131
- package/native/core/programmers/notations/index.go +1 -1
- package/native/core/programmers/notations/notation_general_helpers_test.go +395 -395
- package/native/core/programmers/notations/notation_general_programmer_snake_prefix_test.go +44 -44
- package/native/core/programmers/plain/PlainAssertClassifyProgrammer.go +111 -111
- package/native/core/programmers/plain/PlainAssertCloneProgrammer.go +102 -102
- package/native/core/programmers/plain/PlainAssertPruneProgrammer.go +117 -117
- package/native/core/programmers/plain/PlainClassifyProgrammer.go +2205 -2205
- package/native/core/programmers/plain/PlainCloneProgrammer.go +1254 -1254
- package/native/core/programmers/plain/PlainIsCloneProgrammer.go +117 -117
- package/native/core/programmers/plain/PlainIsPruneProgrammer.go +106 -106
- package/native/core/programmers/plain/PlainPruneProgrammer.go +837 -837
- package/native/core/programmers/plain/PlainValidateClassifyProgrammer.go +127 -127
- package/native/core/programmers/plain/PlainValidateCloneProgrammer.go +123 -123
- package/native/core/programmers/plain/PlainValidatePruneProgrammer.go +114 -114
- package/native/core/programmers/plain/index.go +1 -1
- package/native/core/programmers/plain/plain_programmer_helper_coverage_test.go +284 -284
- package/native/core/programmers/plain/plain_prune_programmer_branch_matrix_test.go +145 -145
- package/native/core/programmers/programmer_direct_helper_coverage_test.go +70 -70
- package/native/core/programmers/protobuf/ProtobufAssertDecodeProgrammer.go +125 -125
- package/native/core/programmers/protobuf/ProtobufAssertEncodeProgrammer.go +143 -143
- package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +861 -861
- package/native/core/programmers/protobuf/ProtobufEncodeProgrammer.go +1269 -1269
- package/native/core/programmers/protobuf/ProtobufIsDecodeProgrammer.go +122 -122
- package/native/core/programmers/protobuf/ProtobufIsEncodeProgrammer.go +115 -115
- package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +269 -269
- package/native/core/programmers/protobuf/ProtobufValidateDecodeProgrammer.go +111 -111
- package/native/core/programmers/protobuf/ProtobufValidateEncodeProgrammer.go +145 -145
- package/native/core/programmers/protobuf/index.go +1 -1
- package/native/core/programmers/protobuf/protobuf_programmer_helper_coverage_test.go +454 -454
- package/native/core/programmers/random_programmer_helper_coverage_test.go +367 -367
- package/native/core/programmers/random_programmer_min_items_tag_test.go +44 -44
- package/native/core/programmers/reflect/ReflectLiteralsProgrammer.go +125 -125
- package/native/core/schemas/index.go +1 -1
- package/native/core/schemas/metadata/IMetadataDictionary.go +8 -8
- package/native/core/schemas/metadata/IMetadataTypeTagSequence.go +53 -53
- package/native/core/schemas/metadata/MetadataAlias.go +36 -36
- package/native/core/schemas/metadata/MetadataAliasType.go +64 -64
- package/native/core/schemas/metadata/MetadataApplication.go +41 -41
- package/native/core/schemas/metadata/MetadataArray.go +36 -36
- package/native/core/schemas/metadata/MetadataArrayType.go +59 -59
- package/native/core/schemas/metadata/MetadataAtomic.go +69 -69
- package/native/core/schemas/metadata/MetadataCollection.go +698 -698
- package/native/core/schemas/metadata/MetadataComponents.go +122 -122
- package/native/core/schemas/metadata/MetadataConstant.go +47 -47
- package/native/core/schemas/metadata/MetadataConstantValue.go +97 -97
- package/native/core/schemas/metadata/MetadataEscaped.go +40 -40
- package/native/core/schemas/metadata/MetadataFunction.go +46 -46
- package/native/core/schemas/metadata/MetadataMap.go +45 -45
- package/native/core/schemas/metadata/MetadataNative.go +72 -72
- package/native/core/schemas/metadata/MetadataObject.go +36 -36
- package/native/core/schemas/metadata/MetadataObjectType.go +223 -223
- package/native/core/schemas/metadata/MetadataParameter.go +46 -46
- package/native/core/schemas/metadata/MetadataProperty.go +50 -50
- package/native/core/schemas/metadata/MetadataSchema.go +1485 -1485
- package/native/core/schemas/metadata/MetadataSet.go +41 -41
- package/native/core/schemas/metadata/MetadataTemplate.go +70 -70
- package/native/core/schemas/metadata/MetadataTuple.go +20 -20
- package/native/core/schemas/metadata/MetadataTupleType.go +69 -69
- package/native/core/schemas/metadata/index.go +1 -1
- package/native/core/schemas/metadata/metadata_object_type_required_literal_property_test.go +51 -51
- package/native/core/schemas/metadata/metadata_schema_covers_tag_matrix_test.go +125 -125
- package/native/core/schemas/metadata/metadata_schema_sole_literal_caches_pointer_test.go +38 -38
- package/native/core/schemas/metadata/schema_sequence_and_json_coverage_test.go +427 -427
- package/native/core/schemas/protobuf/IProtobufProperty.go +6 -6
- package/native/core/schemas/protobuf/IProtobufPropertyType.go +55 -55
- package/native/core/schemas/protobuf/IProtobufSchema.go +54 -54
- package/native/core/schemas/protobuf/index.go +1 -1
- package/native/core/schemas/protobuf/protobuf_marker_coverage_test.go +58 -58
- package/native/core/typings/Writable.go +5 -5
- package/native/core/utils/PatternUtil.go +57 -57
- package/native/core/utils/ProtobufNameEncoder.go +47 -47
- package/native/go.mod +31 -31
- package/native/go.sum +22 -22
- package/native/go.work +22 -22
- package/native/transform/CallExpressionTransformer.go +719 -719
- package/native/transform/FileTransformer.go +221 -221
- package/native/transform/ITransformProps.go +5 -5
- package/native/transform/ImportTransformer.go +285 -285
- package/native/transform/NodeTransformer.go +25 -25
- package/native/transform/TransformerError.go +11 -11
- package/native/transform/TypiaGenerator.go +171 -171
- package/native/transform/call_expression_transformer_registry_coverage_test.go +53 -53
- package/native/transform/call_expression_transformer_target_test.go +46 -46
- package/native/transform/features/AssertTransformer.go +39 -39
- package/native/transform/features/CreateAssertTransformer.go +39 -39
- package/native/transform/features/CreateIsTransformer.go +35 -35
- package/native/transform/features/CreateRandomTransformer.go +47 -47
- package/native/transform/features/CreateShallowTransformer.go +33 -33
- package/native/transform/features/CreateValidateTransformer.go +35 -35
- package/native/transform/features/IsTransformer.go +35 -35
- package/native/transform/features/RandomTransformer.go +54 -54
- package/native/transform/features/ShallowTransformer.go +65 -65
- package/native/transform/features/ValidateTransformer.go +35 -35
- package/native/transform/features/compare/CompareCoverTransformer.go +14 -14
- package/native/transform/features/compare/CompareCreateCoverTransformer.go +14 -14
- package/native/transform/features/compare/CompareCreateEqualTransformer.go +14 -14
- package/native/transform/features/compare/CompareCreateLessTransformer.go +14 -14
- package/native/transform/features/compare/CompareEqualTransformer.go +73 -73
- package/native/transform/features/compare/CompareLessTransformer.go +71 -71
- package/native/transform/features/feature_transformer_entry_coverage_test.go +59 -59
- package/native/transform/features/functional/FunctionalGenericTransformer.go +70 -70
- package/native/transform/features/http/CreateHttpAssertFormDataTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpAssertHeadersTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpAssertQueryTransformer.go +28 -28
- package/native/transform/features/http/CreateHttpFormDataTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpHeadersTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpIsFormDataTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpIsHeadersTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpIsQueryTransformer.go +28 -28
- package/native/transform/features/http/CreateHttpParameterTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpQueryTransformer.go +28 -28
- package/native/transform/features/http/CreateHttpValidateFormDataTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpValidateHeadersTransformer.go +22 -22
- package/native/transform/features/http/CreateHttpValidateQueryTransformer.go +28 -28
- package/native/transform/features/http/HttpAssertFormDataTransformer.go +22 -22
- package/native/transform/features/http/HttpAssertHeadersTransformer.go +22 -22
- package/native/transform/features/http/HttpAssertQueryTransformer.go +28 -28
- package/native/transform/features/http/HttpFormDataTransformer.go +22 -22
- package/native/transform/features/http/HttpHeadersTransformer.go +22 -22
- package/native/transform/features/http/HttpIsFormDataTransformer.go +22 -22
- package/native/transform/features/http/HttpIsHeadersTransformer.go +22 -22
- package/native/transform/features/http/HttpIsQueryTransformer.go +28 -28
- package/native/transform/features/http/HttpParameterTransformer.go +22 -22
- package/native/transform/features/http/HttpQueryTransformer.go +28 -28
- package/native/transform/features/http/HttpValidateFormDataTransformer.go +22 -22
- package/native/transform/features/http/HttpValidateHeadersTransformer.go +22 -22
- package/native/transform/features/http/HttpValidateQueryTransformer.go +28 -28
- package/native/transform/features/http/http_transformer_entry_coverage_test.go +65 -65
- package/native/transform/features/json/JsonApplicationTransformer.go +75 -75
- package/native/transform/features/json/JsonAssertParseTransformer.go +22 -22
- package/native/transform/features/json/JsonAssertStringifyTransformer.go +22 -22
- package/native/transform/features/json/JsonCreateAssertParseTransformer.go +22 -22
- package/native/transform/features/json/JsonCreateAssertStringifyTransformer.go +22 -22
- package/native/transform/features/json/JsonCreateIsParseTransformer.go +22 -22
- package/native/transform/features/json/JsonCreateIsStringifyTransformer.go +22 -22
- package/native/transform/features/json/JsonCreateStringifyTransformer.go +22 -22
- package/native/transform/features/json/JsonCreateValidateParseTransformer.go +22 -22
- package/native/transform/features/json/JsonCreateValidateStringifyProgrammer.go +22 -22
- package/native/transform/features/json/JsonIsParseTransformer.go +22 -22
- package/native/transform/features/json/JsonIsStringifyTransformer.go +22 -22
- package/native/transform/features/json/JsonSchemaTransformer.go +175 -175
- package/native/transform/features/json/JsonSchemasTransformer.go +109 -109
- package/native/transform/features/json/JsonStringifyTransformer.go +22 -22
- package/native/transform/features/json/JsonValidateParseTransformer.go +22 -22
- package/native/transform/features/json/JsonValidateStringifyTransformer.go +22 -22
- package/native/transform/features/json/json_transformer_entry_coverage_test.go +56 -56
- package/native/transform/features/llm/LlmApplicationTransformer.go +54 -54
- package/native/transform/features/llm/LlmCoerceTransformer.go +63 -63
- package/native/transform/features/llm/LlmControllerTransformer.go +59 -59
- package/native/transform/features/llm/LlmCreateCoerceTransformer.go +54 -54
- package/native/transform/features/llm/LlmCreateParseTransformer.go +54 -54
- package/native/transform/features/llm/LlmParametersTransformer.go +49 -49
- package/native/transform/features/llm/LlmParseTransformer.go +63 -63
- package/native/transform/features/llm/LlmSchemaTransformer.go +167 -167
- package/native/transform/features/llm/LlmStructuredOutputTransformer.go +55 -55
- package/native/transform/features/llm/llm_transformer_entry_coverage_test.go +48 -48
- package/native/transform/features/notations/NotationAssertGeneralTransformer.go +27 -27
- package/native/transform/features/notations/NotationCreateAssertGeneralTransformer.go +27 -27
- package/native/transform/features/notations/NotationCreateGeneralTransformer.go +27 -27
- package/native/transform/features/notations/NotationCreateIsGeneralTransformer.go +27 -27
- package/native/transform/features/notations/NotationCreateValidateGeneralTransformer.go +27 -27
- package/native/transform/features/notations/NotationGeneralTransformer.go +36 -36
- package/native/transform/features/notations/NotationIsGeneralTransformer.go +27 -27
- package/native/transform/features/notations/NotationValidateGeneralTransformer.go +27 -27
- package/native/transform/features/notations/notation_transformer_entry_coverage_test.go +58 -58
- package/native/transform/features/plain/PlainAssertClassifyTransformer.go +22 -22
- package/native/transform/features/plain/PlainAssertCloneTransformer.go +22 -22
- package/native/transform/features/plain/PlainAssertPruneTransformer.go +22 -22
- package/native/transform/features/plain/PlainClassifyTransformer.go +22 -22
- package/native/transform/features/plain/PlainCloneTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateAssertClassifyTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateAssertCloneTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateAssertPruneTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateClassifyTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateCloneTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateIsCloneTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateIsPruneTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreatePruneTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateValidateClassifyTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateValidateCloneTransformer.go +22 -22
- package/native/transform/features/plain/PlainCreateValidatePruneTransformer.go +22 -22
- package/native/transform/features/plain/PlainIsCloneTransformer.go +22 -22
- package/native/transform/features/plain/PlainIsPruneTransformer.go +22 -22
- package/native/transform/features/plain/PlainPruneTransformer.go +22 -22
- package/native/transform/features/plain/PlainValidateClassifyTransformer.go +22 -22
- package/native/transform/features/plain/PlainValidateCloneTransformer.go +22 -22
- package/native/transform/features/plain/PlainValidatePruneTransformer.go +22 -22
- package/native/transform/features/plain/plain_transformer_entry_coverage_test.go +61 -61
- package/native/transform/features/protobuf/ProtobufAssertDecodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufAssertEncodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufCreateAssertDecodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufCreateAssertEncodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufCreateDecodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufCreateEncodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufCreateIsDecodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufCreateIsEncodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufCreateValidateDecodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufCreateValidateEncodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufDecodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufEncodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufIsDecodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufIsEncodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufMessageTransformer.go +31 -31
- package/native/transform/features/protobuf/ProtobufValidateDecodeTransformer.go +22 -22
- package/native/transform/features/protobuf/ProtobufValidateEncodeTransformer.go +22 -22
- package/native/transform/features/protobuf/protobuf_transformer_entry_coverage_test.go +56 -56
- package/native/transform/features/reflect/ReflectLiteralsTransformer.go +32 -32
- package/native/transform/features/reflect/ReflectMetadataTransformer.go +73 -73
- package/native/transform/features/reflect/ReflectNameTransformer.go +100 -100
- package/native/transform/features/reflect/ReflectSchemaTransformer.go +153 -153
- package/native/transform/features/reflect/ReflectSchemasTransformer.go +68 -68
- package/native/transform/features/reflect/reflect_metadata_transformer_edge_branches_test.go +55 -55
- package/native/transform/features/reflect/reflect_transformer_entry_coverage_test.go +47 -47
- package/native/transform/file_transformer_coverage_test.go +94 -94
- package/native/transform/import_transformer_coverage_test.go +153 -153
- package/native/transform/index.go +1 -1
- package/native/transform/internal/GenericTransformer.go +236 -236
- package/native/transform/transform.go +57 -57
- package/native/transform/typia_generator_helpers_coverage_test.go +166 -166
- package/package.json +8 -15
- package/src/executable/TypiaGenerateWizard.ts +5 -1
- package/src/executable/generate/ttsc.ts +3 -4
- package/src/executable/typia.ts +8 -4
- package/src/internal/_ProtobufReader.ts +187 -187
- package/src/internal/_randomArray.ts +34 -34
- package/src/internal/_randomString.ts +30 -30
- package/src/re-exports.ts +8 -3
- package/src/transform.ts +21 -21
- package/lib/TypeGuardError2.mjs +0 -55
- package/lib/TypeGuardError2.mjs.map +0 -1
- package/lib/_virtual/NoTransformConfigurationError.mjs +0 -4
- package/lib/_virtual/NoTransformConfigurationError.mjs.map +0 -1
- package/lib/_virtual/TypeGuardError.mjs +0 -4
- package/lib/_virtual/TypeGuardError.mjs.map +0 -1
- package/lib/_virtual/TypiaGenerateWizard.mjs +0 -4
- package/lib/_virtual/TypiaGenerateWizard.mjs.map +0 -1
- package/lib/_virtual/_IProtobufWriter.mjs +0 -4
- package/lib/_virtual/_IProtobufWriter.mjs.map +0 -1
- package/lib/_virtual/_ProtobufReader.mjs +0 -4
- package/lib/_virtual/_ProtobufReader.mjs.map +0 -1
- package/lib/_virtual/_ProtobufSizer.mjs +0 -4
- package/lib/_virtual/_ProtobufSizer.mjs.map +0 -1
- package/lib/_virtual/_ProtobufWriter.mjs +0 -4
- package/lib/_virtual/_ProtobufWriter.mjs.map +0 -1
- package/lib/_virtual/__notationCapitalize.mjs +0 -4
- package/lib/_virtual/__notationCapitalize.mjs.map +0 -1
- package/lib/_virtual/__notationUnsnake.mjs +0 -4
- package/lib/_virtual/__notationUnsnake.mjs.map +0 -1
- package/lib/_virtual/_accessExpressionAsString.mjs +0 -4
- package/lib/_virtual/_accessExpressionAsString.mjs.map +0 -1
- package/lib/_virtual/_assertGuard.mjs +0 -4
- package/lib/_virtual/_assertGuard.mjs.map +0 -1
- package/lib/_virtual/_coerceLlmArguments.mjs +0 -4
- package/lib/_virtual/_coerceLlmArguments.mjs.map +0 -1
- package/lib/_virtual/_commander.mjs +0 -7
- package/lib/_virtual/_commander.mjs.map +0 -1
- package/lib/_virtual/_commonjsHelpers.mjs +0 -35
- package/lib/_virtual/_commonjsHelpers.mjs.map +0 -1
- package/lib/_virtual/_createStandardSchema.mjs +0 -4
- package/lib/_virtual/_createStandardSchema.mjs.map +0 -1
- package/lib/_virtual/_functionalTypeGuardErrorFactory.mjs +0 -4
- package/lib/_virtual/_functionalTypeGuardErrorFactory.mjs.map +0 -1
- package/lib/_virtual/_httpFormDataReadArray.mjs +0 -4
- package/lib/_virtual/_httpFormDataReadArray.mjs.map +0 -1
- package/lib/_virtual/_httpFormDataReadBigint.mjs +0 -4
- package/lib/_virtual/_httpFormDataReadBigint.mjs.map +0 -1
- package/lib/_virtual/_httpFormDataReadBlob.mjs +0 -4
- package/lib/_virtual/_httpFormDataReadBlob.mjs.map +0 -1
- package/lib/_virtual/_httpFormDataReadBoolean.mjs +0 -4
- package/lib/_virtual/_httpFormDataReadBoolean.mjs.map +0 -1
- package/lib/_virtual/_httpFormDataReadFile.mjs +0 -4
- package/lib/_virtual/_httpFormDataReadFile.mjs.map +0 -1
- package/lib/_virtual/_httpFormDataReadNumber.mjs +0 -4
- package/lib/_virtual/_httpFormDataReadNumber.mjs.map +0 -1
- package/lib/_virtual/_httpFormDataReadString.mjs +0 -4
- package/lib/_virtual/_httpFormDataReadString.mjs.map +0 -1
- package/lib/_virtual/_httpHeaderReadBigint.mjs +0 -4
- package/lib/_virtual/_httpHeaderReadBigint.mjs.map +0 -1
- package/lib/_virtual/_httpHeaderReadBoolean.mjs +0 -4
- package/lib/_virtual/_httpHeaderReadBoolean.mjs.map +0 -1
- package/lib/_virtual/_httpHeaderReadNumber.mjs +0 -4
- package/lib/_virtual/_httpHeaderReadNumber.mjs.map +0 -1
- package/lib/_virtual/_httpParameterReadBigint.mjs +0 -4
- package/lib/_virtual/_httpParameterReadBigint.mjs.map +0 -1
- package/lib/_virtual/_httpParameterReadBoolean.mjs +0 -4
- package/lib/_virtual/_httpParameterReadBoolean.mjs.map +0 -1
- package/lib/_virtual/_httpParameterReadNumber.mjs +0 -4
- package/lib/_virtual/_httpParameterReadNumber.mjs.map +0 -1
- package/lib/_virtual/_httpParameterReadString.mjs +0 -4
- package/lib/_virtual/_httpParameterReadString.mjs.map +0 -1
- package/lib/_virtual/_httpQueryParseURLSearchParams.mjs +0 -4
- package/lib/_virtual/_httpQueryParseURLSearchParams.mjs.map +0 -1
- package/lib/_virtual/_httpQueryReadArray.mjs +0 -4
- package/lib/_virtual/_httpQueryReadArray.mjs.map +0 -1
- package/lib/_virtual/_httpQueryReadBigint.mjs +0 -4
- package/lib/_virtual/_httpQueryReadBigint.mjs.map +0 -1
- package/lib/_virtual/_httpQueryReadBoolean.mjs +0 -4
- package/lib/_virtual/_httpQueryReadBoolean.mjs.map +0 -1
- package/lib/_virtual/_httpQueryReadNumber.mjs +0 -4
- package/lib/_virtual/_httpQueryReadNumber.mjs.map +0 -1
- package/lib/_virtual/_httpQueryReadString.mjs +0 -4
- package/lib/_virtual/_httpQueryReadString.mjs.map +0 -1
- package/lib/_virtual/_inquirer.mjs +0 -7
- package/lib/_virtual/_inquirer.mjs.map +0 -1
- package/lib/_virtual/_isBetween.mjs +0 -4
- package/lib/_virtual/_isBetween.mjs.map +0 -1
- package/lib/_virtual/_isBigintString.mjs +0 -4
- package/lib/_virtual/_isBigintString.mjs.map +0 -1
- package/lib/_virtual/_isFormatByte.mjs +0 -4
- package/lib/_virtual/_isFormatByte.mjs.map +0 -1
- package/lib/_virtual/_isFormatDate.mjs +0 -4
- package/lib/_virtual/_isFormatDate.mjs.map +0 -1
- package/lib/_virtual/_isFormatDateTime.mjs +0 -4
- package/lib/_virtual/_isFormatDateTime.mjs.map +0 -1
- package/lib/_virtual/_isFormatDuration.mjs +0 -4
- package/lib/_virtual/_isFormatDuration.mjs.map +0 -1
- package/lib/_virtual/_isFormatEmail.mjs +0 -4
- package/lib/_virtual/_isFormatEmail.mjs.map +0 -1
- package/lib/_virtual/_isFormatHostname.mjs +0 -4
- package/lib/_virtual/_isFormatHostname.mjs.map +0 -1
- package/lib/_virtual/_isFormatIdnEmail.mjs +0 -4
- package/lib/_virtual/_isFormatIdnEmail.mjs.map +0 -1
- package/lib/_virtual/_isFormatIdnHostname.mjs +0 -4
- package/lib/_virtual/_isFormatIdnHostname.mjs.map +0 -1
- package/lib/_virtual/_isFormatIpv4.mjs +0 -4
- package/lib/_virtual/_isFormatIpv4.mjs.map +0 -1
- package/lib/_virtual/_isFormatIpv6.mjs +0 -4
- package/lib/_virtual/_isFormatIpv6.mjs.map +0 -1
- package/lib/_virtual/_isFormatIri.mjs +0 -4
- package/lib/_virtual/_isFormatIri.mjs.map +0 -1
- package/lib/_virtual/_isFormatIriReference.mjs +0 -4
- package/lib/_virtual/_isFormatIriReference.mjs.map +0 -1
- package/lib/_virtual/_isFormatJsonPointer.mjs +0 -4
- package/lib/_virtual/_isFormatJsonPointer.mjs.map +0 -1
- package/lib/_virtual/_isFormatPassword.mjs +0 -4
- package/lib/_virtual/_isFormatPassword.mjs.map +0 -1
- package/lib/_virtual/_isFormatRegex.mjs +0 -4
- package/lib/_virtual/_isFormatRegex.mjs.map +0 -1
- package/lib/_virtual/_isFormatRelativeJsonPointer.mjs +0 -4
- package/lib/_virtual/_isFormatRelativeJsonPointer.mjs.map +0 -1
- package/lib/_virtual/_isFormatTime.mjs +0 -4
- package/lib/_virtual/_isFormatTime.mjs.map +0 -1
- package/lib/_virtual/_isFormatUri.mjs +0 -4
- package/lib/_virtual/_isFormatUri.mjs.map +0 -1
- package/lib/_virtual/_isFormatUriReference.mjs +0 -4
- package/lib/_virtual/_isFormatUriReference.mjs.map +0 -1
- package/lib/_virtual/_isFormatUriTemplate.mjs +0 -4
- package/lib/_virtual/_isFormatUriTemplate.mjs.map +0 -1
- package/lib/_virtual/_isFormatUrl.mjs +0 -4
- package/lib/_virtual/_isFormatUrl.mjs.map +0 -1
- package/lib/_virtual/_isFormatUuid.mjs +0 -4
- package/lib/_virtual/_isFormatUuid.mjs.map +0 -1
- package/lib/_virtual/_isTypeFloat.mjs +0 -4
- package/lib/_virtual/_isTypeFloat.mjs.map +0 -1
- package/lib/_virtual/_isTypeInt16.mjs +0 -4
- package/lib/_virtual/_isTypeInt16.mjs.map +0 -1
- package/lib/_virtual/_isTypeInt32.mjs +0 -4
- package/lib/_virtual/_isTypeInt32.mjs.map +0 -1
- package/lib/_virtual/_isTypeInt64.mjs +0 -4
- package/lib/_virtual/_isTypeInt64.mjs.map +0 -1
- package/lib/_virtual/_isTypeInt8.mjs +0 -4
- package/lib/_virtual/_isTypeInt8.mjs.map +0 -1
- package/lib/_virtual/_isTypeUint16.mjs +0 -4
- package/lib/_virtual/_isTypeUint16.mjs.map +0 -1
- package/lib/_virtual/_isTypeUint32.mjs +0 -4
- package/lib/_virtual/_isTypeUint32.mjs.map +0 -1
- package/lib/_virtual/_isTypeUint64.mjs +0 -4
- package/lib/_virtual/_isTypeUint64.mjs.map +0 -1
- package/lib/_virtual/_isTypeUint8.mjs +0 -4
- package/lib/_virtual/_isTypeUint8.mjs.map +0 -1
- package/lib/_virtual/_isUniqueItems.mjs +0 -4
- package/lib/_virtual/_isUniqueItems.mjs.map +0 -1
- package/lib/_virtual/_jsonStringifyNumber.mjs +0 -4
- package/lib/_virtual/_jsonStringifyNumber.mjs.map +0 -1
- package/lib/_virtual/_jsonStringifyRest.mjs +0 -4
- package/lib/_virtual/_jsonStringifyRest.mjs.map +0 -1
- package/lib/_virtual/_jsonStringifyString.mjs +0 -4
- package/lib/_virtual/_jsonStringifyString.mjs.map +0 -1
- package/lib/_virtual/_jsonStringifyTail.mjs +0 -4
- package/lib/_virtual/_jsonStringifyTail.mjs.map +0 -1
- package/lib/_virtual/_llmApplicationFinalize.mjs +0 -4
- package/lib/_virtual/_llmApplicationFinalize.mjs.map +0 -1
- package/lib/_virtual/_node_child_process.mjs +0 -7
- package/lib/_virtual/_node_child_process.mjs.map +0 -1
- package/lib/_virtual/_node_fs.mjs +0 -7
- package/lib/_virtual/_node_fs.mjs.map +0 -1
- package/lib/_virtual/_node_module.mjs +0 -7
- package/lib/_virtual/_node_module.mjs.map +0 -1
- package/lib/_virtual/_node_path.mjs +0 -7
- package/lib/_virtual/_node_path.mjs.map +0 -1
- package/lib/_virtual/_notationAny.mjs +0 -4
- package/lib/_virtual/_notationAny.mjs.map +0 -1
- package/lib/_virtual/_notationCamel.mjs +0 -4
- package/lib/_virtual/_notationCamel.mjs.map +0 -1
- package/lib/_virtual/_notationPascal.mjs +0 -4
- package/lib/_virtual/_notationPascal.mjs.map +0 -1
- package/lib/_virtual/_notationSnake.mjs +0 -4
- package/lib/_virtual/_notationSnake.mjs.map +0 -1
- package/lib/_virtual/_parseLlmArguments.mjs +0 -4
- package/lib/_virtual/_parseLlmArguments.mjs.map +0 -1
- package/lib/_virtual/_plainCloneAny.mjs +0 -4
- package/lib/_virtual/_plainCloneAny.mjs.map +0 -1
- package/lib/_virtual/_randexp.mjs +0 -7
- package/lib/_virtual/_randexp.mjs.map +0 -1
- package/lib/_virtual/_randomArray.mjs +0 -4
- package/lib/_virtual/_randomArray.mjs.map +0 -1
- package/lib/_virtual/_randomBigint.mjs +0 -4
- package/lib/_virtual/_randomBigint.mjs.map +0 -1
- package/lib/_virtual/_randomBoolean.mjs +0 -4
- package/lib/_virtual/_randomBoolean.mjs.map +0 -1
- package/lib/_virtual/_randomFormatByte.mjs +0 -4
- package/lib/_virtual/_randomFormatByte.mjs.map +0 -1
- package/lib/_virtual/_randomFormatDate.mjs +0 -4
- package/lib/_virtual/_randomFormatDate.mjs.map +0 -1
- package/lib/_virtual/_randomFormatDatetime.mjs +0 -4
- package/lib/_virtual/_randomFormatDatetime.mjs.map +0 -1
- package/lib/_virtual/_randomFormatDuration.mjs +0 -4
- package/lib/_virtual/_randomFormatDuration.mjs.map +0 -1
- package/lib/_virtual/_randomFormatEmail.mjs +0 -4
- package/lib/_virtual/_randomFormatEmail.mjs.map +0 -1
- package/lib/_virtual/_randomFormatHostname.mjs +0 -4
- package/lib/_virtual/_randomFormatHostname.mjs.map +0 -1
- package/lib/_virtual/_randomFormatIdnEmail.mjs +0 -4
- package/lib/_virtual/_randomFormatIdnEmail.mjs.map +0 -1
- package/lib/_virtual/_randomFormatIdnHostname.mjs +0 -4
- package/lib/_virtual/_randomFormatIdnHostname.mjs.map +0 -1
- package/lib/_virtual/_randomFormatIpv4.mjs +0 -4
- package/lib/_virtual/_randomFormatIpv4.mjs.map +0 -1
- package/lib/_virtual/_randomFormatIpv6.mjs +0 -4
- package/lib/_virtual/_randomFormatIpv6.mjs.map +0 -1
- package/lib/_virtual/_randomFormatIri.mjs +0 -4
- package/lib/_virtual/_randomFormatIri.mjs.map +0 -1
- package/lib/_virtual/_randomFormatIriReference.mjs +0 -4
- package/lib/_virtual/_randomFormatIriReference.mjs.map +0 -1
- package/lib/_virtual/_randomFormatJsonPointer.mjs +0 -4
- package/lib/_virtual/_randomFormatJsonPointer.mjs.map +0 -1
- package/lib/_virtual/_randomFormatPassword.mjs +0 -4
- package/lib/_virtual/_randomFormatPassword.mjs.map +0 -1
- package/lib/_virtual/_randomFormatRegex.mjs +0 -4
- package/lib/_virtual/_randomFormatRegex.mjs.map +0 -1
- package/lib/_virtual/_randomFormatRelativeJsonPointer.mjs +0 -4
- package/lib/_virtual/_randomFormatRelativeJsonPointer.mjs.map +0 -1
- package/lib/_virtual/_randomFormatTime.mjs +0 -4
- package/lib/_virtual/_randomFormatTime.mjs.map +0 -1
- package/lib/_virtual/_randomFormatUri.mjs +0 -4
- package/lib/_virtual/_randomFormatUri.mjs.map +0 -1
- package/lib/_virtual/_randomFormatUriReference.mjs +0 -4
- package/lib/_virtual/_randomFormatUriReference.mjs.map +0 -1
- package/lib/_virtual/_randomFormatUriTemplate.mjs +0 -4
- package/lib/_virtual/_randomFormatUriTemplate.mjs.map +0 -1
- package/lib/_virtual/_randomFormatUrl.mjs +0 -4
- package/lib/_virtual/_randomFormatUrl.mjs.map +0 -1
- package/lib/_virtual/_randomFormatUuid.mjs +0 -4
- package/lib/_virtual/_randomFormatUuid.mjs.map +0 -1
- package/lib/_virtual/_randomInteger.mjs +0 -4
- package/lib/_virtual/_randomInteger.mjs.map +0 -1
- package/lib/_virtual/_randomNumber.mjs +0 -4
- package/lib/_virtual/_randomNumber.mjs.map +0 -1
- package/lib/_virtual/_randomPattern.mjs +0 -4
- package/lib/_virtual/_randomPattern.mjs.map +0 -1
- package/lib/_virtual/_randomPick.mjs +0 -4
- package/lib/_virtual/_randomPick.mjs.map +0 -1
- package/lib/_virtual/_randomString.mjs +0 -4
- package/lib/_virtual/_randomString.mjs.map +0 -1
- package/lib/_virtual/_throwTypeGuardError.mjs +0 -4
- package/lib/_virtual/_throwTypeGuardError.mjs.map +0 -1
- package/lib/_virtual/_tinyglobby.mjs +0 -7
- package/lib/_virtual/_tinyglobby.mjs.map +0 -1
- package/lib/_virtual/_validateReport.mjs +0 -4
- package/lib/_virtual/_validateReport.mjs.map +0 -1
- package/lib/_virtual/compare.mjs +0 -4
- package/lib/_virtual/compare.mjs.map +0 -1
- package/lib/_virtual/functional.mjs +0 -4
- package/lib/_virtual/functional.mjs.map +0 -1
- package/lib/_virtual/http.mjs +0 -4
- package/lib/_virtual/http.mjs.map +0 -1
- package/lib/_virtual/index.mjs +0 -4
- package/lib/_virtual/index.mjs.map +0 -1
- package/lib/_virtual/json.mjs +0 -4
- package/lib/_virtual/json.mjs.map +0 -1
- package/lib/_virtual/llm.mjs +0 -4
- package/lib/_virtual/llm.mjs.map +0 -1
- package/lib/_virtual/module.mjs +0 -4
- package/lib/_virtual/module.mjs.map +0 -1
- package/lib/_virtual/notations.mjs +0 -4
- package/lib/_virtual/notations.mjs.map +0 -1
- package/lib/_virtual/plain.mjs +0 -4
- package/lib/_virtual/plain.mjs.map +0 -1
- package/lib/_virtual/protobuf.mjs +0 -4
- package/lib/_virtual/protobuf.mjs.map +0 -1
- package/lib/_virtual/re-exports.mjs +0 -4
- package/lib/_virtual/re-exports.mjs.map +0 -1
- package/lib/_virtual/reflect.mjs +0 -4
- package/lib/_virtual/reflect.mjs.map +0 -1
- package/lib/_virtual/transform.mjs +0 -4
- package/lib/_virtual/transform.mjs.map +0 -1
- package/lib/_virtual/ttsc.mjs +0 -4
- package/lib/_virtual/ttsc.mjs.map +0 -1
- package/lib/_virtual/typia.mjs +0 -4
- package/lib/_virtual/typia.mjs.map +0 -1
- package/lib/compare2.mjs +0 -39
- package/lib/compare2.mjs.map +0 -1
- package/lib/executable/TypiaGenerateWizard2.mjs +0 -719
- package/lib/executable/TypiaGenerateWizard2.mjs.map +0 -1
- package/lib/executable/generate/ttsc2.mjs +0 -56
- package/lib/executable/generate/ttsc2.mjs.map +0 -1
- package/lib/executable/typia2.mjs +0 -88
- package/lib/executable/typia2.mjs.map +0 -1
- package/lib/functional2.mjs +0 -99
- package/lib/functional2.mjs.map +0 -1
- package/lib/http2.mjs +0 -139
- package/lib/http2.mjs.map +0 -1
- package/lib/index2.mjs +0 -53
- package/lib/index2.mjs.map +0 -1
- package/lib/internal/_IProtobufWriter.mjs.map +0 -1
- package/lib/internal/_IProtobufWriter2.mjs +0 -6
- package/lib/internal/_IProtobufWriter2.mjs.map +0 -1
- package/lib/internal/_ProtobufReader2.mjs +0 -169
- package/lib/internal/_ProtobufReader2.mjs.map +0 -1
- package/lib/internal/_ProtobufSizer2.mjs +0 -119
- package/lib/internal/_ProtobufSizer2.mjs.map +0 -1
- package/lib/internal/_ProtobufWriter2.mjs +0 -107
- package/lib/internal/_ProtobufWriter2.mjs.map +0 -1
- package/lib/internal/_accessExpressionAsString2.mjs +0 -49
- package/lib/internal/_accessExpressionAsString2.mjs.map +0 -1
- package/lib/internal/_assertGuard2.mjs +0 -20
- package/lib/internal/_assertGuard2.mjs.map +0 -1
- package/lib/internal/_coerceLlmArguments2.mjs +0 -11
- package/lib/internal/_coerceLlmArguments2.mjs.map +0 -1
- package/lib/internal/_createStandardSchema2.mjs +0 -138
- package/lib/internal/_createStandardSchema2.mjs.map +0 -1
- package/lib/internal/_functionalTypeGuardErrorFactory2.mjs +0 -12
- package/lib/internal/_functionalTypeGuardErrorFactory2.mjs.map +0 -1
- package/lib/internal/_httpFormDataReadArray2.mjs +0 -9
- package/lib/internal/_httpFormDataReadArray2.mjs.map +0 -1
- package/lib/internal/_httpFormDataReadBigint2.mjs +0 -23
- package/lib/internal/_httpFormDataReadBigint2.mjs.map +0 -1
- package/lib/internal/_httpFormDataReadBlob2.mjs +0 -15
- package/lib/internal/_httpFormDataReadBlob2.mjs.map +0 -1
- package/lib/internal/_httpFormDataReadBoolean2.mjs +0 -21
- package/lib/internal/_httpFormDataReadBoolean2.mjs.map +0 -1
- package/lib/internal/_httpFormDataReadFile2.mjs +0 -15
- package/lib/internal/_httpFormDataReadFile2.mjs.map +0 -1
- package/lib/internal/_httpFormDataReadNumber2.mjs +0 -19
- package/lib/internal/_httpFormDataReadNumber2.mjs.map +0 -1
- package/lib/internal/_httpFormDataReadString2.mjs +0 -15
- package/lib/internal/_httpFormDataReadString2.mjs.map +0 -1
- package/lib/internal/_httpHeaderReadBigint2.mjs +0 -17
- package/lib/internal/_httpHeaderReadBigint2.mjs.map +0 -1
- package/lib/internal/_httpHeaderReadBoolean2.mjs +0 -15
- package/lib/internal/_httpHeaderReadBoolean2.mjs.map +0 -1
- package/lib/internal/_httpHeaderReadNumber2.mjs +0 -13
- package/lib/internal/_httpHeaderReadNumber2.mjs.map +0 -1
- package/lib/internal/_httpParameterReadBigint2.mjs +0 -17
- package/lib/internal/_httpParameterReadBigint2.mjs.map +0 -1
- package/lib/internal/_httpParameterReadBoolean2.mjs +0 -15
- package/lib/internal/_httpParameterReadBoolean2.mjs.map +0 -1
- package/lib/internal/_httpParameterReadNumber2.mjs +0 -13
- package/lib/internal/_httpParameterReadNumber2.mjs.map +0 -1
- package/lib/internal/_httpParameterReadString2.mjs +0 -9
- package/lib/internal/_httpParameterReadString2.mjs.map +0 -1
- package/lib/internal/_httpQueryParseURLSearchParams2.mjs +0 -16
- package/lib/internal/_httpQueryParseURLSearchParams2.mjs.map +0 -1
- package/lib/internal/_httpQueryReadArray2.mjs +0 -9
- package/lib/internal/_httpQueryReadArray2.mjs.map +0 -1
- package/lib/internal/_httpQueryReadBigint2.mjs +0 -17
- package/lib/internal/_httpQueryReadBigint2.mjs.map +0 -1
- package/lib/internal/_httpQueryReadBoolean2.mjs +0 -19
- package/lib/internal/_httpQueryReadBoolean2.mjs.map +0 -1
- package/lib/internal/_httpQueryReadNumber2.mjs +0 -13
- package/lib/internal/_httpQueryReadNumber2.mjs.map +0 -1
- package/lib/internal/_httpQueryReadString2.mjs +0 -9
- package/lib/internal/_httpQueryReadString2.mjs.map +0 -1
- package/lib/internal/_isBetween2.mjs +0 -9
- package/lib/internal/_isBetween2.mjs.map +0 -1
- package/lib/internal/_isBigintString2.mjs +0 -17
- package/lib/internal/_isBigintString2.mjs.map +0 -1
- package/lib/internal/_isFormatByte2.mjs +0 -13
- package/lib/internal/_isFormatByte2.mjs.map +0 -1
- package/lib/internal/_isFormatDate2.mjs +0 -10
- package/lib/internal/_isFormatDate2.mjs.map +0 -1
- package/lib/internal/_isFormatDateTime2.mjs +0 -10
- package/lib/internal/_isFormatDateTime2.mjs.map +0 -1
- package/lib/internal/_isFormatDuration2.mjs +0 -10
- package/lib/internal/_isFormatDuration2.mjs.map +0 -1
- package/lib/internal/_isFormatEmail2.mjs +0 -10
- package/lib/internal/_isFormatEmail2.mjs.map +0 -1
- package/lib/internal/_isFormatHostname2.mjs +0 -10
- package/lib/internal/_isFormatHostname2.mjs.map +0 -1
- package/lib/internal/_isFormatIdnEmail2.mjs +0 -10
- package/lib/internal/_isFormatIdnEmail2.mjs.map +0 -1
- package/lib/internal/_isFormatIdnHostname2.mjs +0 -10
- package/lib/internal/_isFormatIdnHostname2.mjs.map +0 -1
- package/lib/internal/_isFormatIpv42.mjs +0 -10
- package/lib/internal/_isFormatIpv42.mjs.map +0 -1
- package/lib/internal/_isFormatIpv62.mjs +0 -10
- package/lib/internal/_isFormatIpv62.mjs.map +0 -1
- package/lib/internal/_isFormatIri2.mjs +0 -10
- package/lib/internal/_isFormatIri2.mjs.map +0 -1
- package/lib/internal/_isFormatIriReference2.mjs +0 -10
- package/lib/internal/_isFormatIriReference2.mjs.map +0 -1
- package/lib/internal/_isFormatJsonPointer2.mjs +0 -10
- package/lib/internal/_isFormatJsonPointer2.mjs.map +0 -1
- package/lib/internal/_isFormatPassword2.mjs +0 -9
- package/lib/internal/_isFormatPassword2.mjs.map +0 -1
- package/lib/internal/_isFormatRegex2.mjs +0 -17
- package/lib/internal/_isFormatRegex2.mjs.map +0 -1
- package/lib/internal/_isFormatRelativeJsonPointer2.mjs +0 -10
- package/lib/internal/_isFormatRelativeJsonPointer2.mjs.map +0 -1
- package/lib/internal/_isFormatTime2.mjs +0 -10
- package/lib/internal/_isFormatTime2.mjs.map +0 -1
- package/lib/internal/_isFormatUri2.mjs +0 -11
- package/lib/internal/_isFormatUri2.mjs.map +0 -1
- package/lib/internal/_isFormatUriReference2.mjs +0 -10
- package/lib/internal/_isFormatUriReference2.mjs.map +0 -1
- package/lib/internal/_isFormatUriTemplate2.mjs +0 -10
- package/lib/internal/_isFormatUriTemplate2.mjs.map +0 -1
- package/lib/internal/_isFormatUrl2.mjs +0 -10
- package/lib/internal/_isFormatUrl2.mjs.map +0 -1
- package/lib/internal/_isFormatUuid2.mjs +0 -10
- package/lib/internal/_isFormatUuid2.mjs.map +0 -1
- package/lib/internal/_isTypeFloat2.mjs +0 -11
- package/lib/internal/_isTypeFloat2.mjs.map +0 -1
- package/lib/internal/_isTypeInt162.mjs +0 -11
- package/lib/internal/_isTypeInt162.mjs.map +0 -1
- package/lib/internal/_isTypeInt322.mjs +0 -11
- package/lib/internal/_isTypeInt322.mjs.map +0 -1
- package/lib/internal/_isTypeInt642.mjs +0 -11
- package/lib/internal/_isTypeInt642.mjs.map +0 -1
- package/lib/internal/_isTypeInt82.mjs +0 -11
- package/lib/internal/_isTypeInt82.mjs.map +0 -1
- package/lib/internal/_isTypeUint162.mjs +0 -11
- package/lib/internal/_isTypeUint162.mjs.map +0 -1
- package/lib/internal/_isTypeUint322.mjs +0 -11
- package/lib/internal/_isTypeUint322.mjs.map +0 -1
- package/lib/internal/_isTypeUint642.mjs +0 -11
- package/lib/internal/_isTypeUint642.mjs.map +0 -1
- package/lib/internal/_isTypeUint82.mjs +0 -11
- package/lib/internal/_isTypeUint82.mjs.map +0 -1
- package/lib/internal/_isUniqueItems2.mjs +0 -143
- package/lib/internal/_isUniqueItems2.mjs.map +0 -1
- package/lib/internal/_jsonStringifyNumber2.mjs +0 -9
- package/lib/internal/_jsonStringifyNumber2.mjs.map +0 -1
- package/lib/internal/_jsonStringifyRest2.mjs +0 -11
- package/lib/internal/_jsonStringifyRest2.mjs.map +0 -1
- package/lib/internal/_jsonStringifyString2.mjs +0 -45
- package/lib/internal/_jsonStringifyString2.mjs.map +0 -1
- package/lib/internal/_jsonStringifyTail2.mjs +0 -9
- package/lib/internal/_jsonStringifyTail2.mjs.map +0 -1
- package/lib/internal/_llmApplicationFinalize2.mjs +0 -11
- package/lib/internal/_llmApplicationFinalize2.mjs.map +0 -1
- package/lib/internal/_notationAny2.mjs +0 -42
- package/lib/internal/_notationAny2.mjs.map +0 -1
- package/lib/internal/_notationCamel2.mjs +0 -21
- package/lib/internal/_notationCamel2.mjs.map +0 -1
- package/lib/internal/_notationPascal2.mjs +0 -17
- package/lib/internal/_notationPascal2.mjs.map +0 -1
- package/lib/internal/_notationSnake2.mjs +0 -54
- package/lib/internal/_notationSnake2.mjs.map +0 -1
- package/lib/internal/_parseLlmArguments2.mjs +0 -11
- package/lib/internal/_parseLlmArguments2.mjs.map +0 -1
- package/lib/internal/_plainCloneAny2.mjs +0 -67
- package/lib/internal/_plainCloneAny2.mjs.map +0 -1
- package/lib/internal/_randomArray2.mjs +0 -31
- package/lib/internal/_randomArray2.mjs.map +0 -1
- package/lib/internal/_randomBigint2.mjs +0 -12
- package/lib/internal/_randomBigint2.mjs.map +0 -1
- package/lib/internal/_randomBoolean2.mjs +0 -9
- package/lib/internal/_randomBoolean2.mjs.map +0 -1
- package/lib/internal/_randomFormatByte2.mjs +0 -10
- package/lib/internal/_randomFormatByte2.mjs.map +0 -1
- package/lib/internal/_randomFormatDate2.mjs +0 -20
- package/lib/internal/_randomFormatDate2.mjs.map +0 -1
- package/lib/internal/_randomFormatDatetime2.mjs +0 -18
- package/lib/internal/_randomFormatDatetime2.mjs.map +0 -1
- package/lib/internal/_randomFormatDuration2.mjs +0 -35
- package/lib/internal/_randomFormatDuration2.mjs.map +0 -1
- package/lib/internal/_randomFormatEmail2.mjs +0 -17
- package/lib/internal/_randomFormatEmail2.mjs.map +0 -1
- package/lib/internal/_randomFormatHostname2.mjs +0 -13
- package/lib/internal/_randomFormatHostname2.mjs.map +0 -1
- package/lib/internal/_randomFormatIdnEmail2.mjs +0 -12
- package/lib/internal/_randomFormatIdnEmail2.mjs.map +0 -1
- package/lib/internal/_randomFormatIdnHostname2.mjs +0 -12
- package/lib/internal/_randomFormatIdnHostname2.mjs.map +0 -1
- package/lib/internal/_randomFormatIpv42.mjs +0 -17
- package/lib/internal/_randomFormatIpv42.mjs.map +0 -1
- package/lib/internal/_randomFormatIpv62.mjs +0 -17
- package/lib/internal/_randomFormatIpv62.mjs.map +0 -1
- package/lib/internal/_randomFormatIri2.mjs +0 -12
- package/lib/internal/_randomFormatIri2.mjs.map +0 -1
- package/lib/internal/_randomFormatIriReference2.mjs +0 -12
- package/lib/internal/_randomFormatIriReference2.mjs.map +0 -1
- package/lib/internal/_randomFormatJsonPointer2.mjs +0 -13
- package/lib/internal/_randomFormatJsonPointer2.mjs.map +0 -1
- package/lib/internal/_randomFormatPassword2.mjs +0 -16
- package/lib/internal/_randomFormatPassword2.mjs.map +0 -1
- package/lib/internal/_randomFormatRegex2.mjs +0 -10
- package/lib/internal/_randomFormatRegex2.mjs.map +0 -1
- package/lib/internal/_randomFormatRelativeJsonPointer2.mjs +0 -16
- package/lib/internal/_randomFormatRelativeJsonPointer2.mjs.map +0 -1
- package/lib/internal/_randomFormatTime2.mjs +0 -19
- package/lib/internal/_randomFormatTime2.mjs.map +0 -1
- package/lib/internal/_randomFormatUri2.mjs +0 -12
- package/lib/internal/_randomFormatUri2.mjs.map +0 -1
- package/lib/internal/_randomFormatUriReference2.mjs +0 -12
- package/lib/internal/_randomFormatUriReference2.mjs.map +0 -1
- package/lib/internal/_randomFormatUriTemplate2.mjs +0 -12
- package/lib/internal/_randomFormatUriTemplate2.mjs.map +0 -1
- package/lib/internal/_randomFormatUrl2.mjs +0 -17
- package/lib/internal/_randomFormatUrl2.mjs.map +0 -1
- package/lib/internal/_randomFormatUuid2.mjs +0 -13
- package/lib/internal/_randomFormatUuid2.mjs.map +0 -1
- package/lib/internal/_randomInteger2.mjs +0 -47
- package/lib/internal/_randomInteger2.mjs.map +0 -1
- package/lib/internal/_randomNumber2.mjs +0 -66
- package/lib/internal/_randomNumber2.mjs.map +0 -1
- package/lib/internal/_randomPattern2.mjs +0 -22
- package/lib/internal/_randomPattern2.mjs.map +0 -1
- package/lib/internal/_randomPick2.mjs +0 -17
- package/lib/internal/_randomPick2.mjs.map +0 -1
- package/lib/internal/_randomString2.mjs +0 -32
- package/lib/internal/_randomString2.mjs.map +0 -1
- package/lib/internal/_throwTypeGuardError2.mjs +0 -14
- package/lib/internal/_throwTypeGuardError2.mjs.map +0 -1
- package/lib/internal/_validateReport2.mjs +0 -29
- package/lib/internal/_validateReport2.mjs.map +0 -1
- package/lib/internal/private/__notationCapitalize2.mjs +0 -9
- package/lib/internal/private/__notationCapitalize2.mjs.map +0 -1
- package/lib/internal/private/__notationUnsnake2.mjs +0 -29
- package/lib/internal/private/__notationUnsnake2.mjs.map +0 -1
- package/lib/json2.mjs +0 -94
- package/lib/json2.mjs.map +0 -1
- package/lib/llm2.mjs +0 -54
- package/lib/llm2.mjs.map +0 -1
- package/lib/module2.mjs +0 -185
- package/lib/module2.mjs.map +0 -1
- package/lib/notations2.mjs +0 -169
- package/lib/notations2.mjs.map +0 -1
- package/lib/plain2.mjs +0 -119
- package/lib/plain2.mjs.map +0 -1
- package/lib/protobuf2.mjs +0 -94
- package/lib/protobuf2.mjs.map +0 -1
- package/lib/re-exports.mjs.map +0 -1
- package/lib/re-exports2.mjs +0 -17
- package/lib/re-exports2.mjs.map +0 -1
- package/lib/reflect2.mjs +0 -29
- package/lib/reflect2.mjs.map +0 -1
- package/lib/transform2.mjs +0 -26
- package/lib/transform2.mjs.map +0 -1
- package/lib/transformers/NoTransformConfigurationError2.mjs +0 -21
- package/lib/transformers/NoTransformConfigurationError2.mjs.map +0 -1
|
@@ -1,1361 +1,1361 @@
|
|
|
1
|
-
package internal
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
"sort"
|
|
6
|
-
"strings"
|
|
7
|
-
|
|
8
|
-
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
9
|
-
shimchecker "github.com/microsoft/typescript-go/shim/checker"
|
|
10
|
-
shimprinter "github.com/microsoft/typescript-go/shim/printer"
|
|
11
|
-
nativecontext "github.com/samchon/typia/packages/typia/native/core/context"
|
|
12
|
-
nativefactories "github.com/samchon/typia/packages/typia/native/core/factories"
|
|
13
|
-
nativehelpers "github.com/samchon/typia/packages/typia/native/core/programmers/helpers"
|
|
14
|
-
nativeiterate "github.com/samchon/typia/packages/typia/native/core/programmers/iterate"
|
|
15
|
-
nativemetadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
type featureProgrammerNamespace struct{}
|
|
19
|
-
|
|
20
|
-
var FeatureProgrammer = featureProgrammerNamespace{}
|
|
21
|
-
|
|
22
|
-
type FeatureProgrammer_IConfig struct {
|
|
23
|
-
Types FeatureProgrammer_IConfig_ITypes
|
|
24
|
-
Prefix string
|
|
25
|
-
Path bool
|
|
26
|
-
Trace bool
|
|
27
|
-
Addition func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
28
|
-
Initializer func(props FeatureProgrammer_InitializerProps) FeatureProgrammer_InitializerOutput
|
|
29
|
-
Decoder func(props FeatureProgrammer_DecoderProps) *shimast.Node
|
|
30
|
-
Objector FeatureProgrammer_IConfig_IObjector
|
|
31
|
-
Generator FeatureProgrammer_IConfig_IGenerator
|
|
32
|
-
ObjectParents bool
|
|
33
|
-
// Visited reports whether the analyzed type graph carries a recursive
|
|
34
|
-
// component (issue #1820). It is a closure (usually the functor's Visited
|
|
35
|
-
// method) because the answer is unknown until metadata analysis runs,
|
|
36
|
-
// which happens after the config is constructed. When true, generated
|
|
37
|
-
// functions thread a per-invocation `_vctx` visit context.
|
|
38
|
-
Visited func() bool
|
|
39
|
-
// VisitGuard wraps a recursive function's body with the feature's own
|
|
40
|
-
// cycle handling (e.g. checkers report a revisited object as valid). Nil
|
|
41
|
-
// keeps the body untouched even when Visited is on.
|
|
42
|
-
VisitGuard func(props FeatureProgrammer_VisitGuardProps) *shimast.Node
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
type FeatureProgrammer_VisitGuardProps struct {
|
|
46
|
-
// Key names the `_vctx` slot of the guarded function (e.g. "o3" for the
|
|
47
|
-
// object function of index 3), so each recursive function tracks its own
|
|
48
|
-
// visit set and union-branch probing cannot pollute sibling checks.
|
|
49
|
-
Key string
|
|
50
|
-
Input *shimast.Expression
|
|
51
|
-
Body *shimast.Node
|
|
52
|
-
// Object is the recursive object being guarded, so a feature's VisitGuard can
|
|
53
|
-
// choose a prototype-bearing allocator (classify: Object.create(Name.prototype)
|
|
54
|
-
// for a named class, matching ClassifyJoiner.Object). nil keeps the legacy
|
|
55
|
-
// plain-container ({}/[]) behavior used by clone, notation, and the rest.
|
|
56
|
-
Object *nativemetadata.MetadataObjectType
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
type FeatureProgrammer_IConfig_ITypes struct {
|
|
60
|
-
Input func(t *shimchecker.Type, name *string) *shimast.TypeNode
|
|
61
|
-
Output func(t *shimchecker.Type, name *string) *shimast.TypeNode
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
type FeatureProgrammer_IConfig_IObjector struct {
|
|
65
|
-
Checker func(props FeatureProgrammer_ObjectorCheckerProps) *shimast.Node
|
|
66
|
-
Decoder func(props FeatureProgrammer_ObjectorDecoderProps) *shimast.Node
|
|
67
|
-
Joiner func(props FeatureProgrammer_ObjectorJoinerProps) *shimast.Node
|
|
68
|
-
Unionizer func(props FeatureProgrammer_ObjectorUnionizerProps) *shimast.Node
|
|
69
|
-
Failure func(props FeatureProgrammer_ObjectorFailureProps) *shimast.Node
|
|
70
|
-
Is func(exp *shimast.Expression) *shimast.Node
|
|
71
|
-
Required func(exp *shimast.Expression) *shimast.Node
|
|
72
|
-
Full func(props FeatureProgrammer_ObjectorFullProps) *shimast.Node
|
|
73
|
-
Type *shimast.TypeNode
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
type FeatureProgrammer_IConfig_IGenerator struct {
|
|
77
|
-
Objects func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
78
|
-
Unions func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
79
|
-
Arrays func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
80
|
-
Tuples func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
type FeatureProgrammer_IExplore = nativehelpers.UnionExplorer_IExplore
|
|
84
|
-
|
|
85
|
-
type FeatureProgrammer_InitializerProps struct {
|
|
86
|
-
Context nativecontext.ITypiaContext
|
|
87
|
-
Functor *nativehelpers.FunctionProgrammer
|
|
88
|
-
Type *shimchecker.Type
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
type FeatureProgrammer_InitializerOutput struct {
|
|
92
|
-
Collection *nativemetadata.MetadataCollection
|
|
93
|
-
Metadata *nativemetadata.MetadataSchema
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
type FeatureProgrammer_DecoderProps struct {
|
|
97
|
-
Metadata *nativemetadata.MetadataSchema
|
|
98
|
-
Input *shimast.Expression
|
|
99
|
-
Explore FeatureProgrammer_IExplore
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
type FeatureProgrammer_ObjectorCheckerProps struct {
|
|
103
|
-
Metadata *nativemetadata.MetadataSchema
|
|
104
|
-
Input *shimast.Expression
|
|
105
|
-
Explore FeatureProgrammer_IExplore
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
type FeatureProgrammer_ObjectorDecoderProps struct {
|
|
109
|
-
Input *shimast.Expression
|
|
110
|
-
Object *nativemetadata.MetadataObjectType
|
|
111
|
-
Explore FeatureProgrammer_IExplore
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
type FeatureProgrammer_ObjectorJoinerProps struct {
|
|
115
|
-
Entries []nativehelpers.IExpressionEntry
|
|
116
|
-
Input *shimast.Expression
|
|
117
|
-
Object *nativemetadata.MetadataObjectType
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
type FeatureProgrammer_ObjectorUnionizerProps struct {
|
|
121
|
-
Objects []*nativemetadata.MetadataObjectType
|
|
122
|
-
Input *shimast.Expression
|
|
123
|
-
Explore FeatureProgrammer_IExplore
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
type FeatureProgrammer_ObjectorFailureProps struct {
|
|
127
|
-
Input *shimast.Expression
|
|
128
|
-
Expected string
|
|
129
|
-
Explore *FeatureProgrammer_IExplore
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
type FeatureProgrammer_ObjectorFullProps struct {
|
|
133
|
-
Condition *shimast.Expression
|
|
134
|
-
Input *shimast.Expression
|
|
135
|
-
Expected string
|
|
136
|
-
Explore FeatureProgrammer_IExplore
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
type FeatureProgrammer_Decoder[T any] func(props struct {
|
|
140
|
-
Input *shimast.Expression
|
|
141
|
-
Definition T
|
|
142
|
-
Explore FeatureProgrammer_IExplore
|
|
143
|
-
}) *shimast.Node
|
|
144
|
-
|
|
145
|
-
type FeatureProgrammer_IComposed struct {
|
|
146
|
-
Body *shimast.Node
|
|
147
|
-
Parameters []*shimast.Node
|
|
148
|
-
Functions map[string]*shimast.Node
|
|
149
|
-
Statements []*shimast.Node
|
|
150
|
-
Response *shimast.TypeNode
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
type FeatureProgrammer_IDecomposed struct {
|
|
154
|
-
Functions map[string]*shimast.Node
|
|
155
|
-
Statements []*shimast.Node
|
|
156
|
-
Arrow *shimast.Node
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
type FeatureProgrammer_ComposeProps struct {
|
|
160
|
-
Context nativecontext.ITypiaContext
|
|
161
|
-
Config FeatureProgrammer_IConfig
|
|
162
|
-
Functor *nativehelpers.FunctionProgrammer
|
|
163
|
-
Type *shimchecker.Type
|
|
164
|
-
Name *string
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
type FeatureProgrammer_WriteDecomposedProps struct {
|
|
168
|
-
Modulo *shimast.Expression
|
|
169
|
-
Functor *nativehelpers.FunctionProgrammer
|
|
170
|
-
Result FeatureProgrammer_IDecomposed
|
|
171
|
-
ReturnWrapper func(arrow *shimast.Node) *shimast.Node
|
|
172
|
-
Emit *shimprinter.EmitContext
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
type FeatureProgrammer_WriteProps struct {
|
|
176
|
-
Context nativecontext.ITypiaContext
|
|
177
|
-
Config FeatureProgrammer_IConfig
|
|
178
|
-
Functor *nativehelpers.FunctionProgrammer
|
|
179
|
-
Type *shimchecker.Type
|
|
180
|
-
Name *string
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
type FeatureProgrammer_WriteObjectFunctionsProps struct {
|
|
184
|
-
Config FeatureProgrammer_IConfig
|
|
185
|
-
Context nativecontext.ITypiaContext
|
|
186
|
-
Functor *nativehelpers.FunctionProgrammer
|
|
187
|
-
Collection *nativemetadata.MetadataCollection
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
type FeatureProgrammer_WriteUnionFunctionsProps struct {
|
|
191
|
-
Config FeatureProgrammer_IConfig
|
|
192
|
-
Collection *nativemetadata.MetadataCollection
|
|
193
|
-
Emit *shimprinter.EmitContext
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
type FeatureProgrammer_DecodeArrayConfig struct {
|
|
197
|
-
Trace bool
|
|
198
|
-
Path bool
|
|
199
|
-
Decoder func(props FeatureProgrammer_DecoderProps) *shimast.Node
|
|
200
|
-
Prefix string
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
type FeatureProgrammer_DecodeArrayProps struct {
|
|
204
|
-
Config FeatureProgrammer_DecodeArrayConfig
|
|
205
|
-
Functor *nativehelpers.FunctionProgrammer
|
|
206
|
-
Combiner func(next struct {
|
|
207
|
-
Input *shimast.Expression
|
|
208
|
-
Arrow *shimast.Node
|
|
209
|
-
}) *shimast.Node
|
|
210
|
-
Array *nativemetadata.MetadataArray
|
|
211
|
-
Input *shimast.Expression
|
|
212
|
-
Explore FeatureProgrammer_IExplore
|
|
213
|
-
Emit *shimprinter.EmitContext
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
type FeatureProgrammer_DecodeObjectConfig struct {
|
|
217
|
-
Trace bool
|
|
218
|
-
Path bool
|
|
219
|
-
Prefix string
|
|
220
|
-
// Visited threads the per-invocation `_vctx` argument to the called object
|
|
221
|
-
// function. It must come from the calling feature's own config — not from
|
|
222
|
-
// the (possibly shared) functor — so a visit-tracking feature composed with
|
|
223
|
-
// a non-tracking one (e.g. assert + clone) cannot leak the argument into
|
|
224
|
-
// functions that do not declare it.
|
|
225
|
-
Visited bool
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
type FeatureProgrammer_DecodeObjectProps struct {
|
|
229
|
-
Config FeatureProgrammer_DecodeObjectConfig
|
|
230
|
-
Functor *nativehelpers.FunctionProgrammer
|
|
231
|
-
Object *nativemetadata.MetadataObjectType
|
|
232
|
-
Input *shimast.Expression
|
|
233
|
-
Explore FeatureProgrammer_IExplore
|
|
234
|
-
Emit *shimprinter.EmitContext
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
type FeatureProgrammer_IndexProps struct {
|
|
238
|
-
Start *int
|
|
239
|
-
Postfix string
|
|
240
|
-
Rand string
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
type FeatureProgrammer_ArgumentsArrayProps struct {
|
|
244
|
-
Config FeatureProgrammer_ArgumentsArrayConfig
|
|
245
|
-
Input *shimast.Expression
|
|
246
|
-
Explore FeatureProgrammer_IExplore
|
|
247
|
-
Emit *shimprinter.EmitContext
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
type FeatureProgrammer_ArgumentsArrayConfig struct {
|
|
251
|
-
Path bool
|
|
252
|
-
Trace bool
|
|
253
|
-
Visited bool
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
type FeatureProgrammer_ParameterDeclarationsProps struct {
|
|
257
|
-
Config FeatureProgrammer_ParameterConfig
|
|
258
|
-
Type *shimast.TypeNode
|
|
259
|
-
Input *shimast.Node
|
|
260
|
-
Emit *shimprinter.EmitContext
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
type FeatureProgrammer_ParameterConfig struct {
|
|
264
|
-
Path bool
|
|
265
|
-
Trace bool
|
|
266
|
-
Visited bool
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// featureProgrammer_visited resolves the late-bound recursion flag; the
|
|
270
|
-
// closure is nil for features that do not participate in visit tracking.
|
|
271
|
-
func featureProgrammer_visited(config FeatureProgrammer_IConfig) bool {
|
|
272
|
-
return config.Visited != nil && config.Visited()
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// VisitKey names a recursive function's `_vctx` slot after the function
|
|
276
|
-
// itself (its prefixed name minus the leading underscore, e.g. "io0", "co2").
|
|
277
|
-
// Composed features share one context object — clone embeds is-checks for
|
|
278
|
-
// union discrimination, for instance — so the slot must carry the feature
|
|
279
|
-
// prefix or two families would clash on the same key with different
|
|
280
|
-
// container kinds.
|
|
281
|
-
func (featureProgrammerNamespace) VisitKey(prefix string, kind string, index int) string {
|
|
282
|
-
return strings.TrimPrefix(fmt.Sprintf("%s%s%d", prefix, kind, index), "_")
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// CollectionRecursive reports whether the analyzed type graph carries any
|
|
286
|
-
// recursive component — the precondition for a runtime value to drive the
|
|
287
|
-
// generated function call graph into a cycle (issue #1820).
|
|
288
|
-
func (featureProgrammerNamespace) CollectionRecursive(collection *nativemetadata.MetadataCollection) bool {
|
|
289
|
-
for _, object := range collection.Objects() {
|
|
290
|
-
if object.Recursive {
|
|
291
|
-
return true
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
for _, array := range collection.Arrays() {
|
|
295
|
-
if array.Recursive {
|
|
296
|
-
return true
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
for _, tuple := range collection.Tuples() {
|
|
300
|
-
if tuple.Recursive {
|
|
301
|
-
return true
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return false
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// VisitGuardSkip wraps a recursive in-place walker (prune) so a revisited
|
|
308
|
-
// object is simply skipped: pruning is idempotent per instance, which makes
|
|
309
|
-
// the skip both the cycle breaker and the DAG deduplication. Handles the
|
|
310
|
-
// block bodies the prune joiner produces as well as expression bodies.
|
|
311
|
-
func (featureProgrammerNamespace) VisitGuardSkip(key string, body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
312
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
313
|
-
slot := "_vctx." + key
|
|
314
|
-
has := f.NewIdentifier("(" + slot + " || (" + slot + " = new WeakSet())).has(input)")
|
|
315
|
-
add := f.NewIdentifier(slot + ".add(input)")
|
|
316
|
-
if body != nil && body.Kind == shimast.KindBlock {
|
|
317
|
-
statements := []*shimast.Node{
|
|
318
|
-
f.NewIfStatement(has, f.NewReturnStatement(nil), nil),
|
|
319
|
-
f.NewExpressionStatement(add),
|
|
320
|
-
}
|
|
321
|
-
statements = append(statements, body.Statements()...)
|
|
322
|
-
return f.NewBlock(f.NewNodeList(statements), true)
|
|
323
|
-
}
|
|
324
|
-
return nativefactories.ExpressionFactory.Conditional(
|
|
325
|
-
has,
|
|
326
|
-
f.NewIdentifier("undefined"),
|
|
327
|
-
f.NewParenthesizedExpression(
|
|
328
|
-
f.NewBinaryExpression(
|
|
329
|
-
nil,
|
|
330
|
-
add,
|
|
331
|
-
nil,
|
|
332
|
-
f.NewToken(shimast.KindCommaToken),
|
|
333
|
-
f.NewParenthesizedExpression(body),
|
|
334
|
-
),
|
|
335
|
-
),
|
|
336
|
-
emit,
|
|
337
|
-
)
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// VisitGuardSerialize wraps a recursive serializer function (json.stringify,
|
|
341
|
-
// protobuf.encode) with on-stack cycle detection: JSON and protobuf cannot
|
|
342
|
-
// represent cycles, so a value met again while still being serialized raises
|
|
343
|
-
// the feature's thrower instead of overflowing the stack. Unlike the checker
|
|
344
|
-
// and rebuilder guards the entry is removed after the body finishes either
|
|
345
|
-
// way, because re-serializing a DAG alias at another position is legal and
|
|
346
|
-
// must keep working.
|
|
347
|
-
func (featureProgrammerNamespace) VisitGuardSerialize(key string, thrower *shimast.Node, body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
348
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
349
|
-
slot := "_vctx." + key
|
|
350
|
-
bodyExpression := featureProgrammer_block_to_expression(body, emit)
|
|
351
|
-
finisher := f.NewArrowFunction(
|
|
352
|
-
nil,
|
|
353
|
-
nil,
|
|
354
|
-
f.NewNodeList([]*shimast.Node{
|
|
355
|
-
nativefactories.IdentifierFactory.Parameter("_vout", nativefactories.TypeFactory.Keyword("any"), nil),
|
|
356
|
-
}),
|
|
357
|
-
nil,
|
|
358
|
-
nil,
|
|
359
|
-
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
360
|
-
f.NewParenthesizedExpression(
|
|
361
|
-
f.NewBinaryExpression(
|
|
362
|
-
nil,
|
|
363
|
-
f.NewIdentifier(slot+".delete(input)"),
|
|
364
|
-
nil,
|
|
365
|
-
f.NewToken(shimast.KindCommaToken),
|
|
366
|
-
f.NewIdentifier("_vout"),
|
|
367
|
-
),
|
|
368
|
-
),
|
|
369
|
-
)
|
|
370
|
-
return nativefactories.ExpressionFactory.Conditional(
|
|
371
|
-
f.NewIdentifier("("+slot+" || ("+slot+" = new WeakSet())).has(input)"),
|
|
372
|
-
thrower,
|
|
373
|
-
f.NewParenthesizedExpression(
|
|
374
|
-
f.NewBinaryExpression(
|
|
375
|
-
nil,
|
|
376
|
-
f.NewIdentifier(slot+".add(input)"),
|
|
377
|
-
nil,
|
|
378
|
-
f.NewToken(shimast.KindCommaToken),
|
|
379
|
-
f.NewCallExpression(
|
|
380
|
-
f.NewParenthesizedExpression(finisher),
|
|
381
|
-
nil,
|
|
382
|
-
nil,
|
|
383
|
-
f.NewNodeList([]*shimast.Node{bodyExpression}),
|
|
384
|
-
shimast.NodeFlagsNone,
|
|
385
|
-
),
|
|
386
|
-
),
|
|
387
|
-
),
|
|
388
|
-
emit,
|
|
389
|
-
)
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// VisitGuardRebuild wraps a recursive rebuilder function (clone, notations)
|
|
393
|
-
// so a revisited source object returns the output instance allocated on its
|
|
394
|
-
// first visit — reproducing runtime cycles and deduplicating DAG aliases.
|
|
395
|
-
// The output container registers in the WeakMap BEFORE the body evaluates,
|
|
396
|
-
// so recursive references inside the body resolve to the same (still
|
|
397
|
-
// filling) instance, exactly like the structured-clone algorithm.
|
|
398
|
-
func (featureProgrammerNamespace) VisitGuardRebuild(key string, array bool, body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
399
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
400
|
-
allocator := f.NewObjectLiteralExpression(f.NewNodeList(nil), false)
|
|
401
|
-
if array {
|
|
402
|
-
allocator = f.NewArrayLiteralExpression(f.NewNodeList(nil), false)
|
|
403
|
-
}
|
|
404
|
-
return FeatureProgrammer.VisitGuardRebuildWith(key, allocator, body, emit)
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// VisitGuardRebuildWith is VisitGuardRebuild with a caller-supplied output
|
|
408
|
-
// container. clone/notation pass a plain {} (or [] for arrays); classify passes
|
|
409
|
-
// Object.create(<Class>.prototype) for a named class so the WeakMap-registered
|
|
410
|
-
// instance carries the right prototype — `x instanceof Class` then holds even on
|
|
411
|
-
// the recursive arm, where the joiner body's own (unregistered) instance is
|
|
412
|
-
// merged onto this allocator by Object.assign and discarded. The allocator
|
|
413
|
-
// registers in the WeakMap BEFORE the body evaluates, so a back-reference
|
|
414
|
-
// inside the body resolves to this same (still filling) instance.
|
|
415
|
-
func (featureProgrammerNamespace) VisitGuardRebuildWith(key string, allocator *shimast.Node, body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
416
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
417
|
-
slot := "_vctx." + key
|
|
418
|
-
bodyExpression := featureProgrammer_block_to_expression(body, emit)
|
|
419
|
-
filler := f.NewArrowFunction(
|
|
420
|
-
nil,
|
|
421
|
-
nil,
|
|
422
|
-
f.NewNodeList([]*shimast.Node{
|
|
423
|
-
nativefactories.IdentifierFactory.Parameter("_vout", nativefactories.TypeFactory.Keyword("any"), nil),
|
|
424
|
-
}),
|
|
425
|
-
nil,
|
|
426
|
-
nil,
|
|
427
|
-
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
428
|
-
f.NewParenthesizedExpression(
|
|
429
|
-
f.NewBinaryExpression(
|
|
430
|
-
nil,
|
|
431
|
-
f.NewIdentifier(slot+".set(input, _vout)"),
|
|
432
|
-
nil,
|
|
433
|
-
f.NewToken(shimast.KindCommaToken),
|
|
434
|
-
f.NewCallExpression(
|
|
435
|
-
f.NewIdentifier("Object.assign"),
|
|
436
|
-
nil,
|
|
437
|
-
nil,
|
|
438
|
-
f.NewNodeList([]*shimast.Node{
|
|
439
|
-
f.NewIdentifier("_vout"),
|
|
440
|
-
bodyExpression,
|
|
441
|
-
}),
|
|
442
|
-
shimast.NodeFlagsNone,
|
|
443
|
-
),
|
|
444
|
-
),
|
|
445
|
-
),
|
|
446
|
-
)
|
|
447
|
-
return nativefactories.ExpressionFactory.Conditional(
|
|
448
|
-
f.NewIdentifier("("+slot+" || ("+slot+" = new WeakMap())).has(input)"),
|
|
449
|
-
f.NewIdentifier(slot+".get(input)"),
|
|
450
|
-
f.NewCallExpression(
|
|
451
|
-
f.NewParenthesizedExpression(filler),
|
|
452
|
-
nil,
|
|
453
|
-
nil,
|
|
454
|
-
f.NewNodeList([]*shimast.Node{allocator}),
|
|
455
|
-
shimast.NodeFlagsNone,
|
|
456
|
-
),
|
|
457
|
-
emit,
|
|
458
|
-
)
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
func featureProgrammer_block_to_expression(body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
462
|
-
if body != nil && body.Kind == shimast.KindBlock {
|
|
463
|
-
return nativefactories.ExpressionFactory.SelfCall(emit, body)
|
|
464
|
-
}
|
|
465
|
-
return body
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
var featureProgrammer_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
469
|
-
|
|
470
|
-
func (featureProgrammerNamespace) Compose(props FeatureProgrammer_ComposeProps) FeatureProgrammer_IComposed {
|
|
471
|
-
initialized := props.Config.Initializer(FeatureProgrammer_InitializerProps{
|
|
472
|
-
Context: props.Context,
|
|
473
|
-
Functor: props.Functor,
|
|
474
|
-
Type: props.Type,
|
|
475
|
-
})
|
|
476
|
-
featureProgrammer_compact_object_parents(props.Config, initialized.Collection)
|
|
477
|
-
featureProgrammer_register_schema_unions(initialized.Collection, initialized.Metadata, map[*nativemetadata.MetadataSchema]bool{})
|
|
478
|
-
body := props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
479
|
-
Input: nativefactories.ValueFactory.INPUT(props.Context.Emit),
|
|
480
|
-
Metadata: initialized.Metadata,
|
|
481
|
-
Explore: FeatureProgrammer_IExplore{
|
|
482
|
-
Tracable: props.Config.Path || props.Config.Trace,
|
|
483
|
-
Source: "top",
|
|
484
|
-
From: "top",
|
|
485
|
-
Postfix: "\"\"",
|
|
486
|
-
},
|
|
487
|
-
})
|
|
488
|
-
statements := []*shimast.Node{}
|
|
489
|
-
if props.Config.Addition != nil {
|
|
490
|
-
statements = props.Config.Addition(initialized.Collection)
|
|
491
|
-
}
|
|
492
|
-
functions := map[string]*shimast.Node{}
|
|
493
|
-
for i, v := range featureProgrammer_object_functions(props, initialized.Collection) {
|
|
494
|
-
functions[fmt.Sprintf("%so%d", props.Config.Prefix, i)] = v
|
|
495
|
-
}
|
|
496
|
-
for i, v := range featureProgrammer_union_functions(props.Config, initialized.Collection, props.Context.Emit) {
|
|
497
|
-
functions[fmt.Sprintf("%su%d", props.Config.Prefix, i)] = v
|
|
498
|
-
}
|
|
499
|
-
for i, v := range props.Config.Generator.Arrays(initialized.Collection) {
|
|
500
|
-
functions[fmt.Sprintf("%sa%d", props.Config.Prefix, i)] = v
|
|
501
|
-
}
|
|
502
|
-
for i, v := range props.Config.Generator.Tuples(initialized.Collection) {
|
|
503
|
-
functions[fmt.Sprintf("%st%d", props.Config.Prefix, i)] = v
|
|
504
|
-
}
|
|
505
|
-
return FeatureProgrammer_IComposed{
|
|
506
|
-
Body: body,
|
|
507
|
-
Statements: statements,
|
|
508
|
-
Functions: functions,
|
|
509
|
-
Parameters: FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
510
|
-
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
511
|
-
Type: props.Config.Types.Input(props.Type, props.Name),
|
|
512
|
-
Input: nativefactories.ValueFactory.INPUT(props.Context.Emit),
|
|
513
|
-
Emit: props.Context.Emit,
|
|
514
|
-
}),
|
|
515
|
-
Response: props.Config.Types.Output(props.Type, props.Name),
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
func (featureProgrammerNamespace) WriteDecomposed(props FeatureProgrammer_WriteDecomposedProps) *shimast.Node {
|
|
520
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
521
|
-
statements := []*shimast.Node{}
|
|
522
|
-
statements = append(statements, props.Functor.Declare()...)
|
|
523
|
-
keys := make([]string, 0, len(props.Result.Functions))
|
|
524
|
-
for key := range props.Result.Functions {
|
|
525
|
-
keys = append(keys, key)
|
|
526
|
-
}
|
|
527
|
-
sort.Strings(keys)
|
|
528
|
-
for _, key := range keys {
|
|
529
|
-
if props.Functor != nil && props.Functor.HasLocal(key) == false {
|
|
530
|
-
continue
|
|
531
|
-
}
|
|
532
|
-
statements = append(statements, props.Result.Functions[key])
|
|
533
|
-
}
|
|
534
|
-
statements = append(statements, props.Result.Statements...)
|
|
535
|
-
response := props.Result.Arrow
|
|
536
|
-
if props.ReturnWrapper != nil {
|
|
537
|
-
response = props.ReturnWrapper(props.Result.Arrow)
|
|
538
|
-
}
|
|
539
|
-
statements = append(statements, f.NewReturnStatement(response))
|
|
540
|
-
return f.NewCallExpression(
|
|
541
|
-
f.NewArrowFunction(
|
|
542
|
-
nil,
|
|
543
|
-
nil,
|
|
544
|
-
f.NewNodeList(nil),
|
|
545
|
-
nil,
|
|
546
|
-
nil,
|
|
547
|
-
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
548
|
-
f.NewBlock(f.NewNodeList(statements), true),
|
|
549
|
-
),
|
|
550
|
-
nil,
|
|
551
|
-
nil,
|
|
552
|
-
nil,
|
|
553
|
-
shimast.NodeFlagsNone,
|
|
554
|
-
)
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
func (featureProgrammerNamespace) Write(props FeatureProgrammer_WriteProps) *shimast.Node {
|
|
558
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Context.Emit)
|
|
559
|
-
initialized := props.Config.Initializer(FeatureProgrammer_InitializerProps{
|
|
560
|
-
Context: props.Context,
|
|
561
|
-
Functor: props.Functor,
|
|
562
|
-
Type: props.Type,
|
|
563
|
-
})
|
|
564
|
-
featureProgrammer_compact_object_parents(props.Config, initialized.Collection)
|
|
565
|
-
featureProgrammer_register_schema_unions(initialized.Collection, initialized.Metadata, map[*nativemetadata.MetadataSchema]bool{})
|
|
566
|
-
output := props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
567
|
-
Metadata: initialized.Metadata,
|
|
568
|
-
Input: nativefactories.ValueFactory.INPUT(props.Context.Emit),
|
|
569
|
-
Explore: FeatureProgrammer_IExplore{
|
|
570
|
-
Tracable: props.Config.Path || props.Config.Trace,
|
|
571
|
-
Source: "top",
|
|
572
|
-
From: "top",
|
|
573
|
-
Postfix: "\"\"",
|
|
574
|
-
},
|
|
575
|
-
})
|
|
576
|
-
|
|
577
|
-
objects := featureProgrammer_object_functions(FeatureProgrammer_ComposeProps{
|
|
578
|
-
Config: props.Config,
|
|
579
|
-
Context: props.Context,
|
|
580
|
-
Functor: props.Functor,
|
|
581
|
-
Type: props.Type,
|
|
582
|
-
Name: props.Name,
|
|
583
|
-
}, initialized.Collection)
|
|
584
|
-
unions := featureProgrammer_union_functions(props.Config, initialized.Collection, props.Context.Emit)
|
|
585
|
-
arrays := props.Config.Generator.Arrays(initialized.Collection)
|
|
586
|
-
tuples := props.Config.Generator.Tuples(initialized.Collection)
|
|
587
|
-
|
|
588
|
-
added := []*shimast.Node{}
|
|
589
|
-
if props.Config.Addition != nil {
|
|
590
|
-
added = props.Config.Addition(initialized.Collection)
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
statements := append([]*shimast.Node{}, added...)
|
|
594
|
-
statements = append(statements, props.Functor.Declare()...)
|
|
595
|
-
for _, v := range objects {
|
|
596
|
-
statements = append(statements, v)
|
|
597
|
-
}
|
|
598
|
-
for _, v := range unions {
|
|
599
|
-
statements = append(statements, v)
|
|
600
|
-
}
|
|
601
|
-
for _, v := range arrays {
|
|
602
|
-
statements = append(statements, v)
|
|
603
|
-
}
|
|
604
|
-
for _, v := range tuples {
|
|
605
|
-
statements = append(statements, v)
|
|
606
|
-
}
|
|
607
|
-
if output != nil && output.Kind == shimast.KindBlock {
|
|
608
|
-
statements = append(statements, output.Statements()...)
|
|
609
|
-
} else {
|
|
610
|
-
statements = append(statements, f.NewReturnStatement(output))
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
return f.NewArrowFunction(
|
|
614
|
-
nil,
|
|
615
|
-
nil,
|
|
616
|
-
f.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
617
|
-
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
618
|
-
Type: props.Config.Types.Input(props.Type, props.Name),
|
|
619
|
-
Input: nativefactories.ValueFactory.INPUT(props.Context.Emit),
|
|
620
|
-
Emit: props.Context.Emit,
|
|
621
|
-
})),
|
|
622
|
-
props.Config.Types.Output(props.Type, props.Name),
|
|
623
|
-
nil,
|
|
624
|
-
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
625
|
-
f.NewBlock(f.NewNodeList(statements), true),
|
|
626
|
-
)
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
func (featureProgrammerNamespace) Write_object_functions(props FeatureProgrammer_WriteObjectFunctionsProps) []*shimast.Node {
|
|
630
|
-
featureProgrammer_compact_object_parents(props.Config, props.Collection)
|
|
631
|
-
return featureProgrammer_write_object_functions(props.Config, props.Context, props.Functor, props.Collection)
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
func (featureProgrammerNamespace) Write_union_functions(props FeatureProgrammer_WriteUnionFunctionsProps) []*shimast.Node {
|
|
635
|
-
return featureProgrammer_write_union_functions(props.Config, props.Collection, props.Emit)
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
func (featureProgrammerNamespace) Decode_array(props FeatureProgrammer_DecodeArrayProps) *shimast.Node {
|
|
639
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
640
|
-
rand := fmt.Sprint(props.Functor.Increment())
|
|
641
|
-
tail := []*shimast.Node{}
|
|
642
|
-
if props.Config.Path || props.Config.Trace {
|
|
643
|
-
tail = append(tail, nativefactories.IdentifierFactory.Parameter("_index"+rand, nativefactories.TypeFactory.Keyword("number"), nil))
|
|
644
|
-
}
|
|
645
|
-
parameters := []*shimast.Node{
|
|
646
|
-
nativefactories.IdentifierFactory.Parameter("elem", nativefactories.TypeFactory.Keyword("any"), nil),
|
|
647
|
-
}
|
|
648
|
-
parameters = append(parameters, tail...)
|
|
649
|
-
arrow := f.NewArrowFunction(
|
|
650
|
-
nil,
|
|
651
|
-
nil,
|
|
652
|
-
f.NewNodeList(parameters),
|
|
653
|
-
nil,
|
|
654
|
-
nil,
|
|
655
|
-
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
656
|
-
props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
657
|
-
Input: nativefactories.ValueFactory.INPUT(nil, "elem"),
|
|
658
|
-
Metadata: props.Array.Type.Value,
|
|
659
|
-
Explore: FeatureProgrammer_IExplore{
|
|
660
|
-
Tracable: props.Explore.Tracable,
|
|
661
|
-
Source: props.Explore.Source,
|
|
662
|
-
From: "array",
|
|
663
|
-
Postfix: FeatureProgrammer.Index(FeatureProgrammer_IndexProps{
|
|
664
|
-
Start: props.Explore.Start,
|
|
665
|
-
Postfix: props.Explore.Postfix,
|
|
666
|
-
Rand: rand,
|
|
667
|
-
}),
|
|
668
|
-
},
|
|
669
|
-
}),
|
|
670
|
-
)
|
|
671
|
-
return props.Combiner(struct {
|
|
672
|
-
Input *shimast.Expression
|
|
673
|
-
Arrow *shimast.Node
|
|
674
|
-
}{Input: props.Input, Arrow: arrow})
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
func (featureProgrammerNamespace) Decode_object(props FeatureProgrammer_DecodeObjectProps) *shimast.Node {
|
|
678
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
679
|
-
return f.NewCallExpression(
|
|
680
|
-
f.NewIdentifier(
|
|
681
|
-
props.Functor.UseLocal(fmt.Sprintf("%so%d", props.Config.Prefix, props.Object.Index)),
|
|
682
|
-
),
|
|
683
|
-
nil,
|
|
684
|
-
nil,
|
|
685
|
-
f.NewNodeList(FeatureProgrammer.ArgumentsArray(FeatureProgrammer_ArgumentsArrayProps{
|
|
686
|
-
Config: FeatureProgrammer_ArgumentsArrayConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: props.Config.Visited},
|
|
687
|
-
Input: props.Input,
|
|
688
|
-
Explore: props.Explore,
|
|
689
|
-
Emit: props.Emit,
|
|
690
|
-
})),
|
|
691
|
-
shimast.NodeFlagsNone,
|
|
692
|
-
)
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
func (featureProgrammerNamespace) Index(props FeatureProgrammer_IndexProps) string {
|
|
696
|
-
tail := "\"[\" + _index" + props.Rand + " + \"]\""
|
|
697
|
-
if props.Start != nil {
|
|
698
|
-
tail = "\"[\" + (" + fmt.Sprint(*props.Start) + " + _index" + props.Rand + ") + \"]\""
|
|
699
|
-
}
|
|
700
|
-
if props.Postfix == "" {
|
|
701
|
-
return tail
|
|
702
|
-
}
|
|
703
|
-
if props.Postfix[len(props.Postfix)-1:] == "\"" {
|
|
704
|
-
return props.Postfix[:len(props.Postfix)-1] + tail[1:]
|
|
705
|
-
}
|
|
706
|
-
return props.Postfix + " + " + tail
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
func (featureProgrammerNamespace) ArgumentsArray(props FeatureProgrammer_ArgumentsArrayProps) []*shimast.Node {
|
|
710
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
711
|
-
tail := []*shimast.Node{}
|
|
712
|
-
if props.Config.Path == false && props.Config.Trace == false {
|
|
713
|
-
tail = []*shimast.Node{}
|
|
714
|
-
} else if props.Config.Path && props.Config.Trace {
|
|
715
|
-
path := "_path"
|
|
716
|
-
if props.Explore.Postfix != "" {
|
|
717
|
-
path = "_path + " + props.Explore.Postfix
|
|
718
|
-
}
|
|
719
|
-
tail = append(tail, f.NewIdentifier(path))
|
|
720
|
-
if props.Explore.Source == "function" {
|
|
721
|
-
tail = append(tail, f.NewIdentifier(fmt.Sprintf("%t && _exceptionable", props.Explore.Tracable)))
|
|
722
|
-
} else if props.Explore.Tracable {
|
|
723
|
-
tail = append(tail, f.NewKeywordExpression(shimast.KindTrueKeyword))
|
|
724
|
-
} else {
|
|
725
|
-
tail = append(tail, f.NewKeywordExpression(shimast.KindFalseKeyword))
|
|
726
|
-
}
|
|
727
|
-
} else if props.Config.Path {
|
|
728
|
-
path := "_path"
|
|
729
|
-
if props.Explore.Postfix != "" {
|
|
730
|
-
path = "_path + " + props.Explore.Postfix
|
|
731
|
-
}
|
|
732
|
-
tail = append(tail, f.NewIdentifier(path))
|
|
733
|
-
} else {
|
|
734
|
-
if props.Explore.Source == "function" {
|
|
735
|
-
tail = append(tail, f.NewIdentifier(fmt.Sprintf("%t && _exceptionable", props.Explore.Tracable)))
|
|
736
|
-
} else if props.Explore.Tracable {
|
|
737
|
-
tail = append(tail, f.NewKeywordExpression(shimast.KindTrueKeyword))
|
|
738
|
-
} else {
|
|
739
|
-
tail = append(tail, f.NewKeywordExpression(shimast.KindFalseKeyword))
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
if props.Config.Visited {
|
|
743
|
-
tail = append(tail, f.NewIdentifier("_vctx"))
|
|
744
|
-
}
|
|
745
|
-
return append([]*shimast.Node{props.Input}, tail...)
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
func (featureProgrammerNamespace) ParameterDeclarations(props FeatureProgrammer_ParameterDeclarationsProps) []*shimast.Node {
|
|
749
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
750
|
-
tail := []*shimast.Node{}
|
|
751
|
-
if props.Config.Path {
|
|
752
|
-
tail = append(tail, nativefactories.IdentifierFactory.Parameter("_path", nativefactories.TypeFactory.Keyword("string"), nil))
|
|
753
|
-
}
|
|
754
|
-
if props.Config.Trace {
|
|
755
|
-
tail = append(tail, nativefactories.IdentifierFactory.Parameter(
|
|
756
|
-
"_exceptionable",
|
|
757
|
-
nativefactories.TypeFactory.Keyword("boolean"),
|
|
758
|
-
f.NewKeywordExpression(shimast.KindTrueKeyword),
|
|
759
|
-
))
|
|
760
|
-
}
|
|
761
|
-
if props.Config.Visited {
|
|
762
|
-
// The per-invocation visit context: internal calls always pass it along,
|
|
763
|
-
// so the default object literal only materializes at the public entry.
|
|
764
|
-
tail = append(tail, nativefactories.IdentifierFactory.Parameter(
|
|
765
|
-
"_vctx",
|
|
766
|
-
nativefactories.TypeFactory.Keyword("any"),
|
|
767
|
-
f.NewObjectLiteralExpression(f.NewNodeList(nil), false),
|
|
768
|
-
))
|
|
769
|
-
}
|
|
770
|
-
return append([]*shimast.Node{
|
|
771
|
-
nativefactories.IdentifierFactory.Parameter(props.Input, props.Type, nil),
|
|
772
|
-
}, tail...)
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
func featureProgrammer_object_functions(props FeatureProgrammer_ComposeProps, collection *nativemetadata.MetadataCollection) []*shimast.Node {
|
|
776
|
-
if props.Config.Generator.Objects != nil {
|
|
777
|
-
return props.Config.Generator.Objects(collection)
|
|
778
|
-
}
|
|
779
|
-
return featureProgrammer_write_object_functions(props.Config, props.Context, props.Functor, collection)
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
func featureProgrammer_union_functions(config FeatureProgrammer_IConfig, collection *nativemetadata.MetadataCollection, emit *shimprinter.EmitContext) []*shimast.Node {
|
|
783
|
-
if config.Generator.Unions != nil {
|
|
784
|
-
if generated := config.Generator.Unions(collection); generated != nil {
|
|
785
|
-
return generated
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
return featureProgrammer_write_union_functions(config, collection, emit)
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
type featureProgrammer_schemaUnionVisit struct {
|
|
792
|
-
Schemas map[*nativemetadata.MetadataSchema]bool
|
|
793
|
-
Objects map[*nativemetadata.MetadataObjectType]bool
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
const featureProgrammer_objectParentMinProperties = 8
|
|
797
|
-
|
|
798
|
-
type featureProgrammer_objectPropertySet struct {
|
|
799
|
-
Properties map[string]*nativemetadata.MetadataProperty
|
|
800
|
-
Order []string
|
|
801
|
-
Anchor string
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
func featureProgrammer_compact_object_parents(config FeatureProgrammer_IConfig, collection *nativemetadata.MetadataCollection) {
|
|
805
|
-
if config.ObjectParents == false || collection == nil {
|
|
806
|
-
return
|
|
807
|
-
}
|
|
808
|
-
objects := collection.Objects()
|
|
809
|
-
signatures := make([]featureProgrammer_objectPropertySet, len(objects))
|
|
810
|
-
frequencies := map[string]int{}
|
|
811
|
-
for i, object := range objects {
|
|
812
|
-
signatures[i] = featureProgrammer_object_property_set(object)
|
|
813
|
-
for _, key := range signatures[i].Order {
|
|
814
|
-
frequencies[key]++
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
buckets := map[string][]int{}
|
|
818
|
-
for i := range objects {
|
|
819
|
-
if len(signatures[i].Order) < featureProgrammer_objectParentMinProperties {
|
|
820
|
-
continue
|
|
821
|
-
}
|
|
822
|
-
anchor := featureProgrammer_object_parent_anchor(signatures[i], frequencies)
|
|
823
|
-
if anchor == "" {
|
|
824
|
-
continue
|
|
825
|
-
}
|
|
826
|
-
signatures[i].Anchor = anchor
|
|
827
|
-
buckets[anchor] = append(buckets[anchor], i)
|
|
828
|
-
}
|
|
829
|
-
for i, object := range objects {
|
|
830
|
-
if object.Check_properties_ != nil || len(object.Properties) <= featureProgrammer_objectParentMinProperties {
|
|
831
|
-
continue
|
|
832
|
-
}
|
|
833
|
-
current := signatures[i]
|
|
834
|
-
if len(current.Order) <= featureProgrammer_objectParentMinProperties {
|
|
835
|
-
continue
|
|
836
|
-
}
|
|
837
|
-
best := -1
|
|
838
|
-
bestSize := 0
|
|
839
|
-
visited := map[int]bool{}
|
|
840
|
-
for _, key := range current.Order {
|
|
841
|
-
for _, candidate := range buckets[key] {
|
|
842
|
-
if visited[candidate] || candidate == i {
|
|
843
|
-
continue
|
|
844
|
-
}
|
|
845
|
-
visited[candidate] = true
|
|
846
|
-
candidateSize := len(signatures[candidate].Order)
|
|
847
|
-
if candidateSize <= bestSize || candidateSize >= len(current.Order) {
|
|
848
|
-
continue
|
|
849
|
-
}
|
|
850
|
-
if featureProgrammer_object_parent_covers(current, signatures[candidate]) {
|
|
851
|
-
best = candidate
|
|
852
|
-
bestSize = candidateSize
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
if best == -1 {
|
|
857
|
-
continue
|
|
858
|
-
}
|
|
859
|
-
parent := objects[best]
|
|
860
|
-
object.Parent_objects_ = append(object.Parent_objects_, nativemetadata.MetadataObject_create(nativemetadata.MetadataObject{
|
|
861
|
-
Type: parent,
|
|
862
|
-
Tags: [][]nativemetadata.IMetadataTypeTag{},
|
|
863
|
-
}))
|
|
864
|
-
object.Check_properties_ = featureProgrammer_object_remaining_properties(object.Properties, signatures[best])
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
func featureProgrammer_object_property_set(object *nativemetadata.MetadataObjectType) featureProgrammer_objectPropertySet {
|
|
869
|
-
if object == nil {
|
|
870
|
-
return featureProgrammer_objectPropertySet{}
|
|
871
|
-
}
|
|
872
|
-
output := featureProgrammer_objectPropertySet{
|
|
873
|
-
Properties: map[string]*nativemetadata.MetadataProperty{},
|
|
874
|
-
Order: []string{},
|
|
875
|
-
}
|
|
876
|
-
for _, property := range object.Properties {
|
|
877
|
-
if property == nil || property.Key == nil {
|
|
878
|
-
return featureProgrammer_objectPropertySet{}
|
|
879
|
-
}
|
|
880
|
-
key := property.Key.GetSoleLiteral()
|
|
881
|
-
if key == nil {
|
|
882
|
-
return featureProgrammer_objectPropertySet{}
|
|
883
|
-
}
|
|
884
|
-
signature := featureProgrammer_object_property_signature(property)
|
|
885
|
-
if signature == "" {
|
|
886
|
-
return featureProgrammer_objectPropertySet{}
|
|
887
|
-
}
|
|
888
|
-
output.Properties[signature] = property
|
|
889
|
-
output.Order = append(output.Order, signature)
|
|
890
|
-
}
|
|
891
|
-
return output
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
func featureProgrammer_object_property_signature(property *nativemetadata.MetadataProperty) string {
|
|
895
|
-
if property == nil || property.Key == nil || property.Value == nil {
|
|
896
|
-
return ""
|
|
897
|
-
}
|
|
898
|
-
key := property.Key.GetSoleLiteral()
|
|
899
|
-
if key == nil {
|
|
900
|
-
return ""
|
|
901
|
-
}
|
|
902
|
-
return *key + "\x00" +
|
|
903
|
-
property.Key.GetName() + "\x00" +
|
|
904
|
-
property.Value.GetName() + "\x00" +
|
|
905
|
-
fmt.Sprintf("%t\x00%t", property.Value.Optional, property.Value.Nullable)
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
func featureProgrammer_object_parent_anchor(set featureProgrammer_objectPropertySet, frequencies map[string]int) string {
|
|
909
|
-
anchor := ""
|
|
910
|
-
score := 0
|
|
911
|
-
for _, key := range set.Order {
|
|
912
|
-
next := frequencies[key]
|
|
913
|
-
if anchor == "" || next < score {
|
|
914
|
-
anchor = key
|
|
915
|
-
score = next
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
return anchor
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
func featureProgrammer_object_parent_covers(
|
|
922
|
-
current featureProgrammer_objectPropertySet,
|
|
923
|
-
candidate featureProgrammer_objectPropertySet,
|
|
924
|
-
) bool {
|
|
925
|
-
if len(candidate.Order) == 0 || len(candidate.Order) >= len(current.Order) {
|
|
926
|
-
return false
|
|
927
|
-
}
|
|
928
|
-
for _, key := range candidate.Order {
|
|
929
|
-
if current.Properties[key] == nil {
|
|
930
|
-
return false
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
return true
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
func featureProgrammer_object_remaining_properties(
|
|
937
|
-
properties []*nativemetadata.MetadataProperty,
|
|
938
|
-
parent featureProgrammer_objectPropertySet,
|
|
939
|
-
) []*nativemetadata.MetadataProperty {
|
|
940
|
-
output := make([]*nativemetadata.MetadataProperty, 0, len(properties)-len(parent.Order))
|
|
941
|
-
for _, property := range properties {
|
|
942
|
-
if parent.Properties[featureProgrammer_object_property_signature(property)] != nil {
|
|
943
|
-
continue
|
|
944
|
-
}
|
|
945
|
-
output = append(output, property)
|
|
946
|
-
}
|
|
947
|
-
return output
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
func featureProgrammer_register_schema_unions(collection *nativemetadata.MetadataCollection, metadata *nativemetadata.MetadataSchema, visited map[*nativemetadata.MetadataSchema]bool) {
|
|
951
|
-
if visited == nil {
|
|
952
|
-
visited = map[*nativemetadata.MetadataSchema]bool{}
|
|
953
|
-
}
|
|
954
|
-
featureProgrammer_register_schema_unions_iterate(collection, metadata, &featureProgrammer_schemaUnionVisit{
|
|
955
|
-
Schemas: visited,
|
|
956
|
-
Objects: map[*nativemetadata.MetadataObjectType]bool{},
|
|
957
|
-
})
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
func featureProgrammer_register_schema_unions_iterate(collection *nativemetadata.MetadataCollection, metadata *nativemetadata.MetadataSchema, visited *featureProgrammer_schemaUnionVisit) {
|
|
961
|
-
if collection == nil || metadata == nil || visited.Schemas[metadata] {
|
|
962
|
-
return
|
|
963
|
-
}
|
|
964
|
-
visited.Schemas[metadata] = true
|
|
965
|
-
|
|
966
|
-
if len(metadata.Objects) > 1 {
|
|
967
|
-
index := collection.GetUnionIndex(metadata)
|
|
968
|
-
metadata.Union_index = &index
|
|
969
|
-
}
|
|
970
|
-
if metadata.Escaped != nil {
|
|
971
|
-
featureProgrammer_register_schema_unions_iterate(collection, metadata.Escaped.Returns, visited)
|
|
972
|
-
}
|
|
973
|
-
if metadata.Rest != nil {
|
|
974
|
-
featureProgrammer_register_schema_unions_iterate(collection, metadata.Rest, visited)
|
|
975
|
-
}
|
|
976
|
-
for _, alias := range metadata.Aliases {
|
|
977
|
-
if alias.Type != nil {
|
|
978
|
-
featureProgrammer_register_schema_unions_iterate(collection, alias.Type.Value, visited)
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
for _, array := range metadata.Arrays {
|
|
982
|
-
if array.Type != nil {
|
|
983
|
-
featureProgrammer_register_schema_unions_iterate(collection, array.Type.Value, visited)
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
for _, tuple := range metadata.Tuples {
|
|
987
|
-
if tuple.Type != nil {
|
|
988
|
-
for _, element := range tuple.Type.Elements {
|
|
989
|
-
featureProgrammer_register_schema_unions_iterate(collection, element, visited)
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
for _, object := range metadata.Objects {
|
|
994
|
-
if object.Type != nil && visited.Objects[object.Type] == false {
|
|
995
|
-
visited.Objects[object.Type] = true
|
|
996
|
-
for _, property := range object.Type.Properties {
|
|
997
|
-
featureProgrammer_register_schema_unions_iterate(collection, property.Value, visited)
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
for _, set := range metadata.Sets {
|
|
1002
|
-
featureProgrammer_register_schema_unions_iterate(collection, set.Value, visited)
|
|
1003
|
-
}
|
|
1004
|
-
for _, item := range metadata.Maps {
|
|
1005
|
-
featureProgrammer_register_schema_unions_iterate(collection, item.Key, visited)
|
|
1006
|
-
featureProgrammer_register_schema_unions_iterate(collection, item.Value, visited)
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
func featureProgrammer_write_object_functions(config FeatureProgrammer_IConfig, context nativecontext.ITypiaContext, functor *nativehelpers.FunctionProgrammer, collection *nativemetadata.MetadataCollection) []*shimast.Node {
|
|
1011
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, context.Emit)
|
|
1012
|
-
objects := collection.Objects()
|
|
1013
|
-
propertyFrequencies := featureProgrammer_object_property_frequencies(config, context, functor, objects)
|
|
1014
|
-
output := make([]*shimast.Node, 0, len(objects))
|
|
1015
|
-
for _, object := range objects {
|
|
1016
|
-
input := f.NewIdentifier("input")
|
|
1017
|
-
objectType := config.Objector.Type
|
|
1018
|
-
if objectType == nil {
|
|
1019
|
-
objectType = nativefactories.TypeFactory.Keyword("any", context.Emit)
|
|
1020
|
-
}
|
|
1021
|
-
entriesObject := object
|
|
1022
|
-
if config.ObjectParents && len(object.Parent_objects_) != 0 {
|
|
1023
|
-
entriesObject = &nativemetadata.MetadataObjectType{
|
|
1024
|
-
Name: object.Name,
|
|
1025
|
-
DisplayName: object.DisplayName,
|
|
1026
|
-
Properties: object.CheckProperties(),
|
|
1027
|
-
Description: object.Description,
|
|
1028
|
-
JsDocTags: object.JsDocTags,
|
|
1029
|
-
Index: object.Index,
|
|
1030
|
-
Validated: object.Validated,
|
|
1031
|
-
Recursive: object.Recursive,
|
|
1032
|
-
Nullables: object.Nullables,
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
helperAllProperties := config.ObjectParents && functor != nil && len(entriesObject.Properties) >= 16
|
|
1036
|
-
body := config.Objector.Joiner(FeatureProgrammer_ObjectorJoinerProps{
|
|
1037
|
-
Input: input,
|
|
1038
|
-
Entries: nativeiterate.Feature_object_entries(nativeiterate.Feature_object_entriesProps{
|
|
1039
|
-
Config: nativeiterate.Feature_object_entriesConfig{
|
|
1040
|
-
Path: config.Path,
|
|
1041
|
-
Trace: config.Trace,
|
|
1042
|
-
Decoder: func(next nativeiterate.Feature_object_entriesDecoderProps) *shimast.Node {
|
|
1043
|
-
if key := featureProgrammer_object_property_helper_key(context, next.Property, next.Metadata); key != "" && (propertyFrequencies[key] > 1 || helperAllProperties) {
|
|
1044
|
-
return featureProgrammer_object_property_helper_call(featureProgrammer_objectPropertyHelperProps{
|
|
1045
|
-
Config: config,
|
|
1046
|
-
Context: context,
|
|
1047
|
-
Functor: functor,
|
|
1048
|
-
Input: input,
|
|
1049
|
-
ReturnType: objectType,
|
|
1050
|
-
Next: next,
|
|
1051
|
-
Key: key,
|
|
1052
|
-
})
|
|
1053
|
-
}
|
|
1054
|
-
return config.Decoder(FeatureProgrammer_DecoderProps{
|
|
1055
|
-
Input: next.Input,
|
|
1056
|
-
Metadata: next.Metadata,
|
|
1057
|
-
Explore: featureProgrammer_from_iterate_explore(next.Explore),
|
|
1058
|
-
})
|
|
1059
|
-
},
|
|
1060
|
-
},
|
|
1061
|
-
Context: context,
|
|
1062
|
-
Input: input,
|
|
1063
|
-
Object: entriesObject,
|
|
1064
|
-
}),
|
|
1065
|
-
Object: object,
|
|
1066
|
-
})
|
|
1067
|
-
if config.ObjectParents && len(object.Parent_objects_) != 0 {
|
|
1068
|
-
expressions := make([]*shimast.Node, 0, len(object.Parent_objects_)+1)
|
|
1069
|
-
explore := FeatureProgrammer_IExplore{
|
|
1070
|
-
Tracable: config.Path || config.Trace,
|
|
1071
|
-
Source: "function",
|
|
1072
|
-
From: "object",
|
|
1073
|
-
Postfix: "",
|
|
1074
|
-
}
|
|
1075
|
-
for _, parent := range object.Parent_objects_ {
|
|
1076
|
-
expressions = append(expressions, config.Objector.Decoder(FeatureProgrammer_ObjectorDecoderProps{
|
|
1077
|
-
Input: input,
|
|
1078
|
-
Object: parent.Type,
|
|
1079
|
-
Explore: explore,
|
|
1080
|
-
}))
|
|
1081
|
-
}
|
|
1082
|
-
expressions = append(expressions, body)
|
|
1083
|
-
body = checkerProgrammer_reduce(expressions, shimast.KindAmpersandAmpersandToken, f.NewKeywordExpression(shimast.KindTrueKeyword), context.Emit)
|
|
1084
|
-
}
|
|
1085
|
-
if object.Recursive && config.VisitGuard != nil && featureProgrammer_visited(config) {
|
|
1086
|
-
body = config.VisitGuard(FeatureProgrammer_VisitGuardProps{
|
|
1087
|
-
Key: FeatureProgrammer.VisitKey(config.Prefix, "o", object.Index),
|
|
1088
|
-
Input: input,
|
|
1089
|
-
Body: body,
|
|
1090
|
-
Object: object,
|
|
1091
|
-
})
|
|
1092
|
-
}
|
|
1093
|
-
output = append(output, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
1094
|
-
Name: fmt.Sprintf("%so%d", config.Prefix, object.Index),
|
|
1095
|
-
Value: f.NewArrowFunction(
|
|
1096
|
-
nil,
|
|
1097
|
-
nil,
|
|
1098
|
-
f.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
1099
|
-
Config: FeatureProgrammer_ParameterConfig{Path: config.Path, Trace: config.Trace, Visited: featureProgrammer_visited(config)},
|
|
1100
|
-
Type: nativefactories.TypeFactory.Keyword("any"),
|
|
1101
|
-
Input: nativefactories.ValueFactory.INPUT(context.Emit),
|
|
1102
|
-
Emit: context.Emit,
|
|
1103
|
-
})),
|
|
1104
|
-
objectType,
|
|
1105
|
-
nil,
|
|
1106
|
-
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
1107
|
-
body,
|
|
1108
|
-
),
|
|
1109
|
-
}, context.Emit))
|
|
1110
|
-
}
|
|
1111
|
-
return output
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
type featureProgrammer_objectPropertyHelperProps struct {
|
|
1115
|
-
Config FeatureProgrammer_IConfig
|
|
1116
|
-
Context nativecontext.ITypiaContext
|
|
1117
|
-
Functor *nativehelpers.FunctionProgrammer
|
|
1118
|
-
Input *shimast.Expression
|
|
1119
|
-
ReturnType *shimast.TypeNode
|
|
1120
|
-
Next nativeiterate.Feature_object_entriesDecoderProps
|
|
1121
|
-
Key string
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
func featureProgrammer_object_property_frequencies(
|
|
1125
|
-
config FeatureProgrammer_IConfig,
|
|
1126
|
-
context nativecontext.ITypiaContext,
|
|
1127
|
-
functor *nativehelpers.FunctionProgrammer,
|
|
1128
|
-
objects []*nativemetadata.MetadataObjectType,
|
|
1129
|
-
) map[string]int {
|
|
1130
|
-
output := map[string]int{}
|
|
1131
|
-
if config.ObjectParents == false || functor == nil {
|
|
1132
|
-
return output
|
|
1133
|
-
}
|
|
1134
|
-
for _, object := range objects {
|
|
1135
|
-
for _, property := range object.CheckProperties() {
|
|
1136
|
-
if property == nil || property.Key == nil || property.Value == nil {
|
|
1137
|
-
continue
|
|
1138
|
-
}
|
|
1139
|
-
metadata := property.Value
|
|
1140
|
-
if property.Key.GetSoleLiteral() != nil && nativehelpers.OptionPredicator.StrictOptionalUndefined(context, property.Value) {
|
|
1141
|
-
metadata = property.Value.ShallowClone()
|
|
1142
|
-
metadata.Optional = false
|
|
1143
|
-
}
|
|
1144
|
-
key := featureProgrammer_object_property_helper_key(context, property, metadata)
|
|
1145
|
-
if key != "" {
|
|
1146
|
-
output[key]++
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
return output
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
func featureProgrammer_object_property_helper_key(
|
|
1154
|
-
context nativecontext.ITypiaContext,
|
|
1155
|
-
property *nativemetadata.MetadataProperty,
|
|
1156
|
-
metadata *nativemetadata.MetadataSchema,
|
|
1157
|
-
) string {
|
|
1158
|
-
if property == nil || property.Key == nil || metadata == nil {
|
|
1159
|
-
return ""
|
|
1160
|
-
}
|
|
1161
|
-
key := property.Key.GetSoleLiteral()
|
|
1162
|
-
if key == nil {
|
|
1163
|
-
return ""
|
|
1164
|
-
}
|
|
1165
|
-
return *key + "\x00" +
|
|
1166
|
-
property.Key.GetName() + "\x00" +
|
|
1167
|
-
metadata.GetName() + "\x00" +
|
|
1168
|
-
fmt.Sprintf("%t\x00%t\x00%t", metadata.Optional, metadata.Nullable, nativehelpers.OptionPredicator.Numeric(context.Options))
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
func featureProgrammer_object_property_helper_call(props featureProgrammer_objectPropertyHelperProps) *shimast.Node {
|
|
1172
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Context.Emit)
|
|
1173
|
-
helper := props.Functor.EmplaceVariableByKey(props.Config.Prefix+"p", props.Key, func(string) *shimast.Expression {
|
|
1174
|
-
input := nativefactories.ValueFactory.INPUT(props.Context.Emit)
|
|
1175
|
-
propertyInput := featureProgrammer_object_property_input(input, props.Next.Key, props.Context.Emit)
|
|
1176
|
-
body := props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
1177
|
-
Input: propertyInput,
|
|
1178
|
-
Metadata: props.Next.Metadata,
|
|
1179
|
-
Explore: featureProgrammer_from_iterate_explore(props.Next.Explore),
|
|
1180
|
-
})
|
|
1181
|
-
return f.NewArrowFunction(
|
|
1182
|
-
nil,
|
|
1183
|
-
nil,
|
|
1184
|
-
f.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
1185
|
-
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
1186
|
-
Type: nativefactories.TypeFactory.Keyword("any"),
|
|
1187
|
-
Input: input,
|
|
1188
|
-
Emit: props.Context.Emit,
|
|
1189
|
-
})),
|
|
1190
|
-
props.ReturnType,
|
|
1191
|
-
nil,
|
|
1192
|
-
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
1193
|
-
body,
|
|
1194
|
-
)
|
|
1195
|
-
})
|
|
1196
|
-
return f.NewCallExpression(
|
|
1197
|
-
helper,
|
|
1198
|
-
nil,
|
|
1199
|
-
nil,
|
|
1200
|
-
f.NewNodeList(FeatureProgrammer.ArgumentsArray(FeatureProgrammer_ArgumentsArrayProps{
|
|
1201
|
-
Config: FeatureProgrammer_ArgumentsArrayConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
1202
|
-
Input: props.Input,
|
|
1203
|
-
Explore: FeatureProgrammer_IExplore{
|
|
1204
|
-
Tracable: props.Config.Path || props.Config.Trace,
|
|
1205
|
-
Source: "function",
|
|
1206
|
-
From: "object",
|
|
1207
|
-
Postfix: "",
|
|
1208
|
-
},
|
|
1209
|
-
Emit: props.Context.Emit,
|
|
1210
|
-
})),
|
|
1211
|
-
shimast.NodeFlagsNone,
|
|
1212
|
-
)
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
func featureProgrammer_object_property_input(input *shimast.Expression, key *string, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
1216
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit...)
|
|
1217
|
-
if key == nil {
|
|
1218
|
-
return f.NewIdentifier("value")
|
|
1219
|
-
}
|
|
1220
|
-
return f.NewElementAccessExpression(
|
|
1221
|
-
input,
|
|
1222
|
-
nil,
|
|
1223
|
-
f.NewStringLiteral(*key, shimast.TokenFlagsNone),
|
|
1224
|
-
shimast.NodeFlagsNone,
|
|
1225
|
-
)
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
func featureProgrammer_write_union_functions(config FeatureProgrammer_IConfig, collection *nativemetadata.MetadataCollection, emit *shimprinter.EmitContext) []*shimast.Node {
|
|
1229
|
-
unions := collection.Unions()
|
|
1230
|
-
output := make([]*shimast.Node, 0, len(unions))
|
|
1231
|
-
for i, union := range unions {
|
|
1232
|
-
output = append(output, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
1233
|
-
Name: fmt.Sprintf("%su%d", config.Prefix, i),
|
|
1234
|
-
Value: featureProgrammer_write_union(struct {
|
|
1235
|
-
Config FeatureProgrammer_IConfig
|
|
1236
|
-
Objects []*nativemetadata.MetadataObjectType
|
|
1237
|
-
}{Config: config, Objects: union}, emit),
|
|
1238
|
-
}))
|
|
1239
|
-
}
|
|
1240
|
-
return output
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
func featureProgrammer_write_union(props struct {
|
|
1244
|
-
Config FeatureProgrammer_IConfig
|
|
1245
|
-
Objects []*nativemetadata.MetadataObjectType
|
|
1246
|
-
}, emit *shimprinter.EmitContext) *shimast.Node {
|
|
1247
|
-
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
1248
|
-
return f.NewArrowFunction(
|
|
1249
|
-
nil,
|
|
1250
|
-
nil,
|
|
1251
|
-
f.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
1252
|
-
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
1253
|
-
Type: nativefactories.TypeFactory.Keyword("any"),
|
|
1254
|
-
Input: nativefactories.ValueFactory.INPUT(nil),
|
|
1255
|
-
Emit: emit,
|
|
1256
|
-
})),
|
|
1257
|
-
nativefactories.TypeFactory.Keyword("any"),
|
|
1258
|
-
nil,
|
|
1259
|
-
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
1260
|
-
nativehelpers.UnionExplorer.Object(nativehelpers.UnionExplorer_ObjectProps{
|
|
1261
|
-
Config: nativehelpers.UnionExplorer_ObjectConfig{
|
|
1262
|
-
Objector: featureProgrammer_union_objector(props.Config.Objector),
|
|
1263
|
-
},
|
|
1264
|
-
Objects: props.Objects,
|
|
1265
|
-
Input: nativefactories.ValueFactory.INPUT(nil),
|
|
1266
|
-
Explore: FeatureProgrammer_IExplore{
|
|
1267
|
-
Tracable: props.Config.Path || props.Config.Trace,
|
|
1268
|
-
Source: "function",
|
|
1269
|
-
From: "object",
|
|
1270
|
-
Postfix: "",
|
|
1271
|
-
},
|
|
1272
|
-
Emit: emit,
|
|
1273
|
-
}),
|
|
1274
|
-
)
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
func featureProgrammer_union_objector(objector FeatureProgrammer_IConfig_IObjector) nativehelpers.UnionExplorer_IObjector {
|
|
1278
|
-
return nativehelpers.UnionExplorer_IObjector{
|
|
1279
|
-
Checker: func(props nativehelpers.UnionExplorer_ObjectorCheckerProps) *shimast.Node {
|
|
1280
|
-
return objector.Checker(FeatureProgrammer_ObjectorCheckerProps{
|
|
1281
|
-
Metadata: props.Metadata,
|
|
1282
|
-
Input: props.Input,
|
|
1283
|
-
Explore: featureProgrammer_as_explore(props.Explore),
|
|
1284
|
-
})
|
|
1285
|
-
},
|
|
1286
|
-
Decoder: func(props nativehelpers.UnionExplorer_ObjectorDecoderProps) *shimast.Node {
|
|
1287
|
-
return objector.Decoder(FeatureProgrammer_ObjectorDecoderProps{
|
|
1288
|
-
Input: props.Input,
|
|
1289
|
-
Object: props.Object,
|
|
1290
|
-
Explore: featureProgrammer_as_explore(props.Explore),
|
|
1291
|
-
})
|
|
1292
|
-
},
|
|
1293
|
-
Unionizer: func(props nativehelpers.UnionExplorer_ObjectorUnionizerProps) *shimast.Node {
|
|
1294
|
-
return objector.Unionizer(FeatureProgrammer_ObjectorUnionizerProps{
|
|
1295
|
-
Objects: props.Objects,
|
|
1296
|
-
Input: props.Input,
|
|
1297
|
-
Explore: featureProgrammer_as_explore(props.Explore),
|
|
1298
|
-
})
|
|
1299
|
-
},
|
|
1300
|
-
Failure: func(props nativehelpers.UnionExplorer_ObjectorFailureProps) *shimast.Node {
|
|
1301
|
-
explore := featureProgrammer_as_explore(props.Explore)
|
|
1302
|
-
return objector.Failure(FeatureProgrammer_ObjectorFailureProps{
|
|
1303
|
-
Input: props.Input,
|
|
1304
|
-
Expected: props.Expected,
|
|
1305
|
-
Explore: &explore,
|
|
1306
|
-
})
|
|
1307
|
-
},
|
|
1308
|
-
Is: objector.Is,
|
|
1309
|
-
Required: objector.Required,
|
|
1310
|
-
Full: func(props nativehelpers.UnionExplorer_ObjectorFullProps) *shimast.Node {
|
|
1311
|
-
if objector.Full == nil {
|
|
1312
|
-
return props.Condition
|
|
1313
|
-
}
|
|
1314
|
-
return objector.Full(FeatureProgrammer_ObjectorFullProps{
|
|
1315
|
-
Condition: props.Condition,
|
|
1316
|
-
Input: props.Input,
|
|
1317
|
-
Expected: props.Expected,
|
|
1318
|
-
Explore: featureProgrammer_as_explore(props.Explore),
|
|
1319
|
-
})
|
|
1320
|
-
},
|
|
1321
|
-
Type: objector.Type,
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
func featureProgrammer_from_iterate_explore(input nativeiterate.Feature_object_entriesExplore) FeatureProgrammer_IExplore {
|
|
1326
|
-
return FeatureProgrammer_IExplore{
|
|
1327
|
-
Tracable: input.Tracable,
|
|
1328
|
-
Source: input.Source,
|
|
1329
|
-
From: input.From,
|
|
1330
|
-
Postfix: input.Postfix,
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
func featureProgrammer_as_explore(input any) FeatureProgrammer_IExplore {
|
|
1335
|
-
switch value := input.(type) {
|
|
1336
|
-
case FeatureProgrammer_IExplore:
|
|
1337
|
-
return value
|
|
1338
|
-
case *FeatureProgrammer_IExplore:
|
|
1339
|
-
return *value
|
|
1340
|
-
case map[string]any:
|
|
1341
|
-
output := FeatureProgrammer_IExplore{}
|
|
1342
|
-
if v, ok := value["tracable"].(bool); ok {
|
|
1343
|
-
output.Tracable = v
|
|
1344
|
-
}
|
|
1345
|
-
if v, ok := value["source"].(string); ok {
|
|
1346
|
-
output.Source = v
|
|
1347
|
-
}
|
|
1348
|
-
if v, ok := value["from"].(string); ok {
|
|
1349
|
-
output.From = v
|
|
1350
|
-
}
|
|
1351
|
-
if v, ok := value["postfix"].(string); ok {
|
|
1352
|
-
output.Postfix = v
|
|
1353
|
-
}
|
|
1354
|
-
if v, ok := value["start"].(int); ok {
|
|
1355
|
-
output.Start = &v
|
|
1356
|
-
}
|
|
1357
|
-
return output
|
|
1358
|
-
default:
|
|
1359
|
-
return FeatureProgrammer_IExplore{}
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1
|
+
package internal
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
"sort"
|
|
6
|
+
"strings"
|
|
7
|
+
|
|
8
|
+
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
9
|
+
shimchecker "github.com/microsoft/typescript-go/shim/checker"
|
|
10
|
+
shimprinter "github.com/microsoft/typescript-go/shim/printer"
|
|
11
|
+
nativecontext "github.com/samchon/typia/packages/typia/native/core/context"
|
|
12
|
+
nativefactories "github.com/samchon/typia/packages/typia/native/core/factories"
|
|
13
|
+
nativehelpers "github.com/samchon/typia/packages/typia/native/core/programmers/helpers"
|
|
14
|
+
nativeiterate "github.com/samchon/typia/packages/typia/native/core/programmers/iterate"
|
|
15
|
+
nativemetadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
type featureProgrammerNamespace struct{}
|
|
19
|
+
|
|
20
|
+
var FeatureProgrammer = featureProgrammerNamespace{}
|
|
21
|
+
|
|
22
|
+
type FeatureProgrammer_IConfig struct {
|
|
23
|
+
Types FeatureProgrammer_IConfig_ITypes
|
|
24
|
+
Prefix string
|
|
25
|
+
Path bool
|
|
26
|
+
Trace bool
|
|
27
|
+
Addition func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
28
|
+
Initializer func(props FeatureProgrammer_InitializerProps) FeatureProgrammer_InitializerOutput
|
|
29
|
+
Decoder func(props FeatureProgrammer_DecoderProps) *shimast.Node
|
|
30
|
+
Objector FeatureProgrammer_IConfig_IObjector
|
|
31
|
+
Generator FeatureProgrammer_IConfig_IGenerator
|
|
32
|
+
ObjectParents bool
|
|
33
|
+
// Visited reports whether the analyzed type graph carries a recursive
|
|
34
|
+
// component (issue #1820). It is a closure (usually the functor's Visited
|
|
35
|
+
// method) because the answer is unknown until metadata analysis runs,
|
|
36
|
+
// which happens after the config is constructed. When true, generated
|
|
37
|
+
// functions thread a per-invocation `_vctx` visit context.
|
|
38
|
+
Visited func() bool
|
|
39
|
+
// VisitGuard wraps a recursive function's body with the feature's own
|
|
40
|
+
// cycle handling (e.g. checkers report a revisited object as valid). Nil
|
|
41
|
+
// keeps the body untouched even when Visited is on.
|
|
42
|
+
VisitGuard func(props FeatureProgrammer_VisitGuardProps) *shimast.Node
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type FeatureProgrammer_VisitGuardProps struct {
|
|
46
|
+
// Key names the `_vctx` slot of the guarded function (e.g. "o3" for the
|
|
47
|
+
// object function of index 3), so each recursive function tracks its own
|
|
48
|
+
// visit set and union-branch probing cannot pollute sibling checks.
|
|
49
|
+
Key string
|
|
50
|
+
Input *shimast.Expression
|
|
51
|
+
Body *shimast.Node
|
|
52
|
+
// Object is the recursive object being guarded, so a feature's VisitGuard can
|
|
53
|
+
// choose a prototype-bearing allocator (classify: Object.create(Name.prototype)
|
|
54
|
+
// for a named class, matching ClassifyJoiner.Object). nil keeps the legacy
|
|
55
|
+
// plain-container ({}/[]) behavior used by clone, notation, and the rest.
|
|
56
|
+
Object *nativemetadata.MetadataObjectType
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type FeatureProgrammer_IConfig_ITypes struct {
|
|
60
|
+
Input func(t *shimchecker.Type, name *string) *shimast.TypeNode
|
|
61
|
+
Output func(t *shimchecker.Type, name *string) *shimast.TypeNode
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type FeatureProgrammer_IConfig_IObjector struct {
|
|
65
|
+
Checker func(props FeatureProgrammer_ObjectorCheckerProps) *shimast.Node
|
|
66
|
+
Decoder func(props FeatureProgrammer_ObjectorDecoderProps) *shimast.Node
|
|
67
|
+
Joiner func(props FeatureProgrammer_ObjectorJoinerProps) *shimast.Node
|
|
68
|
+
Unionizer func(props FeatureProgrammer_ObjectorUnionizerProps) *shimast.Node
|
|
69
|
+
Failure func(props FeatureProgrammer_ObjectorFailureProps) *shimast.Node
|
|
70
|
+
Is func(exp *shimast.Expression) *shimast.Node
|
|
71
|
+
Required func(exp *shimast.Expression) *shimast.Node
|
|
72
|
+
Full func(props FeatureProgrammer_ObjectorFullProps) *shimast.Node
|
|
73
|
+
Type *shimast.TypeNode
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type FeatureProgrammer_IConfig_IGenerator struct {
|
|
77
|
+
Objects func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
78
|
+
Unions func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
79
|
+
Arrays func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
80
|
+
Tuples func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type FeatureProgrammer_IExplore = nativehelpers.UnionExplorer_IExplore
|
|
84
|
+
|
|
85
|
+
type FeatureProgrammer_InitializerProps struct {
|
|
86
|
+
Context nativecontext.ITypiaContext
|
|
87
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
88
|
+
Type *shimchecker.Type
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type FeatureProgrammer_InitializerOutput struct {
|
|
92
|
+
Collection *nativemetadata.MetadataCollection
|
|
93
|
+
Metadata *nativemetadata.MetadataSchema
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type FeatureProgrammer_DecoderProps struct {
|
|
97
|
+
Metadata *nativemetadata.MetadataSchema
|
|
98
|
+
Input *shimast.Expression
|
|
99
|
+
Explore FeatureProgrammer_IExplore
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type FeatureProgrammer_ObjectorCheckerProps struct {
|
|
103
|
+
Metadata *nativemetadata.MetadataSchema
|
|
104
|
+
Input *shimast.Expression
|
|
105
|
+
Explore FeatureProgrammer_IExplore
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
type FeatureProgrammer_ObjectorDecoderProps struct {
|
|
109
|
+
Input *shimast.Expression
|
|
110
|
+
Object *nativemetadata.MetadataObjectType
|
|
111
|
+
Explore FeatureProgrammer_IExplore
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type FeatureProgrammer_ObjectorJoinerProps struct {
|
|
115
|
+
Entries []nativehelpers.IExpressionEntry
|
|
116
|
+
Input *shimast.Expression
|
|
117
|
+
Object *nativemetadata.MetadataObjectType
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
type FeatureProgrammer_ObjectorUnionizerProps struct {
|
|
121
|
+
Objects []*nativemetadata.MetadataObjectType
|
|
122
|
+
Input *shimast.Expression
|
|
123
|
+
Explore FeatureProgrammer_IExplore
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
type FeatureProgrammer_ObjectorFailureProps struct {
|
|
127
|
+
Input *shimast.Expression
|
|
128
|
+
Expected string
|
|
129
|
+
Explore *FeatureProgrammer_IExplore
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
type FeatureProgrammer_ObjectorFullProps struct {
|
|
133
|
+
Condition *shimast.Expression
|
|
134
|
+
Input *shimast.Expression
|
|
135
|
+
Expected string
|
|
136
|
+
Explore FeatureProgrammer_IExplore
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
type FeatureProgrammer_Decoder[T any] func(props struct {
|
|
140
|
+
Input *shimast.Expression
|
|
141
|
+
Definition T
|
|
142
|
+
Explore FeatureProgrammer_IExplore
|
|
143
|
+
}) *shimast.Node
|
|
144
|
+
|
|
145
|
+
type FeatureProgrammer_IComposed struct {
|
|
146
|
+
Body *shimast.Node
|
|
147
|
+
Parameters []*shimast.Node
|
|
148
|
+
Functions map[string]*shimast.Node
|
|
149
|
+
Statements []*shimast.Node
|
|
150
|
+
Response *shimast.TypeNode
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type FeatureProgrammer_IDecomposed struct {
|
|
154
|
+
Functions map[string]*shimast.Node
|
|
155
|
+
Statements []*shimast.Node
|
|
156
|
+
Arrow *shimast.Node
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
type FeatureProgrammer_ComposeProps struct {
|
|
160
|
+
Context nativecontext.ITypiaContext
|
|
161
|
+
Config FeatureProgrammer_IConfig
|
|
162
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
163
|
+
Type *shimchecker.Type
|
|
164
|
+
Name *string
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type FeatureProgrammer_WriteDecomposedProps struct {
|
|
168
|
+
Modulo *shimast.Expression
|
|
169
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
170
|
+
Result FeatureProgrammer_IDecomposed
|
|
171
|
+
ReturnWrapper func(arrow *shimast.Node) *shimast.Node
|
|
172
|
+
Emit *shimprinter.EmitContext
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
type FeatureProgrammer_WriteProps struct {
|
|
176
|
+
Context nativecontext.ITypiaContext
|
|
177
|
+
Config FeatureProgrammer_IConfig
|
|
178
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
179
|
+
Type *shimchecker.Type
|
|
180
|
+
Name *string
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
type FeatureProgrammer_WriteObjectFunctionsProps struct {
|
|
184
|
+
Config FeatureProgrammer_IConfig
|
|
185
|
+
Context nativecontext.ITypiaContext
|
|
186
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
187
|
+
Collection *nativemetadata.MetadataCollection
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
type FeatureProgrammer_WriteUnionFunctionsProps struct {
|
|
191
|
+
Config FeatureProgrammer_IConfig
|
|
192
|
+
Collection *nativemetadata.MetadataCollection
|
|
193
|
+
Emit *shimprinter.EmitContext
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
type FeatureProgrammer_DecodeArrayConfig struct {
|
|
197
|
+
Trace bool
|
|
198
|
+
Path bool
|
|
199
|
+
Decoder func(props FeatureProgrammer_DecoderProps) *shimast.Node
|
|
200
|
+
Prefix string
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
type FeatureProgrammer_DecodeArrayProps struct {
|
|
204
|
+
Config FeatureProgrammer_DecodeArrayConfig
|
|
205
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
206
|
+
Combiner func(next struct {
|
|
207
|
+
Input *shimast.Expression
|
|
208
|
+
Arrow *shimast.Node
|
|
209
|
+
}) *shimast.Node
|
|
210
|
+
Array *nativemetadata.MetadataArray
|
|
211
|
+
Input *shimast.Expression
|
|
212
|
+
Explore FeatureProgrammer_IExplore
|
|
213
|
+
Emit *shimprinter.EmitContext
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
type FeatureProgrammer_DecodeObjectConfig struct {
|
|
217
|
+
Trace bool
|
|
218
|
+
Path bool
|
|
219
|
+
Prefix string
|
|
220
|
+
// Visited threads the per-invocation `_vctx` argument to the called object
|
|
221
|
+
// function. It must come from the calling feature's own config — not from
|
|
222
|
+
// the (possibly shared) functor — so a visit-tracking feature composed with
|
|
223
|
+
// a non-tracking one (e.g. assert + clone) cannot leak the argument into
|
|
224
|
+
// functions that do not declare it.
|
|
225
|
+
Visited bool
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
type FeatureProgrammer_DecodeObjectProps struct {
|
|
229
|
+
Config FeatureProgrammer_DecodeObjectConfig
|
|
230
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
231
|
+
Object *nativemetadata.MetadataObjectType
|
|
232
|
+
Input *shimast.Expression
|
|
233
|
+
Explore FeatureProgrammer_IExplore
|
|
234
|
+
Emit *shimprinter.EmitContext
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
type FeatureProgrammer_IndexProps struct {
|
|
238
|
+
Start *int
|
|
239
|
+
Postfix string
|
|
240
|
+
Rand string
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
type FeatureProgrammer_ArgumentsArrayProps struct {
|
|
244
|
+
Config FeatureProgrammer_ArgumentsArrayConfig
|
|
245
|
+
Input *shimast.Expression
|
|
246
|
+
Explore FeatureProgrammer_IExplore
|
|
247
|
+
Emit *shimprinter.EmitContext
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
type FeatureProgrammer_ArgumentsArrayConfig struct {
|
|
251
|
+
Path bool
|
|
252
|
+
Trace bool
|
|
253
|
+
Visited bool
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
type FeatureProgrammer_ParameterDeclarationsProps struct {
|
|
257
|
+
Config FeatureProgrammer_ParameterConfig
|
|
258
|
+
Type *shimast.TypeNode
|
|
259
|
+
Input *shimast.Node
|
|
260
|
+
Emit *shimprinter.EmitContext
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
type FeatureProgrammer_ParameterConfig struct {
|
|
264
|
+
Path bool
|
|
265
|
+
Trace bool
|
|
266
|
+
Visited bool
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// featureProgrammer_visited resolves the late-bound recursion flag; the
|
|
270
|
+
// closure is nil for features that do not participate in visit tracking.
|
|
271
|
+
func featureProgrammer_visited(config FeatureProgrammer_IConfig) bool {
|
|
272
|
+
return config.Visited != nil && config.Visited()
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// VisitKey names a recursive function's `_vctx` slot after the function
|
|
276
|
+
// itself (its prefixed name minus the leading underscore, e.g. "io0", "co2").
|
|
277
|
+
// Composed features share one context object — clone embeds is-checks for
|
|
278
|
+
// union discrimination, for instance — so the slot must carry the feature
|
|
279
|
+
// prefix or two families would clash on the same key with different
|
|
280
|
+
// container kinds.
|
|
281
|
+
func (featureProgrammerNamespace) VisitKey(prefix string, kind string, index int) string {
|
|
282
|
+
return strings.TrimPrefix(fmt.Sprintf("%s%s%d", prefix, kind, index), "_")
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// CollectionRecursive reports whether the analyzed type graph carries any
|
|
286
|
+
// recursive component — the precondition for a runtime value to drive the
|
|
287
|
+
// generated function call graph into a cycle (issue #1820).
|
|
288
|
+
func (featureProgrammerNamespace) CollectionRecursive(collection *nativemetadata.MetadataCollection) bool {
|
|
289
|
+
for _, object := range collection.Objects() {
|
|
290
|
+
if object.Recursive {
|
|
291
|
+
return true
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
for _, array := range collection.Arrays() {
|
|
295
|
+
if array.Recursive {
|
|
296
|
+
return true
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
for _, tuple := range collection.Tuples() {
|
|
300
|
+
if tuple.Recursive {
|
|
301
|
+
return true
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return false
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// VisitGuardSkip wraps a recursive in-place walker (prune) so a revisited
|
|
308
|
+
// object is simply skipped: pruning is idempotent per instance, which makes
|
|
309
|
+
// the skip both the cycle breaker and the DAG deduplication. Handles the
|
|
310
|
+
// block bodies the prune joiner produces as well as expression bodies.
|
|
311
|
+
func (featureProgrammerNamespace) VisitGuardSkip(key string, body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
312
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
313
|
+
slot := "_vctx." + key
|
|
314
|
+
has := f.NewIdentifier("(" + slot + " || (" + slot + " = new WeakSet())).has(input)")
|
|
315
|
+
add := f.NewIdentifier(slot + ".add(input)")
|
|
316
|
+
if body != nil && body.Kind == shimast.KindBlock {
|
|
317
|
+
statements := []*shimast.Node{
|
|
318
|
+
f.NewIfStatement(has, f.NewReturnStatement(nil), nil),
|
|
319
|
+
f.NewExpressionStatement(add),
|
|
320
|
+
}
|
|
321
|
+
statements = append(statements, body.Statements()...)
|
|
322
|
+
return f.NewBlock(f.NewNodeList(statements), true)
|
|
323
|
+
}
|
|
324
|
+
return nativefactories.ExpressionFactory.Conditional(
|
|
325
|
+
has,
|
|
326
|
+
f.NewIdentifier("undefined"),
|
|
327
|
+
f.NewParenthesizedExpression(
|
|
328
|
+
f.NewBinaryExpression(
|
|
329
|
+
nil,
|
|
330
|
+
add,
|
|
331
|
+
nil,
|
|
332
|
+
f.NewToken(shimast.KindCommaToken),
|
|
333
|
+
f.NewParenthesizedExpression(body),
|
|
334
|
+
),
|
|
335
|
+
),
|
|
336
|
+
emit,
|
|
337
|
+
)
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// VisitGuardSerialize wraps a recursive serializer function (json.stringify,
|
|
341
|
+
// protobuf.encode) with on-stack cycle detection: JSON and protobuf cannot
|
|
342
|
+
// represent cycles, so a value met again while still being serialized raises
|
|
343
|
+
// the feature's thrower instead of overflowing the stack. Unlike the checker
|
|
344
|
+
// and rebuilder guards the entry is removed after the body finishes either
|
|
345
|
+
// way, because re-serializing a DAG alias at another position is legal and
|
|
346
|
+
// must keep working.
|
|
347
|
+
func (featureProgrammerNamespace) VisitGuardSerialize(key string, thrower *shimast.Node, body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
348
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
349
|
+
slot := "_vctx." + key
|
|
350
|
+
bodyExpression := featureProgrammer_block_to_expression(body, emit)
|
|
351
|
+
finisher := f.NewArrowFunction(
|
|
352
|
+
nil,
|
|
353
|
+
nil,
|
|
354
|
+
f.NewNodeList([]*shimast.Node{
|
|
355
|
+
nativefactories.IdentifierFactory.Parameter("_vout", nativefactories.TypeFactory.Keyword("any"), nil),
|
|
356
|
+
}),
|
|
357
|
+
nil,
|
|
358
|
+
nil,
|
|
359
|
+
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
360
|
+
f.NewParenthesizedExpression(
|
|
361
|
+
f.NewBinaryExpression(
|
|
362
|
+
nil,
|
|
363
|
+
f.NewIdentifier(slot+".delete(input)"),
|
|
364
|
+
nil,
|
|
365
|
+
f.NewToken(shimast.KindCommaToken),
|
|
366
|
+
f.NewIdentifier("_vout"),
|
|
367
|
+
),
|
|
368
|
+
),
|
|
369
|
+
)
|
|
370
|
+
return nativefactories.ExpressionFactory.Conditional(
|
|
371
|
+
f.NewIdentifier("("+slot+" || ("+slot+" = new WeakSet())).has(input)"),
|
|
372
|
+
thrower,
|
|
373
|
+
f.NewParenthesizedExpression(
|
|
374
|
+
f.NewBinaryExpression(
|
|
375
|
+
nil,
|
|
376
|
+
f.NewIdentifier(slot+".add(input)"),
|
|
377
|
+
nil,
|
|
378
|
+
f.NewToken(shimast.KindCommaToken),
|
|
379
|
+
f.NewCallExpression(
|
|
380
|
+
f.NewParenthesizedExpression(finisher),
|
|
381
|
+
nil,
|
|
382
|
+
nil,
|
|
383
|
+
f.NewNodeList([]*shimast.Node{bodyExpression}),
|
|
384
|
+
shimast.NodeFlagsNone,
|
|
385
|
+
),
|
|
386
|
+
),
|
|
387
|
+
),
|
|
388
|
+
emit,
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// VisitGuardRebuild wraps a recursive rebuilder function (clone, notations)
|
|
393
|
+
// so a revisited source object returns the output instance allocated on its
|
|
394
|
+
// first visit — reproducing runtime cycles and deduplicating DAG aliases.
|
|
395
|
+
// The output container registers in the WeakMap BEFORE the body evaluates,
|
|
396
|
+
// so recursive references inside the body resolve to the same (still
|
|
397
|
+
// filling) instance, exactly like the structured-clone algorithm.
|
|
398
|
+
func (featureProgrammerNamespace) VisitGuardRebuild(key string, array bool, body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
399
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
400
|
+
allocator := f.NewObjectLiteralExpression(f.NewNodeList(nil), false)
|
|
401
|
+
if array {
|
|
402
|
+
allocator = f.NewArrayLiteralExpression(f.NewNodeList(nil), false)
|
|
403
|
+
}
|
|
404
|
+
return FeatureProgrammer.VisitGuardRebuildWith(key, allocator, body, emit)
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// VisitGuardRebuildWith is VisitGuardRebuild with a caller-supplied output
|
|
408
|
+
// container. clone/notation pass a plain {} (or [] for arrays); classify passes
|
|
409
|
+
// Object.create(<Class>.prototype) for a named class so the WeakMap-registered
|
|
410
|
+
// instance carries the right prototype — `x instanceof Class` then holds even on
|
|
411
|
+
// the recursive arm, where the joiner body's own (unregistered) instance is
|
|
412
|
+
// merged onto this allocator by Object.assign and discarded. The allocator
|
|
413
|
+
// registers in the WeakMap BEFORE the body evaluates, so a back-reference
|
|
414
|
+
// inside the body resolves to this same (still filling) instance.
|
|
415
|
+
func (featureProgrammerNamespace) VisitGuardRebuildWith(key string, allocator *shimast.Node, body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
416
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
417
|
+
slot := "_vctx." + key
|
|
418
|
+
bodyExpression := featureProgrammer_block_to_expression(body, emit)
|
|
419
|
+
filler := f.NewArrowFunction(
|
|
420
|
+
nil,
|
|
421
|
+
nil,
|
|
422
|
+
f.NewNodeList([]*shimast.Node{
|
|
423
|
+
nativefactories.IdentifierFactory.Parameter("_vout", nativefactories.TypeFactory.Keyword("any"), nil),
|
|
424
|
+
}),
|
|
425
|
+
nil,
|
|
426
|
+
nil,
|
|
427
|
+
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
428
|
+
f.NewParenthesizedExpression(
|
|
429
|
+
f.NewBinaryExpression(
|
|
430
|
+
nil,
|
|
431
|
+
f.NewIdentifier(slot+".set(input, _vout)"),
|
|
432
|
+
nil,
|
|
433
|
+
f.NewToken(shimast.KindCommaToken),
|
|
434
|
+
f.NewCallExpression(
|
|
435
|
+
f.NewIdentifier("Object.assign"),
|
|
436
|
+
nil,
|
|
437
|
+
nil,
|
|
438
|
+
f.NewNodeList([]*shimast.Node{
|
|
439
|
+
f.NewIdentifier("_vout"),
|
|
440
|
+
bodyExpression,
|
|
441
|
+
}),
|
|
442
|
+
shimast.NodeFlagsNone,
|
|
443
|
+
),
|
|
444
|
+
),
|
|
445
|
+
),
|
|
446
|
+
)
|
|
447
|
+
return nativefactories.ExpressionFactory.Conditional(
|
|
448
|
+
f.NewIdentifier("("+slot+" || ("+slot+" = new WeakMap())).has(input)"),
|
|
449
|
+
f.NewIdentifier(slot+".get(input)"),
|
|
450
|
+
f.NewCallExpression(
|
|
451
|
+
f.NewParenthesizedExpression(filler),
|
|
452
|
+
nil,
|
|
453
|
+
nil,
|
|
454
|
+
f.NewNodeList([]*shimast.Node{allocator}),
|
|
455
|
+
shimast.NodeFlagsNone,
|
|
456
|
+
),
|
|
457
|
+
emit,
|
|
458
|
+
)
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
func featureProgrammer_block_to_expression(body *shimast.Node, emit *shimprinter.EmitContext) *shimast.Node {
|
|
462
|
+
if body != nil && body.Kind == shimast.KindBlock {
|
|
463
|
+
return nativefactories.ExpressionFactory.SelfCall(emit, body)
|
|
464
|
+
}
|
|
465
|
+
return body
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
var featureProgrammer_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
469
|
+
|
|
470
|
+
func (featureProgrammerNamespace) Compose(props FeatureProgrammer_ComposeProps) FeatureProgrammer_IComposed {
|
|
471
|
+
initialized := props.Config.Initializer(FeatureProgrammer_InitializerProps{
|
|
472
|
+
Context: props.Context,
|
|
473
|
+
Functor: props.Functor,
|
|
474
|
+
Type: props.Type,
|
|
475
|
+
})
|
|
476
|
+
featureProgrammer_compact_object_parents(props.Config, initialized.Collection)
|
|
477
|
+
featureProgrammer_register_schema_unions(initialized.Collection, initialized.Metadata, map[*nativemetadata.MetadataSchema]bool{})
|
|
478
|
+
body := props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
479
|
+
Input: nativefactories.ValueFactory.INPUT(props.Context.Emit),
|
|
480
|
+
Metadata: initialized.Metadata,
|
|
481
|
+
Explore: FeatureProgrammer_IExplore{
|
|
482
|
+
Tracable: props.Config.Path || props.Config.Trace,
|
|
483
|
+
Source: "top",
|
|
484
|
+
From: "top",
|
|
485
|
+
Postfix: "\"\"",
|
|
486
|
+
},
|
|
487
|
+
})
|
|
488
|
+
statements := []*shimast.Node{}
|
|
489
|
+
if props.Config.Addition != nil {
|
|
490
|
+
statements = props.Config.Addition(initialized.Collection)
|
|
491
|
+
}
|
|
492
|
+
functions := map[string]*shimast.Node{}
|
|
493
|
+
for i, v := range featureProgrammer_object_functions(props, initialized.Collection) {
|
|
494
|
+
functions[fmt.Sprintf("%so%d", props.Config.Prefix, i)] = v
|
|
495
|
+
}
|
|
496
|
+
for i, v := range featureProgrammer_union_functions(props.Config, initialized.Collection, props.Context.Emit) {
|
|
497
|
+
functions[fmt.Sprintf("%su%d", props.Config.Prefix, i)] = v
|
|
498
|
+
}
|
|
499
|
+
for i, v := range props.Config.Generator.Arrays(initialized.Collection) {
|
|
500
|
+
functions[fmt.Sprintf("%sa%d", props.Config.Prefix, i)] = v
|
|
501
|
+
}
|
|
502
|
+
for i, v := range props.Config.Generator.Tuples(initialized.Collection) {
|
|
503
|
+
functions[fmt.Sprintf("%st%d", props.Config.Prefix, i)] = v
|
|
504
|
+
}
|
|
505
|
+
return FeatureProgrammer_IComposed{
|
|
506
|
+
Body: body,
|
|
507
|
+
Statements: statements,
|
|
508
|
+
Functions: functions,
|
|
509
|
+
Parameters: FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
510
|
+
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
511
|
+
Type: props.Config.Types.Input(props.Type, props.Name),
|
|
512
|
+
Input: nativefactories.ValueFactory.INPUT(props.Context.Emit),
|
|
513
|
+
Emit: props.Context.Emit,
|
|
514
|
+
}),
|
|
515
|
+
Response: props.Config.Types.Output(props.Type, props.Name),
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
func (featureProgrammerNamespace) WriteDecomposed(props FeatureProgrammer_WriteDecomposedProps) *shimast.Node {
|
|
520
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
521
|
+
statements := []*shimast.Node{}
|
|
522
|
+
statements = append(statements, props.Functor.Declare()...)
|
|
523
|
+
keys := make([]string, 0, len(props.Result.Functions))
|
|
524
|
+
for key := range props.Result.Functions {
|
|
525
|
+
keys = append(keys, key)
|
|
526
|
+
}
|
|
527
|
+
sort.Strings(keys)
|
|
528
|
+
for _, key := range keys {
|
|
529
|
+
if props.Functor != nil && props.Functor.HasLocal(key) == false {
|
|
530
|
+
continue
|
|
531
|
+
}
|
|
532
|
+
statements = append(statements, props.Result.Functions[key])
|
|
533
|
+
}
|
|
534
|
+
statements = append(statements, props.Result.Statements...)
|
|
535
|
+
response := props.Result.Arrow
|
|
536
|
+
if props.ReturnWrapper != nil {
|
|
537
|
+
response = props.ReturnWrapper(props.Result.Arrow)
|
|
538
|
+
}
|
|
539
|
+
statements = append(statements, f.NewReturnStatement(response))
|
|
540
|
+
return f.NewCallExpression(
|
|
541
|
+
f.NewArrowFunction(
|
|
542
|
+
nil,
|
|
543
|
+
nil,
|
|
544
|
+
f.NewNodeList(nil),
|
|
545
|
+
nil,
|
|
546
|
+
nil,
|
|
547
|
+
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
548
|
+
f.NewBlock(f.NewNodeList(statements), true),
|
|
549
|
+
),
|
|
550
|
+
nil,
|
|
551
|
+
nil,
|
|
552
|
+
nil,
|
|
553
|
+
shimast.NodeFlagsNone,
|
|
554
|
+
)
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
func (featureProgrammerNamespace) Write(props FeatureProgrammer_WriteProps) *shimast.Node {
|
|
558
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Context.Emit)
|
|
559
|
+
initialized := props.Config.Initializer(FeatureProgrammer_InitializerProps{
|
|
560
|
+
Context: props.Context,
|
|
561
|
+
Functor: props.Functor,
|
|
562
|
+
Type: props.Type,
|
|
563
|
+
})
|
|
564
|
+
featureProgrammer_compact_object_parents(props.Config, initialized.Collection)
|
|
565
|
+
featureProgrammer_register_schema_unions(initialized.Collection, initialized.Metadata, map[*nativemetadata.MetadataSchema]bool{})
|
|
566
|
+
output := props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
567
|
+
Metadata: initialized.Metadata,
|
|
568
|
+
Input: nativefactories.ValueFactory.INPUT(props.Context.Emit),
|
|
569
|
+
Explore: FeatureProgrammer_IExplore{
|
|
570
|
+
Tracable: props.Config.Path || props.Config.Trace,
|
|
571
|
+
Source: "top",
|
|
572
|
+
From: "top",
|
|
573
|
+
Postfix: "\"\"",
|
|
574
|
+
},
|
|
575
|
+
})
|
|
576
|
+
|
|
577
|
+
objects := featureProgrammer_object_functions(FeatureProgrammer_ComposeProps{
|
|
578
|
+
Config: props.Config,
|
|
579
|
+
Context: props.Context,
|
|
580
|
+
Functor: props.Functor,
|
|
581
|
+
Type: props.Type,
|
|
582
|
+
Name: props.Name,
|
|
583
|
+
}, initialized.Collection)
|
|
584
|
+
unions := featureProgrammer_union_functions(props.Config, initialized.Collection, props.Context.Emit)
|
|
585
|
+
arrays := props.Config.Generator.Arrays(initialized.Collection)
|
|
586
|
+
tuples := props.Config.Generator.Tuples(initialized.Collection)
|
|
587
|
+
|
|
588
|
+
added := []*shimast.Node{}
|
|
589
|
+
if props.Config.Addition != nil {
|
|
590
|
+
added = props.Config.Addition(initialized.Collection)
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
statements := append([]*shimast.Node{}, added...)
|
|
594
|
+
statements = append(statements, props.Functor.Declare()...)
|
|
595
|
+
for _, v := range objects {
|
|
596
|
+
statements = append(statements, v)
|
|
597
|
+
}
|
|
598
|
+
for _, v := range unions {
|
|
599
|
+
statements = append(statements, v)
|
|
600
|
+
}
|
|
601
|
+
for _, v := range arrays {
|
|
602
|
+
statements = append(statements, v)
|
|
603
|
+
}
|
|
604
|
+
for _, v := range tuples {
|
|
605
|
+
statements = append(statements, v)
|
|
606
|
+
}
|
|
607
|
+
if output != nil && output.Kind == shimast.KindBlock {
|
|
608
|
+
statements = append(statements, output.Statements()...)
|
|
609
|
+
} else {
|
|
610
|
+
statements = append(statements, f.NewReturnStatement(output))
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
return f.NewArrowFunction(
|
|
614
|
+
nil,
|
|
615
|
+
nil,
|
|
616
|
+
f.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
617
|
+
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
618
|
+
Type: props.Config.Types.Input(props.Type, props.Name),
|
|
619
|
+
Input: nativefactories.ValueFactory.INPUT(props.Context.Emit),
|
|
620
|
+
Emit: props.Context.Emit,
|
|
621
|
+
})),
|
|
622
|
+
props.Config.Types.Output(props.Type, props.Name),
|
|
623
|
+
nil,
|
|
624
|
+
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
625
|
+
f.NewBlock(f.NewNodeList(statements), true),
|
|
626
|
+
)
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
func (featureProgrammerNamespace) Write_object_functions(props FeatureProgrammer_WriteObjectFunctionsProps) []*shimast.Node {
|
|
630
|
+
featureProgrammer_compact_object_parents(props.Config, props.Collection)
|
|
631
|
+
return featureProgrammer_write_object_functions(props.Config, props.Context, props.Functor, props.Collection)
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
func (featureProgrammerNamespace) Write_union_functions(props FeatureProgrammer_WriteUnionFunctionsProps) []*shimast.Node {
|
|
635
|
+
return featureProgrammer_write_union_functions(props.Config, props.Collection, props.Emit)
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
func (featureProgrammerNamespace) Decode_array(props FeatureProgrammer_DecodeArrayProps) *shimast.Node {
|
|
639
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
640
|
+
rand := fmt.Sprint(props.Functor.Increment())
|
|
641
|
+
tail := []*shimast.Node{}
|
|
642
|
+
if props.Config.Path || props.Config.Trace {
|
|
643
|
+
tail = append(tail, nativefactories.IdentifierFactory.Parameter("_index"+rand, nativefactories.TypeFactory.Keyword("number"), nil))
|
|
644
|
+
}
|
|
645
|
+
parameters := []*shimast.Node{
|
|
646
|
+
nativefactories.IdentifierFactory.Parameter("elem", nativefactories.TypeFactory.Keyword("any"), nil),
|
|
647
|
+
}
|
|
648
|
+
parameters = append(parameters, tail...)
|
|
649
|
+
arrow := f.NewArrowFunction(
|
|
650
|
+
nil,
|
|
651
|
+
nil,
|
|
652
|
+
f.NewNodeList(parameters),
|
|
653
|
+
nil,
|
|
654
|
+
nil,
|
|
655
|
+
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
656
|
+
props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
657
|
+
Input: nativefactories.ValueFactory.INPUT(nil, "elem"),
|
|
658
|
+
Metadata: props.Array.Type.Value,
|
|
659
|
+
Explore: FeatureProgrammer_IExplore{
|
|
660
|
+
Tracable: props.Explore.Tracable,
|
|
661
|
+
Source: props.Explore.Source,
|
|
662
|
+
From: "array",
|
|
663
|
+
Postfix: FeatureProgrammer.Index(FeatureProgrammer_IndexProps{
|
|
664
|
+
Start: props.Explore.Start,
|
|
665
|
+
Postfix: props.Explore.Postfix,
|
|
666
|
+
Rand: rand,
|
|
667
|
+
}),
|
|
668
|
+
},
|
|
669
|
+
}),
|
|
670
|
+
)
|
|
671
|
+
return props.Combiner(struct {
|
|
672
|
+
Input *shimast.Expression
|
|
673
|
+
Arrow *shimast.Node
|
|
674
|
+
}{Input: props.Input, Arrow: arrow})
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
func (featureProgrammerNamespace) Decode_object(props FeatureProgrammer_DecodeObjectProps) *shimast.Node {
|
|
678
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
679
|
+
return f.NewCallExpression(
|
|
680
|
+
f.NewIdentifier(
|
|
681
|
+
props.Functor.UseLocal(fmt.Sprintf("%so%d", props.Config.Prefix, props.Object.Index)),
|
|
682
|
+
),
|
|
683
|
+
nil,
|
|
684
|
+
nil,
|
|
685
|
+
f.NewNodeList(FeatureProgrammer.ArgumentsArray(FeatureProgrammer_ArgumentsArrayProps{
|
|
686
|
+
Config: FeatureProgrammer_ArgumentsArrayConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: props.Config.Visited},
|
|
687
|
+
Input: props.Input,
|
|
688
|
+
Explore: props.Explore,
|
|
689
|
+
Emit: props.Emit,
|
|
690
|
+
})),
|
|
691
|
+
shimast.NodeFlagsNone,
|
|
692
|
+
)
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
func (featureProgrammerNamespace) Index(props FeatureProgrammer_IndexProps) string {
|
|
696
|
+
tail := "\"[\" + _index" + props.Rand + " + \"]\""
|
|
697
|
+
if props.Start != nil {
|
|
698
|
+
tail = "\"[\" + (" + fmt.Sprint(*props.Start) + " + _index" + props.Rand + ") + \"]\""
|
|
699
|
+
}
|
|
700
|
+
if props.Postfix == "" {
|
|
701
|
+
return tail
|
|
702
|
+
}
|
|
703
|
+
if props.Postfix[len(props.Postfix)-1:] == "\"" {
|
|
704
|
+
return props.Postfix[:len(props.Postfix)-1] + tail[1:]
|
|
705
|
+
}
|
|
706
|
+
return props.Postfix + " + " + tail
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
func (featureProgrammerNamespace) ArgumentsArray(props FeatureProgrammer_ArgumentsArrayProps) []*shimast.Node {
|
|
710
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
711
|
+
tail := []*shimast.Node{}
|
|
712
|
+
if props.Config.Path == false && props.Config.Trace == false {
|
|
713
|
+
tail = []*shimast.Node{}
|
|
714
|
+
} else if props.Config.Path && props.Config.Trace {
|
|
715
|
+
path := "_path"
|
|
716
|
+
if props.Explore.Postfix != "" {
|
|
717
|
+
path = "_path + " + props.Explore.Postfix
|
|
718
|
+
}
|
|
719
|
+
tail = append(tail, f.NewIdentifier(path))
|
|
720
|
+
if props.Explore.Source == "function" {
|
|
721
|
+
tail = append(tail, f.NewIdentifier(fmt.Sprintf("%t && _exceptionable", props.Explore.Tracable)))
|
|
722
|
+
} else if props.Explore.Tracable {
|
|
723
|
+
tail = append(tail, f.NewKeywordExpression(shimast.KindTrueKeyword))
|
|
724
|
+
} else {
|
|
725
|
+
tail = append(tail, f.NewKeywordExpression(shimast.KindFalseKeyword))
|
|
726
|
+
}
|
|
727
|
+
} else if props.Config.Path {
|
|
728
|
+
path := "_path"
|
|
729
|
+
if props.Explore.Postfix != "" {
|
|
730
|
+
path = "_path + " + props.Explore.Postfix
|
|
731
|
+
}
|
|
732
|
+
tail = append(tail, f.NewIdentifier(path))
|
|
733
|
+
} else {
|
|
734
|
+
if props.Explore.Source == "function" {
|
|
735
|
+
tail = append(tail, f.NewIdentifier(fmt.Sprintf("%t && _exceptionable", props.Explore.Tracable)))
|
|
736
|
+
} else if props.Explore.Tracable {
|
|
737
|
+
tail = append(tail, f.NewKeywordExpression(shimast.KindTrueKeyword))
|
|
738
|
+
} else {
|
|
739
|
+
tail = append(tail, f.NewKeywordExpression(shimast.KindFalseKeyword))
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
if props.Config.Visited {
|
|
743
|
+
tail = append(tail, f.NewIdentifier("_vctx"))
|
|
744
|
+
}
|
|
745
|
+
return append([]*shimast.Node{props.Input}, tail...)
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
func (featureProgrammerNamespace) ParameterDeclarations(props FeatureProgrammer_ParameterDeclarationsProps) []*shimast.Node {
|
|
749
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Emit)
|
|
750
|
+
tail := []*shimast.Node{}
|
|
751
|
+
if props.Config.Path {
|
|
752
|
+
tail = append(tail, nativefactories.IdentifierFactory.Parameter("_path", nativefactories.TypeFactory.Keyword("string"), nil))
|
|
753
|
+
}
|
|
754
|
+
if props.Config.Trace {
|
|
755
|
+
tail = append(tail, nativefactories.IdentifierFactory.Parameter(
|
|
756
|
+
"_exceptionable",
|
|
757
|
+
nativefactories.TypeFactory.Keyword("boolean"),
|
|
758
|
+
f.NewKeywordExpression(shimast.KindTrueKeyword),
|
|
759
|
+
))
|
|
760
|
+
}
|
|
761
|
+
if props.Config.Visited {
|
|
762
|
+
// The per-invocation visit context: internal calls always pass it along,
|
|
763
|
+
// so the default object literal only materializes at the public entry.
|
|
764
|
+
tail = append(tail, nativefactories.IdentifierFactory.Parameter(
|
|
765
|
+
"_vctx",
|
|
766
|
+
nativefactories.TypeFactory.Keyword("any"),
|
|
767
|
+
f.NewObjectLiteralExpression(f.NewNodeList(nil), false),
|
|
768
|
+
))
|
|
769
|
+
}
|
|
770
|
+
return append([]*shimast.Node{
|
|
771
|
+
nativefactories.IdentifierFactory.Parameter(props.Input, props.Type, nil),
|
|
772
|
+
}, tail...)
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
func featureProgrammer_object_functions(props FeatureProgrammer_ComposeProps, collection *nativemetadata.MetadataCollection) []*shimast.Node {
|
|
776
|
+
if props.Config.Generator.Objects != nil {
|
|
777
|
+
return props.Config.Generator.Objects(collection)
|
|
778
|
+
}
|
|
779
|
+
return featureProgrammer_write_object_functions(props.Config, props.Context, props.Functor, collection)
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
func featureProgrammer_union_functions(config FeatureProgrammer_IConfig, collection *nativemetadata.MetadataCollection, emit *shimprinter.EmitContext) []*shimast.Node {
|
|
783
|
+
if config.Generator.Unions != nil {
|
|
784
|
+
if generated := config.Generator.Unions(collection); generated != nil {
|
|
785
|
+
return generated
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return featureProgrammer_write_union_functions(config, collection, emit)
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
type featureProgrammer_schemaUnionVisit struct {
|
|
792
|
+
Schemas map[*nativemetadata.MetadataSchema]bool
|
|
793
|
+
Objects map[*nativemetadata.MetadataObjectType]bool
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
const featureProgrammer_objectParentMinProperties = 8
|
|
797
|
+
|
|
798
|
+
type featureProgrammer_objectPropertySet struct {
|
|
799
|
+
Properties map[string]*nativemetadata.MetadataProperty
|
|
800
|
+
Order []string
|
|
801
|
+
Anchor string
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
func featureProgrammer_compact_object_parents(config FeatureProgrammer_IConfig, collection *nativemetadata.MetadataCollection) {
|
|
805
|
+
if config.ObjectParents == false || collection == nil {
|
|
806
|
+
return
|
|
807
|
+
}
|
|
808
|
+
objects := collection.Objects()
|
|
809
|
+
signatures := make([]featureProgrammer_objectPropertySet, len(objects))
|
|
810
|
+
frequencies := map[string]int{}
|
|
811
|
+
for i, object := range objects {
|
|
812
|
+
signatures[i] = featureProgrammer_object_property_set(object)
|
|
813
|
+
for _, key := range signatures[i].Order {
|
|
814
|
+
frequencies[key]++
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
buckets := map[string][]int{}
|
|
818
|
+
for i := range objects {
|
|
819
|
+
if len(signatures[i].Order) < featureProgrammer_objectParentMinProperties {
|
|
820
|
+
continue
|
|
821
|
+
}
|
|
822
|
+
anchor := featureProgrammer_object_parent_anchor(signatures[i], frequencies)
|
|
823
|
+
if anchor == "" {
|
|
824
|
+
continue
|
|
825
|
+
}
|
|
826
|
+
signatures[i].Anchor = anchor
|
|
827
|
+
buckets[anchor] = append(buckets[anchor], i)
|
|
828
|
+
}
|
|
829
|
+
for i, object := range objects {
|
|
830
|
+
if object.Check_properties_ != nil || len(object.Properties) <= featureProgrammer_objectParentMinProperties {
|
|
831
|
+
continue
|
|
832
|
+
}
|
|
833
|
+
current := signatures[i]
|
|
834
|
+
if len(current.Order) <= featureProgrammer_objectParentMinProperties {
|
|
835
|
+
continue
|
|
836
|
+
}
|
|
837
|
+
best := -1
|
|
838
|
+
bestSize := 0
|
|
839
|
+
visited := map[int]bool{}
|
|
840
|
+
for _, key := range current.Order {
|
|
841
|
+
for _, candidate := range buckets[key] {
|
|
842
|
+
if visited[candidate] || candidate == i {
|
|
843
|
+
continue
|
|
844
|
+
}
|
|
845
|
+
visited[candidate] = true
|
|
846
|
+
candidateSize := len(signatures[candidate].Order)
|
|
847
|
+
if candidateSize <= bestSize || candidateSize >= len(current.Order) {
|
|
848
|
+
continue
|
|
849
|
+
}
|
|
850
|
+
if featureProgrammer_object_parent_covers(current, signatures[candidate]) {
|
|
851
|
+
best = candidate
|
|
852
|
+
bestSize = candidateSize
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
if best == -1 {
|
|
857
|
+
continue
|
|
858
|
+
}
|
|
859
|
+
parent := objects[best]
|
|
860
|
+
object.Parent_objects_ = append(object.Parent_objects_, nativemetadata.MetadataObject_create(nativemetadata.MetadataObject{
|
|
861
|
+
Type: parent,
|
|
862
|
+
Tags: [][]nativemetadata.IMetadataTypeTag{},
|
|
863
|
+
}))
|
|
864
|
+
object.Check_properties_ = featureProgrammer_object_remaining_properties(object.Properties, signatures[best])
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
func featureProgrammer_object_property_set(object *nativemetadata.MetadataObjectType) featureProgrammer_objectPropertySet {
|
|
869
|
+
if object == nil {
|
|
870
|
+
return featureProgrammer_objectPropertySet{}
|
|
871
|
+
}
|
|
872
|
+
output := featureProgrammer_objectPropertySet{
|
|
873
|
+
Properties: map[string]*nativemetadata.MetadataProperty{},
|
|
874
|
+
Order: []string{},
|
|
875
|
+
}
|
|
876
|
+
for _, property := range object.Properties {
|
|
877
|
+
if property == nil || property.Key == nil {
|
|
878
|
+
return featureProgrammer_objectPropertySet{}
|
|
879
|
+
}
|
|
880
|
+
key := property.Key.GetSoleLiteral()
|
|
881
|
+
if key == nil {
|
|
882
|
+
return featureProgrammer_objectPropertySet{}
|
|
883
|
+
}
|
|
884
|
+
signature := featureProgrammer_object_property_signature(property)
|
|
885
|
+
if signature == "" {
|
|
886
|
+
return featureProgrammer_objectPropertySet{}
|
|
887
|
+
}
|
|
888
|
+
output.Properties[signature] = property
|
|
889
|
+
output.Order = append(output.Order, signature)
|
|
890
|
+
}
|
|
891
|
+
return output
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
func featureProgrammer_object_property_signature(property *nativemetadata.MetadataProperty) string {
|
|
895
|
+
if property == nil || property.Key == nil || property.Value == nil {
|
|
896
|
+
return ""
|
|
897
|
+
}
|
|
898
|
+
key := property.Key.GetSoleLiteral()
|
|
899
|
+
if key == nil {
|
|
900
|
+
return ""
|
|
901
|
+
}
|
|
902
|
+
return *key + "\x00" +
|
|
903
|
+
property.Key.GetName() + "\x00" +
|
|
904
|
+
property.Value.GetName() + "\x00" +
|
|
905
|
+
fmt.Sprintf("%t\x00%t", property.Value.Optional, property.Value.Nullable)
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
func featureProgrammer_object_parent_anchor(set featureProgrammer_objectPropertySet, frequencies map[string]int) string {
|
|
909
|
+
anchor := ""
|
|
910
|
+
score := 0
|
|
911
|
+
for _, key := range set.Order {
|
|
912
|
+
next := frequencies[key]
|
|
913
|
+
if anchor == "" || next < score {
|
|
914
|
+
anchor = key
|
|
915
|
+
score = next
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return anchor
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
func featureProgrammer_object_parent_covers(
|
|
922
|
+
current featureProgrammer_objectPropertySet,
|
|
923
|
+
candidate featureProgrammer_objectPropertySet,
|
|
924
|
+
) bool {
|
|
925
|
+
if len(candidate.Order) == 0 || len(candidate.Order) >= len(current.Order) {
|
|
926
|
+
return false
|
|
927
|
+
}
|
|
928
|
+
for _, key := range candidate.Order {
|
|
929
|
+
if current.Properties[key] == nil {
|
|
930
|
+
return false
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
return true
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
func featureProgrammer_object_remaining_properties(
|
|
937
|
+
properties []*nativemetadata.MetadataProperty,
|
|
938
|
+
parent featureProgrammer_objectPropertySet,
|
|
939
|
+
) []*nativemetadata.MetadataProperty {
|
|
940
|
+
output := make([]*nativemetadata.MetadataProperty, 0, len(properties)-len(parent.Order))
|
|
941
|
+
for _, property := range properties {
|
|
942
|
+
if parent.Properties[featureProgrammer_object_property_signature(property)] != nil {
|
|
943
|
+
continue
|
|
944
|
+
}
|
|
945
|
+
output = append(output, property)
|
|
946
|
+
}
|
|
947
|
+
return output
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
func featureProgrammer_register_schema_unions(collection *nativemetadata.MetadataCollection, metadata *nativemetadata.MetadataSchema, visited map[*nativemetadata.MetadataSchema]bool) {
|
|
951
|
+
if visited == nil {
|
|
952
|
+
visited = map[*nativemetadata.MetadataSchema]bool{}
|
|
953
|
+
}
|
|
954
|
+
featureProgrammer_register_schema_unions_iterate(collection, metadata, &featureProgrammer_schemaUnionVisit{
|
|
955
|
+
Schemas: visited,
|
|
956
|
+
Objects: map[*nativemetadata.MetadataObjectType]bool{},
|
|
957
|
+
})
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
func featureProgrammer_register_schema_unions_iterate(collection *nativemetadata.MetadataCollection, metadata *nativemetadata.MetadataSchema, visited *featureProgrammer_schemaUnionVisit) {
|
|
961
|
+
if collection == nil || metadata == nil || visited.Schemas[metadata] {
|
|
962
|
+
return
|
|
963
|
+
}
|
|
964
|
+
visited.Schemas[metadata] = true
|
|
965
|
+
|
|
966
|
+
if len(metadata.Objects) > 1 {
|
|
967
|
+
index := collection.GetUnionIndex(metadata)
|
|
968
|
+
metadata.Union_index = &index
|
|
969
|
+
}
|
|
970
|
+
if metadata.Escaped != nil {
|
|
971
|
+
featureProgrammer_register_schema_unions_iterate(collection, metadata.Escaped.Returns, visited)
|
|
972
|
+
}
|
|
973
|
+
if metadata.Rest != nil {
|
|
974
|
+
featureProgrammer_register_schema_unions_iterate(collection, metadata.Rest, visited)
|
|
975
|
+
}
|
|
976
|
+
for _, alias := range metadata.Aliases {
|
|
977
|
+
if alias.Type != nil {
|
|
978
|
+
featureProgrammer_register_schema_unions_iterate(collection, alias.Type.Value, visited)
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
for _, array := range metadata.Arrays {
|
|
982
|
+
if array.Type != nil {
|
|
983
|
+
featureProgrammer_register_schema_unions_iterate(collection, array.Type.Value, visited)
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
for _, tuple := range metadata.Tuples {
|
|
987
|
+
if tuple.Type != nil {
|
|
988
|
+
for _, element := range tuple.Type.Elements {
|
|
989
|
+
featureProgrammer_register_schema_unions_iterate(collection, element, visited)
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
for _, object := range metadata.Objects {
|
|
994
|
+
if object.Type != nil && visited.Objects[object.Type] == false {
|
|
995
|
+
visited.Objects[object.Type] = true
|
|
996
|
+
for _, property := range object.Type.Properties {
|
|
997
|
+
featureProgrammer_register_schema_unions_iterate(collection, property.Value, visited)
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
for _, set := range metadata.Sets {
|
|
1002
|
+
featureProgrammer_register_schema_unions_iterate(collection, set.Value, visited)
|
|
1003
|
+
}
|
|
1004
|
+
for _, item := range metadata.Maps {
|
|
1005
|
+
featureProgrammer_register_schema_unions_iterate(collection, item.Key, visited)
|
|
1006
|
+
featureProgrammer_register_schema_unions_iterate(collection, item.Value, visited)
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
func featureProgrammer_write_object_functions(config FeatureProgrammer_IConfig, context nativecontext.ITypiaContext, functor *nativehelpers.FunctionProgrammer, collection *nativemetadata.MetadataCollection) []*shimast.Node {
|
|
1011
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, context.Emit)
|
|
1012
|
+
objects := collection.Objects()
|
|
1013
|
+
propertyFrequencies := featureProgrammer_object_property_frequencies(config, context, functor, objects)
|
|
1014
|
+
output := make([]*shimast.Node, 0, len(objects))
|
|
1015
|
+
for _, object := range objects {
|
|
1016
|
+
input := f.NewIdentifier("input")
|
|
1017
|
+
objectType := config.Objector.Type
|
|
1018
|
+
if objectType == nil {
|
|
1019
|
+
objectType = nativefactories.TypeFactory.Keyword("any", context.Emit)
|
|
1020
|
+
}
|
|
1021
|
+
entriesObject := object
|
|
1022
|
+
if config.ObjectParents && len(object.Parent_objects_) != 0 {
|
|
1023
|
+
entriesObject = &nativemetadata.MetadataObjectType{
|
|
1024
|
+
Name: object.Name,
|
|
1025
|
+
DisplayName: object.DisplayName,
|
|
1026
|
+
Properties: object.CheckProperties(),
|
|
1027
|
+
Description: object.Description,
|
|
1028
|
+
JsDocTags: object.JsDocTags,
|
|
1029
|
+
Index: object.Index,
|
|
1030
|
+
Validated: object.Validated,
|
|
1031
|
+
Recursive: object.Recursive,
|
|
1032
|
+
Nullables: object.Nullables,
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
helperAllProperties := config.ObjectParents && functor != nil && len(entriesObject.Properties) >= 16
|
|
1036
|
+
body := config.Objector.Joiner(FeatureProgrammer_ObjectorJoinerProps{
|
|
1037
|
+
Input: input,
|
|
1038
|
+
Entries: nativeiterate.Feature_object_entries(nativeiterate.Feature_object_entriesProps{
|
|
1039
|
+
Config: nativeiterate.Feature_object_entriesConfig{
|
|
1040
|
+
Path: config.Path,
|
|
1041
|
+
Trace: config.Trace,
|
|
1042
|
+
Decoder: func(next nativeiterate.Feature_object_entriesDecoderProps) *shimast.Node {
|
|
1043
|
+
if key := featureProgrammer_object_property_helper_key(context, next.Property, next.Metadata); key != "" && (propertyFrequencies[key] > 1 || helperAllProperties) {
|
|
1044
|
+
return featureProgrammer_object_property_helper_call(featureProgrammer_objectPropertyHelperProps{
|
|
1045
|
+
Config: config,
|
|
1046
|
+
Context: context,
|
|
1047
|
+
Functor: functor,
|
|
1048
|
+
Input: input,
|
|
1049
|
+
ReturnType: objectType,
|
|
1050
|
+
Next: next,
|
|
1051
|
+
Key: key,
|
|
1052
|
+
})
|
|
1053
|
+
}
|
|
1054
|
+
return config.Decoder(FeatureProgrammer_DecoderProps{
|
|
1055
|
+
Input: next.Input,
|
|
1056
|
+
Metadata: next.Metadata,
|
|
1057
|
+
Explore: featureProgrammer_from_iterate_explore(next.Explore),
|
|
1058
|
+
})
|
|
1059
|
+
},
|
|
1060
|
+
},
|
|
1061
|
+
Context: context,
|
|
1062
|
+
Input: input,
|
|
1063
|
+
Object: entriesObject,
|
|
1064
|
+
}),
|
|
1065
|
+
Object: object,
|
|
1066
|
+
})
|
|
1067
|
+
if config.ObjectParents && len(object.Parent_objects_) != 0 {
|
|
1068
|
+
expressions := make([]*shimast.Node, 0, len(object.Parent_objects_)+1)
|
|
1069
|
+
explore := FeatureProgrammer_IExplore{
|
|
1070
|
+
Tracable: config.Path || config.Trace,
|
|
1071
|
+
Source: "function",
|
|
1072
|
+
From: "object",
|
|
1073
|
+
Postfix: "",
|
|
1074
|
+
}
|
|
1075
|
+
for _, parent := range object.Parent_objects_ {
|
|
1076
|
+
expressions = append(expressions, config.Objector.Decoder(FeatureProgrammer_ObjectorDecoderProps{
|
|
1077
|
+
Input: input,
|
|
1078
|
+
Object: parent.Type,
|
|
1079
|
+
Explore: explore,
|
|
1080
|
+
}))
|
|
1081
|
+
}
|
|
1082
|
+
expressions = append(expressions, body)
|
|
1083
|
+
body = checkerProgrammer_reduce(expressions, shimast.KindAmpersandAmpersandToken, f.NewKeywordExpression(shimast.KindTrueKeyword), context.Emit)
|
|
1084
|
+
}
|
|
1085
|
+
if object.Recursive && config.VisitGuard != nil && featureProgrammer_visited(config) {
|
|
1086
|
+
body = config.VisitGuard(FeatureProgrammer_VisitGuardProps{
|
|
1087
|
+
Key: FeatureProgrammer.VisitKey(config.Prefix, "o", object.Index),
|
|
1088
|
+
Input: input,
|
|
1089
|
+
Body: body,
|
|
1090
|
+
Object: object,
|
|
1091
|
+
})
|
|
1092
|
+
}
|
|
1093
|
+
output = append(output, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
1094
|
+
Name: fmt.Sprintf("%so%d", config.Prefix, object.Index),
|
|
1095
|
+
Value: f.NewArrowFunction(
|
|
1096
|
+
nil,
|
|
1097
|
+
nil,
|
|
1098
|
+
f.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
1099
|
+
Config: FeatureProgrammer_ParameterConfig{Path: config.Path, Trace: config.Trace, Visited: featureProgrammer_visited(config)},
|
|
1100
|
+
Type: nativefactories.TypeFactory.Keyword("any"),
|
|
1101
|
+
Input: nativefactories.ValueFactory.INPUT(context.Emit),
|
|
1102
|
+
Emit: context.Emit,
|
|
1103
|
+
})),
|
|
1104
|
+
objectType,
|
|
1105
|
+
nil,
|
|
1106
|
+
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
1107
|
+
body,
|
|
1108
|
+
),
|
|
1109
|
+
}, context.Emit))
|
|
1110
|
+
}
|
|
1111
|
+
return output
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
type featureProgrammer_objectPropertyHelperProps struct {
|
|
1115
|
+
Config FeatureProgrammer_IConfig
|
|
1116
|
+
Context nativecontext.ITypiaContext
|
|
1117
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
1118
|
+
Input *shimast.Expression
|
|
1119
|
+
ReturnType *shimast.TypeNode
|
|
1120
|
+
Next nativeiterate.Feature_object_entriesDecoderProps
|
|
1121
|
+
Key string
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
func featureProgrammer_object_property_frequencies(
|
|
1125
|
+
config FeatureProgrammer_IConfig,
|
|
1126
|
+
context nativecontext.ITypiaContext,
|
|
1127
|
+
functor *nativehelpers.FunctionProgrammer,
|
|
1128
|
+
objects []*nativemetadata.MetadataObjectType,
|
|
1129
|
+
) map[string]int {
|
|
1130
|
+
output := map[string]int{}
|
|
1131
|
+
if config.ObjectParents == false || functor == nil {
|
|
1132
|
+
return output
|
|
1133
|
+
}
|
|
1134
|
+
for _, object := range objects {
|
|
1135
|
+
for _, property := range object.CheckProperties() {
|
|
1136
|
+
if property == nil || property.Key == nil || property.Value == nil {
|
|
1137
|
+
continue
|
|
1138
|
+
}
|
|
1139
|
+
metadata := property.Value
|
|
1140
|
+
if property.Key.GetSoleLiteral() != nil && nativehelpers.OptionPredicator.StrictOptionalUndefined(context, property.Value) {
|
|
1141
|
+
metadata = property.Value.ShallowClone()
|
|
1142
|
+
metadata.Optional = false
|
|
1143
|
+
}
|
|
1144
|
+
key := featureProgrammer_object_property_helper_key(context, property, metadata)
|
|
1145
|
+
if key != "" {
|
|
1146
|
+
output[key]++
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
return output
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
func featureProgrammer_object_property_helper_key(
|
|
1154
|
+
context nativecontext.ITypiaContext,
|
|
1155
|
+
property *nativemetadata.MetadataProperty,
|
|
1156
|
+
metadata *nativemetadata.MetadataSchema,
|
|
1157
|
+
) string {
|
|
1158
|
+
if property == nil || property.Key == nil || metadata == nil {
|
|
1159
|
+
return ""
|
|
1160
|
+
}
|
|
1161
|
+
key := property.Key.GetSoleLiteral()
|
|
1162
|
+
if key == nil {
|
|
1163
|
+
return ""
|
|
1164
|
+
}
|
|
1165
|
+
return *key + "\x00" +
|
|
1166
|
+
property.Key.GetName() + "\x00" +
|
|
1167
|
+
metadata.GetName() + "\x00" +
|
|
1168
|
+
fmt.Sprintf("%t\x00%t\x00%t", metadata.Optional, metadata.Nullable, nativehelpers.OptionPredicator.Numeric(context.Options))
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
func featureProgrammer_object_property_helper_call(props featureProgrammer_objectPropertyHelperProps) *shimast.Node {
|
|
1172
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, props.Context.Emit)
|
|
1173
|
+
helper := props.Functor.EmplaceVariableByKey(props.Config.Prefix+"p", props.Key, func(string) *shimast.Expression {
|
|
1174
|
+
input := nativefactories.ValueFactory.INPUT(props.Context.Emit)
|
|
1175
|
+
propertyInput := featureProgrammer_object_property_input(input, props.Next.Key, props.Context.Emit)
|
|
1176
|
+
body := props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
1177
|
+
Input: propertyInput,
|
|
1178
|
+
Metadata: props.Next.Metadata,
|
|
1179
|
+
Explore: featureProgrammer_from_iterate_explore(props.Next.Explore),
|
|
1180
|
+
})
|
|
1181
|
+
return f.NewArrowFunction(
|
|
1182
|
+
nil,
|
|
1183
|
+
nil,
|
|
1184
|
+
f.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
1185
|
+
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
1186
|
+
Type: nativefactories.TypeFactory.Keyword("any"),
|
|
1187
|
+
Input: input,
|
|
1188
|
+
Emit: props.Context.Emit,
|
|
1189
|
+
})),
|
|
1190
|
+
props.ReturnType,
|
|
1191
|
+
nil,
|
|
1192
|
+
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
1193
|
+
body,
|
|
1194
|
+
)
|
|
1195
|
+
})
|
|
1196
|
+
return f.NewCallExpression(
|
|
1197
|
+
helper,
|
|
1198
|
+
nil,
|
|
1199
|
+
nil,
|
|
1200
|
+
f.NewNodeList(FeatureProgrammer.ArgumentsArray(FeatureProgrammer_ArgumentsArrayProps{
|
|
1201
|
+
Config: FeatureProgrammer_ArgumentsArrayConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
1202
|
+
Input: props.Input,
|
|
1203
|
+
Explore: FeatureProgrammer_IExplore{
|
|
1204
|
+
Tracable: props.Config.Path || props.Config.Trace,
|
|
1205
|
+
Source: "function",
|
|
1206
|
+
From: "object",
|
|
1207
|
+
Postfix: "",
|
|
1208
|
+
},
|
|
1209
|
+
Emit: props.Context.Emit,
|
|
1210
|
+
})),
|
|
1211
|
+
shimast.NodeFlagsNone,
|
|
1212
|
+
)
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
func featureProgrammer_object_property_input(input *shimast.Expression, key *string, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
1216
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit...)
|
|
1217
|
+
if key == nil {
|
|
1218
|
+
return f.NewIdentifier("value")
|
|
1219
|
+
}
|
|
1220
|
+
return f.NewElementAccessExpression(
|
|
1221
|
+
input,
|
|
1222
|
+
nil,
|
|
1223
|
+
f.NewStringLiteral(*key, shimast.TokenFlagsNone),
|
|
1224
|
+
shimast.NodeFlagsNone,
|
|
1225
|
+
)
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
func featureProgrammer_write_union_functions(config FeatureProgrammer_IConfig, collection *nativemetadata.MetadataCollection, emit *shimprinter.EmitContext) []*shimast.Node {
|
|
1229
|
+
unions := collection.Unions()
|
|
1230
|
+
output := make([]*shimast.Node, 0, len(unions))
|
|
1231
|
+
for i, union := range unions {
|
|
1232
|
+
output = append(output, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
1233
|
+
Name: fmt.Sprintf("%su%d", config.Prefix, i),
|
|
1234
|
+
Value: featureProgrammer_write_union(struct {
|
|
1235
|
+
Config FeatureProgrammer_IConfig
|
|
1236
|
+
Objects []*nativemetadata.MetadataObjectType
|
|
1237
|
+
}{Config: config, Objects: union}, emit),
|
|
1238
|
+
}))
|
|
1239
|
+
}
|
|
1240
|
+
return output
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
func featureProgrammer_write_union(props struct {
|
|
1244
|
+
Config FeatureProgrammer_IConfig
|
|
1245
|
+
Objects []*nativemetadata.MetadataObjectType
|
|
1246
|
+
}, emit *shimprinter.EmitContext) *shimast.Node {
|
|
1247
|
+
f := nativecontext.EmitFactoryOf(featureProgrammer_factory, emit)
|
|
1248
|
+
return f.NewArrowFunction(
|
|
1249
|
+
nil,
|
|
1250
|
+
nil,
|
|
1251
|
+
f.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
1252
|
+
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace, Visited: featureProgrammer_visited(props.Config)},
|
|
1253
|
+
Type: nativefactories.TypeFactory.Keyword("any"),
|
|
1254
|
+
Input: nativefactories.ValueFactory.INPUT(nil),
|
|
1255
|
+
Emit: emit,
|
|
1256
|
+
})),
|
|
1257
|
+
nativefactories.TypeFactory.Keyword("any"),
|
|
1258
|
+
nil,
|
|
1259
|
+
f.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
1260
|
+
nativehelpers.UnionExplorer.Object(nativehelpers.UnionExplorer_ObjectProps{
|
|
1261
|
+
Config: nativehelpers.UnionExplorer_ObjectConfig{
|
|
1262
|
+
Objector: featureProgrammer_union_objector(props.Config.Objector),
|
|
1263
|
+
},
|
|
1264
|
+
Objects: props.Objects,
|
|
1265
|
+
Input: nativefactories.ValueFactory.INPUT(nil),
|
|
1266
|
+
Explore: FeatureProgrammer_IExplore{
|
|
1267
|
+
Tracable: props.Config.Path || props.Config.Trace,
|
|
1268
|
+
Source: "function",
|
|
1269
|
+
From: "object",
|
|
1270
|
+
Postfix: "",
|
|
1271
|
+
},
|
|
1272
|
+
Emit: emit,
|
|
1273
|
+
}),
|
|
1274
|
+
)
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
func featureProgrammer_union_objector(objector FeatureProgrammer_IConfig_IObjector) nativehelpers.UnionExplorer_IObjector {
|
|
1278
|
+
return nativehelpers.UnionExplorer_IObjector{
|
|
1279
|
+
Checker: func(props nativehelpers.UnionExplorer_ObjectorCheckerProps) *shimast.Node {
|
|
1280
|
+
return objector.Checker(FeatureProgrammer_ObjectorCheckerProps{
|
|
1281
|
+
Metadata: props.Metadata,
|
|
1282
|
+
Input: props.Input,
|
|
1283
|
+
Explore: featureProgrammer_as_explore(props.Explore),
|
|
1284
|
+
})
|
|
1285
|
+
},
|
|
1286
|
+
Decoder: func(props nativehelpers.UnionExplorer_ObjectorDecoderProps) *shimast.Node {
|
|
1287
|
+
return objector.Decoder(FeatureProgrammer_ObjectorDecoderProps{
|
|
1288
|
+
Input: props.Input,
|
|
1289
|
+
Object: props.Object,
|
|
1290
|
+
Explore: featureProgrammer_as_explore(props.Explore),
|
|
1291
|
+
})
|
|
1292
|
+
},
|
|
1293
|
+
Unionizer: func(props nativehelpers.UnionExplorer_ObjectorUnionizerProps) *shimast.Node {
|
|
1294
|
+
return objector.Unionizer(FeatureProgrammer_ObjectorUnionizerProps{
|
|
1295
|
+
Objects: props.Objects,
|
|
1296
|
+
Input: props.Input,
|
|
1297
|
+
Explore: featureProgrammer_as_explore(props.Explore),
|
|
1298
|
+
})
|
|
1299
|
+
},
|
|
1300
|
+
Failure: func(props nativehelpers.UnionExplorer_ObjectorFailureProps) *shimast.Node {
|
|
1301
|
+
explore := featureProgrammer_as_explore(props.Explore)
|
|
1302
|
+
return objector.Failure(FeatureProgrammer_ObjectorFailureProps{
|
|
1303
|
+
Input: props.Input,
|
|
1304
|
+
Expected: props.Expected,
|
|
1305
|
+
Explore: &explore,
|
|
1306
|
+
})
|
|
1307
|
+
},
|
|
1308
|
+
Is: objector.Is,
|
|
1309
|
+
Required: objector.Required,
|
|
1310
|
+
Full: func(props nativehelpers.UnionExplorer_ObjectorFullProps) *shimast.Node {
|
|
1311
|
+
if objector.Full == nil {
|
|
1312
|
+
return props.Condition
|
|
1313
|
+
}
|
|
1314
|
+
return objector.Full(FeatureProgrammer_ObjectorFullProps{
|
|
1315
|
+
Condition: props.Condition,
|
|
1316
|
+
Input: props.Input,
|
|
1317
|
+
Expected: props.Expected,
|
|
1318
|
+
Explore: featureProgrammer_as_explore(props.Explore),
|
|
1319
|
+
})
|
|
1320
|
+
},
|
|
1321
|
+
Type: objector.Type,
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
func featureProgrammer_from_iterate_explore(input nativeiterate.Feature_object_entriesExplore) FeatureProgrammer_IExplore {
|
|
1326
|
+
return FeatureProgrammer_IExplore{
|
|
1327
|
+
Tracable: input.Tracable,
|
|
1328
|
+
Source: input.Source,
|
|
1329
|
+
From: input.From,
|
|
1330
|
+
Postfix: input.Postfix,
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
func featureProgrammer_as_explore(input any) FeatureProgrammer_IExplore {
|
|
1335
|
+
switch value := input.(type) {
|
|
1336
|
+
case FeatureProgrammer_IExplore:
|
|
1337
|
+
return value
|
|
1338
|
+
case *FeatureProgrammer_IExplore:
|
|
1339
|
+
return *value
|
|
1340
|
+
case map[string]any:
|
|
1341
|
+
output := FeatureProgrammer_IExplore{}
|
|
1342
|
+
if v, ok := value["tracable"].(bool); ok {
|
|
1343
|
+
output.Tracable = v
|
|
1344
|
+
}
|
|
1345
|
+
if v, ok := value["source"].(string); ok {
|
|
1346
|
+
output.Source = v
|
|
1347
|
+
}
|
|
1348
|
+
if v, ok := value["from"].(string); ok {
|
|
1349
|
+
output.From = v
|
|
1350
|
+
}
|
|
1351
|
+
if v, ok := value["postfix"].(string); ok {
|
|
1352
|
+
output.Postfix = v
|
|
1353
|
+
}
|
|
1354
|
+
if v, ok := value["start"].(int); ok {
|
|
1355
|
+
output.Start = &v
|
|
1356
|
+
}
|
|
1357
|
+
return output
|
|
1358
|
+
default:
|
|
1359
|
+
return FeatureProgrammer_IExplore{}
|
|
1360
|
+
}
|
|
1361
|
+
}
|