@thisisagile/easy 15.8.6 → 15.8.8
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/dist/chunk-4N72FQFX.mjs +16 -0
- package/dist/chunk-4N72FQFX.mjs.map +1 -0
- package/dist/data/Condition.d.ts +25 -0
- package/dist/data/Condition.js +71 -0
- package/dist/data/Condition.js.map +1 -0
- package/dist/data/Condition.mjs +44 -0
- package/dist/data/Condition.mjs.map +1 -0
- package/dist/data/DataProvider.d.ts +1 -0
- package/dist/data/DataProvider.js +17 -0
- package/dist/data/DataProvider.js.map +1 -0
- package/dist/data/DataProvider.mjs +1 -0
- package/dist/data/DataProvider.mjs.map +1 -0
- package/dist/data/Database.d.ts +22 -0
- package/dist/data/Database.js +42 -0
- package/dist/data/Database.js.map +1 -0
- package/dist/data/Database.mjs +18 -0
- package/dist/data/Database.mjs.map +1 -0
- package/dist/data/Field.d.ts +17 -0
- package/dist/data/Field.js +48 -0
- package/dist/data/Field.js.map +1 -0
- package/dist/data/Field.mjs +24 -0
- package/dist/data/Field.mjs.map +1 -0
- package/dist/data/InMemoryGateway.d.ts +12 -0
- package/dist/data/InMemoryGateway.js +59 -0
- package/dist/data/InMemoryGateway.js.map +1 -0
- package/dist/data/InMemoryGateway.mjs +36 -0
- package/dist/data/InMemoryGateway.mjs.map +1 -0
- package/dist/data/Query.d.ts +2 -0
- package/dist/data/Query.js +17 -0
- package/dist/data/Query.js.map +1 -0
- package/dist/data/Query.mjs +1 -0
- package/dist/data/Query.mjs.map +1 -0
- package/dist/data/QueryProvider.d.ts +7 -0
- package/dist/data/QueryProvider.js +17 -0
- package/dist/data/QueryProvider.js.map +1 -0
- package/dist/data/QueryProvider.mjs +1 -0
- package/dist/data/QueryProvider.mjs.map +1 -0
- package/dist/data/index.d.ts +7 -0
- package/dist/data/index.js +35 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/index.mjs +8 -0
- package/dist/data/index.mjs.map +1 -0
- package/dist/domain/Audit.d.ts +11 -0
- package/dist/domain/Audit.js +59 -0
- package/dist/domain/Audit.js.map +1 -0
- package/dist/domain/Audit.mjs +29 -0
- package/dist/domain/Audit.mjs.map +1 -0
- package/dist/domain/Child.d.ts +6 -0
- package/dist/domain/Child.js +49 -0
- package/dist/domain/Child.js.map +1 -0
- package/dist/domain/Child.mjs +19 -0
- package/dist/domain/Child.mjs.map +1 -0
- package/dist/domain/Entity.d.ts +9 -0
- package/dist/domain/Entity.js +62 -0
- package/dist/domain/Entity.js.map +1 -0
- package/dist/domain/Entity.mjs +32 -0
- package/dist/domain/Entity.mjs.map +1 -0
- package/dist/domain/Repo.d.ts +23 -0
- package/dist/domain/Repo.js +81 -0
- package/dist/domain/Repo.js.map +1 -0
- package/dist/domain/Repo.mjs +58 -0
- package/dist/domain/Repo.mjs.map +1 -0
- package/dist/domain/Struct.d.ts +11 -0
- package/dist/domain/Struct.js +55 -0
- package/dist/domain/Struct.js.map +1 -0
- package/dist/domain/Struct.mjs +31 -0
- package/dist/domain/Struct.mjs.map +1 -0
- package/dist/domain/Typo.d.ts +16 -0
- package/dist/domain/Typo.js +62 -0
- package/dist/domain/Typo.js.map +1 -0
- package/dist/domain/Typo.mjs +39 -0
- package/dist/domain/Typo.mjs.map +1 -0
- package/dist/domain/enums/Country.d.ts +256 -0
- package/dist/domain/enums/Country.js +290 -0
- package/dist/domain/enums/Country.js.map +1 -0
- package/dist/domain/enums/Country.mjs +267 -0
- package/dist/domain/enums/Country.mjs.map +1 -0
- package/dist/domain/enums/Currency.d.ts +127 -0
- package/dist/domain/enums/Currency.js +159 -0
- package/dist/domain/enums/Currency.js.map +1 -0
- package/dist/domain/enums/Currency.mjs +136 -0
- package/dist/domain/enums/Currency.mjs.map +1 -0
- package/dist/domain/enums/Environment.d.ts +7 -0
- package/dist/domain/enums/Environment.js +35 -0
- package/dist/domain/enums/Environment.js.map +1 -0
- package/dist/domain/enums/Environment.mjs +12 -0
- package/dist/domain/enums/Environment.mjs.map +1 -0
- package/dist/domain/enums/Locale.d.ts +571 -0
- package/dist/domain/enums/Locale.js +605 -0
- package/dist/domain/enums/Locale.js.map +1 -0
- package/dist/domain/enums/Locale.mjs +582 -0
- package/dist/domain/enums/Locale.mjs.map +1 -0
- package/dist/domain/enums/UnitOfMeasurement.d.ts +10 -0
- package/dist/domain/enums/UnitOfMeasurement.js +40 -0
- package/dist/domain/enums/UnitOfMeasurement.js.map +1 -0
- package/dist/domain/enums/UnitOfMeasurement.mjs +17 -0
- package/dist/domain/enums/UnitOfMeasurement.mjs.map +1 -0
- package/dist/domain/enums/UnitOfWeight.d.ts +8 -0
- package/dist/domain/enums/UnitOfWeight.js +38 -0
- package/dist/domain/enums/UnitOfWeight.js.map +1 -0
- package/dist/domain/enums/UnitOfWeight.mjs +15 -0
- package/dist/domain/enums/UnitOfWeight.mjs.map +1 -0
- package/dist/domain/enums/index.d.ts +6 -0
- package/dist/domain/enums/index.js +33 -0
- package/dist/domain/enums/index.js.map +1 -0
- package/dist/domain/enums/index.mjs +7 -0
- package/dist/domain/enums/index.mjs.map +1 -0
- package/dist/domain/index.d.ts +9 -0
- package/dist/domain/index.js +39 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/index.mjs +10 -0
- package/dist/domain/index.mjs.map +1 -0
- package/dist/domain/structs/Address.d.ts +12 -0
- package/dist/domain/structs/Address.js +73 -0
- package/dist/domain/structs/Address.js.map +1 -0
- package/dist/domain/structs/Address.mjs +42 -0
- package/dist/domain/structs/Address.mjs.map +1 -0
- package/dist/domain/structs/Box.d.ts +15 -0
- package/dist/domain/structs/Box.js +70 -0
- package/dist/domain/structs/Box.js.map +1 -0
- package/dist/domain/structs/Box.mjs +40 -0
- package/dist/domain/structs/Box.mjs.map +1 -0
- package/dist/domain/structs/Dimension.d.ts +10 -0
- package/dist/domain/structs/Dimension.js +61 -0
- package/dist/domain/structs/Dimension.js.map +1 -0
- package/dist/domain/structs/Dimension.mjs +31 -0
- package/dist/domain/structs/Dimension.mjs.map +1 -0
- package/dist/domain/structs/Money.d.ts +12 -0
- package/dist/domain/structs/Money.js +71 -0
- package/dist/domain/structs/Money.js.map +1 -0
- package/dist/domain/structs/Money.mjs +39 -0
- package/dist/domain/structs/Money.mjs.map +1 -0
- package/dist/domain/structs/Name.d.ts +9 -0
- package/dist/domain/structs/Name.js +57 -0
- package/dist/domain/structs/Name.js.map +1 -0
- package/dist/domain/structs/Name.mjs +26 -0
- package/dist/domain/structs/Name.mjs.map +1 -0
- package/dist/domain/structs/Weight.d.ts +13 -0
- package/dist/domain/structs/Weight.js +71 -0
- package/dist/domain/structs/Weight.js.map +1 -0
- package/dist/domain/structs/Weight.mjs +40 -0
- package/dist/domain/structs/Weight.mjs.map +1 -0
- package/dist/domain/structs/index.d.ts +6 -0
- package/dist/domain/structs/index.js +33 -0
- package/dist/domain/structs/index.js.map +1 -0
- package/dist/domain/structs/index.mjs +7 -0
- package/dist/domain/structs/index.mjs.map +1 -0
- package/dist/domain/values/DateTime.d.ts +34 -0
- package/dist/domain/values/DateTime.js +117 -0
- package/dist/domain/values/DateTime.js.map +1 -0
- package/dist/domain/values/DateTime.mjs +92 -0
- package/dist/domain/values/DateTime.mjs.map +1 -0
- package/dist/domain/values/EAN.d.ts +5 -0
- package/dist/domain/values/EAN.js +50 -0
- package/dist/domain/values/EAN.js.map +1 -0
- package/dist/domain/values/EAN.mjs +16 -0
- package/dist/domain/values/EAN.mjs.map +1 -0
- package/dist/domain/values/Email.d.ts +8 -0
- package/dist/domain/values/Email.js +57 -0
- package/dist/domain/values/Email.js.map +1 -0
- package/dist/domain/values/Email.mjs +22 -0
- package/dist/domain/values/Email.mjs.map +1 -0
- package/dist/domain/values/IBAN.d.ts +5 -0
- package/dist/domain/values/IBAN.js +50 -0
- package/dist/domain/values/IBAN.js.map +1 -0
- package/dist/domain/values/IBAN.mjs +16 -0
- package/dist/domain/values/IBAN.mjs.map +1 -0
- package/dist/domain/values/PostalCode.d.ts +8 -0
- package/dist/domain/values/PostalCode.js +53 -0
- package/dist/domain/values/PostalCode.js.map +1 -0
- package/dist/domain/values/PostalCode.mjs +19 -0
- package/dist/domain/values/PostalCode.mjs.map +1 -0
- package/dist/domain/values/Url.d.ts +22 -0
- package/dist/domain/values/Url.js +57 -0
- package/dist/domain/values/Url.js.map +1 -0
- package/dist/domain/values/Url.mjs +22 -0
- package/dist/domain/values/Url.mjs.map +1 -0
- package/dist/domain/values/index.d.ts +6 -0
- package/dist/domain/values/index.js +33 -0
- package/dist/domain/values/index.js.map +1 -0
- package/dist/domain/values/index.mjs +7 -0
- package/dist/domain/values/index.mjs.map +1 -0
- package/dist/health/HealthResource.d.ts +5 -0
- package/dist/health/HealthResource.js +49 -0
- package/dist/health/HealthResource.js.map +1 -0
- package/dist/health/HealthResource.mjs +19 -0
- package/dist/health/HealthResource.mjs.map +1 -0
- package/dist/health/HealthUri.d.ts +5 -0
- package/dist/health/HealthUri.js +33 -0
- package/dist/health/HealthUri.js.map +1 -0
- package/dist/health/HealthUri.mjs +10 -0
- package/dist/health/HealthUri.mjs.map +1 -0
- package/dist/health/index.d.ts +2 -0
- package/dist/health/index.js +25 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/index.mjs +3 -0
- package/dist/health/index.mjs.map +1 -0
- package/dist/http/CacheControl.d.ts +24 -0
- package/dist/http/CacheControl.js +56 -0
- package/dist/http/CacheControl.js.map +1 -0
- package/dist/http/CacheControl.mjs +33 -0
- package/dist/http/CacheControl.mjs.map +1 -0
- package/dist/http/ContentType.d.ts +12 -0
- package/dist/http/ContentType.js +53 -0
- package/dist/http/ContentType.js.map +1 -0
- package/dist/http/ContentType.mjs +20 -0
- package/dist/http/ContentType.mjs.map +1 -0
- package/dist/http/HttpHeader.d.ts +4 -0
- package/dist/http/HttpHeader.js +32 -0
- package/dist/http/HttpHeader.js.map +1 -0
- package/dist/http/HttpHeader.mjs +9 -0
- package/dist/http/HttpHeader.mjs.map +1 -0
- package/dist/http/HttpStatus.d.ts +72 -0
- package/dist/http/HttpStatus.js +112 -0
- package/dist/http/HttpStatus.js.map +1 -0
- package/dist/http/HttpStatus.mjs +87 -0
- package/dist/http/HttpStatus.mjs.map +1 -0
- package/dist/http/HttpVerb.d.ts +9 -0
- package/dist/http/HttpVerb.js +39 -0
- package/dist/http/HttpVerb.js.map +1 -0
- package/dist/http/HttpVerb.mjs +16 -0
- package/dist/http/HttpVerb.mjs.map +1 -0
- package/dist/http/LocalRequestStore.d.ts +7 -0
- package/dist/http/LocalRequestStore.js +36 -0
- package/dist/http/LocalRequestStore.js.map +1 -0
- package/dist/http/LocalRequestStore.mjs +13 -0
- package/dist/http/LocalRequestStore.mjs.map +1 -0
- package/dist/http/OriginatedError.d.ts +9 -0
- package/dist/http/OriginatedError.js +42 -0
- package/dist/http/OriginatedError.js.map +1 -0
- package/dist/http/OriginatedError.mjs +17 -0
- package/dist/http/OriginatedError.mjs.map +1 -0
- package/dist/http/Request.d.ts +11 -0
- package/dist/http/Request.js +17 -0
- package/dist/http/Request.js.map +1 -0
- package/dist/http/Request.mjs +1 -0
- package/dist/http/Request.mjs.map +1 -0
- package/dist/http/RequestOptions.d.ts +35 -0
- package/dist/http/RequestOptions.js +91 -0
- package/dist/http/RequestOptions.js.map +1 -0
- package/dist/http/RequestOptions.mjs +66 -0
- package/dist/http/RequestOptions.mjs.map +1 -0
- package/dist/http/RequestProvider.d.ts +5 -0
- package/dist/http/RequestProvider.js +17 -0
- package/dist/http/RequestProvider.js.map +1 -0
- package/dist/http/RequestProvider.mjs +1 -0
- package/dist/http/RequestProvider.mjs.map +1 -0
- package/dist/http/Response.d.ts +14 -0
- package/dist/http/Response.js +39 -0
- package/dist/http/Response.js.map +1 -0
- package/dist/http/Response.mjs +15 -0
- package/dist/http/Response.mjs.map +1 -0
- package/dist/http/RestResult.d.ts +23 -0
- package/dist/http/RestResult.js +56 -0
- package/dist/http/RestResult.js.map +1 -0
- package/dist/http/RestResult.mjs +32 -0
- package/dist/http/RestResult.mjs.map +1 -0
- package/dist/http/Verb.d.ts +20 -0
- package/dist/http/Verb.js +61 -0
- package/dist/http/Verb.js.map +1 -0
- package/dist/http/Verb.mjs +31 -0
- package/dist/http/Verb.mjs.map +1 -0
- package/dist/http/index.d.ts +12 -0
- package/dist/http/index.js +45 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/index.mjs +13 -0
- package/dist/http/index.mjs.map +1 -0
- package/dist/index.d.ts +12 -2821
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +13 -1
- package/dist/index.mjs.map +1 -0
- package/dist/process/App.d.ts +5 -0
- package/dist/process/App.js +35 -0
- package/dist/process/App.js.map +1 -0
- package/dist/process/App.mjs +12 -0
- package/dist/process/App.mjs.map +1 -0
- package/dist/process/Manage.d.ts +8 -0
- package/dist/process/Manage.js +43 -0
- package/dist/process/Manage.js.map +1 -0
- package/dist/process/Manage.mjs +20 -0
- package/dist/process/Manage.mjs.map +1 -0
- package/dist/process/Scope.d.ts +5 -0
- package/dist/process/Scope.js +38 -0
- package/dist/process/Scope.js.map +1 -0
- package/dist/process/Scope.mjs +15 -0
- package/dist/process/Scope.mjs.map +1 -0
- package/dist/process/Search.d.ts +14 -0
- package/dist/process/Search.js +62 -0
- package/dist/process/Search.js.map +1 -0
- package/dist/process/Search.mjs +39 -0
- package/dist/process/Search.mjs.map +1 -0
- package/dist/process/UseCase.d.ts +10 -0
- package/dist/process/UseCase.js +48 -0
- package/dist/process/UseCase.js.map +1 -0
- package/dist/process/UseCase.mjs +25 -0
- package/dist/process/UseCase.mjs.map +1 -0
- package/dist/process/index.d.ts +5 -0
- package/dist/process/index.js +31 -0
- package/dist/process/index.js.map +1 -0
- package/dist/process/index.mjs +6 -0
- package/dist/process/index.mjs.map +1 -0
- package/dist/resources/AppProvider.d.ts +9 -0
- package/dist/resources/AppProvider.js +17 -0
- package/dist/resources/AppProvider.js.map +1 -0
- package/dist/resources/AppProvider.mjs +1 -0
- package/dist/resources/AppProvider.mjs.map +1 -0
- package/dist/resources/Req.d.ts +23 -0
- package/dist/resources/Req.js +52 -0
- package/dist/resources/Req.js.map +1 -0
- package/dist/resources/Req.mjs +28 -0
- package/dist/resources/Req.mjs.map +1 -0
- package/dist/resources/Requires.d.ts +8 -0
- package/dist/resources/Requires.js +48 -0
- package/dist/resources/Requires.js.map +1 -0
- package/dist/resources/Requires.mjs +24 -0
- package/dist/resources/Requires.mjs.map +1 -0
- package/dist/resources/Resource.d.ts +1 -0
- package/dist/resources/Resource.js +17 -0
- package/dist/resources/Resource.js.map +1 -0
- package/dist/resources/Resource.mjs +1 -0
- package/dist/resources/Resource.mjs.map +1 -0
- package/dist/resources/Route.d.ts +26 -0
- package/dist/resources/Route.js +62 -0
- package/dist/resources/Route.js.map +1 -0
- package/dist/resources/Route.mjs +38 -0
- package/dist/resources/Route.mjs.map +1 -0
- package/dist/resources/Service.d.ts +15 -0
- package/dist/resources/Service.js +49 -0
- package/dist/resources/Service.js.map +1 -0
- package/dist/resources/Service.mjs +26 -0
- package/dist/resources/Service.mjs.map +1 -0
- package/dist/resources/index.d.ts +7 -0
- package/dist/resources/index.js +35 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/index.mjs +8 -0
- package/dist/resources/index.mjs.map +1 -0
- package/dist/security/Jwt.d.ts +15 -0
- package/dist/security/Jwt.js +48 -0
- package/dist/security/Jwt.js.map +1 -0
- package/dist/security/Jwt.mjs +25 -0
- package/dist/security/Jwt.mjs.map +1 -0
- package/dist/security/index.d.ts +1 -0
- package/dist/security/index.js +23 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/index.mjs +2 -0
- package/dist/security/index.mjs.map +1 -0
- package/dist/services/Api.d.ts +16 -0
- package/dist/services/Api.js +93 -0
- package/dist/services/Api.js.map +1 -0
- package/dist/services/Api.mjs +69 -0
- package/dist/services/Api.mjs.map +1 -0
- package/dist/services/ApiGateway.d.ts +14 -0
- package/dist/services/ApiGateway.js +57 -0
- package/dist/services/ApiGateway.js.map +1 -0
- package/dist/services/ApiGateway.mjs +34 -0
- package/dist/services/ApiGateway.mjs.map +1 -0
- package/dist/services/AxiosProvider.d.ts +7 -0
- package/dist/services/AxiosProvider.js +61 -0
- package/dist/services/AxiosProvider.js.map +1 -0
- package/dist/services/AxiosProvider.mjs +28 -0
- package/dist/services/AxiosProvider.mjs.map +1 -0
- package/dist/services/MappedRouteGateway.d.ts +16 -0
- package/dist/services/MappedRouteGateway.js +52 -0
- package/dist/services/MappedRouteGateway.js.map +1 -0
- package/dist/services/MappedRouteGateway.mjs +29 -0
- package/dist/services/MappedRouteGateway.mjs.map +1 -0
- package/dist/services/RouteGateway.d.ts +19 -0
- package/dist/services/RouteGateway.js +70 -0
- package/dist/services/RouteGateway.js.map +1 -0
- package/dist/services/RouteGateway.mjs +47 -0
- package/dist/services/RouteGateway.mjs.map +1 -0
- package/dist/services/ViewRouteGateway.d.ts +21 -0
- package/dist/services/ViewRouteGateway.js +55 -0
- package/dist/services/ViewRouteGateway.js.map +1 -0
- package/dist/services/ViewRouteGateway.mjs +32 -0
- package/dist/services/ViewRouteGateway.mjs.map +1 -0
- package/dist/services/index.d.ts +6 -0
- package/dist/services/index.js +33 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/index.mjs +7 -0
- package/dist/services/index.mjs.map +1 -0
- package/dist/sql/Clause.d.ts +17 -0
- package/dist/sql/Clause.js +58 -0
- package/dist/sql/Clause.js.map +1 -0
- package/dist/sql/Clause.mjs +31 -0
- package/dist/sql/Clause.mjs.map +1 -0
- package/dist/sql/Column.d.ts +41 -0
- package/dist/sql/Column.js +96 -0
- package/dist/sql/Column.js.map +1 -0
- package/dist/sql/Column.mjs +71 -0
- package/dist/sql/Column.mjs.map +1 -0
- package/dist/sql/Count.d.ts +7 -0
- package/dist/sql/Count.js +38 -0
- package/dist/sql/Count.js.map +1 -0
- package/dist/sql/Count.mjs +15 -0
- package/dist/sql/Count.mjs.map +1 -0
- package/dist/sql/Delete.d.ts +4 -0
- package/dist/sql/Delete.js +35 -0
- package/dist/sql/Delete.js.map +1 -0
- package/dist/sql/Delete.mjs +12 -0
- package/dist/sql/Delete.mjs.map +1 -0
- package/dist/sql/Insert.d.ts +9 -0
- package/dist/sql/Insert.js +40 -0
- package/dist/sql/Insert.js.map +1 -0
- package/dist/sql/Insert.mjs +17 -0
- package/dist/sql/Insert.mjs.map +1 -0
- package/dist/sql/Join.d.ts +12 -0
- package/dist/sql/Join.js +46 -0
- package/dist/sql/Join.js.map +1 -0
- package/dist/sql/Join.mjs +23 -0
- package/dist/sql/Join.mjs.map +1 -0
- package/dist/sql/Select.d.ts +21 -0
- package/dist/sql/Select.js +68 -0
- package/dist/sql/Select.js.map +1 -0
- package/dist/sql/Select.mjs +45 -0
- package/dist/sql/Select.mjs.map +1 -0
- package/dist/sql/SqlQuery.d.ts +8 -0
- package/dist/sql/SqlQuery.js +39 -0
- package/dist/sql/SqlQuery.js.map +1 -0
- package/dist/sql/SqlQuery.mjs +16 -0
- package/dist/sql/SqlQuery.mjs.map +1 -0
- package/dist/sql/Table.d.ts +34 -0
- package/dist/sql/Table.js +63 -0
- package/dist/sql/Table.js.map +1 -0
- package/dist/sql/Table.mjs +40 -0
- package/dist/sql/Table.mjs.map +1 -0
- package/dist/sql/TableGateway.d.ts +18 -0
- package/dist/sql/TableGateway.js +62 -0
- package/dist/sql/TableGateway.js.map +1 -0
- package/dist/sql/TableGateway.mjs +39 -0
- package/dist/sql/TableGateway.mjs.map +1 -0
- package/dist/sql/Update.d.ts +9 -0
- package/dist/sql/Update.js +41 -0
- package/dist/sql/Update.js.map +1 -0
- package/dist/sql/Update.mjs +18 -0
- package/dist/sql/Update.mjs.map +1 -0
- package/dist/sql/index.d.ts +10 -0
- package/dist/sql/index.js +41 -0
- package/dist/sql/index.js.map +1 -0
- package/dist/sql/index.mjs +11 -0
- package/dist/sql/index.mjs.map +1 -0
- package/dist/types/Array.d.ts +9 -0
- package/dist/types/Array.js +54 -0
- package/dist/types/Array.js.map +1 -0
- package/dist/types/Array.mjs +29 -0
- package/dist/types/Array.mjs.map +1 -0
- package/dist/types/Builder.d.ts +6 -0
- package/dist/types/Builder.js +43 -0
- package/dist/types/Builder.js.map +1 -0
- package/dist/types/Builder.mjs +19 -0
- package/dist/types/Builder.mjs.map +1 -0
- package/dist/types/Cache.d.ts +12 -0
- package/dist/types/Cache.js +38 -0
- package/dist/types/Cache.js.map +1 -0
- package/dist/types/Cache.mjs +14 -0
- package/dist/types/Cache.mjs.map +1 -0
- package/dist/types/CacheAge.d.ts +5 -0
- package/dist/types/CacheAge.js +64 -0
- package/dist/types/CacheAge.js.map +1 -0
- package/dist/types/CacheAge.mjs +41 -0
- package/dist/types/CacheAge.mjs.map +1 -0
- package/dist/types/Case.d.ts +59 -0
- package/dist/types/Case.js +115 -0
- package/dist/types/Case.js.map +1 -0
- package/dist/types/Case.mjs +92 -0
- package/dist/types/Case.mjs.map +1 -0
- package/dist/types/Constructor.d.ts +15 -0
- package/dist/types/Constructor.js +50 -0
- package/dist/types/Constructor.js.map +1 -0
- package/dist/types/Constructor.mjs +22 -0
- package/dist/types/Constructor.mjs.map +1 -0
- package/dist/types/Context.d.ts +63 -0
- package/dist/types/Context.js +117 -0
- package/dist/types/Context.js.map +1 -0
- package/dist/types/Context.mjs +90 -0
- package/dist/types/Context.mjs.map +1 -0
- package/dist/types/Enum.d.ts +24 -0
- package/dist/types/Enum.js +76 -0
- package/dist/types/Enum.js.map +1 -0
- package/dist/types/Enum.mjs +52 -0
- package/dist/types/Enum.mjs.map +1 -0
- package/dist/types/ErrorOrigin.d.ts +6 -0
- package/dist/types/ErrorOrigin.js +17 -0
- package/dist/types/ErrorOrigin.js.map +1 -0
- package/dist/types/ErrorOrigin.mjs +1 -0
- package/dist/types/ErrorOrigin.mjs.map +1 -0
- package/dist/types/Exception.d.ts +20 -0
- package/dist/types/Exception.js +54 -0
- package/dist/types/Exception.js.map +1 -0
- package/dist/types/Exception.mjs +29 -0
- package/dist/types/Exception.mjs.map +1 -0
- package/dist/types/Falsy.d.ts +4 -0
- package/dist/types/Falsy.js +32 -0
- package/dist/types/Falsy.js.map +1 -0
- package/dist/types/Falsy.mjs +8 -0
- package/dist/types/Falsy.mjs.map +1 -0
- package/dist/types/Func.d.ts +2 -0
- package/dist/types/Func.js +29 -0
- package/dist/types/Func.js.map +1 -0
- package/dist/types/Func.mjs +6 -0
- package/dist/types/Func.mjs.map +1 -0
- package/dist/types/Gateway.d.ts +18 -0
- package/dist/types/Gateway.js +62 -0
- package/dist/types/Gateway.js.map +1 -0
- package/dist/types/Gateway.mjs +39 -0
- package/dist/types/Gateway.mjs.map +1 -0
- package/dist/types/Get.d.ts +7 -0
- package/dist/types/Get.js +36 -0
- package/dist/types/Get.js.map +1 -0
- package/dist/types/Get.mjs +11 -0
- package/dist/types/Get.mjs.map +1 -0
- package/dist/types/Id.d.ts +7 -0
- package/dist/types/Id.js +30 -0
- package/dist/types/Id.js.map +1 -0
- package/dist/types/Id.mjs +7 -0
- package/dist/types/Id.mjs.map +1 -0
- package/dist/types/Identity.d.ts +5 -0
- package/dist/types/Identity.js +17 -0
- package/dist/types/Identity.js.map +1 -0
- package/dist/types/Identity.mjs +1 -0
- package/dist/types/Identity.mjs.map +1 -0
- package/dist/types/Is.d.ts +20 -0
- package/dist/types/Is.js +85 -0
- package/dist/types/Is.js.map +1 -0
- package/dist/types/Is.mjs +44 -0
- package/dist/types/Is.mjs.map +1 -0
- package/dist/types/IsA.d.ts +2 -0
- package/dist/types/IsA.js +33 -0
- package/dist/types/IsA.js.map +1 -0
- package/dist/types/IsA.mjs +9 -0
- package/dist/types/IsA.mjs.map +1 -0
- package/dist/types/IsDate.d.ts +9 -0
- package/dist/types/IsDate.js +46 -0
- package/dist/types/IsDate.js.map +1 -0
- package/dist/types/IsDate.mjs +20 -0
- package/dist/types/IsDate.mjs.map +1 -0
- package/dist/types/IsEqual.d.ts +1 -0
- package/dist/types/IsEqual.js +39 -0
- package/dist/types/IsEqual.js.map +1 -0
- package/dist/types/IsEqual.mjs +16 -0
- package/dist/types/IsEqual.mjs.map +1 -0
- package/dist/types/Json.d.ts +30 -0
- package/dist/types/Json.js +67 -0
- package/dist/types/Json.js.map +1 -0
- package/dist/types/Json.mjs +40 -0
- package/dist/types/Json.mjs.map +1 -0
- package/dist/types/List.d.ts +52 -0
- package/dist/types/List.js +180 -0
- package/dist/types/List.js.map +1 -0
- package/dist/types/List.mjs +154 -0
- package/dist/types/List.mjs.map +1 -0
- package/dist/types/Message.d.ts +3 -0
- package/dist/types/Message.js +30 -0
- package/dist/types/Message.js.map +1 -0
- package/dist/types/Message.mjs +7 -0
- package/dist/types/Message.mjs.map +1 -0
- package/dist/types/Meta.d.ts +33 -0
- package/dist/types/Meta.js +71 -0
- package/dist/types/Meta.js.map +1 -0
- package/dist/types/Meta.mjs +47 -0
- package/dist/types/Meta.mjs.map +1 -0
- package/dist/types/Nullish.d.ts +2 -0
- package/dist/types/Nullish.js +29 -0
- package/dist/types/Nullish.js.map +1 -0
- package/dist/types/Nullish.mjs +6 -0
- package/dist/types/Nullish.mjs.map +1 -0
- package/dist/types/Number.d.ts +2 -0
- package/dist/types/Number.js +33 -0
- package/dist/types/Number.js.map +1 -0
- package/dist/types/Number.mjs +10 -0
- package/dist/types/Number.mjs.map +1 -0
- package/dist/types/PageList.d.ts +68 -0
- package/dist/types/PageList.js +156 -0
- package/dist/types/PageList.js.map +1 -0
- package/dist/types/PageList.mjs +128 -0
- package/dist/types/PageList.mjs.map +1 -0
- package/dist/types/Primitive.d.ts +2 -0
- package/dist/types/Primitive.js +32 -0
- package/dist/types/Primitive.js.map +1 -0
- package/dist/types/Primitive.mjs +9 -0
- package/dist/types/Primitive.mjs.map +1 -0
- package/dist/types/Repository.d.ts +15 -0
- package/dist/types/Repository.js +68 -0
- package/dist/types/Repository.js.map +1 -0
- package/dist/types/Repository.mjs +45 -0
- package/dist/types/Repository.mjs.map +1 -0
- package/dist/types/Result.d.ts +9 -0
- package/dist/types/Result.js +38 -0
- package/dist/types/Result.js.map +1 -0
- package/dist/types/Result.mjs +14 -0
- package/dist/types/Result.mjs.map +1 -0
- package/dist/types/Results.d.ts +12 -0
- package/dist/types/Results.js +51 -0
- package/dist/types/Results.js.map +1 -0
- package/dist/types/Results.mjs +26 -0
- package/dist/types/Results.mjs.map +1 -0
- package/dist/types/Sort.d.ts +8 -0
- package/dist/types/Sort.js +32 -0
- package/dist/types/Sort.js.map +1 -0
- package/dist/types/Sort.mjs +8 -0
- package/dist/types/Sort.mjs.map +1 -0
- package/dist/types/Tag.d.ts +2 -0
- package/dist/types/Tag.js +35 -0
- package/dist/types/Tag.js.map +1 -0
- package/dist/types/Tag.mjs +11 -0
- package/dist/types/Tag.mjs.map +1 -0
- package/dist/types/Template.d.ts +7 -0
- package/dist/types/Template.js +62 -0
- package/dist/types/Template.js.map +1 -0
- package/dist/types/Template.mjs +39 -0
- package/dist/types/Template.mjs.map +1 -0
- package/dist/types/Text.d.ts +45 -0
- package/dist/types/Text.js +127 -0
- package/dist/types/Text.js.map +1 -0
- package/dist/types/Text.mjs +99 -0
- package/dist/types/Text.mjs.map +1 -0
- package/dist/types/Try.d.ts +44 -0
- package/dist/types/Try.js +137 -0
- package/dist/types/Try.js.map +1 -0
- package/dist/types/Try.mjs +113 -0
- package/dist/types/Try.mjs.map +1 -0
- package/dist/types/TypeGuard.d.ts +1 -0
- package/dist/types/TypeGuard.js +17 -0
- package/dist/types/TypeGuard.js.map +1 -0
- package/dist/types/TypeGuard.mjs +1 -0
- package/dist/types/TypeGuard.mjs.map +1 -0
- package/dist/types/Types.d.ts +5 -0
- package/dist/types/Types.js +17 -0
- package/dist/types/Types.js.map +1 -0
- package/dist/types/Types.mjs +1 -0
- package/dist/types/Types.mjs.map +1 -0
- package/dist/types/Uri.d.ts +69 -0
- package/dist/types/Uri.js +104 -0
- package/dist/types/Uri.js.map +1 -0
- package/dist/types/Uri.mjs +79 -0
- package/dist/types/Uri.mjs.map +1 -0
- package/dist/types/Uuid.d.ts +3 -0
- package/dist/types/Uuid.js +35 -0
- package/dist/types/Uuid.js.map +1 -0
- package/dist/types/Uuid.mjs +11 -0
- package/dist/types/Uuid.mjs.map +1 -0
- package/dist/types/Validatable.d.ts +5 -0
- package/dist/types/Validatable.js +30 -0
- package/dist/types/Validatable.js.map +1 -0
- package/dist/types/Validatable.mjs +7 -0
- package/dist/types/Validatable.mjs.map +1 -0
- package/dist/types/Value.d.ts +9 -0
- package/dist/types/Value.js +47 -0
- package/dist/types/Value.js.map +1 -0
- package/dist/types/Value.mjs +23 -0
- package/dist/types/Value.mjs.map +1 -0
- package/dist/types/index.d.ts +42 -0
- package/dist/types/index.js +105 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +43 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/utils/Convert.d.ts +19 -0
- package/dist/utils/Convert.js +69 -0
- package/dist/utils/Convert.js.map +1 -0
- package/dist/utils/Convert.mjs +45 -0
- package/dist/utils/Convert.mjs.map +1 -0
- package/dist/utils/If.d.ts +10 -0
- package/dist/utils/If.js +47 -0
- package/dist/utils/If.js.map +1 -0
- package/dist/utils/If.mjs +21 -0
- package/dist/utils/If.mjs.map +1 -0
- package/dist/utils/Loading.d.ts +1 -0
- package/dist/utils/Loading.js +30 -0
- package/dist/utils/Loading.js.map +1 -0
- package/dist/utils/Loading.mjs +7 -0
- package/dist/utils/Loading.mjs.map +1 -0
- package/dist/utils/Log.d.ts +2 -0
- package/dist/utils/Log.js +37 -0
- package/dist/utils/Log.js.map +1 -0
- package/dist/utils/Log.mjs +14 -0
- package/dist/utils/Log.mjs.map +1 -0
- package/dist/utils/Mapper.d.ts +48 -0
- package/dist/utils/Mapper.js +133 -0
- package/dist/utils/Mapper.js.map +1 -0
- package/dist/utils/Mapper.mjs +108 -0
- package/dist/utils/Mapper.mjs.map +1 -0
- package/dist/utils/Promise.d.ts +18 -0
- package/dist/utils/Promise.js +55 -0
- package/dist/utils/Promise.js.map +1 -0
- package/dist/utils/Promise.mjs +26 -0
- package/dist/utils/Promise.mjs.map +1 -0
- package/dist/utils/Property.d.ts +16 -0
- package/dist/utils/Property.js +42 -0
- package/dist/utils/Property.js.map +1 -0
- package/dist/utils/Property.mjs +19 -0
- package/dist/utils/Property.mjs.map +1 -0
- package/dist/utils/Sentence.d.ts +48 -0
- package/dist/utils/Sentence.js +80 -0
- package/dist/utils/Sentence.js.map +1 -0
- package/dist/utils/Sentence.mjs +56 -0
- package/dist/utils/Sentence.mjs.map +1 -0
- package/dist/utils/State.d.ts +7 -0
- package/dist/utils/State.js +36 -0
- package/dist/utils/State.js.map +1 -0
- package/dist/utils/State.mjs +13 -0
- package/dist/utils/State.mjs.map +1 -0
- package/dist/utils/Traverse.d.ts +1 -0
- package/dist/utils/Traverse.js +33 -0
- package/dist/utils/Traverse.js.map +1 -0
- package/dist/utils/Traverse.mjs +10 -0
- package/dist/utils/Traverse.mjs.map +1 -0
- package/dist/utils/View.d.ts +36 -0
- package/dist/utils/View.js +86 -0
- package/dist/utils/View.js.map +1 -0
- package/dist/utils/View.mjs +73 -0
- package/dist/utils/View.mjs.map +1 -0
- package/dist/utils/Wait.d.ts +5 -0
- package/dist/utils/Wait.js +39 -0
- package/dist/utils/Wait.js.map +1 -0
- package/dist/utils/Wait.mjs +15 -0
- package/dist/utils/Wait.mjs.map +1 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +45 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +13 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/validation/Contraints.d.ts +19 -0
- package/dist/validation/Contraints.js +88 -0
- package/dist/validation/Contraints.js.map +1 -0
- package/dist/validation/Contraints.mjs +49 -0
- package/dist/validation/Contraints.mjs.map +1 -0
- package/dist/validation/Validate.d.ts +11 -0
- package/dist/validation/Validate.js +43 -0
- package/dist/validation/Validate.js.map +1 -0
- package/dist/validation/Validate.mjs +34 -0
- package/dist/validation/Validate.mjs.map +1 -0
- package/dist/validation/When.d.ts +22 -0
- package/dist/validation/When.js +68 -0
- package/dist/validation/When.js.map +1 -0
- package/dist/validation/When.mjs +44 -0
- package/dist/validation/When.mjs.map +1 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.js +27 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/index.mjs +4 -0
- package/dist/validation/index.mjs.map +1 -0
- package/package.json +4 -4
- package/src/resources/Req.ts +7 -10
- package/dist/index.d.mts +0 -2821
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Traverse_exports = {};
|
|
20
|
+
__export(Traverse_exports, {
|
|
21
|
+
traverse: () => traverse
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Traverse_exports);
|
|
24
|
+
const traverse = (subject = {}, property = "") => {
|
|
25
|
+
const props = property.split(".");
|
|
26
|
+
const p = props.shift();
|
|
27
|
+
return props.length === 0 ? subject[p] : traverse(subject[p], props.join("."));
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
traverse
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=Traverse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/Traverse.ts"],"sourcesContent":["export const traverse = (subject: unknown = {}, property = ''): unknown => {\n const props = property.split('.');\n const p = props.shift() as string;\n return props.length === 0 ? (subject as any)[p] : traverse((subject as any)[p], props.join('.'));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,WAAW,CAAC,UAAmB,CAAC,GAAG,WAAW,OAAgB;AACzE,QAAM,QAAQ,SAAS,MAAM,GAAG;AAChC,QAAM,IAAI,MAAM,MAAM;AACtB,SAAO,MAAM,WAAW,IAAK,QAAgB,CAAC,IAAI,SAAU,QAAgB,CAAC,GAAG,MAAM,KAAK,GAAG,CAAC;AACjG;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../chunk-4N72FQFX.mjs";
|
|
2
|
+
const traverse = (subject = {}, property = "") => {
|
|
3
|
+
const props = property.split(".");
|
|
4
|
+
const p = props.shift();
|
|
5
|
+
return props.length === 0 ? subject[p] : traverse(subject[p], props.join("."));
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
traverse
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=Traverse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/Traverse.ts"],"sourcesContent":["export const traverse = (subject: unknown = {}, property = ''): unknown => {\n const props = property.split('.');\n const p = props.shift() as string;\n return props.length === 0 ? (subject as any)[p] : traverse((subject as any)[p], props.join('.'));\n};\n"],"mappings":";AAAO,MAAM,WAAW,CAAC,UAAmB,CAAC,GAAG,WAAW,OAAgB;AACzE,QAAM,QAAQ,SAAS,MAAM,GAAG;AAChC,QAAM,IAAI,MAAM,MAAM;AACtB,SAAO,MAAM,WAAW,IAAK,QAAgB,CAAC,IAAI,SAAU,QAAgB,CAAC,GAAG,MAAM,KAAK,GAAG,CAAC;AACjG;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Constructor, DontInfer, Json, List, PageList, Primitive } from '../types';
|
|
2
|
+
type Func<T = unknown> = (a: any, key?: string) => T;
|
|
3
|
+
type Viewer = {
|
|
4
|
+
key: string;
|
|
5
|
+
f: Func;
|
|
6
|
+
};
|
|
7
|
+
type ViewType = Primitive | Constructor | Func | View | undefined;
|
|
8
|
+
type ViewRecord<V = Json> = Partial<Record<keyof V, ViewType>>;
|
|
9
|
+
export declare const toViewer: (key: string, value: ViewType) => Viewer;
|
|
10
|
+
export declare class View<V = Json> {
|
|
11
|
+
private views;
|
|
12
|
+
readonly startsFrom: 'scratch' | 'source';
|
|
13
|
+
readonly viewers: Viewer[];
|
|
14
|
+
constructor(views?: Partial<Record<keyof V, ViewType>>, startsFrom?: 'scratch' | 'source', viewers?: Viewer[]);
|
|
15
|
+
get fromSource(): View<V>;
|
|
16
|
+
from<T = unknown>(source: PageList<T>): PageList<V>;
|
|
17
|
+
from<T = unknown>(source: List<T>): List<V>;
|
|
18
|
+
from<T = unknown>(source: T[]): V[];
|
|
19
|
+
from<T = unknown>(source: T): V;
|
|
20
|
+
same: (one?: unknown, another?: unknown) => boolean;
|
|
21
|
+
private reduce;
|
|
22
|
+
}
|
|
23
|
+
export declare const isSimpleView: (a: unknown) => a is View<Json>;
|
|
24
|
+
export declare const view: <V = Json>(views: Partial<Record<keyof DontInfer<V>, ViewType>>) => View<V>;
|
|
25
|
+
export declare const views: {
|
|
26
|
+
ignore: symbol;
|
|
27
|
+
keep: symbol;
|
|
28
|
+
skip: symbol;
|
|
29
|
+
value: (value: unknown) => () => unknown;
|
|
30
|
+
or: {
|
|
31
|
+
key: (altKey: string) => (a: unknown, key?: string) => unknown;
|
|
32
|
+
value: (altValue: unknown) => (a: unknown, key?: string) => unknown;
|
|
33
|
+
func: (altFunc: Func) => (a: unknown, key?: string) => unknown;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var View_exports = {};
|
|
20
|
+
__export(View_exports, {
|
|
21
|
+
View: () => View,
|
|
22
|
+
isSimpleView: () => isSimpleView,
|
|
23
|
+
toViewer: () => toViewer,
|
|
24
|
+
view: () => view,
|
|
25
|
+
views: () => views
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(View_exports);
|
|
28
|
+
var import_types = require("../types");
|
|
29
|
+
var import_Traverse = require("./Traverse");
|
|
30
|
+
var import_If = require("./If");
|
|
31
|
+
const ignore = Symbol("view.ignore");
|
|
32
|
+
const keep = Symbol("view.keep");
|
|
33
|
+
const toViewer = (key, value) => (0, import_types.choose)(value).is.not.defined((v) => v, { key, f: () => void 0 }).type(import_types.isBoolean, (b) => ({ key, f: () => b })).equals(ignore, { key, f: () => void 0 }).equals(keep, { key, f: (a) => (0, import_Traverse.traverse)(a, key) }).type(import_types.isString, (s) => ({ key, f: (a) => (0, import_Traverse.traverse)(a, s) })).type(import_types.isConstructor, (c) => ({
|
|
34
|
+
key,
|
|
35
|
+
f: (a, key2) => (0, import_types.use)((0, import_Traverse.traverse)(a, key2), (v) => (0, import_types.isArray)(v) ? v.map((i) => optional(c, i)) : optional(c, v))
|
|
36
|
+
})).type(isSimpleView, (f) => ({ key, f: (a) => f.from((0, import_Traverse.traverse)(a, key)) })).type(import_types.isFunction, (f) => ({ key, f })).else((v) => ({ key, f: () => v }));
|
|
37
|
+
const optional = (c, v) => (0, import_If.ifDefined)(
|
|
38
|
+
v,
|
|
39
|
+
(i) => new c(i),
|
|
40
|
+
() => v
|
|
41
|
+
);
|
|
42
|
+
const toViewers = (views2) => (0, import_types.meta)(views2).entries().map(([k, v]) => toViewer(k, v));
|
|
43
|
+
class View {
|
|
44
|
+
constructor(views2 = {}, startsFrom = "scratch", viewers = toViewers(views2)) {
|
|
45
|
+
this.views = views2;
|
|
46
|
+
this.startsFrom = startsFrom;
|
|
47
|
+
this.viewers = viewers;
|
|
48
|
+
}
|
|
49
|
+
get fromSource() {
|
|
50
|
+
return new View(this.views, "source", this.viewers);
|
|
51
|
+
}
|
|
52
|
+
from(source) {
|
|
53
|
+
if ((0, import_types.isPageList)(source))
|
|
54
|
+
return (0, import_types.toPageList)(
|
|
55
|
+
source.map((s) => this.reduce(s)),
|
|
56
|
+
source
|
|
57
|
+
);
|
|
58
|
+
if ((0, import_types.isArray)(source))
|
|
59
|
+
return source.map((s) => this.reduce(s));
|
|
60
|
+
return this.reduce(source);
|
|
61
|
+
}
|
|
62
|
+
same = (one, another) => (0, import_types.isEqual)(this.from(one), this.from(another));
|
|
63
|
+
reduce = (source) => (0, import_types.use)((0, import_types.asJson)(source), (src) => this.viewers.reduce((acc, v) => import_types.json.set(acc, v.key, v.f(src, v.key)), this.startsFrom === "scratch" ? {} : src));
|
|
64
|
+
}
|
|
65
|
+
const isSimpleView = (a) => a instanceof View;
|
|
66
|
+
const view = (views2) => new View(views2);
|
|
67
|
+
const views = {
|
|
68
|
+
ignore,
|
|
69
|
+
keep,
|
|
70
|
+
skip: ignore,
|
|
71
|
+
value: (value) => () => value,
|
|
72
|
+
or: {
|
|
73
|
+
key: (altKey) => (a, key) => (0, import_Traverse.traverse)(a, key) ?? (0, import_Traverse.traverse)(a, altKey),
|
|
74
|
+
value: (altValue) => (a, key) => (0, import_Traverse.traverse)(a, key) ?? altValue,
|
|
75
|
+
func: (altFunc) => (a, key) => (0, import_Traverse.traverse)(a, key) ?? altFunc(a, key)
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
View,
|
|
81
|
+
isSimpleView,
|
|
82
|
+
toViewer,
|
|
83
|
+
view,
|
|
84
|
+
views
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=View.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/View.ts"],"sourcesContent":["import {\n asJson,\n choose,\n Constructor,\n DontInfer,\n isArray,\n isBoolean,\n isConstructor,\n isEqual,\n isFunction,\n isPageList,\n isString,\n json,\n Json,\n List,\n meta,\n PageList,\n Primitive,\n toPageList,\n use,\n} from '../types';\nimport { traverse } from './Traverse';\nimport { ifDefined } from './If';\n\ntype Func<T = unknown> = (a: any, key?: string) => T;\ntype Viewer = { key: string; f: Func };\n\ntype ViewType = Primitive | Constructor | Func | View | undefined;\ntype ViewRecord<V = Json> = Partial<Record<keyof V, ViewType>>;\n\nconst ignore = Symbol('view.ignore');\nconst keep = Symbol('view.keep');\n\nexport const toViewer = (key: string, value: ViewType): Viewer =>\n choose(value)\n .is.not.defined(v => v, { key, f: () => undefined } as Viewer)\n .type(isBoolean, b => ({ key, f: () => b }))\n .equals(ignore, { key, f: () => undefined })\n .equals(keep, { key, f: (a: any) => traverse(a, key) })\n .type(isString, s => ({ key, f: (a: any) => traverse(a, s) }))\n .type(isConstructor, c => ({\n key,\n f: (a, key) => use(traverse(a, key), v => (isArray(v) ? v.map(i => optional(c, i)) : optional(c, v))),\n }))\n .type(isSimpleView, f => ({ key, f: (a: any) => f.from(traverse(a, key)) }))\n .type(isFunction, f => ({ key, f }))\n .else(v => ({ key, f: () => v }));\n\nconst optional = (c: Constructor, v: any) =>\n ifDefined(\n v,\n i => new c(i),\n () => v,\n );\n\nconst toViewers = (views: ViewRecord): Viewer[] =>\n meta(views)\n .entries<ViewType>()\n .map(([k, v]) => toViewer(k, v));\n\nexport class View<V = Json> {\n constructor(private views = {} as ViewRecord<V>, readonly startsFrom: 'scratch' | 'source' = 'scratch', readonly viewers: Viewer[] = toViewers(views)) {\n }\n\n get fromSource(): View<V> {\n return new View(this.views, 'source', this.viewers);\n }\n\n from<T = unknown>(source: PageList<T>): PageList<V>;\n from<T = unknown>(source: List<T>): List<V>;\n from<T = unknown>(source: T[]): V[];\n from<T = unknown>(source: T): V;\n from<T = unknown>(source: PageList<T> | List<T> | T[] | T): PageList<V> | List<V> | V[] | V {\n if (isPageList(source))\n return toPageList(\n source.map(s => this.reduce(s)),\n source,\n );\n if (isArray(source)) return source.map(s => this.reduce(s));\n return this.reduce(source);\n }\n\n same = (one?: unknown, another?: unknown): boolean => isEqual(this.from(one), this.from(another));\n\n private reduce = (source: any): any =>\n use(asJson(source), src => this.viewers.reduce((acc, v) => json.set(acc, v.key, v.f(src, v.key)), this.startsFrom === 'scratch' ? {} : src));\n}\n\nexport const isSimpleView = (a: unknown): a is View => a instanceof View;\n\nexport const view = <V = Json>(views: ViewRecord<DontInfer<V>>): View<V> => new View<V>(views);\n\nexport const views = {\n ignore,\n keep,\n skip: ignore,\n value: (value: unknown) => () => value,\n or: {\n key: (altKey: string) => (a: unknown, key?: string) => traverse(a, key) ?? traverse(a, altKey),\n value: (altValue: unknown) => (a: unknown, key?: string) => traverse(a, key) ?? altValue,\n func: (altFunc: Func) => (a: unknown, key?: string) => traverse(a, key) ?? altFunc(a, key),\n },\n};\n\n// spread: (a: any, key: string) => ({...a, ...(use(traverse(a, key), v => isObject(v) ? v : ({[key]: v})))}),\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAoBO;AACP,sBAAyB;AACzB,gBAA0B;AAQ1B,MAAM,SAAS,OAAO,aAAa;AACnC,MAAM,OAAO,OAAO,WAAW;AAExB,MAAM,WAAW,CAAC,KAAa,cACpC,qBAAO,KAAK,EACT,GAAG,IAAI,QAAQ,OAAK,GAAG,EAAE,KAAK,GAAG,MAAM,OAAU,CAAW,EAC5D,KAAK,wBAAW,QAAM,EAAE,KAAK,GAAG,MAAM,EAAE,EAAE,EAC1C,OAAO,QAAQ,EAAE,KAAK,GAAG,MAAM,OAAU,CAAC,EAC1C,OAAO,MAAM,EAAE,KAAK,GAAG,CAAC,UAAW,0BAAS,GAAG,GAAG,EAAE,CAAC,EACrD,KAAK,uBAAU,QAAM,EAAE,KAAK,GAAG,CAAC,UAAW,0BAAS,GAAG,CAAC,EAAE,EAAE,EAC5D,KAAK,4BAAe,QAAM;AAAA,EACzB;AAAA,EACA,GAAG,CAAC,GAAGA,aAAQ,sBAAI,0BAAS,GAAGA,IAAG,GAAG,WAAM,sBAAQ,CAAC,IAAI,EAAE,IAAI,OAAK,SAAS,GAAG,CAAC,CAAC,IAAI,SAAS,GAAG,CAAC,CAAE;AACtG,EAAE,EACD,KAAK,cAAc,QAAM,EAAE,KAAK,GAAG,CAAC,MAAW,EAAE,SAAK,0BAAS,GAAG,GAAG,CAAC,EAAE,EAAE,EAC1E,KAAK,yBAAY,QAAM,EAAE,KAAK,EAAE,EAAE,EAClC,KAAK,QAAM,EAAE,KAAK,GAAG,MAAM,EAAE,EAAE;AAEpC,MAAM,WAAW,CAAC,GAAgB,UAChC;AAAA,EACE;AAAA,EACA,OAAK,IAAI,EAAE,CAAC;AAAA,EACZ,MAAM;AACR;AAEF,MAAM,YAAY,CAACC,eACjB,mBAAKA,MAAK,EACP,QAAkB,EAClB,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAE5B,MAAM,KAAe;AAAA,EAC1B,YAAoBA,SAAQ,CAAC,GAA6B,aAAmC,WAAoB,UAAoB,UAAUA,MAAK,GAAG;AAAnI,iBAAAA;AAAsC;AAAuD;AAAA,EACjH;AAAA,EAEA,IAAI,aAAsB;AACxB,WAAO,IAAI,KAAK,KAAK,OAAO,UAAU,KAAK,OAAO;AAAA,EACpD;AAAA,EAMA,KAAkB,QAA0E;AAC1F,YAAI,yBAAW,MAAM;AACnB,iBAAO;AAAA,QACL,OAAO,IAAI,OAAK,KAAK,OAAO,CAAC,CAAC;AAAA,QAC9B;AAAA,MACF;AACF,YAAI,sBAAQ,MAAM;AAAG,aAAO,OAAO,IAAI,OAAK,KAAK,OAAO,CAAC,CAAC;AAC1D,WAAO,KAAK,OAAO,MAAM;AAAA,EAC3B;AAAA,EAEA,OAAO,CAAC,KAAe,gBAA+B,sBAAQ,KAAK,KAAK,GAAG,GAAG,KAAK,KAAK,OAAO,CAAC;AAAA,EAExF,SAAS,CAAC,eAChB,sBAAI,qBAAO,MAAM,GAAG,SAAO,KAAK,QAAQ,OAAO,CAAC,KAAK,MAAM,kBAAK,IAAI,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,eAAe,YAAY,CAAC,IAAI,GAAG,CAAC;AAC/I;AAEO,MAAM,eAAe,CAAC,MAA0B,aAAa;AAE7D,MAAM,OAAO,CAAWA,WAA6C,IAAI,KAAQA,MAAK;AAEtF,MAAM,QAAQ;AAAA,EACnB;AAAA,EACA;AAAA,EACA,MAAM;AAAA,EACN,OAAO,CAAC,UAAmB,MAAM;AAAA,EACjC,IAAI;AAAA,IACF,KAAK,CAAC,WAAmB,CAAC,GAAY,YAAiB,0BAAS,GAAG,GAAG,SAAK,0BAAS,GAAG,MAAM;AAAA,IAC7F,OAAO,CAAC,aAAsB,CAAC,GAAY,YAAiB,0BAAS,GAAG,GAAG,KAAK;AAAA,IAChF,MAAM,CAAC,YAAkB,CAAC,GAAY,YAAiB,0BAAS,GAAG,GAAG,KAAK,QAAQ,GAAG,GAAG;AAAA,EAC3F;AACF;","names":["key","views"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import "../chunk-4N72FQFX.mjs";
|
|
2
|
+
import {
|
|
3
|
+
asJson,
|
|
4
|
+
choose,
|
|
5
|
+
isArray,
|
|
6
|
+
isBoolean,
|
|
7
|
+
isConstructor,
|
|
8
|
+
isEqual,
|
|
9
|
+
isFunction,
|
|
10
|
+
isPageList,
|
|
11
|
+
isString,
|
|
12
|
+
json,
|
|
13
|
+
meta,
|
|
14
|
+
toPageList,
|
|
15
|
+
use
|
|
16
|
+
} from "../types";
|
|
17
|
+
import { traverse } from "./Traverse";
|
|
18
|
+
import { ifDefined } from "./If";
|
|
19
|
+
const ignore = Symbol("view.ignore");
|
|
20
|
+
const keep = Symbol("view.keep");
|
|
21
|
+
const toViewer = (key, value) => choose(value).is.not.defined((v) => v, { key, f: () => void 0 }).type(isBoolean, (b) => ({ key, f: () => b })).equals(ignore, { key, f: () => void 0 }).equals(keep, { key, f: (a) => traverse(a, key) }).type(isString, (s) => ({ key, f: (a) => traverse(a, s) })).type(isConstructor, (c) => ({
|
|
22
|
+
key,
|
|
23
|
+
f: (a, key2) => use(traverse(a, key2), (v) => isArray(v) ? v.map((i) => optional(c, i)) : optional(c, v))
|
|
24
|
+
})).type(isSimpleView, (f) => ({ key, f: (a) => f.from(traverse(a, key)) })).type(isFunction, (f) => ({ key, f })).else((v) => ({ key, f: () => v }));
|
|
25
|
+
const optional = (c, v) => ifDefined(
|
|
26
|
+
v,
|
|
27
|
+
(i) => new c(i),
|
|
28
|
+
() => v
|
|
29
|
+
);
|
|
30
|
+
const toViewers = (views2) => meta(views2).entries().map(([k, v]) => toViewer(k, v));
|
|
31
|
+
class View {
|
|
32
|
+
constructor(views2 = {}, startsFrom = "scratch", viewers = toViewers(views2)) {
|
|
33
|
+
this.views = views2;
|
|
34
|
+
this.startsFrom = startsFrom;
|
|
35
|
+
this.viewers = viewers;
|
|
36
|
+
}
|
|
37
|
+
get fromSource() {
|
|
38
|
+
return new View(this.views, "source", this.viewers);
|
|
39
|
+
}
|
|
40
|
+
from(source) {
|
|
41
|
+
if (isPageList(source))
|
|
42
|
+
return toPageList(
|
|
43
|
+
source.map((s) => this.reduce(s)),
|
|
44
|
+
source
|
|
45
|
+
);
|
|
46
|
+
if (isArray(source))
|
|
47
|
+
return source.map((s) => this.reduce(s));
|
|
48
|
+
return this.reduce(source);
|
|
49
|
+
}
|
|
50
|
+
same = (one, another) => isEqual(this.from(one), this.from(another));
|
|
51
|
+
reduce = (source) => use(asJson(source), (src) => this.viewers.reduce((acc, v) => json.set(acc, v.key, v.f(src, v.key)), this.startsFrom === "scratch" ? {} : src));
|
|
52
|
+
}
|
|
53
|
+
const isSimpleView = (a) => a instanceof View;
|
|
54
|
+
const view = (views2) => new View(views2);
|
|
55
|
+
const views = {
|
|
56
|
+
ignore,
|
|
57
|
+
keep,
|
|
58
|
+
skip: ignore,
|
|
59
|
+
value: (value) => () => value,
|
|
60
|
+
or: {
|
|
61
|
+
key: (altKey) => (a, key) => traverse(a, key) ?? traverse(a, altKey),
|
|
62
|
+
value: (altValue) => (a, key) => traverse(a, key) ?? altValue,
|
|
63
|
+
func: (altFunc) => (a, key) => traverse(a, key) ?? altFunc(a, key)
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
View,
|
|
68
|
+
isSimpleView,
|
|
69
|
+
toViewer,
|
|
70
|
+
view,
|
|
71
|
+
views
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=View.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/View.ts"],"sourcesContent":["import {\n asJson,\n choose,\n Constructor,\n DontInfer,\n isArray,\n isBoolean,\n isConstructor,\n isEqual,\n isFunction,\n isPageList,\n isString,\n json,\n Json,\n List,\n meta,\n PageList,\n Primitive,\n toPageList,\n use,\n} from '../types';\nimport { traverse } from './Traverse';\nimport { ifDefined } from './If';\n\ntype Func<T = unknown> = (a: any, key?: string) => T;\ntype Viewer = { key: string; f: Func };\n\ntype ViewType = Primitive | Constructor | Func | View | undefined;\ntype ViewRecord<V = Json> = Partial<Record<keyof V, ViewType>>;\n\nconst ignore = Symbol('view.ignore');\nconst keep = Symbol('view.keep');\n\nexport const toViewer = (key: string, value: ViewType): Viewer =>\n choose(value)\n .is.not.defined(v => v, { key, f: () => undefined } as Viewer)\n .type(isBoolean, b => ({ key, f: () => b }))\n .equals(ignore, { key, f: () => undefined })\n .equals(keep, { key, f: (a: any) => traverse(a, key) })\n .type(isString, s => ({ key, f: (a: any) => traverse(a, s) }))\n .type(isConstructor, c => ({\n key,\n f: (a, key) => use(traverse(a, key), v => (isArray(v) ? v.map(i => optional(c, i)) : optional(c, v))),\n }))\n .type(isSimpleView, f => ({ key, f: (a: any) => f.from(traverse(a, key)) }))\n .type(isFunction, f => ({ key, f }))\n .else(v => ({ key, f: () => v }));\n\nconst optional = (c: Constructor, v: any) =>\n ifDefined(\n v,\n i => new c(i),\n () => v,\n );\n\nconst toViewers = (views: ViewRecord): Viewer[] =>\n meta(views)\n .entries<ViewType>()\n .map(([k, v]) => toViewer(k, v));\n\nexport class View<V = Json> {\n constructor(private views = {} as ViewRecord<V>, readonly startsFrom: 'scratch' | 'source' = 'scratch', readonly viewers: Viewer[] = toViewers(views)) {\n }\n\n get fromSource(): View<V> {\n return new View(this.views, 'source', this.viewers);\n }\n\n from<T = unknown>(source: PageList<T>): PageList<V>;\n from<T = unknown>(source: List<T>): List<V>;\n from<T = unknown>(source: T[]): V[];\n from<T = unknown>(source: T): V;\n from<T = unknown>(source: PageList<T> | List<T> | T[] | T): PageList<V> | List<V> | V[] | V {\n if (isPageList(source))\n return toPageList(\n source.map(s => this.reduce(s)),\n source,\n );\n if (isArray(source)) return source.map(s => this.reduce(s));\n return this.reduce(source);\n }\n\n same = (one?: unknown, another?: unknown): boolean => isEqual(this.from(one), this.from(another));\n\n private reduce = (source: any): any =>\n use(asJson(source), src => this.viewers.reduce((acc, v) => json.set(acc, v.key, v.f(src, v.key)), this.startsFrom === 'scratch' ? {} : src));\n}\n\nexport const isSimpleView = (a: unknown): a is View => a instanceof View;\n\nexport const view = <V = Json>(views: ViewRecord<DontInfer<V>>): View<V> => new View<V>(views);\n\nexport const views = {\n ignore,\n keep,\n skip: ignore,\n value: (value: unknown) => () => value,\n or: {\n key: (altKey: string) => (a: unknown, key?: string) => traverse(a, key) ?? traverse(a, altKey),\n value: (altValue: unknown) => (a: unknown, key?: string) => traverse(a, key) ?? altValue,\n func: (altFunc: Func) => (a: unknown, key?: string) => traverse(a, key) ?? altFunc(a, key),\n },\n};\n\n// spread: (a: any, key: string) => ({...a, ...(use(traverse(a, key), v => isObject(v) ? v : ({[key]: v})))}),\n"],"mappings":"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","names":["key","views"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Wait_exports = {};
|
|
20
|
+
__export(Wait_exports, {
|
|
21
|
+
Wait: () => Wait,
|
|
22
|
+
wait: () => wait
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Wait_exports);
|
|
25
|
+
class Wait {
|
|
26
|
+
static wait(ms = 0) {
|
|
27
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
28
|
+
}
|
|
29
|
+
static seconds(s = 0) {
|
|
30
|
+
return this.wait(s * 1e3);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const wait = (millis) => Wait.wait(millis);
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
Wait,
|
|
37
|
+
wait
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=Wait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/Wait.ts"],"sourcesContent":["export class Wait {\n static wait(ms = 0): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n }\n\n static seconds(s = 0) {\n return this.wait(s * 1000);\n }\n}\n\nexport const wait = (millis: number) => Wait.wait(millis);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,KAAK;AAAA,EAChB,OAAO,KAAK,KAAK,GAAkB;AACjC,WAAO,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AAAA,EACvD;AAAA,EAEA,OAAO,QAAQ,IAAI,GAAG;AACpB,WAAO,KAAK,KAAK,IAAI,GAAI;AAAA,EAC3B;AACF;AAEO,MAAM,OAAO,CAAC,WAAmB,KAAK,KAAK,MAAM;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "../chunk-4N72FQFX.mjs";
|
|
2
|
+
class Wait {
|
|
3
|
+
static wait(ms = 0) {
|
|
4
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
|
+
}
|
|
6
|
+
static seconds(s = 0) {
|
|
7
|
+
return this.wait(s * 1e3);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const wait = (millis) => Wait.wait(millis);
|
|
11
|
+
export {
|
|
12
|
+
Wait,
|
|
13
|
+
wait
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=Wait.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/Wait.ts"],"sourcesContent":["export class Wait {\n static wait(ms = 0): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n }\n\n static seconds(s = 0) {\n return this.wait(s * 1000);\n }\n}\n\nexport const wait = (millis: number) => Wait.wait(millis);\n"],"mappings":";AAAO,MAAM,KAAK;AAAA,EAChB,OAAO,KAAK,KAAK,GAAkB;AACjC,WAAO,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AAAA,EACvD;AAAA,EAEA,OAAO,QAAQ,IAAI,GAAG;AACpB,WAAO,KAAK,KAAK,IAAI,GAAI;AAAA,EAC3B;AACF;AAEO,MAAM,OAAO,CAAC,WAAmB,KAAK,KAAK,MAAM;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Convert';
|
|
2
|
+
export * from './If';
|
|
3
|
+
export * from './Loading';
|
|
4
|
+
export * from './Log';
|
|
5
|
+
export * from './Mapper';
|
|
6
|
+
export * from './Promise';
|
|
7
|
+
export * from './Property';
|
|
8
|
+
export * from './State';
|
|
9
|
+
export * from './Sentence';
|
|
10
|
+
export * from './Traverse';
|
|
11
|
+
export * from './View';
|
|
12
|
+
export * from './Wait';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var utils_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(utils_exports);
|
|
18
|
+
__reExport(utils_exports, require("./Convert"), module.exports);
|
|
19
|
+
__reExport(utils_exports, require("./If"), module.exports);
|
|
20
|
+
__reExport(utils_exports, require("./Loading"), module.exports);
|
|
21
|
+
__reExport(utils_exports, require("./Log"), module.exports);
|
|
22
|
+
__reExport(utils_exports, require("./Mapper"), module.exports);
|
|
23
|
+
__reExport(utils_exports, require("./Promise"), module.exports);
|
|
24
|
+
__reExport(utils_exports, require("./Property"), module.exports);
|
|
25
|
+
__reExport(utils_exports, require("./State"), module.exports);
|
|
26
|
+
__reExport(utils_exports, require("./Sentence"), module.exports);
|
|
27
|
+
__reExport(utils_exports, require("./Traverse"), module.exports);
|
|
28
|
+
__reExport(utils_exports, require("./View"), module.exports);
|
|
29
|
+
__reExport(utils_exports, require("./Wait"), module.exports);
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
...require("./Convert"),
|
|
33
|
+
...require("./If"),
|
|
34
|
+
...require("./Loading"),
|
|
35
|
+
...require("./Log"),
|
|
36
|
+
...require("./Mapper"),
|
|
37
|
+
...require("./Promise"),
|
|
38
|
+
...require("./Property"),
|
|
39
|
+
...require("./State"),
|
|
40
|
+
...require("./Sentence"),
|
|
41
|
+
...require("./Traverse"),
|
|
42
|
+
...require("./View"),
|
|
43
|
+
...require("./Wait")
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './Convert';\nexport * from './If';\nexport * from './Loading';\nexport * from './Log';\nexport * from './Mapper';\nexport * from './Promise';\nexport * from './Property';\nexport * from './State';\nexport * from './Sentence';\nexport * from './Traverse';\nexport * from './View';\nexport * from './Wait';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,sBAAd;AACA,0BAAc,iBADd;AAEA,0BAAc,sBAFd;AAGA,0BAAc,kBAHd;AAIA,0BAAc,qBAJd;AAKA,0BAAc,sBALd;AAMA,0BAAc,uBANd;AAOA,0BAAc,oBAPd;AAQA,0BAAc,uBARd;AASA,0BAAc,uBATd;AAUA,0BAAc,mBAVd;AAWA,0BAAc,mBAXd;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./Convert";
|
|
2
|
+
export * from "./If";
|
|
3
|
+
export * from "./Loading";
|
|
4
|
+
export * from "./Log";
|
|
5
|
+
export * from "./Mapper";
|
|
6
|
+
export * from "./Promise";
|
|
7
|
+
export * from "./Property";
|
|
8
|
+
export * from "./State";
|
|
9
|
+
export * from "./Sentence";
|
|
10
|
+
export * from "./Traverse";
|
|
11
|
+
export * from "./View";
|
|
12
|
+
export * from "./Wait";
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './Convert';\nexport * from './If';\nexport * from './Loading';\nexport * from './Log';\nexport * from './Mapper';\nexport * from './Promise';\nexport * from './Property';\nexport * from './State';\nexport * from './Sentence';\nexport * from './Traverse';\nexport * from './View';\nexport * from './Wait';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Func, Results, Text } from '../types';
|
|
2
|
+
export type Constraint = Func<boolean | Results, any>;
|
|
3
|
+
export declare const constraint: <T>(c: Constraint, message: Text) => PropertyDecorator;
|
|
4
|
+
export declare const defined: (message?: Text) => PropertyDecorator;
|
|
5
|
+
export declare const required: (message?: Text) => PropertyDecorator;
|
|
6
|
+
export declare const notEmpty: (message?: Text) => PropertyDecorator;
|
|
7
|
+
export declare const valid: () => PropertyDecorator;
|
|
8
|
+
export declare const optional: () => PropertyDecorator;
|
|
9
|
+
export declare const includes: (sub: string, message?: string) => PropertyDecorator;
|
|
10
|
+
export declare const inList: (values: unknown[], message?: Text) => PropertyDecorator;
|
|
11
|
+
export declare const gt: (limit: number, message?: Text) => PropertyDecorator;
|
|
12
|
+
export declare const gte: (limit: number, message?: Text) => PropertyDecorator;
|
|
13
|
+
export declare const lt: (limit: number, message?: Text) => PropertyDecorator;
|
|
14
|
+
export declare const lte: (limit: number, message?: Text) => PropertyDecorator;
|
|
15
|
+
export declare const past: (message?: Text) => PropertyDecorator;
|
|
16
|
+
export declare const future: (message?: Text) => PropertyDecorator;
|
|
17
|
+
export declare const minLength: (length: number, message?: Text) => PropertyDecorator;
|
|
18
|
+
export declare const maxLength: (length: number, message?: Text) => PropertyDecorator;
|
|
19
|
+
export declare const rule: (message?: Text) => PropertyDecorator;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Contraints_exports = {};
|
|
20
|
+
__export(Contraints_exports, {
|
|
21
|
+
constraint: () => constraint,
|
|
22
|
+
defined: () => defined,
|
|
23
|
+
future: () => future,
|
|
24
|
+
gt: () => gt,
|
|
25
|
+
gte: () => gte,
|
|
26
|
+
inList: () => inList,
|
|
27
|
+
includes: () => includes,
|
|
28
|
+
lt: () => lt,
|
|
29
|
+
lte: () => lte,
|
|
30
|
+
maxLength: () => maxLength,
|
|
31
|
+
minLength: () => minLength,
|
|
32
|
+
notEmpty: () => notEmpty,
|
|
33
|
+
optional: () => optional,
|
|
34
|
+
past: () => past,
|
|
35
|
+
required: () => required,
|
|
36
|
+
rule: () => rule,
|
|
37
|
+
valid: () => valid
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(Contraints_exports);
|
|
40
|
+
var import_types = require("../types");
|
|
41
|
+
var import_Validate = require("./Validate");
|
|
42
|
+
const constraint = (c, message) => (subject, property) => {
|
|
43
|
+
const cs = (0, import_types.meta)(subject).property(property).get("constraint") ?? (0, import_types.toList)();
|
|
44
|
+
(0, import_types.meta)(subject).property(property).set("constraint", cs.add({ property, constraint: c, text: message }));
|
|
45
|
+
};
|
|
46
|
+
const defined = (message) => constraint((v) => (0, import_types.isDefined)(v), message ?? "Property {property} must be defined.");
|
|
47
|
+
const required = (message) => constraint((v) => (0, import_types.isNotEmpty)(v), message ?? "Property {property} is required, and may not be empty.");
|
|
48
|
+
const notEmpty = (message) => constraint((v) => (0, import_types.isNotEmpty)(v), message ?? "Property {property} may not be empty.");
|
|
49
|
+
const valid = () => constraint((v) => (0, import_Validate.validate)(v), "");
|
|
50
|
+
const optional = () => constraint((v) => !(0, import_types.isDefined)(v) || (0, import_Validate.validate)(v), "");
|
|
51
|
+
const includes = (sub, message) => constraint((s) => (0, import_types.isDefined)(s) && (0, import_types.isString)(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);
|
|
52
|
+
const inList = (values, message) => constraint((v) => (0, import_types.isDefined)(v) && (0, import_types.isIn)(v, values), message ?? "Value {actual} must appear in list.");
|
|
53
|
+
const gt = (limit, message) => constraint((v) => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);
|
|
54
|
+
const gte = (limit, message) => constraint((v) => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);
|
|
55
|
+
const lt = (limit, message) => constraint((v) => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);
|
|
56
|
+
const lte = (limit, message) => constraint((v) => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);
|
|
57
|
+
const past = (message) => constraint((v) => (0, import_types.inPast)(v), message ?? "Value {actual} must lay in the past.");
|
|
58
|
+
const future = (message) => constraint((v) => (0, import_types.inFuture)(v), message ?? "Value {actual} must lay in the future.");
|
|
59
|
+
const minLength = (length, message) => constraint(
|
|
60
|
+
(v) => (0, import_types.tryTo)(() => v).is.defined().map((v2) => (0, import_types.text)(v2).toString().length >= length).orElse(true),
|
|
61
|
+
message ?? `Value {actual} must be at least '${length}' characters long.`
|
|
62
|
+
);
|
|
63
|
+
const maxLength = (length, message) => constraint(
|
|
64
|
+
(v) => (0, import_types.tryTo)(() => v).is.defined().map((v2) => (0, import_types.text)(v2).toString().length <= length).orElse(true),
|
|
65
|
+
message ?? `Value {actual} cannot be longer than '${length}' characters.`
|
|
66
|
+
);
|
|
67
|
+
const rule = (message) => constraint((v) => (0, import_types.isFunction)(v) ? v() : (0, import_types.isBoolean)(v) ? v : false, message ?? `Value {actual} must be true`);
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
constraint,
|
|
71
|
+
defined,
|
|
72
|
+
future,
|
|
73
|
+
gt,
|
|
74
|
+
gte,
|
|
75
|
+
inList,
|
|
76
|
+
includes,
|
|
77
|
+
lt,
|
|
78
|
+
lte,
|
|
79
|
+
maxLength,
|
|
80
|
+
minLength,
|
|
81
|
+
notEmpty,
|
|
82
|
+
optional,
|
|
83
|
+
past,
|
|
84
|
+
required,
|
|
85
|
+
rule,
|
|
86
|
+
valid
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=Contraints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/validation/Contraints.ts"],"sourcesContent":["import { Func, inFuture, inPast, isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString, List, meta, Results, text, Text, toList, tryTo } from '../types';\nimport { validate, Validator } from './Validate';\n\nexport type Constraint = Func<boolean | Results, any>;\n\nexport const constraint =\n <T>(c: Constraint, message: Text): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n const cs = meta(subject).property(property).get<List<Validator>>('constraint') ?? toList<Validator>();\n meta(subject)\n .property(property)\n .set('constraint', cs.add({ property, constraint: c, text: message }));\n };\n\nexport const defined = (message?: Text): PropertyDecorator => constraint(v => isDefined(v), message ?? 'Property {property} must be defined.');\n\nexport const required = (message?: Text): PropertyDecorator =>\n constraint(v => isNotEmpty(v), message ?? 'Property {property} is required, and may not be empty.');\n\nexport const notEmpty = (message?: Text): PropertyDecorator => constraint(v => isNotEmpty(v), message ?? 'Property {property} may not be empty.');\n\nexport const valid = (): PropertyDecorator => constraint(v => validate(v), '');\n\nexport const optional = (): PropertyDecorator => constraint(v => !isDefined(v) || validate(v), '');\n\nexport const includes = (sub: string, message?: string): PropertyDecorator =>\n constraint(s => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);\n\nexport const inList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const gt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);\n\nexport const gte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);\n\nexport const lt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);\n\nexport const lte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);\n\nexport const past = (message?: Text): PropertyDecorator => constraint(v => inPast(v), message ?? 'Value {actual} must lay in the past.');\n\nexport const future = (message?: Text): PropertyDecorator => constraint(v => inFuture(v), message ?? 'Value {actual} must lay in the future.');\n\nexport const minLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length >= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} must be at least '${length}' characters long.`\n );\n\nexport const maxLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length <= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} cannot be longer than '${length}' characters.`\n );\n\nexport const rule = (message?: Text): PropertyDecorator =>\n constraint(v => (isFunction(v) ? (v() as boolean | Results) : isBoolean(v) ? v : false), message ?? `Value {actual} must be true`);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqJ;AACrJ,sBAAoC;AAI7B,MAAM,aACX,CAAI,GAAe,YACnB,CAAC,SAAkB,aAAoC;AACrD,QAAM,SAAK,mBAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAqB,YAAY,SAAK,qBAAkB;AACpG,yBAAK,OAAO,EACT,SAAS,QAAQ,EACjB,IAAI,cAAc,GAAG,IAAI,EAAE,UAAU,YAAY,GAAG,MAAM,QAAQ,CAAC,CAAC;AACzE;AAEK,MAAM,UAAU,CAAC,YAAsC,WAAW,WAAK,wBAAU,CAAC,GAAG,WAAW,sCAAsC;AAEtI,MAAM,WAAW,CAAC,YACvB,WAAW,WAAK,yBAAW,CAAC,GAAG,WAAW,wDAAwD;AAE7F,MAAM,WAAW,CAAC,YAAsC,WAAW,WAAK,yBAAW,CAAC,GAAG,WAAW,uCAAuC;AAEzI,MAAM,QAAQ,MAAyB,WAAW,WAAK,0BAAS,CAAC,GAAG,EAAE;AAEtE,MAAM,WAAW,MAAyB,WAAW,OAAK,KAAC,wBAAU,CAAC,SAAK,0BAAS,CAAC,GAAG,EAAE;AAE1F,MAAM,WAAW,CAAC,KAAa,YACpC,WAAW,WAAK,wBAAU,CAAC,SAAK,uBAAS,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,WAAW,gCAAgC,GAAG,IAAI;AAE7G,MAAM,SAAS,CAAC,QAAmB,YACxC,WAAW,WAAK,wBAAU,CAAC,SAAK,mBAAK,GAAG,MAAM,GAAG,WAAW,qCAAqC;AAE5F,MAAM,KAAK,CAAC,OAAe,YAAsC,WAAW,OAAK,IAAI,OAAO,WAAW,uCAAuC,KAAK,IAAI;AAEvJ,MAAM,MAAM,CAAC,OAAe,YACjC,WAAW,OAAK,KAAK,OAAO,WAAW,kDAAkD,KAAK,GAAG;AAE5F,MAAM,KAAK,CAAC,OAAe,YAAsC,WAAW,OAAK,IAAI,OAAO,WAAW,uCAAuC,KAAK,GAAG;AAEtJ,MAAM,MAAM,CAAC,OAAe,YACjC,WAAW,OAAK,KAAK,OAAO,WAAW,mDAAmD,KAAK,GAAG;AAE7F,MAAM,OAAO,CAAC,YAAsC,WAAW,WAAK,qBAAO,CAAC,GAAG,WAAW,sCAAsC;AAEhI,MAAM,SAAS,CAAC,YAAsC,WAAW,WAAK,uBAAS,CAAC,GAAG,WAAW,wCAAwC;AAEtI,MAAM,YAAY,CAAC,QAAgB,YACxC;AAAA,EACE,WACE,oBAAM,MAAM,CAAC,EACV,GAAG,QAAQ,EACX,IAAI,CAAAA,WAAK,mBAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,oCAAoC,MAAM;AACvD;AAEK,MAAM,YAAY,CAAC,QAAgB,YACxC;AAAA,EACE,WACE,oBAAM,MAAM,CAAC,EACV,GAAG,QAAQ,EACX,IAAI,CAAAA,WAAK,mBAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,yCAAyC,MAAM;AAC5D;AAEK,MAAM,OAAO,CAAC,YACnB,WAAW,WAAM,yBAAW,CAAC,IAAK,EAAE,QAA0B,wBAAU,CAAC,IAAI,IAAI,OAAQ,WAAW,6BAA6B;","names":["v"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import "../chunk-4N72FQFX.mjs";
|
|
2
|
+
import { inFuture, inPast, isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString, meta, text, toList, tryTo } from "../types";
|
|
3
|
+
import { validate } from "./Validate";
|
|
4
|
+
const constraint = (c, message) => (subject, property) => {
|
|
5
|
+
const cs = meta(subject).property(property).get("constraint") ?? toList();
|
|
6
|
+
meta(subject).property(property).set("constraint", cs.add({ property, constraint: c, text: message }));
|
|
7
|
+
};
|
|
8
|
+
const defined = (message) => constraint((v) => isDefined(v), message ?? "Property {property} must be defined.");
|
|
9
|
+
const required = (message) => constraint((v) => isNotEmpty(v), message ?? "Property {property} is required, and may not be empty.");
|
|
10
|
+
const notEmpty = (message) => constraint((v) => isNotEmpty(v), message ?? "Property {property} may not be empty.");
|
|
11
|
+
const valid = () => constraint((v) => validate(v), "");
|
|
12
|
+
const optional = () => constraint((v) => !isDefined(v) || validate(v), "");
|
|
13
|
+
const includes = (sub, message) => constraint((s) => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);
|
|
14
|
+
const inList = (values, message) => constraint((v) => isDefined(v) && isIn(v, values), message ?? "Value {actual} must appear in list.");
|
|
15
|
+
const gt = (limit, message) => constraint((v) => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);
|
|
16
|
+
const gte = (limit, message) => constraint((v) => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);
|
|
17
|
+
const lt = (limit, message) => constraint((v) => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);
|
|
18
|
+
const lte = (limit, message) => constraint((v) => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);
|
|
19
|
+
const past = (message) => constraint((v) => inPast(v), message ?? "Value {actual} must lay in the past.");
|
|
20
|
+
const future = (message) => constraint((v) => inFuture(v), message ?? "Value {actual} must lay in the future.");
|
|
21
|
+
const minLength = (length, message) => constraint(
|
|
22
|
+
(v) => tryTo(() => v).is.defined().map((v2) => text(v2).toString().length >= length).orElse(true),
|
|
23
|
+
message ?? `Value {actual} must be at least '${length}' characters long.`
|
|
24
|
+
);
|
|
25
|
+
const maxLength = (length, message) => constraint(
|
|
26
|
+
(v) => tryTo(() => v).is.defined().map((v2) => text(v2).toString().length <= length).orElse(true),
|
|
27
|
+
message ?? `Value {actual} cannot be longer than '${length}' characters.`
|
|
28
|
+
);
|
|
29
|
+
const rule = (message) => constraint((v) => isFunction(v) ? v() : isBoolean(v) ? v : false, message ?? `Value {actual} must be true`);
|
|
30
|
+
export {
|
|
31
|
+
constraint,
|
|
32
|
+
defined,
|
|
33
|
+
future,
|
|
34
|
+
gt,
|
|
35
|
+
gte,
|
|
36
|
+
inList,
|
|
37
|
+
includes,
|
|
38
|
+
lt,
|
|
39
|
+
lte,
|
|
40
|
+
maxLength,
|
|
41
|
+
minLength,
|
|
42
|
+
notEmpty,
|
|
43
|
+
optional,
|
|
44
|
+
past,
|
|
45
|
+
required,
|
|
46
|
+
rule,
|
|
47
|
+
valid
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=Contraints.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/validation/Contraints.ts"],"sourcesContent":["import { Func, inFuture, inPast, isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString, List, meta, Results, text, Text, toList, tryTo } from '../types';\nimport { validate, Validator } from './Validate';\n\nexport type Constraint = Func<boolean | Results, any>;\n\nexport const constraint =\n <T>(c: Constraint, message: Text): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n const cs = meta(subject).property(property).get<List<Validator>>('constraint') ?? toList<Validator>();\n meta(subject)\n .property(property)\n .set('constraint', cs.add({ property, constraint: c, text: message }));\n };\n\nexport const defined = (message?: Text): PropertyDecorator => constraint(v => isDefined(v), message ?? 'Property {property} must be defined.');\n\nexport const required = (message?: Text): PropertyDecorator =>\n constraint(v => isNotEmpty(v), message ?? 'Property {property} is required, and may not be empty.');\n\nexport const notEmpty = (message?: Text): PropertyDecorator => constraint(v => isNotEmpty(v), message ?? 'Property {property} may not be empty.');\n\nexport const valid = (): PropertyDecorator => constraint(v => validate(v), '');\n\nexport const optional = (): PropertyDecorator => constraint(v => !isDefined(v) || validate(v), '');\n\nexport const includes = (sub: string, message?: string): PropertyDecorator =>\n constraint(s => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);\n\nexport const inList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const gt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);\n\nexport const gte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);\n\nexport const lt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);\n\nexport const lte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);\n\nexport const past = (message?: Text): PropertyDecorator => constraint(v => inPast(v), message ?? 'Value {actual} must lay in the past.');\n\nexport const future = (message?: Text): PropertyDecorator => constraint(v => inFuture(v), message ?? 'Value {actual} must lay in the future.');\n\nexport const minLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length >= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} must be at least '${length}' characters long.`\n );\n\nexport const maxLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length <= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} cannot be longer than '${length}' characters.`\n );\n\nexport const rule = (message?: Text): PropertyDecorator =>\n constraint(v => (isFunction(v) ? (v() as boolean | Results) : isBoolean(v) ? v : false), message ?? `Value {actual} must be true`);\n"],"mappings":";AAAA,SAAe,UAAU,QAAQ,WAAW,WAAW,YAAY,MAAM,YAAY,UAAgB,MAAe,MAAY,QAAQ,aAAa;AACrJ,SAAS,gBAA2B;AAI7B,MAAM,aACX,CAAI,GAAe,YACnB,CAAC,SAAkB,aAAoC;AACrD,QAAM,KAAK,KAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAqB,YAAY,KAAK,OAAkB;AACpG,OAAK,OAAO,EACT,SAAS,QAAQ,EACjB,IAAI,cAAc,GAAG,IAAI,EAAE,UAAU,YAAY,GAAG,MAAM,QAAQ,CAAC,CAAC;AACzE;AAEK,MAAM,UAAU,CAAC,YAAsC,WAAW,OAAK,UAAU,CAAC,GAAG,WAAW,sCAAsC;AAEtI,MAAM,WAAW,CAAC,YACvB,WAAW,OAAK,WAAW,CAAC,GAAG,WAAW,wDAAwD;AAE7F,MAAM,WAAW,CAAC,YAAsC,WAAW,OAAK,WAAW,CAAC,GAAG,WAAW,uCAAuC;AAEzI,MAAM,QAAQ,MAAyB,WAAW,OAAK,SAAS,CAAC,GAAG,EAAE;AAEtE,MAAM,WAAW,MAAyB,WAAW,OAAK,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,GAAG,EAAE;AAE1F,MAAM,WAAW,CAAC,KAAa,YACpC,WAAW,OAAK,UAAU,CAAC,KAAK,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,WAAW,gCAAgC,GAAG,IAAI;AAE7G,MAAM,SAAS,CAAC,QAAmB,YACxC,WAAW,OAAK,UAAU,CAAC,KAAK,KAAK,GAAG,MAAM,GAAG,WAAW,qCAAqC;AAE5F,MAAM,KAAK,CAAC,OAAe,YAAsC,WAAW,OAAK,IAAI,OAAO,WAAW,uCAAuC,KAAK,IAAI;AAEvJ,MAAM,MAAM,CAAC,OAAe,YACjC,WAAW,OAAK,KAAK,OAAO,WAAW,kDAAkD,KAAK,GAAG;AAE5F,MAAM,KAAK,CAAC,OAAe,YAAsC,WAAW,OAAK,IAAI,OAAO,WAAW,uCAAuC,KAAK,GAAG;AAEtJ,MAAM,MAAM,CAAC,OAAe,YACjC,WAAW,OAAK,KAAK,OAAO,WAAW,mDAAmD,KAAK,GAAG;AAE7F,MAAM,OAAO,CAAC,YAAsC,WAAW,OAAK,OAAO,CAAC,GAAG,WAAW,sCAAsC;AAEhI,MAAM,SAAS,CAAC,YAAsC,WAAW,OAAK,SAAS,CAAC,GAAG,WAAW,wCAAwC;AAEtI,MAAM,YAAY,CAAC,QAAgB,YACxC;AAAA,EACE,OACE,MAAM,MAAM,CAAC,EACV,GAAG,QAAQ,EACX,IAAI,CAAAA,OAAK,KAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,oCAAoC,MAAM;AACvD;AAEK,MAAM,YAAY,CAAC,QAAgB,YACxC;AAAA,EACE,OACE,MAAM,MAAM,CAAC,EACV,GAAG,QAAQ,EACX,IAAI,CAAAA,OAAK,KAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,yCAAyC,MAAM;AAC5D;AAEK,MAAM,OAAO,CAAC,YACnB,WAAW,OAAM,WAAW,CAAC,IAAK,EAAE,IAA0B,UAAU,CAAC,IAAI,IAAI,OAAQ,WAAW,6BAA6B;","names":["v"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Results, TemplateOptions, Text } from '../types';
|
|
2
|
+
import { Constraint } from './Contraints';
|
|
3
|
+
export type Validator = {
|
|
4
|
+
property: string | symbol;
|
|
5
|
+
constraint: Constraint;
|
|
6
|
+
text: Text;
|
|
7
|
+
actual?: Text;
|
|
8
|
+
};
|
|
9
|
+
export declare const asResults: (subject: unknown, template: Text, options?: TemplateOptions) => Results;
|
|
10
|
+
export declare const validate: (subject?: unknown) => Results;
|
|
11
|
+
export declare const validateReject: <T>(subject: T) => Promise<T>;
|