@thisisagile/easy 18.6.0 → 18.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-34COXZ5A.mjs → chunk-5N6Q7OXJ.mjs} +3 -3
- package/dist/{chunk-ZBVKM7WT.mjs → chunk-63DTRTSC.mjs} +4 -8
- package/dist/{chunk-ZBVKM7WT.mjs.map → chunk-63DTRTSC.mjs.map} +1 -1
- package/dist/{chunk-U3NVU37K.mjs → chunk-6PMTGQVO.mjs} +3 -3
- package/dist/{chunk-ISRJB7Z4.mjs → chunk-6YTIRHPN.mjs} +4 -6
- package/dist/{chunk-ISRJB7Z4.mjs.map → chunk-6YTIRHPN.mjs.map} +1 -1
- package/dist/{chunk-KXNGKB2N.mjs → chunk-7TW4TBFN.mjs} +8 -16
- package/dist/{chunk-KXNGKB2N.mjs.map → chunk-7TW4TBFN.mjs.map} +1 -1
- package/dist/{chunk-GOZMSSH5.mjs → chunk-AYR4US3Z.mjs} +2 -2
- package/dist/{chunk-6MBDCDGA.mjs → chunk-B37NZCNW.mjs} +2 -2
- package/dist/{chunk-H73MZAGT.mjs → chunk-FF3BNZ4H.mjs} +3 -5
- package/dist/{chunk-H73MZAGT.mjs.map → chunk-FF3BNZ4H.mjs.map} +1 -1
- package/dist/{chunk-WWYPWYFC.mjs → chunk-FFD2T6YV.mjs} +2 -2
- package/dist/{chunk-GV6NUD6R.mjs → chunk-FSWASMJZ.mjs} +2 -2
- package/dist/{chunk-TRR2LTWJ.mjs → chunk-GF7JYGJU.mjs} +4 -8
- package/dist/{chunk-TRR2LTWJ.mjs.map → chunk-GF7JYGJU.mjs.map} +1 -1
- package/dist/{chunk-LPT6LW5N.mjs → chunk-GKQMIKIY.mjs} +2 -2
- package/dist/{chunk-C6VQGKDB.mjs → chunk-IESVFCB3.mjs} +3 -3
- package/dist/{chunk-JZCNZKGP.mjs → chunk-IYUYA5OX.mjs} +5 -5
- package/dist/{chunk-SW73SKB2.mjs → chunk-J5PB7ZVO.mjs} +4 -6
- package/dist/{chunk-SW73SKB2.mjs.map → chunk-J5PB7ZVO.mjs.map} +1 -1
- package/dist/{chunk-V6TMXDF7.mjs → chunk-JI7MC5EA.mjs} +2 -2
- package/dist/{chunk-GMFUUU3V.mjs → chunk-JM6NAJQ3.mjs} +4 -6
- package/dist/{chunk-GMFUUU3V.mjs.map → chunk-JM6NAJQ3.mjs.map} +1 -1
- package/dist/{chunk-2SE4U4T2.mjs → chunk-JNZUGKMO.mjs} +2 -2
- package/dist/{chunk-MLYUI7R7.mjs → chunk-KPXOQFEB.mjs} +4 -6
- package/dist/{chunk-MLYUI7R7.mjs.map → chunk-KPXOQFEB.mjs.map} +1 -1
- package/dist/{chunk-FAFNTQIS.mjs → chunk-LHDTOERW.mjs} +3 -5
- package/dist/{chunk-FAFNTQIS.mjs.map → chunk-LHDTOERW.mjs.map} +1 -1
- package/dist/{chunk-CFJJ2C6C.mjs → chunk-M2S4OLVZ.mjs} +2 -2
- package/dist/{chunk-SW5NBVHL.mjs → chunk-O4RWZGFC.mjs} +4 -6
- package/dist/{chunk-SW5NBVHL.mjs.map → chunk-O4RWZGFC.mjs.map} +1 -1
- package/dist/{chunk-ZEIIFJDX.mjs → chunk-QBPSI5NM.mjs} +4 -4
- package/dist/{chunk-HBDIZSIE.mjs → chunk-QLEGIYVU.mjs} +3 -5
- package/dist/{chunk-HBDIZSIE.mjs.map → chunk-QLEGIYVU.mjs.map} +1 -1
- package/dist/{chunk-DUYHH6LC.mjs → chunk-QZPBFVZL.mjs} +2 -2
- package/dist/{chunk-YXLGHJ5Q.mjs → chunk-RBJBAJOK.mjs} +2 -2
- package/dist/{chunk-5C5OHGRW.mjs → chunk-RW4AKBCN.mjs} +3 -3
- package/dist/{chunk-5FD5G442.mjs → chunk-SBT3WGBP.mjs} +7 -7
- package/dist/{chunk-USR4ETA7.mjs → chunk-TNIG6FU2.mjs} +2 -2
- package/dist/{chunk-5BGTUK7G.mjs → chunk-TUO7ZPSP.mjs} +540 -104
- package/dist/chunk-TUO7ZPSP.mjs.map +1 -0
- package/dist/{chunk-UATZAAX2.mjs → chunk-WOUH6UVC.mjs} +3 -5
- package/dist/{chunk-UATZAAX2.mjs.map → chunk-WOUH6UVC.mjs.map} +1 -1
- package/dist/{chunk-5MCJXABA.mjs → chunk-XQJ5LQEQ.mjs} +2 -2
- package/dist/{chunk-5JE4QW4E.mjs → chunk-ZBOGLMG2.mjs} +4 -4
- package/dist/{chunk-UGNNHNYX.mjs → chunk-ZRH6FGUK.mjs} +4 -4
- package/dist/{chunk-LCJEJ3LU.mjs → chunk-ZZ73Z5CU.mjs} +2 -2
- package/dist/data/Condition.mjs +5 -4
- package/dist/data/Database.mjs +4 -5
- package/dist/data/Field.mjs +5 -4
- package/dist/data/Field.mjs.map +1 -1
- package/dist/data/InMemoryGateway.mjs +4 -9
- package/dist/data/InMemoryGateway.mjs.map +1 -1
- package/dist/domain/Audit.mjs +8 -13
- package/dist/domain/Child.mjs +5 -10
- package/dist/domain/Child.mjs.map +1 -1
- package/dist/domain/DateTime.mjs +4 -9
- package/dist/domain/Entity.mjs +8 -13
- package/dist/domain/Entity.mjs.map +1 -1
- package/dist/domain/Repo.mjs +7 -14
- package/dist/domain/Repo.mjs.map +1 -1
- package/dist/domain/Struct.mjs +4 -9
- package/dist/domain/Typo.mjs +4 -9
- package/dist/domain/Typo.mjs.map +1 -1
- package/dist/http/CacheControl.mjs +6 -12
- package/dist/http/CacheControl.mjs.map +1 -1
- package/dist/http/ContentType.mjs +4 -5
- package/dist/http/HttpStatus.mjs +4 -5
- package/dist/http/HttpVerb.mjs +4 -5
- package/dist/http/LocalRequestStore.mjs +2 -7
- package/dist/http/LocalRequestStore.mjs.map +1 -1
- package/dist/http/RequestOptions.mjs +4 -9
- package/dist/http/RestResult.mjs +4 -9
- package/dist/http/toResponse.mjs +5 -10
- package/dist/index.js +528 -523
- package/dist/index.js.map +1 -1
- package/dist/process/App.mjs +3 -8
- package/dist/process/App.mjs.map +1 -1
- package/dist/process/Manage.mjs +4 -9
- package/dist/process/Manage.mjs.map +1 -1
- package/dist/process/Scope.mjs +3 -8
- package/dist/process/Search.mjs +4 -9
- package/dist/process/UseCase.mjs +5 -12
- package/dist/process/UseCase.mjs.map +1 -1
- package/dist/resources/Req.mjs +4 -9
- package/dist/resources/Req.mjs.map +1 -1
- package/dist/services/Api.mjs +12 -17
- package/dist/services/ApiGateway.mjs +15 -20
- package/dist/services/AxiosProvider.mjs +10 -15
- package/dist/services/MappedRouteGateway.mjs +18 -23
- package/dist/services/MappedRouteGateway.mjs.map +1 -1
- package/dist/services/RouteGateway.mjs +16 -21
- package/dist/services/ViewRouteGateway.mjs +18 -24
- package/dist/services/ViewRouteGateway.mjs.map +1 -1
- package/dist/sql/Column.mjs +3 -8
- package/dist/sql/Count.mjs +6 -4
- package/dist/sql/Delete.mjs +5 -3
- package/dist/sql/Insert.mjs +5 -3
- package/dist/sql/Select.mjs +5 -3
- package/dist/sql/SqlQuery.mjs +4 -2
- package/dist/sql/Table.mjs +13 -18
- package/dist/sql/Table.mjs.map +1 -1
- package/dist/sql/TableGateway.mjs +5 -11
- package/dist/sql/TableGateway.mjs.map +1 -1
- package/dist/sql/Update.mjs +5 -3
- package/dist/types/Cache.mjs +3 -3
- package/dist/types/CacheAge.mjs +4 -9
- package/dist/types/Case.mjs +2 -7
- package/dist/types/Context.mjs +2 -7
- package/dist/types/Enum.mjs +3 -4
- package/dist/types/Environment.mjs +3 -4
- package/dist/types/Environment.mjs.map +1 -1
- package/dist/types/Exception.mjs +2 -7
- package/dist/types/Gateway.mjs +3 -8
- package/dist/types/IsEqual.mjs +2 -8
- package/dist/types/Json.mjs +4 -3
- package/dist/types/List.mjs +3 -1
- package/dist/types/Meta.mjs +3 -3
- package/dist/types/Number.mjs +3 -8
- package/dist/types/Object.mjs +3 -2
- package/dist/types/PageList.mjs +3 -8
- package/dist/types/Parser.mjs +2 -7
- package/dist/types/Parser.mjs.map +1 -1
- package/dist/types/Repository.mjs +3 -8
- package/dist/types/Result.mjs +2 -7
- package/dist/types/Results.mjs +2 -7
- package/dist/types/Tag.mjs +3 -3
- package/dist/types/Template.mjs +2 -7
- package/dist/types/ToText.mjs +2 -7
- package/dist/types/Try.mjs +2 -7
- package/dist/types/Uri.mjs +5 -13
- package/dist/types/Uri.mjs.map +1 -1
- package/dist/utils/If.d.ts +2 -0
- package/dist/utils/If.mjs +5 -1
- package/dist/utils/Mapper.mjs +5 -5
- package/dist/utils/Period.mjs +4 -9
- package/dist/utils/Period.mjs.map +1 -1
- package/dist/utils/Promise.mjs +3 -3
- package/dist/utils/Seconds.mjs +4 -2
- package/dist/utils/Sentence.mjs +2 -7
- package/dist/utils/Sentence.mjs.map +1 -1
- package/dist/utils/View.mjs +5 -11
- package/dist/validation/Contraints.mjs +3 -8
- package/dist/validation/Validate.mjs +2 -7
- package/dist/validation/When.mjs +2 -7
- package/package.json +1 -1
- package/src/utils/If.ts +7 -0
- package/dist/chunk-2PL5VUHT.mjs +0 -37
- package/dist/chunk-2PL5VUHT.mjs.map +0 -1
- package/dist/chunk-5BGTUK7G.mjs.map +0 -1
- package/dist/chunk-5FAZA55F.mjs +0 -58
- package/dist/chunk-5FAZA55F.mjs.map +0 -1
- package/dist/chunk-7A3RM67L.mjs +0 -68
- package/dist/chunk-7A3RM67L.mjs.map +0 -1
- package/dist/chunk-AJZIKJEC.mjs +0 -54
- package/dist/chunk-AJZIKJEC.mjs.map +0 -1
- package/dist/chunk-AQXV7L65.mjs +0 -310
- package/dist/chunk-AQXV7L65.mjs.map +0 -1
- package/dist/chunk-DC5HIBQG.mjs +0 -23
- package/dist/chunk-DC5HIBQG.mjs.map +0 -1
- /package/dist/{chunk-34COXZ5A.mjs.map → chunk-5N6Q7OXJ.mjs.map} +0 -0
- /package/dist/{chunk-U3NVU37K.mjs.map → chunk-6PMTGQVO.mjs.map} +0 -0
- /package/dist/{chunk-GOZMSSH5.mjs.map → chunk-AYR4US3Z.mjs.map} +0 -0
- /package/dist/{chunk-6MBDCDGA.mjs.map → chunk-B37NZCNW.mjs.map} +0 -0
- /package/dist/{chunk-WWYPWYFC.mjs.map → chunk-FFD2T6YV.mjs.map} +0 -0
- /package/dist/{chunk-GV6NUD6R.mjs.map → chunk-FSWASMJZ.mjs.map} +0 -0
- /package/dist/{chunk-LPT6LW5N.mjs.map → chunk-GKQMIKIY.mjs.map} +0 -0
- /package/dist/{chunk-C6VQGKDB.mjs.map → chunk-IESVFCB3.mjs.map} +0 -0
- /package/dist/{chunk-JZCNZKGP.mjs.map → chunk-IYUYA5OX.mjs.map} +0 -0
- /package/dist/{chunk-V6TMXDF7.mjs.map → chunk-JI7MC5EA.mjs.map} +0 -0
- /package/dist/{chunk-2SE4U4T2.mjs.map → chunk-JNZUGKMO.mjs.map} +0 -0
- /package/dist/{chunk-CFJJ2C6C.mjs.map → chunk-M2S4OLVZ.mjs.map} +0 -0
- /package/dist/{chunk-ZEIIFJDX.mjs.map → chunk-QBPSI5NM.mjs.map} +0 -0
- /package/dist/{chunk-DUYHH6LC.mjs.map → chunk-QZPBFVZL.mjs.map} +0 -0
- /package/dist/{chunk-YXLGHJ5Q.mjs.map → chunk-RBJBAJOK.mjs.map} +0 -0
- /package/dist/{chunk-5C5OHGRW.mjs.map → chunk-RW4AKBCN.mjs.map} +0 -0
- /package/dist/{chunk-5FD5G442.mjs.map → chunk-SBT3WGBP.mjs.map} +0 -0
- /package/dist/{chunk-USR4ETA7.mjs.map → chunk-TNIG6FU2.mjs.map} +0 -0
- /package/dist/{chunk-5MCJXABA.mjs.map → chunk-XQJ5LQEQ.mjs.map} +0 -0
- /package/dist/{chunk-5JE4QW4E.mjs.map → chunk-ZBOGLMG2.mjs.map} +0 -0
- /package/dist/{chunk-UGNNHNYX.mjs.map → chunk-ZRH6FGUK.mjs.map} +0 -0
- /package/dist/{chunk-LCJEJ3LU.mjs.map → chunk-ZZ73Z5CU.mjs.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6YTIRHPN.mjs";
|
|
4
4
|
import {
|
|
5
5
|
toHttpStatus
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FSWASMJZ.mjs";
|
|
7
7
|
|
|
8
8
|
// src/http/toResponse.ts
|
|
9
9
|
function toResponse(status, body, headers) {
|
|
@@ -17,4 +17,4 @@ function toResponse(status, body, headers) {
|
|
|
17
17
|
export {
|
|
18
18
|
toResponse
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-5N6Q7OXJ.mjs.map
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
Enum
|
|
6
|
-
} from "./chunk-7A3RM67L.mjs";
|
|
7
|
-
import {
|
|
2
|
+
Enum,
|
|
3
|
+
text,
|
|
8
4
|
toList
|
|
9
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
10
6
|
import {
|
|
11
7
|
kebab
|
|
12
8
|
} from "./chunk-4Q6IHSAU.mjs";
|
|
@@ -36,4 +32,4 @@ var Scope = class _Scope extends Enum {
|
|
|
36
32
|
export {
|
|
37
33
|
Scope
|
|
38
34
|
};
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-63DTRTSC.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/process/Scope.ts"],"sourcesContent":["import { Enum } from '../types/Enum';\nimport type { Text } from '../types/Text';\nimport { kebab } from '../types/Text';\nimport { List, toList } from '../types/List';\nimport { isString } from '../types/Is';\nimport { IdNamePlain } from '../types/IdName';\nimport { text } from '../types/ToText';\n\nexport class Scope extends Enum {\n protected constructor(\n readonly name: string,\n id: Text = text(name).kebab,\n readonly subs: List<Scope> = toList()\n ) {\n super(name, id.toString());\n }\n\n for(item: string | IdNamePlain): Scope {\n return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));\n }\n\n combines(...scopes: Scope[]): this {\n this.subs.add(scopes);\n return this;\n }\n\n expand(): List<Scope> {\n return this.subs\n .flatMap(s => s.expand())\n .add(this)\n .distinct();\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/process/Scope.ts"],"sourcesContent":["import { Enum } from '../types/Enum';\nimport type { Text } from '../types/Text';\nimport { kebab } from '../types/Text';\nimport { List, toList } from '../types/List';\nimport { isString } from '../types/Is';\nimport { IdNamePlain } from '../types/IdName';\nimport { text } from '../types/ToText';\n\nexport class Scope extends Enum {\n protected constructor(\n readonly name: string,\n id: Text = text(name).kebab,\n readonly subs: List<Scope> = toList()\n ) {\n super(name, id.toString());\n }\n\n for(item: string | IdNamePlain): Scope {\n return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));\n }\n\n combines(...scopes: Scope[]): this {\n this.subs.add(scopes);\n return this;\n }\n\n expand(): List<Scope> {\n return this.subs\n .flatMap(s => s.expand())\n .add(this)\n .distinct();\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAQO,IAAM,QAAN,MAAM,eAAc,KAAK;AAAA,EACpB,YACC,MACT,KAAW,KAAK,IAAI,EAAE,OACb,OAAoB,OAAO,GACpC;AACA,UAAM,MAAM,GAAG,SAAS,CAAC;AAJhB;AAEA;AAAA,EAGX;AAAA,EAEA,IAAI,MAAmC;AACrC,WAAO,IAAI,OAAM,GAAG,KAAK,IAAI,IAAI,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,QAAQ,KAAK,IAAI,IAAI,MAAM,GAAG,KAAK,EAAE,IAAI,SAAS,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;AAAA,EAC1I;AAAA,EAEA,YAAY,QAAuB;AACjC,SAAK,KAAK,IAAI,MAAM;AACpB,WAAO;AAAA,EACT;AAAA,EAEA,SAAsB;AACpB,WAAO,KAAK,KACT,QAAQ,OAAK,EAAE,OAAO,CAAC,EACvB,IAAI,IAAI,EACR,SAAS;AAAA,EACd;AACF;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SqlQuery
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B37NZCNW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
toList
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ifGet
|
|
9
9
|
} from "./chunk-SJGQU3OG.mjs";
|
|
@@ -51,4 +51,4 @@ var Select = class extends SqlQuery {
|
|
|
51
51
|
export {
|
|
52
52
|
Select
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-6PMTGQVO.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HttpStatus,
|
|
3
3
|
isHttpStatus
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FSWASMJZ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
isResponse
|
|
7
7
|
} from "./chunk-WYLKFMFD.mjs";
|
|
@@ -9,11 +9,9 @@ import {
|
|
|
9
9
|
choose,
|
|
10
10
|
isResult,
|
|
11
11
|
isResults,
|
|
12
|
+
toList,
|
|
12
13
|
toResult
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
toList
|
|
16
|
-
} from "./chunk-AQXV7L65.mjs";
|
|
14
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
17
15
|
import {
|
|
18
16
|
isDefined,
|
|
19
17
|
isError
|
|
@@ -48,4 +46,4 @@ export {
|
|
|
48
46
|
rest,
|
|
49
47
|
isRestResult
|
|
50
48
|
};
|
|
51
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-6YTIRHPN.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/http/RestResult.ts"],"sourcesContent":["import { HttpStatus, isHttpStatus } from './HttpStatus';\nimport { isResponse } from './Response';\nimport { List, toList } from '../types/List';\nimport { Json } from '../types/Json';\nimport { isResult, Result, toResult } from '../types/Result';\nimport { isDefined, isError } from '../types/Is';\nimport { choose } from '../types/Case';\nimport { isResults } from '../types/Results';\nimport { Id } from '../types/Id';\n\nexport type RestResult = {\n data?: { code: number; items: List<Json>; itemCount: number; totalItems?: number; meta?: Json };\n error?: { code: number; message: string; errorCount: number; errors: List<Result> };\n};\n\nconst hasErrors = (a: any): a is { error: { code: number; errors: List<Result> } } => isDefined(a?.error?.errors);\nconst hasItems = (a: any): a is { data: { code: number; items: List<Json>; totalItems?: number; meta?: Json } } => isDefined(a?.data.items);\n\nexport const rest = {\n toData: (status: HttpStatus, items: Json[] = [], totalItems?: number, meta?: Json): RestResult => ({\n data: {\n code: status.status,\n items: toList(items),\n itemCount: items.length,\n totalItems,\n meta,\n },\n }),\n toError: (status: HttpStatus, errors: Result[] = [toResult(status.name)]): RestResult => ({\n error: {\n code: status.status,\n message: status.name ?? errors[0].message ?? 'Unknown',\n errors: toList(errors),\n errorCount: errors.length,\n },\n }),\n to: (payload?: any | any[], status?: HttpStatus): RestResult =>\n choose(payload)\n .is.not.defined(p => p, undefined as unknown as RestResult)\n .type(isHttpStatus, h => rest.toError(h ?? status ?? HttpStatus.InternalServerError, [toResult(h.name)]))\n .type(isResult, r => rest.toError(status ?? HttpStatus.BadRequest, [r]))\n .type(isError, e => rest.toError(status ?? HttpStatus.BadRequest, [e]))\n .type(isResults, r => rest.toError(status ?? HttpStatus.BadRequest, r.results))\n .type(isResponse, r => rest.toError(status ?? HttpStatus.byId(r.body.error?.code as Id), r.body.error?.errors))\n .type(hasErrors, e => rest.toError(status ?? HttpStatus.byId(e.error.code, HttpStatus.BadRequest), e.error.errors))\n .type(hasItems, d => rest.toData(status ?? HttpStatus.byId(d.data.code, HttpStatus.Ok), d.data.items, d.data.totalItems, d.data.meta))\n .else(p => rest.toData(status ?? HttpStatus.Ok, toList(p))),\n};\n\nexport const isRestResult = (r: unknown): r is RestResult => isDefined(r) && (isDefined((r as RestResult).data) || isDefined((r as RestResult).error));\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/http/RestResult.ts"],"sourcesContent":["import { HttpStatus, isHttpStatus } from './HttpStatus';\nimport { isResponse } from './Response';\nimport { List, toList } from '../types/List';\nimport { Json } from '../types/Json';\nimport { isResult, Result, toResult } from '../types/Result';\nimport { isDefined, isError } from '../types/Is';\nimport { choose } from '../types/Case';\nimport { isResults } from '../types/Results';\nimport { Id } from '../types/Id';\n\nexport type RestResult = {\n data?: { code: number; items: List<Json>; itemCount: number; totalItems?: number; meta?: Json };\n error?: { code: number; message: string; errorCount: number; errors: List<Result> };\n};\n\nconst hasErrors = (a: any): a is { error: { code: number; errors: List<Result> } } => isDefined(a?.error?.errors);\nconst hasItems = (a: any): a is { data: { code: number; items: List<Json>; totalItems?: number; meta?: Json } } => isDefined(a?.data.items);\n\nexport const rest = {\n toData: (status: HttpStatus, items: Json[] = [], totalItems?: number, meta?: Json): RestResult => ({\n data: {\n code: status.status,\n items: toList(items),\n itemCount: items.length,\n totalItems,\n meta,\n },\n }),\n toError: (status: HttpStatus, errors: Result[] = [toResult(status.name)]): RestResult => ({\n error: {\n code: status.status,\n message: status.name ?? errors[0].message ?? 'Unknown',\n errors: toList(errors),\n errorCount: errors.length,\n },\n }),\n to: (payload?: any | any[], status?: HttpStatus): RestResult =>\n choose(payload)\n .is.not.defined(p => p, undefined as unknown as RestResult)\n .type(isHttpStatus, h => rest.toError(h ?? status ?? HttpStatus.InternalServerError, [toResult(h.name)]))\n .type(isResult, r => rest.toError(status ?? HttpStatus.BadRequest, [r]))\n .type(isError, e => rest.toError(status ?? HttpStatus.BadRequest, [e]))\n .type(isResults, r => rest.toError(status ?? HttpStatus.BadRequest, r.results))\n .type(isResponse, r => rest.toError(status ?? HttpStatus.byId(r.body.error?.code as Id), r.body.error?.errors))\n .type(hasErrors, e => rest.toError(status ?? HttpStatus.byId(e.error.code, HttpStatus.BadRequest), e.error.errors))\n .type(hasItems, d => rest.toData(status ?? HttpStatus.byId(d.data.code, HttpStatus.Ok), d.data.items, d.data.totalItems, d.data.meta))\n .else(p => rest.toData(status ?? HttpStatus.Ok, toList(p))),\n};\n\nexport const isRestResult = (r: unknown): r is RestResult => isDefined(r) && (isDefined((r as RestResult).data) || isDefined((r as RestResult).error));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAeA,IAAM,YAAY,CAAC,MAAmE,UAAU,GAAG,OAAO,MAAM;AAChH,IAAM,WAAW,CAAC,MAAiG,UAAU,GAAG,KAAK,KAAK;AAEnI,IAAM,OAAO;AAAA,EAClB,QAAQ,CAAC,QAAoB,QAAgB,CAAC,GAAG,YAAqB,UAA6B;AAAA,IACjG,MAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,OAAO,OAAO,KAAK;AAAA,MACnB,WAAW,MAAM;AAAA,MACjB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,SAAS,CAAC,QAAoB,SAAmB,CAAC,SAAS,OAAO,IAAI,CAAC,OAAmB;AAAA,IACxF,OAAO;AAAA,MACL,MAAM,OAAO;AAAA,MACb,SAAS,OAAO,QAAQ,OAAO,CAAC,EAAE,WAAW;AAAA,MAC7C,QAAQ,OAAO,MAAM;AAAA,MACrB,YAAY,OAAO;AAAA,IACrB;AAAA,EACF;AAAA,EACA,IAAI,CAAC,SAAuB,WAC1B,OAAO,OAAO,EACX,GAAG,IAAI,QAAQ,OAAK,GAAG,MAAkC,EACzD,KAAK,cAAc,OAAK,KAAK,QAAQ,KAAK,UAAU,WAAW,qBAAqB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,EACvG,KAAK,UAAU,OAAK,KAAK,QAAQ,UAAU,WAAW,YAAY,CAAC,CAAC,CAAC,CAAC,EACtE,KAAK,SAAS,OAAK,KAAK,QAAQ,UAAU,WAAW,YAAY,CAAC,CAAC,CAAC,CAAC,EACrE,KAAK,WAAW,OAAK,KAAK,QAAQ,UAAU,WAAW,YAAY,EAAE,OAAO,CAAC,EAC7E,KAAK,YAAY,OAAK,KAAK,QAAQ,UAAU,WAAW,KAAK,EAAE,KAAK,OAAO,IAAU,GAAG,EAAE,KAAK,OAAO,MAAM,CAAC,EAC7G,KAAK,WAAW,OAAK,KAAK,QAAQ,UAAU,WAAW,KAAK,EAAE,MAAM,MAAM,WAAW,UAAU,GAAG,EAAE,MAAM,MAAM,CAAC,EACjH,KAAK,UAAU,OAAK,KAAK,OAAO,UAAU,WAAW,KAAK,EAAE,KAAK,MAAM,WAAW,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,IAAI,CAAC,EACpI,KAAK,OAAK,KAAK,OAAO,UAAU,WAAW,IAAI,OAAO,CAAC,CAAC,CAAC;AAChE;AAEO,IAAM,eAAe,CAAC,MAAgC,UAAU,CAAC,MAAM,UAAW,EAAiB,IAAI,KAAK,UAAW,EAAiB,KAAK;","names":[]}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isEqual
|
|
3
|
-
} from "./chunk-DC5HIBQG.mjs";
|
|
4
1
|
import {
|
|
5
2
|
isPageList,
|
|
6
3
|
toPageList
|
|
7
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QLEGIYVU.mjs";
|
|
8
5
|
import {
|
|
9
6
|
asJson,
|
|
10
7
|
json
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
choose
|
|
14
|
-
} from "./chunk-5BGTUK7G.mjs";
|
|
15
|
-
import {
|
|
16
|
-
isEnumConstructor
|
|
17
|
-
} from "./chunk-7A3RM67L.mjs";
|
|
8
|
+
} from "./chunk-WOUH6UVC.mjs";
|
|
18
9
|
import {
|
|
10
|
+
choose,
|
|
11
|
+
ifDefined,
|
|
12
|
+
isEnumConstructor,
|
|
13
|
+
isEqual,
|
|
19
14
|
meta
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
ifDefined
|
|
23
|
-
} from "./chunk-AQXV7L65.mjs";
|
|
15
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
24
16
|
import {
|
|
25
17
|
traverse
|
|
26
18
|
} from "./chunk-SSROJBD5.mjs";
|
|
@@ -113,4 +105,4 @@ export {
|
|
|
113
105
|
view,
|
|
114
106
|
views
|
|
115
107
|
};
|
|
116
|
-
//# sourceMappingURL=chunk-
|
|
108
|
+
//# sourceMappingURL=chunk-7TW4TBFN.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/View.ts"],"sourcesContent":["import { traverse } from './Traverse';\nimport { ifDefined } from './If';\nimport { Primitive } from '../types/Primitive';\nimport { Constructor, isConstructor, use } from '../types/Constructor';\nimport { asJson, json as typesJson } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { isArray, isBoolean, isFunction, isString } from '../types/Is';\nimport { meta } from '../types/Meta';\nimport { isPageList, PageList, toPageList } from '../types/PageList';\nimport { List } from '../types/List';\nimport { isEqual } from '../types/IsEqual';\nimport { Get, ofGet } from '../types/Get';\nimport { DontInfer } from '../types/Types';\nimport { AnyKey } from '../types/AnyKey';\nimport { EnumConstructor, isEnumConstructor } from '../types/Enum';\nimport { Id } from '../types/Id';\n\ntype Func<T = unknown> = (a: any, key?: string) => T;\ntype FuncOn<S> = (a: S, key?: string) => unknown;\ntype Viewer = { key: string; f: Func };\n\ntype ViewType<V = any> = Primitive | EnumConstructor | Constructor | Func | View<V> | undefined;\ntype ViewValue<S = never> = [S] extends [never] ? ViewType : Exclude<ViewType, string | Func> | AnyKey<S> | FuncOn<S>;\ntype ViewRecord<V = any, S = never> = [S] extends [never]\n ? Partial<Record<keyof V | typeof spread, ViewValue<S>>>\n : Partial<Record<keyof V | typeof spread, ViewValue<S>>> & Partial<Record<Exclude<Extract<keyof S, string>, Extract<keyof V, string>>, typeof ignore>>;\n\nconst ignore = Symbol('view.ignore');\nconst keep = Symbol('view.keep');\nconst json = Symbol('view.json');\nconst spread = 'view.spread';\n\nexport const toViewer = (key: string, value: ViewType): Viewer =>\n choose(value)\n .is.not.defined(v => v, { key, f: () => undefined } as Viewer)\n .type(isBoolean, b => ({ key, f: () => b }))\n .equals(ignore, { key, f: () => undefined })\n .equals(keep, { key, f: (a: any) => traverse(a, key) })\n .equals(json, { key, f: (a: any) => asJson(traverse(a, key)) })\n .type(isString, s => ({ key, f: (a: any) => traverse(a, s) }))\n .type(isEnumConstructor, c => ({\n key,\n f: (a, key) => use(traverse(a, key), v => (isArray(v) ? c.byIds(v) : c.byId(v as Id))),\n }))\n .type(isConstructor, c => ({\n key,\n f: (a, key) => use(traverse(a, key), v => (isArray(v) ? v.map(i => optional(c, i)) : optional(c, v))),\n }))\n .type(isSimpleView, f => ({ key, f: (a: any) => ifDefined(traverse(a, key), v => f.from(v)) }))\n .type(isFunction, f => ({ key, f }))\n .else(v => ({ key, f: () => v }));\n\nconst optional = (c: Constructor, v: any) =>\n ifDefined(\n v,\n i => new c(i),\n () => v\n );\n\nconst toViewers = (views: ViewRecord): Viewer[] =>\n meta(views)\n .entries<ViewType>()\n .map(([k, v]) => toViewer(k, v));\n\nexport class View<V = any, S = never> {\n constructor(\n private views = {} as ViewRecord<V, S>,\n readonly startsFrom: 'scratch' | 'source' = 'scratch',\n readonly viewers: Viewer[] = toViewers(views),\n private spreads: Get<V>[] = []\n ) {}\n\n get fromSource(): View<V, S> {\n return new View(this.views, 'source', this.viewers, this.spreads);\n }\n\n spread(f: Get<V>): View<V, S> {\n return new View(this.views, this.startsFrom, this.viewers, [...this.spreads, f]);\n }\n\n from<T = unknown>(source: PageList<T>): PageList<V>;\n from<T = unknown>(source: List<T>): List<V>;\n from<T = unknown>(source: T[]): V[];\n from<T = unknown>(source: T): V;\n from<T = unknown>(source: PageList<T> | List<T> | T[] | T): PageList<V> | List<V> | V[] | V {\n if (isPageList(source))\n return toPageList(\n source.map(s => this.reduce(s)),\n source.options\n );\n if (isArray(source)) return source.map(s => this.reduce(s));\n return this.reduce(source);\n }\n\n same = (one?: unknown, another?: unknown): boolean => isEqual(this.from(one), this.from(another));\n\n private reduce = (source: any): any =>\n use(asJson(source), src => {\n const mapped = this.viewers.reduce(\n (acc, v) => (v.key === spread ? { ...acc, ...asJson(v.f(src, v.key)) } : typesJson.set(acc, v.key, v.f(src, v.key))),\n this.startsFrom === 'scratch' ? {} : src\n );\n return this.spreads.reduce((acc, f) => ({ ...acc, ...asJson(ofGet(f, src)) }), mapped);\n });\n}\n\nexport const isSimpleView = (a: unknown): a is View => a instanceof View;\n\nexport const view = <V = any, S = never>(views: ViewRecord<DontInfer<V>, DontInfer<S>>): View<V, S> => new View<V, S>(views);\n\nexport const views = {\n ignore,\n keep,\n json,\n spread,\n skip: ignore,\n equals: (key: string, value: unknown) => (a: unknown) => isEqual(traverse(a, key), value),\n value: (value: unknown) => () => value,\n coalesce:\n (...keys: string[]) =>\n (a: unknown) =>\n keys.reduce<unknown>((result, k) => result ?? traverse(a, k), undefined),\n or: {\n key: (altKey: string) => (a: unknown, key?: string) => traverse(a, key) ?? traverse(a, altKey),\n value: (altValue: unknown) => (a: unknown, key?: string) => traverse(a, key) ?? altValue,\n func: (altFunc: Func) => (a: unknown, key?: string) => traverse(a, key) ?? altFunc(a, key),\n },\n} as const;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/utils/View.ts"],"sourcesContent":["import { traverse } from './Traverse';\nimport { ifDefined } from './If';\nimport { Primitive } from '../types/Primitive';\nimport { Constructor, isConstructor, use } from '../types/Constructor';\nimport { asJson, json as typesJson } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { isArray, isBoolean, isFunction, isString } from '../types/Is';\nimport { meta } from '../types/Meta';\nimport { isPageList, PageList, toPageList } from '../types/PageList';\nimport { List } from '../types/List';\nimport { isEqual } from '../types/IsEqual';\nimport { Get, ofGet } from '../types/Get';\nimport { DontInfer } from '../types/Types';\nimport { AnyKey } from '../types/AnyKey';\nimport { EnumConstructor, isEnumConstructor } from '../types/Enum';\nimport { Id } from '../types/Id';\n\ntype Func<T = unknown> = (a: any, key?: string) => T;\ntype FuncOn<S> = (a: S, key?: string) => unknown;\ntype Viewer = { key: string; f: Func };\n\ntype ViewType<V = any> = Primitive | EnumConstructor | Constructor | Func | View<V> | undefined;\ntype ViewValue<S = never> = [S] extends [never] ? ViewType : Exclude<ViewType, string | Func> | AnyKey<S> | FuncOn<S>;\ntype ViewRecord<V = any, S = never> = [S] extends [never]\n ? Partial<Record<keyof V | typeof spread, ViewValue<S>>>\n : Partial<Record<keyof V | typeof spread, ViewValue<S>>> & Partial<Record<Exclude<Extract<keyof S, string>, Extract<keyof V, string>>, typeof ignore>>;\n\nconst ignore = Symbol('view.ignore');\nconst keep = Symbol('view.keep');\nconst json = Symbol('view.json');\nconst spread = 'view.spread';\n\nexport const toViewer = (key: string, value: ViewType): Viewer =>\n choose(value)\n .is.not.defined(v => v, { key, f: () => undefined } as Viewer)\n .type(isBoolean, b => ({ key, f: () => b }))\n .equals(ignore, { key, f: () => undefined })\n .equals(keep, { key, f: (a: any) => traverse(a, key) })\n .equals(json, { key, f: (a: any) => asJson(traverse(a, key)) })\n .type(isString, s => ({ key, f: (a: any) => traverse(a, s) }))\n .type(isEnumConstructor, c => ({\n key,\n f: (a, key) => use(traverse(a, key), v => (isArray(v) ? c.byIds(v) : c.byId(v as Id))),\n }))\n .type(isConstructor, c => ({\n key,\n f: (a, key) => use(traverse(a, key), v => (isArray(v) ? v.map(i => optional(c, i)) : optional(c, v))),\n }))\n .type(isSimpleView, f => ({ key, f: (a: any) => ifDefined(traverse(a, key), v => f.from(v)) }))\n .type(isFunction, f => ({ key, f }))\n .else(v => ({ key, f: () => v }));\n\nconst optional = (c: Constructor, v: any) =>\n ifDefined(\n v,\n i => new c(i),\n () => v\n );\n\nconst toViewers = (views: ViewRecord): Viewer[] =>\n meta(views)\n .entries<ViewType>()\n .map(([k, v]) => toViewer(k, v));\n\nexport class View<V = any, S = never> {\n constructor(\n private views = {} as ViewRecord<V, S>,\n readonly startsFrom: 'scratch' | 'source' = 'scratch',\n readonly viewers: Viewer[] = toViewers(views),\n private spreads: Get<V>[] = []\n ) {}\n\n get fromSource(): View<V, S> {\n return new View(this.views, 'source', this.viewers, this.spreads);\n }\n\n spread(f: Get<V>): View<V, S> {\n return new View(this.views, this.startsFrom, this.viewers, [...this.spreads, f]);\n }\n\n from<T = unknown>(source: PageList<T>): PageList<V>;\n from<T = unknown>(source: List<T>): List<V>;\n from<T = unknown>(source: T[]): V[];\n from<T = unknown>(source: T): V;\n from<T = unknown>(source: PageList<T> | List<T> | T[] | T): PageList<V> | List<V> | V[] | V {\n if (isPageList(source))\n return toPageList(\n source.map(s => this.reduce(s)),\n source.options\n );\n if (isArray(source)) return source.map(s => this.reduce(s));\n return this.reduce(source);\n }\n\n same = (one?: unknown, another?: unknown): boolean => isEqual(this.from(one), this.from(another));\n\n private reduce = (source: any): any =>\n use(asJson(source), src => {\n const mapped = this.viewers.reduce(\n (acc, v) => (v.key === spread ? { ...acc, ...asJson(v.f(src, v.key)) } : typesJson.set(acc, v.key, v.f(src, v.key))),\n this.startsFrom === 'scratch' ? {} : src\n );\n return this.spreads.reduce((acc, f) => ({ ...acc, ...asJson(ofGet(f, src)) }), mapped);\n });\n}\n\nexport const isSimpleView = (a: unknown): a is View => a instanceof View;\n\nexport const view = <V = any, S = never>(views: ViewRecord<DontInfer<V>, DontInfer<S>>): View<V, S> => new View<V, S>(views);\n\nexport const views = {\n ignore,\n keep,\n json,\n spread,\n skip: ignore,\n equals: (key: string, value: unknown) => (a: unknown) => isEqual(traverse(a, key), value),\n value: (value: unknown) => () => value,\n coalesce:\n (...keys: string[]) =>\n (a: unknown) =>\n keys.reduce<unknown>((result, k) => result ?? traverse(a, k), undefined),\n or: {\n key: (altKey: string) => (a: unknown, key?: string) => traverse(a, key) ?? traverse(a, altKey),\n value: (altValue: unknown) => (a: unknown, key?: string) => traverse(a, key) ?? altValue,\n func: (altFunc: Func) => (a: unknown, key?: string) => traverse(a, key) ?? altFunc(a, key),\n },\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAM,SAAS,OAAO,aAAa;AACnC,IAAM,OAAO,OAAO,WAAW;AAC/B,IAAMA,QAAO,OAAO,WAAW;AAC/B,IAAM,SAAS;AAER,IAAM,WAAW,CAAC,KAAa,UACpC,OAAO,KAAK,EACT,GAAG,IAAI,QAAQ,OAAK,GAAG,EAAE,KAAK,GAAG,MAAM,OAAU,CAAW,EAC5D,KAAK,WAAW,QAAM,EAAE,KAAK,GAAG,MAAM,EAAE,EAAE,EAC1C,OAAO,QAAQ,EAAE,KAAK,GAAG,MAAM,OAAU,CAAC,EAC1C,OAAO,MAAM,EAAE,KAAK,GAAG,CAAC,MAAW,SAAS,GAAG,GAAG,EAAE,CAAC,EACrD,OAAOA,OAAM,EAAE,KAAK,GAAG,CAAC,MAAW,OAAO,SAAS,GAAG,GAAG,CAAC,EAAE,CAAC,EAC7D,KAAK,UAAU,QAAM,EAAE,KAAK,GAAG,CAAC,MAAW,SAAS,GAAG,CAAC,EAAE,EAAE,EAC5D,KAAK,mBAAmB,QAAM;AAAA,EAC7B;AAAA,EACA,GAAG,CAAC,GAAGC,SAAQ,IAAI,SAAS,GAAGA,IAAG,GAAG,OAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,CAAO,CAAE;AACvF,EAAE,EACD,KAAK,eAAe,QAAM;AAAA,EACzB;AAAA,EACA,GAAG,CAAC,GAAGA,SAAQ,IAAI,SAAS,GAAGA,IAAG,GAAG,OAAM,QAAQ,CAAC,IAAI,EAAE,IAAI,OAAK,S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GAAG;AAAA,EAC3F;AACF;","names":["json","key","views"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SqlQuery
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B37NZCNW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ifGet
|
|
6
6
|
} from "./chunk-SJGQU3OG.mjs";
|
|
@@ -15,4 +15,4 @@ var Delete = class extends SqlQuery {
|
|
|
15
15
|
export {
|
|
16
16
|
Delete
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-AYR4US3Z.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toList
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
4
4
|
|
|
5
5
|
// src/sql/SqlQuery.ts
|
|
6
6
|
var SqlQuery = class {
|
|
@@ -17,4 +17,4 @@ var SqlQuery = class {
|
|
|
17
17
|
export {
|
|
18
18
|
SqlQuery
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-B37NZCNW.mjs.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Exception
|
|
3
|
-
} from "./chunk-5BGTUK7G.mjs";
|
|
4
|
-
import {
|
|
2
|
+
Exception,
|
|
5
3
|
reject
|
|
6
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
7
5
|
|
|
8
6
|
// src/types/Gateway.ts
|
|
9
7
|
var Gateway = class {
|
|
@@ -42,4 +40,4 @@ var Gateway = class {
|
|
|
42
40
|
export {
|
|
43
41
|
Gateway
|
|
44
42
|
};
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-FF3BNZ4H.mjs.map
|
|
@@ -1 +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":"
|
|
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":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Enum
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
asString
|
|
6
6
|
} from "./chunk-4Q6IHSAU.mjs";
|
|
@@ -28,4 +28,4 @@ var ContentType = class _ContentType extends Enum {
|
|
|
28
28
|
export {
|
|
29
29
|
ContentType
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
31
|
+
//# sourceMappingURL=chunk-FFD2T6YV.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Enum
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isAn
|
|
6
6
|
} from "./chunk-MDIO6K2O.mjs";
|
|
@@ -91,4 +91,4 @@ export {
|
|
|
91
91
|
isHttpStatus,
|
|
92
92
|
toHttpStatus
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-FSWASMJZ.mjs.map
|
|
@@ -3,16 +3,12 @@ import {
|
|
|
3
3
|
inPast
|
|
4
4
|
} from "./chunk-ADJAEGCT.mjs";
|
|
5
5
|
import {
|
|
6
|
+
meta,
|
|
6
7
|
text,
|
|
8
|
+
toList,
|
|
7
9
|
tryTo,
|
|
8
10
|
validate
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
meta
|
|
12
|
-
} from "./chunk-5FAZA55F.mjs";
|
|
13
|
-
import {
|
|
14
|
-
toList
|
|
15
|
-
} from "./chunk-AQXV7L65.mjs";
|
|
11
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
16
12
|
import {
|
|
17
13
|
isBoolean,
|
|
18
14
|
isDefined,
|
|
@@ -73,4 +69,4 @@ export {
|
|
|
73
69
|
maxLength,
|
|
74
70
|
rule
|
|
75
71
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-GF7JYGJU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/validation/Contraints.ts"],"sourcesContent":["import { validate, Validator } from './Validate';\nimport { Func } from '../types/Func';\nimport { Results } from '../types/Results';\nimport { meta } from '../types/Meta';\nimport { List, toList } from '../types/List';\nimport { isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString } from '../types/Is';\nimport { tryTo } from '../types/Try';\nimport { inFuture, inPast } from '../types/IsDate';\nimport type { Text } from '../types/Text';\nimport { text } from '../types/ToText';\n\nexport type Constraint = Func<boolean | Results, any>;\n\nexport const constraint =\n <T>(c: Constraint, message: Text): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n const cs = meta(subject).property(property).get<List<Validator>>('constraint') ?? toList<Validator>();\n meta(subject)\n .property(property)\n .set('constraint', cs.add({ property, constraint: c, text: message }));\n };\n\nexport const defined = (message?: Text): PropertyDecorator => constraint(v => isDefined(v), message ?? 'Property {property} must be defined.');\n\nexport const required = (message?: Text): PropertyDecorator =>\n constraint(v => isNotEmpty(v), message ?? 'Property {property} is required, and may not be empty.');\n\nexport const notEmpty = (message?: Text): PropertyDecorator => constraint(v => isNotEmpty(v), message ?? 'Property {property} may not be empty.');\n\nexport const valid = (): PropertyDecorator => constraint(v => validate(v), '');\n\nexport const optional = (): PropertyDecorator => constraint(v => !isDefined(v) || validate(v), '');\n\nexport const includes = (sub: string, message?: string): PropertyDecorator =>\n constraint(s => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);\n\nexport const inList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inOptionalList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => !isDefined(v) || isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inUnion = (values: readonly unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, [...values]), message ?? 'Value {actual} must be in union.');\n\nexport const gt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);\n\nexport const gte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);\n\nexport const lt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);\n\nexport const lte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);\n\nexport const past = (message?: Text): PropertyDecorator => constraint(v => inPast(v), message ?? 'Value {actual} must lay in the past.');\n\nexport const future = (message?: Text): PropertyDecorator => constraint(v => inFuture(v), message ?? 'Value {actual} must lay in the future.');\n\nexport const minLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length >= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} must be at least '${length}' characters long.`\n );\n\nexport const maxLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length <= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} cannot be longer than '${length}' characters.`\n );\n\nexport const rule = (message?: Text): PropertyDecorator =>\n constraint(v => (isFunction(v) ? (v() as boolean | Results) : isBoolean(v) ? v : false), message ?? `Value {actual} must be true`);\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/validation/Contraints.ts"],"sourcesContent":["import { validate, Validator } from './Validate';\nimport { Func } from '../types/Func';\nimport { Results } from '../types/Results';\nimport { meta } from '../types/Meta';\nimport { List, toList } from '../types/List';\nimport { isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString } from '../types/Is';\nimport { tryTo } from '../types/Try';\nimport { inFuture, inPast } from '../types/IsDate';\nimport type { Text } from '../types/Text';\nimport { text } from '../types/ToText';\n\nexport type Constraint = Func<boolean | Results, any>;\n\nexport const constraint =\n <T>(c: Constraint, message: Text): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n const cs = meta(subject).property(property).get<List<Validator>>('constraint') ?? toList<Validator>();\n meta(subject)\n .property(property)\n .set('constraint', cs.add({ property, constraint: c, text: message }));\n };\n\nexport const defined = (message?: Text): PropertyDecorator => constraint(v => isDefined(v), message ?? 'Property {property} must be defined.');\n\nexport const required = (message?: Text): PropertyDecorator =>\n constraint(v => isNotEmpty(v), message ?? 'Property {property} is required, and may not be empty.');\n\nexport const notEmpty = (message?: Text): PropertyDecorator => constraint(v => isNotEmpty(v), message ?? 'Property {property} may not be empty.');\n\nexport const valid = (): PropertyDecorator => constraint(v => validate(v), '');\n\nexport const optional = (): PropertyDecorator => constraint(v => !isDefined(v) || validate(v), '');\n\nexport const includes = (sub: string, message?: string): PropertyDecorator =>\n constraint(s => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);\n\nexport const inList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inOptionalList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => !isDefined(v) || isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inUnion = (values: readonly unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, [...values]), message ?? 'Value {actual} must be in union.');\n\nexport const gt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);\n\nexport const gte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);\n\nexport const lt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);\n\nexport const lte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);\n\nexport const past = (message?: Text): PropertyDecorator => constraint(v => inPast(v), message ?? 'Value {actual} must lay in the past.');\n\nexport const future = (message?: Text): PropertyDecorator => constraint(v => inFuture(v), message ?? 'Value {actual} must lay in the future.');\n\nexport const minLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length >= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} must be at least '${length}' characters long.`\n );\n\nexport const maxLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length <= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} cannot be longer than '${length}' characters.`\n );\n\nexport const rule = (message?: Text): PropertyDecorator =>\n constraint(v => (isFunction(v) ? (v() as boolean | Results) : isBoolean(v) ? v : false), message ?? `Value {actual} must be true`);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAaO,IAAM,aACX,CAAI,GAAe,YACnB,CAAC,SAAkB,aAAoC;AACrD,QAAM,KAAK,KAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAqB,YAAY,KAAK,OAAkB;AACpG,OAAK,OAAO,EACT,SAAS,QAAQ,EACjB,IAAI,cAAc,GAAG,IAAI,EAAE,UAAU,YAAY,GAAG,MAAM,QAAQ,CAAC,CAAC;AACzE;AAEK,IAAM,UAAU,CAAC,YAAsC,WAAW,OAAK,UAAU,CAAC,GAAG,WAAW,sCAAsC;AAEtI,IAAM,WAAW,CAAC,YACvB,WAAW,OAAK,WAAW,CAAC,GAAG,WAAW,wDAAwD;AAE7F,IAAM,WAAW,CAAC,YAAsC,WAAW,OAAK,WAAW,CAAC,GAAG,WAAW,uCAAuC;AAEzI,IAAM,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CAAAA,OAAK,KAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,oCAAoC,MAAM;AACvD;AAEK,IAAM,YAAY,CAAC,QAAgB,YACxC;AAAA,EACE,OACE,MAAM,MAAM,CAAC,EACV,GAAG,QAAQ,EACX,IAAI,CAAAA,OAAK,KAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,yCAAyC,MAAM;AAC5D;AAEK,IAAM,OAAO,CAAC,YACnB,WAAW,OAAM,WAAW,CAAC,IAAK,EAAE,IAA0B,UAAU,CAAC,IAAI,IAAI,OAAQ,WAAW,6BAA6B;","names":["v"]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-UAYAS3WM.mjs";
|
|
4
4
|
import {
|
|
5
5
|
json
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WOUH6UVC.mjs";
|
|
7
7
|
import {
|
|
8
8
|
isDefined
|
|
9
9
|
} from "./chunk-YYWOQNZQ.mjs";
|
|
@@ -50,4 +50,4 @@ export {
|
|
|
50
50
|
toCondition,
|
|
51
51
|
isSortCondition
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-GKQMIKIY.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
asNumber
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XQJ5LQEQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
choose
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
7
7
|
import {
|
|
8
8
|
asString
|
|
9
9
|
} from "./chunk-4Q6IHSAU.mjs";
|
|
@@ -54,4 +54,4 @@ export {
|
|
|
54
54
|
cacheAge,
|
|
55
55
|
isCacheAge
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-IESVFCB3.mjs.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
required,
|
|
3
3
|
valid
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GF7JYGJU.mjs";
|
|
5
5
|
import {
|
|
6
6
|
DateTime
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KPXOQFEB.mjs";
|
|
8
8
|
import {
|
|
9
9
|
Struct
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RW4AKBCN.mjs";
|
|
11
11
|
import {
|
|
12
12
|
choose,
|
|
13
13
|
ctx
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
15
15
|
import {
|
|
16
16
|
isIdentity
|
|
17
17
|
} from "./chunk-MDIO6K2O.mjs";
|
|
@@ -45,4 +45,4 @@ __decorateClass([
|
|
|
45
45
|
export {
|
|
46
46
|
Audit
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-IYUYA5OX.mjs.map
|
|
@@ -6,14 +6,12 @@ import {
|
|
|
6
6
|
} from "./chunk-RUKHONCR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
json
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
meta
|
|
12
|
-
} from "./chunk-5FAZA55F.mjs";
|
|
9
|
+
} from "./chunk-WOUH6UVC.mjs";
|
|
13
10
|
import {
|
|
14
11
|
ifNotEmpty,
|
|
12
|
+
meta,
|
|
15
13
|
toList
|
|
16
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
17
15
|
import {
|
|
18
16
|
ofGet
|
|
19
17
|
} from "./chunk-SJGQU3OG.mjs";
|
|
@@ -131,4 +129,4 @@ export {
|
|
|
131
129
|
Mapper,
|
|
132
130
|
mappings
|
|
133
131
|
};
|
|
134
|
-
//# sourceMappingURL=chunk-
|
|
132
|
+
//# sourceMappingURL=chunk-J5PB7ZVO.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/Mapper.ts"],"sourcesContent":["import { Property, PropertyOptions } from './Property';\nimport { State } from './State';\nimport { ifNotEmpty } from './If';\nimport { json, Json, JsonValue } from '../types/Json';\nimport { Optional } from '../types/Types';\nimport { TypeGuard } from '../types/TypeGuard';\nimport { isA } from '../types/IsA';\nimport { List, toList } from '../types/List';\nimport { meta } from '../types/Meta';\nimport { isEmpty } from '../types/Is';\nimport { Get, ofGet } from '../types/Get';\nimport { Construct, ofConstruct } from '../types/Constructor';\n\nexport type Mapping = {\n property: string;\n in: (source?: Json, key?: string) => Optional<JsonValue>;\n out: (source?: Json, key?: string) => Optional<JsonValue>;\n};\nexport const isMapping: TypeGuard<Mapping> = (m?: unknown): m is Mapping => isA<Mapping>(m, 'in', 'out');\n\nexport type MapStartFrom = 'scratch' | 'source';\nexport type MapOptions = { startFrom: MapStartFrom };\n\nexport class Mapper extends State implements Mapping {\n protected readonly map = mappings;\n\n constructor(\n readonly options: MapOptions = { startFrom: 'scratch' },\n readonly property = ''\n ) {\n super();\n }\n\n // All properties that are a mapping\n get properties(): List<[string, Mapping]> {\n return this.get('props', () =>\n meta(this)\n .entries<Mapping>()\n .filter(([, v]) => isMapping(v))\n );\n }\n\n // All names of properties (in target) that have a Mapping\n get keys(): List<string> {\n return this.get('keys', () => this.properties.map(([k]) => k));\n }\n\n // All names of properties (in source) that are named in a Mapping\n get columns(): List<string> {\n return this.get('columns', () => this.properties.mapDefined(([, p]) => ifNotEmpty(p.property, p.property))).distinct();\n }\n\n // All names of properties (in source) that are NOT properties in target\n private get droppedIn(): List<string> {\n return this.get('droppedIn', () => this.columns.filter(c => !this.keys.some(k => k === c)));\n }\n\n // All names op properties (in target) that are NOT properties in source\n private get droppedOut(): List<string> {\n return this.get('droppedOut', () => this.properties.filter(([, p]) => !this.keys.some(k => k === p.property)).map(([k]) => k));\n }\n\n public in(from: Json = {}): Json {\n return json.omit(\n this.properties.reduce((a, [k, p]) => json.merge(a, { [k]: p.in({ ...a, ...from }) }), this.options.startFrom === 'source' ? from : {}),\n ...this.droppedIn\n );\n }\n\n public out(to: Json = {}): Json {\n return json.omit(\n this.properties.reduce(\n (a, [k, p]) => json.merge(a, isEmpty(p.property) ? p.out(to, k) : { [p.property ?? '']: p.out({ ...a, ...to }, k) }),\n this.options.startFrom === 'source' ? to : {}\n ),\n ...this.droppedOut\n );\n }\n\n toString(): string {\n return this.constructor.name;\n }\n}\n\nexport const mappings = {\n item: (property: string, options?: PropertyOptions): Property => new Property(property, options),\n ignore: (property = ''): Mapping => ({\n property,\n in: (): Optional<JsonValue> => undefined,\n out: (): Optional<JsonValue> => undefined,\n }),\n skipIn: (property: string): Mapping => ({\n property,\n in: (): Optional<JsonValue> => undefined,\n out: (source: Json = {}): JsonValue => source[property],\n }),\n skipOut: (property: string): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue => source[property],\n out: (): Optional<JsonValue> => undefined,\n }),\n func: (property: string, funcIn: Get<Optional<JsonValue>, Json>, funcOut: Get<Optional<JsonValue>, Json>): Mapping => ({\n property,\n in: (source: Json = {}): Optional<JsonValue> => ofGet(funcIn, source),\n out: (source: Json = {}): Optional<JsonValue> => ofGet(funcOut, source),\n }),\n add: (funcIn: Get<JsonValue, Json>): Mapping => ({\n property: '',\n in: (source: Json = {}): JsonValue => ofGet(funcIn, source),\n out: (): Optional<JsonValue> => undefined,\n }),\n map: (mapper: Construct<Mapper>, property = ''): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue => ofConstruct(mapper).in(isEmpty(property) ? source : (source[property] as Json)),\n out: (source: Json = {}, key = ''): JsonValue => ofConstruct(mapper).out(isEmpty(key) ? source : (source[key] as Json)),\n }),\n propsToList: (...maps: Mapping[]): Mapping => ({\n property: '',\n in: (source: Json = {}): JsonValue => toList(maps.map(m => ofConstruct(m).in(source))).toJSON(),\n out: (source: Json = {}, key = ''): JsonValue =>\n maps.reduce((a: Json, m, i) => {\n const res = toList(source[key])[i];\n const out = m.out(res as Json);\n return { ...a, [m.property]: out ?? {} };\n }, {}),\n }),\n list: (mapper: Mapping, property: string): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue =>\n toList(source[property])\n .map((v: any) => mapper.in(v))\n .toJSON(),\n out: (source: Json = {}, key = ''): JsonValue =>\n toList(isEmpty(key) ? source : (source[key] as Json))\n .map((v: any) => mapper.out(v))\n .toJSON(),\n }),\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/utils/Mapper.ts"],"sourcesContent":["import { Property, PropertyOptions } from './Property';\nimport { State } from './State';\nimport { ifNotEmpty } from './If';\nimport { json, Json, JsonValue } from '../types/Json';\nimport { Optional } from '../types/Types';\nimport { TypeGuard } from '../types/TypeGuard';\nimport { isA } from '../types/IsA';\nimport { List, toList } from '../types/List';\nimport { meta } from '../types/Meta';\nimport { isEmpty } from '../types/Is';\nimport { Get, ofGet } from '../types/Get';\nimport { Construct, ofConstruct } from '../types/Constructor';\n\nexport type Mapping = {\n property: string;\n in: (source?: Json, key?: string) => Optional<JsonValue>;\n out: (source?: Json, key?: string) => Optional<JsonValue>;\n};\nexport const isMapping: TypeGuard<Mapping> = (m?: unknown): m is Mapping => isA<Mapping>(m, 'in', 'out');\n\nexport type MapStartFrom = 'scratch' | 'source';\nexport type MapOptions = { startFrom: MapStartFrom };\n\nexport class Mapper extends State implements Mapping {\n protected readonly map = mappings;\n\n constructor(\n readonly options: MapOptions = { startFrom: 'scratch' },\n readonly property = ''\n ) {\n super();\n }\n\n // All properties that are a mapping\n get properties(): List<[string, Mapping]> {\n return this.get('props', () =>\n meta(this)\n .entries<Mapping>()\n .filter(([, v]) => isMapping(v))\n );\n }\n\n // All names of properties (in target) that have a Mapping\n get keys(): List<string> {\n return this.get('keys', () => this.properties.map(([k]) => k));\n }\n\n // All names of properties (in source) that are named in a Mapping\n get columns(): List<string> {\n return this.get('columns', () => this.properties.mapDefined(([, p]) => ifNotEmpty(p.property, p.property))).distinct();\n }\n\n // All names of properties (in source) that are NOT properties in target\n private get droppedIn(): List<string> {\n return this.get('droppedIn', () => this.columns.filter(c => !this.keys.some(k => k === c)));\n }\n\n // All names op properties (in target) that are NOT properties in source\n private get droppedOut(): List<string> {\n return this.get('droppedOut', () => this.properties.filter(([, p]) => !this.keys.some(k => k === p.property)).map(([k]) => k));\n }\n\n public in(from: Json = {}): Json {\n return json.omit(\n this.properties.reduce((a, [k, p]) => json.merge(a, { [k]: p.in({ ...a, ...from }) }), this.options.startFrom === 'source' ? from : {}),\n ...this.droppedIn\n );\n }\n\n public out(to: Json = {}): Json {\n return json.omit(\n this.properties.reduce(\n (a, [k, p]) => json.merge(a, isEmpty(p.property) ? p.out(to, k) : { [p.property ?? '']: p.out({ ...a, ...to }, k) }),\n this.options.startFrom === 'source' ? to : {}\n ),\n ...this.droppedOut\n );\n }\n\n toString(): string {\n return this.constructor.name;\n }\n}\n\nexport const mappings = {\n item: (property: string, options?: PropertyOptions): Property => new Property(property, options),\n ignore: (property = ''): Mapping => ({\n property,\n in: (): Optional<JsonValue> => undefined,\n out: (): Optional<JsonValue> => undefined,\n }),\n skipIn: (property: string): Mapping => ({\n property,\n in: (): Optional<JsonValue> => undefined,\n out: (source: Json = {}): JsonValue => source[property],\n }),\n skipOut: (property: string): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue => source[property],\n out: (): Optional<JsonValue> => undefined,\n }),\n func: (property: string, funcIn: Get<Optional<JsonValue>, Json>, funcOut: Get<Optional<JsonValue>, Json>): Mapping => ({\n property,\n in: (source: Json = {}): Optional<JsonValue> => ofGet(funcIn, source),\n out: (source: Json = {}): Optional<JsonValue> => ofGet(funcOut, source),\n }),\n add: (funcIn: Get<JsonValue, Json>): Mapping => ({\n property: '',\n in: (source: Json = {}): JsonValue => ofGet(funcIn, source),\n out: (): Optional<JsonValue> => undefined,\n }),\n map: (mapper: Construct<Mapper>, property = ''): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue => ofConstruct(mapper).in(isEmpty(property) ? source : (source[property] as Json)),\n out: (source: Json = {}, key = ''): JsonValue => ofConstruct(mapper).out(isEmpty(key) ? source : (source[key] as Json)),\n }),\n propsToList: (...maps: Mapping[]): Mapping => ({\n property: '',\n in: (source: Json = {}): JsonValue => toList(maps.map(m => ofConstruct(m).in(source))).toJSON(),\n out: (source: Json = {}, key = ''): JsonValue =>\n maps.reduce((a: Json, m, i) => {\n const res = toList(source[key])[i];\n const out = m.out(res as Json);\n return { ...a, [m.property]: out ?? {} };\n }, {}),\n }),\n list: (mapper: Mapping, property: string): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue =>\n toList(source[property])\n .map((v: any) => mapper.in(v))\n .toJSON(),\n out: (source: Json = {}, key = ''): JsonValue =>\n toList(isEmpty(key) ? source : (source[key] as Json))\n .map((v: any) => mapper.out(v))\n .toJSON(),\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,IAAM,YAAgC,CAAC,MAA8B,IAAa,GAAG,MAAM,KAAK;AAKhG,IAAM,SAAN,cAAqB,MAAyB;AAAA,EAGnD,YACW,UAAsB,EAAE,WAAW,UAAU,GAC7C,WAAW,IACpB;AACA,UAAM;AAHG;AACA;AAAA,EAGX;AAAA,EAPmB,MAAM;AAAA;AAAA,EAUzB,IAAI,aAAsC;AACxC,WAAO,KAAK;AAAA,MAAI;AAAA,MAAS,MACvB,KAAK,IAAI,EACN,QAAiB,EACjB,OAAO,CAAC,CAAC,EAAE,CAAC,MAAM,UAAU,CAAC,CAAC;AAAA,IACnC;AAAA,EACF;AAAA;AAAA,EAGA,IAAI,OAAqB;AACvB,WAAO,KAAK,IAAI,QAAQ,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAAA,EAC/D;AAAA;AAAA,EAGA,IAA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aAAa,IAAI,UAA8B;AAAA,IAC7C,UAAU;AAAA,IACV,IAAI,CAAC,SAAe,CAAC,MAAiB,OAAO,KAAK,IAAI,OAAK,YAAY,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO;AAAA,IAC9F,KAAK,CAAC,SAAe,CAAC,GAAG,MAAM,OAC7B,KAAK,OAAO,CAAC,GAAS,GAAG,MAAM;AAC7B,YAAM,MAAM,OAAO,OAAO,GAAG,CAAC,EAAE,CAAC;AACjC,YAAM,MAAM,EAAE,IAAI,GAAW;AAC7B,aAAO,EAAE,GAAG,GAAG,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,EAAE;AAAA,IACzC,GAAG,CAAC,CAAC;AAAA,EACT;AAAA,EACA,MAAM,CAAC,QAAiB,cAA+B;AAAA,IACrD;AAAA,IACA,IAAI,CAAC,SAAe,CAAC,MACnB,OAAO,OAAO,QAAQ,CAAC,EACpB,IAAI,CAAC,MAAW,OAAO,GAAG,CAAC,CAAC,EAC5B,OAAO;AAAA,IACZ,KAAK,CAAC,SAAe,CAAC,GAAG,MAAM,OAC7B,OAAO,QAAQ,GAAG,IAAI,SAAU,OAAO,GAAG,CAAU,EACjD,IAAI,CAAC,MAAW,OAAO,IAAI,CAAC,CAAC,EAC7B,OAAO;AAAA,EACd;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Enum
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
4
4
|
|
|
5
5
|
// src/http/HttpVerb.ts
|
|
6
6
|
var HttpVerb = class _HttpVerb extends Enum {
|
|
@@ -17,4 +17,4 @@ var HttpVerb = class _HttpVerb extends Enum {
|
|
|
17
17
|
export {
|
|
18
18
|
HttpVerb
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-JI7MC5EA.mjs.map
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toPageList
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
choose
|
|
6
|
-
} from "./chunk-5BGTUK7G.mjs";
|
|
3
|
+
} from "./chunk-QLEGIYVU.mjs";
|
|
7
4
|
import {
|
|
5
|
+
choose,
|
|
8
6
|
resolve
|
|
9
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
10
8
|
|
|
11
9
|
// src/process/Search.ts
|
|
12
10
|
var Search = class {
|
|
@@ -45,4 +43,4 @@ var Search = class {
|
|
|
45
43
|
export {
|
|
46
44
|
Search
|
|
47
45
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
46
|
+
//# sourceMappingURL=chunk-JM6NAJQ3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/process/Search.ts"],"sourcesContent":["import { FetchOptions } from '../types/Gateway';\nimport { Repository } from '../types/Repository';\nimport { PageList, toPageList } from '../types/PageList';\nimport { Id, Key } from '../types/Id';\nimport { List } from '../types/List';\nimport { Req } from '../resources/Req';\nimport { JsonValue } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { resolve } from '../utils/Promise';\n\nexport class Search<T, Options = FetchOptions> {\n constructor(protected repo: Repository<T, Options>) {}\n\n all(options?: Options): Promise<PageList<T>> {\n return this.repo.all(options);\n }\n\n byId(id: Id): Promise<T> {\n return this.repo.byId(id);\n }\n\n byIds(...ids: Id[]): Promise<List<T>> {\n return this.repo.byIds(...ids);\n }\n\n byKey(key: Key, options?: Options): Promise<PageList<T>> {\n return this.repo.byKey(key, options);\n }\n\n query({ query, skip, take }: Req): Promise<PageList<T>> {\n return this.search(query, { skip, take } as Options);\n }\n\n search(query: JsonValue, options?: Options): Promise<PageList<T>> {\n return choose(query)\n .is.not.empty(\n q => q,\n q => this.repo.search(q, options)\n )\n .else(() => resolve(toPageList<T>()));\n }\n\n filter(options?: Options): Promise<PageList<T>> {\n return this.repo.filter(options);\n }\n\n exists(id: Id): Promise<boolean> {\n return this.repo.exists(id);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/process/Search.ts"],"sourcesContent":["import { FetchOptions } from '../types/Gateway';\nimport { Repository } from '../types/Repository';\nimport { PageList, toPageList } from '../types/PageList';\nimport { Id, Key } from '../types/Id';\nimport { List } from '../types/List';\nimport { Req } from '../resources/Req';\nimport { JsonValue } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { resolve } from '../utils/Promise';\n\nexport class Search<T, Options = FetchOptions> {\n constructor(protected repo: Repository<T, Options>) {}\n\n all(options?: Options): Promise<PageList<T>> {\n return this.repo.all(options);\n }\n\n byId(id: Id): Promise<T> {\n return this.repo.byId(id);\n }\n\n byIds(...ids: Id[]): Promise<List<T>> {\n return this.repo.byIds(...ids);\n }\n\n byKey(key: Key, options?: Options): Promise<PageList<T>> {\n return this.repo.byKey(key, options);\n }\n\n query({ query, skip, take }: Req): Promise<PageList<T>> {\n return this.search(query, { skip, take } as Options);\n }\n\n search(query: JsonValue, options?: Options): Promise<PageList<T>> {\n return choose(query)\n .is.not.empty(\n q => q,\n q => this.repo.search(q, options)\n )\n .else(() => resolve(toPageList<T>()));\n }\n\n filter(options?: Options): Promise<PageList<T>> {\n return this.repo.filter(options);\n }\n\n exists(id: Id): Promise<boolean> {\n return this.repo.exists(id);\n }\n}\n"],"mappings":";;;;;;;;;AAUO,IAAM,SAAN,MAAwC;AAAA,EAC7C,YAAsB,MAA8B;AAA9B;AAAA,EAA+B;AAAA,EAErD,IAAI,SAAyC;AAC3C,WAAO,KAAK,KAAK,IAAI,OAAO;AAAA,EAC9B;AAAA,EAEA,KAAK,IAAoB;AACvB,WAAO,KAAK,KAAK,KAAK,EAAE;AAAA,EAC1B;AAAA,EAEA,SAAS,KAA6B;AACpC,WAAO,KAAK,KAAK,MAAM,GAAG,GAAG;AAAA,EAC/B;AAAA,EAEA,MAAM,KAAU,SAAyC;AACvD,WAAO,KAAK,KAAK,MAAM,KAAK,OAAO;AAAA,EACrC;AAAA,EAEA,MAAM,EAAE,OAAO,MAAM,KAAK,GAA8B;AACtD,WAAO,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,CAAY;AAAA,EACrD;AAAA,EAEA,OAAO,OAAkB,SAAyC;AAChE,WAAO,OAAO,KAAK,EAChB,GAAG,IAAI;AAAA,MACN,OAAK;AAAA,MACL,OAAK,KAAK,KAAK,OAAO,GAAG,OAAO;AAAA,IAClC,EACC,KAAK,MAAM,QAAQ,WAAc,CAAC,CAAC;AAAA,EACxC;AAAA,EAEA,OAAO,SAAyC;AAC9C,WAAO,KAAK,KAAK,OAAO,OAAO;AAAA,EACjC;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,KAAK,KAAK,OAAO,EAAE;AAAA,EAC5B;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SqlQuery
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B37NZCNW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
toClause
|
|
6
6
|
} from "./chunk-UXDH5W4T.mjs";
|
|
@@ -23,4 +23,4 @@ var Update = class extends SqlQuery {
|
|
|
23
23
|
export {
|
|
24
24
|
Update
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-JNZUGKMO.mjs.map
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
seconds
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M2S4OLVZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isDate
|
|
6
6
|
} from "./chunk-ADJAEGCT.mjs";
|
|
7
7
|
import {
|
|
8
8
|
choose,
|
|
9
|
+
ifDefined,
|
|
9
10
|
tryTo
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TUO7ZPSP.mjs";
|
|
11
12
|
import {
|
|
12
13
|
Value
|
|
13
14
|
} from "./chunk-AMS2ELWR.mjs";
|
|
14
|
-
import {
|
|
15
|
-
ifDefined
|
|
16
|
-
} from "./chunk-AQXV7L65.mjs";
|
|
17
15
|
import {
|
|
18
16
|
isA
|
|
19
17
|
} from "./chunk-MDIO6K2O.mjs";
|
|
@@ -139,4 +137,4 @@ export {
|
|
|
139
137
|
isDateTime,
|
|
140
138
|
dt
|
|
141
139
|
};
|
|
142
|
-
//# sourceMappingURL=chunk-
|
|
140
|
+
//# sourceMappingURL=chunk-KPXOQFEB.mjs.map
|