@thisisagile/easy 16.0.0 → 17.0.1
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-UNHWYQ54.mjs → chunk-27YL5N6O.mjs} +4 -4
- package/dist/{chunk-QQRGOHU6.mjs → chunk-2BGTVGU4.mjs} +2 -2
- package/dist/{chunk-X7FZPY3P.mjs → chunk-2KBPI5HD.mjs} +2 -2
- package/dist/{chunk-M47EOYDK.mjs → chunk-2S656HDG.mjs} +4 -4
- package/dist/{chunk-APYISY5K.mjs → chunk-2YNBXKAS.mjs} +2 -2
- package/dist/{chunk-45GNHDKA.mjs → chunk-3G2I3M46.mjs} +4 -4
- package/dist/{chunk-6VLC4Z4H.mjs → chunk-3PG7XJVW.mjs} +2 -2
- package/dist/{chunk-7TJ4VCBE.mjs → chunk-3RXN7Y6B.mjs} +6 -6
- package/dist/{chunk-3L4RAR24.mjs → chunk-4IGBNRNB.mjs} +5 -5
- package/dist/{chunk-D4K4MC24.mjs → chunk-7GL3D7F7.mjs} +3 -3
- package/dist/{chunk-IAXKOENJ.mjs → chunk-A7PAVXBM.mjs} +4 -4
- package/dist/{chunk-KRLEHX37.mjs → chunk-ANOORQCM.mjs} +5 -5
- package/dist/{chunk-NYYHRFBW.mjs → chunk-AQT7Z43R.mjs} +4 -4
- package/dist/{chunk-JFU65NZU.mjs → chunk-C4ZJZWD5.mjs} +7 -7
- package/dist/{chunk-U53FLD4J.mjs → chunk-CGMASUXA.mjs} +3 -3
- package/dist/{chunk-UKHDSTTZ.mjs → chunk-CMHJOQBL.mjs} +5 -5
- package/dist/{chunk-TMZRZLA2.mjs → chunk-CYTFXBYW.mjs} +3 -3
- package/dist/{chunk-J7XKOXMW.mjs → chunk-EGVFHL23.mjs} +6 -6
- package/dist/{chunk-A62OK7XE.mjs → chunk-F7C6VY2D.mjs} +5 -5
- package/dist/{chunk-HBJMCX2I.mjs → chunk-FCGLOMI7.mjs} +3 -3
- package/dist/{chunk-ARTSACXM.mjs → chunk-FRG4TDTG.mjs} +9 -9
- package/dist/{chunk-ZHXKBOK2.mjs → chunk-G4GZG77M.mjs} +2 -2
- package/dist/{chunk-EDVJUOFU.mjs → chunk-HETCTNQ6.mjs} +13 -13
- package/dist/{chunk-JBJ2YERG.mjs → chunk-IFDDZTWN.mjs} +3 -3
- package/dist/{chunk-ZPNFXK7Y.mjs → chunk-IK4EPPOF.mjs} +4 -4
- package/dist/{chunk-6YVMQB26.mjs → chunk-JADWPU3M.mjs} +2 -2
- package/dist/{chunk-LYAPQ4QZ.mjs → chunk-JKZEVKE3.mjs} +4 -4
- package/dist/{chunk-JSON7A4X.mjs → chunk-JOI26DEU.mjs} +2 -2
- package/dist/{chunk-UJEQAXZI.mjs → chunk-JPHN3NM3.mjs} +3 -3
- package/dist/{chunk-JTGB3TSZ.mjs → chunk-JV37KGKL.mjs} +3 -3
- package/dist/{chunk-HV4CI2QX.mjs → chunk-JX7EOMTI.mjs} +9 -9
- package/dist/{chunk-HNVAFEZP.mjs → chunk-K2IES6IY.mjs} +2 -2
- package/dist/{chunk-D5FLGKVR.mjs → chunk-K53K3QPT.mjs} +11 -11
- package/dist/{chunk-ARZEQQW5.mjs → chunk-KCOJAMHS.mjs} +16 -16
- package/dist/{chunk-Q5HABVOK.mjs → chunk-KRVOV2PR.mjs} +3 -3
- package/dist/{chunk-73UD7JJL.mjs → chunk-LCNUK6EI.mjs} +2 -2
- package/dist/{chunk-UW6S2PNO.mjs → chunk-LGXHFCSE.mjs} +5 -5
- package/dist/{chunk-UYDZZAEK.mjs → chunk-LHD6A2CA.mjs} +2 -2
- package/dist/{chunk-QTPKH4PY.mjs → chunk-MPFUPK2O.mjs} +5 -5
- package/dist/{chunk-WJZFE5NE.mjs → chunk-MYZQELEU.mjs} +2 -2
- package/dist/{chunk-LAR7AT6R.mjs → chunk-MZ74H2HU.mjs} +2 -2
- package/dist/{chunk-7K4QMDUN.mjs → chunk-OHHQ5YCI.mjs} +2 -2
- package/dist/{chunk-VV534JNS.mjs → chunk-OKVYYWDS.mjs} +3 -3
- package/dist/{chunk-CAHTK3AT.mjs → chunk-PB7ZHNR6.mjs} +2 -2
- package/dist/{chunk-FHW5K2RR.mjs → chunk-POMUVSEW.mjs} +5 -5
- package/dist/{chunk-2ZUDYGPP.mjs → chunk-PUUAMXGK.mjs} +5 -5
- package/dist/{chunk-USGZFNWP.mjs → chunk-QGLPCM3U.mjs} +3 -3
- package/dist/{chunk-4DJNTF2D.mjs → chunk-QQ62TFVN.mjs} +3 -3
- package/dist/{chunk-J6KN572O.mjs → chunk-RNM4YSY2.mjs} +3 -3
- package/dist/{chunk-YSBACFUR.mjs → chunk-SKP7IQKF.mjs} +5 -5
- package/dist/{chunk-RNROH3VJ.mjs → chunk-SWKY2KOQ.mjs} +3 -3
- package/dist/{chunk-4G6AW6D6.mjs → chunk-T5K5ZLP2.mjs} +3 -3
- package/dist/{chunk-OFGI5FLG.mjs → chunk-UARTMYBD.mjs} +2 -2
- package/dist/{chunk-6BQEFLOS.mjs → chunk-V35WKNIG.mjs} +3 -3
- package/dist/{chunk-PPWHEIZW.mjs → chunk-WWJDP64S.mjs} +4 -4
- package/dist/{chunk-5WSP2IYF.mjs → chunk-XJAVMPHW.mjs} +6 -6
- package/dist/{chunk-A2JYVEBB.mjs → chunk-XSK44RYX.mjs} +4 -4
- package/dist/data/Condition.mjs +11 -11
- package/dist/data/Database.mjs +11 -11
- package/dist/data/Field.mjs +12 -12
- package/dist/data/InMemoryGateway.mjs +21 -21
- package/dist/domain/Audit.mjs +24 -24
- package/dist/domain/Child.mjs +22 -22
- package/dist/domain/DateTime.mjs +20 -20
- package/dist/domain/Entity.mjs +26 -26
- package/dist/domain/Repo.mjs +21 -21
- package/dist/domain/Struct.mjs +21 -21
- package/dist/domain/Typo.mjs +20 -20
- package/dist/http/CacheControl.mjs +58 -23
- package/dist/http/CacheControl.mjs.map +1 -1
- package/dist/http/ContentType.mjs +11 -11
- package/dist/http/HttpStatus.mjs +11 -11
- package/dist/http/HttpVerb.mjs +11 -11
- package/dist/http/LocalRequestStore.mjs +11 -11
- package/dist/http/RequestOptions.mjs +14 -14
- package/dist/http/Response.mjs +4 -4
- package/dist/http/RestResult.mjs +22 -22
- package/dist/http/toResponse.mjs +23 -23
- package/dist/index.d.ts +1 -9
- package/dist/index.js +214 -324
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -9
- package/dist/index.mjs.map +1 -1
- package/dist/process/App.mjs +12 -12
- package/dist/process/Manage.mjs +21 -21
- package/dist/process/Scope.mjs +12 -12
- package/dist/process/Search.mjs +21 -21
- package/dist/process/UseCase.mjs +11 -11
- package/dist/resources/Req.mjs +20 -20
- package/dist/security/Jwt.d.ts +2 -12
- package/dist/security/Jwt.mjs +60 -37
- package/dist/security/Jwt.mjs.map +1 -1
- package/dist/services/Api.mjs +30 -30
- package/dist/services/ApiGateway.mjs +33 -33
- package/dist/services/AxiosProvider.mjs +28 -28
- package/dist/services/MappedRouteGateway.mjs +39 -39
- package/dist/services/RouteGateway.mjs +34 -34
- package/dist/services/ViewRouteGateway.mjs +37 -37
- package/dist/sql/Clause.mjs +6 -6
- package/dist/sql/Column.mjs +23 -23
- package/dist/sql/Count.mjs +10 -10
- package/dist/sql/Delete.mjs +9 -9
- package/dist/sql/Insert.mjs +11 -11
- package/dist/sql/Select.mjs +9 -9
- package/dist/sql/SqlQuery.mjs +8 -8
- package/dist/sql/Table.mjs +33 -33
- package/dist/sql/TableGateway.mjs +21 -21
- package/dist/sql/Update.mjs +11 -11
- package/dist/types/Array.mjs +3 -3
- package/dist/types/Builder.mjs +2 -2
- package/dist/types/Cache.mjs +9 -9
- package/dist/types/CacheAge.mjs +21 -21
- package/dist/types/Case.mjs +19 -19
- package/dist/types/Constructor.mjs +2 -2
- package/dist/types/Context.mjs +11 -11
- package/dist/types/Currency.d.ts +7 -0
- package/dist/types/Currency.mjs +15 -0
- package/dist/types/Currency.mjs.map +1 -0
- package/dist/types/Enum.mjs +10 -10
- package/dist/types/Environment.mjs +10 -10
- package/dist/types/Exception.mjs +12 -12
- package/dist/types/Gateway.mjs +14 -14
- package/dist/types/IsA.mjs +3 -3
- package/dist/types/IsEqual.mjs +20 -20
- package/dist/types/Json.mjs +9 -9
- package/dist/types/List.mjs +7 -7
- package/dist/types/Meta.mjs +9 -9
- package/dist/types/Number.mjs +20 -20
- package/dist/types/Object.mjs +8 -8
- package/dist/types/PageList.mjs +20 -20
- package/dist/types/Parser.mjs +19 -19
- package/dist/types/Repository.mjs +14 -14
- package/dist/types/Result.mjs +12 -12
- package/dist/types/Results.mjs +13 -13
- package/dist/types/Tag.mjs +9 -9
- package/dist/types/Template.mjs +10 -10
- package/dist/types/Text.mjs +2 -2
- package/dist/types/Try.mjs +19 -19
- package/dist/types/Uri.mjs +106 -23
- package/dist/types/Uri.mjs.map +1 -1
- package/dist/types/Validatable.mjs +4 -4
- package/dist/types/Value.mjs +3 -3
- package/dist/utils/Convert.mjs +3 -3
- package/dist/utils/If.mjs +3 -3
- package/dist/utils/Mapper.mjs +14 -14
- package/dist/utils/Promise.mjs +8 -8
- package/dist/utils/Property.mjs +4 -4
- package/dist/utils/Sentence.mjs +10 -10
- package/dist/utils/State.mjs +3 -3
- package/dist/utils/View.mjs +23 -23
- package/dist/validation/Contraints.mjs +20 -20
- package/dist/validation/Validate.mjs +19 -19
- package/dist/validation/When.mjs +19 -19
- package/package.json +2 -4
- package/src/index.ts +1 -10
- package/src/security/Jwt.ts +4 -35
- package/src/types/Currency.ts +10 -0
- package/dist/chunk-EIJ3GSGG.mjs +0 -45
- package/dist/chunk-EIJ3GSGG.mjs.map +0 -1
- package/dist/chunk-GSZLYZSW.mjs +0 -104
- package/dist/chunk-GSZLYZSW.mjs.map +0 -1
- package/dist/chunk-JFJLDIJB.mjs +0 -46
- package/dist/chunk-JFJLDIJB.mjs.map +0 -1
- package/dist/chunk-NFWIUPZU.mjs +0 -48
- package/dist/chunk-NFWIUPZU.mjs.map +0 -1
- package/dist/chunk-XBYDAQGZ.mjs +0 -15
- package/dist/chunk-XBYDAQGZ.mjs.map +0 -1
- package/dist/health/HealthResource.d.ts +0 -5
- package/dist/health/HealthResource.mjs +0 -58
- package/dist/health/HealthResource.mjs.map +0 -1
- package/dist/health/HealthUri.d.ts +0 -5
- package/dist/health/HealthUri.mjs +0 -31
- package/dist/health/HealthUri.mjs.map +0 -1
- package/dist/http/OriginatedError.d.ts +0 -9
- package/dist/http/OriginatedError.mjs +0 -23
- package/dist/http/OriginatedError.mjs.map +0 -1
- package/dist/http/Verb.d.ts +0 -23
- package/dist/http/Verb.mjs +0 -50
- package/dist/http/Verb.mjs.map +0 -1
- package/dist/resources/AppProvider.d.ts +0 -9
- package/dist/resources/AppProvider.mjs +0 -1
- package/dist/resources/AppProvider.mjs.map +0 -1
- package/dist/resources/Requires.d.ts +0 -9
- package/dist/resources/Requires.mjs +0 -39
- package/dist/resources/Requires.mjs.map +0 -1
- package/dist/resources/Resource.d.ts +0 -1
- package/dist/resources/Resource.mjs +0 -1
- package/dist/resources/Resource.mjs.map +0 -1
- package/dist/resources/Route.d.ts +0 -28
- package/dist/resources/Route.mjs +0 -32
- package/dist/resources/Route.mjs.map +0 -1
- package/dist/resources/Service.d.ts +0 -17
- package/dist/resources/Service.mjs +0 -55
- package/dist/resources/Service.mjs.map +0 -1
- package/src/health/HealthResource.ts +0 -12
- package/src/health/HealthUri.ts +0 -6
- package/src/http/OriginatedError.ts +0 -18
- package/src/http/Verb.ts +0 -36
- package/src/resources/AppProvider.ts +0 -11
- package/src/resources/Requires.ts +0 -33
- package/src/resources/Resource.ts +0 -1
- package/src/resources/Route.ts +0 -60
- package/src/resources/Service.ts +0 -37
- /package/dist/{chunk-UNHWYQ54.mjs.map → chunk-27YL5N6O.mjs.map} +0 -0
- /package/dist/{chunk-QQRGOHU6.mjs.map → chunk-2BGTVGU4.mjs.map} +0 -0
- /package/dist/{chunk-X7FZPY3P.mjs.map → chunk-2KBPI5HD.mjs.map} +0 -0
- /package/dist/{chunk-M47EOYDK.mjs.map → chunk-2S656HDG.mjs.map} +0 -0
- /package/dist/{chunk-APYISY5K.mjs.map → chunk-2YNBXKAS.mjs.map} +0 -0
- /package/dist/{chunk-45GNHDKA.mjs.map → chunk-3G2I3M46.mjs.map} +0 -0
- /package/dist/{chunk-6VLC4Z4H.mjs.map → chunk-3PG7XJVW.mjs.map} +0 -0
- /package/dist/{chunk-7TJ4VCBE.mjs.map → chunk-3RXN7Y6B.mjs.map} +0 -0
- /package/dist/{chunk-3L4RAR24.mjs.map → chunk-4IGBNRNB.mjs.map} +0 -0
- /package/dist/{chunk-D4K4MC24.mjs.map → chunk-7GL3D7F7.mjs.map} +0 -0
- /package/dist/{chunk-IAXKOENJ.mjs.map → chunk-A7PAVXBM.mjs.map} +0 -0
- /package/dist/{chunk-KRLEHX37.mjs.map → chunk-ANOORQCM.mjs.map} +0 -0
- /package/dist/{chunk-NYYHRFBW.mjs.map → chunk-AQT7Z43R.mjs.map} +0 -0
- /package/dist/{chunk-JFU65NZU.mjs.map → chunk-C4ZJZWD5.mjs.map} +0 -0
- /package/dist/{chunk-U53FLD4J.mjs.map → chunk-CGMASUXA.mjs.map} +0 -0
- /package/dist/{chunk-UKHDSTTZ.mjs.map → chunk-CMHJOQBL.mjs.map} +0 -0
- /package/dist/{chunk-TMZRZLA2.mjs.map → chunk-CYTFXBYW.mjs.map} +0 -0
- /package/dist/{chunk-J7XKOXMW.mjs.map → chunk-EGVFHL23.mjs.map} +0 -0
- /package/dist/{chunk-A62OK7XE.mjs.map → chunk-F7C6VY2D.mjs.map} +0 -0
- /package/dist/{chunk-HBJMCX2I.mjs.map → chunk-FCGLOMI7.mjs.map} +0 -0
- /package/dist/{chunk-ARTSACXM.mjs.map → chunk-FRG4TDTG.mjs.map} +0 -0
- /package/dist/{chunk-ZHXKBOK2.mjs.map → chunk-G4GZG77M.mjs.map} +0 -0
- /package/dist/{chunk-EDVJUOFU.mjs.map → chunk-HETCTNQ6.mjs.map} +0 -0
- /package/dist/{chunk-JBJ2YERG.mjs.map → chunk-IFDDZTWN.mjs.map} +0 -0
- /package/dist/{chunk-ZPNFXK7Y.mjs.map → chunk-IK4EPPOF.mjs.map} +0 -0
- /package/dist/{chunk-6YVMQB26.mjs.map → chunk-JADWPU3M.mjs.map} +0 -0
- /package/dist/{chunk-LYAPQ4QZ.mjs.map → chunk-JKZEVKE3.mjs.map} +0 -0
- /package/dist/{chunk-JSON7A4X.mjs.map → chunk-JOI26DEU.mjs.map} +0 -0
- /package/dist/{chunk-UJEQAXZI.mjs.map → chunk-JPHN3NM3.mjs.map} +0 -0
- /package/dist/{chunk-JTGB3TSZ.mjs.map → chunk-JV37KGKL.mjs.map} +0 -0
- /package/dist/{chunk-HV4CI2QX.mjs.map → chunk-JX7EOMTI.mjs.map} +0 -0
- /package/dist/{chunk-HNVAFEZP.mjs.map → chunk-K2IES6IY.mjs.map} +0 -0
- /package/dist/{chunk-D5FLGKVR.mjs.map → chunk-K53K3QPT.mjs.map} +0 -0
- /package/dist/{chunk-ARZEQQW5.mjs.map → chunk-KCOJAMHS.mjs.map} +0 -0
- /package/dist/{chunk-Q5HABVOK.mjs.map → chunk-KRVOV2PR.mjs.map} +0 -0
- /package/dist/{chunk-73UD7JJL.mjs.map → chunk-LCNUK6EI.mjs.map} +0 -0
- /package/dist/{chunk-UW6S2PNO.mjs.map → chunk-LGXHFCSE.mjs.map} +0 -0
- /package/dist/{chunk-UYDZZAEK.mjs.map → chunk-LHD6A2CA.mjs.map} +0 -0
- /package/dist/{chunk-QTPKH4PY.mjs.map → chunk-MPFUPK2O.mjs.map} +0 -0
- /package/dist/{chunk-WJZFE5NE.mjs.map → chunk-MYZQELEU.mjs.map} +0 -0
- /package/dist/{chunk-LAR7AT6R.mjs.map → chunk-MZ74H2HU.mjs.map} +0 -0
- /package/dist/{chunk-7K4QMDUN.mjs.map → chunk-OHHQ5YCI.mjs.map} +0 -0
- /package/dist/{chunk-VV534JNS.mjs.map → chunk-OKVYYWDS.mjs.map} +0 -0
- /package/dist/{chunk-CAHTK3AT.mjs.map → chunk-PB7ZHNR6.mjs.map} +0 -0
- /package/dist/{chunk-FHW5K2RR.mjs.map → chunk-POMUVSEW.mjs.map} +0 -0
- /package/dist/{chunk-2ZUDYGPP.mjs.map → chunk-PUUAMXGK.mjs.map} +0 -0
- /package/dist/{chunk-USGZFNWP.mjs.map → chunk-QGLPCM3U.mjs.map} +0 -0
- /package/dist/{chunk-4DJNTF2D.mjs.map → chunk-QQ62TFVN.mjs.map} +0 -0
- /package/dist/{chunk-J6KN572O.mjs.map → chunk-RNM4YSY2.mjs.map} +0 -0
- /package/dist/{chunk-YSBACFUR.mjs.map → chunk-SKP7IQKF.mjs.map} +0 -0
- /package/dist/{chunk-RNROH3VJ.mjs.map → chunk-SWKY2KOQ.mjs.map} +0 -0
- /package/dist/{chunk-4G6AW6D6.mjs.map → chunk-T5K5ZLP2.mjs.map} +0 -0
- /package/dist/{chunk-OFGI5FLG.mjs.map → chunk-UARTMYBD.mjs.map} +0 -0
- /package/dist/{chunk-6BQEFLOS.mjs.map → chunk-V35WKNIG.mjs.map} +0 -0
- /package/dist/{chunk-PPWHEIZW.mjs.map → chunk-WWJDP64S.mjs.map} +0 -0
- /package/dist/{chunk-5WSP2IYF.mjs.map → chunk-XJAVMPHW.mjs.map} +0 -0
- /package/dist/{chunk-A2JYVEBB.mjs.map → chunk-XSK44RYX.mjs.map} +0 -0
package/dist/chunk-GSZLYZSW.mjs
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
tryTo
|
|
3
|
-
} from "./chunk-ARZEQQW5.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ctx
|
|
6
|
-
} from "./chunk-6YVMQB26.mjs";
|
|
7
|
-
import {
|
|
8
|
-
meta
|
|
9
|
-
} from "./chunk-PPWHEIZW.mjs";
|
|
10
|
-
import {
|
|
11
|
-
entries
|
|
12
|
-
} from "./chunk-JTGB3TSZ.mjs";
|
|
13
|
-
import {
|
|
14
|
-
toList
|
|
15
|
-
} from "./chunk-J7XKOXMW.mjs";
|
|
16
|
-
import {
|
|
17
|
-
toArray
|
|
18
|
-
} from "./chunk-X7FZPY3P.mjs";
|
|
19
|
-
import {
|
|
20
|
-
asString
|
|
21
|
-
} from "./chunk-45GNHDKA.mjs";
|
|
22
|
-
import {
|
|
23
|
-
toName
|
|
24
|
-
} from "./chunk-ZPNFXK7Y.mjs";
|
|
25
|
-
import {
|
|
26
|
-
isBoolean,
|
|
27
|
-
isNotEmpty,
|
|
28
|
-
isTrue
|
|
29
|
-
} from "./chunk-DEJ7A5PY.mjs";
|
|
30
|
-
|
|
31
|
-
// src/types/Uri.ts
|
|
32
|
-
var toSegment = (key, {
|
|
33
|
-
segment,
|
|
34
|
-
query
|
|
35
|
-
} = {}) => ({
|
|
36
|
-
key,
|
|
37
|
-
segment,
|
|
38
|
-
query,
|
|
39
|
-
toString: () => asString(key)
|
|
40
|
-
});
|
|
41
|
-
var uri = {
|
|
42
|
-
host: (key) => toSegment(key, { segment: key ?? ctx.env.host ?? "$host" }),
|
|
43
|
-
resource: (resource) => toSegment(toName(resource, "Uri"), { segment: toName(resource, "Uri") }),
|
|
44
|
-
segment: (key) => toSegment(key, { segment: key }),
|
|
45
|
-
path: (key) => toSegment(key, { segment: `:${key}` }),
|
|
46
|
-
query: (key) => toSegment(key, {
|
|
47
|
-
query: (value) => tryTo(value).is.defined().map((v) => encodeURIComponent(asString(v))).map((v) => `${key}=${v}`).orElse("") ?? ""
|
|
48
|
-
}),
|
|
49
|
-
boolean: (key) => toSegment(key, { query: (value) => isTrue(value) ? `${key}` : "" })
|
|
50
|
-
};
|
|
51
|
-
var toRoute = (...segments) => toList(segments).mapDefined((s) => s.segment).join("/");
|
|
52
|
-
var EasyUri = class _EasyUri {
|
|
53
|
-
constructor(segments = []) {
|
|
54
|
-
this.segments = segments;
|
|
55
|
-
}
|
|
56
|
-
static id = uri.path("id");
|
|
57
|
-
static ids = uri.query("ids");
|
|
58
|
-
static query = uri.query("q");
|
|
59
|
-
static sort = uri.query("s");
|
|
60
|
-
static skip = uri.query("skip");
|
|
61
|
-
static take = uri.query("take");
|
|
62
|
-
host = uri.host();
|
|
63
|
-
resource = uri.resource(this);
|
|
64
|
-
state = {};
|
|
65
|
-
get path() {
|
|
66
|
-
return toRoute(uri.segment(""), this.resource, ...this.segments);
|
|
67
|
-
}
|
|
68
|
-
get complete() {
|
|
69
|
-
return toRoute(this.host, this.resource, ...this.segments);
|
|
70
|
-
}
|
|
71
|
-
get isInternal() {
|
|
72
|
-
return toRoute(this.host) === (ctx.env.host ?? "$host");
|
|
73
|
-
}
|
|
74
|
-
get props() {
|
|
75
|
-
return meta(this.state).values();
|
|
76
|
-
}
|
|
77
|
-
route = (resource = this.resource.key) => toRoute(uri.segment(""), uri.segment(resource?.toLowerCase()), ...this.segments);
|
|
78
|
-
set = (segment, value) => {
|
|
79
|
-
tryTo(value).is.defined().accept((value2) => this.state[segment.key ?? ""] = { segment, value: value2 });
|
|
80
|
-
return this;
|
|
81
|
-
};
|
|
82
|
-
toString() {
|
|
83
|
-
return tryTo(() => this.props).map((ps) => ps.filter((p) => p.segment?.segment)).map((ps) => ps.reduce((r, p) => r.replace(asString(p.segment.segment), asString(p.value)), this.complete)).map((route) => ({
|
|
84
|
-
route,
|
|
85
|
-
query: this.props.mapDefined((p) => p.segment?.query ? p.segment?.query(p.value) : void 0)?.join("&")
|
|
86
|
-
})).map(({ route, query }) => isNotEmpty(query) ? `${route}?${query}` : route).value;
|
|
87
|
-
}
|
|
88
|
-
id = (id) => this.set(_EasyUri.id, id);
|
|
89
|
-
ids = (ids) => this.set(_EasyUri.ids, toArray(ids).join(","));
|
|
90
|
-
query = (q) => this.set(_EasyUri.query, q);
|
|
91
|
-
sort = (s) => this.set(_EasyUri.sort, asString(s));
|
|
92
|
-
skip = (index) => this.set(_EasyUri.skip, index);
|
|
93
|
-
take = (items) => this.set(_EasyUri.take, items);
|
|
94
|
-
expand(props) {
|
|
95
|
-
return entries(props).filter(([_, v]) => isNotEmpty(v)).reduce((u, [k, v]) => isBoolean(v) ? u.set(uri.boolean(k), v) : u.set(uri.query(k), toArray(v).join(",")), this);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export {
|
|
100
|
-
toSegment,
|
|
101
|
-
uri,
|
|
102
|
-
EasyUri
|
|
103
|
-
};
|
|
104
|
-
//# sourceMappingURL=chunk-GSZLYZSW.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/Uri.ts"],"sourcesContent":["import { isBoolean, isNotEmpty, isTrue } from './Is';\nimport { asString, Text } from './Text';\nimport { toName } from './Constructor';\nimport { ctx } from './Context';\nimport { List, toList } from './List';\nimport { meta } from './Meta';\nimport { tryTo } from './Try';\nimport { Optional } from './Types';\nimport { OneOrMore, toArray } from './Array';\nimport { entries } from './Object';\n\nexport type Segment = Text & { key?: string; segment?: string; query?: (value: unknown) => string };\n\nexport const toSegment = (\n key?: Text,\n {\n segment,\n query,\n }: {\n segment?: string;\n query?: (value: unknown) => string;\n } = {}\n): Segment => ({\n key: key as string,\n segment,\n query,\n toString: () => asString(key),\n});\n\nexport const uri = {\n host: (key?: string): Segment => toSegment(key, { segment: key ?? ctx.env.host ?? '$host' }),\n resource: (resource: Uri): Segment => toSegment(toName(resource, 'Uri'), { segment: toName(resource, 'Uri') }),\n segment: (key?: Text): Segment => toSegment(key, { segment: key as string }),\n path: (key: Text): Segment => toSegment(key, { segment: `:${key}` }),\n query: (key: Text): Segment =>\n toSegment(key, {\n query: (value: unknown): string =>\n tryTo(value)\n .is.defined()\n .map(v => encodeURIComponent(asString(v)))\n .map(v => `${key}=${v}`)\n .orElse('') ?? '',\n }),\n boolean: (key: Text): Segment => toSegment(key, { query: (value: unknown): string => (isTrue(value) ? `${key}` : '') }),\n};\n\ntype Prop = { segment: Segment; value: any };\n\nconst toRoute = (...segments: Segment[]): string =>\n toList(segments)\n .mapDefined(s => s.segment)\n .join('/');\n\nexport type Uri = {\n id: (id?: unknown) => Uri;\n ids: (ids: OneOrMore<unknown>) => Uri;\n query: (q?: unknown) => Uri;\n sort: (q?: any) => Uri;\n skip: (n?: number) => Uri;\n take: (n?: number) => Uri;\n path: string;\n route: (resource: string) => string;\n isInternal: boolean;\n toString: () => string;\n};\n\nexport type UriExpandProps = { q: string; s: string };\n\nexport class EasyUri<Props = UriExpandProps> implements Uri {\n static readonly id = uri.path('id');\n static readonly ids = uri.query('ids');\n static readonly query = uri.query('q');\n static readonly sort = uri.query('s');\n static readonly skip = uri.query('skip');\n static readonly take = uri.query('take');\n\n readonly host = uri.host();\n protected resource = uri.resource(this);\n\n protected state: any = {};\n\n constructor(readonly segments: Segment[] = []) {}\n\n get path(): string {\n return toRoute(uri.segment(''), this.resource, ...this.segments);\n }\n\n get complete(): string {\n return toRoute(this.host, this.resource, ...this.segments);\n }\n\n get isInternal(): boolean {\n return toRoute(this.host) === (ctx.env.host ?? '$host');\n }\n\n protected get props(): List<Prop> {\n return meta(this.state).values<Prop>();\n }\n\n route = (resource: Optional<string> = this.resource.key): string => toRoute(uri.segment(''), uri.segment(resource?.toLowerCase()), ...this.segments);\n\n set = (segment: Segment, value?: unknown): this => {\n tryTo(value)\n .is.defined()\n .accept(value => (this.state[segment.key ?? ''] = { segment, value }));\n return this;\n };\n\n toString(): string {\n return tryTo(() => this.props)\n .map(ps => ps.filter(p => p.segment?.segment))\n .map(ps => ps.reduce((r: string, p: Prop) => r.replace(asString(p.segment.segment), asString(p.value)), this.complete))\n .map(route => ({\n route,\n query: this.props.mapDefined(p => (p.segment?.query ? p.segment?.query(p.value) : undefined))?.join('&'),\n }))\n .map(({ route, query }) => (isNotEmpty(query) ? `${route}?${query}` : route)).value;\n }\n\n id = (id?: unknown): this => this.set(EasyUri.id, id);\n ids = (ids: OneOrMore<unknown>): this => this.set(EasyUri.ids, toArray(ids).join(','));\n query = (q?: unknown): this => this.set(EasyUri.query, q);\n sort = (s?: any): this => this.set(EasyUri.sort, asString(s));\n\n skip = (index?: number): this => this.set(EasyUri.skip, index);\n take = (items?: number): this => this.set(EasyUri.take, items);\n\n expand(props: Partial<Props>): this {\n return entries(props)\n .filter(([_, v]) => isNotEmpty(v))\n .reduce((u, [k, v]) => (isBoolean(v) ? u.set(uri.boolean(k), v) : u.set(uri.query(k), toArray(v).join(','))), this);\n }\n}\n"],"mappings":"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","names":["value"]}
|
package/dist/chunk-JFJLDIJB.mjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CacheControl
|
|
3
|
-
} from "./chunk-NFWIUPZU.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ContentType
|
|
6
|
-
} from "./chunk-4DJNTF2D.mjs";
|
|
7
|
-
import {
|
|
8
|
-
HttpStatus
|
|
9
|
-
} from "./chunk-TMZRZLA2.mjs";
|
|
10
|
-
import {
|
|
11
|
-
HttpVerb
|
|
12
|
-
} from "./chunk-LAR7AT6R.mjs";
|
|
13
|
-
import {
|
|
14
|
-
meta
|
|
15
|
-
} from "./chunk-PPWHEIZW.mjs";
|
|
16
|
-
|
|
17
|
-
// src/http/Verb.ts
|
|
18
|
-
var toVerbOptions = (options) => ({
|
|
19
|
-
onOk: options?.onOk ?? HttpStatus.Ok,
|
|
20
|
-
onNotFound: options?.onNotFound ?? HttpStatus.NotFound,
|
|
21
|
-
onError: options?.onError ?? HttpStatus.BadRequest,
|
|
22
|
-
type: options?.type ?? ContentType.Json,
|
|
23
|
-
cache: options?.cache ?? CacheControl.disabled()
|
|
24
|
-
});
|
|
25
|
-
var toVerb = (verb, options) => (subject, property) => {
|
|
26
|
-
meta(subject).property(property).set("verb", { verb, options });
|
|
27
|
-
};
|
|
28
|
-
var get = (options) => toVerb(HttpVerb.Get, options);
|
|
29
|
-
var search = (options) => toVerb(HttpVerb.Get, { onNotFound: HttpStatus.Ok, ...options });
|
|
30
|
-
var put = (options) => toVerb(HttpVerb.Put, options);
|
|
31
|
-
var patch = (options) => toVerb(HttpVerb.Patch, options);
|
|
32
|
-
var post = (options) => toVerb(HttpVerb.Post, { onOk: HttpStatus.Created, ...options });
|
|
33
|
-
var del = (options) => toVerb(HttpVerb.Delete, { onOk: HttpStatus.NoContent, ...options });
|
|
34
|
-
var stream = (options) => toVerb(HttpVerb.Get, { type: ContentType.Stream, ...options });
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
toVerbOptions,
|
|
38
|
-
get,
|
|
39
|
-
search,
|
|
40
|
-
put,
|
|
41
|
-
patch,
|
|
42
|
-
post,
|
|
43
|
-
del,
|
|
44
|
-
stream
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=chunk-JFJLDIJB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/http/Verb.ts"],"sourcesContent":["import { meta } from '../types/Meta';\nimport { HttpStatus } from './HttpStatus';\nimport { ContentType } from './ContentType';\nimport { CacheControl } from './CacheControl';\nimport { HttpVerb } from './HttpVerb';\n\nexport type VerbOptions = { onOk?: HttpStatus; onNotFound?: HttpStatus; onError?: HttpStatus; type?: ContentType; cache?: CacheControl };\nexport type Verb = { verb: HttpVerb; options: VerbOptions };\n\nexport const toVerbOptions = (options?: VerbOptions): Required<VerbOptions> => ({\n onOk: options?.onOk ?? HttpStatus.Ok,\n onNotFound: options?.onNotFound ?? HttpStatus.NotFound,\n onError: options?.onError ?? HttpStatus.BadRequest,\n type: options?.type ?? ContentType.Json,\n cache: options?.cache ?? CacheControl.disabled(),\n});\n\nconst toVerb =\n <T>(verb: HttpVerb, options?: VerbOptions): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n meta(subject).property(property).set('verb', { verb, options });\n };\n\nexport const get = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Get, options);\n\nexport const search = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Get, { onNotFound: HttpStatus.Ok, ...options });\n\nexport const put = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Put, options);\n\nexport const patch = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Patch, options);\n\nexport const post = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Post, { onOk: HttpStatus.Created, ...options });\n\nexport const del = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Delete, { onOk: HttpStatus.NoContent, ...options });\n\nexport const stream = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Get, { type: ContentType.Stream, ...options });\n"],"mappings":";;;;;;;;;;;;;;;;;AASO,IAAM,gBAAgB,CAAC,aAAkD;AAAA,EAC9E,MAAM,SAAS,QAAQ,WAAW;AAAA,EAClC,YAAY,SAAS,cAAc,WAAW;AAAA,EAC9C,SAAS,SAAS,WAAW,WAAW;AAAA,EACxC,MAAM,SAAS,QAAQ,YAAY;AAAA,EACnC,OAAO,SAAS,SAAS,aAAa,SAAS;AACjD;AAEA,IAAM,SACJ,CAAI,MAAgB,YACpB,CAAC,SAAkB,aAAoC;AACrD,OAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAChE;AAEK,IAAM,MAAM,CAAC,YAA6C,OAAO,SAAS,KAAK,OAAO;AAEtF,IAAM,SAAS,CAAC,YAA6C,OAAO,SAAS,KAAK,EAAE,YAAY,WAAW,IAAI,GAAG,QAAQ,CAAC;AAE3H,IAAM,MAAM,CAAC,YAA6C,OAAO,SAAS,KAAK,OAAO;AAEtF,IAAM,QAAQ,CAAC,YAA6C,OAAO,SAAS,OAAO,OAAO;AAE1F,IAAM,OAAO,CAAC,YAA6C,OAAO,SAAS,MAAM,EAAE,MAAM,WAAW,SAAS,GAAG,QAAQ,CAAC;AAEzH,IAAM,MAAM,CAAC,YAA6C,OAAO,SAAS,QAAQ,EAAE,MAAM,WAAW,WAAW,GAAG,QAAQ,CAAC;AAE5H,IAAM,SAAS,CAAC,YAA6C,OAAO,SAAS,KAAK,EAAE,MAAM,YAAY,QAAQ,GAAG,QAAQ,CAAC;","names":[]}
|
package/dist/chunk-NFWIUPZU.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cacheAge
|
|
3
|
-
} from "./chunk-NYYHRFBW.mjs";
|
|
4
|
-
import {
|
|
5
|
-
entries
|
|
6
|
-
} from "./chunk-JTGB3TSZ.mjs";
|
|
7
|
-
import {
|
|
8
|
-
ifDefined
|
|
9
|
-
} from "./chunk-JSON7A4X.mjs";
|
|
10
|
-
import {
|
|
11
|
-
on
|
|
12
|
-
} from "./chunk-ZPNFXK7Y.mjs";
|
|
13
|
-
import {
|
|
14
|
-
isNumber
|
|
15
|
-
} from "./chunk-DEJ7A5PY.mjs";
|
|
16
|
-
|
|
17
|
-
// src/http/CacheControl.ts
|
|
18
|
-
var CacheControl = class _CacheControl {
|
|
19
|
-
constructor(enabled = true, directives = {}) {
|
|
20
|
-
this.enabled = enabled;
|
|
21
|
-
this.directives = directives;
|
|
22
|
-
}
|
|
23
|
-
name = "Cache-Control";
|
|
24
|
-
static disabled = () => new _CacheControl(false);
|
|
25
|
-
static OneSecond = () => new _CacheControl().maxAge(1).staleWhileRevalidate(1);
|
|
26
|
-
static fiveSeconds = () => new _CacheControl().maxAge(5).staleWhileRevalidate(5);
|
|
27
|
-
static tenSeconds = () => new _CacheControl().maxAge(10).staleWhileRevalidate(10);
|
|
28
|
-
static thirtySeconds = () => new _CacheControl().maxAge(30).staleWhileRevalidate(30);
|
|
29
|
-
static sixtySeconds = () => new _CacheControl().maxAge(60).staleWhileRevalidate(60);
|
|
30
|
-
static custom = (maxAge, staleWhileRevalidate) => new _CacheControl().maxAge(maxAge).staleWhileRevalidate(staleWhileRevalidate);
|
|
31
|
-
maxAge = (ca) => on(this, (t) => t.directives["max-age"] = ca);
|
|
32
|
-
sharedMaxAge = (ca) => on(this, (t) => t.directives["s-maxage"] = ca);
|
|
33
|
-
noCache = (a) => on(this, (t) => t.directives["no-cache"] = a);
|
|
34
|
-
mustRevalidate = (a) => on(this, (t) => t.directives["must-revalidate"] = a);
|
|
35
|
-
private = (a) => on(this, (t) => t.directives["private"] = a);
|
|
36
|
-
public = (a) => on(this, (t) => t.directives["public"] = a);
|
|
37
|
-
immutable = (a) => on(this, (t) => t.directives["immutable"] = a);
|
|
38
|
-
staleWhileRevalidate = (ca) => on(this, (t) => t.directives["stale-while-revalidate"] = ca);
|
|
39
|
-
value = () => this.toString();
|
|
40
|
-
toString() {
|
|
41
|
-
return entries(this.directives).mapDefined(([k, v]) => ifDefined(v, isNumber(v) ? `${k}=${cacheAge.toSeconds(v)}` : k)).join(",");
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
CacheControl
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=chunk-NFWIUPZU.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/http/CacheControl.ts"],"sourcesContent":["import { cacheAge, CacheAge } from '../types/CacheAge';\nimport { on } from '../types/Constructor';\nimport { entries } from '../types/Object';\nimport { ifDefined } from '../utils/If';\nimport { isNumber } from '../types/Is';\n\nexport class CacheControl {\n name = 'Cache-Control';\n\n protected constructor(\n readonly enabled = true,\n private directives: Record<string, boolean | CacheAge | undefined> = {}\n ) {}\n\n static disabled = () => new CacheControl(false);\n\n static OneSecond = () => new CacheControl().maxAge(1).staleWhileRevalidate(1);\n\n static fiveSeconds = () => new CacheControl().maxAge(5).staleWhileRevalidate(5);\n\n static tenSeconds = () => new CacheControl().maxAge(10).staleWhileRevalidate(10);\n\n static thirtySeconds = () => new CacheControl().maxAge(30).staleWhileRevalidate(30);\n\n static sixtySeconds = () => new CacheControl().maxAge(60).staleWhileRevalidate(60);\n\n static custom = (maxAge?: CacheAge, staleWhileRevalidate?: CacheAge) => new CacheControl().maxAge(maxAge).staleWhileRevalidate(staleWhileRevalidate);\n\n readonly maxAge = (ca?: CacheAge): this => on(this, t => (t.directives['max-age'] = ca));\n\n readonly sharedMaxAge = (ca?: CacheAge): this => on(this, t => (t.directives['s-maxage'] = ca));\n\n readonly noCache = (a?: boolean): this => on(this, t => (t.directives['no-cache'] = a));\n\n readonly mustRevalidate = (a?: boolean): this => on(this, t => (t.directives['must-revalidate'] = a));\n\n readonly private = (a?: boolean): this => on(this, t => (t.directives['private'] = a));\n\n readonly public = (a?: boolean): this => on(this, t => (t.directives['public'] = a));\n\n readonly immutable = (a?: boolean): this => on(this, t => (t.directives['immutable'] = a));\n\n readonly staleWhileRevalidate = (ca?: CacheAge): this => on(this, t => (t.directives['stale-while-revalidate'] = ca));\n\n value = (): string => this.toString();\n\n toString(): string {\n return entries(this.directives)\n .mapDefined(([k, v]) => ifDefined(v, isNumber(v) ? `${k}=${cacheAge.toSeconds(v)}` : k))\n .join(',');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAMO,IAAM,eAAN,MAAM,cAAa;AAAA,EAGd,YACC,UAAU,MACX,aAA6D,CAAC,GACtE;AAFS;AACD;AAAA,EACP;AAAA,EALH,OAAO;AAAA,EAOP,OAAO,WAAW,MAAM,IAAI,cAAa,KAAK;AAAA,EAE9C,OAAO,YAAY,MAAM,IAAI,cAAa,EAAE,OAAO,CAAC,EAAE,qBAAqB,CAAC;AAAA,EAE5E,OAAO,cAAc,MAAM,IAAI,cAAa,EAAE,OAAO,CAAC,EAAE,qBAAqB,CAAC;AAAA,EAE9E,OAAO,aAAa,MAAM,IAAI,cAAa,EAAE,OAAO,EAAE,EAAE,qBAAqB,EAAE;AAAA,EAE/E,OAAO,gBAAgB,MAAM,IAAI,cAAa,EAAE,OAAO,EAAE,EAAE,qBAAqB,EAAE;AAAA,EAElF,OAAO,eAAe,MAAM,IAAI,cAAa,EAAE,OAAO,EAAE,EAAE,qBAAqB,EAAE;AAAA,EAEjF,OAAO,SAAS,CAAC,QAAmB,yBAAoC,IAAI,cAAa,EAAE,OAAO,MAAM,EAAE,qBAAqB,oBAAoB;AAAA,EAE1I,SAAS,CAAC,OAAwB,GAAG,MAAM,OAAM,EAAE,WAAW,SAAS,IAAI,EAAG;AAAA,EAE9E,eAAe,CAAC,OAAwB,GAAG,MAAM,OAAM,EAAE,WAAW,UAAU,IAAI,EAAG;AAAA,EAErF,UAAU,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,UAAU,IAAI,CAAE;AAAA,EAE7E,iBAAiB,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,iBAAiB,IAAI,CAAE;AAAA,EAE3F,UAAU,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,SAAS,IAAI,CAAE;AAAA,EAE5E,SAAS,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,QAAQ,IAAI,CAAE;AAAA,EAE1E,YAAY,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,WAAW,IAAI,CAAE;AAAA,EAEhF,uBAAuB,CAAC,OAAwB,GAAG,MAAM,OAAM,EAAE,WAAW,wBAAwB,IAAI,EAAG;AAAA,EAEpH,QAAQ,MAAc,KAAK,SAAS;AAAA,EAEpC,WAAmB;AACjB,WAAO,QAAQ,KAAK,UAAU,EAC3B,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,GAAG,CAAC,IAAI,SAAS,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,EACtF,KAAK,GAAG;AAAA,EACb;AACF;","names":[]}
|
package/dist/chunk-XBYDAQGZ.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EasyUri,
|
|
3
|
-
uri
|
|
4
|
-
} from "./chunk-GSZLYZSW.mjs";
|
|
5
|
-
|
|
6
|
-
// src/health/HealthUri.ts
|
|
7
|
-
var HealthUri = class _HealthUri extends EasyUri {
|
|
8
|
-
static health = uri.segment("health");
|
|
9
|
-
static Health = new _HealthUri([_HealthUri.health]);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
HealthUri
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=chunk-XBYDAQGZ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/health/HealthUri.ts"],"sourcesContent":["import { EasyUri, uri } from '../types/Uri';\n\nexport class HealthUri extends EasyUri {\n static readonly health = uri.segment('health');\n static readonly Health = new HealthUri([HealthUri.health]);\n}\n"],"mappings":";;;;;;AAEO,IAAM,YAAN,MAAM,mBAAkB,QAAQ;AAAA,EACrC,OAAgB,SAAS,IAAI,QAAQ,QAAQ;AAAA,EAC7C,OAAgB,SAAS,IAAI,WAAU,CAAC,WAAU,MAAM,CAAC;AAC3D;","names":[]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
route
|
|
3
|
-
} from "../chunk-EIJ3GSGG.mjs";
|
|
4
|
-
import {
|
|
5
|
-
get
|
|
6
|
-
} from "../chunk-JFJLDIJB.mjs";
|
|
7
|
-
import "../chunk-NFWIUPZU.mjs";
|
|
8
|
-
import "../chunk-NYYHRFBW.mjs";
|
|
9
|
-
import "../chunk-JBJ2YERG.mjs";
|
|
10
|
-
import "../chunk-4DJNTF2D.mjs";
|
|
11
|
-
import "../chunk-TMZRZLA2.mjs";
|
|
12
|
-
import "../chunk-LAR7AT6R.mjs";
|
|
13
|
-
import {
|
|
14
|
-
HealthUri
|
|
15
|
-
} from "../chunk-XBYDAQGZ.mjs";
|
|
16
|
-
import "../chunk-GSZLYZSW.mjs";
|
|
17
|
-
import "../chunk-ARZEQQW5.mjs";
|
|
18
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
19
|
-
import "../chunk-CAHTK3AT.mjs";
|
|
20
|
-
import "../chunk-4G6AW6D6.mjs";
|
|
21
|
-
import "../chunk-J6KN572O.mjs";
|
|
22
|
-
import {
|
|
23
|
-
resolve
|
|
24
|
-
} from "../chunk-USGZFNWP.mjs";
|
|
25
|
-
import "../chunk-LYAPQ4QZ.mjs";
|
|
26
|
-
import "../chunk-6YVMQB26.mjs";
|
|
27
|
-
import "../chunk-FHW5K2RR.mjs";
|
|
28
|
-
import "../chunk-UNHWYQ54.mjs";
|
|
29
|
-
import "../chunk-PPWHEIZW.mjs";
|
|
30
|
-
import "../chunk-JTGB3TSZ.mjs";
|
|
31
|
-
import "../chunk-J7XKOXMW.mjs";
|
|
32
|
-
import "../chunk-JSON7A4X.mjs";
|
|
33
|
-
import "../chunk-X7FZPY3P.mjs";
|
|
34
|
-
import "../chunk-45GNHDKA.mjs";
|
|
35
|
-
import "../chunk-SJGQU3OG.mjs";
|
|
36
|
-
import "../chunk-ZHXKBOK2.mjs";
|
|
37
|
-
import "../chunk-ZPNFXK7Y.mjs";
|
|
38
|
-
import "../chunk-DXQSIBC7.mjs";
|
|
39
|
-
import "../chunk-PIRWVOO2.mjs";
|
|
40
|
-
import "../chunk-DEJ7A5PY.mjs";
|
|
41
|
-
import {
|
|
42
|
-
__decorateClass
|
|
43
|
-
} from "../chunk-4N72FQFX.mjs";
|
|
44
|
-
|
|
45
|
-
// src/health/HealthResource.ts
|
|
46
|
-
var HealthResource = class {
|
|
47
|
-
ok = () => resolve({ state: "Service is healthy." });
|
|
48
|
-
};
|
|
49
|
-
__decorateClass([
|
|
50
|
-
get()
|
|
51
|
-
], HealthResource.prototype, "ok", 2);
|
|
52
|
-
HealthResource = __decorateClass([
|
|
53
|
-
route(HealthUri.Health)
|
|
54
|
-
], HealthResource);
|
|
55
|
-
export {
|
|
56
|
-
HealthResource
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=HealthResource.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/health/HealthResource.ts"],"sourcesContent":["import { HealthUri } from './HealthUri';\nimport { route } from '../resources/Route';\nimport { Resource } from '../resources/Resource';\nimport { get } from '../http/Verb';\nimport { Json } from '../types/Json';\nimport { resolve } from '../utils/Promise';\n\n@route(HealthUri.Health)\nexport class HealthResource implements Resource {\n @get()\n ok = (): Promise<Json> => resolve({ state: 'Service is healthy.' });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,IAAM,iBAAN,MAAyC;AAAA,EAE9C,KAAK,MAAqB,QAAQ,EAAE,OAAO,sBAAsB,CAAC;AACpE;AADE;AAAA,EADC,IAAI;AAAA,GADM,eAEX;AAFW,iBAAN;AAAA,EADN,MAAM,UAAU,MAAM;AAAA,GACV;","names":[]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HealthUri
|
|
3
|
-
} from "../chunk-XBYDAQGZ.mjs";
|
|
4
|
-
import "../chunk-GSZLYZSW.mjs";
|
|
5
|
-
import "../chunk-ARZEQQW5.mjs";
|
|
6
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
7
|
-
import "../chunk-CAHTK3AT.mjs";
|
|
8
|
-
import "../chunk-4G6AW6D6.mjs";
|
|
9
|
-
import "../chunk-J6KN572O.mjs";
|
|
10
|
-
import "../chunk-USGZFNWP.mjs";
|
|
11
|
-
import "../chunk-LYAPQ4QZ.mjs";
|
|
12
|
-
import "../chunk-6YVMQB26.mjs";
|
|
13
|
-
import "../chunk-FHW5K2RR.mjs";
|
|
14
|
-
import "../chunk-UNHWYQ54.mjs";
|
|
15
|
-
import "../chunk-PPWHEIZW.mjs";
|
|
16
|
-
import "../chunk-JTGB3TSZ.mjs";
|
|
17
|
-
import "../chunk-J7XKOXMW.mjs";
|
|
18
|
-
import "../chunk-JSON7A4X.mjs";
|
|
19
|
-
import "../chunk-X7FZPY3P.mjs";
|
|
20
|
-
import "../chunk-45GNHDKA.mjs";
|
|
21
|
-
import "../chunk-SJGQU3OG.mjs";
|
|
22
|
-
import "../chunk-ZHXKBOK2.mjs";
|
|
23
|
-
import "../chunk-ZPNFXK7Y.mjs";
|
|
24
|
-
import "../chunk-DXQSIBC7.mjs";
|
|
25
|
-
import "../chunk-PIRWVOO2.mjs";
|
|
26
|
-
import "../chunk-DEJ7A5PY.mjs";
|
|
27
|
-
import "../chunk-4N72FQFX.mjs";
|
|
28
|
-
export {
|
|
29
|
-
HealthUri
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=HealthUri.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { VerbOptions } from './Verb';
|
|
2
|
-
import { ErrorOrigin } from '../types/ErrorOrigin';
|
|
3
|
-
export declare class OriginatedError extends Error {
|
|
4
|
-
readonly origin: ErrorOrigin;
|
|
5
|
-
readonly options?: VerbOptions | undefined;
|
|
6
|
-
constructor(origin: ErrorOrigin, options?: VerbOptions | undefined);
|
|
7
|
-
}
|
|
8
|
-
export declare const isOriginatedError: (e?: unknown) => e is OriginatedError;
|
|
9
|
-
export declare const toOriginatedError: (e: unknown, options?: VerbOptions) => OriginatedError;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isError
|
|
3
|
-
} from "../chunk-DEJ7A5PY.mjs";
|
|
4
|
-
import "../chunk-4N72FQFX.mjs";
|
|
5
|
-
|
|
6
|
-
// src/http/OriginatedError.ts
|
|
7
|
-
var OriginatedError = class extends Error {
|
|
8
|
-
constructor(origin, options) {
|
|
9
|
-
super();
|
|
10
|
-
this.origin = origin;
|
|
11
|
-
this.options = options;
|
|
12
|
-
if (isError(origin))
|
|
13
|
-
this.stack = origin.stack;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var isOriginatedError = (e) => isError(e) && e instanceof OriginatedError;
|
|
17
|
-
var toOriginatedError = (e, options) => isOriginatedError(e) ? e : new OriginatedError(e, options);
|
|
18
|
-
export {
|
|
19
|
-
OriginatedError,
|
|
20
|
-
isOriginatedError,
|
|
21
|
-
toOriginatedError
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=OriginatedError.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/http/OriginatedError.ts"],"sourcesContent":["import { VerbOptions } from './Verb';\nimport { ErrorOrigin } from '../types/ErrorOrigin';\nimport { isError } from '../types/Is';\n\nexport class OriginatedError extends Error {\n constructor(\n readonly origin: ErrorOrigin,\n readonly options?: VerbOptions\n ) {\n super();\n if (isError(origin)) this.stack = origin.stack;\n }\n}\n\nexport const isOriginatedError = (e?: unknown): e is OriginatedError => isError(e) && e instanceof OriginatedError;\n\nexport const toOriginatedError = (e: unknown, options?: VerbOptions): OriginatedError =>\n isOriginatedError(e) ? e : new OriginatedError(e as ErrorOrigin, options);\n"],"mappings":";;;;;;AAIO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC,YACW,QACA,SACT;AACA,UAAM;AAHG;AACA;AAGT,QAAI,QAAQ,MAAM;AAAG,WAAK,QAAQ,OAAO;AAAA,EAC3C;AACF;AAEO,IAAM,oBAAoB,CAAC,MAAsC,QAAQ,CAAC,KAAK,aAAa;AAE5F,IAAM,oBAAoB,CAAC,GAAY,YAC5C,kBAAkB,CAAC,IAAI,IAAI,IAAI,gBAAgB,GAAkB,OAAO;","names":[]}
|
package/dist/http/Verb.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { HttpStatus } from './HttpStatus';
|
|
2
|
-
import { ContentType } from './ContentType';
|
|
3
|
-
import { CacheControl } from './CacheControl';
|
|
4
|
-
import { HttpVerb } from './HttpVerb';
|
|
5
|
-
export type VerbOptions = {
|
|
6
|
-
onOk?: HttpStatus;
|
|
7
|
-
onNotFound?: HttpStatus;
|
|
8
|
-
onError?: HttpStatus;
|
|
9
|
-
type?: ContentType;
|
|
10
|
-
cache?: CacheControl;
|
|
11
|
-
};
|
|
12
|
-
export type Verb = {
|
|
13
|
-
verb: HttpVerb;
|
|
14
|
-
options: VerbOptions;
|
|
15
|
-
};
|
|
16
|
-
export declare const toVerbOptions: (options?: VerbOptions) => Required<VerbOptions>;
|
|
17
|
-
export declare const get: (options?: VerbOptions) => PropertyDecorator;
|
|
18
|
-
export declare const search: (options?: VerbOptions) => PropertyDecorator;
|
|
19
|
-
export declare const put: (options?: VerbOptions) => PropertyDecorator;
|
|
20
|
-
export declare const patch: (options?: VerbOptions) => PropertyDecorator;
|
|
21
|
-
export declare const post: (options?: VerbOptions) => PropertyDecorator;
|
|
22
|
-
export declare const del: (options?: VerbOptions) => PropertyDecorator;
|
|
23
|
-
export declare const stream: (options?: VerbOptions) => PropertyDecorator;
|
package/dist/http/Verb.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
del,
|
|
3
|
-
get,
|
|
4
|
-
patch,
|
|
5
|
-
post,
|
|
6
|
-
put,
|
|
7
|
-
search,
|
|
8
|
-
stream,
|
|
9
|
-
toVerbOptions
|
|
10
|
-
} from "../chunk-JFJLDIJB.mjs";
|
|
11
|
-
import "../chunk-NFWIUPZU.mjs";
|
|
12
|
-
import "../chunk-NYYHRFBW.mjs";
|
|
13
|
-
import "../chunk-JBJ2YERG.mjs";
|
|
14
|
-
import "../chunk-4DJNTF2D.mjs";
|
|
15
|
-
import "../chunk-TMZRZLA2.mjs";
|
|
16
|
-
import "../chunk-LAR7AT6R.mjs";
|
|
17
|
-
import "../chunk-ARZEQQW5.mjs";
|
|
18
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
19
|
-
import "../chunk-CAHTK3AT.mjs";
|
|
20
|
-
import "../chunk-4G6AW6D6.mjs";
|
|
21
|
-
import "../chunk-J6KN572O.mjs";
|
|
22
|
-
import "../chunk-USGZFNWP.mjs";
|
|
23
|
-
import "../chunk-LYAPQ4QZ.mjs";
|
|
24
|
-
import "../chunk-6YVMQB26.mjs";
|
|
25
|
-
import "../chunk-FHW5K2RR.mjs";
|
|
26
|
-
import "../chunk-UNHWYQ54.mjs";
|
|
27
|
-
import "../chunk-PPWHEIZW.mjs";
|
|
28
|
-
import "../chunk-JTGB3TSZ.mjs";
|
|
29
|
-
import "../chunk-J7XKOXMW.mjs";
|
|
30
|
-
import "../chunk-JSON7A4X.mjs";
|
|
31
|
-
import "../chunk-X7FZPY3P.mjs";
|
|
32
|
-
import "../chunk-45GNHDKA.mjs";
|
|
33
|
-
import "../chunk-SJGQU3OG.mjs";
|
|
34
|
-
import "../chunk-ZHXKBOK2.mjs";
|
|
35
|
-
import "../chunk-ZPNFXK7Y.mjs";
|
|
36
|
-
import "../chunk-DXQSIBC7.mjs";
|
|
37
|
-
import "../chunk-PIRWVOO2.mjs";
|
|
38
|
-
import "../chunk-DEJ7A5PY.mjs";
|
|
39
|
-
import "../chunk-4N72FQFX.mjs";
|
|
40
|
-
export {
|
|
41
|
-
del,
|
|
42
|
-
get,
|
|
43
|
-
patch,
|
|
44
|
-
post,
|
|
45
|
-
put,
|
|
46
|
-
search,
|
|
47
|
-
stream,
|
|
48
|
-
toVerbOptions
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=Verb.mjs.map
|
package/dist/http/Verb.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Resource } from './Resource';
|
|
2
|
-
import { Service } from './Service';
|
|
3
|
-
import { Func } from '../types/Func';
|
|
4
|
-
export type Handler = Func<void, any>;
|
|
5
|
-
export interface AppProvider {
|
|
6
|
-
use: (h: Handler) => void;
|
|
7
|
-
route: (s: Service, r: Resource) => void;
|
|
8
|
-
listen: (port: number, message?: string) => void;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=AppProvider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Scope } from '../process/Scope';
|
|
2
|
-
import { UseCase } from '../process/UseCase';
|
|
3
|
-
export declare class Requires {
|
|
4
|
-
readonly labCoat: () => PropertyDecorator;
|
|
5
|
-
readonly token: () => PropertyDecorator;
|
|
6
|
-
readonly scope: (scope: Scope) => PropertyDecorator;
|
|
7
|
-
readonly useCase: (uc: UseCase) => PropertyDecorator;
|
|
8
|
-
}
|
|
9
|
-
export declare const requires: Requires;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "../chunk-PPWHEIZW.mjs";
|
|
4
|
-
import "../chunk-JTGB3TSZ.mjs";
|
|
5
|
-
import "../chunk-J7XKOXMW.mjs";
|
|
6
|
-
import "../chunk-JSON7A4X.mjs";
|
|
7
|
-
import "../chunk-X7FZPY3P.mjs";
|
|
8
|
-
import "../chunk-45GNHDKA.mjs";
|
|
9
|
-
import "../chunk-SJGQU3OG.mjs";
|
|
10
|
-
import "../chunk-ZHXKBOK2.mjs";
|
|
11
|
-
import "../chunk-ZPNFXK7Y.mjs";
|
|
12
|
-
import "../chunk-DXQSIBC7.mjs";
|
|
13
|
-
import "../chunk-PIRWVOO2.mjs";
|
|
14
|
-
import "../chunk-DEJ7A5PY.mjs";
|
|
15
|
-
import "../chunk-4N72FQFX.mjs";
|
|
16
|
-
|
|
17
|
-
// src/resources/Requires.ts
|
|
18
|
-
var Requires = class {
|
|
19
|
-
labCoat = () => (subject, property) => {
|
|
20
|
-
meta(subject).property(property).set("labCoat", true);
|
|
21
|
-
};
|
|
22
|
-
token = () => (subject, property) => {
|
|
23
|
-
meta(subject).property(property).set("token", true);
|
|
24
|
-
};
|
|
25
|
-
scope = (scope) => (subject, property) => {
|
|
26
|
-
meta(subject).property(property).set("token", true);
|
|
27
|
-
meta(subject).property(property).set("scope", scope);
|
|
28
|
-
};
|
|
29
|
-
useCase = (uc) => (subject, property) => {
|
|
30
|
-
meta(subject).property(property).set("token", true);
|
|
31
|
-
meta(subject).property(property).set("uc", uc);
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
var requires = new Requires();
|
|
35
|
-
export {
|
|
36
|
-
Requires,
|
|
37
|
-
requires
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=Requires.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/resources/Requires.ts"],"sourcesContent":["import { meta } from '../types/Meta';\nimport { Scope } from '../process/Scope';\nimport { UseCase } from '../process/UseCase';\n\nexport class Requires {\n readonly labCoat =\n (): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n meta(subject).property(property).set('labCoat', true);\n };\n\n readonly token =\n (): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n meta(subject).property(property).set('token', true);\n };\n\n readonly scope =\n (scope: Scope): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n meta(subject).property(property).set('token', true);\n meta(subject).property(property).set('scope', scope);\n };\n\n readonly useCase =\n (uc: UseCase): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n meta(subject).property(property).set('token', true);\n meta(subject).property(property).set('uc', uc);\n };\n}\n\nexport const requires = new Requires();\n"],"mappings":";;;;;;;;;;;;;;;;;AAIO,IAAM,WAAN,MAAe;AAAA,EACX,UACP,MACA,CAAC,SAAkB,aAAoC;AACrD,SAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAI,WAAW,IAAI;AAAA,EACtD;AAAA,EAEO,QACP,MACA,CAAC,SAAkB,aAAoC;AACrD,SAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAI,SAAS,IAAI;AAAA,EACpD;AAAA,EAEO,QACP,CAAC,UACD,CAAC,SAAkB,aAAoC;AACrD,SAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAI,SAAS,IAAI;AAClD,SAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAI,SAAS,KAAK;AAAA,EACrD;AAAA,EAEO,UACP,CAAC,OACD,CAAC,SAAkB,aAAoC;AACrD,SAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAI,SAAS,IAAI;AAClD,SAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAI,MAAM,EAAE;AAAA,EAC/C;AACJ;AAEO,IAAM,WAAW,IAAI,SAAS;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Resource = any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=Resource.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Req } from './Req';
|
|
2
|
-
import { Resource } from './Resource';
|
|
3
|
-
import { RequestHandler } from 'express';
|
|
4
|
-
import { Uri } from '../types/Uri';
|
|
5
|
-
import { List } from '../types/List';
|
|
6
|
-
import { Scope } from '../process/Scope';
|
|
7
|
-
import { UseCase } from '../process/UseCase';
|
|
8
|
-
import { Verb } from '../http/Verb';
|
|
9
|
-
export declare const route: (uri: Uri) => ClassDecorator;
|
|
10
|
-
export type Endpoint<T = unknown> = (re: Req) => Promise<T | List<T>>;
|
|
11
|
-
export type RouteRequires = {
|
|
12
|
-
token: boolean;
|
|
13
|
-
labCoat: boolean;
|
|
14
|
-
scope?: Scope;
|
|
15
|
-
uc?: UseCase;
|
|
16
|
-
};
|
|
17
|
-
export type Route = {
|
|
18
|
-
verb: Verb;
|
|
19
|
-
endpoint: Endpoint;
|
|
20
|
-
requires: RouteRequires;
|
|
21
|
-
middleware: RequestHandler[];
|
|
22
|
-
};
|
|
23
|
-
export type Routes = {
|
|
24
|
-
route: Uri;
|
|
25
|
-
middleware: RequestHandler[];
|
|
26
|
-
endpoints: List<Route>;
|
|
27
|
-
};
|
|
28
|
-
export declare const routes: (resource: Resource) => Routes;
|
package/dist/resources/Route.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
route,
|
|
3
|
-
routes
|
|
4
|
-
} from "../chunk-EIJ3GSGG.mjs";
|
|
5
|
-
import "../chunk-ARZEQQW5.mjs";
|
|
6
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
7
|
-
import "../chunk-CAHTK3AT.mjs";
|
|
8
|
-
import "../chunk-4G6AW6D6.mjs";
|
|
9
|
-
import "../chunk-J6KN572O.mjs";
|
|
10
|
-
import "../chunk-USGZFNWP.mjs";
|
|
11
|
-
import "../chunk-LYAPQ4QZ.mjs";
|
|
12
|
-
import "../chunk-6YVMQB26.mjs";
|
|
13
|
-
import "../chunk-FHW5K2RR.mjs";
|
|
14
|
-
import "../chunk-UNHWYQ54.mjs";
|
|
15
|
-
import "../chunk-PPWHEIZW.mjs";
|
|
16
|
-
import "../chunk-JTGB3TSZ.mjs";
|
|
17
|
-
import "../chunk-J7XKOXMW.mjs";
|
|
18
|
-
import "../chunk-JSON7A4X.mjs";
|
|
19
|
-
import "../chunk-X7FZPY3P.mjs";
|
|
20
|
-
import "../chunk-45GNHDKA.mjs";
|
|
21
|
-
import "../chunk-SJGQU3OG.mjs";
|
|
22
|
-
import "../chunk-ZHXKBOK2.mjs";
|
|
23
|
-
import "../chunk-ZPNFXK7Y.mjs";
|
|
24
|
-
import "../chunk-DXQSIBC7.mjs";
|
|
25
|
-
import "../chunk-PIRWVOO2.mjs";
|
|
26
|
-
import "../chunk-DEJ7A5PY.mjs";
|
|
27
|
-
import "../chunk-4N72FQFX.mjs";
|
|
28
|
-
export {
|
|
29
|
-
route,
|
|
30
|
-
routes
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=Route.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|