@resistdesign/voltra 3.0.0-alpha.2 → 3.0.0-alpha.21
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 +1323 -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
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.S3SupportedFileItemDBDriverEntry = exports.S3FileItemDBDriver = void 0;
|
|
7
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
8
|
-
const S3FileDriver_1 = require("./S3FileItemDBDriver/S3FileDriver");
|
|
9
|
-
const SearchUtils_1 = require("../../../common/SearchUtils");
|
|
10
|
-
const Types_1 = require("./common/Types");
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const fs_1 = __importDefault(require("fs"));
|
|
13
|
-
const TypeParsing_1 = require("../../../common/TypeParsing");
|
|
14
|
-
/**
|
|
15
|
-
* Use S3 as a {@link DataItemDBDriver} for {@link BaseFileItem}s.
|
|
16
|
-
* */
|
|
17
|
-
class S3FileItemDBDriver {
|
|
18
|
-
config;
|
|
19
|
-
specificConfig;
|
|
20
|
-
s3;
|
|
21
|
-
s3FileDriver;
|
|
22
|
-
constructor(config) {
|
|
23
|
-
this.config = config;
|
|
24
|
-
const { dbSpecificConfig } = config;
|
|
25
|
-
const { s3Config, bucketName, urlExpirationInSeconds } = dbSpecificConfig;
|
|
26
|
-
this.specificConfig = dbSpecificConfig;
|
|
27
|
-
this.s3 = new client_s3_1.S3(s3Config);
|
|
28
|
-
this.s3FileDriver = new S3FileDriver_1.S3FileDriver({
|
|
29
|
-
s3Config: s3Config,
|
|
30
|
-
bucketName,
|
|
31
|
-
urlExpirationInSeconds,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Create a new @{@link BaseFileItem}.
|
|
36
|
-
* */
|
|
37
|
-
createItem = async (item) => {
|
|
38
|
-
const { tableName } = this.config;
|
|
39
|
-
const { bucketName } = this.specificConfig;
|
|
40
|
-
await this.s3.send(new client_s3_1.PutObjectCommand({
|
|
41
|
-
Bucket: bucketName,
|
|
42
|
-
Key: (0, S3FileDriver_1.getFullFileKey)({
|
|
43
|
-
file: item,
|
|
44
|
-
// SECURITY: `baseDirectory` is only used internally here, and not as part of the `id`.
|
|
45
|
-
baseDirectory: tableName,
|
|
46
|
-
}),
|
|
47
|
-
Body: "",
|
|
48
|
-
}));
|
|
49
|
-
return (0, S3FileDriver_1.getFullFileKey)({
|
|
50
|
-
file: item,
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Read a @{@link BaseFileItem} by its id.
|
|
55
|
-
* */
|
|
56
|
-
readItem = async (id, selectFields) => {
|
|
57
|
-
const { tableName } = this.config;
|
|
58
|
-
const { bucketName } = this.specificConfig;
|
|
59
|
-
if (typeof id === "undefined") {
|
|
60
|
-
throw new Error(Types_1.DATA_ITEM_DB_DRIVER_ERRORS.MISSING_ID);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const itemLoc = (0, S3FileDriver_1.getBaseFileLocationInfo)(id);
|
|
64
|
-
const { ContentType = "", ContentLength = 0, LastModified, Metadata: {} = {}, } = await this.s3.send(new client_s3_1.HeadObjectCommand({
|
|
65
|
-
Bucket: bucketName,
|
|
66
|
-
Key: (0, S3FileDriver_1.getFullFileKey)({
|
|
67
|
-
file: itemLoc,
|
|
68
|
-
baseDirectory: tableName,
|
|
69
|
-
}),
|
|
70
|
-
}));
|
|
71
|
-
const item = {
|
|
72
|
-
...itemLoc,
|
|
73
|
-
id,
|
|
74
|
-
updatedOn: LastModified?.getTime() || 0,
|
|
75
|
-
mimeType: ContentType,
|
|
76
|
-
sizeInBytes: ContentLength,
|
|
77
|
-
isDirectory: ContentType === "application/x-directory",
|
|
78
|
-
uploadUrl: selectFields && selectFields.includes("uploadUrl")
|
|
79
|
-
? await this.s3FileDriver.getFileUploadUrl(itemLoc, tableName)
|
|
80
|
-
: undefined,
|
|
81
|
-
downloadUrl: selectFields && selectFields.includes("downloadUrl")
|
|
82
|
-
? await this.s3FileDriver.getFileDownloadUrl(itemLoc, tableName)
|
|
83
|
-
: undefined,
|
|
84
|
-
};
|
|
85
|
-
return item;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Update a @{@link BaseFileItem}.
|
|
90
|
-
* */
|
|
91
|
-
updateItem = async (uniqueIdentifier, item) => {
|
|
92
|
-
const { directory, name } = item;
|
|
93
|
-
const { tableName } = this.config;
|
|
94
|
-
const { bucketName } = this.specificConfig;
|
|
95
|
-
const oldItemLoc = (0, S3FileDriver_1.getBaseFileLocationInfo)(uniqueIdentifier);
|
|
96
|
-
const { name: oldName, directory: oldDirectory } = oldItemLoc;
|
|
97
|
-
if (name && (name !== oldName || directory !== oldDirectory)) {
|
|
98
|
-
await this.s3.send(new client_s3_1.CopyObjectCommand({
|
|
99
|
-
Bucket: bucketName,
|
|
100
|
-
Key: (0, S3FileDriver_1.getFullFileKey)({
|
|
101
|
-
file: {
|
|
102
|
-
directory,
|
|
103
|
-
name,
|
|
104
|
-
},
|
|
105
|
-
baseDirectory: tableName,
|
|
106
|
-
}),
|
|
107
|
-
CopySource: (0, S3FileDriver_1.getFullFileKey)({
|
|
108
|
-
file: oldItemLoc,
|
|
109
|
-
baseDirectory: tableName,
|
|
110
|
-
}),
|
|
111
|
-
}));
|
|
112
|
-
await this.s3FileDriver.deleteFile(oldItemLoc, tableName);
|
|
113
|
-
}
|
|
114
|
-
await this.readItem(uniqueIdentifier);
|
|
115
|
-
return true;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Delete a @{@link BaseFileItem} by its id.
|
|
119
|
-
*/
|
|
120
|
-
deleteItem = async (id) => {
|
|
121
|
-
const { tableName } = this.config;
|
|
122
|
-
if (typeof id === "undefined") {
|
|
123
|
-
throw new Error(Types_1.DATA_ITEM_DB_DRIVER_ERRORS.MISSING_ID);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
await this.readItem(id);
|
|
127
|
-
await this.s3FileDriver.deleteFile((0, S3FileDriver_1.getBaseFileLocationInfo)(id), tableName);
|
|
128
|
-
}
|
|
129
|
-
return true;
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* List @{@link BaseFileItem}s by a given criteria.
|
|
133
|
-
*/
|
|
134
|
-
listItems = async (config, selectFields) => {
|
|
135
|
-
const { tableName } = this.config;
|
|
136
|
-
const { itemsPerPage = Infinity, cursor, sortFields = [], criteria, } = config;
|
|
137
|
-
const { files: baseFileList = [], cursor: newCursor } = await this.s3FileDriver.listFiles(undefined, tableName, itemsPerPage, cursor);
|
|
138
|
-
const currentFileItems = baseFileList.map((bF) => ({
|
|
139
|
-
id: (0, S3FileDriver_1.getFullFileKey)({
|
|
140
|
-
file: bF,
|
|
141
|
-
}),
|
|
142
|
-
...bF,
|
|
143
|
-
}));
|
|
144
|
-
const filteredFiles = criteria
|
|
145
|
-
? (0, SearchUtils_1.getFilterTypeInfoDataItemsBySearchCriteria)(criteria, currentFileItems)
|
|
146
|
-
: currentFileItems;
|
|
147
|
-
const expandedFiles = [];
|
|
148
|
-
for (const fF of filteredFiles) {
|
|
149
|
-
expandedFiles.push({
|
|
150
|
-
...fF,
|
|
151
|
-
uploadUrl: selectFields?.includes("uploadUrl")
|
|
152
|
-
? await this.s3FileDriver.getFileUploadUrl(fF, tableName)
|
|
153
|
-
: undefined,
|
|
154
|
-
downloadUrl: selectFields?.includes("downloadUrl")
|
|
155
|
-
? await this.s3FileDriver.getFileDownloadUrl(fF, tableName)
|
|
156
|
-
: undefined,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
items: (0, SearchUtils_1.getSortedItems)(sortFields, expandedFiles),
|
|
161
|
-
cursor: newCursor,
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
exports.S3FileItemDBDriver = S3FileItemDBDriver;
|
|
166
|
-
/**
|
|
167
|
-
* The supported DB driver entry for the S3 File {@link DataItemDBDriver}.
|
|
168
|
-
* */
|
|
169
|
-
exports.S3SupportedFileItemDBDriverEntry = {
|
|
170
|
-
factory: (config) => {
|
|
171
|
-
return new S3FileItemDBDriver(config);
|
|
172
|
-
},
|
|
173
|
-
getDBSpecificConfigTypeInfo: () => {
|
|
174
|
-
const configTypesPath = path_1.default.join(__dirname, "S3DataItemDBDriver", "ConfigTypes.ts");
|
|
175
|
-
const configTypesTS = fs_1.default.readFileSync(configTypesPath, "utf8");
|
|
176
|
-
const typeInfoMap = (0, TypeParsing_1.getTypeInfoMapFromTypeScript)(configTypesTS);
|
|
177
|
-
return {
|
|
178
|
-
entryTypeName: "S3SpecificConfig",
|
|
179
|
-
typeInfoMap,
|
|
180
|
-
};
|
|
181
|
-
},
|
|
182
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SupportedDataItemDBDriverEntry } from "./Types";
|
|
2
|
-
/**
|
|
3
|
-
* The supported Type Info ORM DB driver names.
|
|
4
|
-
* */
|
|
5
|
-
export declare enum SupportedTypeInfoORMDBDriverNames {
|
|
6
|
-
DYNAMO_DB_DATA_ITEM = "DYNAMO_DB_DATA_ITEM",
|
|
7
|
-
S3_FILE_ITEM = "S3_FILE_ITEM"
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A map of supported Type Info ORM DB drivers by name.
|
|
11
|
-
* */
|
|
12
|
-
export declare const SUPPORTED_TYPE_INFO_ORM_DB_DRIVERS: Record<SupportedTypeInfoORMDBDriverNames, SupportedDataItemDBDriverEntry>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SUPPORTED_TYPE_INFO_ORM_DB_DRIVERS = exports.SupportedTypeInfoORMDBDriverNames = void 0;
|
|
4
|
-
const DynamoDBDataItemDBDriver_1 = require("../DynamoDBDataItemDBDriver");
|
|
5
|
-
const S3FileItemDBDriver_1 = require("../S3FileItemDBDriver");
|
|
6
|
-
/**
|
|
7
|
-
* The supported Type Info ORM DB driver names.
|
|
8
|
-
* */
|
|
9
|
-
var SupportedTypeInfoORMDBDriverNames;
|
|
10
|
-
(function (SupportedTypeInfoORMDBDriverNames) {
|
|
11
|
-
SupportedTypeInfoORMDBDriverNames["DYNAMO_DB_DATA_ITEM"] = "DYNAMO_DB_DATA_ITEM";
|
|
12
|
-
SupportedTypeInfoORMDBDriverNames["S3_FILE_ITEM"] = "S3_FILE_ITEM";
|
|
13
|
-
})(SupportedTypeInfoORMDBDriverNames || (exports.SupportedTypeInfoORMDBDriverNames = SupportedTypeInfoORMDBDriverNames = {}));
|
|
14
|
-
/**
|
|
15
|
-
* A map of supported Type Info ORM DB drivers by name.
|
|
16
|
-
* */
|
|
17
|
-
exports.SUPPORTED_TYPE_INFO_ORM_DB_DRIVERS = {
|
|
18
|
-
[SupportedTypeInfoORMDBDriverNames.DYNAMO_DB_DATA_ITEM]: DynamoDBDataItemDBDriver_1.DynamoDBSupportedDataItemDBDriverEntry,
|
|
19
|
-
[SupportedTypeInfoORMDBDriverNames.S3_FILE_ITEM]: S3FileItemDBDriver_1.S3SupportedFileItemDBDriverEntry,
|
|
20
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DATA_ITEM_DB_DRIVER_ERRORS = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* The errors that can be thrown by a {@link DataItemDBDriver}.
|
|
6
|
-
* */
|
|
7
|
-
var DATA_ITEM_DB_DRIVER_ERRORS;
|
|
8
|
-
(function (DATA_ITEM_DB_DRIVER_ERRORS) {
|
|
9
|
-
DATA_ITEM_DB_DRIVER_ERRORS["MISSING_ID"] = "MISSING_ID";
|
|
10
|
-
DATA_ITEM_DB_DRIVER_ERRORS["INVALID_CURSOR"] = "INVALID_CURSOR";
|
|
11
|
-
DATA_ITEM_DB_DRIVER_ERRORS["ITEM_NOT_FOUND"] = "ITEM_NOT_FOUND";
|
|
12
|
-
DATA_ITEM_DB_DRIVER_ERRORS["MISSING_UNIQUE_IDENTIFIER"] = "MISSING_UNIQUE_IDENTIFIER";
|
|
13
|
-
DATA_ITEM_DB_DRIVER_ERRORS["SEARCH_COMPARISON_OPERATOR_NOT_SUPPORTED"] = "SEARCH_COMPARISON_OPERATOR_NOT_SUPPORTED";
|
|
14
|
-
})(DATA_ITEM_DB_DRIVER_ERRORS || (exports.DATA_ITEM_DB_DRIVER_ERRORS = DATA_ITEM_DB_DRIVER_ERRORS = {}));
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Types"), exports);
|
|
18
|
-
__exportStar(require("./SupportedTypeInfoORMDBDrivers"), exports);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./S3FileItemDBDriver"), exports);
|
|
18
|
-
__exportStar(require("./DynamoDBDataItemDBDriver"), exports);
|
|
19
|
-
__exportStar(require("./common"), exports);
|
package/src/api/ORM/index.d.ts
DELETED
package/src/api/ORM/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Drivers = void 0;
|
|
40
|
-
exports.Drivers = __importStar(require("./drivers"));
|
|
41
|
-
__exportStar(require("./TypeInfoORMService"), exports);
|
|
42
|
-
__exportStar(require("./DACUtils"), exports);
|
|
43
|
-
__exportStar(require("./ORMRouteMap"), exports);
|
package/src/api/Router/AWS.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AuthInfo, CloudFunctionEventTransformer } from "./Types";
|
|
2
|
-
/**
|
|
3
|
-
* AWS specific utilities for processing routing and normalizing Cloud Function events.
|
|
4
|
-
* */
|
|
5
|
-
export declare namespace AWS {
|
|
6
|
-
/**
|
|
7
|
-
* An AWS specific Cloud Function event.
|
|
8
|
-
* */
|
|
9
|
-
interface IAWSCloudFunctionEvent {
|
|
10
|
-
requestContext?: Record<any, any>;
|
|
11
|
-
httpMethod?: string;
|
|
12
|
-
headers?: Record<string, string>;
|
|
13
|
-
multiValueHeaders?: Record<string, string[]>;
|
|
14
|
-
path?: string;
|
|
15
|
-
body?: string;
|
|
16
|
-
}
|
|
17
|
-
const getPathFromEvent: (event: IAWSCloudFunctionEvent) => string;
|
|
18
|
-
const getBodyFromEvent: (event: IAWSCloudFunctionEvent) => any;
|
|
19
|
-
const getHeadersFromEvent: (event: IAWSCloudFunctionEvent) => Record<string, string[]>;
|
|
20
|
-
const getMethodFromEvent: (event: IAWSCloudFunctionEvent) => string;
|
|
21
|
-
const getAuthInfo: (event: IAWSCloudFunctionEvent) => AuthInfo;
|
|
22
|
-
/**
|
|
23
|
-
* Parse out the Auth, CORS, Headers, Method and Body from an AWS Cloud Function event.
|
|
24
|
-
* */
|
|
25
|
-
const normalizeCloudFunctionEvent: CloudFunctionEventTransformer;
|
|
26
|
-
}
|
package/src/api/Router/AWS.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AWS = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* AWS specific utilities for processing routing and normalizing Cloud Function events.
|
|
6
|
-
* */
|
|
7
|
-
var AWS;
|
|
8
|
-
(function (AWS) {
|
|
9
|
-
AWS.getPathFromEvent = (event) => {
|
|
10
|
-
const { path = "" } = event;
|
|
11
|
-
return path;
|
|
12
|
-
};
|
|
13
|
-
AWS.getBodyFromEvent = (event) => {
|
|
14
|
-
const { body = "" } = event;
|
|
15
|
-
try {
|
|
16
|
-
const bodyValue = JSON.parse(body);
|
|
17
|
-
return bodyValue;
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
AWS.getHeadersFromEvent = (event) => {
|
|
24
|
-
const { headers = {}, multiValueHeaders = {} } = event;
|
|
25
|
-
const mergedHeaders = {
|
|
26
|
-
...headers,
|
|
27
|
-
...multiValueHeaders,
|
|
28
|
-
};
|
|
29
|
-
const normalizedHeaders = Object.keys(mergedHeaders).reduce((acc, key) => {
|
|
30
|
-
const value = mergedHeaders[key];
|
|
31
|
-
const normalizedKey = key.toLowerCase();
|
|
32
|
-
const normalizedValue = Array.isArray(value) ? value : [value];
|
|
33
|
-
return {
|
|
34
|
-
...acc,
|
|
35
|
-
[normalizedKey]: normalizedValue,
|
|
36
|
-
};
|
|
37
|
-
}, {});
|
|
38
|
-
return normalizedHeaders;
|
|
39
|
-
};
|
|
40
|
-
AWS.getMethodFromEvent = (event) => {
|
|
41
|
-
const { httpMethod = "" } = event;
|
|
42
|
-
return httpMethod;
|
|
43
|
-
};
|
|
44
|
-
AWS.getAuthInfo = (event) => {
|
|
45
|
-
const { requestContext: { authorizer: { claims: { sub: userId = undefined, "cognito:groups": roles = [], } = {}, } = {}, } = {}, } = event;
|
|
46
|
-
const cleanRoles = Array.isArray(roles)
|
|
47
|
-
? roles
|
|
48
|
-
: typeof roles === "string"
|
|
49
|
-
? roles
|
|
50
|
-
.split(",")
|
|
51
|
-
.map((x) => x.trim())
|
|
52
|
-
.filter((x) => !!x)
|
|
53
|
-
: [];
|
|
54
|
-
return {
|
|
55
|
-
userId,
|
|
56
|
-
roles: cleanRoles,
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Parse out the Auth, CORS, Headers, Method and Body from an AWS Cloud Function event.
|
|
61
|
-
* */
|
|
62
|
-
AWS.normalizeCloudFunctionEvent = (event) => {
|
|
63
|
-
const authInfo = AWS.getAuthInfo(event);
|
|
64
|
-
const headers = AWS.getHeadersFromEvent(event);
|
|
65
|
-
const method = AWS.getMethodFromEvent(event);
|
|
66
|
-
const path = AWS.getPathFromEvent(event);
|
|
67
|
-
const body = AWS.getBodyFromEvent(event);
|
|
68
|
-
return {
|
|
69
|
-
authInfo,
|
|
70
|
-
headers,
|
|
71
|
-
method,
|
|
72
|
-
path,
|
|
73
|
-
body,
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
})(AWS || (exports.AWS = AWS = {}));
|
package/src/api/Router/Auth.d.ts
DELETED
package/src/api/Router/Auth.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRouteIsAuthorized = void 0;
|
|
4
|
-
const getRouteIsAuthorized = (authInfo, authConfig) => {
|
|
5
|
-
const { userId, roles = [] } = authInfo;
|
|
6
|
-
const { public: routeIsPublic = false, anyAuthorized, allowedRoles = [] } = authConfig;
|
|
7
|
-
return routeIsPublic || (anyAuthorized && !!userId) || !!allowedRoles.find((role) => roles.includes(role));
|
|
8
|
-
};
|
|
9
|
-
exports.getRouteIsAuthorized = getRouteIsAuthorized;
|
package/src/api/Router/CORS.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CORSPatter } from "./Types";
|
|
2
|
-
export declare const originMatchesString: (origin?: string, str?: string) => boolean;
|
|
3
|
-
export declare const originMatchesRegExp: (origin?: string, regExp?: RegExp) => boolean;
|
|
4
|
-
export declare const originMatches: (origin?: string, corsPattern?: CORSPatter) => boolean;
|
|
5
|
-
export declare const getAllowedCORSOrigin: (origin?: string, corsPatterns?: CORSPatter[]) => string;
|
|
6
|
-
export declare const getHeadersWithCORS: (origin?: string, corsPatterns?: CORSPatter[]) => Record<string, string>;
|
package/src/api/Router/CORS.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHeadersWithCORS = exports.getAllowedCORSOrigin = exports.originMatches = exports.originMatchesRegExp = exports.originMatchesString = void 0;
|
|
4
|
-
const originMatchesString = (origin = "", str = "") => str === origin;
|
|
5
|
-
exports.originMatchesString = originMatchesString;
|
|
6
|
-
const originMatchesRegExp = (origin = "", regExp = /^$/) => !!regExp.test(origin);
|
|
7
|
-
exports.originMatchesRegExp = originMatchesRegExp;
|
|
8
|
-
const originMatches = (origin = "", corsPattern = "") => {
|
|
9
|
-
if (typeof corsPattern === "string") {
|
|
10
|
-
return (0, exports.originMatchesString)(origin, corsPattern);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
return (0, exports.originMatchesRegExp)(origin, corsPattern);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
exports.originMatches = originMatches;
|
|
17
|
-
const getAllowedCORSOrigin = (origin = "", corsPatterns = []) => !!corsPatterns.find((cP) => (0, exports.originMatches)(origin, cP)) ? origin : "";
|
|
18
|
-
exports.getAllowedCORSOrigin = getAllowedCORSOrigin;
|
|
19
|
-
const getHeadersWithCORS = (origin = "", corsPatterns = []) => {
|
|
20
|
-
return {
|
|
21
|
-
"Access-Control-Allow-Origin": (0, exports.getAllowedCORSOrigin)(origin, corsPatterns),
|
|
22
|
-
"Access-Control-Allow-Credentials": "true",
|
|
23
|
-
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization",
|
|
24
|
-
"Access-Control-Allow-Methods": "OPTIONS, HEAD, GET, POST, PUT, PATCH, DELETE",
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
exports.getHeadersWithCORS = getHeadersWithCORS;
|
package/src/api/Router/Types.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CloudFunctionEventRouter, Route, RouteMap } from "./Types";
|
|
2
|
-
export * from "./AWS";
|
|
3
|
-
/**
|
|
4
|
-
* A utility function to add a route to a route map by path.
|
|
5
|
-
* */
|
|
6
|
-
export declare const addRouteToRouteMap: (routeMap: RouteMap, route: Route, basePath?: string) => RouteMap;
|
|
7
|
-
/**
|
|
8
|
-
* Add multiple routes to a {@link RouteMap} by path.
|
|
9
|
-
* */
|
|
10
|
-
export declare const addRoutesToRouteMap: (routeMap: RouteMap, routes: Route[], basePath?: string) => RouteMap;
|
|
11
|
-
/**
|
|
12
|
-
* Apply one {@link RouteMap} to another.
|
|
13
|
-
* */
|
|
14
|
-
export declare const addRouteMapToRouteMap: (routeMap: RouteMap, routeMapToAdd: RouteMap, basePath?: string) => RouteMap;
|
|
15
|
-
/**
|
|
16
|
-
* A Cloud Function event router.
|
|
17
|
-
* */
|
|
18
|
-
export declare const handleCloudFunctionEvent: CloudFunctionEventRouter;
|
package/src/api/Router/index.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.handleCloudFunctionEvent = exports.addRouteMapToRouteMap = exports.addRoutesToRouteMap = exports.addRouteToRouteMap = void 0;
|
|
18
|
-
const Auth_1 = require("./Auth");
|
|
19
|
-
const CORS_1 = require("./CORS");
|
|
20
|
-
const Routing_1 = require("../../common/Routing");
|
|
21
|
-
const Utils_1 = require("../../common/Logging/Utils");
|
|
22
|
-
__exportStar(require("./AWS"), exports);
|
|
23
|
-
/**
|
|
24
|
-
* A utility function to add a route to a route map by path.
|
|
25
|
-
* */
|
|
26
|
-
const addRouteToRouteMap = (routeMap, route, basePath = "") => {
|
|
27
|
-
const { path: routePath } = route;
|
|
28
|
-
const path = (0, Routing_1.mergeStringPaths)(basePath, routePath);
|
|
29
|
-
return {
|
|
30
|
-
...routeMap,
|
|
31
|
-
[path]: route,
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
exports.addRouteToRouteMap = addRouteToRouteMap;
|
|
35
|
-
/**
|
|
36
|
-
* Add multiple routes to a {@link RouteMap} by path.
|
|
37
|
-
* */
|
|
38
|
-
const addRoutesToRouteMap = (routeMap, routes, basePath = "") => {
|
|
39
|
-
let newRouteMap = {
|
|
40
|
-
...routeMap,
|
|
41
|
-
};
|
|
42
|
-
for (const route of routes) {
|
|
43
|
-
newRouteMap = (0, exports.addRouteToRouteMap)(newRouteMap, route, basePath);
|
|
44
|
-
}
|
|
45
|
-
return newRouteMap;
|
|
46
|
-
};
|
|
47
|
-
exports.addRoutesToRouteMap = addRoutesToRouteMap;
|
|
48
|
-
/**
|
|
49
|
-
* Apply one {@link RouteMap} to another.
|
|
50
|
-
* */
|
|
51
|
-
const addRouteMapToRouteMap = (routeMap, routeMapToAdd, basePath = "") => {
|
|
52
|
-
const newRouteMap = {
|
|
53
|
-
...routeMap,
|
|
54
|
-
};
|
|
55
|
-
for (const k in routeMapToAdd) {
|
|
56
|
-
const path = (0, Routing_1.mergeStringPaths)(basePath, k);
|
|
57
|
-
newRouteMap[path] = routeMapToAdd[k];
|
|
58
|
-
}
|
|
59
|
-
return newRouteMap;
|
|
60
|
-
};
|
|
61
|
-
exports.addRouteMapToRouteMap = addRouteMapToRouteMap;
|
|
62
|
-
/**
|
|
63
|
-
* A Cloud Function event router.
|
|
64
|
-
* */
|
|
65
|
-
const handleCloudFunctionEvent = async (event, eventTransformer, routeMap, allowedOrigins, errorShouldBeExposedToClient, debug = false) => {
|
|
66
|
-
let transformedEvent = undefined;
|
|
67
|
-
try {
|
|
68
|
-
transformedEvent = eventTransformer(event);
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
// Ignore.
|
|
72
|
-
}
|
|
73
|
-
if (transformedEvent) {
|
|
74
|
-
const { authInfo, headers: { origin: originItems = [] } = {}, path = "",
|
|
75
|
-
// IMPORTANT: Respond automatically to all OPTIONS requests.
|
|
76
|
-
method,
|
|
77
|
-
// IMPORTANT: Should be an array of arguments.
|
|
78
|
-
body = [], } = transformedEvent;
|
|
79
|
-
const providedOrigin = originItems[0];
|
|
80
|
-
const normalizedOrigin = typeof providedOrigin === "string" ? providedOrigin : "";
|
|
81
|
-
const normalizedBody = Array.isArray(body) ? body : [body];
|
|
82
|
-
const normalizedPath = (0, Routing_1.getPathString)((0, Routing_1.getPathArray)(`${path}`));
|
|
83
|
-
const route = routeMap[normalizedPath];
|
|
84
|
-
const responseHeaders = (0, CORS_1.getHeadersWithCORS)(normalizedOrigin, allowedOrigins);
|
|
85
|
-
if (method === "OPTIONS") {
|
|
86
|
-
return {
|
|
87
|
-
statusCode: 200,
|
|
88
|
-
headers: responseHeaders,
|
|
89
|
-
body: "OK",
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
if (route) {
|
|
94
|
-
const { authConfig = {}, handlerFactory, handler } = route;
|
|
95
|
-
const requestIsAuthorized = (0, Auth_1.getRouteIsAuthorized)(authInfo, authConfig);
|
|
96
|
-
if (requestIsAuthorized) {
|
|
97
|
-
const handlerInstance = handler
|
|
98
|
-
? handler
|
|
99
|
-
: handlerFactory(transformedEvent);
|
|
100
|
-
try {
|
|
101
|
-
const result = await (0, Utils_1.logFunctionCall)(normalizedPath, normalizedBody, handlerInstance, debug);
|
|
102
|
-
return {
|
|
103
|
-
statusCode: 200,
|
|
104
|
-
headers: responseHeaders,
|
|
105
|
-
body: JSON.stringify(result),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
return {
|
|
110
|
-
statusCode: 500,
|
|
111
|
-
headers: responseHeaders,
|
|
112
|
-
body: JSON.stringify({
|
|
113
|
-
status: "Internal Server Error",
|
|
114
|
-
message: error?.message,
|
|
115
|
-
error: errorShouldBeExposedToClient
|
|
116
|
-
? errorShouldBeExposedToClient(error)
|
|
117
|
-
? error
|
|
118
|
-
: undefined
|
|
119
|
-
: undefined,
|
|
120
|
-
}, null, 2),
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
return {
|
|
126
|
-
statusCode: 401,
|
|
127
|
-
headers: responseHeaders,
|
|
128
|
-
body: "Unauthorized",
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
statusCode: 404,
|
|
134
|
-
headers: responseHeaders,
|
|
135
|
-
body: "Not Found",
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
statusCode: 500,
|
|
141
|
-
headers: {},
|
|
142
|
-
body: "Internal Server Error",
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
exports.handleCloudFunctionEvent = handleCloudFunctionEvent;
|
package/src/api/index.d.ts
DELETED