@thisisagile/easy 17.26.0 → 17.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2AB6ZQHC.mjs +26 -0
- package/dist/chunk-2AB6ZQHC.mjs.map +1 -0
- package/dist/chunk-4DJUHTQO.mjs +55 -0
- package/dist/chunk-4DJUHTQO.mjs.map +1 -0
- package/dist/chunk-4HWEQEHM.mjs +20 -0
- package/dist/chunk-4HWEQEHM.mjs.map +1 -0
- package/dist/chunk-4N72FQFX.mjs +16 -0
- package/dist/chunk-4N72FQFX.mjs.map +1 -0
- package/dist/chunk-4SWYJEN5.mjs +82 -0
- package/dist/chunk-4SWYJEN5.mjs.map +1 -0
- package/dist/chunk-4VZHB642.mjs +37 -0
- package/dist/chunk-4VZHB642.mjs.map +1 -0
- package/dist/chunk-ADJAEGCT.mjs +21 -0
- package/dist/chunk-ADJAEGCT.mjs.map +1 -0
- package/dist/chunk-AGTB4HMP.mjs +11 -0
- package/dist/chunk-AGTB4HMP.mjs.map +1 -0
- package/dist/chunk-BDA5LB4S.mjs +29 -0
- package/dist/chunk-BDA5LB4S.mjs.map +1 -0
- package/dist/chunk-BZOYP6X7.mjs +134 -0
- package/dist/chunk-BZOYP6X7.mjs.map +1 -0
- package/dist/chunk-CO2AFYVD.mjs +43 -0
- package/dist/chunk-CO2AFYVD.mjs.map +1 -0
- package/dist/chunk-D7UFAVDX.mjs +54 -0
- package/dist/chunk-D7UFAVDX.mjs.map +1 -0
- package/dist/chunk-DEFTEK45.mjs +40 -0
- package/dist/chunk-DEFTEK45.mjs.map +1 -0
- package/dist/chunk-DEJ7A5PY.mjs +43 -0
- package/dist/chunk-DEJ7A5PY.mjs.map +1 -0
- package/dist/chunk-DLA22ZCC.mjs +20 -0
- package/dist/chunk-DLA22ZCC.mjs.map +1 -0
- package/dist/chunk-DXQSIBC7.mjs +13 -0
- package/dist/chunk-DXQSIBC7.mjs.map +1 -0
- package/dist/chunk-ELDS3NWV.mjs +23 -0
- package/dist/chunk-ELDS3NWV.mjs.map +1 -0
- package/dist/chunk-ELUKCMQZ.mjs +50 -0
- package/dist/chunk-ELUKCMQZ.mjs.map +1 -0
- package/dist/chunk-FN7HN3YK.mjs +58 -0
- package/dist/chunk-FN7HN3YK.mjs.map +1 -0
- package/dist/chunk-GCY5A63A.mjs +25 -0
- package/dist/chunk-GCY5A63A.mjs.map +1 -0
- package/dist/chunk-GO66AIDJ.mjs +76 -0
- package/dist/chunk-GO66AIDJ.mjs.map +1 -0
- package/dist/chunk-GVTADDU5.mjs +39 -0
- package/dist/chunk-GVTADDU5.mjs.map +1 -0
- package/dist/chunk-GZIULZH2.mjs +79 -0
- package/dist/chunk-GZIULZH2.mjs.map +1 -0
- package/dist/chunk-HOVTNDHS.mjs +297 -0
- package/dist/chunk-HOVTNDHS.mjs.map +1 -0
- package/dist/chunk-HPM4L4MH.mjs +20 -0
- package/dist/chunk-HPM4L4MH.mjs.map +1 -0
- package/dist/chunk-HSOXY623.mjs +53 -0
- package/dist/chunk-HSOXY623.mjs.map +1 -0
- package/dist/chunk-IH4VU7UP.mjs +31 -0
- package/dist/chunk-IH4VU7UP.mjs.map +1 -0
- package/dist/chunk-JPWRHLXY.mjs +51 -0
- package/dist/chunk-JPWRHLXY.mjs.map +1 -0
- package/dist/chunk-L5KXXMUH.mjs +46 -0
- package/dist/chunk-L5KXXMUH.mjs.map +1 -0
- package/dist/chunk-L5ZI7SPN.mjs +90 -0
- package/dist/chunk-L5ZI7SPN.mjs.map +1 -0
- package/dist/chunk-LGLRWA42.mjs +324 -0
- package/dist/chunk-LGLRWA42.mjs.map +1 -0
- package/dist/chunk-LKTTPV6U.mjs +70 -0
- package/dist/chunk-LKTTPV6U.mjs.map +1 -0
- package/dist/chunk-LONFFS5R.mjs +107 -0
- package/dist/chunk-LONFFS5R.mjs.map +1 -0
- package/dist/chunk-LUHR6633.mjs +54 -0
- package/dist/chunk-LUHR6633.mjs.map +1 -0
- package/dist/chunk-MDXL65W4.mjs +49 -0
- package/dist/chunk-MDXL65W4.mjs.map +1 -0
- package/dist/chunk-N22QIDIK.mjs +25 -0
- package/dist/chunk-N22QIDIK.mjs.map +1 -0
- package/dist/chunk-NBYO2U6Q.mjs +48 -0
- package/dist/chunk-NBYO2U6Q.mjs.map +1 -0
- package/dist/chunk-NPCTXURR.mjs +23 -0
- package/dist/chunk-NPCTXURR.mjs.map +1 -0
- package/dist/chunk-OFGI5FLG.mjs +11 -0
- package/dist/chunk-OFGI5FLG.mjs.map +1 -0
- package/dist/chunk-OGLPG6DF.mjs +18 -0
- package/dist/chunk-OGLPG6DF.mjs.map +1 -0
- package/dist/chunk-OKPGJD64.mjs +41 -0
- package/dist/chunk-OKPGJD64.mjs.map +1 -0
- package/dist/chunk-OQNZEKWO.mjs +24 -0
- package/dist/chunk-OQNZEKWO.mjs.map +1 -0
- package/dist/chunk-OWLQ6U7M.mjs +57 -0
- package/dist/chunk-OWLQ6U7M.mjs.map +1 -0
- package/dist/chunk-P5MN5NGC.mjs +24 -0
- package/dist/chunk-P5MN5NGC.mjs.map +1 -0
- package/dist/chunk-PIRWVOO2.mjs +7 -0
- package/dist/chunk-PIRWVOO2.mjs.map +1 -0
- package/dist/chunk-PR6DFFCE.mjs +94 -0
- package/dist/chunk-PR6DFFCE.mjs.map +1 -0
- package/dist/chunk-QMASVXTD.mjs +40 -0
- package/dist/chunk-QMASVXTD.mjs.map +1 -0
- package/dist/chunk-QNNYTOR7.mjs +142 -0
- package/dist/chunk-QNNYTOR7.mjs.map +1 -0
- package/dist/chunk-RHOK5QZR.mjs +175 -0
- package/dist/chunk-RHOK5QZR.mjs.map +1 -0
- package/dist/chunk-RS7CT7BU.mjs +20 -0
- package/dist/chunk-RS7CT7BU.mjs.map +1 -0
- package/dist/chunk-RUFO75IB.mjs +18 -0
- package/dist/chunk-RUFO75IB.mjs.map +1 -0
- package/dist/chunk-RWGCMC6L.mjs +164 -0
- package/dist/chunk-RWGCMC6L.mjs.map +1 -0
- package/dist/chunk-SCVGZWV7.mjs +35 -0
- package/dist/chunk-SCVGZWV7.mjs.map +1 -0
- package/dist/chunk-SJ4YFZKO.mjs +21 -0
- package/dist/chunk-SJ4YFZKO.mjs.map +1 -0
- package/dist/chunk-SJGQU3OG.mjs +15 -0
- package/dist/chunk-SJGQU3OG.mjs.map +1 -0
- package/dist/chunk-SSROJBD5.mjs +30 -0
- package/dist/chunk-SSROJBD5.mjs.map +1 -0
- package/dist/chunk-SW2OCUH3.mjs +10 -0
- package/dist/chunk-SW2OCUH3.mjs.map +1 -0
- package/dist/chunk-TNZJKUDY.mjs +45 -0
- package/dist/chunk-TNZJKUDY.mjs.map +1 -0
- package/dist/chunk-UXADDXCJ.mjs +68 -0
- package/dist/chunk-UXADDXCJ.mjs.map +1 -0
- package/dist/chunk-UYDZZAEK.mjs +11 -0
- package/dist/chunk-UYDZZAEK.mjs.map +1 -0
- package/dist/chunk-VBZTERRM.mjs +94 -0
- package/dist/chunk-VBZTERRM.mjs.map +1 -0
- package/dist/chunk-WJZFE5NE.mjs +17 -0
- package/dist/chunk-WJZFE5NE.mjs.map +1 -0
- package/dist/chunk-WLTLSV2I.mjs +20 -0
- package/dist/chunk-WLTLSV2I.mjs.map +1 -0
- package/dist/chunk-WOSYMEQL.mjs +60 -0
- package/dist/chunk-WOSYMEQL.mjs.map +1 -0
- package/dist/chunk-WSBULPUZ.mjs +30 -0
- package/dist/chunk-WSBULPUZ.mjs.map +1 -0
- package/dist/chunk-WVTNXVBL.mjs +56 -0
- package/dist/chunk-WVTNXVBL.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.mjs +29 -0
- package/dist/data/Condition.mjs.map +1 -0
- package/dist/data/DataProvider.mjs +1 -0
- package/dist/data/DataProvider.mjs.map +1 -0
- package/dist/data/Database.mjs +23 -0
- package/dist/data/Database.mjs.map +1 -0
- package/dist/data/Field.mjs +47 -0
- package/dist/data/Field.mjs.map +1 -0
- package/dist/data/InMemoryGateway.mjs +70 -0
- package/dist/data/InMemoryGateway.mjs.map +1 -0
- package/dist/data/Query.mjs +1 -0
- package/dist/data/Query.mjs.map +1 -0
- package/dist/data/QueryProvider.mjs +1 -0
- package/dist/data/QueryProvider.mjs.map +1 -0
- package/dist/domain/Audit.mjs +36 -0
- package/dist/domain/Audit.mjs.map +1 -0
- package/dist/domain/Child.mjs +54 -0
- package/dist/domain/Child.mjs.map +1 -0
- package/dist/domain/DateTime.mjs +36 -0
- package/dist/domain/DateTime.mjs.map +1 -0
- package/dist/domain/Entity.mjs +71 -0
- package/dist/domain/Entity.mjs.map +1 -0
- package/dist/domain/Repo.mjs +96 -0
- package/dist/domain/Repo.mjs.map +1 -0
- package/dist/domain/Struct.mjs +33 -0
- package/dist/domain/Struct.mjs.map +1 -0
- package/dist/domain/Typo.mjs +114 -0
- package/dist/domain/Typo.mjs.map +1 -0
- package/dist/http/CacheControl.mjs +66 -0
- package/dist/http/CacheControl.mjs.map +1 -0
- package/dist/http/ContentType.mjs +21 -0
- package/dist/http/ContentType.mjs.map +1 -0
- package/dist/http/HttpHeader.mjs +8 -0
- package/dist/http/HttpHeader.mjs.map +1 -0
- package/dist/http/HttpStatus.mjs +25 -0
- package/dist/http/HttpStatus.mjs.map +1 -0
- package/dist/http/HttpVerb.mjs +21 -0
- package/dist/http/HttpVerb.mjs.map +1 -0
- package/dist/http/LocalRequestStore.mjs +29 -0
- package/dist/http/LocalRequestStore.mjs.map +1 -0
- package/dist/http/Request.mjs +1 -0
- package/dist/http/Request.mjs.map +1 -0
- package/dist/http/RequestOptions.mjs +30 -0
- package/dist/http/RequestOptions.mjs.map +1 -0
- package/dist/http/RequestProvider.mjs +1 -0
- package/dist/http/RequestProvider.mjs.map +1 -0
- package/dist/http/Response.mjs +13 -0
- package/dist/http/Response.mjs.map +1 -0
- package/dist/http/RestResult.mjs +34 -0
- package/dist/http/RestResult.mjs.map +1 -0
- package/dist/http/toResponse.mjs +33 -0
- package/dist/http/toResponse.mjs.map +1 -0
- package/dist/index.mjs +115 -3476
- package/dist/index.mjs.map +1 -1
- package/dist/process/App.mjs +30 -0
- package/dist/process/App.mjs.map +1 -0
- package/dist/process/Manage.mjs +47 -0
- package/dist/process/Manage.mjs.map +1 -0
- package/dist/process/Scope.mjs +22 -0
- package/dist/process/Scope.mjs.map +1 -0
- package/dist/process/Search.mjs +31 -0
- package/dist/process/Search.mjs.map +1 -0
- package/dist/process/UseCase.mjs +53 -0
- package/dist/process/UseCase.mjs.map +1 -0
- package/dist/resources/Req.mjs +57 -0
- package/dist/resources/Req.mjs.map +1 -0
- package/dist/security/Jwt.mjs +77 -0
- package/dist/security/Jwt.mjs.map +1 -0
- package/dist/services/Api.mjs +44 -0
- package/dist/services/Api.mjs.map +1 -0
- package/dist/services/ApiGateway.mjs +45 -0
- package/dist/services/ApiGateway.mjs.map +1 -0
- package/dist/services/AxiosProvider.mjs +40 -0
- package/dist/services/AxiosProvider.mjs.map +1 -0
- package/dist/services/MappedRouteGateway.mjs +78 -0
- package/dist/services/MappedRouteGateway.mjs.map +1 -0
- package/dist/services/RouteGateway.mjs +46 -0
- package/dist/services/RouteGateway.mjs.map +1 -0
- package/dist/services/ViewRouteGateway.mjs +79 -0
- package/dist/services/ViewRouteGateway.mjs.map +1 -0
- package/dist/sql/Clause.mjs +24 -0
- package/dist/sql/Clause.mjs.map +1 -0
- package/dist/sql/Column.mjs +37 -0
- package/dist/sql/Column.mjs.map +1 -0
- package/dist/sql/Count.mjs +20 -0
- package/dist/sql/Count.mjs.map +1 -0
- package/dist/sql/Delete.mjs +19 -0
- package/dist/sql/Delete.mjs.map +1 -0
- package/dist/sql/Insert.mjs +21 -0
- package/dist/sql/Insert.mjs.map +1 -0
- package/dist/sql/Join.mjs +8 -0
- package/dist/sql/Join.mjs.map +1 -0
- package/dist/sql/Select.mjs +19 -0
- package/dist/sql/Select.mjs.map +1 -0
- package/dist/sql/SqlQuery.mjs +18 -0
- package/dist/sql/SqlQuery.mjs.map +1 -0
- package/dist/sql/Table.mjs +93 -0
- package/dist/sql/Table.mjs.map +1 -0
- package/dist/sql/TableGateway.mjs +72 -0
- package/dist/sql/TableGateway.mjs.map +1 -0
- package/dist/sql/Update.mjs +21 -0
- package/dist/sql/Update.mjs.map +1 -0
- package/dist/types/AnyKey.mjs +1 -0
- package/dist/types/AnyKey.mjs.map +1 -0
- package/dist/types/Array.mjs +16 -0
- package/dist/types/Array.mjs.map +1 -0
- package/dist/types/Builder.mjs +26 -0
- package/dist/types/Builder.mjs.map +1 -0
- package/dist/types/Cache.mjs +29 -0
- package/dist/types/Cache.mjs.map +1 -0
- package/dist/types/CacheAge.mjs +33 -0
- package/dist/types/CacheAge.mjs.map +1 -0
- package/dist/types/Case.mjs +29 -0
- package/dist/types/Case.mjs.map +1 -0
- package/dist/types/Constructor.mjs +23 -0
- package/dist/types/Constructor.mjs.map +1 -0
- package/dist/types/Context.mjs +28 -0
- package/dist/types/Context.mjs.map +1 -0
- package/dist/types/Currency.mjs +15 -0
- package/dist/types/Currency.mjs.map +1 -0
- package/dist/types/Enum.mjs +24 -0
- package/dist/types/Enum.mjs.map +1 -0
- package/dist/types/Environment.mjs +28 -0
- package/dist/types/Environment.mjs.map +1 -0
- package/dist/types/ErrorOrigin.mjs +1 -0
- package/dist/types/ErrorOrigin.mjs.map +1 -0
- package/dist/types/Exception.mjs +26 -0
- package/dist/types/Exception.mjs.map +1 -0
- package/dist/types/Falsy.mjs +10 -0
- package/dist/types/Falsy.mjs.map +1 -0
- package/dist/types/Func.mjs +8 -0
- package/dist/types/Func.mjs.map +1 -0
- package/dist/types/Gateway.mjs +24 -0
- package/dist/types/Gateway.mjs.map +1 -0
- package/dist/types/Get.mjs +13 -0
- package/dist/types/Get.mjs.map +1 -0
- package/dist/types/Id.mjs +13 -0
- package/dist/types/Id.mjs.map +1 -0
- package/dist/types/IdName.mjs +1 -0
- package/dist/types/IdName.mjs.map +1 -0
- package/dist/types/Identity.mjs +1 -0
- package/dist/types/Identity.mjs.map +1 -0
- package/dist/types/Indexed.mjs +15 -0
- package/dist/types/Indexed.mjs.map +1 -0
- package/dist/types/Is.mjs +42 -0
- package/dist/types/Is.mjs.map +1 -0
- package/dist/types/IsA.mjs +16 -0
- package/dist/types/IsA.mjs.map +1 -0
- package/dist/types/IsDate.mjs +14 -0
- package/dist/types/IsDate.mjs.map +1 -0
- package/dist/types/IsEqual.mjs +30 -0
- package/dist/types/IsEqual.mjs.map +1 -0
- package/dist/types/Json.mjs +29 -0
- package/dist/types/Json.mjs.map +1 -0
- package/dist/types/List.mjs +27 -0
- package/dist/types/List.mjs.map +1 -0
- package/dist/types/Message.mjs +11 -0
- package/dist/types/Message.mjs.map +1 -0
- package/dist/types/Meta.mjs +19 -0
- package/dist/types/Meta.mjs.map +1 -0
- package/dist/types/Nullish.mjs +8 -0
- package/dist/types/Nullish.mjs.map +1 -0
- package/dist/types/Number.mjs +30 -0
- package/dist/types/Number.mjs.map +1 -0
- package/dist/types/Object.mjs +24 -0
- package/dist/types/Object.mjs.map +1 -0
- package/dist/types/PageList.mjs +40 -0
- package/dist/types/PageList.mjs.map +1 -0
- package/dist/types/Parser.mjs +80 -0
- package/dist/types/Parser.mjs.map +1 -0
- package/dist/types/Primitive.mjs +9 -0
- package/dist/types/Primitive.mjs.map +1 -0
- package/dist/types/Repository.mjs +24 -0
- package/dist/types/Repository.mjs.map +1 -0
- package/dist/types/Result.mjs +23 -0
- package/dist/types/Result.mjs.map +1 -0
- package/dist/types/Results.mjs +26 -0
- package/dist/types/Results.mjs.map +1 -0
- package/dist/types/Sort.mjs +10 -0
- package/dist/types/Sort.mjs.map +1 -0
- package/dist/types/Tag.mjs +26 -0
- package/dist/types/Tag.mjs.map +1 -0
- package/dist/types/Template.mjs +21 -0
- package/dist/types/Template.mjs.map +1 -0
- package/dist/types/Text.mjs +21 -0
- package/dist/types/Text.mjs.map +1 -0
- package/dist/types/ToText.mjs +23 -0
- package/dist/types/ToText.mjs.map +1 -0
- package/dist/types/Try.mjs +31 -0
- package/dist/types/Try.mjs.map +1 -0
- package/dist/types/TypeGuard.mjs +1 -0
- package/dist/types/TypeGuard.mjs.map +1 -0
- package/dist/types/Types.mjs +1 -0
- package/dist/types/Types.mjs.map +1 -0
- package/dist/types/Uri.mjs +119 -0
- package/dist/types/Uri.mjs.map +1 -0
- package/dist/types/Uuid.mjs +16 -0
- package/dist/types/Uuid.mjs.map +1 -0
- package/dist/types/Validatable.mjs +13 -0
- package/dist/types/Validatable.mjs.map +1 -0
- package/dist/types/Value.mjs +14 -0
- package/dist/types/Value.mjs.map +1 -0
- package/dist/utils/Base64.mjs +12 -0
- package/dist/utils/Base64.mjs.map +1 -0
- package/dist/utils/Convert.mjs +14 -0
- package/dist/utils/Convert.mjs.map +1 -0
- package/dist/utils/If.mjs +25 -0
- package/dist/utils/If.mjs.map +1 -0
- package/dist/utils/Loading.mjs +11 -0
- package/dist/utils/Loading.mjs.map +1 -0
- package/dist/utils/Log.mjs +21 -0
- package/dist/utils/Log.mjs.map +1 -0
- package/dist/utils/Mapper.mjs +28 -0
- package/dist/utils/Mapper.mjs.map +1 -0
- package/dist/utils/Promise.mjs +35 -0
- package/dist/utils/Promise.mjs.map +1 -0
- package/dist/utils/Property.mjs +13 -0
- package/dist/utils/Property.mjs.map +1 -0
- package/dist/utils/Seconds.mjs +18 -0
- package/dist/utils/Seconds.mjs.map +1 -0
- package/dist/utils/Sentence.mjs +71 -0
- package/dist/utils/Sentence.mjs.map +1 -0
- package/dist/utils/State.mjs +12 -0
- package/dist/utils/State.mjs.map +1 -0
- package/dist/utils/Traverse.mjs +12 -0
- package/dist/utils/Traverse.mjs.map +1 -0
- package/dist/utils/View.mjs +41 -0
- package/dist/utils/View.mjs.map +1 -0
- package/dist/utils/Wait.mjs +17 -0
- package/dist/utils/Wait.mjs.map +1 -0
- package/dist/validation/Contraints.mjs +65 -0
- package/dist/validation/Contraints.mjs.map +1 -0
- package/dist/validation/Validate.mjs +35 -0
- package/dist/validation/Validate.mjs.map +1 -0
- package/dist/validation/When.mjs +31 -0
- package/dist/validation/When.mjs.map +1 -0
- package/package.json +4 -12
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isFunc
|
|
3
|
+
} from "./chunk-PIRWVOO2.mjs";
|
|
4
|
+
|
|
5
|
+
// src/types/Get.ts
|
|
6
|
+
var ofGet = (g, ...args) => isFunc(g) ? g(...args) : g;
|
|
7
|
+
var ifGet = (pred, valid, invalid) => ofGet(pred) ? ofGet(valid) : ofGet(invalid);
|
|
8
|
+
var ofProperty = (t, p) => isFunc(p) ? p(t) : t[p];
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
ofGet,
|
|
12
|
+
ifGet,
|
|
13
|
+
ofProperty
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=chunk-SJGQU3OG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/Get.ts"],"sourcesContent":["import { Func, isFunc } from './Func';\n\nexport type Get<T = any, Args = any> = Func<T, Args> | T;\nexport type Predicate<Args = unknown> = Get<boolean, Args>;\nexport const ofGet = <T, Args = any>(g: Get<T, Args>, ...args: Args[]): T => (isFunc<T, Args>(g) ? g(...args) : g);\nexport const ifGet = <T>(pred: Get, valid: Get<T>, invalid: Get<T>): T => (ofGet(pred) ? ofGet(valid) : ofGet(invalid));\nexport type GetProperty<T, Prop> = keyof T | Func<Prop, T>;\nexport const ofProperty = <T, Prop>(t: T, p: GetProperty<T, Prop>): Prop => (isFunc<Prop, T>(p) ? p(t) : ((t as any)[p] as Prop));\n"],"mappings":";;;;;AAIO,IAAM,QAAQ,CAAgB,MAAoB,SAAqB,OAAgB,CAAC,IAAI,EAAE,GAAG,IAAI,IAAI;AACzG,IAAM,QAAQ,CAAI,MAAW,OAAe,YAAwB,MAAM,IAAI,IAAI,MAAM,KAAK,IAAI,MAAM,OAAO;AAE9G,IAAM,aAAa,CAAU,GAAM,MAAmC,OAAgB,CAAC,IAAI,EAAE,CAAC,IAAM,EAAU,CAAC;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/utils/Traverse.ts
|
|
2
|
+
var traverse = (subject, property = "") => {
|
|
3
|
+
subject ??= {};
|
|
4
|
+
const props = property.split(".");
|
|
5
|
+
const p = props.shift();
|
|
6
|
+
return props.length === 0 ? subject[p] : traverse(subject[p], props.join("."));
|
|
7
|
+
};
|
|
8
|
+
var traverseSet = (subject, property, value) => {
|
|
9
|
+
const props = property.split(".");
|
|
10
|
+
const p = props.shift();
|
|
11
|
+
return {
|
|
12
|
+
...subject,
|
|
13
|
+
[p]: props.length === 0 ? value : traverseSet(subject[p], props.join("."), value)
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
var accumulate = (items, ...keys) => items.map((t, i, arr) => {
|
|
17
|
+
const acc = keys.reduce(
|
|
18
|
+
(acc2, v) => traverseSet(acc2, v, i === 0 ? traverse(t, v) : traverse(arr[i - 1], v) + traverse(t, v)),
|
|
19
|
+
t
|
|
20
|
+
);
|
|
21
|
+
arr[i] = acc;
|
|
22
|
+
return acc;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
traverse,
|
|
27
|
+
traverseSet,
|
|
28
|
+
accumulate
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-SSROJBD5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/Traverse.ts"],"sourcesContent":["import { AnyKey } from '../types/AnyKey';\n\nexport const traverse = (subject: unknown, property = ''): unknown => {\n subject ??= {};\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\nexport const traverseSet = <T>(subject: T, property: AnyKey<T>, value: unknown): unknown => {\n const props = property.split('.');\n const p = props.shift() as string;\n return {\n ...(subject as any),\n [p]: props.length === 0 ? value : traverseSet((subject as any)[p], props.join('.'), value),\n } as T;\n};\n\nexport const accumulate = <T>(items: T[], ...keys: AnyKey<T>[]): T[] =>\n items.map((t, i, arr) => {\n const acc = keys.reduce(\n (acc, v) => traverseSet(acc, v, i === 0 ? traverse(t, v) : (traverse(arr[i - 1], v) as number) + (traverse(t, v) as number)) as T,\n t\n );\n arr[i] = acc;\n return acc;\n });\n"],"mappings":";AAEO,IAAM,WAAW,CAAC,SAAkB,WAAW,OAAgB;AACpE,cAAY,CAAC;AACb,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;AAEO,IAAM,cAAc,CAAI,SAAY,UAAqB,UAA4B;AAC1F,QAAM,QAAQ,SAAS,MAAM,GAAG;AAChC,QAAM,IAAI,MAAM,MAAM;AACtB,SAAO;AAAA,IACL,GAAI;AAAA,IACJ,CAAC,CAAC,GAAG,MAAM,WAAW,IAAI,QAAQ,YAAa,QAAgB,CAAC,GAAG,MAAM,KAAK,GAAG,GAAG,KAAK;AAAA,EAC3F;AACF;AAEO,IAAM,aAAa,CAAI,UAAe,SAC3C,MAAM,IAAI,CAAC,GAAG,GAAG,QAAQ;AACvB,QAAM,MAAM,KAAK;AAAA,IACf,CAACA,MAAK,MAAM,YAAYA,MAAK,GAAG,MAAM,IAAI,SAAS,GAAG,CAAC,IAAK,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,IAAgB,SAAS,GAAG,CAAC,CAAY;AAAA,IAC3H;AAAA,EACF;AACA,MAAI,CAAC,IAAI;AACT,SAAO;AACT,CAAC;","names":["acc"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/http/HttpHeader.ts"],"sourcesContent":["export const HttpHeader = {\n ContentType: 'Content-Type',\n Correlation: 'X-Correlation-Id',\n};\n"],"mappings":";AAAO,IAAM,aAAa;AAAA,EACxB,aAAa;AAAA,EACb,aAAa;AACf;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
reject
|
|
3
|
+
} from "./chunk-LUHR6633.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Exception
|
|
6
|
+
} from "./chunk-DEFTEK45.mjs";
|
|
7
|
+
|
|
8
|
+
// src/types/Gateway.ts
|
|
9
|
+
var Gateway = class {
|
|
10
|
+
all(options) {
|
|
11
|
+
return reject(Exception.IsNotImplemented);
|
|
12
|
+
}
|
|
13
|
+
byId(id, options) {
|
|
14
|
+
return reject(Exception.IsNotImplemented);
|
|
15
|
+
}
|
|
16
|
+
by(_key, _value, _options) {
|
|
17
|
+
return reject(Exception.IsNotImplemented);
|
|
18
|
+
}
|
|
19
|
+
byIds(..._ids) {
|
|
20
|
+
return reject(Exception.IsNotImplemented);
|
|
21
|
+
}
|
|
22
|
+
search(q, options) {
|
|
23
|
+
return reject(Exception.IsNotImplemented);
|
|
24
|
+
}
|
|
25
|
+
filter(options) {
|
|
26
|
+
return reject(Exception.IsNotImplemented);
|
|
27
|
+
}
|
|
28
|
+
exists(id, options) {
|
|
29
|
+
return reject(Exception.IsNotImplemented);
|
|
30
|
+
}
|
|
31
|
+
add(item, options) {
|
|
32
|
+
return reject(Exception.IsNotImplemented);
|
|
33
|
+
}
|
|
34
|
+
update(item, options) {
|
|
35
|
+
return reject(Exception.IsNotImplemented);
|
|
36
|
+
}
|
|
37
|
+
remove(id, options) {
|
|
38
|
+
return reject(Exception.IsNotImplemented);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
Gateway
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=chunk-TNZJKUDY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/Gateway.ts"],"sourcesContent":["import { Json, JsonValue } from './Json';\nimport { Id } from './Id';\nimport { Exception } from './Exception';\nimport { PageList, PageOptions } from './PageList';\nimport { List } from './List';\nimport { Optional } from './Types';\nimport { reject } from '../utils/Promise';\n\nexport type FetchOptions = PageOptions;\n\nexport abstract class Gateway<Options = FetchOptions> {\n all(options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byId(id: Id, options?: Options): Promise<Optional<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n by(_key: string, _value: JsonValue, _options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byIds(..._ids: Id[]): Promise<List<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n search(q: JsonValue, options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n filter(options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n exists(id: Id, options?: Options): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n\n add(item: Json, options?: Options): Promise<Json> {\n return reject(Exception.IsNotImplemented);\n }\n\n update(item: Json, options?: Options): Promise<Json> {\n return reject(Exception.IsNotImplemented);\n }\n\n remove(id: Id, options?: Options): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n}\n"],"mappings":";;;;;;;;AAUO,IAAe,UAAf,MAA+C;AAAA,EACpD,IAAI,SAA4C;AAC9C,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,KAAK,IAAQ,SAA4C;AACvD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,GAAG,MAAc,QAAmB,UAA6C;AAC/E,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,SAAS,MAAiC;AACxC,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,GAAc,SAA4C;AAC/D,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,SAA4C;AACjD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,SAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,IAAI,MAAY,SAAkC;AAChD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,MAAY,SAAkC;AACnD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,SAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AACF;","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
meta
|
|
3
|
+
} from "./chunk-FN7HN3YK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
toList
|
|
6
|
+
} from "./chunk-HOVTNDHS.mjs";
|
|
7
|
+
import {
|
|
8
|
+
ofGet
|
|
9
|
+
} from "./chunk-SJGQU3OG.mjs";
|
|
10
|
+
import {
|
|
11
|
+
isAn
|
|
12
|
+
} from "./chunk-ZHXKBOK2.mjs";
|
|
13
|
+
import {
|
|
14
|
+
isDefined,
|
|
15
|
+
isFunction
|
|
16
|
+
} from "./chunk-DEJ7A5PY.mjs";
|
|
17
|
+
|
|
18
|
+
// src/types/Enum.ts
|
|
19
|
+
var isEnumConstructor = (c) => isFunction(c) && c.isEnum;
|
|
20
|
+
var Enum = class {
|
|
21
|
+
constructor(name, id = name.toLowerCase(), code = id.toString()) {
|
|
22
|
+
this.name = name;
|
|
23
|
+
this.id = id;
|
|
24
|
+
this.code = code;
|
|
25
|
+
}
|
|
26
|
+
static isEnum = true;
|
|
27
|
+
get isValid() {
|
|
28
|
+
return isDefined(this.id);
|
|
29
|
+
}
|
|
30
|
+
static all() {
|
|
31
|
+
return meta(this.allTuple()).values();
|
|
32
|
+
}
|
|
33
|
+
static filter(p, params) {
|
|
34
|
+
return this.all().filter(p, params);
|
|
35
|
+
}
|
|
36
|
+
static first(p, params) {
|
|
37
|
+
return this.all().first(p, params);
|
|
38
|
+
}
|
|
39
|
+
static byIds(ids = []) {
|
|
40
|
+
return toList(ids).mapDefined((id) => this.byId(id)).distinct();
|
|
41
|
+
}
|
|
42
|
+
static byId(id, alt) {
|
|
43
|
+
return this.allTuple()[id] ?? ofGet(alt);
|
|
44
|
+
}
|
|
45
|
+
static allTuple() {
|
|
46
|
+
return meta(this).get(`all-${this.name}`) ?? meta(this).set(`all-${this.name}`, meta(this).values().filter(isEnum).toObject("id"));
|
|
47
|
+
}
|
|
48
|
+
equals(other) {
|
|
49
|
+
return this.id === (isEnum(other) ? other.id : other);
|
|
50
|
+
}
|
|
51
|
+
isIn(...items) {
|
|
52
|
+
return items.some((i) => this.equals(i));
|
|
53
|
+
}
|
|
54
|
+
toJSON() {
|
|
55
|
+
return this.id;
|
|
56
|
+
}
|
|
57
|
+
toString() {
|
|
58
|
+
return this.id.toString();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var isEnum = (e) => isDefined(e) && e instanceof Enum && isAn(e, "name", "id", "code");
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
isEnumConstructor,
|
|
65
|
+
Enum,
|
|
66
|
+
isEnum
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=chunk-UXADDXCJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/Enum.ts"],"sourcesContent":["import { Id } from './Id';\nimport { List, toList } from './List';\nimport { isAn } from './IsA';\nimport { meta } from './Meta';\nimport { isDefined, isFunction } from './Is';\nimport { Validatable } from './Validatable';\nimport { JsonValue } from './Json';\nimport { Get, ofGet } from './Get';\nimport { TypeGuard } from './TypeGuard';\n\nexport type EnumConstructor<E = unknown> = {\n byIds<E extends Enum>(ids: Id[]): List<E>;\n byId<E extends Enum>(id: Id, alt?: Get<E, unknown>): E;\n isEnum: boolean;\n};\n\nexport const isEnumConstructor = <E = unknown>(c: unknown): c is EnumConstructor<E> => isFunction(c) && (c as any).isEnum;\n\nexport abstract class Enum implements Validatable {\n static isEnum = true;\n\n protected constructor(\n readonly name: string,\n readonly id: Id = name.toLowerCase(),\n readonly code: string = id.toString()\n ) {}\n\n get isValid(): boolean {\n return isDefined(this.id);\n }\n\n static all<E extends Enum>(): List<E> {\n return meta(this.allTuple<E>()).values<E>();\n }\n\n static filter<E extends Enum>(p: (value: E, index: number, array: E[]) => unknown, params?: unknown): List<E> {\n return this.all<E>().filter(p, params);\n }\n\n static first<E extends Enum>(p?: (value: E, index: number, array: E[]) => unknown, params?: unknown): E {\n return this.all<E>().first(p, params);\n }\n\n static byIds<E extends Enum>(ids: Id[] = []): List<E> {\n return toList(ids)\n .mapDefined(id => this.byId<E>(id))\n .distinct();\n }\n\n static byId<E extends Enum>(id: Id, alt?: Get<E, unknown>): E {\n return this.allTuple<E>()[id] ?? ofGet(alt);\n }\n\n protected static allTuple<E extends Enum>(): Record<Id, E> {\n return meta(this).get(`all-${this.name}`) ?? meta(this).set(`all-${this.name}`, meta(this).values<E>().filter(isEnum).toObject('id'));\n }\n\n equals<E extends Enum>(other: E | Id): other is E {\n return this.id === (isEnum(other) ? other.id : other);\n }\n\n isIn<E extends Enum>(...items: E[] | Id[]): boolean {\n return items.some(i => this.equals(i));\n }\n\n toJSON(): JsonValue {\n return this.id;\n }\n\n toString(): string {\n return this.id.toString();\n }\n}\n\nexport const isEnum: TypeGuard<Enum> = (e?: unknown): e is Enum => isDefined(e) && e instanceof Enum && isAn<Enum>(e, 'name', 'id', 'code');\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBO,IAAM,oBAAoB,CAAc,MAAwC,WAAW,CAAC,KAAM,EAAU;AAE5G,IAAe,OAAf,MAA2C;AAAA,EAGtC,YACC,MACA,KAAS,KAAK,YAAY,GAC1B,OAAe,GAAG,SAAS,GACpC;AAHS;AACA;AACA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AQ,MAAM,MAAM;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/http/Response.ts"],"sourcesContent":["import { HttpStatus } from './HttpStatus';\nimport type { RestResult } from './RestResult';\nimport { isA } from '../types/IsA';\nimport { TypeGuard } from '../types/TypeGuard';\n\nexport type Response = {\n status: HttpStatus;\n headers?: { [key: string]: any };\n body: RestResult;\n};\n\nexport const isResponse: TypeGuard<Response> = (r?: unknown): r is Response => isA<Response>(r, 'status', 'body');\n"],"mappings":";;;;;AAWO,IAAM,aAAkC,CAAC,MAA+B,IAAc,GAAG,UAAU,MAAM;","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Enum
|
|
3
|
+
} from "./chunk-UXADDXCJ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
isAn
|
|
6
|
+
} from "./chunk-ZHXKBOK2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/http/HttpStatus.ts
|
|
9
|
+
var HttpStatus = class _HttpStatus extends Enum {
|
|
10
|
+
static Continue = new _HttpStatus("Continue", 100);
|
|
11
|
+
static SwitchingProtocols = new _HttpStatus("Switching protocols", 101);
|
|
12
|
+
static Processing = new _HttpStatus("Processing", 102);
|
|
13
|
+
static EarlyHints = new _HttpStatus("Early hints", 103);
|
|
14
|
+
static Ok = new _HttpStatus("Ok", 200);
|
|
15
|
+
static Created = new _HttpStatus("Created", 201);
|
|
16
|
+
static Accepted = new _HttpStatus("Accepted", 202);
|
|
17
|
+
static NonAuthoritativeInformation = new _HttpStatus("Non-authoritative information", 203);
|
|
18
|
+
static NoContent = new _HttpStatus("No content", 204);
|
|
19
|
+
static ResetContent = new _HttpStatus("Reset content", 205);
|
|
20
|
+
static PartialContent = new _HttpStatus("Partial content", 206);
|
|
21
|
+
static MultiStatus = new _HttpStatus("Multi-status", 207);
|
|
22
|
+
static AlreadyReported = new _HttpStatus("Already reported", 208);
|
|
23
|
+
static ImUsed = new _HttpStatus("IM used", 226);
|
|
24
|
+
static MultipleChoices = new _HttpStatus("Multiple Choices", 300);
|
|
25
|
+
static MovedPermanently = new _HttpStatus("Moved Permanently", 301);
|
|
26
|
+
static Found = new _HttpStatus("Found", 302);
|
|
27
|
+
static SeeOther = new _HttpStatus("See other", 303);
|
|
28
|
+
static NotModified = new _HttpStatus("Not modified", 304);
|
|
29
|
+
static UseProxy = new _HttpStatus("Use proxy", 305);
|
|
30
|
+
static SwitchProxy = new _HttpStatus("Switch proxy", 306);
|
|
31
|
+
static TemporaryRedirect = new _HttpStatus("Temporary redirect", 307);
|
|
32
|
+
static PermanentRedirect = new _HttpStatus("Permanent redirect", 308);
|
|
33
|
+
static BadRequest = new _HttpStatus("Bad request", 400);
|
|
34
|
+
static NotAuthorized = new _HttpStatus("Not authorized", 401);
|
|
35
|
+
static PaymentRequired = new _HttpStatus("Payment required", 402);
|
|
36
|
+
static Forbidden = new _HttpStatus("Forbidden", 403);
|
|
37
|
+
static NotFound = new _HttpStatus("Not found", 404);
|
|
38
|
+
static MethodNotAllowed = new _HttpStatus("Method not allowed", 405);
|
|
39
|
+
static NotAcceptable = new _HttpStatus("Not acceptable", 406);
|
|
40
|
+
static ProxyAuthenticationRequired = new _HttpStatus("Proxy authentication required", 407);
|
|
41
|
+
static RequestTimeout = new _HttpStatus("Request timeout", 408);
|
|
42
|
+
static Conflict = new _HttpStatus("Conflict", 409);
|
|
43
|
+
static Gone = new _HttpStatus("Gone", 410);
|
|
44
|
+
static LengthRequired = new _HttpStatus("Length required", 411);
|
|
45
|
+
static PreconditionFailed = new _HttpStatus("Precondition failed", 412);
|
|
46
|
+
static PayloadTooLarge = new _HttpStatus("Payload too large", 413);
|
|
47
|
+
static UriTooLong = new _HttpStatus("URI too long", 414);
|
|
48
|
+
static UnsupportedMediaType = new _HttpStatus("Unsupported media type", 415);
|
|
49
|
+
static RangeNotSatisfiable = new _HttpStatus("Range not satisfiable", 416);
|
|
50
|
+
static ExpectationFailed = new _HttpStatus("Expectation failed", 417);
|
|
51
|
+
static ImATeapot = new _HttpStatus("I'm a teapot", 418);
|
|
52
|
+
static MisdirectedRequest = new _HttpStatus("Misdirected request", 421);
|
|
53
|
+
static UnprocessableEntity = new _HttpStatus("Unprocessable entity", 422);
|
|
54
|
+
static Locked = new _HttpStatus("Locked", 423);
|
|
55
|
+
static FailedDependency = new _HttpStatus("Failed dependency", 424);
|
|
56
|
+
static TooEarly = new _HttpStatus("Too early", 425);
|
|
57
|
+
static UpgradeRequired = new _HttpStatus("Upgrade required", 426);
|
|
58
|
+
static PreconditionRequired = new _HttpStatus("Precondition required", 428);
|
|
59
|
+
static TooManyRequests = new _HttpStatus("Too many requests", 429);
|
|
60
|
+
static RequestHeaderFieldsTooLarge = new _HttpStatus("Request header fields too large", 431);
|
|
61
|
+
static UnavailableForLegalReasons = new _HttpStatus("Unavailable for legal reasons", 451);
|
|
62
|
+
static InternalServerError = new _HttpStatus("Internal server error", 500);
|
|
63
|
+
static NotImplemented = new _HttpStatus("Not implemented", 501);
|
|
64
|
+
static BadGateway = new _HttpStatus("Bad gateway", 502);
|
|
65
|
+
static ServiceUnavailable = new _HttpStatus("Service unavailable", 503);
|
|
66
|
+
static GatewayTimeout = new _HttpStatus("Gateway timeout", 504);
|
|
67
|
+
static HTTPVersionNotSupported = new _HttpStatus("Http version not supported", 505);
|
|
68
|
+
static VariantAlsoNegotiates = new _HttpStatus("Variant also negotiates", 506);
|
|
69
|
+
static InsufficientStorage = new _HttpStatus("Insufficient storage", 507);
|
|
70
|
+
static LoopDetected = new _HttpStatus("Loop detected", 508);
|
|
71
|
+
static NotExtended = new _HttpStatus("Not extended", 510);
|
|
72
|
+
static NetworkAuthenticationRequired = new _HttpStatus("Network authentication required", 511);
|
|
73
|
+
get isError() {
|
|
74
|
+
return this.isClientError || this.isServerError;
|
|
75
|
+
}
|
|
76
|
+
get isClientError() {
|
|
77
|
+
return this.id >= 400 && this.id < 500;
|
|
78
|
+
}
|
|
79
|
+
get isServerError() {
|
|
80
|
+
return this.id >= 500 && this.id < 600;
|
|
81
|
+
}
|
|
82
|
+
get status() {
|
|
83
|
+
return this.id;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var isHttpStatus = (s) => isAn(s, "id", "status");
|
|
87
|
+
var toHttpStatus = (s) => isHttpStatus(s) ? s : HttpStatus.byId(s);
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
HttpStatus,
|
|
91
|
+
isHttpStatus,
|
|
92
|
+
toHttpStatus
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=chunk-VBZTERRM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/http/HttpStatus.ts"],"sourcesContent":["import { Enum } from '../types/Enum';\nimport { TypeGuard } from '../types/TypeGuard';\nimport { isAn } from '../types/IsA';\nimport { Code } from '../types/Id';\n\nexport class HttpStatus extends Enum {\n static Continue = new HttpStatus('Continue', 100);\n static SwitchingProtocols = new HttpStatus('Switching protocols', 101);\n static Processing = new HttpStatus('Processing', 102);\n static EarlyHints = new HttpStatus('Early hints', 103);\n static Ok = new HttpStatus('Ok', 200);\n static Created = new HttpStatus('Created', 201);\n static Accepted = new HttpStatus('Accepted', 202);\n static NonAuthoritativeInformation = new HttpStatus('Non-authoritative information', 203);\n static NoContent = new HttpStatus('No content', 204);\n static ResetContent = new HttpStatus('Reset content', 205);\n static PartialContent = new HttpStatus('Partial content', 206);\n static MultiStatus = new HttpStatus('Multi-status', 207);\n static AlreadyReported = new HttpStatus('Already reported', 208);\n static ImUsed = new HttpStatus('IM used', 226);\n static MultipleChoices = new HttpStatus('Multiple Choices', 300);\n static MovedPermanently = new HttpStatus('Moved Permanently', 301);\n static Found = new HttpStatus('Found', 302);\n static SeeOther = new HttpStatus('See other', 303);\n static NotModified = new HttpStatus('Not modified', 304);\n static UseProxy = new HttpStatus('Use proxy', 305);\n static SwitchProxy = new HttpStatus('Switch proxy', 306);\n static TemporaryRedirect = new HttpStatus('Temporary redirect', 307);\n static PermanentRedirect = new HttpStatus('Permanent redirect', 308);\n static BadRequest = new HttpStatus('Bad request', 400);\n static NotAuthorized = new HttpStatus('Not authorized', 401);\n static PaymentRequired = new HttpStatus('Payment required', 402);\n static Forbidden = new HttpStatus('Forbidden', 403);\n static NotFound = new HttpStatus('Not found', 404);\n static MethodNotAllowed = new HttpStatus('Method not allowed', 405);\n static NotAcceptable = new HttpStatus('Not acceptable', 406);\n static ProxyAuthenticationRequired = new HttpStatus('Proxy authentication required', 407);\n static RequestTimeout = new HttpStatus('Request timeout', 408);\n static Conflict = new HttpStatus('Conflict', 409);\n static Gone = new HttpStatus('Gone', 410);\n static LengthRequired = new HttpStatus('Length required', 411);\n static PreconditionFailed = new HttpStatus('Precondition failed', 412);\n static PayloadTooLarge = new HttpStatus('Payload too large', 413);\n static UriTooLong = new HttpStatus('URI too long', 414);\n static UnsupportedMediaType = new HttpStatus('Unsupported media type', 415);\n static RangeNotSatisfiable = new HttpStatus('Range not satisfiable', 416);\n static ExpectationFailed = new HttpStatus('Expectation failed', 417);\n static ImATeapot = new HttpStatus(\"I'm a teapot\", 418);\n static MisdirectedRequest = new HttpStatus('Misdirected request', 421);\n static UnprocessableEntity = new HttpStatus('Unprocessable entity', 422);\n static Locked = new HttpStatus('Locked', 423);\n static FailedDependency = new HttpStatus('Failed dependency', 424);\n static TooEarly = new HttpStatus('Too early', 425);\n static UpgradeRequired = new HttpStatus('Upgrade required', 426);\n static PreconditionRequired = new HttpStatus('Precondition required', 428);\n static TooManyRequests = new HttpStatus('Too many requests', 429);\n static RequestHeaderFieldsTooLarge = new HttpStatus('Request header fields too large', 431);\n static UnavailableForLegalReasons = new HttpStatus('Unavailable for legal reasons', 451);\n static InternalServerError = new HttpStatus('Internal server error', 500);\n static NotImplemented = new HttpStatus('Not implemented', 501);\n static BadGateway = new HttpStatus('Bad gateway', 502);\n static ServiceUnavailable = new HttpStatus('Service unavailable', 503);\n static GatewayTimeout = new HttpStatus('Gateway timeout', 504);\n static HTTPVersionNotSupported = new HttpStatus('Http version not supported', 505);\n static VariantAlsoNegotiates = new HttpStatus('Variant also negotiates', 506);\n static InsufficientStorage = new HttpStatus('Insufficient storage', 507);\n static LoopDetected = new HttpStatus('Loop detected', 508);\n static NotExtended = new HttpStatus('Not extended', 510);\n static NetworkAuthenticationRequired = new HttpStatus('Network authentication required', 511);\n\n get isError(): boolean {\n return this.isClientError || this.isServerError;\n }\n\n get isClientError(): boolean {\n return (this.id as number) >= 400 && (this.id as number) < 500;\n }\n\n get isServerError(): boolean {\n return (this.id as number) >= 500 && (this.id as number) < 600;\n }\n\n get status(): number {\n return this.id as number;\n }\n}\n\nexport const isHttpStatus: TypeGuard<HttpStatus> = (s?: unknown): s is HttpStatus => isAn<HttpStatus>(s, 'id', 'status');\n\nexport const toHttpStatus = (s: HttpStatus | Code): HttpStatus => (isHttpStatus(s) ? s : HttpStatus.byId(s));\n"],"mappings":";;;;;;;;AAKO,IAAM,aAAN,MAAM,oBAAmB,KAAK;AAAA,EACnC,OAAO,WAAW,IAAI,YAAW,YAAY,GAAG;AAAA,EAChD,OAAO,qBAAqB,IAAI,YAAW,uBAAuB,GAAG;AAAA,EACrE,OAAO,aAAa,IAAI,YAAW,cAAc,GAAG;AAAA,EACpD,OAAO,aAAa,IAAI,YAAW,eAAe,GAAG;AAAA,EACrD,OAAO,KAAK,IAAI,YAAW,MAAM,GAAG;AAAA,EACpC,OAAO,UAAU,IAAI,YAAW,WAAW,GAAG;AAAA,EAC9C,OAAO,WAAW,IAAI,YAAW,YAAY,GAAG;AAAA,EAChD,OAAO,8BAA8B,IAAI,YAAW,iCAAiC,GAAG;AAAA,EACxF,OAAO,YAAY,IAAI,YAAW,cAAc,GAAG;AAAA,EACnD,OAAO,eAAe,IAAI,YAAW,iBAAiB,GAAG;AAAA,EACzD,OAAO,iBAAiB,IAAI,YAAW,mBAAmB,GAAG;AAAA,EAC7D,OAAO,cAAc,IAAI,YAAW,gBAAgB,GAAG;AAAA,EACv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,YAAW,wBAAwB,GAAG;AAAA,EACvE,OAAO,eAAe,IAAI,YAAW,iBAAiB,GAAG;AAAA,EACzD,OAAO,cAAc,IAAI,YAAW,gBAAgB,GAAG;AAAA,EACvD,OAAO,gCAAgC,IAAI,YAAW,mCAAmC,GAAG;AAAA,EAE5F,IAAI,UAAmB;AACrB,WAAO,KAAK,iBAAiB,KAAK;AAAA,EACpC;AAAA,EAEA,IAAI,gBAAyB;AAC3B,WAAQ,KAAK,MAAiB,OAAQ,KAAK,KAAgB;AAAA,EAC7D;AAAA,EAEA,IAAI,gBAAyB;AAC3B,WAAQ,KAAK,MAAiB,OAAQ,KAAK,KAAgB;AAAA,EAC7D;AAAA,EAEA,IAAI,SAAiB;AACnB,WAAO,KAAK;AAAA,EACd;AACF;AAEO,IAAM,eAAsC,CAAC,MAAiC,KAAiB,GAAG,MAAM,QAAQ;AAEhH,IAAM,eAAe,CAAC,MAAsC,aAAa,CAAC,IAAI,IAAI,WAAW,KAAK,CAAC;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ofConstruct
|
|
3
|
+
} from "./chunk-ZPNFXK7Y.mjs";
|
|
4
|
+
|
|
5
|
+
// src/utils/State.ts
|
|
6
|
+
var State = class {
|
|
7
|
+
constructor(state = {}) {
|
|
8
|
+
this.state = state;
|
|
9
|
+
}
|
|
10
|
+
get = (key, alt) => this.state[key] ?? (this.state[key] = ofConstruct(alt));
|
|
11
|
+
set = (key, value) => this.get(key, value);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
State
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-WJZFE5NE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/State.ts"],"sourcesContent":["import { Construct, ofConstruct } from '../types/Constructor';\n\nexport class State {\n constructor(protected readonly state: any = {}) {}\n\n protected get = <T>(key: string, alt?: Construct<T>): T => this.state[key] ?? (this.state[key] = ofConstruct(alt));\n protected set = <T>(key: string, value: Construct<T>): T => this.get(key, value);\n}\n"],"mappings":";;;;;AAEO,IAAM,QAAN,MAAY;AAAA,EACjB,YAA+B,QAAa,CAAC,GAAG;AAAjB;AAAA,EAAkB;AAAA,EAEvC,MAAM,CAAI,KAAa,QAA0B,KAAK,MAAM,GAAG,MAAM,KAAK,MAAM,GAAG,IAAI,YAAY,GAAG;AAAA,EACtG,MAAM,CAAI,KAAa,UAA2B,KAAK,IAAI,KAAK,KAAK;AACjF;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toList
|
|
3
|
+
} from "./chunk-HOVTNDHS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/sql/SqlQuery.ts
|
|
6
|
+
var SqlQuery = class {
|
|
7
|
+
constructor(table, clauses = toList()) {
|
|
8
|
+
this.table = table;
|
|
9
|
+
this.clauses = clauses;
|
|
10
|
+
}
|
|
11
|
+
where = (...clauses) => {
|
|
12
|
+
this.clauses.add(clauses);
|
|
13
|
+
return this;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
SqlQuery
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk-WLTLSV2I.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sql/SqlQuery.ts"],"sourcesContent":["import { Query } from '../data/Query';\nimport { Table } from './Table';\nimport { Join } from './Join';\nimport { List, toList } from '../types/List';\nimport { Clause } from './Clause';\n\nexport class SqlQuery implements Query {\n constructor(\n protected table: Table | Join,\n readonly clauses: List<Clause> = toList()\n ) {}\n\n where = (...clauses: Clause[]): this => {\n this.clauses.add(clauses);\n return this;\n };\n}\n"],"mappings":";;;;;AAMO,IAAM,WAAN,MAAgC;AAAA,EACrC,YACY,OACD,UAAwB,OAAO,GACxC;AAFU;AACD;AAAA,EACR;AAAA,EAEH,QAAQ,IAAI,YAA4B;AACtC,SAAK,QAAQ,IAAI,OAAO;AACxB,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ApiGateway
|
|
3
|
+
} from "./chunk-L5KXXMUH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Api
|
|
6
|
+
} from "./chunk-GZIULZH2.mjs";
|
|
7
|
+
import {
|
|
8
|
+
HttpStatus
|
|
9
|
+
} from "./chunk-VBZTERRM.mjs";
|
|
10
|
+
import {
|
|
11
|
+
toArray
|
|
12
|
+
} from "./chunk-CO2AFYVD.mjs";
|
|
13
|
+
import {
|
|
14
|
+
isDefined
|
|
15
|
+
} from "./chunk-DEJ7A5PY.mjs";
|
|
16
|
+
|
|
17
|
+
// src/services/RouteGateway.ts
|
|
18
|
+
var RouteGateway = class extends ApiGateway {
|
|
19
|
+
constructor(route, routeId, api = new Api()) {
|
|
20
|
+
super(api);
|
|
21
|
+
this.route = route;
|
|
22
|
+
this.routeId = routeId;
|
|
23
|
+
this.api = api;
|
|
24
|
+
}
|
|
25
|
+
all(options) {
|
|
26
|
+
return this.get(this.route().expand(options ?? {}), options);
|
|
27
|
+
}
|
|
28
|
+
byId(id) {
|
|
29
|
+
return this.getOne(this.routeId().id(id));
|
|
30
|
+
}
|
|
31
|
+
byIds(...ids) {
|
|
32
|
+
return this.get(this.route().ids(toArray(...ids)));
|
|
33
|
+
}
|
|
34
|
+
search(q, options) {
|
|
35
|
+
return this.get(this.route().expand({ ...options, q }));
|
|
36
|
+
}
|
|
37
|
+
exists(id) {
|
|
38
|
+
return this.byId(id).then((r) => isDefined(r)).catch((r) => HttpStatus.NotFound.equals(r.status) ? false : Promise.reject(r));
|
|
39
|
+
}
|
|
40
|
+
add(item) {
|
|
41
|
+
return this.post(this.route(), item);
|
|
42
|
+
}
|
|
43
|
+
filter(options) {
|
|
44
|
+
return this.postSearch(this.route().expand(options ?? {}));
|
|
45
|
+
}
|
|
46
|
+
update(item) {
|
|
47
|
+
return this.patch(this.routeId().id(item.id), item);
|
|
48
|
+
}
|
|
49
|
+
upsert(item) {
|
|
50
|
+
return this.put(this.routeId().id(item.id), item);
|
|
51
|
+
}
|
|
52
|
+
remove(id) {
|
|
53
|
+
return this.delete(this.routeId().id(id));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
RouteGateway
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=chunk-WOSYMEQL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/RouteGateway.ts"],"sourcesContent":["import { Api } from './Api';\nimport { ApiGateway } from './ApiGateway';\nimport { Func } from '../types/Func';\nimport { Uri, UriExpandProps } from '../types/Uri';\nimport { PageList } from '../types/PageList';\nimport { Json, JsonValue } from '../types/Json';\nimport { Id } from '../types/Id';\nimport { Optional } from '../types/Types';\nimport { List } from '../types/List';\nimport { toArray } from '../types/Array';\nimport { HttpStatus } from '../http/HttpStatus';\nimport { isDefined } from '../types/Is';\n\nexport class RouteGateway<Props extends UriExpandProps = UriExpandProps> extends ApiGateway {\n constructor(\n readonly route: Func<Uri<Props>>,\n readonly routeId: Func<Uri<Props>>,\n readonly api: Api = new Api()\n ) {\n super(api);\n }\n\n all(options?: Props): Promise<PageList<Json>> {\n return this.get(this.route().expand(options ?? {}) as Uri, options);\n }\n\n byId(id: Id): Promise<Optional<Json>> {\n return this.getOne(this.routeId().id(id) as Uri);\n }\n\n byIds(...ids: Id[]): Promise<List<Json>> {\n return this.get(this.route().ids(toArray(...ids)) as Uri);\n }\n\n search(q: JsonValue, options?: Props): Promise<PageList<Json>> {\n return this.get(this.route().expand({ ...options, q } as Props) as Uri);\n }\n\n exists(id: Id): Promise<boolean> {\n return this.byId(id)\n .then(r => isDefined(r))\n .catch(r => (HttpStatus.NotFound.equals(r.status) ? false : Promise.reject(r)));\n }\n\n add(item: Json): Promise<Json> {\n return this.post(this.route() as Uri, item);\n }\n\n filter(options?: Props): Promise<PageList<Json>> {\n return this.postSearch(this.route().expand(options ?? {}) as Uri);\n }\n\n update(item: Json): Promise<Json> {\n return this.patch(this.routeId().id(item.id) as Uri, item);\n }\n\n upsert(item: Json): Promise<Json> {\n return this.put(this.routeId().id(item.id) as Uri, item);\n }\n\n remove(id: Id): Promise<boolean> {\n return this.delete(this.routeId().id(id) as Uri);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAaO,IAAM,eAAN,cAA0E,WAAW;AAAA,EAC1F,YACW,OACA,SACA,MAAW,IAAI,IAAI,GAC5B;AACA,UAAM,GAAG;AAJA;AACA;AACA;AAAA,EAGX;AAAA,EAEA,IAAI,SAA0C;AAC5C,WAAO,KAAK,IAAI,KAAK,MAAM,EAAE,OAAO,WAAW,CAAC,CAAC,GAAU,OAAO;AAAA,EACpE;AAAA,EAEA,KAAK,IAAiC;AACpC,WAAO,KAAK,OAAO,KAAK,QAAQ,EAAE,GAAG,EAAE,CAAQ;AAAA,EACjD;AAAA,EAEA,SAAS,KAAgC;AACvC,WAAO,KAAK,IAAI,KAAK,MAAM,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,CAAQ;AAAA,EAC1D;AAAA,EAEA,OAAO,GAAc,SAA0C;AAC7D,WAAO,KAAK,IAAI,KAAK,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAU,CAAQ;AAAA,EACxE;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,KAAK,KAAK,EAAE,EAChB,KAAK,OAAK,UAAU,CAAC,CAAC,EACtB,MAAM,OAAM,WAAW,SAAS,OAAO,EAAE,MAAM,IAAI,QAAQ,QAAQ,OAAO,CAAC,CAAE;AAAA,EAClF;AAAA,EAEA,IAAI,MAA2B;AAC7B,WAAO,KAAK,KAAK,KAAK,MAAM,GAAU,IAAI;AAAA,EAC5C;AAAA,EAEA,OAAO,SAA0C;AAC/C,WAAO,KAAK,WAAW,KAAK,MAAM,EAAE,OAAO,WAAW,CAAC,CAAC,CAAQ;AAAA,EAClE;AAAA,EAEA,OAAO,MAA2B;AAChC,WAAO,KAAK,MAAM,KAAK,QAAQ,EAAE,GAAG,KAAK,EAAE,GAAU,IAAI;AAAA,EAC3D;AAAA,EAEA,OAAO,MAA2B;AAChC,WAAO,KAAK,IAAI,KAAK,QAAQ,EAAE,GAAG,KAAK,EAAE,GAAU,IAAI;AAAA,EACzD;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,KAAK,OAAO,KAAK,QAAQ,EAAE,GAAG,EAAE,CAAQ;AAAA,EACjD;AACF;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
asString
|
|
3
|
+
} from "./chunk-BDA5LB4S.mjs";
|
|
4
|
+
import {
|
|
5
|
+
isDefined
|
|
6
|
+
} from "./chunk-DEJ7A5PY.mjs";
|
|
7
|
+
|
|
8
|
+
// src/types/Value.ts
|
|
9
|
+
var Value = class {
|
|
10
|
+
constructor(value) {
|
|
11
|
+
this.value = value;
|
|
12
|
+
this.value = value;
|
|
13
|
+
}
|
|
14
|
+
get isValid() {
|
|
15
|
+
return isDefined(this.value);
|
|
16
|
+
}
|
|
17
|
+
toJSON() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
return asString(this.value);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var isValue = (v) => v instanceof Value;
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
Value,
|
|
28
|
+
isValue
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-WSBULPUZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/Value.ts"],"sourcesContent":["import { Validatable } from './Validatable';\nimport { isDefined } from './Is';\nimport { JsonValue } from './Json';\nimport { asString } from './Text';\n\nexport class Value<V = string> implements Validatable {\n constructor(readonly value: V) {\n this.value = value;\n }\n\n get isValid(): boolean {\n return isDefined(this.value);\n }\n\n toJSON(): JsonValue {\n return this.value as unknown as JsonValue;\n }\n\n toString(): string {\n return asString(this.value);\n }\n}\n\nexport const isValue = (v?: unknown): v is Value => v instanceof Value;\n"],"mappings":";;;;;;;;AAKO,IAAM,QAAN,MAA+C;AAAA,EACpD,YAAqB,OAAU;AAAV;AACnB,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,IAAI,UAAmB;AACrB,WAAO,UAAU,KAAK,KAAK;AAAA,EAC7B;AAAA,EAEA,SAAoB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,WAAmB;AACjB,WAAO,SAAS,KAAK,KAAK;AAAA,EAC5B;AACF;AAEO,IAAM,UAAU,CAAC,MAA4B,aAAa;","names":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toResponse
|
|
3
|
+
} from "./chunk-DLA22ZCC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
isRestResult
|
|
6
|
+
} from "./chunk-4DJUHTQO.mjs";
|
|
7
|
+
import {
|
|
8
|
+
HttpStatus
|
|
9
|
+
} from "./chunk-VBZTERRM.mjs";
|
|
10
|
+
import {
|
|
11
|
+
RequestOptions
|
|
12
|
+
} from "./chunk-L5ZI7SPN.mjs";
|
|
13
|
+
import {
|
|
14
|
+
cacheAge
|
|
15
|
+
} from "./chunk-OWLQ6U7M.mjs";
|
|
16
|
+
import {
|
|
17
|
+
choose
|
|
18
|
+
} from "./chunk-LGLRWA42.mjs";
|
|
19
|
+
import {
|
|
20
|
+
toResult
|
|
21
|
+
} from "./chunk-RS7CT7BU.mjs";
|
|
22
|
+
import {
|
|
23
|
+
ctx
|
|
24
|
+
} from "./chunk-PR6DFFCE.mjs";
|
|
25
|
+
import {
|
|
26
|
+
isDefined,
|
|
27
|
+
isEmpty
|
|
28
|
+
} from "./chunk-DEJ7A5PY.mjs";
|
|
29
|
+
|
|
30
|
+
// src/services/AxiosProvider.ts
|
|
31
|
+
import axios from "axios";
|
|
32
|
+
var isResponse = (a) => isDefined(a?.response);
|
|
33
|
+
var isRequest = (a) => isDefined(a?.request);
|
|
34
|
+
var asResponse = (uri, verb, error) => choose(error).type(
|
|
35
|
+
isResponse,
|
|
36
|
+
(r) => toResponse(r.response.status, isRestResult(r.response.data) ? r.response.data : toResult(r.response.statusText, uri.path, uri), r.response.headers)
|
|
37
|
+
).type(isRequest, (r) => toResponse(r.request.status, toResult(r.request.message, uri.path, uri))).else((e) => toResponse(HttpStatus.InternalServerError, toResult(e.message, uri.path, uri)));
|
|
38
|
+
var AxiosProvider = class {
|
|
39
|
+
constructor(ai = axios) {
|
|
40
|
+
this.ai = ai;
|
|
41
|
+
}
|
|
42
|
+
execute = ({ uri, verb, body, transform = (r) => r, transformError = (r) => r, options = RequestOptions.Json }) => this.ai.request({
|
|
43
|
+
url: uri.toString(),
|
|
44
|
+
method: verb.toString(),
|
|
45
|
+
headers: uri.isInternal && isEmpty(options.headers.Authorization) ? options.bearer(ctx.request.jwt).headers : options.headers,
|
|
46
|
+
data: options.type.encode(body),
|
|
47
|
+
maxRedirects: options.requestOptions.maxRedirects,
|
|
48
|
+
...options.requestOptions.timeout && { timeout: cacheAge.toMilliseconds(options?.requestOptions.timeout) },
|
|
49
|
+
...options.requestOptions.validateStatus && { validateStatus: options.requestOptions.validateStatus }
|
|
50
|
+
}).then((r) => toResponse(r.status, transform(r.data), r.headers)).catch((e) => Promise.reject(asResponse(uri, verb, transformError(e))));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
AxiosProvider
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=chunk-WVTNXVBL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/AxiosProvider.ts"],"sourcesContent":["import axios, { AxiosError, AxiosInstance, AxiosResponse, Method } from 'axios';\nimport { toResponse } from '../http/toResponse';\nimport { isDefined, isEmpty } from '../types/Is';\nimport { Uri } from '../types/Uri';\nimport { HttpVerb } from '../http/HttpVerb';\nimport { choose } from '../types/Case';\nimport { isRestResult } from '../http/RestResult';\nimport { toResult } from '../types/Result';\nimport { HttpStatus } from '../http/HttpStatus';\nimport { RequestProvider } from '../http/RequestProvider';\nimport { RequestOptions } from '../http/RequestOptions';\nimport { ctx } from '../types/Context';\nimport { cacheAge } from '../types/CacheAge';\nimport { Response } from '../http/Response';\nimport { Request } from '../http/Request';\n\nconst isResponse = (a: unknown): a is { response: AxiosResponse } => isDefined((a as any)?.response);\nconst isRequest = (a: unknown): a is { request: any } => isDefined((a as any)?.request);\n\nconst asResponse = (uri: Uri, verb: HttpVerb, error: AxiosError): Response =>\n choose(error)\n .type(isResponse, r =>\n toResponse(r.response.status, isRestResult(r.response.data) ? r.response.data : toResult(r.response.statusText, uri.path, uri), r.response.headers)\n )\n .type(isRequest, r => toResponse(r.request.status, toResult(r.request.message, uri.path, uri)))\n .else(e => toResponse(HttpStatus.InternalServerError, toResult(e.message, uri.path, uri)));\n\nexport class AxiosProvider implements RequestProvider {\n constructor(readonly ai: AxiosInstance = axios) {}\n\n execute = ({ uri, verb, body, transform = (r: any) => r, transformError = (r: any) => r, options = RequestOptions.Json }: Request): Promise<Response> =>\n this.ai\n .request({\n url: uri.toString(),\n method: verb.toString() as Method,\n headers: uri.isInternal && isEmpty(options.headers.Authorization) ? options.bearer(ctx.request.jwt).headers : options.headers,\n data: options.type.encode(body),\n maxRedirects: options.requestOptions.maxRedirects,\n ...(options.requestOptions.timeout && { timeout: cacheAge.toMilliseconds(options?.requestOptions.timeout) }),\n ...(options.requestOptions.validateStatus && { validateStatus: options.requestOptions.validateStatus }),\n })\n .then(r => toResponse(r.status, transform(r.data), r.headers))\n .catch(e => Promise.reject(asResponse(uri, verb, transformError(e))));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAiE;AAgBxE,IAAM,aAAa,CAAC,MAAiD,UAAW,GAAW,QAAQ;AAC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Q,OAAO,WAAW,KAAK,MAAM,eAAe,CAAC,CAAC,CAAC,CAAC;AAC1E;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
use
|
|
3
|
+
} from "./chunk-ZPNFXK7Y.mjs";
|
|
4
|
+
import {
|
|
5
|
+
isPrimitive
|
|
6
|
+
} from "./chunk-DXQSIBC7.mjs";
|
|
7
|
+
import {
|
|
8
|
+
isDefined,
|
|
9
|
+
isObject
|
|
10
|
+
} from "./chunk-DEJ7A5PY.mjs";
|
|
11
|
+
|
|
12
|
+
// src/types/IsA.ts
|
|
13
|
+
var isA = (t, ...properties) => !isPrimitive(t) && properties.every((p) => p.toString() in t);
|
|
14
|
+
var isAn = isA;
|
|
15
|
+
var isIdentity = (by) => use(by, (b) => isObject(b) && isDefined(b.id));
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
isA,
|
|
19
|
+
isAn,
|
|
20
|
+
isIdentity
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-ZHXKBOK2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/IsA.ts"],"sourcesContent":["import { isPrimitive } from './Primitive';\nimport { Identity } from './Identity';\nimport { use } from './Constructor';\nimport { isDefined, isObject } from './Is';\n\nexport const isA = <T>(t?: unknown, ...properties: (keyof T)[]): t is T => !isPrimitive(t) && properties.every(p => p.toString() in (t as any));\nexport const isAn = isA;\nexport const isIdentity = (by: unknown): by is Identity => use(by as Identity, b => isObject(b) && isDefined(b.id));\n"],"mappings":";;;;;;;;;;;;AAKO,IAAM,MAAM,CAAI,MAAgB,eAAoC,CAAC,YAAY,CAAC,KAAK,WAAW,MAAM,OAAK,EAAE,SAAS,KAAM,CAAS;AACvI,IAAM,OAAO;AACb,IAAM,aAAa,CAAC,OAAgC,IAAI,IAAgB,OAAK,SAAS,CAAC,KAAK,UAAU,EAAE,EAAE,CAAC;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isPrimitive
|
|
3
|
+
} from "./chunk-DXQSIBC7.mjs";
|
|
4
|
+
import {
|
|
5
|
+
isFunc
|
|
6
|
+
} from "./chunk-PIRWVOO2.mjs";
|
|
7
|
+
import {
|
|
8
|
+
isDefined,
|
|
9
|
+
isFunction
|
|
10
|
+
} from "./chunk-DEJ7A5PY.mjs";
|
|
11
|
+
|
|
12
|
+
// src/types/Constructor.ts
|
|
13
|
+
var isConstructor = (c) => (isDefined(c) && isFunc(c) && c.prototype && c.prototype.constructor) === c;
|
|
14
|
+
var isInstance = (ctor, o) => isFunction(ctor) && o instanceof ctor;
|
|
15
|
+
var ofConstruct = (c, ...args) => isConstructor(c) ? new c(...args) : isFunc(c) ? c(...args) : c;
|
|
16
|
+
var toName = (subject, postfix = "") => subject?.constructor?.name?.replace(postfix, "").toLowerCase() ?? "";
|
|
17
|
+
var isPromise = (value) => {
|
|
18
|
+
return value instanceof Promise;
|
|
19
|
+
};
|
|
20
|
+
var on = (t, f) => {
|
|
21
|
+
const result = f(t);
|
|
22
|
+
return isPromise(result) ? result.then(() => t) : t;
|
|
23
|
+
};
|
|
24
|
+
var use = (t, f) => f(t);
|
|
25
|
+
var ifA = (c, t, alt) => !isPrimitive(t) && t instanceof c ? t : alt ? ifA(c, alt) : void 0;
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
isConstructor,
|
|
29
|
+
isInstance,
|
|
30
|
+
ofConstruct,
|
|
31
|
+
toName,
|
|
32
|
+
on,
|
|
33
|
+
use,
|
|
34
|
+
ifA
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=chunk-ZPNFXK7Y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/Constructor.ts"],"sourcesContent":["import { Get } from './Get';\nimport { isFunc } from './Func';\nimport { isDefined, isFunction } from './Is';\nimport { isPrimitive } from './Primitive';\nimport { Optional } from './Types';\n\nexport type Constructor<T = unknown> = { new (...args: any[]): T };\n\nexport type Construct<Out, In = any> = Get<Out, In> | Constructor<Out>;\n\nexport const isConstructor = <T>(c?: unknown): c is Constructor<T> => (isDefined(c) && isFunc<T, unknown>(c) && c.prototype && c.prototype.constructor) === c;\n\nexport const isInstance = <T>(ctor: Constructor<T>, o?: unknown): o is T => isFunction(ctor) && o instanceof ctor;\n\nexport const ofConstruct = <T>(c: Construct<T>, ...args: unknown[]): T => (isConstructor<T>(c) ? new c(...args) : isFunc<T, unknown>(c) ? c(...args) : c);\n\nexport const toName = (subject?: unknown, postfix = ''): string => (subject as any)?.constructor?.name?.replace(postfix, '').toLowerCase() ?? '';\n\nconst isPromise = <T>(value: unknown): value is Promise<T> => {\n return value instanceof Promise;\n};\n\nexport const on = <T, R>(t: T, f: (t: T) => R): R extends Promise<unknown> ? Promise<T> : T => {\n const result = f(t);\n return (isPromise(result) ? result.then(() => t) : t) as R extends Promise<unknown> ? Promise<T> : T;\n};\n\nexport const use = <T, Out>(t: T, f: (t: T) => Out): Out => f(t);\n\nexport const ifA = <T>(c: Constructor<T>, t?: unknown, alt?: unknown): Optional<T> => (!isPrimitive(t) && t instanceof c ? t : alt ? ifA(c, alt) : undefined);\n\nexport type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> &\n {\n [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n }[Keys];\n"],"mappings":";;;;;;;;;;;;AAUO,IAAM,gBAAgB,CAAI,OAAsC,UAAU,CAAC,KAAK,OAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,iBAAiB;AAErJ,IAAM,aAAa,CAAI,MAAsB,MAAwB,WAAW,IAAI,KAAK,aAAa;AAEtG,IAAM,cAAc,CAAI,MAAoB,SAAwB,cAAiB,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,IAAI,OAAmB,CAAC,IAAI,EAAE,GAAG,IAAI,IAAI;AAEhJ,IAAM,SAAS,CAAC,SAAmB,UAAU,OAAgB,SAAiB,aAAa,MAAM,QAAQ,SAAS,EAAE,EAAE,YAAY,KAAK;AAE9I,IAAM,YAAY,CAAI,UAAwC;AAC5D,SAAO,iBAAiB;AAC1B;AAEO,IAAM,KAAK,CAAO,GAAM,MAAgE;AAC7F,QAAM,SAAS,EAAE,CAAC;AAClB,SAAQ,UAAU,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC,IAAI;AACrD;AAEO,IAAM,MAAM,CAAS,GAAM,MAA0B,EAAE,CAAC;AAExD,IAAM,MAAM,CAAI,GAAmB,GAAa,QAAgC,CAAC,YAAY,CAAC,KAAK,aAAa,IAAI,IAAI,MAAM,IAAI,GAAG,GAAG,IAAI;","names":[]}
|