@resistdesign/voltra 3.0.0-alpha.2 → 3.0.0-alpha.20
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/README.md +327 -7
- package/api/DBX/DBXAsserts.d.ts +95 -0
- package/api/DBX/DBXRequest.d.ts +5 -0
- package/api/DBX/DBXRuntime.d.ts +5 -0
- package/api/DBX/DBXScenarioConfig.d.ts +9 -0
- package/api/DBX/DBXSeed.d.ts +124 -0
- package/api/DBX/DBXTypes.d.ts +176 -0
- package/api/DBX/index.d.ts +8 -0
- package/api/DataAccessControl.d.ts +220 -0
- package/api/Indexing/API.d.ts +224 -0
- package/api/Indexing/Cursor.d.ts +101 -0
- package/api/Indexing/Handler/Config.d.ts +39 -0
- package/api/Indexing/Handler.d.ts +166 -0
- package/api/Indexing/Trace.d.ts +54 -0
- package/api/Indexing/Types.d.ts +204 -0
- package/api/Indexing/ddb/AwsSdkV3Adapter.d.ts +8 -0
- package/api/Indexing/ddb/Types.d.ts +169 -0
- package/api/Indexing/docId.d.ts +27 -0
- package/api/Indexing/exact/ExactDdb.d.ts +58 -0
- package/api/Indexing/exact/ExactIndex.d.ts +90 -0
- package/api/Indexing/exact/ExactS3.d.ts +41 -0
- package/api/Indexing/fieldQualification.d.ts +12 -0
- package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +210 -0
- package/api/Indexing/fulltext/FullTextMemoryBackend.d.ts +93 -0
- package/api/Indexing/fulltext/Schema.d.ts +164 -0
- package/api/Indexing/hashUniversal.d.ts +13 -0
- package/api/Indexing/index.d.ts +45 -0
- package/api/Indexing/lossy/LossyDdb.d.ts +43 -0
- package/api/Indexing/lossy/LossyIndex.d.ts +72 -0
- package/api/Indexing/lossy/LossyS3.d.ts +40 -0
- package/api/Indexing/rel/Cursor.d.ts +25 -0
- package/api/Indexing/rel/Handlers.d.ts +143 -0
- package/api/Indexing/rel/RelationalDdb.d.ts +169 -0
- package/api/Indexing/rel/RelationalInMemoryBackend.d.ts +38 -0
- package/api/Indexing/rel/Types.d.ts +69 -0
- package/api/Indexing/structured/Cursor.d.ts +26 -0
- package/api/Indexing/structured/Handlers.d.ts +128 -0
- package/api/Indexing/structured/SearchStructured.d.ts +44 -0
- package/api/Indexing/structured/StructuredDdb.d.ts +166 -0
- package/api/Indexing/structured/StructuredDdbBackend.d.ts +109 -0
- package/api/Indexing/structured/StructuredInMemoryBackend.d.ts +34 -0
- package/api/Indexing/structured/StructuredInMemoryIndex.d.ts +58 -0
- package/api/Indexing/structured/StructuredStringLike.d.ts +25 -0
- package/api/Indexing/structured/StructuredWriter.d.ts +61 -0
- package/api/Indexing/structured/Types.d.ts +126 -0
- package/api/Indexing/structured/index.d.ts +9 -0
- package/api/Indexing/tokenize.d.ts +31 -0
- package/api/ORM/DACUtils.d.ts +270 -0
- package/api/ORM/ListItemUtils.d.ts +40 -0
- package/api/ORM/ORMRouteMap.d.ts +55 -0
- package/api/ORM/TypeInfoORMService.d.ts +555 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +229 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +89 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypes.d.ts +4 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver.d.ts +55 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver/ConfigTypes.d.ts +13 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver.d.ts +98 -0
- package/api/ORM/drivers/InMemoryItemRelationshipDBDriver.d.ts +16 -0
- package/api/ORM/drivers/IndexingRelationshipDriver.d.ts +123 -0
- package/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +322 -0
- package/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +118 -0
- package/{src/api → api}/ORM/drivers/S3FileItemDBDriver.d.ts +27 -0
- package/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +36 -0
- package/{src/api → api}/ORM/drivers/common/Types.d.ts +120 -0
- package/api/ORM/drivers/index.d.ts +7 -0
- package/api/ORM/index.d.ts +7 -0
- package/api/ORM/indexing/criteriaToStructuredWhere.d.ts +17 -0
- package/api/Router/AWS.d.ts +80 -0
- package/api/Router/Auth.d.ts +14 -0
- package/api/Router/CORS.d.ts +66 -0
- package/{src/api → api}/Router/Types.d.ts +70 -4
- package/api/Router/index.d.ts +89 -0
- package/api/index.d.ts +68 -0
- package/api/index.js +9204 -0
- package/app/forms/Engine.d.ts +20 -0
- package/app/forms/core/createAutoField.d.ts +35 -0
- package/app/forms/core/createFormRenderer.d.ts +24 -0
- package/app/forms/core/getFieldKind.d.ts +14 -0
- package/app/forms/core/index.d.ts +11 -0
- package/app/forms/core/mergeSuites.d.ts +22 -0
- package/app/forms/core/resolveSuite.d.ts +14 -0
- package/app/forms/core/types.d.ts +153 -0
- package/app/forms/index.d.ts +9 -0
- package/app/forms/types.d.ts +156 -0
- package/app/helpers/styled.d.ts +3 -0
- package/app/index.d.ts +98 -0
- package/app/index.js +1386 -0
- package/{src/app → app}/utils/ApplicationState.d.ts +115 -0
- package/{src/app → app}/utils/ApplicationStateLoader.d.ts +40 -0
- package/app/utils/Controller.d.ts +10 -0
- package/app/utils/Debug.d.ts +14 -0
- package/app/utils/EasyLayout.d.ts +89 -0
- package/app/utils/History.d.ts +148 -0
- package/app/utils/Route.d.ts +129 -0
- package/app/utils/RouteHistory.d.ts +26 -0
- package/app/utils/Service.d.ts +45 -0
- package/app/utils/TypeInfoORMAPIUtils.d.ts +94 -0
- package/app/utils/TypeInfoORMClient.d.ts +103 -0
- package/app/utils/easy-layout/computeAreaBounds.d.ts +5 -0
- package/app/utils/easy-layout/computeTracks.d.ts +16 -0
- package/app/utils/easy-layout/index.d.ts +5 -0
- package/app/utils/easy-layout/parseTemplate.d.ts +12 -0
- package/app/utils/easy-layout/types.d.ts +52 -0
- package/app/utils/easy-layout/validateAreas.d.ts +5 -0
- package/app/utils/index.d.ts +23 -0
- package/{src/common/TypeParsing → build}/TypeMapping.d.ts +8 -0
- package/build/TypeParsing.d.ts +10 -0
- package/build/index.d.ts +15 -0
- package/build/index.js +579 -0
- package/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +9 -0
- package/common/CommandLine/index.d.ts +6 -0
- package/common/HelperTypes.d.ts +9 -0
- package/common/IdGeneration/getSimpleId.d.ts +8 -0
- package/{src/common → common}/ItemRelationshipInfoTypes.d.ts +19 -1
- package/common/ItemRelationships/ItemRelationshipValidation.d.ts +21 -0
- package/common/Logging/Utils.d.ts +19 -0
- package/common/Routing.d.ts +67 -0
- package/common/SearchTypes.d.ts +248 -0
- package/common/SearchUtils.d.ts +55 -0
- package/{src/common → common}/SearchValidation.d.ts +10 -0
- package/{src/common → common}/StringTransformers.d.ts +11 -0
- package/common/Testing/CLI.d.ts +6 -0
- package/common/Testing/CLI.js +432 -0
- package/{src/common → common}/Testing/Types.d.ts +103 -4
- package/{src/common → common}/Testing/Utils.d.ts +65 -1
- package/common/Testing/index.d.ts +8 -0
- package/common/TypeInfoDataItemUtils.d.ts +39 -0
- package/common/TypeInfoORM/Types.d.ts +342 -0
- package/common/TypeParsing/Constants.d.ts +4 -0
- package/{src/common → common}/TypeParsing/ParsingUtils/Constants.d.ts +3 -0
- package/{src/common → common}/TypeParsing/ParsingUtils/checkType.d.ts +6 -0
- package/{src/common → common}/TypeParsing/ParsingUtils/checkUnionType.d.ts +6 -0
- package/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +8 -0
- package/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +14 -0
- package/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +18 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +9 -0
- package/{src/common → common}/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +6 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +8 -0
- package/{src/common → common}/TypeParsing/TypeInfo.d.ts +61 -1
- package/{src/common → common}/TypeParsing/Utils.d.ts +26 -0
- package/{src/common → common}/TypeParsing/Validation.d.ts +105 -0
- package/common/TypeParsing/index.d.ts +8 -0
- package/common/index.d.ts +50 -0
- package/common/index.js +413 -0
- package/{src/iac → iac}/SimpleCFT.d.ts +46 -2
- package/iac/index.d.ts +40 -0
- package/iac/index.js +258 -0
- package/iac/packs/auth/user-management.d.ts +80 -0
- package/iac/packs/auth.d.ts +86 -0
- package/iac/packs/build/utils.d.ts +289 -0
- package/iac/packs/build.d.ts +92 -0
- package/iac/packs/cdn.d.ts +33 -0
- package/iac/packs/cloud-function.d.ts +67 -0
- package/{src/iac → iac}/packs/database.d.ts +4 -1
- package/{src/iac → iac}/packs/dns.d.ts +22 -1
- package/iac/packs/file-storage.d.ts +46 -0
- package/iac/packs/gateway.d.ts +79 -0
- package/iac/packs/index.d.ts +60 -0
- package/iac/packs/index.js +1622 -0
- package/iac/packs/repo.d.ts +28 -0
- package/iac/packs/ssl-certificate.d.ts +28 -0
- package/{src/iac → iac}/types/Constants.d.ts +15 -0
- package/iac/types/Renderers.d.ts +96 -0
- package/iac/types/Types.d.ts +131 -0
- package/iac/types/Utils.d.ts +9 -0
- package/{src/iac → iac}/utils/index.d.ts +56 -5
- package/iac/utils/patch-utils.d.ts +66 -0
- package/native/forms/createNativeFormRenderer.d.ts +21 -0
- package/native/forms/index.d.ts +8 -0
- package/native/forms/primitives/index.d.ts +48 -0
- package/native/forms/suite.d.ts +15 -0
- package/native/index.d.ts +15 -0
- package/native/index.js +1311 -0
- package/native/utils/EasyLayout.d.ts +88 -0
- package/native/utils/History.d.ts +113 -0
- package/native/utils/NativeRoute.d.ts +44 -0
- package/native/utils/Route.d.ts +50 -0
- package/native/utils/index.d.ts +11 -0
- package/package.json +87 -42
- package/web/forms/UI.d.ts +67 -0
- package/web/forms/createWebFormRenderer.d.ts +21 -0
- package/web/forms/index.d.ts +9 -0
- package/web/forms/primitives/index.d.ts +21 -0
- package/web/forms/suite.d.ts +15 -0
- package/web/index.d.ts +15 -0
- package/web/index.js +1297 -0
- package/web/utils/EasyLayout.d.ts +47 -0
- package/web/utils/Route.d.ts +20 -0
- package/web/utils/index.d.ts +7 -0
- package/src/api/DataAccessControl.d.ts +0 -85
- package/src/api/DataAccessControl.js +0 -159
- package/src/api/ORM/DACUtils.d.ts +0 -60
- package/src/api/ORM/DACUtils.js +0 -197
- package/src/api/ORM/ListItemUtils.d.ts +0 -7
- package/src/api/ORM/ListItemUtils.js +0 -22
- package/src/api/ORM/ORMRouteMap.d.ts +0 -19
- package/src/api/ORM/ORMRouteMap.js +0 -82
- package/src/api/ORM/TypeInfoORMService.d.ts +0 -103
- package/src/api/ORM/TypeInfoORMService.js +0 -581
- package/src/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +0 -63
- package/src/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.js +0 -2
- package/src/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +0 -36
- package/src/api/ORM/drivers/DynamoDBDataItemDBDriver.js +0 -282
- package/src/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +0 -90
- package/src/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.js +0 -2
- package/src/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +0 -45
- package/src/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.js +0 -127
- package/src/api/ORM/drivers/S3FileItemDBDriver.js +0 -182
- package/src/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +0 -12
- package/src/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.js +0 -20
- package/src/api/ORM/drivers/common/Types.js +0 -14
- package/src/api/ORM/drivers/common/index.js +0 -18
- package/src/api/ORM/drivers/index.d.ts +0 -3
- package/src/api/ORM/drivers/index.js +0 -19
- package/src/api/ORM/index.d.ts +0 -4
- package/src/api/ORM/index.js +0 -43
- package/src/api/Router/AWS.d.ts +0 -26
- package/src/api/Router/AWS.js +0 -76
- package/src/api/Router/Auth.d.ts +0 -2
- package/src/api/Router/Auth.js +0 -9
- package/src/api/Router/CORS.d.ts +0 -6
- package/src/api/Router/CORS.js +0 -27
- package/src/api/Router/Types.js +0 -2
- package/src/api/Router/index.d.ts +0 -18
- package/src/api/Router/index.js +0 -145
- package/src/api/index.d.ts +0 -3
- package/src/api/index.js +0 -39
- package/src/app/index.d.ts +0 -1
- package/src/app/index.js +0 -37
- package/src/app/utils/ApplicationState.js +0 -86
- package/src/app/utils/ApplicationStateLoader.js +0 -57
- package/src/app/utils/Controller.d.ts +0 -4
- package/src/app/utils/Controller.js +0 -47
- package/src/app/utils/Debug.d.ts +0 -4
- package/src/app/utils/Debug.js +0 -30
- package/src/app/utils/EasyLayout.d.ts +0 -49
- package/src/app/utils/EasyLayout.js +0 -122
- package/src/app/utils/Route.d.ts +0 -28
- package/src/app/utils/Route.js +0 -102
- package/src/app/utils/Service.d.ts +0 -12
- package/src/app/utils/Service.js +0 -34
- package/src/app/utils/TypeInfoORMAPIUtils.d.ts +0 -20
- package/src/app/utils/TypeInfoORMAPIUtils.js +0 -62
- package/src/app/utils/TypeInfoORMClient.d.ts +0 -24
- package/src/app/utils/TypeInfoORMClient.js +0 -69
- package/src/app/utils/index.d.ts +0 -8
- package/src/app/utils/index.js +0 -24
- package/src/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +0 -1
- package/src/common/CommandLine/collectRequiredEnvironmentVariables.js +0 -16
- package/src/common/HelperTypes.d.ts +0 -3
- package/src/common/HelperTypes.js +0 -2
- package/src/common/IdGeneration/getSimpleId.d.ts +0 -4
- package/src/common/IdGeneration/getSimpleId.js +0 -16
- package/src/common/IdGeneration/index.js +0 -17
- package/src/common/ItemRelationshipInfoTypes.js +0 -20
- package/src/common/ItemRelationships/ItemRelationshipValidation.d.ts +0 -10
- package/src/common/ItemRelationships/ItemRelationshipValidation.js +0 -43
- package/src/common/ItemRelationships/index.js +0 -17
- package/src/common/Logging/Utils.d.ts +0 -10
- package/src/common/Logging/Utils.js +0 -33
- package/src/common/Logging/index.js +0 -17
- package/src/common/Routing.d.ts +0 -25
- package/src/common/Routing.js +0 -102
- package/src/common/SearchTypes.d.ts +0 -98
- package/src/common/SearchTypes.js +0 -39
- package/src/common/SearchUtils.d.ts +0 -22
- package/src/common/SearchUtils.js +0 -134
- package/src/common/SearchValidation.js +0 -90
- package/src/common/Storyboarding/Types.d.ts +0 -25
- package/src/common/Storyboarding/Types.js +0 -2
- package/src/common/StringTransformers.js +0 -36
- package/src/common/Testing/CLI.d.ts +0 -2
- package/src/common/Testing/CLI.js +0 -56
- package/src/common/Testing/Types.js +0 -19
- package/src/common/Testing/Utils.js +0 -334
- package/src/common/Testing/index.d.ts +0 -2
- package/src/common/Testing/index.js +0 -18
- package/src/common/TypeInfoDataItemUtils.d.ts +0 -10
- package/src/common/TypeInfoDataItemUtils.js +0 -55
- package/src/common/TypeInfoORM/Types.d.ts +0 -76
- package/src/common/TypeInfoORM/Types.js +0 -55
- package/src/common/TypeInfoORM/index.js +0 -17
- package/src/common/TypeParsing/Constants.d.ts +0 -1
- package/src/common/TypeParsing/Constants.js +0 -4
- package/src/common/TypeParsing/ParsingUtils/Constants.js +0 -8
- package/src/common/TypeParsing/ParsingUtils/checkType.js +0 -46
- package/src/common/TypeParsing/ParsingUtils/checkUnionType.js +0 -15
- package/src/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +0 -2
- package/src/common/TypeParsing/ParsingUtils/extractCommentTags.js +0 -105
- package/src/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +0 -6
- package/src/common/TypeParsing/ParsingUtils/extractLiteralValues.js +0 -42
- package/src/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +0 -8
- package/src/common/TypeParsing/ParsingUtils/extractTypeDetails.js +0 -14
- package/src/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +0 -5
- package/src/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.js +0 -27
- package/src/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +0 -3
- package/src/common/TypeParsing/ParsingUtils/getTypeInfo.js +0 -27
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoField.js +0 -44
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +0 -4
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.js +0 -28
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +0 -4
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.js +0 -105
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +0 -4
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.js +0 -20
- package/src/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +0 -3
- package/src/common/TypeParsing/ParsingUtils/getTypeKeyword.js +0 -17
- package/src/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +0 -4
- package/src/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.js +0 -49
- package/src/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +0 -2
- package/src/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.js +0 -24
- package/src/common/TypeParsing/TypeInfo.js +0 -13
- package/src/common/TypeParsing/TypeMapping.js +0 -32
- package/src/common/TypeParsing/TypeParsing.d.ts +0 -5
- package/src/common/TypeParsing/TypeParsing.js +0 -39
- package/src/common/TypeParsing/Utils.js +0 -94
- package/src/common/TypeParsing/Validation.js +0 -340
- package/src/common/TypeParsing/index.d.ts +0 -5
- package/src/common/TypeParsing/index.js +0 -44
- package/src/common/index.d.ts +0 -11
- package/src/common/index.js +0 -47
- package/src/iac/SimpleCFT.js +0 -82
- package/src/iac/index.d.ts +0 -9
- package/src/iac/index.js +0 -48
- package/src/iac/packs/auth/user-management.d.ts +0 -14
- package/src/iac/packs/auth/user-management.js +0 -302
- package/src/iac/packs/auth.d.ts +0 -19
- package/src/iac/packs/auth.js +0 -47
- package/src/iac/packs/build/utils.d.ts +0 -100
- package/src/iac/packs/build/utils.js +0 -23
- package/src/iac/packs/build.d.ts +0 -29
- package/src/iac/packs/build.js +0 -217
- package/src/iac/packs/cdn.d.ts +0 -12
- package/src/iac/packs/cdn.js +0 -113
- package/src/iac/packs/cloud-function.d.ts +0 -17
- package/src/iac/packs/cloud-function.js +0 -69
- package/src/iac/packs/database.js +0 -27
- package/src/iac/packs/dns.js +0 -26
- package/src/iac/packs/file-storage.d.ts +0 -14
- package/src/iac/packs/file-storage.js +0 -71
- package/src/iac/packs/gateway.d.ts +0 -27
- package/src/iac/packs/gateway.js +0 -342
- package/src/iac/packs/index.d.ts +0 -11
- package/src/iac/packs/index.js +0 -27
- package/src/iac/packs/repo.d.ts +0 -10
- package/src/iac/packs/repo.js +0 -34
- package/src/iac/packs/ssl-certificate.d.ts +0 -10
- package/src/iac/packs/ssl-certificate.js +0 -36
- package/src/iac/types/Constants.js +0 -20
- package/src/iac/types/IaCTypes.js +0 -14
- package/src/iac/types/Renderers.d.ts +0 -12
- package/src/iac/types/Renderers.js +0 -112
- package/src/iac/types/Types.d.ts +0 -37
- package/src/iac/types/Types.js +0 -2
- package/src/iac/types/Utils.d.ts +0 -2
- package/src/iac/types/Utils.js +0 -60
- package/src/iac/types/generate.js +0 -31
- package/src/iac/utils/index.js +0 -105
- package/src/iac/utils/patch-utils.d.ts +0 -15
- package/src/iac/utils/patch-utils.js +0 -62
- package/src/index.d.ts +0 -178
- package/src/index.js +0 -214
- /package/{src/api → api}/ORM/drivers/common/index.d.ts +0 -0
- /package/{src/common → common}/IdGeneration/index.d.ts +0 -0
- /package/{src/common → common}/ItemRelationships/index.d.ts +0 -0
- /package/{src/common → common}/Logging/index.d.ts +0 -0
- /package/{src/common → common}/TypeInfoORM/index.d.ts +0 -0
- /package/{src/iac → iac}/types/CloudFormationResourceSpecification.d.ts +0 -0
- /package/{src/iac → iac}/types/IaCTypes.d.ts +0 -0
- /package/{src/iac → iac}/types/generate.d.ts +0 -0
package/app/index.js
ADDED
|
@@ -0,0 +1,1386 @@
|
|
|
1
|
+
import { createContext, useContext, useRef, useMemo, useCallback, useState, useEffect } from 'react';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/app/utils/ApplicationState.tsx
|
|
5
|
+
var getApplicationStateIdentifier = (subStateIdMap) => subStateIdMap ? subStateIdMap : {};
|
|
6
|
+
var getApplicationStateModified = (identifier, modificationState) => !!modificationState.get(identifier);
|
|
7
|
+
var getApplicationStateValue = (identifier, applicationState) => applicationState.get(identifier);
|
|
8
|
+
var setApplicationStateModified = (identifier, value, modificationState) => new Map(modificationState).set(identifier, value);
|
|
9
|
+
var setApplicationStateValue = (identifier, value, applicationState) => new Map(applicationState).set(identifier, value);
|
|
10
|
+
var getApplicationStateValueStructure = (idStructure, applicationState) => Object.keys(idStructure).reduce(
|
|
11
|
+
(acc, k) => ({
|
|
12
|
+
...acc,
|
|
13
|
+
[k]: getApplicationStateValue(idStructure[k], applicationState)
|
|
14
|
+
}),
|
|
15
|
+
{}
|
|
16
|
+
);
|
|
17
|
+
var ApplicationStateContext = createContext({
|
|
18
|
+
modified: /* @__PURE__ */ new Map(),
|
|
19
|
+
value: /* @__PURE__ */ new Map(),
|
|
20
|
+
onChange: () => {
|
|
21
|
+
},
|
|
22
|
+
setModified: () => {
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
var { Provider } = ApplicationStateContext;
|
|
26
|
+
var useApplicationStateValue = (identifier) => {
|
|
27
|
+
const {
|
|
28
|
+
modified: modificationState,
|
|
29
|
+
value: applicationState,
|
|
30
|
+
onChange: setApplicationState,
|
|
31
|
+
setModified: setModificationState
|
|
32
|
+
} = useContext(ApplicationStateContext);
|
|
33
|
+
const appStateRef = useRef(applicationState);
|
|
34
|
+
appStateRef.current = applicationState;
|
|
35
|
+
const modified = useMemo(
|
|
36
|
+
() => getApplicationStateModified(identifier, modificationState),
|
|
37
|
+
[identifier, modificationState]
|
|
38
|
+
);
|
|
39
|
+
const value = useMemo(
|
|
40
|
+
() => getApplicationStateValue(identifier, applicationState),
|
|
41
|
+
[identifier, applicationState]
|
|
42
|
+
);
|
|
43
|
+
const setModified = useCallback(
|
|
44
|
+
(isModified) => {
|
|
45
|
+
setModificationState(
|
|
46
|
+
setApplicationStateModified(identifier, isModified, modificationState)
|
|
47
|
+
);
|
|
48
|
+
},
|
|
49
|
+
[identifier, setModificationState]
|
|
50
|
+
);
|
|
51
|
+
const onChange = useCallback(
|
|
52
|
+
(newValue) => {
|
|
53
|
+
setApplicationState(
|
|
54
|
+
setApplicationStateValue(identifier, newValue, appStateRef.current)
|
|
55
|
+
);
|
|
56
|
+
setModified(true);
|
|
57
|
+
},
|
|
58
|
+
[identifier, setApplicationState]
|
|
59
|
+
);
|
|
60
|
+
const controller = useMemo(
|
|
61
|
+
() => ({
|
|
62
|
+
modified,
|
|
63
|
+
value,
|
|
64
|
+
onChange,
|
|
65
|
+
setModified
|
|
66
|
+
}),
|
|
67
|
+
[modified, onChange, setModified, value]
|
|
68
|
+
);
|
|
69
|
+
return controller;
|
|
70
|
+
};
|
|
71
|
+
var useApplicationStateValueStructure = (idStructure) => {
|
|
72
|
+
const { value: applicationState, onChange: setApplicationState } = useContext(
|
|
73
|
+
ApplicationStateContext
|
|
74
|
+
);
|
|
75
|
+
const valueStructure = useMemo(
|
|
76
|
+
() => getApplicationStateValueStructure(idStructure, applicationState),
|
|
77
|
+
[applicationState, idStructure]
|
|
78
|
+
);
|
|
79
|
+
const onChangeStructure = useMemo(
|
|
80
|
+
() => Object.keys(idStructure).reduce(
|
|
81
|
+
(acc, k) => ({
|
|
82
|
+
...acc,
|
|
83
|
+
[k]: (newValue) => {
|
|
84
|
+
setApplicationState(
|
|
85
|
+
setApplicationStateValue(
|
|
86
|
+
idStructure[k],
|
|
87
|
+
newValue,
|
|
88
|
+
applicationState
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}),
|
|
93
|
+
{}
|
|
94
|
+
),
|
|
95
|
+
[applicationState, idStructure, setApplicationState]
|
|
96
|
+
);
|
|
97
|
+
const controller = useMemo(
|
|
98
|
+
() => ({
|
|
99
|
+
valueStructure,
|
|
100
|
+
onChangeStructure
|
|
101
|
+
}),
|
|
102
|
+
[onChangeStructure, valueStructure]
|
|
103
|
+
);
|
|
104
|
+
return controller;
|
|
105
|
+
};
|
|
106
|
+
var ApplicationStateProvider = ({
|
|
107
|
+
children
|
|
108
|
+
}) => {
|
|
109
|
+
const [modified, setModified] = useState(
|
|
110
|
+
/* @__PURE__ */ new Map()
|
|
111
|
+
);
|
|
112
|
+
const [value, setValue] = useState(/* @__PURE__ */ new Map());
|
|
113
|
+
const controller = useMemo(
|
|
114
|
+
() => ({
|
|
115
|
+
modified,
|
|
116
|
+
value,
|
|
117
|
+
onChange: setValue,
|
|
118
|
+
setModified
|
|
119
|
+
}),
|
|
120
|
+
[modified, value]
|
|
121
|
+
);
|
|
122
|
+
return /* @__PURE__ */ jsx(Provider, { value: controller, children });
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// src/common/Routing.ts
|
|
126
|
+
var PATH_DELIMITER = "/";
|
|
127
|
+
var getPotentialJSONValue = (value) => {
|
|
128
|
+
try {
|
|
129
|
+
return JSON.parse(value);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var getPathArray = (path, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriDecodeParts = true) => path.split(delimiter).filter(filterEmptyInput ? (p) => p !== "" : () => true).map(uriDecodeParts ? decodeURIComponent : (x) => x).map(useJson ? getPotentialJSONValue : (p) => p).filter(filterEmptyOutput ? (p) => p ?? false : () => true);
|
|
135
|
+
var getPathString = (parts = [], delimiter = PATH_DELIMITER, filterEmptyInput = false, useJson = true, uriEncodeParts = false) => parts.filter(filterEmptyInput ? (p) => p ?? false : () => true).map(useJson ? (p) => JSON.stringify(p) : (x) => x).map(uriEncodeParts ? encodeURIComponent : (x) => x).join(delimiter);
|
|
136
|
+
var mergeStringPaths = (path1, path2, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriEncodeParts = false) => getPathString(
|
|
137
|
+
[
|
|
138
|
+
...getPathArray(
|
|
139
|
+
path1,
|
|
140
|
+
delimiter,
|
|
141
|
+
filterEmptyOutput,
|
|
142
|
+
filterEmptyInput,
|
|
143
|
+
useJson,
|
|
144
|
+
uriEncodeParts
|
|
145
|
+
),
|
|
146
|
+
...getPathArray(
|
|
147
|
+
path2,
|
|
148
|
+
delimiter,
|
|
149
|
+
filterEmptyOutput,
|
|
150
|
+
filterEmptyInput,
|
|
151
|
+
useJson,
|
|
152
|
+
uriEncodeParts
|
|
153
|
+
)
|
|
154
|
+
],
|
|
155
|
+
delimiter,
|
|
156
|
+
filterEmptyInput,
|
|
157
|
+
useJson,
|
|
158
|
+
uriEncodeParts
|
|
159
|
+
);
|
|
160
|
+
var getParamsAndTestPath = (path, testPath, exact = false) => {
|
|
161
|
+
const pathList = getPathArray(path);
|
|
162
|
+
const testPathList = getPathArray(testPath);
|
|
163
|
+
if (exact && pathList.length !== testPathList.length) {
|
|
164
|
+
return false;
|
|
165
|
+
} else {
|
|
166
|
+
let params = {};
|
|
167
|
+
if (pathList.length >= testPathList.length) {
|
|
168
|
+
for (let i = 0; i < testPathList.length; i++) {
|
|
169
|
+
const testPathPart = testPathList[i];
|
|
170
|
+
const pathPart = pathList[i];
|
|
171
|
+
if (testPathPart.startsWith(":")) {
|
|
172
|
+
const paramName = testPathPart.slice(1);
|
|
173
|
+
params[paramName] = pathPart;
|
|
174
|
+
} else if (pathPart !== testPathPart) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
return params;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// src/app/utils/Service.ts
|
|
186
|
+
var getFullUrl = (protocol, domain, basePath = "", path = "", port) => {
|
|
187
|
+
const portString = !!port ? `:${port}` : "";
|
|
188
|
+
const fullPath = mergeStringPaths(
|
|
189
|
+
basePath,
|
|
190
|
+
path,
|
|
191
|
+
PATH_DELIMITER,
|
|
192
|
+
false,
|
|
193
|
+
false,
|
|
194
|
+
false
|
|
195
|
+
);
|
|
196
|
+
return `${protocol}://${domain}${portString}${fullPath}`;
|
|
197
|
+
};
|
|
198
|
+
var sendServiceRequest = async (config, path = "", args = []) => {
|
|
199
|
+
const { protocol, domain, port, basePath = "", authorization = "" } = config;
|
|
200
|
+
const fullUrl = getFullUrl(protocol, domain, basePath, path, port);
|
|
201
|
+
const requestHeaders = {
|
|
202
|
+
"Content-Type": "application/json",
|
|
203
|
+
...!!authorization ? {
|
|
204
|
+
Authorization: `Bearer ${authorization}`
|
|
205
|
+
} : {}
|
|
206
|
+
};
|
|
207
|
+
const response = await fetch(fullUrl, {
|
|
208
|
+
headers: requestHeaders,
|
|
209
|
+
credentials: "same-origin",
|
|
210
|
+
method: "POST",
|
|
211
|
+
body: JSON.stringify(args)
|
|
212
|
+
});
|
|
213
|
+
const { ok: responseIsOk } = response;
|
|
214
|
+
const data = await response.json();
|
|
215
|
+
if (responseIsOk) {
|
|
216
|
+
return data;
|
|
217
|
+
} else {
|
|
218
|
+
throw data;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
var useApplicationStateLoader = (config) => {
|
|
222
|
+
const {
|
|
223
|
+
identifier,
|
|
224
|
+
remoteProcedureCall,
|
|
225
|
+
resetOnError = false,
|
|
226
|
+
onLoadComplete,
|
|
227
|
+
manual = false
|
|
228
|
+
} = config;
|
|
229
|
+
const { args = [] } = remoteProcedureCall;
|
|
230
|
+
const argsRef = useRef(args);
|
|
231
|
+
argsRef.current = args;
|
|
232
|
+
const [cacheValidity, setCacheValidity] = useState({});
|
|
233
|
+
const [loading, setLoading] = useState(false);
|
|
234
|
+
const [latestError, setLatestError] = useState();
|
|
235
|
+
const { onChange, setModified } = useApplicationStateValue(identifier);
|
|
236
|
+
const invalidate = useCallback(() => {
|
|
237
|
+
setCacheValidity({});
|
|
238
|
+
}, []);
|
|
239
|
+
const makeRemoteProcedureCall = useCallback(
|
|
240
|
+
async (...directArgs) => {
|
|
241
|
+
let success;
|
|
242
|
+
setLoading(true);
|
|
243
|
+
setLatestError(void 0);
|
|
244
|
+
try {
|
|
245
|
+
const { serviceConfig, path } = remoteProcedureCall;
|
|
246
|
+
const result = await sendServiceRequest(
|
|
247
|
+
serviceConfig,
|
|
248
|
+
path,
|
|
249
|
+
directArgs
|
|
250
|
+
);
|
|
251
|
+
success = true;
|
|
252
|
+
onChange(result);
|
|
253
|
+
setModified(false);
|
|
254
|
+
} catch (error) {
|
|
255
|
+
success = false;
|
|
256
|
+
setLatestError(error);
|
|
257
|
+
if (resetOnError) {
|
|
258
|
+
onChange(void 0);
|
|
259
|
+
setModified(false);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
setLoading(false);
|
|
263
|
+
onLoadComplete?.(success);
|
|
264
|
+
},
|
|
265
|
+
[remoteProcedureCall, onChange, setModified, resetOnError, onLoadComplete]
|
|
266
|
+
);
|
|
267
|
+
const appStateLoader = useMemo(
|
|
268
|
+
() => ({
|
|
269
|
+
loading,
|
|
270
|
+
latestError,
|
|
271
|
+
invalidate,
|
|
272
|
+
makeRemoteProcedureCall
|
|
273
|
+
}),
|
|
274
|
+
[loading, latestError, invalidate, makeRemoteProcedureCall]
|
|
275
|
+
);
|
|
276
|
+
useEffect(() => {
|
|
277
|
+
if (!manual && argsRef.current) {
|
|
278
|
+
makeRemoteProcedureCall(...argsRef.current);
|
|
279
|
+
}
|
|
280
|
+
}, [cacheValidity, manual, makeRemoteProcedureCall]);
|
|
281
|
+
return appStateLoader;
|
|
282
|
+
};
|
|
283
|
+
var getKeyValueWithoutError = (obj, key) => {
|
|
284
|
+
try {
|
|
285
|
+
return obj[key];
|
|
286
|
+
} catch (e) {
|
|
287
|
+
return void 0;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
var useController = (parentValue, key, onParentValueChange, isArrayIndex = false) => {
|
|
291
|
+
const [value, setValue] = useState(getKeyValueWithoutError(parentValue, key));
|
|
292
|
+
const onChange = useCallback(
|
|
293
|
+
(value2) => {
|
|
294
|
+
try {
|
|
295
|
+
setValue(value2);
|
|
296
|
+
if (isArrayIndex) {
|
|
297
|
+
const newArray = [...parentValue];
|
|
298
|
+
newArray[key] = value2;
|
|
299
|
+
onParentValueChange(newArray);
|
|
300
|
+
} else {
|
|
301
|
+
onParentValueChange({
|
|
302
|
+
...parentValue,
|
|
303
|
+
[key]: value2
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
} catch (e) {
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
[parentValue, key, onParentValueChange, isArrayIndex]
|
|
310
|
+
);
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
try {
|
|
313
|
+
setValue(getKeyValueWithoutError(parentValue, key));
|
|
314
|
+
} catch (e) {
|
|
315
|
+
setValue(void 0);
|
|
316
|
+
}
|
|
317
|
+
}, [parentValue, key]);
|
|
318
|
+
return [value, onChange];
|
|
319
|
+
};
|
|
320
|
+
var getChangedDependencyIndexes = (prevDeps, nextDeps) => nextDeps.map((dep, i) => dep !== prevDeps[i] ? i : null).filter((dep) => dep !== null);
|
|
321
|
+
var useDebugDependencies = (dependencies) => {
|
|
322
|
+
const firstRender = useRef(true);
|
|
323
|
+
const prevDeps = useRef(dependencies);
|
|
324
|
+
useEffect(() => {
|
|
325
|
+
if (firstRender.current) {
|
|
326
|
+
firstRender.current = false;
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const changedDeps = getChangedDependencyIndexes(
|
|
330
|
+
prevDeps.current,
|
|
331
|
+
dependencies
|
|
332
|
+
);
|
|
333
|
+
if (changedDeps.length > 0) {
|
|
334
|
+
console.log("Changed dependencies:", changedDeps);
|
|
335
|
+
}
|
|
336
|
+
prevDeps.current = dependencies;
|
|
337
|
+
}, dependencies);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// src/app/utils/easy-layout/parseTemplate.ts
|
|
341
|
+
var parseTrackSpec = (token) => {
|
|
342
|
+
const trimmed = token.trim();
|
|
343
|
+
const numericMatch = trimmed.match(/^([0-9]*\.?[0-9]+)(fr|px|%)$/);
|
|
344
|
+
if (!numericMatch) {
|
|
345
|
+
throw new Error(
|
|
346
|
+
`Invalid track token "${trimmed}". Supported units are fr, px, and %.`
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
const value = Number(numericMatch[1]);
|
|
350
|
+
const suffix = numericMatch[2];
|
|
351
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
352
|
+
throw new Error(`Track value must be a non-negative number. Received "${trimmed}".`);
|
|
353
|
+
}
|
|
354
|
+
if (suffix === "fr") {
|
|
355
|
+
return { kind: "fr", value };
|
|
356
|
+
}
|
|
357
|
+
if (suffix === "px") {
|
|
358
|
+
return { kind: "px", value };
|
|
359
|
+
}
|
|
360
|
+
return { kind: "pct", value };
|
|
361
|
+
};
|
|
362
|
+
var normalizeAreas = (areaPart) => {
|
|
363
|
+
return areaPart.trim().split(/\s+/g).map((token) => token.trim()).filter(Boolean);
|
|
364
|
+
};
|
|
365
|
+
var parseTemplate = (template = "") => {
|
|
366
|
+
const lines = template.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
367
|
+
const areaGrid = [];
|
|
368
|
+
const rowTracks = [];
|
|
369
|
+
let colTracks = null;
|
|
370
|
+
for (const line of lines) {
|
|
371
|
+
if (line.startsWith("\\")) {
|
|
372
|
+
if (colTracks) {
|
|
373
|
+
throw new Error("Template can include only one column-track line.");
|
|
374
|
+
}
|
|
375
|
+
const colTokens = line.replace(/\\/g, " ").trim().split(/\s+/g).filter(Boolean);
|
|
376
|
+
colTracks = colTokens.map(parseTrackSpec);
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
const parts = line.split(",").map((part) => part.trim());
|
|
380
|
+
const areaPart = parts[0] || "";
|
|
381
|
+
if (!areaPart) {
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (parts.length > 2) {
|
|
385
|
+
throw new Error(
|
|
386
|
+
`Invalid row definition "${line}". Expected "<areas>, <row-track>".`
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
const areas = normalizeAreas(areaPart);
|
|
390
|
+
if (!areas.length) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
areaGrid.push(areas);
|
|
394
|
+
const rowTrack = parts[1];
|
|
395
|
+
if (rowTrack) {
|
|
396
|
+
rowTracks.push(parseTrackSpec(rowTrack));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (!areaGrid.length) {
|
|
400
|
+
throw new Error("Template must include at least one area row.");
|
|
401
|
+
}
|
|
402
|
+
const expectedWidth = areaGrid[0].length;
|
|
403
|
+
for (let rowIndex = 0; rowIndex < areaGrid.length; rowIndex++) {
|
|
404
|
+
const width = areaGrid[rowIndex].length;
|
|
405
|
+
if (width !== expectedWidth) {
|
|
406
|
+
throw new Error(
|
|
407
|
+
`All area rows must have the same width. Expected ${expectedWidth}, received ${width} at row ${rowIndex + 1}.`
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (colTracks && colTracks.length !== expectedWidth) {
|
|
412
|
+
throw new Error(
|
|
413
|
+
`Column track count must match area width. Expected ${expectedWidth}, received ${colTracks.length}.`
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
const areaNames = Array.from(
|
|
417
|
+
new Set(
|
|
418
|
+
areaGrid.flat().map((name) => name.trim()).filter((name) => !!name && name !== ".")
|
|
419
|
+
)
|
|
420
|
+
);
|
|
421
|
+
return {
|
|
422
|
+
areaGrid,
|
|
423
|
+
rowTracks,
|
|
424
|
+
colTracks: colTracks || [],
|
|
425
|
+
areaNames
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
// src/app/utils/easy-layout/computeAreaBounds.ts
|
|
430
|
+
var computeAreaBounds = (parsed) => {
|
|
431
|
+
const result = {};
|
|
432
|
+
for (let rowIndex = 0; rowIndex < parsed.areaGrid.length; rowIndex++) {
|
|
433
|
+
const row = parsed.areaGrid[rowIndex];
|
|
434
|
+
for (let colIndex = 0; colIndex < row.length; colIndex++) {
|
|
435
|
+
const name = row[colIndex];
|
|
436
|
+
if (!name || name === ".") {
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
const row1 = rowIndex + 1;
|
|
440
|
+
const col1 = colIndex + 1;
|
|
441
|
+
const existing = result[name];
|
|
442
|
+
if (!existing) {
|
|
443
|
+
result[name] = {
|
|
444
|
+
name,
|
|
445
|
+
rowStart: row1,
|
|
446
|
+
rowEnd: row1,
|
|
447
|
+
colStart: col1,
|
|
448
|
+
colEnd: col1
|
|
449
|
+
};
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
existing.rowStart = Math.min(existing.rowStart, row1);
|
|
453
|
+
existing.rowEnd = Math.max(existing.rowEnd, row1);
|
|
454
|
+
existing.colStart = Math.min(existing.colStart, col1);
|
|
455
|
+
existing.colEnd = Math.max(existing.colEnd, col1);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return result;
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// src/app/utils/easy-layout/validateAreas.ts
|
|
462
|
+
var validateAreas = (parsed) => {
|
|
463
|
+
const bounds = computeAreaBounds(parsed);
|
|
464
|
+
for (const areaName of parsed.areaNames) {
|
|
465
|
+
const bound = bounds[areaName];
|
|
466
|
+
if (!bound) {
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
for (let row = bound.rowStart; row <= bound.rowEnd; row++) {
|
|
470
|
+
for (let col = bound.colStart; col <= bound.colEnd; col++) {
|
|
471
|
+
const token = parsed.areaGrid[row - 1]?.[col - 1];
|
|
472
|
+
if (token !== areaName) {
|
|
473
|
+
throw new Error(
|
|
474
|
+
`Area "${areaName}" must be a rectangle. Missing "${areaName}" at row ${row}, col ${col}.`
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
// src/app/utils/EasyLayout.tsx
|
|
483
|
+
var getPascalCaseAreaName = (area) => {
|
|
484
|
+
return area.split("-").map((a) => a[0].toUpperCase() + a.slice(1)).join("");
|
|
485
|
+
};
|
|
486
|
+
var convertLayoutToCSS = (layout = "", spacing = {}) => {
|
|
487
|
+
const parsed = parseTemplate(layout);
|
|
488
|
+
validateAreas(parsed);
|
|
489
|
+
const renderTrack = (track) => {
|
|
490
|
+
if (track.kind === "px") {
|
|
491
|
+
return `${track.value}px`;
|
|
492
|
+
}
|
|
493
|
+
if (track.kind === "pct") {
|
|
494
|
+
return `${track.value}%`;
|
|
495
|
+
}
|
|
496
|
+
return `${track.value}fr`;
|
|
497
|
+
};
|
|
498
|
+
const areaRows = parsed.areaGrid.map((row) => row.join(" "));
|
|
499
|
+
const rows = parsed.rowTracks.map(renderTrack);
|
|
500
|
+
let css = "";
|
|
501
|
+
if (parsed.colTracks.length) {
|
|
502
|
+
css += `
|
|
503
|
+
grid-template-columns: ${parsed.colTracks.map(renderTrack).join(" ")};`;
|
|
504
|
+
}
|
|
505
|
+
css += `
|
|
506
|
+
grid-template-areas:
|
|
507
|
+
${areaRows.map((a) => ` "${a}"`).join("\n")};`;
|
|
508
|
+
if (rows.length) {
|
|
509
|
+
css += `
|
|
510
|
+
grid-template-rows: ${rows.join(" ")};`;
|
|
511
|
+
}
|
|
512
|
+
if (typeof spacing.gap !== "undefined") {
|
|
513
|
+
css += `
|
|
514
|
+
gap: ${typeof spacing.gap === "number" ? `${spacing.gap}px` : spacing.gap};`;
|
|
515
|
+
}
|
|
516
|
+
if (typeof spacing.padding !== "undefined") {
|
|
517
|
+
css += `
|
|
518
|
+
padding: ${typeof spacing.padding === "number" ? `${spacing.padding}px` : spacing.padding};`;
|
|
519
|
+
}
|
|
520
|
+
return {
|
|
521
|
+
areasList: parsed.areaNames,
|
|
522
|
+
css
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
var getEasyLayoutTemplateDetails = (layout = "", spacing = {}) => convertLayoutToCSS(layout, spacing);
|
|
526
|
+
var createEasyLayout = (config, extendFrom, areasExtendFrom, spacing = {}) => {
|
|
527
|
+
return (layoutTemplate, ...expressions) => {
|
|
528
|
+
const mergedTemplate = layoutTemplate.reduce((acc, l, ind) => {
|
|
529
|
+
const expr = expressions[ind - 1];
|
|
530
|
+
const exprStr = typeof expr === "undefined" ? "" : expr;
|
|
531
|
+
return `${acc}${l}${exprStr}`;
|
|
532
|
+
}, "");
|
|
533
|
+
const { areasList, css } = convertLayoutToCSS(mergedTemplate, spacing);
|
|
534
|
+
const layout = config.createLayout({ base: extendFrom, css });
|
|
535
|
+
const areas = areasList.reduce((acc, area) => {
|
|
536
|
+
const pascalCaseAreaName = getPascalCaseAreaName(area);
|
|
537
|
+
const component = config.createArea({ base: areasExtendFrom, area });
|
|
538
|
+
return {
|
|
539
|
+
...acc,
|
|
540
|
+
[pascalCaseAreaName]: component
|
|
541
|
+
};
|
|
542
|
+
}, {});
|
|
543
|
+
return {
|
|
544
|
+
layout,
|
|
545
|
+
areas
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// src/app/utils/easy-layout/computeTracks.ts
|
|
551
|
+
var computeTrackPixels = ({
|
|
552
|
+
tracks,
|
|
553
|
+
totalPx,
|
|
554
|
+
gapPx = 0,
|
|
555
|
+
paddingPx = 0
|
|
556
|
+
}) => {
|
|
557
|
+
if (!tracks.length) {
|
|
558
|
+
return [];
|
|
559
|
+
}
|
|
560
|
+
const gapsPx = Math.max(0, tracks.length - 1) * Math.max(0, gapPx);
|
|
561
|
+
const usablePx = Math.max(0, totalPx - Math.max(0, paddingPx) * 2 - gapsPx);
|
|
562
|
+
let fixedPx = 0;
|
|
563
|
+
let frTotal = 0;
|
|
564
|
+
for (const track of tracks) {
|
|
565
|
+
if (track.kind === "px") {
|
|
566
|
+
fixedPx += track.value;
|
|
567
|
+
} else if (track.kind === "pct") {
|
|
568
|
+
fixedPx += usablePx * track.value / 100;
|
|
569
|
+
} else {
|
|
570
|
+
frTotal += track.value;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const remainderPx = Math.max(0, usablePx - fixedPx);
|
|
574
|
+
return tracks.map((track) => {
|
|
575
|
+
if (track.kind === "px") {
|
|
576
|
+
return track.value;
|
|
577
|
+
}
|
|
578
|
+
if (track.kind === "pct") {
|
|
579
|
+
return usablePx * track.value / 100;
|
|
580
|
+
}
|
|
581
|
+
if (frTotal <= 0) {
|
|
582
|
+
return 0;
|
|
583
|
+
}
|
|
584
|
+
return remainderPx * track.value / frTotal;
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// src/app/utils/History.ts
|
|
589
|
+
var ensurePrefix = (value, prefix) => value ? value.startsWith(prefix) ? value : `${prefix}${value}` : "";
|
|
590
|
+
var parseHistoryPath = (inputPath) => {
|
|
591
|
+
const raw = String(inputPath ?? "").trim();
|
|
592
|
+
if (!raw) {
|
|
593
|
+
return { path: "/" };
|
|
594
|
+
}
|
|
595
|
+
try {
|
|
596
|
+
const absoluteUrl = new URL(raw);
|
|
597
|
+
return {
|
|
598
|
+
path: absoluteUrl.pathname || "/",
|
|
599
|
+
...absoluteUrl.search ? { search: absoluteUrl.search } : {},
|
|
600
|
+
...absoluteUrl.hash ? { hash: absoluteUrl.hash } : {}
|
|
601
|
+
};
|
|
602
|
+
} catch (error) {
|
|
603
|
+
let target = raw;
|
|
604
|
+
let hash = "";
|
|
605
|
+
let search = "";
|
|
606
|
+
const hashIndex = target.indexOf("#");
|
|
607
|
+
if (hashIndex >= 0) {
|
|
608
|
+
hash = target.slice(hashIndex);
|
|
609
|
+
target = target.slice(0, hashIndex);
|
|
610
|
+
}
|
|
611
|
+
const searchIndex = target.indexOf("?");
|
|
612
|
+
if (searchIndex >= 0) {
|
|
613
|
+
search = target.slice(searchIndex);
|
|
614
|
+
target = target.slice(0, searchIndex);
|
|
615
|
+
}
|
|
616
|
+
const path = target ? target.startsWith("/") ? target : `/${target}` : "/";
|
|
617
|
+
return {
|
|
618
|
+
path,
|
|
619
|
+
...search && search !== "?" ? { search } : {},
|
|
620
|
+
...hash && hash !== "#" ? { hash } : {}
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
var buildHistoryPath = ({
|
|
625
|
+
path,
|
|
626
|
+
search,
|
|
627
|
+
hash
|
|
628
|
+
}) => {
|
|
629
|
+
const normalizedPath = path ? path.startsWith("/") ? path : `/${path}` : "/";
|
|
630
|
+
const normalizedSearch = search ? ensurePrefix(search, "?") : "";
|
|
631
|
+
const normalizedHash = hash ? ensurePrefix(hash, "#") : "";
|
|
632
|
+
return `${normalizedPath}${normalizedSearch}${normalizedHash}`;
|
|
633
|
+
};
|
|
634
|
+
var getHistoryLocation = (inputPath, state, getNextKey, currentLocation, replaceSearch = false) => {
|
|
635
|
+
const parsed = parseHistoryPath(inputPath);
|
|
636
|
+
const nextSearch = typeof parsed.search === "undefined" ? replaceSearch ? void 0 : currentLocation?.search : parsed.search;
|
|
637
|
+
return {
|
|
638
|
+
path: parsed.path,
|
|
639
|
+
...typeof nextSearch !== "undefined" ? { search: nextSearch } : {},
|
|
640
|
+
...parsed.hash ? { hash: parsed.hash } : {},
|
|
641
|
+
...typeof state !== "undefined" ? { state } : {},
|
|
642
|
+
key: getNextKey()
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
var createMemoryHistory = (initialPath = "/") => {
|
|
646
|
+
let keyCounter = 0;
|
|
647
|
+
const getNextKey = () => `h${keyCounter++}`;
|
|
648
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
649
|
+
const entries = [
|
|
650
|
+
{
|
|
651
|
+
location: getHistoryLocation(
|
|
652
|
+
initialPath,
|
|
653
|
+
void 0,
|
|
654
|
+
getNextKey,
|
|
655
|
+
void 0,
|
|
656
|
+
true
|
|
657
|
+
)
|
|
658
|
+
}
|
|
659
|
+
];
|
|
660
|
+
let currentIndex = 0;
|
|
661
|
+
const getCurrentLocation = () => entries[currentIndex].location;
|
|
662
|
+
const notify = () => {
|
|
663
|
+
const location = getCurrentLocation();
|
|
664
|
+
listeners.forEach((listener) => listener(location));
|
|
665
|
+
};
|
|
666
|
+
const push = (path, opts) => {
|
|
667
|
+
const location = getHistoryLocation(
|
|
668
|
+
path,
|
|
669
|
+
opts?.state,
|
|
670
|
+
getNextKey,
|
|
671
|
+
getCurrentLocation(),
|
|
672
|
+
opts?.replaceSearch === true
|
|
673
|
+
);
|
|
674
|
+
if (currentIndex < entries.length - 1) {
|
|
675
|
+
entries.splice(currentIndex + 1);
|
|
676
|
+
}
|
|
677
|
+
entries.push({ location });
|
|
678
|
+
currentIndex = entries.length - 1;
|
|
679
|
+
notify();
|
|
680
|
+
};
|
|
681
|
+
const replace = (path, opts) => {
|
|
682
|
+
const location = getHistoryLocation(
|
|
683
|
+
path,
|
|
684
|
+
opts?.state,
|
|
685
|
+
getNextKey,
|
|
686
|
+
getCurrentLocation(),
|
|
687
|
+
opts?.replaceSearch === true
|
|
688
|
+
);
|
|
689
|
+
entries[currentIndex] = { location };
|
|
690
|
+
notify();
|
|
691
|
+
};
|
|
692
|
+
const go = (delta) => {
|
|
693
|
+
if (!Number.isFinite(delta)) {
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
const targetIndex = Math.max(
|
|
697
|
+
0,
|
|
698
|
+
Math.min(entries.length - 1, currentIndex + Math.trunc(delta))
|
|
699
|
+
);
|
|
700
|
+
if (targetIndex === currentIndex) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
currentIndex = targetIndex;
|
|
704
|
+
notify();
|
|
705
|
+
};
|
|
706
|
+
return {
|
|
707
|
+
get location() {
|
|
708
|
+
return getCurrentLocation();
|
|
709
|
+
},
|
|
710
|
+
get length() {
|
|
711
|
+
return entries.length;
|
|
712
|
+
},
|
|
713
|
+
get index() {
|
|
714
|
+
return currentIndex;
|
|
715
|
+
},
|
|
716
|
+
push,
|
|
717
|
+
replace,
|
|
718
|
+
go,
|
|
719
|
+
back: () => go(-1),
|
|
720
|
+
forward: () => go(1),
|
|
721
|
+
listen: (listener) => {
|
|
722
|
+
listeners.add(listener);
|
|
723
|
+
return () => listeners.delete(listener);
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
var createManualRouteAdapter = (initialPath = "/") => {
|
|
728
|
+
let currentPath = initialPath;
|
|
729
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
730
|
+
const updatePath = (nextPath) => {
|
|
731
|
+
currentPath = nextPath;
|
|
732
|
+
listeners.forEach((listener) => listener(nextPath));
|
|
733
|
+
};
|
|
734
|
+
const adapter = {
|
|
735
|
+
getPath: () => currentPath,
|
|
736
|
+
subscribe: (listener) => {
|
|
737
|
+
listeners.add(listener);
|
|
738
|
+
return () => {
|
|
739
|
+
listeners.delete(listener);
|
|
740
|
+
};
|
|
741
|
+
},
|
|
742
|
+
push: (path) => updatePath(path),
|
|
743
|
+
replace: (path) => updatePath(path)
|
|
744
|
+
};
|
|
745
|
+
return {
|
|
746
|
+
adapter,
|
|
747
|
+
updatePath
|
|
748
|
+
};
|
|
749
|
+
};
|
|
750
|
+
var buildQueryString = (query = {}) => {
|
|
751
|
+
const parts = [];
|
|
752
|
+
for (const [key, rawValue] of Object.entries(query)) {
|
|
753
|
+
if (rawValue === void 0) {
|
|
754
|
+
continue;
|
|
755
|
+
}
|
|
756
|
+
const values = Array.isArray(rawValue) ? rawValue : [rawValue];
|
|
757
|
+
for (const value of values) {
|
|
758
|
+
if (value === void 0) {
|
|
759
|
+
continue;
|
|
760
|
+
}
|
|
761
|
+
const encodedKey = encodeURIComponent(key);
|
|
762
|
+
const encodedValue = value === null ? "" : encodeURIComponent(String(value));
|
|
763
|
+
parts.push(`${encodedKey}=${encodedValue}`);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
return parts.join("&");
|
|
767
|
+
};
|
|
768
|
+
var buildRoutePath = (segments, query) => {
|
|
769
|
+
const normalizedSegments = segments.map((segment) => String(segment));
|
|
770
|
+
const basePath = "/" + getPathString(normalizedSegments, "/", true, false, true);
|
|
771
|
+
const queryString = query ? buildQueryString(query) : "";
|
|
772
|
+
return queryString ? `${basePath}?${queryString}` : basePath;
|
|
773
|
+
};
|
|
774
|
+
var RouteContext = createContext({
|
|
775
|
+
currentWindowPath: "",
|
|
776
|
+
parentPath: "",
|
|
777
|
+
params: {},
|
|
778
|
+
isTopLevel: true
|
|
779
|
+
});
|
|
780
|
+
var {
|
|
781
|
+
/**
|
|
782
|
+
* @ignore
|
|
783
|
+
*/
|
|
784
|
+
Provider: RouteContextProvider,
|
|
785
|
+
/**
|
|
786
|
+
* @ignore
|
|
787
|
+
*/
|
|
788
|
+
Consumer: RouteContextConsumer
|
|
789
|
+
} = RouteContext;
|
|
790
|
+
var useRouteContext = () => useContext(RouteContext);
|
|
791
|
+
var RouteProvider = ({
|
|
792
|
+
adapter,
|
|
793
|
+
initialPath,
|
|
794
|
+
children
|
|
795
|
+
}) => {
|
|
796
|
+
const [currentPath, setCurrentPath] = useState(
|
|
797
|
+
initialPath ?? adapter.getPath()
|
|
798
|
+
);
|
|
799
|
+
useEffect(() => {
|
|
800
|
+
return adapter.subscribe((nextPath) => {
|
|
801
|
+
setCurrentPath(nextPath);
|
|
802
|
+
});
|
|
803
|
+
}, [adapter]);
|
|
804
|
+
const contextValue = useMemo(
|
|
805
|
+
() => ({
|
|
806
|
+
currentWindowPath: currentPath,
|
|
807
|
+
parentPath: "",
|
|
808
|
+
params: {},
|
|
809
|
+
isTopLevel: true,
|
|
810
|
+
adapter
|
|
811
|
+
}),
|
|
812
|
+
[currentPath, adapter]
|
|
813
|
+
);
|
|
814
|
+
return /* @__PURE__ */ jsx(RouteContextProvider, { value: contextValue, children });
|
|
815
|
+
};
|
|
816
|
+
var Route = ({
|
|
817
|
+
/**
|
|
818
|
+
* Use `:` as the first character to denote a parameter in the path.
|
|
819
|
+
*/
|
|
820
|
+
path = "",
|
|
821
|
+
onParamsChange,
|
|
822
|
+
exact = false,
|
|
823
|
+
children
|
|
824
|
+
}) => {
|
|
825
|
+
const {
|
|
826
|
+
currentWindowPath = "",
|
|
827
|
+
parentPath = "",
|
|
828
|
+
params: parentParams = {},
|
|
829
|
+
adapter
|
|
830
|
+
} = useRouteContext();
|
|
831
|
+
const targetCurrentPath = useMemo(
|
|
832
|
+
() => currentWindowPath,
|
|
833
|
+
[currentWindowPath]
|
|
834
|
+
);
|
|
835
|
+
const fullPath = useMemo(
|
|
836
|
+
() => mergeStringPaths(parentPath, path),
|
|
837
|
+
[parentPath, path]
|
|
838
|
+
);
|
|
839
|
+
const newParams = useMemo(
|
|
840
|
+
() => getParamsAndTestPath(targetCurrentPath, fullPath, exact),
|
|
841
|
+
[targetCurrentPath, fullPath, exact]
|
|
842
|
+
);
|
|
843
|
+
const params = useMemo(
|
|
844
|
+
() => ({
|
|
845
|
+
...parentParams,
|
|
846
|
+
...newParams ? newParams : {}
|
|
847
|
+
}),
|
|
848
|
+
[parentParams, newParams]
|
|
849
|
+
);
|
|
850
|
+
const newRouteContext = useMemo(
|
|
851
|
+
() => ({
|
|
852
|
+
currentWindowPath: targetCurrentPath,
|
|
853
|
+
parentPath: fullPath,
|
|
854
|
+
params,
|
|
855
|
+
isTopLevel: false,
|
|
856
|
+
adapter
|
|
857
|
+
}),
|
|
858
|
+
[targetCurrentPath, fullPath, params, adapter]
|
|
859
|
+
);
|
|
860
|
+
useEffect(() => {
|
|
861
|
+
if (onParamsChange) {
|
|
862
|
+
onParamsChange(params);
|
|
863
|
+
}
|
|
864
|
+
}, [params, onParamsChange]);
|
|
865
|
+
return newParams ? /* @__PURE__ */ jsx(RouteContextProvider, { value: newRouteContext, children }) : null;
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
// src/app/utils/RouteHistory.ts
|
|
869
|
+
var createRouteAdapterFromHistory = (history) => {
|
|
870
|
+
return {
|
|
871
|
+
getPath: () => history.location.path,
|
|
872
|
+
subscribe: (listener) => {
|
|
873
|
+
return history.listen((location) => {
|
|
874
|
+
listener(location.path);
|
|
875
|
+
});
|
|
876
|
+
},
|
|
877
|
+
push: (path) => {
|
|
878
|
+
history.push(path, { replaceSearch: true });
|
|
879
|
+
},
|
|
880
|
+
replace: (path) => {
|
|
881
|
+
history.replace(path, { replaceSearch: true });
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
// src/common/IdGeneration/getSimpleId.ts
|
|
887
|
+
var LAST_HAST_ID = 0;
|
|
888
|
+
var textEncoder = new TextEncoder();
|
|
889
|
+
var bytesToBinaryString = (bytes) => {
|
|
890
|
+
let out = "";
|
|
891
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
892
|
+
out += String.fromCharCode(bytes[i]);
|
|
893
|
+
}
|
|
894
|
+
return out;
|
|
895
|
+
};
|
|
896
|
+
var getBase64EncodedString = (input) => {
|
|
897
|
+
const bytes = textEncoder.encode(input);
|
|
898
|
+
let base64 = "";
|
|
899
|
+
if (typeof globalThis.btoa === "function") {
|
|
900
|
+
const binary = bytesToBinaryString(bytes);
|
|
901
|
+
base64 = globalThis.btoa(binary);
|
|
902
|
+
} else {
|
|
903
|
+
const anyGlobal = globalThis;
|
|
904
|
+
if (typeof anyGlobal.Buffer === "function") {
|
|
905
|
+
base64 = anyGlobal.Buffer.from(bytes).toString("base64");
|
|
906
|
+
} else {
|
|
907
|
+
throw new Error("No base64 encoder available (need btoa or Buffer).");
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return base64;
|
|
911
|
+
};
|
|
912
|
+
var getSimpleId = () => {
|
|
913
|
+
const hashId = LAST_HAST_ID++;
|
|
914
|
+
const base64Datetime = getBase64EncodedString(
|
|
915
|
+
(/* @__PURE__ */ new Date()).toISOString()
|
|
916
|
+
);
|
|
917
|
+
const rand1 = Math.random().toString(36).substring(2, 15);
|
|
918
|
+
const rand2 = Math.random().toString(36).substring(2, 15);
|
|
919
|
+
return `${hashId}-${base64Datetime}-${rand1}-${rand2}`;
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
// src/app/utils/TypeInfoORMAPIUtils.ts
|
|
923
|
+
var handleRequest = async (requestId, args, typeInfoORMAPI, methodName, onRequestStateChange) => {
|
|
924
|
+
onRequestStateChange(methodName, requestId, { loading: true });
|
|
925
|
+
try {
|
|
926
|
+
const requestMethod = typeInfoORMAPI[methodName];
|
|
927
|
+
const result = await requestMethod(...args);
|
|
928
|
+
onRequestStateChange(methodName, requestId, {
|
|
929
|
+
loading: false,
|
|
930
|
+
data: result
|
|
931
|
+
});
|
|
932
|
+
} catch (error) {
|
|
933
|
+
onRequestStateChange(methodName, requestId, {
|
|
934
|
+
loading: false,
|
|
935
|
+
error: typeof error === "object" && error !== null && "message" in error ? error.message : void 0
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
var requestHandlerFactory = (typeInfoORMAPI, methodName, onRequestStateChange) => (...args) => {
|
|
940
|
+
const requestId = getSimpleId();
|
|
941
|
+
handleRequest(
|
|
942
|
+
requestId,
|
|
943
|
+
args,
|
|
944
|
+
typeInfoORMAPI,
|
|
945
|
+
methodName,
|
|
946
|
+
onRequestStateChange
|
|
947
|
+
);
|
|
948
|
+
return requestId;
|
|
949
|
+
};
|
|
950
|
+
var useTypeInfoORMAPI = (typeInfoORMAPI) => {
|
|
951
|
+
const [state, setState] = useState({});
|
|
952
|
+
const onRequestStateChange = useCallback(
|
|
953
|
+
(methodName, requestId, { loading, data, error }) => {
|
|
954
|
+
setState(
|
|
955
|
+
({
|
|
956
|
+
[methodName]: {
|
|
957
|
+
activeRequests: prevActiveRequests = [],
|
|
958
|
+
data: prevData,
|
|
959
|
+
error: prevError
|
|
960
|
+
} = {},
|
|
961
|
+
...prevState
|
|
962
|
+
}) => {
|
|
963
|
+
const newActiveRequests = loading ? [...prevActiveRequests, requestId] : prevActiveRequests.filter((id) => id !== requestId);
|
|
964
|
+
const currentlyLoading = newActiveRequests.length > 0;
|
|
965
|
+
return {
|
|
966
|
+
...prevState,
|
|
967
|
+
[methodName]: {
|
|
968
|
+
activeRequests: newActiveRequests,
|
|
969
|
+
loading: currentlyLoading,
|
|
970
|
+
data: currentlyLoading ? void 0 : data ?? prevData,
|
|
971
|
+
error: currentlyLoading ? void 0 : error ?? prevError
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
);
|
|
976
|
+
},
|
|
977
|
+
[]
|
|
978
|
+
);
|
|
979
|
+
const api = useMemo(() => {
|
|
980
|
+
const apiBase = {};
|
|
981
|
+
for (const aM in typeInfoORMAPI) {
|
|
982
|
+
const methodName = aM;
|
|
983
|
+
apiBase[methodName] = requestHandlerFactory(
|
|
984
|
+
typeInfoORMAPI,
|
|
985
|
+
methodName,
|
|
986
|
+
onRequestStateChange
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
return apiBase;
|
|
990
|
+
}, [typeInfoORMAPI, onRequestStateChange]);
|
|
991
|
+
return {
|
|
992
|
+
state,
|
|
993
|
+
api
|
|
994
|
+
};
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
// src/app/utils/TypeInfoORMClient.ts
|
|
998
|
+
var TypeInfoORMClient = class {
|
|
999
|
+
/**
|
|
1000
|
+
* Create a client for TypeInfoORM routes.
|
|
1001
|
+
*
|
|
1002
|
+
* @param config - Service configuration for the API routes.
|
|
1003
|
+
*/
|
|
1004
|
+
constructor(config) {
|
|
1005
|
+
this.config = config;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Dispatch a request to the configured service.
|
|
1009
|
+
*
|
|
1010
|
+
* @param path - Route path for the ORM method.
|
|
1011
|
+
* @param args - Arguments to send in the request body.
|
|
1012
|
+
* @returns Parsed response payload.
|
|
1013
|
+
*/
|
|
1014
|
+
makeRequest = async (path, args) => {
|
|
1015
|
+
const cleanedArgs = [...args];
|
|
1016
|
+
while (cleanedArgs.length > 0 && typeof cleanedArgs[cleanedArgs.length - 1] === "undefined") {
|
|
1017
|
+
cleanedArgs.pop();
|
|
1018
|
+
}
|
|
1019
|
+
const result = await sendServiceRequest(this.config, path, cleanedArgs);
|
|
1020
|
+
return result;
|
|
1021
|
+
};
|
|
1022
|
+
/**
|
|
1023
|
+
* Create an item of the provided type.
|
|
1024
|
+
*
|
|
1025
|
+
* @param typeName - TypeInfo type name.
|
|
1026
|
+
* @param item - Item payload to persist.
|
|
1027
|
+
* @returns The created item result.
|
|
1028
|
+
*/
|
|
1029
|
+
create = async (typeName, item) => {
|
|
1030
|
+
return await this.makeRequest("create" /* CREATE */, [
|
|
1031
|
+
typeName,
|
|
1032
|
+
item
|
|
1033
|
+
]);
|
|
1034
|
+
};
|
|
1035
|
+
/**
|
|
1036
|
+
* Read an item by its primary field value.
|
|
1037
|
+
*
|
|
1038
|
+
* @param typeName - TypeInfo type name.
|
|
1039
|
+
* @param primaryFieldValue - Primary field value to lookup.
|
|
1040
|
+
* @returns The retrieved item, if found.
|
|
1041
|
+
*/
|
|
1042
|
+
read = async (typeName, primaryFieldValue, selectedFields) => {
|
|
1043
|
+
return await this.makeRequest("read" /* READ */, [
|
|
1044
|
+
typeName,
|
|
1045
|
+
primaryFieldValue,
|
|
1046
|
+
selectedFields
|
|
1047
|
+
]);
|
|
1048
|
+
};
|
|
1049
|
+
/**
|
|
1050
|
+
* Update an item by replacing it with the provided payload.
|
|
1051
|
+
*
|
|
1052
|
+
* @param typeName - TypeInfo type name.
|
|
1053
|
+
* @param item - Updated item payload.
|
|
1054
|
+
* @returns Whether the update succeeded.
|
|
1055
|
+
*/
|
|
1056
|
+
update = async (typeName, item) => {
|
|
1057
|
+
return await this.makeRequest("update" /* UPDATE */, [
|
|
1058
|
+
typeName,
|
|
1059
|
+
item
|
|
1060
|
+
]);
|
|
1061
|
+
};
|
|
1062
|
+
/**
|
|
1063
|
+
* Delete an item by its primary field value.
|
|
1064
|
+
*
|
|
1065
|
+
* @param typeName - TypeInfo type name.
|
|
1066
|
+
* @param primaryFieldValue - Primary field value to delete.
|
|
1067
|
+
* @returns Whether the delete succeeded.
|
|
1068
|
+
*/
|
|
1069
|
+
delete = async (typeName, primaryFieldValue) => {
|
|
1070
|
+
return await this.makeRequest("delete" /* DELETE */, [
|
|
1071
|
+
typeName,
|
|
1072
|
+
primaryFieldValue
|
|
1073
|
+
]);
|
|
1074
|
+
};
|
|
1075
|
+
/**
|
|
1076
|
+
* List items for a given type.
|
|
1077
|
+
*
|
|
1078
|
+
* @param typeName - TypeInfo type name.
|
|
1079
|
+
* @param config - List configuration including filters and paging.
|
|
1080
|
+
* @param selectedFields - Optional fields to project.
|
|
1081
|
+
* @returns List results for the query.
|
|
1082
|
+
*/
|
|
1083
|
+
list = async (typeName, config, selectedFields) => {
|
|
1084
|
+
return await this.makeRequest("list" /* LIST */, [
|
|
1085
|
+
typeName,
|
|
1086
|
+
config,
|
|
1087
|
+
selectedFields
|
|
1088
|
+
]);
|
|
1089
|
+
};
|
|
1090
|
+
/**
|
|
1091
|
+
* Create a relationship between items.
|
|
1092
|
+
*
|
|
1093
|
+
* @param relationshipItem - Relationship payload.
|
|
1094
|
+
* @returns Whether the relationship was created.
|
|
1095
|
+
*/
|
|
1096
|
+
createRelationship = async (relationshipItem) => {
|
|
1097
|
+
return await this.makeRequest(
|
|
1098
|
+
"create-relationship" /* CREATE_RELATIONSHIP */,
|
|
1099
|
+
[relationshipItem]
|
|
1100
|
+
);
|
|
1101
|
+
};
|
|
1102
|
+
/**
|
|
1103
|
+
* Delete a relationship between items.
|
|
1104
|
+
*
|
|
1105
|
+
* @param relationshipItem - Relationship payload.
|
|
1106
|
+
* @returns Results describing the deletion.
|
|
1107
|
+
*/
|
|
1108
|
+
deleteRelationship = async (relationshipItem) => {
|
|
1109
|
+
return await this.makeRequest(
|
|
1110
|
+
"delete-relationship" /* DELETE_RELATIONSHIP */,
|
|
1111
|
+
[relationshipItem]
|
|
1112
|
+
);
|
|
1113
|
+
};
|
|
1114
|
+
/**
|
|
1115
|
+
* List relationship records matching the query.
|
|
1116
|
+
*
|
|
1117
|
+
* @param config - Relationship list query configuration.
|
|
1118
|
+
* @returns Relationship list results.
|
|
1119
|
+
*/
|
|
1120
|
+
listRelationships = async (config) => {
|
|
1121
|
+
return await this.makeRequest("list-relationships" /* LIST_RELATIONSHIPS */, [
|
|
1122
|
+
config
|
|
1123
|
+
]);
|
|
1124
|
+
};
|
|
1125
|
+
/**
|
|
1126
|
+
* List related items for a relationship query.
|
|
1127
|
+
*
|
|
1128
|
+
* @param config - Relationship list query configuration.
|
|
1129
|
+
* @param selectedFields - Optional fields to project on related items.
|
|
1130
|
+
* @returns Related item list results.
|
|
1131
|
+
*/
|
|
1132
|
+
listRelatedItems = async (config, selectedFields) => {
|
|
1133
|
+
return await this.makeRequest("list-related-items" /* LIST_RELATED_ITEMS */, [
|
|
1134
|
+
config,
|
|
1135
|
+
selectedFields
|
|
1136
|
+
]);
|
|
1137
|
+
};
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
// src/app/forms/core/getFieldKind.ts
|
|
1141
|
+
var hasSelectableValues = (field) => {
|
|
1142
|
+
const possibleValues = field.possibleValues ?? [];
|
|
1143
|
+
return possibleValues.some(
|
|
1144
|
+
(value) => typeof value === "string" || typeof value === "number"
|
|
1145
|
+
);
|
|
1146
|
+
};
|
|
1147
|
+
var getFieldKind = (field) => {
|
|
1148
|
+
if (field.typeReference) {
|
|
1149
|
+
return field.array ? "relation_array" : "relation_single";
|
|
1150
|
+
}
|
|
1151
|
+
if (field.tags?.customType) {
|
|
1152
|
+
return field.array ? "custom_array" : "custom_single";
|
|
1153
|
+
}
|
|
1154
|
+
if (field.array) {
|
|
1155
|
+
return "array";
|
|
1156
|
+
}
|
|
1157
|
+
if (hasSelectableValues(field)) {
|
|
1158
|
+
return "enum_select";
|
|
1159
|
+
}
|
|
1160
|
+
if (field.type === "boolean") {
|
|
1161
|
+
return "boolean";
|
|
1162
|
+
}
|
|
1163
|
+
if (field.type === "number") {
|
|
1164
|
+
return "number";
|
|
1165
|
+
}
|
|
1166
|
+
return "string";
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1169
|
+
// src/app/forms/core/resolveSuite.ts
|
|
1170
|
+
var fieldKinds = [
|
|
1171
|
+
"string",
|
|
1172
|
+
"number",
|
|
1173
|
+
"boolean",
|
|
1174
|
+
"enum_select",
|
|
1175
|
+
"array",
|
|
1176
|
+
"relation_single",
|
|
1177
|
+
"relation_array",
|
|
1178
|
+
"custom_single",
|
|
1179
|
+
"custom_array"
|
|
1180
|
+
];
|
|
1181
|
+
var getMissingKinds = (renderers) => {
|
|
1182
|
+
return fieldKinds.filter((kind) => !renderers[kind]);
|
|
1183
|
+
};
|
|
1184
|
+
var resolveSuite = (overrides, fallback) => {
|
|
1185
|
+
const mergedRenderers = {
|
|
1186
|
+
...fallback.renderers ?? {},
|
|
1187
|
+
...overrides?.renderers ?? {}
|
|
1188
|
+
};
|
|
1189
|
+
const missingKinds = getMissingKinds(mergedRenderers);
|
|
1190
|
+
if (missingKinds.length) {
|
|
1191
|
+
throw new Error(
|
|
1192
|
+
`Missing renderers for field kinds: ${missingKinds.join(", ")}`
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
const mergedPrimitives = {
|
|
1196
|
+
...fallback.primitives ?? {},
|
|
1197
|
+
...overrides?.primitives ?? {}
|
|
1198
|
+
};
|
|
1199
|
+
return {
|
|
1200
|
+
renderers: mergedRenderers,
|
|
1201
|
+
primitives: Object.keys(mergedPrimitives).length ? mergedPrimitives : void 0
|
|
1202
|
+
};
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
// src/app/forms/core/createAutoField.ts
|
|
1206
|
+
var createAutoField = (suite) => {
|
|
1207
|
+
return (props) => {
|
|
1208
|
+
const { field, fieldKey, value, onChange, error, disabled } = props;
|
|
1209
|
+
const { tags } = field;
|
|
1210
|
+
const context = {
|
|
1211
|
+
field,
|
|
1212
|
+
fieldKey,
|
|
1213
|
+
label: tags?.label ?? fieldKey,
|
|
1214
|
+
required: !field.optional,
|
|
1215
|
+
disabled: !!disabled,
|
|
1216
|
+
error,
|
|
1217
|
+
value,
|
|
1218
|
+
onChange,
|
|
1219
|
+
constraints: tags?.constraints,
|
|
1220
|
+
format: tags?.format,
|
|
1221
|
+
possibleValues: field.possibleValues,
|
|
1222
|
+
allowCustomSelection: tags?.allowCustomSelection,
|
|
1223
|
+
customType: tags?.customType,
|
|
1224
|
+
onRelationAction: props.onRelationAction,
|
|
1225
|
+
onCustomTypeAction: props.onCustomTypeAction
|
|
1226
|
+
};
|
|
1227
|
+
const kind = getFieldKind(field);
|
|
1228
|
+
return suite.renderers[kind](context);
|
|
1229
|
+
};
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
// src/app/forms/core/createFormRenderer.ts
|
|
1233
|
+
var createFormRenderer = (options) => {
|
|
1234
|
+
const resolvedSuite = resolveSuite(
|
|
1235
|
+
options.suite,
|
|
1236
|
+
options.fallbackSuite
|
|
1237
|
+
);
|
|
1238
|
+
const AutoField = createAutoField(resolvedSuite);
|
|
1239
|
+
return {
|
|
1240
|
+
AutoField,
|
|
1241
|
+
suite: resolvedSuite
|
|
1242
|
+
};
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
// src/app/forms/core/mergeSuites.ts
|
|
1246
|
+
var mergeSuites = (base, overrides) => {
|
|
1247
|
+
return {
|
|
1248
|
+
renderers: {
|
|
1249
|
+
...base.renderers ?? {},
|
|
1250
|
+
...overrides.renderers ?? {}
|
|
1251
|
+
},
|
|
1252
|
+
primitives: {
|
|
1253
|
+
...base.primitives ?? {},
|
|
1254
|
+
...overrides.primitives ?? {}
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
};
|
|
1258
|
+
var withRendererOverride = (kind, renderer) => ({
|
|
1259
|
+
renderers: {
|
|
1260
|
+
[kind]: renderer
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1263
|
+
var getDeniedOperation = (deniedOperations, operation) => {
|
|
1264
|
+
if (!deniedOperations) {
|
|
1265
|
+
return false;
|
|
1266
|
+
}
|
|
1267
|
+
const denied = deniedOperations[operation];
|
|
1268
|
+
if (typeof denied === "boolean") {
|
|
1269
|
+
return denied;
|
|
1270
|
+
}
|
|
1271
|
+
return deniedOperations[operation.toLowerCase()] ?? false;
|
|
1272
|
+
};
|
|
1273
|
+
var buildInitialValues = (initialValues, typeInfo) => {
|
|
1274
|
+
const values = { ...initialValues };
|
|
1275
|
+
for (const [key, field] of Object.entries(typeInfo.fields ?? {})) {
|
|
1276
|
+
if (values[key] !== void 0) {
|
|
1277
|
+
continue;
|
|
1278
|
+
}
|
|
1279
|
+
const defaultValue = field.tags?.constraints?.defaultValue;
|
|
1280
|
+
if (defaultValue !== void 0) {
|
|
1281
|
+
let parsedDefaultValue = defaultValue;
|
|
1282
|
+
try {
|
|
1283
|
+
parsedDefaultValue = JSON.parse(defaultValue);
|
|
1284
|
+
} catch (error) {
|
|
1285
|
+
}
|
|
1286
|
+
values[key] = parsedDefaultValue;
|
|
1287
|
+
continue;
|
|
1288
|
+
}
|
|
1289
|
+
if (field.array && !field.typeReference && !field.optional) {
|
|
1290
|
+
values[key] = [];
|
|
1291
|
+
continue;
|
|
1292
|
+
}
|
|
1293
|
+
if (field.type === "boolean" && !field.optional) {
|
|
1294
|
+
values[key] = false;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
return values;
|
|
1298
|
+
};
|
|
1299
|
+
var useFormEngine = (initialValues = {}, typeInfo, options) => {
|
|
1300
|
+
const operation = options?.operation ?? "CREATE" /* CREATE */;
|
|
1301
|
+
const [values, setValues] = useState(
|
|
1302
|
+
buildInitialValues(initialValues, typeInfo)
|
|
1303
|
+
);
|
|
1304
|
+
const [errors, setErrors] = useState({});
|
|
1305
|
+
const setFieldValue = useCallback((path, value) => {
|
|
1306
|
+
setValues((prev) => {
|
|
1307
|
+
return {
|
|
1308
|
+
...prev,
|
|
1309
|
+
[path]: value
|
|
1310
|
+
};
|
|
1311
|
+
});
|
|
1312
|
+
}, []);
|
|
1313
|
+
const validate = useCallback(() => {
|
|
1314
|
+
const newErrors = {};
|
|
1315
|
+
for (const [key, field] of Object.entries(typeInfo.fields ?? {})) {
|
|
1316
|
+
if (field.tags?.hidden) {
|
|
1317
|
+
continue;
|
|
1318
|
+
}
|
|
1319
|
+
const val = values[key];
|
|
1320
|
+
if (field.readonly && (val === void 0 || val === null || val === "")) {
|
|
1321
|
+
continue;
|
|
1322
|
+
}
|
|
1323
|
+
const isMissing = val === void 0 || val === null || val === "" || field.array && (!Array.isArray(val) || val.length === 0);
|
|
1324
|
+
if (!field.optional && isMissing) {
|
|
1325
|
+
newErrors[key] = "This field is required";
|
|
1326
|
+
continue;
|
|
1327
|
+
}
|
|
1328
|
+
if (isMissing) {
|
|
1329
|
+
continue;
|
|
1330
|
+
}
|
|
1331
|
+
const constraints = field.tags?.constraints;
|
|
1332
|
+
if (constraints?.pattern && typeof val === "string") {
|
|
1333
|
+
const pattern = new RegExp(constraints.pattern);
|
|
1334
|
+
if (!pattern.test(val)) {
|
|
1335
|
+
newErrors[key] = "Value does not match required pattern";
|
|
1336
|
+
continue;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
if (field.type === "number" && typeof val === "number") {
|
|
1340
|
+
if (constraints?.min !== void 0 && val < constraints.min) {
|
|
1341
|
+
newErrors[key] = `Value must be at least ${constraints.min}`;
|
|
1342
|
+
continue;
|
|
1343
|
+
}
|
|
1344
|
+
if (constraints?.max !== void 0 && val > constraints.max) {
|
|
1345
|
+
newErrors[key] = `Value must be at most ${constraints.max}`;
|
|
1346
|
+
continue;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
setErrors(newErrors);
|
|
1351
|
+
return Object.keys(newErrors).length === 0;
|
|
1352
|
+
}, [typeInfo, values]);
|
|
1353
|
+
const fields = useMemo(() => {
|
|
1354
|
+
return Object.entries(typeInfo.fields ?? {}).map(([key, field]) => {
|
|
1355
|
+
const { tags } = field;
|
|
1356
|
+
const isPrimary = tags?.primaryField || typeInfo.primaryField === key;
|
|
1357
|
+
return {
|
|
1358
|
+
key,
|
|
1359
|
+
field,
|
|
1360
|
+
label: tags?.label ?? key,
|
|
1361
|
+
required: !field.optional,
|
|
1362
|
+
disabled: field.readonly || getDeniedOperation(typeInfo.tags?.deniedOperations, operation) || getDeniedOperation(tags?.deniedOperations, operation) || operation === "UPDATE" /* UPDATE */ && isPrimary,
|
|
1363
|
+
hidden: !!tags?.hidden,
|
|
1364
|
+
primary: isPrimary,
|
|
1365
|
+
format: tags?.format,
|
|
1366
|
+
constraints: tags?.constraints,
|
|
1367
|
+
value: values[key],
|
|
1368
|
+
onChange: (value) => setFieldValue(key, value),
|
|
1369
|
+
error: errors[key]
|
|
1370
|
+
};
|
|
1371
|
+
});
|
|
1372
|
+
}, [typeInfo, values, errors, setFieldValue, operation]);
|
|
1373
|
+
return {
|
|
1374
|
+
typeInfo,
|
|
1375
|
+
typeTags: typeInfo.tags,
|
|
1376
|
+
operation,
|
|
1377
|
+
values,
|
|
1378
|
+
errors,
|
|
1379
|
+
fields,
|
|
1380
|
+
setFieldValue,
|
|
1381
|
+
validate,
|
|
1382
|
+
setErrors
|
|
1383
|
+
};
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1386
|
+
export { ApplicationStateContext, ApplicationStateProvider, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, TypeInfoORMClient, buildHistoryPath, buildQueryString, buildRoutePath, computeAreaBounds, computeTrackPixels, createAutoField, createEasyLayout, createFormRenderer, createManualRouteAdapter, createMemoryHistory, createRouteAdapterFromHistory, getApplicationStateIdentifier, getApplicationStateModified, getApplicationStateValue, getApplicationStateValueStructure, getChangedDependencyIndexes, getEasyLayoutTemplateDetails, getFieldKind, getFullUrl, getPascalCaseAreaName, handleRequest, mergeSuites, parseHistoryPath, parseTemplate, requestHandlerFactory, resolveSuite, sendServiceRequest, setApplicationStateModified, setApplicationStateValue, useApplicationStateLoader, useApplicationStateValue, useApplicationStateValueStructure, useController, useDebugDependencies, useFormEngine, useRouteContext, useTypeInfoORMAPI, validateAreas, withRendererOverride };
|