@thisisagile/easy 15.29.2 → 16.0.0
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-3MOFYE2N.mjs → chunk-2ZUDYGPP.mjs} +5 -5
- package/dist/chunk-2ZUDYGPP.mjs.map +1 -0
- package/dist/{chunk-A5MC57TL.mjs → chunk-3L4RAR24.mjs} +9 -7
- package/dist/chunk-3L4RAR24.mjs.map +1 -0
- package/dist/chunk-45GNHDKA.mjs +27 -0
- package/dist/chunk-45GNHDKA.mjs.map +1 -0
- package/dist/{chunk-BAXNN36F.mjs → chunk-4DJNTF2D.mjs} +5 -3
- package/dist/chunk-4DJNTF2D.mjs.map +1 -0
- package/dist/chunk-4G6AW6D6.mjs +35 -0
- package/dist/chunk-4G6AW6D6.mjs.map +1 -0
- package/dist/{chunk-I5MPU33B.mjs → chunk-5WSP2IYF.mjs} +4 -4
- package/dist/chunk-5WSP2IYF.mjs.map +1 -0
- package/dist/{chunk-GCPVSACZ.mjs → chunk-5YM5CLOG.mjs} +2 -2
- package/dist/{chunk-GUSPHVF2.mjs → chunk-6BQEFLOS.mjs} +5 -3
- package/dist/chunk-6BQEFLOS.mjs.map +1 -0
- package/dist/{chunk-MRIELSWP.mjs → chunk-6VLC4Z4H.mjs} +2 -2
- package/dist/chunk-6VLC4Z4H.mjs.map +1 -0
- package/dist/chunk-6YVMQB26.mjs +94 -0
- package/dist/chunk-6YVMQB26.mjs.map +1 -0
- package/dist/{chunk-YHL2CUBI.mjs → chunk-73UD7JJL.mjs} +2 -2
- package/dist/chunk-73UD7JJL.mjs.map +1 -0
- package/dist/{chunk-2L3GZ6NK.mjs → chunk-7K4QMDUN.mjs} +2 -2
- package/dist/chunk-7K4QMDUN.mjs.map +1 -0
- package/dist/{chunk-S5RHU67S.mjs → chunk-7TJ4VCBE.mjs} +15 -9
- package/dist/chunk-7TJ4VCBE.mjs.map +1 -0
- package/dist/{chunk-NKHZO3ME.mjs → chunk-A2JYVEBB.mjs} +4 -4
- package/dist/chunk-A2JYVEBB.mjs.map +1 -0
- package/dist/{chunk-57QV3J5N.mjs → chunk-A62OK7XE.mjs} +10 -6
- package/dist/{chunk-57QV3J5N.mjs.map → chunk-A62OK7XE.mjs.map} +1 -1
- package/dist/{chunk-TQUDYF6E.mjs → chunk-APYISY5K.mjs} +2 -2
- package/dist/chunk-APYISY5K.mjs.map +1 -0
- package/dist/{chunk-XLFC44Y3.mjs → chunk-ARTSACXM.mjs} +17 -22
- package/dist/chunk-ARTSACXM.mjs.map +1 -0
- package/dist/chunk-ARZEQQW5.mjs +315 -0
- package/dist/chunk-ARZEQQW5.mjs.map +1 -0
- package/dist/chunk-CAHTK3AT.mjs +30 -0
- package/dist/chunk-CAHTK3AT.mjs.map +1 -0
- package/dist/{chunk-ARN4MTMY.mjs → chunk-D4K4MC24.mjs} +3 -3
- package/dist/chunk-D4K4MC24.mjs.map +1 -0
- package/dist/{chunk-624IHTEI.mjs → chunk-D5FLGKVR.mjs} +18 -12
- package/dist/chunk-D5FLGKVR.mjs.map +1 -0
- package/dist/{chunk-UWNXWKBU.mjs → chunk-DEJ7A5PY.mjs} +1 -35
- package/dist/chunk-DEJ7A5PY.mjs.map +1 -0
- package/dist/chunk-DXQSIBC7.mjs +13 -0
- package/dist/chunk-DXQSIBC7.mjs.map +1 -0
- package/dist/{chunk-SG6BDC6T.mjs → chunk-EDVJUOFU.mjs} +18 -12
- package/dist/chunk-EDVJUOFU.mjs.map +1 -0
- package/dist/{chunk-IWLJEAQZ.mjs → chunk-EIJ3GSGG.mjs} +5 -3
- package/dist/chunk-EIJ3GSGG.mjs.map +1 -0
- package/dist/chunk-FHW5K2RR.mjs +150 -0
- package/dist/chunk-FHW5K2RR.mjs.map +1 -0
- package/dist/{chunk-WYT52YAX.mjs → chunk-GSZLYZSW.mjs} +23 -11
- package/dist/chunk-GSZLYZSW.mjs.map +1 -0
- package/dist/{chunk-I3DRDMCS.mjs → chunk-HBJMCX2I.mjs} +3 -3
- package/dist/chunk-HBJMCX2I.mjs.map +1 -0
- package/dist/{chunk-2KKIXOMB.mjs → chunk-HNVAFEZP.mjs} +3 -3
- package/dist/{chunk-QRN4Y2QC.mjs → chunk-HV4CI2QX.mjs} +18 -12
- package/dist/chunk-HV4CI2QX.mjs.map +1 -0
- package/dist/chunk-IAXKOENJ.mjs +55 -0
- package/dist/chunk-IAXKOENJ.mjs.map +1 -0
- package/dist/chunk-J6KN572O.mjs +20 -0
- package/dist/chunk-J6KN572O.mjs.map +1 -0
- package/dist/chunk-J7XKOXMW.mjs +203 -0
- package/dist/chunk-J7XKOXMW.mjs.map +1 -0
- package/dist/{chunk-RFG5LNDQ.mjs → chunk-JBJ2YERG.mjs} +6 -4
- package/dist/{chunk-RFG5LNDQ.mjs.map → chunk-JBJ2YERG.mjs.map} +1 -1
- package/dist/{chunk-J64VE55O.mjs → chunk-JFJLDIJB.mjs} +10 -10
- package/dist/chunk-JFJLDIJB.mjs.map +1 -0
- package/dist/{chunk-F4CWMZCV.mjs → chunk-JFU65NZU.mjs} +11 -9
- package/dist/chunk-JFU65NZU.mjs.map +1 -0
- package/dist/{chunk-PWCGCUT7.mjs → chunk-JSON7A4X.mjs} +6 -4
- package/dist/chunk-JSON7A4X.mjs.map +1 -0
- package/dist/chunk-JTGB3TSZ.mjs +24 -0
- package/dist/chunk-JTGB3TSZ.mjs.map +1 -0
- package/dist/{chunk-NOMZAVQC.mjs → chunk-KRLEHX37.mjs} +12 -6
- package/dist/chunk-KRLEHX37.mjs.map +1 -0
- package/dist/{chunk-H7NDGISC.mjs → chunk-LAR7AT6R.mjs} +2 -2
- package/dist/chunk-LAR7AT6R.mjs.map +1 -0
- package/dist/{chunk-OXVJLJIE.mjs → chunk-LXQQ5N6S.mjs} +2 -2
- package/dist/chunk-LYAPQ4QZ.mjs +40 -0
- package/dist/chunk-LYAPQ4QZ.mjs.map +1 -0
- package/dist/{chunk-QRLGQY7M.mjs → chunk-M47EOYDK.mjs} +6 -4
- package/dist/chunk-M47EOYDK.mjs.map +1 -0
- package/dist/{chunk-CJDDGEEK.mjs → chunk-NFWIUPZU.mjs} +8 -6
- package/dist/chunk-NFWIUPZU.mjs.map +1 -0
- package/dist/{chunk-7Z3YQCXR.mjs → chunk-NYYHRFBW.mjs} +6 -4
- package/dist/chunk-NYYHRFBW.mjs.map +1 -0
- package/dist/{chunk-4ROYPQPC.mjs → chunk-OFGI5FLG.mjs} +2 -2
- package/dist/chunk-PPWHEIZW.mjs +58 -0
- package/dist/chunk-PPWHEIZW.mjs.map +1 -0
- package/dist/chunk-Q5HABVOK.mjs +20 -0
- package/dist/chunk-Q5HABVOK.mjs.map +1 -0
- package/dist/{chunk-TG5IPJOG.mjs → chunk-QQRGOHU6.mjs} +2 -2
- package/dist/chunk-QQRGOHU6.mjs.map +1 -0
- package/dist/{chunk-5J3LAY32.mjs → chunk-QTPKH4PY.mjs} +5 -5
- package/dist/chunk-QTPKH4PY.mjs.map +1 -0
- package/dist/{chunk-65W3AYRE.mjs → chunk-RNROH3VJ.mjs} +6 -4
- package/dist/chunk-RNROH3VJ.mjs.map +1 -0
- package/dist/{chunk-GARRF3U7.mjs → chunk-TMZRZLA2.mjs} +3 -3
- package/dist/chunk-TMZRZLA2.mjs.map +1 -0
- package/dist/{chunk-L7JZMM3J.mjs → chunk-U53FLD4J.mjs} +4 -4
- package/dist/chunk-U53FLD4J.mjs.map +1 -0
- package/dist/{chunk-EB26LF5Z.mjs → chunk-UJEQAXZI.mjs} +4 -4
- package/dist/chunk-UJEQAXZI.mjs.map +1 -0
- package/dist/{chunk-ELFAMVTF.mjs → chunk-UKHDSTTZ.mjs} +5 -5
- package/dist/chunk-UKHDSTTZ.mjs.map +1 -0
- package/dist/chunk-UNHWYQ54.mjs +64 -0
- package/dist/chunk-UNHWYQ54.mjs.map +1 -0
- package/dist/chunk-USGZFNWP.mjs +34 -0
- package/dist/chunk-USGZFNWP.mjs.map +1 -0
- package/dist/{chunk-Y5WPU3ZU.mjs → chunk-UW6S2PNO.mjs} +12 -6
- package/dist/chunk-UW6S2PNO.mjs.map +1 -0
- package/dist/chunk-UYDZZAEK.mjs +11 -0
- package/dist/chunk-UYDZZAEK.mjs.map +1 -0
- package/dist/{chunk-GJFFYHHX.mjs → chunk-VV534JNS.mjs} +5 -3
- package/dist/chunk-VV534JNS.mjs.map +1 -0
- package/dist/{chunk-V7FP66LM.mjs → chunk-WJZFE5NE.mjs} +2 -2
- package/dist/chunk-WJZFE5NE.mjs.map +1 -0
- package/dist/{chunk-ZELLSP3E.mjs → chunk-X7FZPY3P.mjs} +6 -4
- package/dist/{chunk-ZELLSP3E.mjs.map → chunk-X7FZPY3P.mjs.map} +1 -1
- package/dist/{chunk-Q6RSBDMM.mjs → chunk-XBYDAQGZ.mjs} +2 -2
- package/dist/chunk-XBYDAQGZ.mjs.map +1 -0
- package/dist/{chunk-ZJKVMRGU.mjs → chunk-YSBACFUR.mjs} +5 -5
- package/dist/chunk-YSBACFUR.mjs.map +1 -0
- package/dist/chunk-ZHXKBOK2.mjs +22 -0
- package/dist/chunk-ZHXKBOK2.mjs.map +1 -0
- package/dist/chunk-ZPNFXK7Y.mjs +36 -0
- package/dist/chunk-ZPNFXK7Y.mjs.map +1 -0
- package/dist/data/Condition.d.ts +3 -2
- package/dist/data/Condition.mjs +12 -8
- package/dist/data/Database.d.ts +2 -1
- package/dist/data/Database.mjs +12 -7
- package/dist/data/Field.d.ts +1 -1
- package/dist/data/Field.mjs +15 -11
- package/dist/data/Field.mjs.map +1 -1
- package/dist/data/InMemoryGateway.d.ts +5 -1
- package/dist/data/InMemoryGateway.mjs +25 -10
- package/dist/data/InMemoryGateway.mjs.map +1 -1
- package/dist/data/Query.d.ts +1 -1
- package/dist/data/QueryProvider.d.ts +2 -1
- package/dist/domain/Audit.d.ts +3 -2
- package/dist/domain/Audit.mjs +25 -10
- package/dist/domain/Child.d.ts +2 -1
- package/dist/domain/Child.mjs +25 -10
- package/dist/domain/Child.mjs.map +1 -1
- package/dist/domain/{values/DateTime.d.ts → DateTime.d.ts} +3 -1
- package/dist/domain/DateTime.mjs +35 -0
- package/dist/domain/Entity.d.ts +2 -1
- package/dist/domain/Entity.mjs +27 -12
- package/dist/domain/Entity.mjs.map +1 -1
- package/dist/domain/Repo.d.ts +7 -1
- package/dist/domain/Repo.mjs +31 -12
- package/dist/domain/Repo.mjs.map +1 -1
- package/dist/domain/Struct.d.ts +2 -1
- package/dist/domain/Struct.mjs +22 -7
- package/dist/domain/Typo.d.ts +7 -2
- package/dist/domain/Typo.mjs +23 -8
- package/dist/domain/Typo.mjs.map +1 -1
- package/dist/health/HealthResource.d.ts +2 -2
- package/dist/health/HealthResource.mjs +30 -16
- package/dist/health/HealthResource.mjs.map +1 -1
- package/dist/health/HealthUri.d.ts +2 -2
- package/dist/health/HealthUri.mjs +22 -8
- package/dist/http/CacheControl.d.ts +1 -1
- package/dist/http/CacheControl.mjs +23 -9
- package/dist/http/ContentType.d.ts +2 -1
- package/dist/http/ContentType.mjs +12 -7
- package/dist/http/HttpStatus.d.ts +3 -1
- package/dist/http/HttpStatus.mjs +12 -7
- package/dist/http/HttpVerb.d.ts +1 -1
- package/dist/http/HttpVerb.mjs +12 -7
- package/dist/http/LocalRequestStore.d.ts +2 -1
- package/dist/http/LocalRequestStore.mjs +12 -6
- package/dist/http/LocalRequestStore.mjs.map +1 -1
- package/dist/http/OriginatedError.d.ts +1 -1
- package/dist/http/OriginatedError.mjs +1 -2
- package/dist/http/OriginatedError.mjs.map +1 -1
- package/dist/http/Request.d.ts +1 -1
- package/dist/http/RequestOptions.d.ts +6 -1
- package/dist/http/RequestOptions.mjs +16 -9
- package/dist/http/Response.d.ts +2 -5
- package/dist/http/Response.mjs +7 -13
- package/dist/http/RestResult.d.ts +3 -1
- package/dist/http/RestResult.mjs +23 -8
- package/dist/http/Verb.d.ts +4 -1
- package/dist/http/Verb.mjs +27 -13
- package/dist/http/toResponse.d.ts +6 -0
- package/dist/http/toResponse.mjs +33 -0
- package/dist/index.d.ts +118 -12
- package/dist/index.js +1645 -2904
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -12
- package/dist/index.mjs.map +1 -1
- package/dist/process/App.mjs +13 -7
- package/dist/process/App.mjs.map +1 -1
- package/dist/process/Manage.d.ts +3 -1
- package/dist/process/Manage.mjs +22 -8
- package/dist/process/Manage.mjs.map +1 -1
- package/dist/process/Scope.d.ts +4 -1
- package/dist/process/Scope.mjs +13 -7
- package/dist/process/Search.d.ts +7 -2
- package/dist/process/Search.mjs +22 -8
- package/dist/process/UseCase.d.ts +4 -1
- package/dist/process/UseCase.mjs +19 -10
- package/dist/process/UseCase.mjs.map +1 -1
- package/dist/resources/AppProvider.d.ts +1 -1
- package/dist/resources/Req.d.ts +6 -1
- package/dist/resources/Req.mjs +21 -7
- package/dist/resources/Req.mjs.map +1 -1
- package/dist/resources/Requires.d.ts +2 -1
- package/dist/resources/Requires.mjs +10 -6
- package/dist/resources/Requires.mjs.map +1 -1
- package/dist/resources/Route.d.ts +5 -3
- package/dist/resources/Route.mjs +21 -7
- package/dist/resources/Service.d.ts +3 -1
- package/dist/resources/Service.mjs +24 -8
- package/dist/resources/Service.mjs.map +1 -1
- package/dist/security/Jwt.d.ts +5 -1
- package/dist/security/Jwt.mjs +24 -8
- package/dist/security/Jwt.mjs.map +1 -1
- package/dist/services/Api.d.ts +8 -2
- package/dist/services/Api.mjs +32 -16
- package/dist/services/ApiGateway.d.ts +6 -2
- package/dist/services/ApiGateway.mjs +35 -19
- package/dist/services/AxiosProvider.d.ts +3 -1
- package/dist/services/AxiosProvider.mjs +30 -14
- package/dist/services/MappedRouteGateway.d.ts +7 -3
- package/dist/services/MappedRouteGateway.mjs +41 -24
- package/dist/services/MappedRouteGateway.mjs.map +1 -1
- package/dist/services/RouteGateway.d.ts +7 -1
- package/dist/services/RouteGateway.mjs +36 -20
- package/dist/services/ViewRouteGateway.d.ts +10 -6
- package/dist/services/ViewRouteGateway.mjs +39 -22
- package/dist/services/ViewRouteGateway.mjs.map +1 -1
- package/dist/sql/Clause.d.ts +3 -2
- package/dist/sql/Clause.mjs +7 -8
- package/dist/sql/Column.d.ts +3 -2
- package/dist/sql/Column.mjs +24 -10
- package/dist/sql/Count.mjs +11 -9
- package/dist/sql/Delete.mjs +10 -8
- package/dist/sql/Insert.d.ts +1 -1
- package/dist/sql/Insert.mjs +12 -10
- package/dist/sql/Select.d.ts +1 -1
- package/dist/sql/Select.mjs +10 -8
- package/dist/sql/SqlQuery.d.ts +5 -2
- package/dist/sql/SqlQuery.mjs +9 -7
- package/dist/sql/Table.d.ts +13 -12
- package/dist/sql/Table.mjs +37 -22
- package/dist/sql/Table.mjs.map +1 -1
- package/dist/sql/TableGateway.d.ts +6 -2
- package/dist/sql/TableGateway.mjs +23 -9
- package/dist/sql/TableGateway.mjs.map +1 -1
- package/dist/sql/Update.d.ts +1 -1
- package/dist/sql/Update.mjs +12 -10
- package/dist/types/Array.mjs +4 -2
- package/dist/types/Builder.mjs +2 -6
- package/dist/types/Builder.mjs.map +1 -1
- package/dist/types/Cache.mjs +10 -6
- package/dist/types/Cache.mjs.map +1 -1
- package/dist/types/CacheAge.mjs +22 -8
- package/dist/types/Case.d.ts +3 -1
- package/dist/types/Case.mjs +20 -6
- package/dist/types/Constructor.d.ts +1 -0
- package/dist/types/Constructor.mjs +5 -1
- package/dist/types/Context.mjs +12 -6
- package/dist/types/Enum.mjs +11 -6
- package/dist/{domain/enums → types}/Environment.d.ts +1 -1
- package/dist/types/Environment.mjs +28 -0
- package/dist/types/Environment.mjs.map +1 -0
- package/dist/types/ErrorOrigin.d.ts +1 -1
- package/dist/types/Exception.mjs +13 -6
- package/dist/types/Gateway.mjs +15 -7
- package/dist/types/Id.mjs +3 -4
- package/dist/types/Is.d.ts +0 -4
- package/dist/types/Is.mjs +1 -6
- package/dist/types/IsA.d.ts +2 -0
- package/dist/types/IsA.mjs +8 -4
- package/dist/types/IsEqual.mjs +21 -7
- package/dist/types/Json.mjs +10 -6
- package/dist/types/List.d.ts +3 -3
- package/dist/types/List.mjs +8 -6
- package/dist/types/Meta.d.ts +1 -2
- package/dist/types/Meta.mjs +10 -8
- package/dist/types/Number.mjs +21 -7
- package/dist/types/Object.d.ts +8 -0
- package/dist/types/Object.mjs +20 -0
- package/dist/types/PageList.mjs +21 -7
- package/dist/types/Parser.mjs +25 -10
- package/dist/types/Parser.mjs.map +1 -1
- package/dist/types/Primitive.mjs +2 -2
- package/dist/types/Repository.d.ts +5 -1
- package/dist/types/Repository.mjs +15 -7
- package/dist/types/Result.mjs +13 -6
- package/dist/types/Results.mjs +14 -6
- package/dist/types/Tag.mjs +10 -6
- package/dist/types/Tag.mjs.map +1 -1
- package/dist/types/Template.d.ts +41 -2
- package/dist/types/Template.mjs +19 -8
- package/dist/types/Text.d.ts +0 -38
- package/dist/types/Text.mjs +2 -10
- package/dist/types/Try.mjs +20 -6
- package/dist/types/Uri.mjs +21 -7
- package/dist/types/Uuid.mjs +2 -3
- package/dist/types/Validatable.mjs +5 -3
- package/dist/types/Value.d.ts +2 -1
- package/dist/types/Value.mjs +3 -6
- package/dist/utils/Base64.d.ts +1 -1
- package/dist/utils/Base64.mjs.map +1 -1
- package/dist/utils/Convert.mjs +3 -7
- package/dist/utils/If.d.ts +2 -1
- package/dist/utils/If.mjs +4 -2
- package/dist/utils/Loading.mjs +1 -2
- package/dist/utils/Loading.mjs.map +1 -1
- package/dist/utils/Log.d.ts +1 -1
- package/dist/utils/Log.mjs.map +1 -1
- package/dist/utils/Mapper.d.ts +6 -1
- package/dist/utils/Mapper.mjs +15 -10
- package/dist/utils/Promise.d.ts +2 -1
- package/dist/utils/Promise.mjs +9 -6
- package/dist/utils/Property.d.ts +2 -1
- package/dist/utils/Property.mjs +4 -8
- package/dist/utils/Sentence.d.ts +2 -1
- package/dist/utils/Sentence.mjs +11 -6
- package/dist/utils/Sentence.mjs.map +1 -1
- package/dist/utils/State.d.ts +1 -1
- package/dist/utils/State.mjs +4 -2
- package/dist/utils/View.d.ts +6 -1
- package/dist/utils/View.mjs +24 -9
- package/dist/validation/Contraints.d.ts +3 -1
- package/dist/validation/Contraints.mjs +21 -7
- package/dist/validation/Validate.d.ts +3 -1
- package/dist/validation/Validate.mjs +20 -6
- package/dist/validation/When.d.ts +4 -1
- package/dist/validation/When.mjs +20 -6
- package/package.json +2 -2
- package/src/data/Condition.ts +17 -5
- package/src/data/Database.ts +7 -2
- package/src/data/Field.ts +3 -2
- package/src/data/InMemoryGateway.ts +8 -2
- package/src/data/Query.ts +1 -1
- package/src/data/QueryProvider.ts +2 -1
- package/src/domain/Audit.ts +11 -7
- package/src/domain/Child.ts +3 -2
- package/src/domain/{values/DateTime.ts → DateTime.ts} +8 -2
- package/src/domain/Entity.ts +3 -2
- package/src/domain/Repo.ts +15 -4
- package/src/domain/Struct.ts +4 -2
- package/src/domain/Typo.ts +13 -4
- package/src/health/HealthResource.ts +5 -3
- package/src/health/HealthUri.ts +1 -1
- package/src/http/CacheControl.ts +9 -3
- package/src/http/ContentType.ts +8 -2
- package/src/http/HttpStatus.ts +4 -1
- package/src/http/HttpVerb.ts +1 -1
- package/src/http/LocalRequestStore.ts +3 -1
- package/src/http/OriginatedError.ts +6 -2
- package/src/http/Request.ts +1 -1
- package/src/http/RequestOptions.ts +16 -2
- package/src/http/Response.ts +4 -9
- package/src/http/RestResult.ts +7 -1
- package/src/http/Verb.ts +5 -2
- package/src/http/toResponse.ts +12 -0
- package/src/index.ts +129 -12
- package/src/process/Manage.ts +3 -1
- package/src/process/Scope.ts +12 -2
- package/src/process/Search.ts +9 -3
- package/src/process/UseCase.ts +12 -2
- package/src/resources/AppProvider.ts +1 -1
- package/src/resources/Req.ts +14 -3
- package/src/resources/Requires.ts +3 -2
- package/src/resources/Route.ts +8 -3
- package/src/resources/Service.ts +9 -2
- package/src/security/Jwt.ts +7 -1
- package/src/services/Api.ts +12 -3
- package/src/services/ApiGateway.ts +7 -2
- package/src/services/AxiosProvider.ts +14 -2
- package/src/services/MappedRouteGateway.ts +13 -4
- package/src/services/RouteGateway.ts +14 -3
- package/src/services/ViewRouteGateway.ts +7 -3
- package/src/sql/Clause.ts +10 -3
- package/src/sql/Column.ts +14 -4
- package/src/sql/Count.ts +1 -1
- package/src/sql/Delete.ts +1 -1
- package/src/sql/Insert.ts +5 -2
- package/src/sql/Select.ts +6 -2
- package/src/sql/SqlQuery.ts +9 -3
- package/src/sql/Table.ts +6 -3
- package/src/sql/TableGateway.ts +13 -5
- package/src/sql/Update.ts +6 -2
- package/src/types/CacheAge.ts +3 -1
- package/src/types/Case.ts +14 -4
- package/src/types/Constructor.ts +3 -1
- package/src/types/Context.ts +7 -8
- package/src/{domain/enums → types}/Environment.ts +1 -1
- package/src/types/ErrorOrigin.ts +1 -1
- package/src/types/Exception.ts +7 -2
- package/src/types/Gateway.ts +1 -1
- package/src/types/Is.ts +0 -7
- package/src/types/IsA.ts +4 -0
- package/src/types/Json.ts +2 -2
- package/src/types/List.ts +13 -12
- package/src/types/Meta.ts +12 -9
- package/src/types/Object.ts +16 -0
- package/src/types/Parser.ts +1 -1
- package/src/types/Repository.ts +7 -2
- package/src/types/Template.ts +149 -12
- package/src/types/Text.ts +3 -138
- package/src/types/Try.ts +1 -1
- package/src/types/Uri.ts +2 -1
- package/src/types/Value.ts +4 -1
- package/src/utils/Base64.ts +1 -1
- package/src/utils/Convert.ts +5 -2
- package/src/utils/If.ts +3 -1
- package/src/utils/Loading.ts +1 -1
- package/src/utils/Log.ts +1 -1
- package/src/utils/Mapper.ts +13 -2
- package/src/utils/Promise.ts +3 -1
- package/src/utils/Property.ts +6 -2
- package/src/utils/Sentence.ts +8 -2
- package/src/utils/State.ts +1 -1
- package/src/utils/View.ts +15 -22
- package/src/validation/Contraints.ts +9 -1
- package/src/validation/Validate.ts +26 -29
- package/src/validation/When.ts +13 -3
- package/dist/chunk-2L3GZ6NK.mjs.map +0 -1
- package/dist/chunk-3MOFYE2N.mjs.map +0 -1
- package/dist/chunk-5J3LAY32.mjs.map +0 -1
- package/dist/chunk-624IHTEI.mjs.map +0 -1
- package/dist/chunk-65W3AYRE.mjs.map +0 -1
- package/dist/chunk-7Z3YQCXR.mjs.map +0 -1
- package/dist/chunk-A5MC57TL.mjs.map +0 -1
- package/dist/chunk-ARN4MTMY.mjs.map +0 -1
- package/dist/chunk-BAXNN36F.mjs.map +0 -1
- package/dist/chunk-C7OPGGIF.mjs +0 -21
- package/dist/chunk-C7OPGGIF.mjs.map +0 -1
- package/dist/chunk-CJDDGEEK.mjs.map +0 -1
- package/dist/chunk-EB26LF5Z.mjs.map +0 -1
- package/dist/chunk-ELFAMVTF.mjs.map +0 -1
- package/dist/chunk-F4CWMZCV.mjs.map +0 -1
- package/dist/chunk-GARRF3U7.mjs.map +0 -1
- package/dist/chunk-GJFFYHHX.mjs.map +0 -1
- package/dist/chunk-GUSPHVF2.mjs.map +0 -1
- package/dist/chunk-H7NDGISC.mjs.map +0 -1
- package/dist/chunk-HBJUEFGA.mjs +0 -26
- package/dist/chunk-HBJUEFGA.mjs.map +0 -1
- package/dist/chunk-I2NKUYUM.mjs +0 -272
- package/dist/chunk-I2NKUYUM.mjs.map +0 -1
- package/dist/chunk-I3DRDMCS.mjs.map +0 -1
- package/dist/chunk-I5MPU33B.mjs.map +0 -1
- package/dist/chunk-IWLJEAQZ.mjs.map +0 -1
- package/dist/chunk-J64VE55O.mjs.map +0 -1
- package/dist/chunk-L7JZMM3J.mjs.map +0 -1
- package/dist/chunk-MRIELSWP.mjs.map +0 -1
- package/dist/chunk-NKHZO3ME.mjs.map +0 -1
- package/dist/chunk-NOMZAVQC.mjs.map +0 -1
- package/dist/chunk-PFAEQQXA.mjs +0 -900
- package/dist/chunk-PFAEQQXA.mjs.map +0 -1
- package/dist/chunk-PWCGCUT7.mjs.map +0 -1
- package/dist/chunk-Q5ATL34D.mjs +0 -13
- package/dist/chunk-Q5ATL34D.mjs.map +0 -1
- package/dist/chunk-Q6RSBDMM.mjs.map +0 -1
- package/dist/chunk-QRLGQY7M.mjs.map +0 -1
- package/dist/chunk-QRN4Y2QC.mjs.map +0 -1
- package/dist/chunk-S5RHU67S.mjs.map +0 -1
- package/dist/chunk-SG6BDC6T.mjs.map +0 -1
- package/dist/chunk-TG5IPJOG.mjs.map +0 -1
- package/dist/chunk-TQUDYF6E.mjs.map +0 -1
- package/dist/chunk-UWNXWKBU.mjs.map +0 -1
- package/dist/chunk-V7FP66LM.mjs.map +0 -1
- package/dist/chunk-WX6UP67J.mjs +0 -40
- package/dist/chunk-WX6UP67J.mjs.map +0 -1
- package/dist/chunk-WYT52YAX.mjs.map +0 -1
- package/dist/chunk-XLFC44Y3.mjs.map +0 -1
- package/dist/chunk-Y5WPU3ZU.mjs.map +0 -1
- package/dist/chunk-YHL2CUBI.mjs.map +0 -1
- package/dist/chunk-YUSOGMIJ.mjs +0 -183
- package/dist/chunk-YUSOGMIJ.mjs.map +0 -1
- package/dist/chunk-YXE66GAL.mjs +0 -19
- package/dist/chunk-YXE66GAL.mjs.map +0 -1
- package/dist/chunk-ZJKVMRGU.mjs.map +0 -1
- package/dist/data/index.d.ts +0 -7
- package/dist/data/index.mjs +0 -8
- package/dist/data/index.mjs.map +0 -1
- package/dist/domain/enums/Country.d.ts +0 -256
- package/dist/domain/enums/Country.mjs +0 -16
- package/dist/domain/enums/Currency.d.ts +0 -127
- package/dist/domain/enums/Currency.mjs +0 -19
- package/dist/domain/enums/Environment.mjs +0 -23
- package/dist/domain/enums/Environment.mjs.map +0 -1
- package/dist/domain/enums/Locale.d.ts +0 -571
- package/dist/domain/enums/Locale.mjs +0 -594
- package/dist/domain/enums/Locale.mjs.map +0 -1
- package/dist/domain/enums/UnitOfMeasurement.d.ts +0 -10
- package/dist/domain/enums/UnitOfMeasurement.mjs +0 -16
- package/dist/domain/enums/UnitOfMeasurement.mjs.map +0 -1
- package/dist/domain/enums/UnitOfWeight.d.ts +0 -8
- package/dist/domain/enums/UnitOfWeight.mjs +0 -16
- package/dist/domain/enums/UnitOfWeight.mjs.map +0 -1
- package/dist/domain/enums/index.d.ts +0 -6
- package/dist/domain/enums/index.mjs +0 -7
- package/dist/domain/enums/index.mjs.map +0 -1
- package/dist/domain/index.d.ts +0 -9
- package/dist/domain/index.mjs +0 -10
- package/dist/domain/index.mjs.map +0 -1
- package/dist/domain/structs/Address.d.ts +0 -12
- package/dist/domain/structs/Address.mjs +0 -65
- package/dist/domain/structs/Address.mjs.map +0 -1
- package/dist/domain/structs/Box.d.ts +0 -15
- package/dist/domain/structs/Box.mjs +0 -58
- package/dist/domain/structs/Box.mjs.map +0 -1
- package/dist/domain/structs/Dimension.d.ts +0 -10
- package/dist/domain/structs/Dimension.mjs +0 -20
- package/dist/domain/structs/Dimension.mjs.map +0 -1
- package/dist/domain/structs/Money.d.ts +0 -12
- package/dist/domain/structs/Money.mjs +0 -23
- package/dist/domain/structs/Money.mjs.map +0 -1
- package/dist/domain/structs/Name.d.ts +0 -9
- package/dist/domain/structs/Name.mjs +0 -42
- package/dist/domain/structs/Name.mjs.map +0 -1
- package/dist/domain/structs/Weight.d.ts +0 -13
- package/dist/domain/structs/Weight.mjs +0 -57
- package/dist/domain/structs/Weight.mjs.map +0 -1
- package/dist/domain/structs/index.d.ts +0 -6
- package/dist/domain/structs/index.mjs +0 -7
- package/dist/domain/structs/index.mjs.map +0 -1
- package/dist/domain/values/DateTime.mjs +0 -21
- package/dist/domain/values/EAN.d.ts +0 -5
- package/dist/domain/values/EAN.mjs +0 -30
- package/dist/domain/values/EAN.mjs.map +0 -1
- package/dist/domain/values/Email.d.ts +0 -8
- package/dist/domain/values/Email.mjs +0 -37
- package/dist/domain/values/Email.mjs.map +0 -1
- package/dist/domain/values/IBAN.d.ts +0 -5
- package/dist/domain/values/IBAN.mjs +0 -30
- package/dist/domain/values/IBAN.mjs.map +0 -1
- package/dist/domain/values/PostalCode.d.ts +0 -8
- package/dist/domain/values/PostalCode.mjs +0 -19
- package/dist/domain/values/PostalCode.mjs.map +0 -1
- package/dist/domain/values/Slug.d.ts +0 -6
- package/dist/domain/values/Slug.mjs +0 -31
- package/dist/domain/values/Slug.mjs.map +0 -1
- package/dist/domain/values/Url.d.ts +0 -22
- package/dist/domain/values/Url.mjs +0 -36
- package/dist/domain/values/Url.mjs.map +0 -1
- package/dist/domain/values/index.d.ts +0 -7
- package/dist/domain/values/index.mjs +0 -8
- package/dist/domain/values/index.mjs.map +0 -1
- package/dist/health/index.d.ts +0 -2
- package/dist/health/index.mjs +0 -3
- package/dist/health/index.mjs.map +0 -1
- package/dist/http/index.d.ts +0 -12
- package/dist/http/index.mjs +0 -13
- package/dist/http/index.mjs.map +0 -1
- package/dist/process/index.d.ts +0 -5
- package/dist/process/index.mjs +0 -6
- package/dist/process/index.mjs.map +0 -1
- package/dist/resources/index.d.ts +0 -7
- package/dist/resources/index.mjs +0 -8
- package/dist/resources/index.mjs.map +0 -1
- package/dist/security/index.d.ts +0 -1
- package/dist/security/index.mjs +0 -2
- package/dist/security/index.mjs.map +0 -1
- package/dist/services/index.d.ts +0 -6
- package/dist/services/index.mjs +0 -7
- package/dist/services/index.mjs.map +0 -1
- package/dist/sql/index.d.ts +0 -10
- package/dist/sql/index.mjs +0 -11
- package/dist/sql/index.mjs.map +0 -1
- package/dist/types/index.d.ts +0 -43
- package/dist/types/index.mjs +0 -44
- package/dist/types/index.mjs.map +0 -1
- package/dist/utils/index.d.ts +0 -13
- package/dist/utils/index.mjs +0 -14
- package/dist/utils/index.mjs.map +0 -1
- package/dist/validation/index.d.ts +0 -3
- package/dist/validation/index.mjs +0 -4
- package/dist/validation/index.mjs.map +0 -1
- package/src/data/index.ts +0 -7
- package/src/domain/enums/Country.ts +0 -265
- package/src/domain/enums/Currency.ts +0 -133
- package/src/domain/enums/Locale.ts +0 -579
- package/src/domain/enums/UnitOfMeasurement.ts +0 -13
- package/src/domain/enums/UnitOfWeight.ts +0 -11
- package/src/domain/enums/countries.json +0 -251
- package/src/domain/enums/currencies.json +0 -1073
- package/src/domain/enums/index.ts +0 -6
- package/src/domain/enums/locales.json +0 -565
- package/src/domain/index.ts +0 -9
- package/src/domain/structs/Address.ts +0 -22
- package/src/domain/structs/Box.ts +0 -29
- package/src/domain/structs/Dimension.ts +0 -25
- package/src/domain/structs/Money.ts +0 -31
- package/src/domain/structs/Name.ts +0 -15
- package/src/domain/structs/Weight.ts +0 -35
- package/src/domain/structs/index.ts +0 -6
- package/src/domain/values/EAN.ts +0 -12
- package/src/domain/values/Email.ts +0 -20
- package/src/domain/values/IBAN.ts +0 -12
- package/src/domain/values/PostalCode.ts +0 -17
- package/src/domain/values/Slug.ts +0 -14
- package/src/domain/values/Url.ts +0 -73
- package/src/domain/values/index.ts +0 -7
- package/src/health/index.ts +0 -2
- package/src/http/index.ts +0 -12
- package/src/process/index.ts +0 -5
- package/src/resources/index.ts +0 -7
- package/src/security/index.ts +0 -1
- package/src/services/index.ts +0 -6
- package/src/sql/index.ts +0 -10
- package/src/types/index.ts +0 -43
- package/src/utils/index.ts +0 -13
- package/src/validation/index.ts +0 -3
- /package/dist/{chunk-GCPVSACZ.mjs.map → chunk-5YM5CLOG.mjs.map} +0 -0
- /package/dist/{chunk-2KKIXOMB.mjs.map → chunk-HNVAFEZP.mjs.map} +0 -0
- /package/dist/{chunk-OXVJLJIE.mjs.map → chunk-LXQQ5N6S.mjs.map} +0 -0
- /package/dist/{chunk-4ROYPQPC.mjs.map → chunk-OFGI5FLG.mjs.map} +0 -0
- /package/dist/domain/{values/DateTime.mjs.map → DateTime.mjs.map} +0 -0
- /package/dist/{domain/enums/Country.mjs.map → http/toResponse.mjs.map} +0 -0
- /package/dist/{domain/enums/Currency.mjs.map → types/Object.mjs.map} +0 -0
package/src/types/Template.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { meta } from './Meta';
|
|
2
2
|
import { List, toList } from './List';
|
|
3
|
-
import { asString,
|
|
3
|
+
import { asString, replaceAll, Text } from './Text';
|
|
4
4
|
import { toName } from './Constructor';
|
|
5
|
-
import {
|
|
5
|
+
import { Optional } from './Types';
|
|
6
|
+
import { Get, ofGet } from './Get';
|
|
7
|
+
import { isEmpty, isNotEmpty } from './Is';
|
|
8
|
+
import { JsonValue } from './Json';
|
|
6
9
|
|
|
7
10
|
export type TemplateOptions = { type?: Text; property?: Text; actual?: Text; subject?: Text };
|
|
8
11
|
|
|
@@ -20,12 +23,6 @@ export class Template implements Text {
|
|
|
20
23
|
.replace(' ', ' ');
|
|
21
24
|
};
|
|
22
25
|
|
|
23
|
-
private readonly value = (subject: any, prop: string): string =>
|
|
24
|
-
tryTo(() => prop.split('.'))
|
|
25
|
-
.map(p => [p, p.splice(1)])
|
|
26
|
-
.map(([p, ps]) => ps.reduce((t: ToText, s) => (t as any)[s], text(subject[p[0]])))
|
|
27
|
-
.map(p => p.toString()).value;
|
|
28
|
-
|
|
29
26
|
private readonly props = (tmpl: string, key: string, result: List<string> = toList()): string[] => {
|
|
30
27
|
const i1 = tmpl.indexOf(`{${key}`);
|
|
31
28
|
if (i1 < 0) {
|
|
@@ -36,17 +33,157 @@ export class Template implements Text {
|
|
|
36
33
|
};
|
|
37
34
|
|
|
38
35
|
private readonly object = (): string => {
|
|
39
|
-
return this.props(this.template, 'this').reduce((t: string, p) => t.replace(`{${p}}`,
|
|
36
|
+
return this.props(this.template, 'this').reduce((t: string, p) => t.replace(`{${p}}`, textValue(this.subject, p.replace('this.', ''))), this.template);
|
|
40
37
|
};
|
|
41
38
|
|
|
42
39
|
private readonly option = (tmpl: string, prop: string): string => {
|
|
43
|
-
return this.props(tmpl, prop).reduce((t: string, p) => t.replace(`{${p}}`,
|
|
40
|
+
return this.props(tmpl, prop).reduce((t: string, p) => t.replace(`{${p}}`, textValue(this.options, p)), tmpl);
|
|
44
41
|
};
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
export
|
|
48
|
-
new Template(asString(tmpl), subject, {
|
|
44
|
+
export function template(tmpl: Text, subject: unknown, options: TemplateOptions = {}): Text {
|
|
45
|
+
return new Template(asString(tmpl), subject, {
|
|
49
46
|
type: toName(subject),
|
|
50
47
|
subject: text(JSON.stringify(subject)),
|
|
51
48
|
...options,
|
|
52
49
|
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class ToText implements Text {
|
|
53
|
+
constructor(readonly subject: string) {}
|
|
54
|
+
|
|
55
|
+
get cap(): ToText {
|
|
56
|
+
return this.map(s => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get title(): ToText {
|
|
60
|
+
return this.map(s =>
|
|
61
|
+
s
|
|
62
|
+
.split(' ')
|
|
63
|
+
.map(w => text(w).cap)
|
|
64
|
+
.join(' ')
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get pascal(): ToText {
|
|
69
|
+
return this.title.replace(' ', '');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
get lower(): ToText {
|
|
73
|
+
return this.map(s => s.toLowerCase());
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get upper(): ToText {
|
|
77
|
+
return this.map(s => s.toUpperCase());
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get camel(): ToText {
|
|
81
|
+
return this.title.trim.map(s => `${s.charAt(0).toLowerCase()}${s.slice(1)}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get kebab(): ToText {
|
|
85
|
+
return this.lower.replace(' ', '-');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get strictKebab(): ToText {
|
|
89
|
+
return this.map(s => s.replace(/[^a-z\d]+/gi, ' ').trim()).kebab;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
get slug(): ToText {
|
|
93
|
+
return this.map(s =>
|
|
94
|
+
s
|
|
95
|
+
.replace(/ß/g, 'ss')
|
|
96
|
+
.normalize('NFKD')
|
|
97
|
+
.replace(/[\u0300-\u036F]/g, '')
|
|
98
|
+
.toLowerCase()
|
|
99
|
+
.replace(/[^a-z\d]+/g, '-')
|
|
100
|
+
.replace(/(^-)|(-$)/g, '')
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get snake(): ToText {
|
|
105
|
+
return this.upper.replace(' ', '_');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
get plural(): ToText {
|
|
109
|
+
return this.ifLike('') ?? this.add('s');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get space(): ToText {
|
|
113
|
+
return this.map(s => s.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/[_-]/g, ' '));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
get sentence(): ToText {
|
|
117
|
+
return this.isEmpty ? this : this.map(s => `${s.charAt(0).toUpperCase()}${s.slice(1)}.`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
get initials(): ToText {
|
|
121
|
+
return this.map(s =>
|
|
122
|
+
s
|
|
123
|
+
.split(' ')
|
|
124
|
+
.map(w => w[0])
|
|
125
|
+
.join('')
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
get trim(): ToText {
|
|
130
|
+
return this.map(s => s.replace(/[- ,_#]/g, ''));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
get isEmpty(): boolean {
|
|
134
|
+
return isEmpty(this.toString());
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
parse = (subject: unknown, options = {}): ToText => text(template(this.subject, subject, { type: toName(subject), ...options }));
|
|
138
|
+
|
|
139
|
+
is = (...others: unknown[]): boolean => others.some(o => this.toString() === text(o).toString());
|
|
140
|
+
|
|
141
|
+
equals = this.is;
|
|
142
|
+
|
|
143
|
+
isLike = (...others: unknown[]): boolean => others.some(o => this.trim.lower.is(text(o).trim.lower));
|
|
144
|
+
|
|
145
|
+
ifLike = (...others: unknown[]): Optional<this> => (this.isLike(...others) ? this : undefined);
|
|
146
|
+
|
|
147
|
+
endsWith = (end?: unknown): boolean => this.subject.endsWith(asString(end));
|
|
148
|
+
|
|
149
|
+
startsWith = (end?: unknown): boolean => this.subject.startsWith(asString(end));
|
|
150
|
+
|
|
151
|
+
first = (n: number): ToText => this.map(s => s.substring(0, n));
|
|
152
|
+
|
|
153
|
+
last = (n: number): ToText => this.map(s => s.substring(s.length - n));
|
|
154
|
+
|
|
155
|
+
map = (func: Get<string, string>): ToText => text(ofGet(func, this.subject));
|
|
156
|
+
|
|
157
|
+
replace = (search: Text, replace: Text): ToText => this.map(s => replaceAll(s, search, replace));
|
|
158
|
+
|
|
159
|
+
add = (add?: unknown, separator = ''): ToText => this.map(s => (isNotEmpty(add) ? `${s}${separator}${text(add)}` : s));
|
|
160
|
+
|
|
161
|
+
with = (separator: string, ...other: unknown[]): ToText =>
|
|
162
|
+
this.map(s =>
|
|
163
|
+
toList(s)
|
|
164
|
+
.add(...other.map(u => text(u).toString()))
|
|
165
|
+
.filter(s => isNotEmpty(s))
|
|
166
|
+
.join(separator)
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
toString(): string {
|
|
170
|
+
return this.subject;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
toJSON(): JsonValue {
|
|
174
|
+
return this.subject;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function text(subject?: unknown, alt = ''): ToText {
|
|
179
|
+
const sub = subject ? asString(subject) : alt;
|
|
180
|
+
return new ToText(sub !== '[object Object]' ? sub : '');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function textValue(subject: any, prop: string): string {
|
|
184
|
+
const p = prop.split('.');
|
|
185
|
+
return p
|
|
186
|
+
.splice(1)
|
|
187
|
+
.reduce((t: ToText, s) => (t as any)[s], text(subject?.[p[0]]))
|
|
188
|
+
.toString();
|
|
189
|
+
}
|
package/src/types/Text.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { isDefined
|
|
2
|
-
import { toName } from './Constructor';
|
|
3
|
-
import { template } from './Template';
|
|
1
|
+
import { isDefined } from './Is';
|
|
4
2
|
import { isFunc } from './Func';
|
|
5
3
|
import { Get, ofGet } from './Get';
|
|
6
|
-
import { toList } from './List';
|
|
7
|
-
import { JsonValue } from './Json';
|
|
8
|
-
import { Optional } from './Types';
|
|
9
4
|
|
|
10
5
|
export type Text = { toString(): string };
|
|
11
6
|
|
|
@@ -19,138 +14,8 @@ export const toWords = (input: unknown): string[] => {
|
|
|
19
14
|
return asString(input)
|
|
20
15
|
.replace(/(\p{Lower})(\p{Upper})/gu, '$1 $2')
|
|
21
16
|
.replace(/(\p{Upper})(\p{Upper}\p{Lower})/gu, '$1 $2')
|
|
22
|
-
.split(/[_\W]+/g)
|
|
17
|
+
.split(/[_\W]+/g)
|
|
18
|
+
.filter(Boolean);
|
|
23
19
|
};
|
|
24
20
|
|
|
25
21
|
export const kebab = (s = ''): string => toWords(s).join('-').toLowerCase();
|
|
26
|
-
|
|
27
|
-
export class ToText implements Text {
|
|
28
|
-
constructor(readonly subject: string) {}
|
|
29
|
-
|
|
30
|
-
get cap(): ToText {
|
|
31
|
-
return this.map(s => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase());
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get title(): ToText {
|
|
35
|
-
return this.map(s =>
|
|
36
|
-
s
|
|
37
|
-
.split(' ')
|
|
38
|
-
.map(w => text(w).cap)
|
|
39
|
-
.join(' ')
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get pascal(): ToText {
|
|
44
|
-
return this.title.replace(' ', '');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get lower(): ToText {
|
|
48
|
-
return this.map(s => s.toLowerCase());
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get upper(): ToText {
|
|
52
|
-
return this.map(s => s.toUpperCase());
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
get camel(): ToText {
|
|
56
|
-
return this.title.trim.map(s => `${s.charAt(0).toLowerCase()}${s.slice(1)}`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get kebab(): ToText {
|
|
60
|
-
return this.lower.replace(' ', '-');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get strictKebab(): ToText {
|
|
64
|
-
return this.map(s => s.replace(/[^a-z\d]+/gi, ' ').trim()).kebab;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get slug(): ToText {
|
|
68
|
-
return this.map(s =>
|
|
69
|
-
s
|
|
70
|
-
.replace(/ß/g, 'ss')
|
|
71
|
-
.normalize('NFKD')
|
|
72
|
-
.replace(/[\u0300-\u036F]/g, '')
|
|
73
|
-
.toLowerCase()
|
|
74
|
-
.replace(/[^a-z\d]+/g, '-')
|
|
75
|
-
.replace(/(^-)|(-$)/g, '')
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
get snake(): ToText {
|
|
80
|
-
return this.upper.replace(' ', '_');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
get plural(): ToText {
|
|
84
|
-
return this.ifLike('') ?? this.add('s');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get space(): ToText {
|
|
88
|
-
return this.map(s => s.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/[_-]/g, ' '));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
get sentence(): ToText {
|
|
92
|
-
return this.isEmpty ? this : this.map(s => `${s.charAt(0).toUpperCase()}${s.slice(1)}.`);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
get initials(): ToText {
|
|
96
|
-
return this.map(s =>
|
|
97
|
-
s
|
|
98
|
-
.split(' ')
|
|
99
|
-
.map(w => w[0])
|
|
100
|
-
.join('')
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
get trim(): ToText {
|
|
105
|
-
return this.map(s => s.replace(/[- ,_#]/g, ''));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
get isEmpty(): boolean {
|
|
109
|
-
return isEmpty(this.toString());
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
parse = (subject: unknown, options = {}): ToText => text(template(this.subject, subject, { type: toName(subject), ...options }));
|
|
113
|
-
|
|
114
|
-
is = (...others: unknown[]): boolean => others.some(o => this.toString() === text(o).toString());
|
|
115
|
-
|
|
116
|
-
equals = this.is;
|
|
117
|
-
|
|
118
|
-
isLike = (...others: unknown[]): boolean => others.some(o => this.trim.lower.is(text(o).trim.lower));
|
|
119
|
-
|
|
120
|
-
ifLike = (...others: unknown[]): Optional<this> => (this.isLike(...others) ? this : undefined);
|
|
121
|
-
|
|
122
|
-
endsWith = (end?: unknown): boolean => this.subject.endsWith(asString(end));
|
|
123
|
-
|
|
124
|
-
startsWith = (end?: unknown): boolean => this.subject.startsWith(asString(end));
|
|
125
|
-
|
|
126
|
-
first = (n: number): ToText => this.map(s => s.substring(0, n));
|
|
127
|
-
|
|
128
|
-
last = (n: number): ToText => this.map(s => s.substring(s.length - n));
|
|
129
|
-
|
|
130
|
-
map = (func: Get<string, string>): ToText => text(ofGet(func, this.subject));
|
|
131
|
-
|
|
132
|
-
replace = (search: Text, replace: Text): ToText => this.map(s => replaceAll(s, search, replace));
|
|
133
|
-
|
|
134
|
-
add = (add?: unknown, separator = ''): ToText => this.map(s => (isNotEmpty(add) ? `${s}${separator}${text(add)}` : s));
|
|
135
|
-
|
|
136
|
-
with = (separator: string, ...other: unknown[]): ToText =>
|
|
137
|
-
this.map(s =>
|
|
138
|
-
toList(s)
|
|
139
|
-
.add(...other.map(u => text(u).toString()))
|
|
140
|
-
.filter(s => isNotEmpty(s))
|
|
141
|
-
.join(separator)
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
toString(): string {
|
|
145
|
-
return this.subject;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
toJSON(): JsonValue {
|
|
149
|
-
return this.subject;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export const text = (subject?: unknown, alt = ''): ToText => {
|
|
154
|
-
const sub = subject ? asString(subject) : alt;
|
|
155
|
-
return new ToText(sub !== '[object Object]' ? sub : '');
|
|
156
|
-
};
|
package/src/types/Try.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDefined, isEmpty, isTrue } from './Is';
|
|
2
|
-
import { validate } from '../validation';
|
|
2
|
+
import { validate } from '../validation/Validate';
|
|
3
3
|
import { Construct, Constructor, ofConstruct } from './Constructor';
|
|
4
4
|
import { Validatable } from './Validatable';
|
|
5
5
|
import { Get, ofGet } from './Get';
|
package/src/types/Uri.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { asString, Text } from './Text';
|
|
|
3
3
|
import { toName } from './Constructor';
|
|
4
4
|
import { ctx } from './Context';
|
|
5
5
|
import { List, toList } from './List';
|
|
6
|
-
import {
|
|
6
|
+
import { meta } from './Meta';
|
|
7
7
|
import { tryTo } from './Try';
|
|
8
8
|
import { Optional } from './Types';
|
|
9
9
|
import { OneOrMore, toArray } from './Array';
|
|
10
|
+
import { entries } from './Object';
|
|
10
11
|
|
|
11
12
|
export type Segment = Text & { key?: string; segment?: string; query?: (value: unknown) => string };
|
|
12
13
|
|
package/src/types/Value.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Validatable } from './Validatable';
|
|
2
|
+
import { isDefined } from './Is';
|
|
3
|
+
import { JsonValue } from './Json';
|
|
4
|
+
import { asString } from './Text';
|
|
2
5
|
|
|
3
6
|
export class Value<V = string> implements Validatable {
|
|
4
7
|
constructor(readonly value: V) {
|
package/src/utils/Base64.ts
CHANGED
package/src/utils/Convert.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { asString } from '../types';
|
|
1
|
+
import { asString } from '../types/Text';
|
|
2
2
|
|
|
3
3
|
export class Convert<From = unknown, To = unknown> {
|
|
4
|
-
constructor(
|
|
4
|
+
constructor(
|
|
5
|
+
public readonly from: (f: From) => To,
|
|
6
|
+
public readonly to: (t: To) => From
|
|
7
|
+
) {}
|
|
5
8
|
}
|
|
6
9
|
|
|
7
10
|
export const convert = {
|
package/src/utils/If.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isDefined, isNotEmpty, isTrue } from '../types/Is';
|
|
2
|
+
import { Optional } from '../types/Types';
|
|
3
|
+
import { Construct, ofConstruct } from '../types/Constructor';
|
|
2
4
|
|
|
3
5
|
export function ifTrue<Out, In = unknown>(o: unknown, f: Construct<Out, NonNullable<In>>, alt: Construct<Out>): Out;
|
|
4
6
|
export function ifTrue<Out, In = unknown>(o: unknown, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out>;
|
package/src/utils/Loading.ts
CHANGED
package/src/utils/Log.ts
CHANGED
package/src/utils/Mapper.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { Construct, Get, isA, isEmpty, json, Json, JsonValue, List, meta, ofConstruct, ofGet, Optional, toList, TypeGuard } from '../types';
|
|
2
1
|
import { Property, PropertyOptions } from './Property';
|
|
3
2
|
import { State } from './State';
|
|
4
3
|
import { ifNotEmpty } from './If';
|
|
4
|
+
import { json, Json, JsonValue } from '../types/Json';
|
|
5
|
+
import { Optional } from '../types/Types';
|
|
6
|
+
import { TypeGuard } from '../types/TypeGuard';
|
|
7
|
+
import { isA } from '../types/IsA';
|
|
8
|
+
import { List, toList } from '../types/List';
|
|
9
|
+
import { meta } from '../types/Meta';
|
|
10
|
+
import { isEmpty } from '../types/Is';
|
|
11
|
+
import { Get, ofGet } from '../types/Get';
|
|
12
|
+
import { Construct, ofConstruct } from '../types/Constructor';
|
|
5
13
|
|
|
6
14
|
export type Mapping = {
|
|
7
15
|
property: string;
|
|
@@ -16,7 +24,10 @@ export type MapOptions = { startFrom: MapStartFrom };
|
|
|
16
24
|
export class Mapper extends State implements Mapping {
|
|
17
25
|
protected readonly map = mappings;
|
|
18
26
|
|
|
19
|
-
constructor(
|
|
27
|
+
constructor(
|
|
28
|
+
readonly options: MapOptions = { startFrom: 'scratch' },
|
|
29
|
+
readonly property = ''
|
|
30
|
+
) {
|
|
20
31
|
super();
|
|
21
32
|
}
|
|
22
33
|
|
package/src/utils/Promise.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toArray } from '../types/Array';
|
|
2
|
+
import { ErrorOrigin } from '../types/ErrorOrigin';
|
|
3
|
+
import { List, toList } from '../types/List';
|
|
2
4
|
|
|
3
5
|
type Pro<A> = A | PromiseLike<A>;
|
|
4
6
|
type Aw<A> = Awaited<A>;
|
package/src/utils/Property.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { convert, Convert } from './Convert';
|
|
2
|
-
import { Get, Json, JsonValue, ofGet } from '../types';
|
|
3
2
|
import { Mapping } from './Mapper';
|
|
3
|
+
import { Get, ofGet } from '../types/Get';
|
|
4
|
+
import { Json, JsonValue } from '../types/Json';
|
|
4
5
|
|
|
5
6
|
export type PropertyOptions<T = unknown> = {
|
|
6
7
|
convert?: Convert<any, any>;
|
|
@@ -9,7 +10,10 @@ export type PropertyOptions<T = unknown> = {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export class Property<T = unknown> implements Mapping {
|
|
12
|
-
constructor(
|
|
13
|
+
constructor(
|
|
14
|
+
readonly property: string,
|
|
15
|
+
readonly options?: PropertyOptions
|
|
16
|
+
) {
|
|
13
17
|
this.options = { ...options, convert: options?.convert ?? convert.default };
|
|
14
18
|
}
|
|
15
19
|
|
package/src/utils/Sentence.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Text } from '../types/Text';
|
|
2
|
+
import { text } from '../types/Template';
|
|
3
|
+
import { Id } from '../types/Id';
|
|
2
4
|
|
|
3
5
|
export class Sentence implements Text {
|
|
4
|
-
constructor(
|
|
6
|
+
constructor(
|
|
7
|
+
word: Text,
|
|
8
|
+
pre?: Sentence,
|
|
9
|
+
private sentence: Text[] = (pre?.sentence ?? []).concat(word)
|
|
10
|
+
) {}
|
|
5
11
|
|
|
6
12
|
toString(): string {
|
|
7
13
|
return text(this.sentence.join(' ')).sentence.toString();
|
package/src/utils/State.ts
CHANGED
package/src/utils/View.ts
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
asJson,
|
|
3
|
-
choose,
|
|
4
|
-
Constructor,
|
|
5
|
-
DontInfer,
|
|
6
|
-
isArray,
|
|
7
|
-
isBoolean,
|
|
8
|
-
isConstructor,
|
|
9
|
-
isEqual,
|
|
10
|
-
isFunction,
|
|
11
|
-
isPageList,
|
|
12
|
-
isString,
|
|
13
|
-
json,
|
|
14
|
-
Json,
|
|
15
|
-
List,
|
|
16
|
-
meta,
|
|
17
|
-
PageList,
|
|
18
|
-
Primitive,
|
|
19
|
-
toPageList,
|
|
20
|
-
use,
|
|
21
|
-
} from '../types';
|
|
22
1
|
import { traverse } from './Traverse';
|
|
23
2
|
import { ifDefined } from './If';
|
|
3
|
+
import { Primitive } from '../types/Primitive';
|
|
4
|
+
import { Constructor, isConstructor, use } from '../types/Constructor';
|
|
5
|
+
import { asJson, json, Json } from '../types/Json';
|
|
6
|
+
import { choose } from '../types/Case';
|
|
7
|
+
import { isArray, isBoolean, isFunction, isString } from '../types/Is';
|
|
8
|
+
import { meta } from '../types/Meta';
|
|
9
|
+
import { isPageList, PageList, toPageList } from '../types/PageList';
|
|
10
|
+
import { List } from '../types/List';
|
|
11
|
+
import { isEqual } from '../types/IsEqual';
|
|
12
|
+
import { DontInfer } from '../types/Types';
|
|
24
13
|
|
|
25
14
|
type Func<T = unknown> = (a: any, key?: string) => T;
|
|
26
15
|
type Viewer = { key: string; f: Func };
|
|
@@ -59,7 +48,11 @@ const toViewers = (views: ViewRecord): Viewer[] =>
|
|
|
59
48
|
.map(([k, v]) => toViewer(k, v));
|
|
60
49
|
|
|
61
50
|
export class View<V = Json> {
|
|
62
|
-
constructor(
|
|
51
|
+
constructor(
|
|
52
|
+
private views = {} as ViewRecord<V>,
|
|
53
|
+
readonly startsFrom: 'scratch' | 'source' = 'scratch',
|
|
54
|
+
readonly viewers: Viewer[] = toViewers(views)
|
|
55
|
+
) {}
|
|
63
56
|
|
|
64
57
|
get fromSource(): View<V> {
|
|
65
58
|
return new View(this.views, 'source', this.viewers);
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { Func, inFuture, inPast, isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString, List, meta, Results, text, Text, toList, tryTo } from '../types';
|
|
2
1
|
import { validate, Validator } from './Validate';
|
|
2
|
+
import { Func } from '../types/Func';
|
|
3
|
+
import { Results } from '../types/Results';
|
|
4
|
+
import { meta } from '../types/Meta';
|
|
5
|
+
import { List, toList } from '../types/List';
|
|
6
|
+
import { isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString } from '../types/Is';
|
|
7
|
+
import { tryTo } from '../types/Try';
|
|
8
|
+
import { text } from '../types/Template';
|
|
9
|
+
import { inFuture, inPast } from '../types/IsDate';
|
|
10
|
+
import type { Text } from '../types/Text';
|
|
3
11
|
|
|
4
12
|
export type Constraint = Func<boolean | Results, any>;
|
|
5
13
|
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
asString,
|
|
3
|
-
choose,
|
|
4
|
-
isArray,
|
|
5
|
-
isEnum,
|
|
6
|
-
isFunction,
|
|
7
|
-
isResults,
|
|
8
|
-
isValidatable,
|
|
9
|
-
isValue,
|
|
10
|
-
List,
|
|
11
|
-
meta,
|
|
12
|
-
Results,
|
|
13
|
-
TemplateOptions,
|
|
14
|
-
text,
|
|
15
|
-
Text,
|
|
16
|
-
toList,
|
|
17
|
-
toName,
|
|
18
|
-
toResult,
|
|
19
|
-
toResults,
|
|
20
|
-
tryTo,
|
|
21
|
-
} from '../types';
|
|
22
1
|
import { Constraint } from './Contraints';
|
|
23
2
|
import { when } from './When';
|
|
3
|
+
import { text } from '../types/Template';
|
|
4
|
+
import type { TemplateOptions } from '../types/Template';
|
|
5
|
+
import { isResults, Results, toResults } from '../types/Results';
|
|
6
|
+
import { toName } from '../types/Constructor';
|
|
7
|
+
import { toResult } from '../types/Result';
|
|
8
|
+
import { List, toList } from '../types/List';
|
|
9
|
+
import { meta } from '../types/Meta';
|
|
10
|
+
import { isArray, isFunction } from '../types/Is';
|
|
11
|
+
import { asString } from '../types/Text';
|
|
12
|
+
import { choose } from '../types/Case';
|
|
13
|
+
import { isEnum } from '../types/Enum';
|
|
14
|
+
import { isValue } from '../types/Value';
|
|
15
|
+
import { isValidatable } from '../types/Validatable';
|
|
16
|
+
import type { Text } from '../types/Text';
|
|
24
17
|
|
|
25
18
|
export type Validator = { property: string | symbol; constraint: Constraint; text: Text; actual?: Text };
|
|
26
19
|
|
|
@@ -32,16 +25,20 @@ const validators = (subject: unknown): List<Validator> =>
|
|
|
32
25
|
.keys<List<Validator>>('constraint')
|
|
33
26
|
.reduce((list, vs) => list.add(vs), toList<Validator>());
|
|
34
27
|
|
|
35
|
-
const runValidator = (v: Validator, subject?: unknown): Results =>
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
const runValidator = (v: Validator, subject?: unknown): Results => {
|
|
29
|
+
try {
|
|
30
|
+
const actual = isFunction((subject as any)[v.property]) ? (subject as any)[v.property]() : (subject as any)[v.property];
|
|
31
|
+
const constraint = v.constraint(actual);
|
|
32
|
+
return isResults(constraint) ? constraint : !constraint ? asResults(subject, v.text, { ...v, actual }) : toResults();
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return asResults(subject, asString(e));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
40
37
|
|
|
41
38
|
const constraints = (subject?: unknown): Results =>
|
|
42
|
-
|
|
43
|
-
.map(vs =>
|
|
44
|
-
.
|
|
39
|
+
validators(subject)
|
|
40
|
+
.map(vs => runValidator(vs, subject))
|
|
41
|
+
.reduce((rs, r) => rs.add(...r.results), toResults());
|
|
45
42
|
|
|
46
43
|
export const validate = (subject?: unknown): Results =>
|
|
47
44
|
choose(subject)
|
package/src/validation/When.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import { Constructor, ErrorOrigin, Exception, Get, isDefined, isEmpty, isIn, ofGet, Predicate, Results, toArray } from '../types';
|
|
2
1
|
import { validate } from './Validate';
|
|
3
|
-
import {
|
|
2
|
+
import { Results } from '../types/Results';
|
|
3
|
+
import { Constructor } from '../types/Constructor';
|
|
4
|
+
import { Get, ofGet, Predicate } from '../types/Get';
|
|
5
|
+
import { isDefined, isEmpty, isIn } from '../types/Is';
|
|
6
|
+
import { toArray } from '../types/Array';
|
|
7
|
+
import { ErrorOrigin } from '../types/ErrorOrigin';
|
|
8
|
+
import { reject, resolve } from '../utils/Promise';
|
|
9
|
+
import { Exception } from '../types/Exception';
|
|
4
10
|
|
|
5
11
|
export class When<W> {
|
|
6
|
-
constructor(
|
|
12
|
+
constructor(
|
|
13
|
+
readonly subject: W,
|
|
14
|
+
readonly valid = true,
|
|
15
|
+
private results?: Results
|
|
16
|
+
) {}
|
|
7
17
|
|
|
8
18
|
get not(): When<W> {
|
|
9
19
|
return this.clone(!this.valid);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sql/Count.ts"],"sourcesContent":["import { ifGet } from '../types';\nimport { Select } from './Select';\n\nexport class Count extends Select {\n toString(): string {\n return (\n `SELECT COUNT(*)` +\n ifGet(this._top, ` TOP ${this._top}`, '') +\n ` FROM ${this.table}` +\n ifGet(this.clauses.length, ` WHERE ${this.clauses.join(' AND ')}`, '') +\n ifGet(this.grouped.length, ` GROUP BY ${this.grouped.join(', ')}`, '') +\n ';'\n );\n }\n}\n"],"mappings":";;;;;;;;AAGO,IAAM,QAAN,cAAoB,OAAO;AAAA,EAChC,WAAmB;AACjB,WACE,oBACA,MAAM,KAAK,MAAM,QAAQ,KAAK,IAAI,IAAI,EAAE,IACxC,SAAS,KAAK,KAAK,KACnB,MAAM,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ,KAAK,OAAO,CAAC,IAAI,EAAE,IACrE,MAAM,KAAK,QAAQ,QAAQ,aAAa,KAAK,QAAQ,KAAK,IAAI,CAAC,IAAI,EAAE,IACrE;AAAA,EAEJ;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/ApiGateway.ts"],"sourcesContent":["import { Api, RouteOptions } from './Api';\nimport { FetchOptions, Gateway, Json, Optional, PageList, toPageList, Uri, use } from '../types';\nimport { RequestOptions } from '../http';\n\nexport class ApiGateway extends Gateway<RouteOptions> {\n constructor(readonly api: Api = new Api()) {\n super();\n }\n\n get(uri: Uri, options?: RouteOptions): Promise<PageList<Json>> {\n return this.api.get(uri, options).then(r => use(r.body.data, d => toPageList(d?.items, { total: d?.totalItems, ...d?.meta })));\n }\n\n getOne(uri: Uri, options?: RouteOptions): Promise<Optional<Json>> {\n return this.get(uri, options).then(r => r.first());\n }\n\n post(uri: Uri, item?: Json, options?: RouteOptions): Promise<Json> {\n return this.api.post(uri, item, options).then(r => r.body.data?.items.first() ?? {});\n }\n\n postSearch(uri: Uri, options?: RequestOptions | FetchOptions): Promise<PageList<Json>> {\n return this.api.post(uri, options).then(r => use(r.body.data, d => toPageList(d?.items, { total: d?.totalItems, ...d?.meta })));\n }\n\n patch(uri: Uri, item?: Json, options?: RouteOptions): Promise<Json> {\n return this.api.patch(uri, item, options).then(r => r.body.data?.items.first() ?? {});\n }\n\n put(uri: Uri, item?: Json, options?: RouteOptions): Promise<Json> {\n return this.api.put(uri, item, options).then(r => r.body.data?.items.first() ?? {});\n }\n\n delete(uri: Uri, options?: RouteOptions): Promise<boolean> {\n return this.api.delete(uri, options).then(() => true);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAIO,IAAM,aAAN,cAAyB,QAAsB;AAAA,EACpD,YAAqB,MAAW,IAAI,IAAI,GAAG;AACzC,UAAM;AADa;AAAA,EAErB;AAAA,EAEA,IAAI,KAAU,SAAiD;AAC7D,WAAO,KAAK,IAAI,IAAI,KAAK,OAAO,EAAE,KAAK,OAAK,IAAI,EAAE,KAAK,MAAM,OAAK,WAAW,GAAG,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;AAAA,EAC/H;AAAA,EAEA,OAAO,KAAU,SAAiD;AAChE,WAAO,KAAK,IAAI,KAAK,OAAO,EAAE,KAAK,OAAK,EAAE,MAAM,CAAC;AAAA,EACnD;AAAA,EAEA,KAAK,KAAU,MAAa,SAAuC;AACjE,WAAO,KAAK,IAAI,KAAK,KAAK,MAAM,OAAO,EAAE,KAAK,OAAK,EAAE,KAAK,MAAM,MAAM,MAAM,KAAK,CAAC,CAAC;AAAA,EACrF;AAAA,EAEA,WAAW,KAAU,SAAkE;AACrF,WAAO,KAAK,IAAI,KAAK,KAAK,OAAO,EAAE,KAAK,OAAK,IAAI,EAAE,KAAK,MAAM,OAAK,WAAW,GAAG,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;AAAA,EAChI;AAAA,EAEA,MAAM,KAAU,MAAa,SAAuC;AAClE,WAAO,KAAK,IAAI,MAAM,KAAK,MAAM,OAAO,EAAE,KAAK,OAAK,EAAE,KAAK,MAAM,MAAM,MAAM,KAAK,CAAC,CAAC;AAAA,EACtF;AAAA,EAEA,IAAI,KAAU,MAAa,SAAuC;AAChE,WAAO,KAAK,IAAI,IAAI,KAAK,MAAM,OAAO,EAAE,KAAK,OAAK,EAAE,KAAK,MAAM,MAAM,MAAM,KAAK,CAAC,CAAC;AAAA,EACpF;AAAA,EAEA,OAAO,KAAU,SAA0C;AACzD,WAAO,KAAK,IAAI,OAAO,KAAK,OAAO,EAAE,KAAK,MAAM,IAAI;AAAA,EACtD;AACF;","names":[]}
|