@thisisagile/easy 17.23.1 → 17.24.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-VKBEWDLL.mjs → chunk-2BOK6R6N.mjs} +4 -4
- package/dist/chunk-2BOK6R6N.mjs.map +1 -0
- package/dist/{chunk-HAEVUETQ.mjs → chunk-2C5WHSM5.mjs} +2 -2
- package/dist/{chunk-UWA2JPXC.mjs → chunk-4WLPMNMB.mjs} +9 -9
- package/dist/{chunk-DUMDOMES.mjs → chunk-6ATDEGSU.mjs} +3 -3
- package/dist/{chunk-P4MEAARF.mjs → chunk-6ENYJKOF.mjs} +42 -35
- package/dist/chunk-6ENYJKOF.mjs.map +1 -0
- package/dist/{chunk-MBY7DP5K.mjs → chunk-6RSOVRW4.mjs} +4 -4
- package/dist/{chunk-MBFLUJ5X.mjs → chunk-73VXBPTL.mjs} +11 -11
- package/dist/{chunk-CHV6RMJL.mjs → chunk-7OEH5Q3V.mjs} +2 -2
- package/dist/{chunk-SHTZ4ZZ2.mjs → chunk-AWT4XDU7.mjs} +4 -4
- package/dist/{chunk-QL3DRPMM.mjs → chunk-BDKRR6H2.mjs} +2 -2
- package/dist/{chunk-VI57VONC.mjs → chunk-CHLVZFAR.mjs} +2 -2
- package/dist/{chunk-RTVVXROA.mjs → chunk-CMMMDBTK.mjs} +3 -3
- package/dist/{chunk-WUHEP5NJ.mjs → chunk-D4EFIKFU.mjs} +4 -4
- package/dist/chunk-D4EFIKFU.mjs.map +1 -0
- package/dist/{chunk-3ZX4YFOK.mjs → chunk-EOIG654K.mjs} +4 -4
- package/dist/{chunk-LMVFKEDS.mjs → chunk-F2SLQDR2.mjs} +2 -2
- package/dist/{chunk-5UUY67VD.mjs → chunk-F7MQZLCR.mjs} +3 -3
- package/dist/{chunk-3LWQJAEJ.mjs → chunk-FLJXHLSM.mjs} +3 -3
- package/dist/{chunk-7WCAHERW.mjs → chunk-GA7BBYC2.mjs} +3 -3
- package/dist/{chunk-UGTCVMQQ.mjs → chunk-GSAKK3JN.mjs} +3 -3
- package/dist/{chunk-A42HFDBS.mjs → chunk-HFBHENMJ.mjs} +3 -3
- package/dist/{chunk-A42HFDBS.mjs.map → chunk-HFBHENMJ.mjs.map} +1 -1
- package/dist/{chunk-Q7FJUYZT.mjs → chunk-HO3IEF5S.mjs} +14 -3
- package/dist/chunk-HO3IEF5S.mjs.map +1 -0
- package/dist/{chunk-J7FACY7Y.mjs → chunk-I4HFLLRR.mjs} +3 -3
- package/dist/{chunk-YAB5YLHI.mjs → chunk-J5AZL5T6.mjs} +2 -2
- package/dist/{chunk-F4JCURDN.mjs → chunk-JABPZGOG.mjs} +2 -2
- package/dist/{chunk-4BH22HLY.mjs → chunk-JJQAGAQN.mjs} +3 -3
- package/dist/{chunk-5UXTE3WM.mjs → chunk-KBB2WGTO.mjs} +2 -2
- package/dist/{chunk-MTDHDEDS.mjs → chunk-LCG5GI24.mjs} +6 -6
- package/dist/{chunk-QH2LF3L3.mjs → chunk-LIDMZELG.mjs} +3 -3
- package/dist/{chunk-KBR62ITL.mjs → chunk-N5B6HSHV.mjs} +4 -4
- package/dist/{chunk-XWRQODZZ.mjs → chunk-NUA7EUWX.mjs} +6 -6
- package/dist/{chunk-DAG7KGVL.mjs → chunk-O4CJ7NSN.mjs} +2 -2
- package/dist/{chunk-TG7T4QPS.mjs → chunk-ONWMWJ43.mjs} +2 -2
- package/dist/chunk-ONWMWJ43.mjs.map +1 -0
- package/dist/{chunk-HL7ITJJT.mjs → chunk-OVORFG3O.mjs} +2 -2
- package/dist/{chunk-4WIL3EXY.mjs → chunk-PB6SCADS.mjs} +4 -4
- package/dist/{chunk-RGO5KVRQ.mjs → chunk-QNE24TSJ.mjs} +2 -2
- package/dist/{chunk-BI3DP4QA.mjs → chunk-S2VNBE5K.mjs} +3 -3
- package/dist/{chunk-7W67IZE4.mjs → chunk-ST3P6VWM.mjs} +2 -2
- package/dist/{chunk-AMIP3FS5.mjs → chunk-TLYJ2G3X.mjs} +9 -3
- package/dist/chunk-TLYJ2G3X.mjs.map +1 -0
- package/dist/{chunk-SDGUXNY3.mjs → chunk-TMAB63X5.mjs} +2 -2
- package/dist/{chunk-BE474ULY.mjs → chunk-UCNB24EO.mjs} +2 -2
- package/dist/{chunk-YODYDO2U.mjs → chunk-W53U3D4O.mjs} +2 -2
- package/dist/{chunk-UHP56ITH.mjs → chunk-WBL4BT3I.mjs} +2 -2
- package/dist/{chunk-4K6SPD7T.mjs → chunk-WDC45I5H.mjs} +4 -4
- package/dist/{chunk-KWE3VWIW.mjs → chunk-Y5NBOPDI.mjs} +5 -5
- package/dist/chunk-Y5NBOPDI.mjs.map +1 -0
- package/dist/{chunk-OWZ5I5IV.mjs → chunk-YYIIQGLL.mjs} +13 -10
- package/dist/chunk-YYIIQGLL.mjs.map +1 -0
- package/dist/{chunk-I32HDHLS.mjs → chunk-ZNUHRHPU.mjs} +2 -2
- package/dist/data/Condition.mjs +5 -4
- package/dist/data/Database.mjs +6 -5
- package/dist/data/Field.mjs +5 -4
- package/dist/data/Field.mjs.map +1 -1
- package/dist/data/InMemoryGateway.mjs +14 -13
- package/dist/data/InMemoryGateway.mjs.map +1 -1
- package/dist/domain/Audit.mjs +18 -17
- package/dist/domain/Child.mjs +15 -14
- package/dist/domain/Child.mjs.map +1 -1
- package/dist/domain/DateTime.d.ts +1 -2
- package/dist/domain/DateTime.mjs +14 -13
- package/dist/domain/Entity.mjs +18 -17
- package/dist/domain/Entity.mjs.map +1 -1
- package/dist/domain/Repo.mjs +14 -13
- package/dist/domain/Repo.mjs.map +1 -1
- package/dist/domain/Struct.mjs +14 -13
- package/dist/domain/Typo.mjs +14 -13
- package/dist/domain/Typo.mjs.map +1 -1
- package/dist/http/CacheControl.mjs +14 -13
- package/dist/http/CacheControl.mjs.map +1 -1
- package/dist/http/ContentType.mjs +6 -5
- package/dist/http/HttpStatus.mjs +6 -5
- package/dist/http/HttpVerb.mjs +6 -5
- package/dist/http/LocalRequestStore.mjs +5 -4
- package/dist/http/LocalRequestStore.mjs.map +1 -1
- package/dist/http/RequestOptions.mjs +9 -8
- package/dist/http/RestResult.mjs +14 -13
- package/dist/http/toResponse.mjs +15 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +48 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/process/App.mjs +7 -6
- package/dist/process/App.mjs.map +1 -1
- package/dist/process/Manage.mjs +14 -13
- package/dist/process/Manage.mjs.map +1 -1
- package/dist/process/Scope.mjs +7 -6
- package/dist/process/Search.mjs +14 -13
- package/dist/process/UseCase.d.ts +1 -1
- package/dist/process/UseCase.mjs +9 -8
- package/dist/process/UseCase.mjs.map +1 -1
- package/dist/resources/Req.mjs +13 -12
- package/dist/resources/Req.mjs.map +1 -1
- package/dist/services/Api.mjs +22 -21
- package/dist/services/ApiGateway.mjs +25 -24
- package/dist/services/AxiosProvider.mjs +20 -19
- package/dist/services/MappedRouteGateway.mjs +28 -27
- package/dist/services/MappedRouteGateway.mjs.map +1 -1
- package/dist/services/RouteGateway.mjs +26 -25
- package/dist/services/ViewRouteGateway.mjs +29 -29
- package/dist/sql/Column.mjs +13 -12
- package/dist/sql/Count.mjs +5 -4
- package/dist/sql/Delete.mjs +4 -3
- package/dist/sql/Insert.mjs +4 -3
- package/dist/sql/Select.mjs +4 -3
- package/dist/sql/SqlQuery.mjs +3 -2
- package/dist/sql/Table.mjs +22 -21
- package/dist/sql/Table.mjs.map +1 -1
- package/dist/sql/TableGateway.mjs +14 -13
- package/dist/sql/TableGateway.mjs.map +1 -1
- package/dist/sql/Update.mjs +4 -3
- package/dist/types/AnyKey.d.ts +2 -2
- package/dist/types/Cache.mjs +4 -3
- package/dist/types/Cache.mjs.map +1 -1
- package/dist/types/CacheAge.mjs +14 -13
- package/dist/types/Case.mjs +12 -11
- package/dist/types/Context.d.ts +1 -1
- package/dist/types/Context.mjs +5 -4
- package/dist/types/Enum.mjs +5 -4
- package/dist/types/Environment.mjs +5 -4
- package/dist/types/Environment.mjs.map +1 -1
- package/dist/types/Exception.mjs +7 -6
- package/dist/types/Gateway.mjs +9 -8
- package/dist/types/IsEqual.mjs +13 -12
- package/dist/types/Json.mjs +4 -3
- package/dist/types/List.d.ts +12 -9
- package/dist/types/List.mjs +2 -1
- package/dist/types/Meta.mjs +4 -3
- package/dist/types/Number.mjs +13 -12
- package/dist/types/Object.mjs +3 -2
- package/dist/types/PageList.mjs +13 -12
- package/dist/types/Parser.mjs +12 -11
- package/dist/types/Parser.mjs.map +1 -1
- package/dist/types/Repository.mjs +9 -8
- package/dist/types/Result.mjs +6 -5
- package/dist/types/Results.mjs +7 -6
- package/dist/types/Tag.mjs +4 -3
- package/dist/types/Tag.mjs.map +1 -1
- package/dist/types/Template.d.ts +0 -43
- package/dist/types/Template.mjs +6 -11
- package/dist/types/ToText.d.ts +45 -0
- package/dist/types/ToText.mjs +23 -0
- package/dist/types/ToText.mjs.map +1 -0
- package/dist/types/Try.mjs +12 -11
- package/dist/types/Uri.mjs +12 -11
- package/dist/types/Uri.mjs.map +1 -1
- package/dist/utils/If.mjs +2 -1
- package/dist/utils/Mapper.mjs +6 -5
- package/dist/utils/Promise.d.ts +2 -0
- package/dist/utils/Promise.mjs +8 -4
- package/dist/utils/Seconds.mjs +3 -2
- package/dist/utils/Sentence.mjs +4 -3
- package/dist/utils/Sentence.mjs.map +1 -1
- package/dist/utils/View.mjs +16 -16
- package/dist/validation/Contraints.mjs +13 -12
- package/dist/validation/Validate.mjs +12 -11
- package/dist/validation/When.mjs +12 -11
- package/package.json +1 -1
- package/src/domain/DateTime.ts +1 -1
- package/src/index.ts +1 -1
- package/src/process/Scope.ts +1 -1
- package/src/process/UseCase.ts +5 -5
- package/src/types/AnyKey.ts +10 -2
- package/src/types/Context.ts +6 -2
- package/src/types/Exception.ts +2 -1
- package/src/types/List.ts +17 -11
- package/src/types/Template.ts +2 -152
- package/src/types/ToText.ts +167 -0
- package/src/types/Uri.ts +1 -1
- package/src/utils/Promise.ts +5 -0
- package/src/utils/Sentence.ts +1 -1
- package/src/validation/Contraints.ts +1 -1
- package/src/validation/Validate.ts +10 -3
- package/dist/chunk-AMIP3FS5.mjs.map +0 -1
- package/dist/chunk-KWE3VWIW.mjs.map +0 -1
- package/dist/chunk-OWZ5I5IV.mjs.map +0 -1
- package/dist/chunk-P4MEAARF.mjs.map +0 -1
- package/dist/chunk-Q7FJUYZT.mjs.map +0 -1
- package/dist/chunk-TG7T4QPS.mjs.map +0 -1
- package/dist/chunk-VKBEWDLL.mjs.map +0 -1
- package/dist/chunk-WUHEP5NJ.mjs.map +0 -1
- /package/dist/{chunk-HAEVUETQ.mjs.map → chunk-2C5WHSM5.mjs.map} +0 -0
- /package/dist/{chunk-UWA2JPXC.mjs.map → chunk-4WLPMNMB.mjs.map} +0 -0
- /package/dist/{chunk-DUMDOMES.mjs.map → chunk-6ATDEGSU.mjs.map} +0 -0
- /package/dist/{chunk-MBY7DP5K.mjs.map → chunk-6RSOVRW4.mjs.map} +0 -0
- /package/dist/{chunk-MBFLUJ5X.mjs.map → chunk-73VXBPTL.mjs.map} +0 -0
- /package/dist/{chunk-CHV6RMJL.mjs.map → chunk-7OEH5Q3V.mjs.map} +0 -0
- /package/dist/{chunk-SHTZ4ZZ2.mjs.map → chunk-AWT4XDU7.mjs.map} +0 -0
- /package/dist/{chunk-QL3DRPMM.mjs.map → chunk-BDKRR6H2.mjs.map} +0 -0
- /package/dist/{chunk-VI57VONC.mjs.map → chunk-CHLVZFAR.mjs.map} +0 -0
- /package/dist/{chunk-RTVVXROA.mjs.map → chunk-CMMMDBTK.mjs.map} +0 -0
- /package/dist/{chunk-3ZX4YFOK.mjs.map → chunk-EOIG654K.mjs.map} +0 -0
- /package/dist/{chunk-LMVFKEDS.mjs.map → chunk-F2SLQDR2.mjs.map} +0 -0
- /package/dist/{chunk-5UUY67VD.mjs.map → chunk-F7MQZLCR.mjs.map} +0 -0
- /package/dist/{chunk-3LWQJAEJ.mjs.map → chunk-FLJXHLSM.mjs.map} +0 -0
- /package/dist/{chunk-7WCAHERW.mjs.map → chunk-GA7BBYC2.mjs.map} +0 -0
- /package/dist/{chunk-UGTCVMQQ.mjs.map → chunk-GSAKK3JN.mjs.map} +0 -0
- /package/dist/{chunk-J7FACY7Y.mjs.map → chunk-I4HFLLRR.mjs.map} +0 -0
- /package/dist/{chunk-YAB5YLHI.mjs.map → chunk-J5AZL5T6.mjs.map} +0 -0
- /package/dist/{chunk-F4JCURDN.mjs.map → chunk-JABPZGOG.mjs.map} +0 -0
- /package/dist/{chunk-4BH22HLY.mjs.map → chunk-JJQAGAQN.mjs.map} +0 -0
- /package/dist/{chunk-5UXTE3WM.mjs.map → chunk-KBB2WGTO.mjs.map} +0 -0
- /package/dist/{chunk-MTDHDEDS.mjs.map → chunk-LCG5GI24.mjs.map} +0 -0
- /package/dist/{chunk-QH2LF3L3.mjs.map → chunk-LIDMZELG.mjs.map} +0 -0
- /package/dist/{chunk-KBR62ITL.mjs.map → chunk-N5B6HSHV.mjs.map} +0 -0
- /package/dist/{chunk-XWRQODZZ.mjs.map → chunk-NUA7EUWX.mjs.map} +0 -0
- /package/dist/{chunk-DAG7KGVL.mjs.map → chunk-O4CJ7NSN.mjs.map} +0 -0
- /package/dist/{chunk-HL7ITJJT.mjs.map → chunk-OVORFG3O.mjs.map} +0 -0
- /package/dist/{chunk-4WIL3EXY.mjs.map → chunk-PB6SCADS.mjs.map} +0 -0
- /package/dist/{chunk-RGO5KVRQ.mjs.map → chunk-QNE24TSJ.mjs.map} +0 -0
- /package/dist/{chunk-BI3DP4QA.mjs.map → chunk-S2VNBE5K.mjs.map} +0 -0
- /package/dist/{chunk-7W67IZE4.mjs.map → chunk-ST3P6VWM.mjs.map} +0 -0
- /package/dist/{chunk-SDGUXNY3.mjs.map → chunk-TMAB63X5.mjs.map} +0 -0
- /package/dist/{chunk-BE474ULY.mjs.map → chunk-UCNB24EO.mjs.map} +0 -0
- /package/dist/{chunk-YODYDO2U.mjs.map → chunk-W53U3D4O.mjs.map} +0 -0
- /package/dist/{chunk-UHP56ITH.mjs.map → chunk-WBL4BT3I.mjs.map} +0 -0
- /package/dist/{chunk-4K6SPD7T.mjs.map → chunk-WDC45I5H.mjs.map} +0 -0
- /package/dist/{chunk-I32HDHLS.mjs.map → chunk-ZNUHRHPU.mjs.map} +0 -0
package/dist/utils/Promise.mjs
CHANGED
|
@@ -6,9 +6,12 @@ import {
|
|
|
6
6
|
tuple2,
|
|
7
7
|
tuple3,
|
|
8
8
|
tuple4,
|
|
9
|
-
tuple5
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
tuple5,
|
|
10
|
+
tupleO
|
|
11
|
+
} from "../chunk-HO3IEF5S.mjs";
|
|
12
|
+
import "../chunk-KBB2WGTO.mjs";
|
|
13
|
+
import "../chunk-TLYJ2G3X.mjs";
|
|
14
|
+
import "../chunk-SSROJBD5.mjs";
|
|
12
15
|
import "../chunk-CO2AFYVD.mjs";
|
|
13
16
|
import "../chunk-BDA5LB4S.mjs";
|
|
14
17
|
import "../chunk-SJGQU3OG.mjs";
|
|
@@ -26,6 +29,7 @@ export {
|
|
|
26
29
|
tuple2,
|
|
27
30
|
tuple3,
|
|
28
31
|
tuple4,
|
|
29
|
-
tuple5
|
|
32
|
+
tuple5,
|
|
33
|
+
tupleO
|
|
30
34
|
};
|
|
31
35
|
//# sourceMappingURL=Promise.mjs.map
|
package/dist/utils/Seconds.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
seconds
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-O4CJ7NSN.mjs";
|
|
4
|
+
import "../chunk-TLYJ2G3X.mjs";
|
|
5
|
+
import "../chunk-SSROJBD5.mjs";
|
|
5
6
|
import "../chunk-CO2AFYVD.mjs";
|
|
6
7
|
import "../chunk-BDA5LB4S.mjs";
|
|
7
8
|
import "../chunk-SJGQU3OG.mjs";
|
package/dist/utils/Sentence.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
text
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-6ENYJKOF.mjs";
|
|
4
|
+
import "../chunk-KBB2WGTO.mjs";
|
|
5
|
+
import "../chunk-TLYJ2G3X.mjs";
|
|
6
|
+
import "../chunk-SSROJBD5.mjs";
|
|
6
7
|
import "../chunk-CO2AFYVD.mjs";
|
|
7
8
|
import "../chunk-BDA5LB4S.mjs";
|
|
8
9
|
import "../chunk-SJGQU3OG.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/Sentence.ts"],"sourcesContent":["import type { Text } from '../types/Text';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/Sentence.ts"],"sourcesContent":["import type { Text } from '../types/Text';\nimport { Id } from '../types/Id';\nimport { text } from '../types/ToText';\n\nexport class Sentence implements Text {\n constructor(\n word: Text,\n pre?: Sentence,\n private sentence: Text[] = (pre?.sentence ?? []).concat(word)\n ) {}\n\n toString(): string {\n return text(this.sentence.join(' ')).sentence.toString();\n }\n}\n\nclass Topic extends Sentence {\n it = new Sentence('it', this);\n anything = new Sentence('anything', this);\n id = (id: Id) => new Sentence(`id '${id}'`, this);\n your = (subject?: Text) => new Sentence(`your ${subject ?? 'item'}`, this);\n a = (subject?: Text) => new Sentence(subject ? `a ${subject}` : 'an item', this);\n an = (subject?: Text) => new Sentence(`an ${subject ?? 'item'}`, this);\n any = (subjects?: Text) => new Sentence(`any ${subjects ?? 'items'}`, this);\n}\n\nclass Verb extends Sentence {\n add = new Topic('add', this);\n check = new Topic('check', this);\n fetch = new Topic('fetch', this);\n find = new Topic('find', this);\n like = new Topic('like', this);\n process = new Topic('process', this);\n remove = new Topic('remove', this);\n translate = new Topic('translate', this);\n update = new Topic('update', this);\n validate = new Topic('validate', this);\n}\n\nclass Not extends Verb {}\n\nclass SupportVerb extends Verb {\n not = new Not('not', this);\n}\n\nclass We extends Sentence {\n could = new SupportVerb('could', this);\n did = new SupportVerb('did', this);\n\n added = new Topic('added', this);\n checked = new Topic('checked', this);\n fetched = new Topic('fetched', this);\n found = new Topic('found', this);\n liked = new Topic('liked', this);\n processed = new Topic('processed', this);\n removed = new Topic('removed', this);\n translated = new Topic('translated', this);\n updated = new Topic('updated', this);\n validated = new Topic('validated', this);\n}\n\nexport const we = new We('we');\n"],"mappings":";;;;;;;;;;;;;;;;;AAIO,IAAM,WAAN,MAA+B;AAAA,EACpC,YACE,MACA,KACQ,YAAoB,KAAK,YAAY,CAAC,GAAG,OAAO,IAAI,GAC5D;AADQ;AAAA,EACP;AAAA,EAEH,WAAmB;AACjB,WAAO,KAAK,KAAK,SAAS,KAAK,GAAG,CAAC,EAAE,SAAS,SAAS;AAAA,EACzD;AACF;AAEA,IAAM,QAAN,cAAoB,SAAS;AAAA,EAC3B,KAAK,IAAI,SAAS,MAAM,IAAI;AAAA,EAC5B,WAAW,IAAI,SAAS,YAAY,IAAI;AAAA,EACxC,KAAK,CAAC,OAAW,IAAI,SAAS,OAAO,EAAE,KAAK,IAAI;AAAA,EAChD,OAAO,CAAC,YAAmB,IAAI,SAAS,QAAQ,WAAW,MAAM,IAAI,IAAI;AAAA,EACzE,IAAI,CAAC,YAAmB,IAAI,SAAS,UAAU,KAAK,OAAO,KAAK,WAAW,IAAI;AAAA,EAC/E,KAAK,CAAC,YAAmB,IAAI,SAAS,MAAM,WAAW,MAAM,IAAI,IAAI;AAAA,EACrE,MAAM,CAAC,aAAoB,IAAI,SAAS,OAAO,YAAY,OAAO,IAAI,IAAI;AAC5E;AAEA,IAAM,OAAN,cAAmB,SAAS;AAAA,EAC1B,MAAM,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3B,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,EAC7B,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,EAC7B,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,SAAS,IAAI,MAAM,UAAU,IAAI;AAAA,EACjC,YAAY,IAAI,MAAM,aAAa,IAAI;AAAA,EACvC,SAAS,IAAI,MAAM,UAAU,IAAI;AAAA,EACjC,WAAW,IAAI,MAAM,YAAY,IAAI;AACvC;AAEA,IAAM,MAAN,cAAkB,KAAK;AAAC;AAExB,IAAM,cAAN,cAA0B,KAAK;AAAA,EAC7B,MAAM,IAAI,IAAI,OAAO,IAAI;AAC3B;AAEA,IAAM,KAAN,cAAiB,SAAS;AAAA,EACxB,QAAQ,IAAI,YAAY,SAAS,IAAI;AAAA,EACrC,MAAM,IAAI,YAAY,OAAO,IAAI;AAAA,EAEjC,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,YAAY,IAAI,MAAM,aAAa,IAAI;AAAA,EACvC,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,aAAa,IAAI,MAAM,cAAc,IAAI;AAAA,EACzC,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,YAAY,IAAI,MAAM,aAAa,IAAI;AACzC;AAEO,IAAM,KAAK,IAAI,GAAG,IAAI;","names":[]}
|
package/dist/utils/View.mjs
CHANGED
|
@@ -4,24 +4,24 @@ import {
|
|
|
4
4
|
toViewer,
|
|
5
5
|
view,
|
|
6
6
|
views
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-OWZ5I5IV.mjs";
|
|
7
|
+
} from "../chunk-73VXBPTL.mjs";
|
|
8
|
+
import "../chunk-BDKRR6H2.mjs";
|
|
9
|
+
import "../chunk-JJQAGAQN.mjs";
|
|
10
|
+
import "../chunk-GA7BBYC2.mjs";
|
|
11
|
+
import "../chunk-YYIIQGLL.mjs";
|
|
13
12
|
import "../chunk-OFGI5FLG.mjs";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-ST3P6VWM.mjs";
|
|
14
|
+
import "../chunk-OVORFG3O.mjs";
|
|
15
|
+
import "../chunk-HO3IEF5S.mjs";
|
|
16
|
+
import "../chunk-HFBHENMJ.mjs";
|
|
18
17
|
import "../chunk-WSBULPUZ.mjs";
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-ONWMWJ43.mjs";
|
|
19
|
+
import "../chunk-6ENYJKOF.mjs";
|
|
20
|
+
import "../chunk-FLJXHLSM.mjs";
|
|
21
|
+
import "../chunk-LIDMZELG.mjs";
|
|
22
|
+
import "../chunk-KBB2WGTO.mjs";
|
|
23
|
+
import "../chunk-TLYJ2G3X.mjs";
|
|
24
|
+
import "../chunk-SSROJBD5.mjs";
|
|
25
25
|
import "../chunk-CO2AFYVD.mjs";
|
|
26
26
|
import "../chunk-BDA5LB4S.mjs";
|
|
27
27
|
import "../chunk-SJGQU3OG.mjs";
|
|
@@ -17,21 +17,22 @@ import {
|
|
|
17
17
|
required,
|
|
18
18
|
rule,
|
|
19
19
|
valid
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-Y5NBOPDI.mjs";
|
|
21
21
|
import "../chunk-ADJAEGCT.mjs";
|
|
22
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-YYIIQGLL.mjs";
|
|
23
23
|
import "../chunk-OFGI5FLG.mjs";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-ST3P6VWM.mjs";
|
|
25
|
+
import "../chunk-OVORFG3O.mjs";
|
|
26
|
+
import "../chunk-HO3IEF5S.mjs";
|
|
27
|
+
import "../chunk-HFBHENMJ.mjs";
|
|
28
28
|
import "../chunk-WSBULPUZ.mjs";
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
31
|
-
import "../chunk-
|
|
32
|
-
import "../chunk-
|
|
33
|
-
import "../chunk-
|
|
34
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-ONWMWJ43.mjs";
|
|
30
|
+
import "../chunk-6ENYJKOF.mjs";
|
|
31
|
+
import "../chunk-FLJXHLSM.mjs";
|
|
32
|
+
import "../chunk-LIDMZELG.mjs";
|
|
33
|
+
import "../chunk-KBB2WGTO.mjs";
|
|
34
|
+
import "../chunk-TLYJ2G3X.mjs";
|
|
35
|
+
import "../chunk-SSROJBD5.mjs";
|
|
35
36
|
import "../chunk-CO2AFYVD.mjs";
|
|
36
37
|
import "../chunk-BDA5LB4S.mjs";
|
|
37
38
|
import "../chunk-SJGQU3OG.mjs";
|
|
@@ -3,19 +3,20 @@ import {
|
|
|
3
3
|
isValid,
|
|
4
4
|
validate,
|
|
5
5
|
validateReject
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-YYIIQGLL.mjs";
|
|
7
7
|
import "../chunk-OFGI5FLG.mjs";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-ST3P6VWM.mjs";
|
|
9
|
+
import "../chunk-OVORFG3O.mjs";
|
|
10
|
+
import "../chunk-HO3IEF5S.mjs";
|
|
11
|
+
import "../chunk-HFBHENMJ.mjs";
|
|
12
12
|
import "../chunk-WSBULPUZ.mjs";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-ONWMWJ43.mjs";
|
|
14
|
+
import "../chunk-6ENYJKOF.mjs";
|
|
15
|
+
import "../chunk-FLJXHLSM.mjs";
|
|
16
|
+
import "../chunk-LIDMZELG.mjs";
|
|
17
|
+
import "../chunk-KBB2WGTO.mjs";
|
|
18
|
+
import "../chunk-TLYJ2G3X.mjs";
|
|
19
|
+
import "../chunk-SSROJBD5.mjs";
|
|
19
20
|
import "../chunk-CO2AFYVD.mjs";
|
|
20
21
|
import "../chunk-BDA5LB4S.mjs";
|
|
21
22
|
import "../chunk-SJGQU3OG.mjs";
|
package/dist/validation/When.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
When,
|
|
3
3
|
when
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-YYIIQGLL.mjs";
|
|
5
5
|
import "../chunk-OFGI5FLG.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-ST3P6VWM.mjs";
|
|
7
|
+
import "../chunk-OVORFG3O.mjs";
|
|
8
|
+
import "../chunk-HO3IEF5S.mjs";
|
|
9
|
+
import "../chunk-HFBHENMJ.mjs";
|
|
10
10
|
import "../chunk-WSBULPUZ.mjs";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-ONWMWJ43.mjs";
|
|
12
|
+
import "../chunk-6ENYJKOF.mjs";
|
|
13
|
+
import "../chunk-FLJXHLSM.mjs";
|
|
14
|
+
import "../chunk-LIDMZELG.mjs";
|
|
15
|
+
import "../chunk-KBB2WGTO.mjs";
|
|
16
|
+
import "../chunk-TLYJ2G3X.mjs";
|
|
17
|
+
import "../chunk-SSROJBD5.mjs";
|
|
17
18
|
import "../chunk-CO2AFYVD.mjs";
|
|
18
19
|
import "../chunk-BDA5LB4S.mjs";
|
|
19
20
|
import "../chunk-SJGQU3OG.mjs";
|
package/package.json
CHANGED
package/src/domain/DateTime.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type DiffOptions = {
|
|
|
21
21
|
rounding: 'floor' | 'ceil' | 'round';
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
type DatetimeInput = string | number | Date | DateTime | null;
|
|
24
|
+
export type DatetimeInput = string | number | Date | DateTime | null;
|
|
25
25
|
|
|
26
26
|
export class DateTime extends Value<Optional<string>> {
|
|
27
27
|
protected readonly luxon: LuxonDateTime;
|
package/src/index.ts
CHANGED
|
@@ -117,7 +117,7 @@ export * from './utils/Sentence';
|
|
|
117
117
|
export * from './utils/Traverse';
|
|
118
118
|
export * from './utils/View';
|
|
119
119
|
export * from './utils/Wait';
|
|
120
|
-
|
|
121
120
|
export * from './validation/Contraints';
|
|
122
121
|
export * from './validation/Validate';
|
|
123
122
|
export * from './validation/When';
|
|
123
|
+
export * from './types/ToText';
|
package/src/process/Scope.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Enum } from '../types/Enum';
|
|
2
|
-
import { text } from '../types/Template';
|
|
3
2
|
import type { Text } from '../types/Text';
|
|
4
3
|
import { kebab } from '../types/Text';
|
|
5
4
|
import { List, toList } from '../types/List';
|
|
6
5
|
import { isString } from '../types/Is';
|
|
7
6
|
import { IdNamePlain } from '../types/IdName';
|
|
7
|
+
import { text } from '../types/ToText';
|
|
8
8
|
|
|
9
9
|
export class Scope extends Enum {
|
|
10
10
|
protected constructor(
|
package/src/process/UseCase.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Scope } from './Scope';
|
|
2
2
|
import { App } from './App';
|
|
3
3
|
import { Enum } from '../types/Enum';
|
|
4
|
-
import { text } from '../types/Template';
|
|
5
4
|
import { kebab, Text } from '../types/Text';
|
|
6
5
|
import { List, toList } from '../types/List';
|
|
7
6
|
import { isIn, isString } from '../types/Is';
|
|
8
7
|
import { IdNamePlain } from '../types/IdName';
|
|
8
|
+
import { text } from '../types/ToText';
|
|
9
9
|
|
|
10
10
|
export class UseCase extends Enum {
|
|
11
11
|
constructor(
|
|
@@ -17,6 +17,10 @@ export class UseCase extends Enum {
|
|
|
17
17
|
super(name, id.toString());
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
static byScopes<U extends UseCase>(...s: Scope[]): List<U> {
|
|
21
|
+
return this.filter(u => u.scopes.some(us => isIn(us, s)));
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
with(...s: Scope[]): this {
|
|
21
25
|
this.scopes.add(
|
|
22
26
|
...toList(s)
|
|
@@ -31,8 +35,4 @@ export class UseCase extends Enum {
|
|
|
31
35
|
...this.scopes.map(s => s?.for(item))
|
|
32
36
|
);
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
static byScopes<U extends UseCase>(...s: Scope[]): List<U> {
|
|
36
|
-
return this.filter(u => u.scopes.some(us => isIn(us, s)));
|
|
37
|
-
}
|
|
38
38
|
}
|
package/src/types/AnyKey.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
export type AnyKey<T> = {
|
|
2
|
-
[Key in keyof T & (string | number)]: T[Key] extends object
|
|
1
|
+
export type AnyKey<T, Visited = never> = {
|
|
2
|
+
[Key in keyof T & (string | number)]: T[Key] extends object
|
|
3
|
+
? T[Key] extends (...args: unknown[]) => unknown
|
|
4
|
+
? `${Key}` // don't recurse into function types
|
|
5
|
+
: T[Key] extends Visited
|
|
6
|
+
? `${Key}` // already visiting this type -> break cycle
|
|
7
|
+
: Key extends keyof T[Key] & (string | number)
|
|
8
|
+
? `${Key}` // nested type has same key (e.g. inAmsterdam().inAmsterdam()) -> break chain
|
|
9
|
+
: `${Key}` | `${Key}.${AnyKey<T[Key], Visited | T>}`
|
|
10
|
+
: `${Key}`;
|
|
3
11
|
}[keyof T & (string | number)];
|
package/src/types/Context.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Uuid } from './Uuid';
|
|
2
2
|
import { Identity } from './Identity';
|
|
3
3
|
import { Optional } from './Types';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import { text } from './ToText';
|
|
5
6
|
|
|
6
7
|
export interface EnvContext {
|
|
7
8
|
readonly domain: string;
|
|
@@ -35,9 +36,12 @@ export interface RequestContext {
|
|
|
35
36
|
correlationId?: Uuid;
|
|
36
37
|
lastError?: string;
|
|
37
38
|
lastErrorStack?: string;
|
|
39
|
+
create: (f: () => void) => void;
|
|
40
|
+
|
|
38
41
|
get<T>(key: string): T;
|
|
42
|
+
|
|
39
43
|
set<T>(key: string, value: T): T;
|
|
40
|
-
|
|
44
|
+
|
|
41
45
|
wrap<T>(f: () => Promise<T>): Promise<T>;
|
|
42
46
|
}
|
|
43
47
|
|
package/src/types/Exception.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { asString, Text } from './Text';
|
|
|
2
2
|
import { Enum } from './Enum';
|
|
3
3
|
import { isDefined } from './Is';
|
|
4
4
|
import { Id } from './Id';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import { text } from './ToText';
|
|
6
7
|
|
|
7
8
|
export class Exception extends Enum {
|
|
8
9
|
static readonly AlreadyExists = new Exception('Subject already exists');
|
package/src/types/List.ts
CHANGED
|
@@ -8,6 +8,10 @@ import type { Id } from './Id';
|
|
|
8
8
|
import { asString } from './Text';
|
|
9
9
|
import { Optional } from './Types';
|
|
10
10
|
import { ifDefined, ifTrue } from '../utils/If';
|
|
11
|
+
import { AnyKey } from './AnyKey';
|
|
12
|
+
import { traverse } from '../utils/Traverse';
|
|
13
|
+
|
|
14
|
+
type Pred<T> = (value: T, index: number, obj: T[]) => unknown;
|
|
11
15
|
|
|
12
16
|
export class List<T = unknown> extends Array<T> {
|
|
13
17
|
get ids(): List<Id> {
|
|
@@ -42,7 +46,7 @@ export class List<T = unknown> extends Array<T> {
|
|
|
42
46
|
return this.sort((e1, e2) => (ofProperty(e1, p) < ofProperty(e2, p) ? 1 : -1));
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
first(p?:
|
|
49
|
+
first(p?: Pred<T>, params?: unknown): T {
|
|
46
50
|
return (p ? this.find(p, params) : this[0]) as T;
|
|
47
51
|
}
|
|
48
52
|
|
|
@@ -58,15 +62,15 @@ export class List<T = unknown> extends Array<T> {
|
|
|
58
62
|
return value === this.first();
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
next(p?:
|
|
65
|
+
next(p?: Pred<T>, params?: unknown): T {
|
|
62
66
|
return p ? this[this.findIndex(p, params) + 1] : this[0];
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
prev(p?:
|
|
69
|
+
prev(p?: Pred<T>, params?: unknown): T {
|
|
66
70
|
return p ? this[this.findIndex(p, params) - 1] : this[0];
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
last(p?:
|
|
73
|
+
last(p?: Pred<T>, params?: unknown): T {
|
|
70
74
|
return p ? this.filter(p, params).last() : this[this.length - 1];
|
|
71
75
|
}
|
|
72
76
|
|
|
@@ -157,7 +161,7 @@ export class List<T = unknown> extends Array<T> {
|
|
|
157
161
|
const seen = new Set<string>();
|
|
158
162
|
return this.filter(item => !seen.has(JSON.stringify(item)) && seen.add(JSON.stringify(item)));
|
|
159
163
|
}
|
|
160
|
-
filter(p:
|
|
164
|
+
filter(p: Pred<T>, params?: unknown): List<T> {
|
|
161
165
|
return toList<T>(super.filter(p, params));
|
|
162
166
|
}
|
|
163
167
|
|
|
@@ -224,10 +228,12 @@ export class List<T = unknown> extends Array<T> {
|
|
|
224
228
|
return this.includes(item) ? this.remove(item) : this.add(item);
|
|
225
229
|
}
|
|
226
230
|
|
|
227
|
-
switchOn(
|
|
228
|
-
switchOn(
|
|
229
|
-
switchOn
|
|
230
|
-
return use(typeof on === 'function' ? this.find(on) :
|
|
231
|
+
switchOn<U = T>(item: U, on: AnyKey<U>): List<T>;
|
|
232
|
+
switchOn<T>(item: T, on: Pred<T>): List<T>;
|
|
233
|
+
switchOn<U = T>(item: T, on: AnyKey<U> | Pred<T>): List<T> {
|
|
234
|
+
return use(typeof on === 'function' ? this.find(on) : use(traverse(item, on), v => this.find(i => traverse(i, on) === v)), i =>
|
|
235
|
+
i ? this.remove(i) : this.add(item)
|
|
236
|
+
);
|
|
231
237
|
}
|
|
232
238
|
|
|
233
239
|
defined(): List<NonNullable<T>> {
|
|
@@ -278,11 +284,11 @@ export class List<T = unknown> extends Array<T> {
|
|
|
278
284
|
}
|
|
279
285
|
|
|
280
286
|
//we needed to add U because of a Typescript issue with generics
|
|
281
|
-
update<U = T>(p:
|
|
287
|
+
update<U = T>(p: Pred<T>, val: T | ((v: U) => T)): List<T> {
|
|
282
288
|
return this.map((v, i, a) => (p(v, i, a) ? ofGet<T>(val, v, i, a) : v));
|
|
283
289
|
}
|
|
284
290
|
|
|
285
|
-
updateFirst<U = T>(p:
|
|
291
|
+
updateFirst<U = T>(p: Pred<T>, val: T | ((v: U) => T)) {
|
|
286
292
|
const index = this.findIndex(p);
|
|
287
293
|
return this.update((t, i) => p(t, i, this) && i == index, val);
|
|
288
294
|
}
|
package/src/types/Template.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { List, toList } from './List';
|
|
2
|
-
import { asString,
|
|
2
|
+
import { asString, Text } from './Text';
|
|
3
3
|
import { toName } from './Constructor';
|
|
4
|
-
import { Optional } from './Types';
|
|
5
|
-
import { Get, ofGet } from './Get';
|
|
6
|
-
import { isEmpty, isNotEmpty } from './Is';
|
|
7
|
-
import { JsonValue } from './Json';
|
|
8
4
|
import { entries } from './Object';
|
|
5
|
+
import { text, textValue } from './ToText';
|
|
9
6
|
|
|
10
7
|
export type TemplateOptions = { type?: Text; property?: Text; actual?: Text; subject?: Text };
|
|
11
8
|
|
|
@@ -47,150 +44,3 @@ export function template(tmpl: Text, subject: unknown, options: TemplateOptions
|
|
|
47
44
|
...options,
|
|
48
45
|
});
|
|
49
46
|
}
|
|
50
|
-
|
|
51
|
-
export class ToText implements Text {
|
|
52
|
-
constructor(readonly subject: string) {}
|
|
53
|
-
|
|
54
|
-
get cap(): ToText {
|
|
55
|
-
return this.map(s => capitalize(s?.toLowerCase()));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
get capFirst(): ToText {
|
|
59
|
-
return this.map(s => capitalize(s));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
get title(): ToText {
|
|
63
|
-
return this.map(s =>
|
|
64
|
-
s
|
|
65
|
-
.split(' ')
|
|
66
|
-
.map(w => text(w).cap)
|
|
67
|
-
.join(' ')
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get pascal(): ToText {
|
|
72
|
-
return this.title.replace(' ', '');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get lower(): ToText {
|
|
76
|
-
return this.map(s => s.toLowerCase());
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
get upper(): ToText {
|
|
80
|
-
return this.map(s => s.toUpperCase());
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
get camel(): ToText {
|
|
84
|
-
return this.title.trim.map(s => `${s.charAt(0).toLowerCase()}${s.slice(1)}`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get kebab(): ToText {
|
|
88
|
-
return this.lower.replace(' ', '-');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
get strictKebab(): ToText {
|
|
92
|
-
return this.map(s => s.replace(/[^a-z\d]+/gi, ' ').trim()).kebab;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
get slug(): ToText {
|
|
96
|
-
return this.map(s =>
|
|
97
|
-
s
|
|
98
|
-
.replace(/ß/g, 'ss')
|
|
99
|
-
.normalize('NFKD')
|
|
100
|
-
.replace(/[\u0300-\u036F]/g, '')
|
|
101
|
-
.toLowerCase()
|
|
102
|
-
.replace(/[^a-z\d]+/g, '-')
|
|
103
|
-
.replace(/(^-)|(-$)/g, '')
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
get snake(): ToText {
|
|
108
|
-
return this.upper.replace(' ', '_');
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
get plural(): ToText {
|
|
112
|
-
return this.ifLike('') ?? this.add('s');
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
get space(): ToText {
|
|
116
|
-
return this.map(s => s.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/[_-]/g, ' '));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get sentence(): ToText {
|
|
120
|
-
return this.isEmpty ? this : this.map(s => `${s.charAt(0).toUpperCase()}${s.slice(1)}.`);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
get initials(): ToText {
|
|
124
|
-
return this.map(s =>
|
|
125
|
-
s
|
|
126
|
-
.split(' ')
|
|
127
|
-
.map(w => w[0])
|
|
128
|
-
.join('')
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
get trim(): ToText {
|
|
133
|
-
return this.map(s => s.replace(/[- ,_#]/g, ''));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
get isEmpty(): boolean {
|
|
137
|
-
return isEmpty(this.toString());
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
parse = (subject: unknown, options = {}): ToText => text(template(this.subject, subject, { type: toName(subject), ...options }));
|
|
141
|
-
|
|
142
|
-
is = (...others: unknown[]): boolean => others.some(o => this.toString() === text(o).toString());
|
|
143
|
-
|
|
144
|
-
equals = this.is;
|
|
145
|
-
|
|
146
|
-
isLike = (...others: unknown[]): boolean => others.some(o => this.trim.lower.is(text(o).trim.lower));
|
|
147
|
-
|
|
148
|
-
ifLike = (...others: unknown[]): Optional<this> => (this.isLike(...others) ? this : undefined);
|
|
149
|
-
|
|
150
|
-
endsWith = (end?: unknown): boolean => this.subject.endsWith(asString(end));
|
|
151
|
-
|
|
152
|
-
startsWith = (end?: unknown): boolean => this.subject.startsWith(asString(end));
|
|
153
|
-
|
|
154
|
-
first = (n: number): ToText => this.map(s => s.substring(0, n));
|
|
155
|
-
|
|
156
|
-
last = (n: number): ToText => this.map(s => s.substring(s.length - n));
|
|
157
|
-
|
|
158
|
-
map = (func: Get<string, string>): ToText => text(ofGet(func, this.subject));
|
|
159
|
-
|
|
160
|
-
replace = (search: Text, replace: Text): ToText => this.map(s => replaceAll(s, search, replace));
|
|
161
|
-
|
|
162
|
-
add = (add?: unknown, separator = ''): ToText => this.map(s => (isNotEmpty(add) ? `${s}${separator}${text(add)}` : s));
|
|
163
|
-
|
|
164
|
-
with = (separator: string, ...other: unknown[]): ToText =>
|
|
165
|
-
this.map(s =>
|
|
166
|
-
toList(s)
|
|
167
|
-
.add(...other.map(u => text(u).toString()))
|
|
168
|
-
.filter(s => isNotEmpty(s))
|
|
169
|
-
.join(separator)
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
split = (separator: string = ' '): List<string> => toList(this.subject.split(separator));
|
|
173
|
-
|
|
174
|
-
toString(): string {
|
|
175
|
-
return this.subject;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
toJSON(): JsonValue {
|
|
179
|
-
return this.subject;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export function text(subject?: unknown, alt = ''): ToText {
|
|
184
|
-
const sub = subject ? asString(subject) : alt;
|
|
185
|
-
return new ToText(sub !== '[object Object]' ? sub : '');
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export function textValue(subject: any, prop: string): string {
|
|
189
|
-
const p = prop.split('.');
|
|
190
|
-
const root = subject?.[p[0]];
|
|
191
|
-
const initial = typeof root === 'object' && root !== null ? root : text(root);
|
|
192
|
-
return p
|
|
193
|
-
.splice(1)
|
|
194
|
-
.reduce((t, s) => t?.[s], initial)
|
|
195
|
-
?.toString() ?? '';
|
|
196
|
-
}
|