@duplojs/agents-kit 0.1.0-beta.3 → 0.1.0-beta.6
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/README.md +11 -11
- package/dist/bin/index.mjs +2 -2
- package/dist/bin/installSkill/index.d.ts +2 -0
- package/dist/bin/{install → installSkill}/index.mjs +3 -3
- package/dist/bin/{install → installSkill}/skill.mjs +1 -1
- package/dist/bin/setup/instructions.d.ts +1 -1
- package/docs/API/10-lang/10-array/10-at.ts +4 -4
- package/docs/API/10-lang/10-array/10-coalescing.ts +3 -2
- package/docs/API/10-lang/10-array/10-indexOf.ts +1 -1
- package/docs/API/10-lang/10-array/10-is.ts +17 -3
- package/docs/API/10-lang/10-array/10-lastIndexOf.ts +1 -1
- package/docs/API/10-lang/10-chrono/10-addTime.ts +1 -1
- package/docs/API/10-lang/10-chrono/10-closestTo.ts +5 -8
- package/docs/API/10-lang/10-chrono/10-isDate.ts +15 -2
- package/docs/API/10-lang/10-chrono/10-isSerializedTheDate.ts +16 -1
- package/docs/API/10-lang/10-chrono/10-isSerializedTheTime.ts +16 -1
- package/docs/API/10-lang/10-chrono/10-isTime.ts +15 -2
- package/docs/API/10-lang/10-chrono/10-maxDate.ts +4 -8
- package/docs/API/10-lang/10-chrono/10-maxTime.ts +4 -8
- package/docs/API/10-lang/10-chrono/10-minDate.ts +4 -8
- package/docs/API/10-lang/10-chrono/10-minTime.ts +4 -8
- package/docs/API/10-lang/10-chrono/10-sortDates.ts +6 -8
- package/docs/API/10-lang/10-chrono/10-sortTimes.ts +6 -8
- package/docs/API/10-lang/10-chrono/10-subtractTime.ts +1 -1
- package/docs/API/10-lang/10-common/10-and.ts +6 -0
- package/docs/API/10-lang/10-common/10-createQueue.ts +4 -3
- package/docs/API/10-lang/10-common/10-createTransformer.ts +1 -1
- package/docs/API/10-lang/10-common/10-equal.ts +6 -0
- package/docs/API/10-lang/10-common/10-falsy.ts +19 -0
- package/docs/API/10-lang/10-common/10-instanceOf.ts +14 -3
- package/docs/API/10-lang/10-common/10-isType.ts +6 -0
- package/docs/API/10-lang/10-common/10-justExec.ts +3 -3
- package/docs/API/10-lang/10-common/10-or.ts +17 -3
- package/docs/API/10-lang/10-common/10-tap.ts +28 -0
- package/docs/API/10-lang/10-common/10-toJSON.ts +1 -1
- package/docs/API/10-lang/10-common/10-toNative.ts +1 -1
- package/docs/API/10-lang/10-common/10-toRegExp.ts +1 -1
- package/docs/API/10-lang/10-common/10-truthy.ts +19 -0
- package/docs/API/10-lang/10-common/10-whenNot.ts +44 -13
- package/docs/API/10-lang/10-common/index.llms.md +4 -0
- package/docs/API/10-lang/10-dataStructure/10-typeStructureIdentifier.ts +2 -2
- package/docs/API/10-lang/10-either/10-asyncGroup.ts +1 -1
- package/docs/API/10-lang/10-either/10-asyncSafeCallback.ts +4 -2
- package/docs/API/10-lang/10-either/10-extractErrorInLeft.ts +45 -0
- package/docs/API/10-lang/10-either/10-forwardAssertsSelection.ts +1 -1
- package/docs/API/10-lang/10-either/10-group.ts +1 -1
- package/docs/API/10-lang/10-either/10-hasInformation.ts +6 -0
- package/docs/API/10-lang/10-either/10-isLeft.ts +10 -1
- package/docs/API/10-lang/10-either/10-isRight.ts +10 -1
- package/docs/API/10-lang/10-either/10-isSelected.ts +13 -1
- package/docs/API/10-lang/10-either/10-keepAsRightSelection.ts +1 -1
- package/docs/API/10-lang/10-either/10-matchInformation.ts +7 -5
- package/docs/API/10-lang/10-either/10-matchInformationCombination.ts +61 -0
- package/docs/API/10-lang/10-either/10-matchInformationCombinationOtherwise.ts +62 -0
- package/docs/API/10-lang/10-either/10-matchInformationOtherwise.ts +7 -5
- package/docs/API/10-lang/10-either/10-rightAsyncPipe.ts +2 -1
- package/docs/API/10-lang/10-either/10-rightPipe.ts +1 -1
- package/docs/API/10-lang/10-either/10-safeCallback.ts +1 -1
- package/docs/API/10-lang/10-either/10-unwrapOr.ts +2 -2
- package/docs/API/10-lang/10-either/10-unwrapOtherwise.ts +2 -2
- package/docs/API/10-lang/10-either/10-whenHasInformation.ts +4 -3
- package/docs/API/10-lang/10-either/10-whenHasInformationOtherwise.ts +5 -5
- package/docs/API/10-lang/10-either/10-whenIsLeft.ts +2 -2
- package/docs/API/10-lang/10-either/10-whenIsLeftOtherwise.ts +5 -5
- package/docs/API/10-lang/10-either/10-whenIsRight.ts +2 -2
- package/docs/API/10-lang/10-either/10-whenIsRightOtherwise.ts +7 -7
- package/docs/API/10-lang/10-either/10-whenIsSelected.ts +5 -5
- package/docs/API/10-lang/10-either/10-whenIsSelectedOtherwise.ts +5 -5
- package/docs/API/10-lang/10-either/index.llms.md +12 -0
- package/docs/API/10-lang/10-generator/10-asyncConcat.ts +7 -10
- package/docs/API/10-lang/10-generator/10-asyncFlat.ts +6 -6
- package/docs/API/10-lang/10-generator/10-concat.ts +3 -3
- package/docs/API/10-lang/10-generator/10-flat.ts +2 -2
- package/docs/API/10-lang/10-generator/10-map.ts +1 -1
- package/docs/API/10-lang/10-generator/10-reduce.ts +1 -1
- package/docs/API/10-lang/10-number/10-betweenThan.ts +43 -0
- package/docs/API/10-lang/10-number/10-betweenThanOrEqual.ts +43 -0
- package/docs/API/10-lang/10-number/10-greaterThan.ts +35 -0
- package/docs/API/10-lang/10-number/10-greaterThanOrEqual.ts +35 -0
- package/docs/API/10-lang/10-number/10-isEven.ts +33 -0
- package/docs/API/10-lang/10-number/10-isInteger.ts +33 -0
- package/docs/API/10-lang/10-number/10-isMultipleOf.ts +35 -0
- package/docs/API/10-lang/10-number/10-isNegative.ts +33 -0
- package/docs/API/10-lang/10-number/10-isNotZero.ts +33 -0
- package/docs/API/10-lang/10-number/10-isOdd.ts +33 -0
- package/docs/API/10-lang/10-number/10-isPositive.ts +33 -0
- package/docs/API/10-lang/10-number/10-isSafe.ts +33 -0
- package/docs/API/10-lang/10-number/10-isStrictNegative.ts +34 -0
- package/docs/API/10-lang/10-number/10-isStrictPositive.ts +33 -0
- package/docs/API/10-lang/10-number/10-lessThan.ts +35 -0
- package/docs/API/10-lang/10-number/10-lessThanOrEqual.ts +35 -0
- package/docs/API/10-lang/10-number/10-max.ts +19 -0
- package/docs/API/10-lang/10-number/10-maxOf.ts +19 -0
- package/docs/API/10-lang/10-number/10-min.ts +19 -0
- package/docs/API/10-lang/10-number/10-minOf.ts +19 -0
- package/docs/API/10-lang/10-number/10-sort.ts +19 -0
- package/docs/API/10-lang/10-number/10-sum.ts +19 -0
- package/docs/API/10-lang/10-number/index.llms.md +92 -0
- package/docs/API/10-lang/10-number/index.md +3 -0
- package/docs/API/10-lang/10-object/10-assign.ts +41 -0
- package/docs/API/10-lang/10-object/10-countKeys.ts +15 -0
- package/docs/API/10-lang/10-object/10-deepDiscriminate.ts +63 -0
- package/docs/API/10-lang/10-object/10-deepOverride.ts +35 -0
- package/docs/API/10-lang/10-object/10-discriminate.ts +55 -0
- package/docs/API/10-lang/10-object/10-discriminateEntryKey.ts +43 -0
- package/docs/API/10-lang/10-object/10-discriminateEntryValue.ts +44 -0
- package/docs/API/10-lang/10-object/10-entries.ts +19 -0
- package/docs/API/10-lang/10-object/10-entry.ts +17 -0
- package/docs/API/10-lang/10-object/10-fromEntries.ts +23 -0
- package/docs/API/10-lang/10-object/10-getDeepProperty.ts +26 -0
- package/docs/API/10-lang/10-object/10-getProperty.ts +24 -0
- package/docs/API/10-lang/10-object/10-hasKeys.ts +43 -0
- package/docs/API/10-lang/10-object/10-isSimple.ts +38 -0
- package/docs/API/10-lang/10-object/10-keys.ts +19 -0
- package/docs/API/10-lang/10-object/10-omit.ts +39 -0
- package/docs/API/10-lang/10-object/10-override.ts +24 -0
- package/docs/API/10-lang/10-object/10-pick.ts +41 -0
- package/docs/API/10-lang/10-object/10-to.ts +40 -0
- package/docs/API/10-lang/10-object/10-transformProperties.ts +43 -0
- package/docs/API/10-lang/10-object/10-transformProperty.ts +39 -0
- package/docs/API/10-lang/10-object/10-values.ts +19 -0
- package/docs/API/10-lang/10-object/index.llms.md +92 -0
- package/docs/API/10-lang/10-object/index.md +3 -0
- package/docs/API/10-lang/10-path/10-computeRelative.ts +19 -0
- package/docs/API/10-lang/10-path/10-concatSegment.ts +28 -0
- package/docs/API/10-lang/10-path/10-create.ts +21 -0
- package/docs/API/10-lang/10-path/10-createAbsolute.ts +21 -0
- package/docs/API/10-lang/10-path/10-createAbsoluteOrThrow.ts +16 -0
- package/docs/API/10-lang/10-path/10-createMatcher.ts +50 -0
- package/docs/API/10-lang/10-path/10-createOrThrow.ts +16 -0
- package/docs/API/10-lang/10-path/10-createSegment.ts +26 -0
- package/docs/API/10-lang/10-path/10-createSegmentOrThrow.ts +16 -0
- package/docs/API/10-lang/10-path/10-declareAbsolutePath.ts +15 -0
- package/docs/API/10-lang/10-path/10-declarePath.ts +15 -0
- package/docs/API/10-lang/10-path/10-declareSegment.ts +15 -0
- package/docs/API/10-lang/10-path/10-getBaseName.ts +22 -0
- package/docs/API/10-lang/10-path/10-getExtensionName.ts +22 -0
- package/docs/API/10-lang/10-path/10-getParentFolderPath.ts +25 -0
- package/docs/API/10-lang/10-path/10-is.ts +46 -0
- package/docs/API/10-lang/10-path/10-isAbsolute.ts +46 -0
- package/docs/API/10-lang/10-path/10-isSegment.ts +42 -0
- package/docs/API/10-lang/10-path/10-normalize.ts +26 -0
- package/docs/API/10-lang/10-path/10-resolveFrom.ts +37 -0
- package/docs/API/10-lang/10-path/10-resolveRelative.ts +23 -0
- package/docs/API/10-lang/10-path/index.llms.md +88 -0
- package/docs/API/10-lang/10-path/index.md +3 -0
- package/docs/API/10-lang/10-pattern/10-exhaustive.ts +26 -0
- package/docs/API/10-lang/10-pattern/10-isMatch.ts +72 -0
- package/docs/API/10-lang/10-pattern/10-match.ts +133 -0
- package/docs/API/10-lang/10-pattern/10-matchWithEntity.ts +49 -0
- package/docs/API/10-lang/10-pattern/10-matchWithEntityOtherwise.ts +55 -0
- package/docs/API/10-lang/10-pattern/10-matchWithError.ts +45 -0
- package/docs/API/10-lang/10-pattern/10-matchWithErrorOtherwise.ts +48 -0
- package/docs/API/10-lang/10-pattern/10-matchWithFact.ts +49 -0
- package/docs/API/10-lang/10-pattern/10-matchWithFactOtherwise.ts +49 -0
- package/docs/API/10-lang/10-pattern/10-matchWithNumber.ts +33 -0
- package/docs/API/10-lang/10-pattern/10-matchWithNumberOtherwise.ts +37 -0
- package/docs/API/10-lang/10-pattern/10-matchWithString.ts +34 -0
- package/docs/API/10-lang/10-pattern/10-matchWithStringOtherwise.ts +35 -0
- package/docs/API/10-lang/10-pattern/10-matchWithTaggedObject.ts +43 -0
- package/docs/API/10-lang/10-pattern/10-matchWithTaggedObjectOtherwise.ts +49 -0
- package/docs/API/10-lang/10-pattern/10-otherwise.ts +28 -0
- package/docs/API/10-lang/10-pattern/10-union.ts +47 -0
- package/docs/API/10-lang/10-pattern/10-when.ts +46 -0
- package/docs/API/10-lang/10-pattern/10-whenNot.ts +123 -0
- package/docs/API/10-lang/10-pattern/index.llms.md +80 -0
- package/docs/API/10-lang/10-pattern/index.md +3 -0
- package/docs/API/10-lang/10-printer/10-bold.ts +12 -0
- package/docs/API/10-lang/10-printer/10-colorized.ts +18 -0
- package/docs/API/10-lang/10-printer/10-colorizedBold.ts +18 -0
- package/docs/API/10-lang/10-printer/10-indent.ts +20 -0
- package/docs/API/10-lang/10-printer/10-primitives.md +11 -0
- package/docs/API/10-lang/10-printer/10-render.ts +29 -0
- package/docs/API/10-lang/10-printer/10-renderLine.ts +12 -0
- package/docs/API/10-lang/10-printer/10-renderParagraph.ts +16 -0
- package/docs/API/10-lang/10-printer/index.llms.md +37 -0
- package/docs/API/10-lang/10-printer/index.md +3 -0
- package/docs/API/10-lang/10-string/10-at.ts +18 -0
- package/docs/API/10-lang/10-string/10-capitalize.ts +18 -0
- package/docs/API/10-lang/10-string/10-charAt.ts +18 -0
- package/docs/API/10-lang/10-string/10-concat.ts +18 -0
- package/docs/API/10-lang/10-string/10-endsWith.ts +33 -0
- package/docs/API/10-lang/10-string/10-extract.ts +18 -0
- package/docs/API/10-lang/10-string/10-extractAll.ts +18 -0
- package/docs/API/10-lang/10-string/10-first.ts +17 -0
- package/docs/API/10-lang/10-string/10-includes.ts +33 -0
- package/docs/API/10-lang/10-string/10-indexOf.ts +17 -0
- package/docs/API/10-lang/10-string/10-isComposedOf.ts +33 -0
- package/docs/API/10-lang/10-string/10-isEmail.ts +56 -0
- package/docs/API/10-lang/10-string/10-isIn.ts +34 -0
- package/docs/API/10-lang/10-string/10-isKeyof.ts +37 -0
- package/docs/API/10-lang/10-string/10-isNotEmpty.ts +32 -0
- package/docs/API/10-lang/10-string/10-isNumber.ts +32 -0
- package/docs/API/10-lang/10-string/10-isTrimmed.ts +33 -0
- package/docs/API/10-lang/10-string/10-isUrl.ts +31 -0
- package/docs/API/10-lang/10-string/10-isUuid.ts +31 -0
- package/docs/API/10-lang/10-string/10-join.ts +18 -0
- package/docs/API/10-lang/10-string/10-last.ts +17 -0
- package/docs/API/10-lang/10-string/10-lastIndexOf.ts +17 -0
- package/docs/API/10-lang/10-string/10-length.ts +18 -0
- package/docs/API/10-lang/10-string/10-lengthEqual.ts +33 -0
- package/docs/API/10-lang/10-string/10-maxCharacters.ts +33 -0
- package/docs/API/10-lang/10-string/10-minCharacters.ts +33 -0
- package/docs/API/10-lang/10-string/10-normalize.ts +17 -0
- package/docs/API/10-lang/10-string/10-padEnd.ts +17 -0
- package/docs/API/10-lang/10-string/10-padStart.ts +17 -0
- package/docs/API/10-lang/10-string/10-pop.ts +17 -0
- package/docs/API/10-lang/10-string/10-prepend.ts +17 -0
- package/docs/API/10-lang/10-string/10-repeat.ts +17 -0
- package/docs/API/10-lang/10-string/10-replace.ts +18 -0
- package/docs/API/10-lang/10-string/10-replaceAll.ts +17 -0
- package/docs/API/10-lang/10-string/10-search.ts +17 -0
- package/docs/API/10-lang/10-string/10-shift.ts +17 -0
- package/docs/API/10-lang/10-string/10-slice.ts +17 -0
- package/docs/API/10-lang/10-string/10-sort.ts +19 -0
- package/docs/API/10-lang/10-string/10-sortCompare.ts +17 -0
- package/docs/API/10-lang/10-string/10-split.ts +34 -0
- package/docs/API/10-lang/10-string/10-startsWith.ts +33 -0
- package/docs/API/10-lang/10-string/10-stringify.ts +11 -0
- package/docs/API/10-lang/10-string/10-substring.ts +17 -0
- package/docs/API/10-lang/10-string/10-test.ts +17 -0
- package/docs/API/10-lang/10-string/10-to.ts +11 -0
- package/docs/API/10-lang/10-string/10-toLowerCase.ts +17 -0
- package/docs/API/10-lang/10-string/10-toUpperCase.ts +17 -0
- package/docs/API/10-lang/10-string/10-trim.ts +17 -0
- package/docs/API/10-lang/10-string/10-trimEnd.ts +17 -0
- package/docs/API/10-lang/10-string/10-trimStart.ts +17 -0
- package/docs/API/10-lang/10-string/10-uncapitalize.ts +17 -0
- package/docs/API/10-lang/10-string/index.llms.md +208 -0
- package/docs/API/10-lang/10-string/index.md +3 -0
- package/docs/API/10-lang/10-tuple/10-from.ts +50 -0
- package/docs/API/10-lang/10-tuple/10-map.ts +37 -0
- package/docs/API/10-lang/10-tuple/index.llms.md +12 -0
- package/docs/API/10-lang/10-tuple/index.md +3 -0
- package/docs/API/40-json-web-token/10-tokenHandler/10-createTokenHandler.ts +160 -0
- package/docs/API/40-json-web-token/10-tokenHandler/index.llms.md +8 -0
- package/docs/API/40-json-web-token/10-tokenHandler/index.md +3 -0
- package/docs/API/40-json-web-token/20-signer/10-createHS256.ts +24 -0
- package/docs/API/40-json-web-token/20-signer/10-createHS512.ts +24 -0
- package/docs/API/40-json-web-token/20-signer/10-createRS256.ts +28 -0
- package/docs/API/40-json-web-token/20-signer/10-createRS512.ts +28 -0
- package/docs/API/40-json-web-token/20-signer/10-factory.ts +29 -0
- package/docs/API/40-json-web-token/20-signer/index.llms.md +24 -0
- package/docs/API/40-json-web-token/20-signer/index.md +3 -0
- package/docs/API/40-json-web-token/30-cipher/10-createRSAOAEP.ts +26 -0
- package/docs/API/40-json-web-token/30-cipher/10-createRSAOAEP256.ts +26 -0
- package/docs/API/40-json-web-token/30-cipher/10-factory.ts +29 -0
- package/docs/API/40-json-web-token/30-cipher/index.llms.md +16 -0
- package/docs/API/40-json-web-token/30-cipher/index.md +3 -0
- package/docs/API/40-json-web-token/40-utils/10-AES_GCM.decrypt.ts +17 -0
- package/docs/API/40-json-web-token/40-utils/10-AES_GCM.encrypt.ts +11 -0
- package/docs/API/40-json-web-token/40-utils/10-AES_GCM.generateInitializationVector.ts +9 -0
- package/docs/API/40-json-web-token/40-utils/10-HMAC.sign.ts +13 -0
- package/docs/API/40-json-web-token/40-utils/10-HMAC.verify.ts +11 -0
- package/docs/API/40-json-web-token/40-utils/10-RSA.sign.ts +14 -0
- package/docs/API/40-json-web-token/40-utils/10-RSA.verify.ts +13 -0
- package/docs/API/40-json-web-token/40-utils/10-RSA_OAEP.decrypt.ts +13 -0
- package/docs/API/40-json-web-token/40-utils/10-RSA_OAEP.encrypt.ts +10 -0
- package/docs/API/40-json-web-token/40-utils/10-decodeBase64.ts +9 -0
- package/docs/API/40-json-web-token/40-utils/10-decodeBase64Url.ts +9 -0
- package/docs/API/40-json-web-token/40-utils/10-decodeText.ts +9 -0
- package/docs/API/40-json-web-token/40-utils/10-encodeBase64.ts +9 -0
- package/docs/API/40-json-web-token/40-utils/10-encodeBase64Url.ts +9 -0
- package/docs/API/40-json-web-token/40-utils/10-encodeText.ts +9 -0
- package/docs/API/40-json-web-token/40-utils/10-isBase64Url.ts +11 -0
- package/docs/API/40-json-web-token/40-utils/10-jsonParse.ts +11 -0
- package/docs/API/40-json-web-token/40-utils/10-pemToBinary.ts +11 -0
- package/docs/API/40-json-web-token/40-utils/index.llms.md +76 -0
- package/docs/API/40-json-web-token/40-utils/index.md +3 -0
- package/docs/API/40-json-web-token/index.md +3 -0
- package/docs/API/50-form/10-vue/10-construction/10-createForm.ts +48 -0
- package/docs/API/50-form/10-vue/10-construction/10-createFormField.ts +66 -0
- package/docs/API/50-form/10-vue/10-construction/10-createGridTemplates.ts +39 -0
- package/docs/API/50-form/10-vue/10-construction/10-createInput.ts +46 -0
- package/docs/API/50-form/10-vue/10-construction/10-createTemplate.ts +36 -0
- package/docs/API/50-form/10-vue/10-construction/fixtures/AddressInput.vue +19 -0
- package/docs/API/50-form/10-vue/10-construction/index.llms.md +24 -0
- package/docs/API/50-form/10-vue/10-construction/index.md +3 -0
- package/docs/API/50-form/10-vue/20-layouts/10-useCheckLayout.ts +40 -0
- package/docs/API/50-form/10-vue/20-layouts/10-useDisabledLayout.ts +34 -0
- package/docs/API/50-form/10-vue/20-layouts/10-useMultiLayout.ts +32 -0
- package/docs/API/50-form/10-vue/20-layouts/10-useRepeatLayout.ts +34 -0
- package/docs/API/50-form/10-vue/20-layouts/10-useSectionLayout.ts +20 -0
- package/docs/API/50-form/10-vue/20-layouts/10-useSlotLayout.ts +37 -0
- package/docs/API/50-form/10-vue/20-layouts/10-useStepLayout.ts +31 -0
- package/docs/API/50-form/10-vue/20-layouts/10-useUnionLayout.ts +48 -0
- package/docs/API/50-form/10-vue/20-layouts/index.llms.md +36 -0
- package/docs/API/50-form/10-vue/20-layouts/index.md +3 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useCheckbox.ts +13 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useCheckboxPolicy.ts +18 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useDateInput.ts +20 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useDualRangeInput.ts +27 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useFileInput.ts +23 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useNumberInput.ts +18 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useRadioGroup.ts +31 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useRangeDateInput.ts +23 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useRangeInput.ts +18 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useRangeTimeInput.ts +23 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useSelectInput.ts +31 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useTextInput.ts +14 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useTextareaInput.ts +14 -0
- package/docs/API/50-form/10-vue/30-designSystem/10-useTimeInput.ts +20 -0
- package/docs/API/50-form/10-vue/30-designSystem/20-components.md +11 -0
- package/docs/API/50-form/10-vue/30-designSystem/index.llms.md +65 -0
- package/docs/API/50-form/10-vue/30-designSystem/index.md +3 -0
- package/docs/API/50-form/10-vue/fixtures/templates.ts +20 -0
- package/docs/API/50-form/10-vue/index.md +3 -0
- package/docs/API/50-form/index.md +3 -0
- package/docs/API/60-playwright/10-construction/10-createComponent.ts +47 -0
- package/docs/API/60-playwright/10-construction/10-createComponentInteraction.ts +28 -0
- package/docs/API/60-playwright/10-construction/10-createPage.ts +34 -0
- package/docs/API/60-playwright/10-construction/10-createStepWrapper.ts +23 -0
- package/docs/API/60-playwright/10-construction/10-createWebsite.ts +57 -0
- package/docs/API/60-playwright/10-construction/10-initClient.ts +38 -0
- package/docs/API/60-playwright/10-construction/index.llms.md +28 -0
- package/docs/API/60-playwright/10-construction/index.md +3 -0
- package/docs/API/60-playwright/20-actions/10-check.ts +9 -0
- package/docs/API/60-playwright/20-actions/10-clear.ts +9 -0
- package/docs/API/60-playwright/20-actions/10-click.ts +9 -0
- package/docs/API/60-playwright/20-actions/10-dragTo.ts +10 -0
- package/docs/API/60-playwright/20-actions/10-extractContent.ts +10 -0
- package/docs/API/60-playwright/20-actions/10-fill.ts +9 -0
- package/docs/API/60-playwright/20-actions/10-focus.ts +9 -0
- package/docs/API/60-playwright/20-actions/10-forceClick.ts +10 -0
- package/docs/API/60-playwright/20-actions/10-hover.ts +9 -0
- package/docs/API/60-playwright/20-actions/10-press.ts +9 -0
- package/docs/API/60-playwright/20-actions/10-selectOption.ts +10 -0
- package/docs/API/60-playwright/20-actions/10-type.ts +10 -0
- package/docs/API/60-playwright/20-actions/10-uncheck.ts +9 -0
- package/docs/API/60-playwright/20-actions/10-withStep.ts +10 -0
- package/docs/API/60-playwright/20-actions/index.llms.md +60 -0
- package/docs/API/60-playwright/20-actions/index.md +3 -0
- package/docs/API/60-playwright/30-assertions/10-toBeBusy.ts +10 -0
- package/docs/API/60-playwright/30-assertions/10-toBeChecked.ts +9 -0
- package/docs/API/60-playwright/30-assertions/10-toBeDisabled.ts +9 -0
- package/docs/API/60-playwright/30-assertions/10-toBeEnabled.ts +9 -0
- package/docs/API/60-playwright/30-assertions/10-toBeHidden.ts +9 -0
- package/docs/API/60-playwright/30-assertions/10-toBeNotBusy.ts +10 -0
- package/docs/API/60-playwright/30-assertions/10-toBeVisible.ts +10 -0
- package/docs/API/60-playwright/30-assertions/10-toContainText.ts +9 -0
- package/docs/API/60-playwright/30-assertions/10-toHaveAttribute.ts +12 -0
- package/docs/API/60-playwright/30-assertions/10-toHaveClass.ts +9 -0
- package/docs/API/60-playwright/30-assertions/10-toHaveNoText.ts +10 -0
- package/docs/API/60-playwright/30-assertions/10-toHaveQuantity.ts +20 -0
- package/docs/API/60-playwright/30-assertions/10-toHaveText.ts +9 -0
- package/docs/API/60-playwright/30-assertions/10-toHaveValue.ts +9 -0
- package/docs/API/60-playwright/30-assertions/10-withStep.ts +10 -0
- package/docs/API/60-playwright/30-assertions/index.llms.md +64 -0
- package/docs/API/60-playwright/30-assertions/index.md +3 -0
- package/docs/API/60-playwright/fixtures/component.ts +44 -0
- package/docs/API/60-playwright/index.md +3 -0
- package/docs/API.llms.md +84 -0
- package/docs/concepts/01-fundamental/01-constraint/20-manipulation.ts +9 -6
- package/docs/concepts/01-fundamental/01-constraint/30-cast.ts +9 -5
- package/docs/concepts/01-fundamental/02-currying/01-use.ts +5 -0
- package/docs/concepts/01-fundamental/02-currying/10-built-in-function.ts +28 -16
- package/docs/concepts/01-fundamental/02-currying/20-inner-pipe.ts +11 -2
- package/docs/concepts/01-fundamental/02-currying/30-async-pipe.ts +11 -2
- package/docs/concepts/01-fundamental/03-either/10-discrimination.ts +23 -12
- package/docs/concepts/01-fundamental/03-either/20-exhaustive-handling.ts +27 -10
- package/docs/concepts/01-fundamental/03-either/30-composition.ts +18 -10
- package/docs/concepts/01-fundamental/03-either/40-result-adaptation.ts +10 -4
- package/docs/concepts/01-fundamental/03-either/50-external-results.ts +16 -3
- package/docs/concepts/01-fundamental/04-data-structure/10-structure.ts +110 -59
- package/docs/concepts/01-fundamental/04-data-structure/20-constraint.ts +20 -12
- package/docs/concepts/01-fundamental/04-data-structure/30-validation.ts +13 -9
- package/docs/concepts/01-fundamental/04-data-structure/40-codecs.ts +31 -20
- package/docs/concepts/01-fundamental/04-data-structure/50-recursive.ts +10 -1
- package/docs/concepts/01-fundamental/05-chrono/10-creation.ts +39 -13
- package/docs/concepts/01-fundamental/05-chrono/20-manipulation.ts +20 -4
- package/docs/concepts/01-fundamental/05-chrono/30-serialized.ts +22 -6
- package/docs/concepts/01-fundamental/05-chrono/40-timezone.ts +5 -1
- package/docs/concepts/01-fundamental/06-modeling/20-entity.ts +29 -42
- package/docs/concepts/01-fundamental/06-modeling/30-tagged-object.ts +46 -23
- package/docs/concepts/01-fundamental/06-modeling/40-entity-lifecycle.ts +30 -33
- package/docs/concepts/01-fundamental/07-discrimination/10-entity.ts +52 -20
- package/docs/concepts/01-fundamental/07-discrimination/20-fact.ts +54 -38
- package/docs/concepts/01-fundamental/07-discrimination/30-tagged-object.ts +52 -20
- package/docs/concepts/01-fundamental/07-discrimination/40-error.ts +26 -10
- package/docs/concepts/01-fundamental/07-discrimination/50-literal.ts +29 -10
- package/docs/concepts/01-fundamental/07-discrimination/60-shape.ts +10 -2
- package/docs/concepts/01-fundamental/07-discrimination/70-predicate.ts +18 -6
- package/docs/concepts/01-fundamental/08-kind/01-identity.md +7 -0
- package/docs/concepts/01-fundamental/08-kind/20-metadata.md +11 -0
- package/docs/concepts/01-fundamental/08-kind/30-transport.md +11 -0
- package/docs/concepts/01-fundamental/08-kind/index.md +3 -0
- package/docs/concepts/02-server/10-file/10-manipulation.ts +15 -3
- package/docs/concepts/02-server/10-file/20-path.ts +22 -6
- package/docs/concepts/02-server/20-http/10-init.ts +1 -9
- package/docs/concepts/02-server/20-http/20-route.ts +40 -32
- package/docs/concepts/02-server/20-http/30-routine.ts +12 -19
- package/docs/concepts/02-server/20-http/40-jwt.ts +49 -37
- package/docs/concepts/02-server/20-http/50-open-api.ts +44 -0
- package/docs/concepts/02-server/20-http/index.md +1 -1
- package/docs/concepts/02-server/30-environment/10-platform.ts +12 -3
- package/docs/concepts/02-server/30-environment/20-variable.ts +13 -7
- package/docs/concepts/03-client/10-http/10-init.ts +11 -23
- package/docs/concepts/03-client/10-http/20-request.ts +79 -69
- package/docs/concepts/03-client/10-http/30-hook.ts +23 -23
- package/docs/concepts/03-client/20-form/10-init.ts +18 -15
- package/docs/concepts/03-client/20-form/20-input.ts +13 -6
- package/docs/concepts/03-client/20-form/30-layout.ts +44 -49
- package/docs/concepts/03-client/20-form/40-template.ts +10 -5
- package/docs/concepts/03-client/20-form/50-integration.md +11 -0
- package/docs/concepts/03-client/20-form/examples/postModeration/ThePage.vue +32 -0
- package/docs/concepts/03-client/20-form/examples/postModeration/usePostModeration.ts +80 -0
- package/docs/concepts/05-type-driven-design/01-architecture/10-boundaries.md +23 -20
- package/docs/concepts/05-type-driven-design/01-architecture/index.md +1 -1
- package/docs/concepts/05-type-driven-design/02-domains/10-entities.md +29 -37
- package/docs/concepts/05-type-driven-design/02-domains/20-aggregates.md +42 -26
- package/docs/concepts/05-type-driven-design/02-domains/30-repositories.md +20 -26
- package/docs/concepts/05-type-driven-design/02-domains/40-refinements.md +30 -0
- package/docs/concepts/05-type-driven-design/02-domains/index.md +1 -1
- package/docs/concepts/05-type-driven-design/03-applications/10-use-case.md +33 -40
- package/docs/concepts/05-type-driven-design/03-applications/20-ports.md +49 -0
- package/docs/concepts/05-type-driven-design/03-applications/index.md +1 -1
- package/docs/concepts/05-type-driven-design/04-infrastructure/10-implementation.md +27 -36
- package/docs/concepts/05-type-driven-design/04-infrastructure/index.md +1 -1
- package/docs/concepts/05-type-driven-design/fixtures/business/applications/ports/index.ts +1 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/applications/ports/waitingListEntry.ts +17 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/applications/useCases/clientGiveBackBook.ts +30 -12
- package/docs/concepts/05-type-driven-design/fixtures/business/applications/useCases/clientRentBook.ts +9 -8
- package/docs/concepts/05-type-driven-design/fixtures/business/applications/useCases/createBook.ts +7 -7
- package/docs/concepts/05-type-driven-design/fixtures/business/applications/useCases/index.ts +2 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/applications/useCases/withdrawBook.ts +32 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/aggregates/clientGiveBackBook.ts +72 -13
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/aggregates/clientRentBook.ts +37 -11
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/aggregates/createBook.ts +29 -17
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/aggregates/index.ts +1 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/aggregates/withdrawBook.ts +37 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/book/facts/create.ts +4 -5
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/book/facts/index.ts +2 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/book/facts/rental.ts +9 -9
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/book/facts/reserve.ts +37 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/book/facts/returnBook.ts +11 -9
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/book/facts/withdraw.ts +21 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/book/index.ts +42 -11
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/client/facts/giveBackBook.ts +11 -9
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/client/facts/rentBook.ts +10 -10
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/client/index.ts +6 -29
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/index.ts +1 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/waitingListEntry/facts/cancel.ts +26 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/waitingListEntry/facts/create.ts +33 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/waitingListEntry/facts/index.ts +3 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/waitingListEntry/facts/prepare.ts +23 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/entities/waitingListEntry/index.ts +79 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/index.ts +1 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/refinements/index.ts +1 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/refinements/refineLinkBetweenClientAndBorrowedBook.ts +34 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/repositories/book.ts +1 -1
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/repositories/index.ts +1 -0
- package/docs/concepts/05-type-driven-design/fixtures/business/domains/repositories/waitingListEntry.ts +19 -0
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/command/clientRentBook.ts +3 -3
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/http/checkers/bookExist.ts +2 -2
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/http/checkers/clientExist.ts +2 -2
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/http/routes/clientGiveBackBook.ts +23 -14
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/http/routes/clientRentBook.ts +7 -12
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/ports/book.ts +1 -1
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/ports/index.ts +1 -0
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/ports/waitingListEntry.ts +17 -0
- package/docs/concepts/05-type-driven-design/fixtures/infrastructure/useCases/index.ts +2 -1
- package/docs/concepts/05-type-driven-design/index.md +2 -2
- package/docs/concepts.llms.md +71 -25
- package/instructions/coding-conventions.md +2 -2
- package/package.json +17 -14
- package/skills/http-client/SKILL.md +1 -1
- package/skills/http-client/references/configuration.md +3 -1
- package/skills/http-client/references/examples/client-expectations.ts +11 -10
- package/skills/http-client/references/examples/client-streams.ts +2 -2
- package/skills/http-client/references/examples/external-client.ts +2 -2
- package/skills/http-client/references/responses.md +1 -1
- package/skills/http-server/SKILL.md +4 -9
- package/skills/http-server/references/examples/authentication.ts +2 -2
- package/skills/http-server/references/examples/inferred-client.ts +54 -0
- package/skills/http-server/references/examples/minimal-route.ts +2 -3
- package/skills/http-server/references/examples/protected-route.ts +4 -6
- package/skills/http-server/references/examples/rename-user-route.ts +4 -6
- package/skills/http-server/references/examples/user-checker.ts +2 -2
- package/skills/http-server/references/examples/user-route.ts +12 -5
- package/skills/http-server/references/initialization.md +1 -1
- package/skills/http-server/references/reusable-flows.md +3 -3
- package/skills/http-server/references/routes-and-floor.md +11 -3
- package/dist/bin/install/index.d.ts +0 -2
- package/docs/concepts/02-server/20-http/50-codegen.ts +0 -29
- package/skills/http-server/references/code-generation.md +0 -31
- package/skills/http-server/references/examples/generate-sdk.ts +0 -36
- /package/dist/bin/{install → installSkill}/skill.d.ts +0 -0
|
@@ -16,10 +16,6 @@ import * as DEither from "@duplojs/lang/either";
|
|
|
16
16
|
// Le code métier n'a pas à choisir ni à manipuler la clé utilisée pour
|
|
17
17
|
// enregistrer le tag.
|
|
18
18
|
//
|
|
19
|
-
// DModeling.ObjectTag<"EmailNotification"> & {
|
|
20
|
-
// readonly email: string;
|
|
21
|
-
// readonly subject: string;
|
|
22
|
-
// }
|
|
23
19
|
const EmailNotification = DModeling.createTaggedObject(
|
|
24
20
|
"EmailNotification",
|
|
25
21
|
{
|
|
@@ -28,17 +24,20 @@ const EmailNotification = DModeling.createTaggedObject(
|
|
|
28
24
|
},
|
|
29
25
|
);
|
|
30
26
|
type EmailNotification = DDataStructure.StructureValue<typeof EmailNotification>;
|
|
27
|
+
type _CheckEmailNotification = DCommon.ExpectType<
|
|
28
|
+
EmailNotification,
|
|
29
|
+
DModeling.ObjectTag<"EmailNotification"> & {
|
|
30
|
+
readonly email: string;
|
|
31
|
+
readonly subject: string;
|
|
32
|
+
},
|
|
33
|
+
"strict"
|
|
34
|
+
>;
|
|
31
35
|
|
|
32
36
|
// Les propriétés peuvent être définies directement avec des `DataStructure`.
|
|
33
37
|
//
|
|
34
38
|
// Contrairement à une `Entity`, un `TaggedObject` n'impose pas que ses
|
|
35
39
|
// propriétés soient des `NewType`.
|
|
36
40
|
//
|
|
37
|
-
// DModeling.ObjectTag<"SmsNotification"> & {
|
|
38
|
-
// readonly phone: string;
|
|
39
|
-
// readonly message: string;
|
|
40
|
-
// readonly attempts: number;
|
|
41
|
-
// }
|
|
42
41
|
const SmsNotification = DModeling.createTaggedObject(
|
|
43
42
|
"SmsNotification",
|
|
44
43
|
{
|
|
@@ -48,6 +47,11 @@ const SmsNotification = DModeling.createTaggedObject(
|
|
|
48
47
|
},
|
|
49
48
|
);
|
|
50
49
|
type SmsNotification = DDataStructure.StructureValue<typeof SmsNotification>;
|
|
50
|
+
type _CheckSmsNotification = DCommon.ExpectType<SmsNotification, DModeling.ObjectTag<"SmsNotification"> & {
|
|
51
|
+
readonly phone: string;
|
|
52
|
+
readonly message: string;
|
|
53
|
+
readonly attempts: number;
|
|
54
|
+
}, "strict">;
|
|
51
55
|
|
|
52
56
|
// Plusieurs `TaggedObject` peuvent former une union discriminée.
|
|
53
57
|
//
|
|
@@ -69,29 +73,36 @@ const destination = DPattern.matchWithTaggedObject(
|
|
|
69
73
|
SmsNotification: (smsNotification) => smsNotification.phone,
|
|
70
74
|
},
|
|
71
75
|
);
|
|
76
|
+
type _CheckDestination = DCommon.ExpectType<typeof destination, string, "strict">;
|
|
72
77
|
|
|
73
78
|
// L'identité peut également être récupérée directement.
|
|
74
79
|
//
|
|
75
|
-
// "EmailNotification" | "SmsNotification"
|
|
76
80
|
const notificationType = DModeling.getTagValue(notification);
|
|
81
|
+
type _CheckNotificationType = DCommon.ExpectType<
|
|
82
|
+
typeof notificationType,
|
|
83
|
+
"EmailNotification" | "SmsNotification",
|
|
84
|
+
"strict"
|
|
85
|
+
>;
|
|
77
86
|
|
|
78
87
|
// `hasTagValue` permet de tester une identité et affine simultanément
|
|
79
88
|
// le type de la valeur.
|
|
80
89
|
//
|
|
81
90
|
// Dans cette branche, `notification` est précisément un `EmailNotification`.
|
|
82
91
|
if (DModeling.hasTagValue(notification, "EmailNotification")) {
|
|
92
|
+
type _CheckEmailBranch = DCommon.ExpectType<typeof notification, EmailNotification, "strict">;
|
|
83
93
|
const subject = notification.subject;
|
|
94
|
+
type _CheckSubject = DCommon.ExpectType<typeof subject, string, "strict">;
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
// `new` est utilisé lorsque les propriétés possèdent déjà le typage attendu.
|
|
87
98
|
//
|
|
88
99
|
// Il construit le `TaggedObject` et lui associe son identité.
|
|
89
100
|
//
|
|
90
|
-
// EmailNotification
|
|
91
101
|
const emailNotification = EmailNotification.new({
|
|
92
102
|
email: "user@example.com",
|
|
93
103
|
subject: "Account created",
|
|
94
104
|
});
|
|
105
|
+
type _CheckEmailNotificationValue = DCommon.ExpectType<typeof emailNotification, EmailNotification, "strict">;
|
|
95
106
|
|
|
96
107
|
// L'identité fait partie de la structure du `TaggedObject`.
|
|
97
108
|
//
|
|
@@ -115,12 +126,16 @@ declare const externalEmailNotification: {
|
|
|
115
126
|
//
|
|
116
127
|
// L'hydratation peut échouer, son résultat est donc représenté par un `Either`.
|
|
117
128
|
|
|
118
|
-
// DEither.Left<"async-error", DDataStructure.ErrorPromise>
|
|
119
|
-
// | DEither.Left<"map-error", DDataStructure.Error>
|
|
120
|
-
// | DEither.Right<"map-success", EmailNotification>
|
|
121
129
|
const maybeEmailNotification = EmailNotification.map(
|
|
122
130
|
externalEmailNotification,
|
|
123
131
|
);
|
|
132
|
+
type _CheckMaybeEmailNotificationLine121 = DCommon.ExpectType<
|
|
133
|
+
typeof maybeEmailNotification,
|
|
134
|
+
DEither.Left<"async-error", DDataStructure.ErrorPromise>
|
|
135
|
+
| DEither.Left<"map-error", DDataStructure.Error>
|
|
136
|
+
| DEither.Right<"map-success", EmailNotification>,
|
|
137
|
+
"strict"
|
|
138
|
+
>;
|
|
124
139
|
|
|
125
140
|
// Une fois hydraté, le tag fait partie de la donnée.
|
|
126
141
|
//
|
|
@@ -129,12 +144,6 @@ const maybeEmailNotification = EmailNotification.map(
|
|
|
129
144
|
// Il n'a donc pas besoin d'être hydraté une seconde fois simplement
|
|
130
145
|
// parce qu'il traverse une frontière entre deux services.
|
|
131
146
|
//
|
|
132
|
-
// DEither.Left<"async-error", DDataStructure.ErrorPromise>
|
|
133
|
-
// | DEither.Left<"map-error", DDataStructure.Error>
|
|
134
|
-
// | (DModeling.ObjectTag<"EmailNotification"> & {
|
|
135
|
-
// readonly email: string;
|
|
136
|
-
// readonly subject: string;
|
|
137
|
-
// })
|
|
138
147
|
const mappedEmailNotification = DCommon.pipe(
|
|
139
148
|
EmailNotification.map({
|
|
140
149
|
email: "user@example.com",
|
|
@@ -142,6 +151,16 @@ const mappedEmailNotification = DCommon.pipe(
|
|
|
142
151
|
}),
|
|
143
152
|
DEither.unwrapRight,
|
|
144
153
|
);
|
|
154
|
+
type _CheckMappedEmailNotification = DCommon.ExpectType<
|
|
155
|
+
typeof mappedEmailNotification,
|
|
156
|
+
DEither.Left<"async-error", DDataStructure.ErrorPromise>
|
|
157
|
+
| DEither.Left<"map-error", DDataStructure.Error>
|
|
158
|
+
| DModeling.ObjectTag<"EmailNotification"> & {
|
|
159
|
+
readonly email: string;
|
|
160
|
+
readonly subject: string;
|
|
161
|
+
},
|
|
162
|
+
"strict"
|
|
163
|
+
>;
|
|
145
164
|
|
|
146
165
|
// `decodeMap` suit le même principe que `map`, mais commence par décoder
|
|
147
166
|
// la représentation externe avec les codecs fournis.
|
|
@@ -149,9 +168,6 @@ const mappedEmailNotification = DCommon.pipe(
|
|
|
149
168
|
// Ici, `attempts` provient par exemple d'une représentation string avant
|
|
150
169
|
// de retrouver son type métier `number`.
|
|
151
170
|
|
|
152
|
-
// DEither.Left<"async-error", DDataStructure.ErrorPromise>
|
|
153
|
-
// | DEither.Left<"map-error", DDataStructure.Error>
|
|
154
|
-
// | DEither.Right<"map-success", SmsNotification>
|
|
155
171
|
const maybeSmsNotification = SmsNotification.decodeMap(
|
|
156
172
|
DDataStructure.codecsString,
|
|
157
173
|
{
|
|
@@ -160,6 +176,13 @@ const maybeSmsNotification = SmsNotification.decodeMap(
|
|
|
160
176
|
attempts: DCommon.cast("1"),
|
|
161
177
|
},
|
|
162
178
|
);
|
|
179
|
+
type _CheckMaybeSmsNotificationLine155 = DCommon.ExpectType<
|
|
180
|
+
typeof maybeSmsNotification,
|
|
181
|
+
DEither.Left<"async-error", DDataStructure.ErrorPromise>
|
|
182
|
+
| DEither.Left<"map-error", DDataStructure.Error>
|
|
183
|
+
| DEither.Right<"map-success", SmsNotification>,
|
|
184
|
+
"strict"
|
|
185
|
+
>;
|
|
163
186
|
|
|
164
187
|
// `update` reconstruit un `TaggedObject` possédant la même identité
|
|
165
188
|
// en remplaçant uniquement les propriétés fournies.
|
|
@@ -87,23 +87,21 @@ export namespace User {
|
|
|
87
87
|
// Ici, chacun porte au runtime la payload de l'état qu'il certifie.
|
|
88
88
|
// Une fonction exigeant `User.Entity & User.AwaitingValidationFlag` reçoit ainsi
|
|
89
89
|
// une entité dont l'état d'attente est prouvé, avec son `AwaitingValidationState`.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
AwaitingValidationState
|
|
93
|
-
>;
|
|
90
|
+
// Déclarer d'abord la factory avec le nom, la payload et la structure d'entité,
|
|
91
|
+
// puis en dériver le type avec `GetFlag`.
|
|
94
92
|
export const AwaitingValidationFlag = DModeling.createFlag<
|
|
95
|
-
|
|
93
|
+
"AwaitingValidation",
|
|
94
|
+
AwaitingValidationState,
|
|
96
95
|
typeof Entity
|
|
97
96
|
>("AwaitingValidation");
|
|
97
|
+
export type AwaitingValidationFlag = DModeling.GetFlag<typeof AwaitingValidationFlag>;
|
|
98
98
|
|
|
99
|
-
export type ValidateFlag = DModeling.Flag<
|
|
100
|
-
"Validate",
|
|
101
|
-
ValidateState
|
|
102
|
-
>;
|
|
103
99
|
export const ValidateFlag = DModeling.createFlag<
|
|
104
|
-
|
|
100
|
+
"Validate",
|
|
101
|
+
ValidateState,
|
|
105
102
|
typeof Entity
|
|
106
103
|
>("Validate");
|
|
104
|
+
export type ValidateFlag = DModeling.GetFlag<typeof ValidateFlag>;
|
|
107
105
|
|
|
108
106
|
// Après hydratation, `state` reste typé comme l'union des états possibles.
|
|
109
107
|
// `refineState` inspecte sa valeur et ajoute le flag correspondant sans modifier
|
|
@@ -132,17 +130,16 @@ export namespace User {
|
|
|
132
130
|
// y compris un changement de propriété qui conserve le même état nommé.
|
|
133
131
|
// Sa payload décrit l'événement et reste portée par l'entité après application du fait.
|
|
134
132
|
// Ici, la création place toujours l'utilisateur en attente de validation.
|
|
135
|
-
|
|
133
|
+
// `createFact` reçoit les mêmes trois génériques que `createFlag`, puis construit `run`
|
|
134
|
+
// dans un second appel. `GetFact` extrait le type du fait depuis cette factory.
|
|
135
|
+
export const UserCreateFact = DModeling.createFact<
|
|
136
136
|
"UserCreated",
|
|
137
137
|
{
|
|
138
138
|
id: User.Id;
|
|
139
139
|
age: User.Age;
|
|
140
140
|
name: User.Name;
|
|
141
141
|
state: User.AwaitingValidationState;
|
|
142
|
-
}
|
|
143
|
-
>;
|
|
144
|
-
export const UserCreateFact = DModeling.createFact<
|
|
145
|
-
UserCreateFact,
|
|
142
|
+
},
|
|
146
143
|
typeof User.Entity
|
|
147
144
|
>("UserCreated")(
|
|
148
145
|
({ applyFact }) => (
|
|
@@ -156,7 +153,7 @@ export const UserCreateFact = DModeling.createFact<
|
|
|
156
153
|
//
|
|
157
154
|
// Elle contient notamment l'état produit par cette étape du cycle de vie,
|
|
158
155
|
// ce qui permet de conserver cette information avec la `Fact`.
|
|
159
|
-
const payload
|
|
156
|
+
const payload = {
|
|
160
157
|
id: params.id,
|
|
161
158
|
age: params.age,
|
|
162
159
|
name: params.name,
|
|
@@ -179,20 +176,19 @@ export const UserCreateFact = DModeling.createFact<
|
|
|
179
176
|
},
|
|
180
177
|
);
|
|
181
178
|
|
|
179
|
+
export type UserCreateFact = DModeling.GetFact<typeof UserCreateFact>;
|
|
180
|
+
|
|
182
181
|
// Cette `Fact` représente la transition entre l'attente de validation
|
|
183
182
|
// et l'état validé.
|
|
184
183
|
//
|
|
185
184
|
// Sa signature fait elle-même partie de la règle métier :
|
|
186
185
|
// seules les entités possédant `AwaitingValidationFlag` peuvent effectuer
|
|
187
186
|
// cette transition.
|
|
188
|
-
export
|
|
187
|
+
export const ValidateUserFact = DModeling.createFact<
|
|
189
188
|
"ValidateUserFact",
|
|
190
189
|
{
|
|
191
190
|
state: User.ValidateState;
|
|
192
|
-
}
|
|
193
|
-
>;
|
|
194
|
-
export const ValidateUserFact = DModeling.createFact<
|
|
195
|
-
ValidateUserFact,
|
|
191
|
+
},
|
|
196
192
|
typeof User.Entity
|
|
197
193
|
>("ValidateUserFact")(
|
|
198
194
|
({ applyFact }) => (
|
|
@@ -205,7 +201,7 @@ export const ValidateUserFact = DModeling.createFact<
|
|
|
205
201
|
//
|
|
206
202
|
// Le fait `ValidateUserFact` conserve donc également les informations
|
|
207
203
|
// produites lors de cette transition.
|
|
208
|
-
const payload
|
|
204
|
+
const payload = {
|
|
209
205
|
state: User.ValidateState.new({
|
|
210
206
|
address: params.address,
|
|
211
207
|
validateAt: DChrono.now(),
|
|
@@ -228,6 +224,8 @@ export const ValidateUserFact = DModeling.createFact<
|
|
|
228
224
|
},
|
|
229
225
|
);
|
|
230
226
|
|
|
227
|
+
export type ValidateUserFact = DModeling.GetFact<typeof ValidateUserFact>;
|
|
228
|
+
|
|
231
229
|
declare const id: User.Id;
|
|
232
230
|
declare const age: User.Age;
|
|
233
231
|
declare const name: User.Name;
|
|
@@ -240,6 +238,11 @@ const createdUser = DCommon.pipe(
|
|
|
240
238
|
}),
|
|
241
239
|
DEither.unwrapRight,
|
|
242
240
|
);
|
|
241
|
+
type _CheckCreatedUser = DCommon.ExpectType<
|
|
242
|
+
typeof createdUser.state,
|
|
243
|
+
User.AwaitingValidationState,
|
|
244
|
+
"strict"
|
|
245
|
+
>;
|
|
243
246
|
|
|
244
247
|
declare const address: User.Address;
|
|
245
248
|
|
|
@@ -255,17 +258,6 @@ declare const address: User.Address;
|
|
|
255
258
|
// - `ValidateFlag` prouve le nouvel état ;
|
|
256
259
|
// - `UserCreated` a été remplacée par `ValidateUserFact`.
|
|
257
260
|
//
|
|
258
|
-
// & DModeling.Entity<"User">
|
|
259
|
-
// & {
|
|
260
|
-
// readonly name: string & DModeling.NewType<"UserName", Trimmed | MinCharacters<3> | MaxCharacters<45>>;
|
|
261
|
-
// readonly id: string & DModeling.NewType<"UserId", Uuid>;
|
|
262
|
-
// readonly age: number & DModeling.NewType<"UserAge", Integer | Positive>;
|
|
263
|
-
// readonly state: User.ValidateState;
|
|
264
|
-
// }
|
|
265
|
-
// & DModeling.Flag<"Validate", User.ValidateState>
|
|
266
|
-
// & DModeling.Fact<"ValidateUserFact", {
|
|
267
|
-
// state: User.ValidateState;
|
|
268
|
-
// }>
|
|
269
261
|
const validateUser = DCommon.pipe(
|
|
270
262
|
ValidateUserFact.run(
|
|
271
263
|
createdUser,
|
|
@@ -273,3 +265,8 @@ const validateUser = DCommon.pipe(
|
|
|
273
265
|
),
|
|
274
266
|
DEither.unwrapRight,
|
|
275
267
|
);
|
|
268
|
+
type _CheckValidatedUser = DCommon.ExpectType<
|
|
269
|
+
typeof validateUser.state,
|
|
270
|
+
User.ValidateState,
|
|
271
|
+
"strict"
|
|
272
|
+
>;
|
|
@@ -33,17 +33,25 @@ declare const entity: Entity;
|
|
|
33
33
|
// Chaque callback reçoit directement le type précis correspondant
|
|
34
34
|
// au nom de l'entité.
|
|
35
35
|
|
|
36
|
-
// string | number
|
|
37
36
|
const matchedEntity = DPattern.matchWithEntity(
|
|
38
37
|
entity,
|
|
39
38
|
{
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
User: (user) => {
|
|
40
|
+
type _CheckUser = DCommon.ExpectType<typeof user, User, "strict">;
|
|
41
|
+
return user.name;
|
|
42
|
+
},
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
Admin: (admin) => {
|
|
45
|
+
type _CheckAdmin = DCommon.ExpectType<typeof admin, Admin, "strict">;
|
|
46
|
+
return admin.permissions.length;
|
|
47
|
+
},
|
|
45
48
|
},
|
|
46
49
|
);
|
|
50
|
+
type _CheckMatchedEntityLine37 = DCommon.ExpectType<
|
|
51
|
+
typeof matchedEntity,
|
|
52
|
+
string | number,
|
|
53
|
+
"strict"
|
|
54
|
+
>;
|
|
47
55
|
|
|
48
56
|
// La sélection exhaustive crée un point d'ancrage dans le typage.
|
|
49
57
|
//
|
|
@@ -56,17 +64,25 @@ const matchedEntity = DPattern.matchWithEntity(
|
|
|
56
64
|
// `matchWithEntity` possède également une forme curried afin d'être
|
|
57
65
|
// directement utilisée dans un pipe.
|
|
58
66
|
|
|
59
|
-
// string | number
|
|
60
67
|
const matchedEntityInPipe = DCommon.pipe(
|
|
61
68
|
entity,
|
|
62
69
|
DPattern.matchWithEntity({
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
User: (user) => {
|
|
71
|
+
type _CheckUser = DCommon.ExpectType<typeof user, User, "strict">;
|
|
72
|
+
return user.name;
|
|
73
|
+
},
|
|
65
74
|
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
Admin: (admin) => {
|
|
76
|
+
type _CheckAdmin = DCommon.ExpectType<typeof admin, Admin, "strict">;
|
|
77
|
+
return admin.permissions.length;
|
|
78
|
+
},
|
|
68
79
|
}),
|
|
69
80
|
);
|
|
81
|
+
type _CheckMatchedEntityInPipeLine60 = DCommon.ExpectType<
|
|
82
|
+
typeof matchedEntityInPipe,
|
|
83
|
+
string | number,
|
|
84
|
+
"strict"
|
|
85
|
+
>;
|
|
70
86
|
|
|
71
87
|
// `matchWithEntityOtherwise` permet de ne sélectionner explicitement
|
|
72
88
|
// qu'une partie des entités.
|
|
@@ -74,31 +90,47 @@ const matchedEntityInPipe = DCommon.pipe(
|
|
|
74
90
|
// `otherwise` reçoit uniquement les entités qui n'ont pas déjà
|
|
75
91
|
// été prises en charge par le matcher.
|
|
76
92
|
|
|
77
|
-
// string | number
|
|
78
93
|
const matchedEntityOtherwise = DPattern.matchWithEntityOtherwise(
|
|
79
94
|
entity,
|
|
80
95
|
{
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
User: (user) => {
|
|
97
|
+
type _CheckUser = DCommon.ExpectType<typeof user, User, "strict">;
|
|
98
|
+
return user.name;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
(admin) => {
|
|
102
|
+
type _CheckAdmin = DCommon.ExpectType<typeof admin, Admin, "strict">;
|
|
103
|
+
return admin.permissions.length;
|
|
83
104
|
},
|
|
84
|
-
// Admin
|
|
85
|
-
(admin) => admin.permissions.length,
|
|
86
105
|
);
|
|
106
|
+
type _CheckMatchedEntityOtherwiseLine78 = DCommon.ExpectType<
|
|
107
|
+
typeof matchedEntityOtherwise,
|
|
108
|
+
string | number,
|
|
109
|
+
"strict"
|
|
110
|
+
>;
|
|
87
111
|
|
|
88
112
|
// La forme curried est également disponible.
|
|
89
113
|
//
|
|
90
114
|
// Le typage de `otherwise` évolue avec les handlers déjà déclarés.
|
|
91
115
|
// Il représente toujours précisément le reste de l'union.
|
|
92
116
|
|
|
93
|
-
// string | number
|
|
94
117
|
const matchedEntityOtherwiseInPipe = DCommon.pipe(
|
|
95
118
|
entity,
|
|
96
119
|
DPattern.matchWithEntityOtherwise(
|
|
97
120
|
{
|
|
98
|
-
|
|
99
|
-
|
|
121
|
+
User: (user) => {
|
|
122
|
+
type _CheckUser = DCommon.ExpectType<typeof user, User, "strict">;
|
|
123
|
+
return user.name;
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
(admin) => {
|
|
127
|
+
type _CheckAdmin = DCommon.ExpectType<typeof admin, Admin, "strict">;
|
|
128
|
+
return admin.permissions.length;
|
|
100
129
|
},
|
|
101
|
-
// Admin
|
|
102
|
-
(admin) => admin.permissions.length,
|
|
103
130
|
),
|
|
104
131
|
);
|
|
132
|
+
type _CheckMatchedEntityOtherwiseInPipeLine94 = DCommon.ExpectType<
|
|
133
|
+
typeof matchedEntityOtherwiseInPipe,
|
|
134
|
+
string | number,
|
|
135
|
+
"strict"
|
|
136
|
+
>;
|
|
@@ -55,21 +55,25 @@ declare const user: User;
|
|
|
55
55
|
// correspondant au nom sélectionné. La payload est accessible sur cette valeur avec factKind.
|
|
56
56
|
// Cette lecture fonctionne dans les formes directe et curifiée.
|
|
57
57
|
|
|
58
|
-
// string | number
|
|
59
58
|
const matchedFact = DPattern.matchWithFact(
|
|
60
59
|
user,
|
|
61
60
|
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
DModeling.factKind.getValue(createdUser).payload.name
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
DModeling.factKind.getValue(deletedUser).payload.reason.length
|
|
70
|
-
|
|
61
|
+
UserCreated: (createdUser) => {
|
|
62
|
+
type _CheckCreatedUser = DCommon.ExpectType<typeof createdUser, UserCreated, "strict">;
|
|
63
|
+
return DModeling.factKind.getValue(createdUser).payload.name;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
UserDeleted: (deletedUser) => {
|
|
67
|
+
type _CheckDeletedUser = DCommon.ExpectType<typeof deletedUser, UserDeleted, "strict">;
|
|
68
|
+
return DModeling.factKind.getValue(deletedUser).payload.reason.length;
|
|
69
|
+
},
|
|
71
70
|
},
|
|
72
71
|
);
|
|
72
|
+
type _CheckMatchedFactLine59 = DCommon.ExpectType<
|
|
73
|
+
typeof matchedFact,
|
|
74
|
+
string | number,
|
|
75
|
+
"strict"
|
|
76
|
+
>;
|
|
73
77
|
|
|
74
78
|
// La sélection exhaustive crée un point d'ancrage dans le typage.
|
|
75
79
|
//
|
|
@@ -82,21 +86,25 @@ const matchedFact = DPattern.matchWithFact(
|
|
|
82
86
|
// `matchWithFact` possède également une forme curried afin d'être
|
|
83
87
|
// directement utilisée dans un pipe.
|
|
84
88
|
|
|
85
|
-
// string | number
|
|
86
89
|
const matchedFactInPipe = DCommon.pipe(
|
|
87
90
|
user,
|
|
88
91
|
DPattern.matchWithFact({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
DModeling.factKind.getValue(createdUser).payload.name
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
DModeling.factKind.getValue(deletedUser).payload.reason.length
|
|
97
|
-
|
|
92
|
+
UserCreated: (createdUser) => {
|
|
93
|
+
type _CheckCreatedUser = DCommon.ExpectType<typeof createdUser, UserCreated, "strict">;
|
|
94
|
+
return DModeling.factKind.getValue(createdUser).payload.name;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
UserDeleted: (deletedUser) => {
|
|
98
|
+
type _CheckDeletedUser = DCommon.ExpectType<typeof deletedUser, UserDeleted, "strict">;
|
|
99
|
+
return DModeling.factKind.getValue(deletedUser).payload.reason.length;
|
|
100
|
+
},
|
|
98
101
|
}),
|
|
99
102
|
);
|
|
103
|
+
type _CheckMatchedFactInPipeLine86 = DCommon.ExpectType<
|
|
104
|
+
typeof matchedFactInPipe,
|
|
105
|
+
string | number,
|
|
106
|
+
"strict"
|
|
107
|
+
>;
|
|
100
108
|
|
|
101
109
|
// `matchWithFactOtherwise` permet de ne sélectionner explicitement
|
|
102
110
|
// qu'une partie des facts.
|
|
@@ -104,39 +112,47 @@ const matchedFactInPipe = DCommon.pipe(
|
|
|
104
112
|
// `otherwise` reçoit uniquement les valeurs portant les facts
|
|
105
113
|
// qui n'ont pas déjà été prises en charge par le matcher.
|
|
106
114
|
|
|
107
|
-
// string | UserDeleted
|
|
108
115
|
const matchedFactOtherwise = DPattern.matchWithFactOtherwise(
|
|
109
116
|
user,
|
|
110
117
|
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
DModeling.factKind.getValue(createdUser).payload.name
|
|
114
|
-
|
|
118
|
+
UserCreated: (createdUser) => {
|
|
119
|
+
type _CheckCreatedUser = DCommon.ExpectType<typeof createdUser, UserCreated, "strict">;
|
|
120
|
+
return DModeling.factKind.getValue(createdUser).payload.name;
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
(deletedUser) => {
|
|
124
|
+
type _CheckDeletedUser = DCommon.ExpectType<typeof deletedUser, UserDeleted, "strict">;
|
|
125
|
+
return deletedUser;
|
|
115
126
|
},
|
|
116
|
-
// UserDeleted
|
|
117
|
-
(deletedUser) => (
|
|
118
|
-
deletedUser
|
|
119
|
-
),
|
|
120
127
|
);
|
|
128
|
+
type _CheckMatchedFactOtherwiseLine108 = DCommon.ExpectType<
|
|
129
|
+
typeof matchedFactOtherwise,
|
|
130
|
+
string | UserDeleted,
|
|
131
|
+
"strict"
|
|
132
|
+
>;
|
|
121
133
|
|
|
122
134
|
// La forme curried est également disponible.
|
|
123
135
|
//
|
|
124
136
|
// Le typage de `otherwise` évolue avec les handlers déjà déclarés.
|
|
125
137
|
// Il représente toujours précisément le reste de l'union de facts.
|
|
126
138
|
|
|
127
|
-
// string | UserDeleted
|
|
128
139
|
const matchedFactOtherwiseInPipe = DCommon.pipe(
|
|
129
140
|
user,
|
|
130
141
|
DPattern.matchWithFactOtherwise(
|
|
131
142
|
{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
DModeling.factKind.getValue(createdUser).payload.name
|
|
135
|
-
|
|
143
|
+
UserCreated: (createdUser) => {
|
|
144
|
+
type _CheckCreatedUser = DCommon.ExpectType<typeof createdUser, UserCreated, "strict">;
|
|
145
|
+
return DModeling.factKind.getValue(createdUser).payload.name;
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
(deletedUser) => {
|
|
149
|
+
type _CheckDeletedUser = DCommon.ExpectType<typeof deletedUser, UserDeleted, "strict">;
|
|
150
|
+
return deletedUser;
|
|
136
151
|
},
|
|
137
|
-
// UserDeleted
|
|
138
|
-
(deletedUser) => (
|
|
139
|
-
deletedUser
|
|
140
|
-
),
|
|
141
152
|
),
|
|
142
153
|
);
|
|
154
|
+
type _CheckMatchedFactOtherwiseInPipeLine128 = DCommon.ExpectType<
|
|
155
|
+
typeof matchedFactOtherwiseInPipe,
|
|
156
|
+
string | UserDeleted,
|
|
157
|
+
"strict"
|
|
158
|
+
>;
|
|
@@ -34,17 +34,25 @@ declare const notification: Notification;
|
|
|
34
34
|
// Chaque callback reçoit directement le `TaggedObject` précis
|
|
35
35
|
// correspondant au tag sélectionné.
|
|
36
36
|
|
|
37
|
-
// string
|
|
38
37
|
const matchedNotification = DPattern.matchWithTaggedObject(
|
|
39
38
|
notification,
|
|
40
39
|
{
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
EmailNotification: (emailNotification) => {
|
|
41
|
+
type _CheckEmailNotification = DCommon.ExpectType<typeof emailNotification, EmailNotification, "strict">;
|
|
42
|
+
return emailNotification.email;
|
|
43
|
+
},
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
SmsNotification: (smsNotification) => {
|
|
46
|
+
type _CheckSmsNotification = DCommon.ExpectType<typeof smsNotification, SmsNotification, "strict">;
|
|
47
|
+
return smsNotification.phone;
|
|
48
|
+
},
|
|
46
49
|
},
|
|
47
50
|
);
|
|
51
|
+
type _CheckMatchedNotificationLine38 = DCommon.ExpectType<
|
|
52
|
+
typeof matchedNotification,
|
|
53
|
+
string,
|
|
54
|
+
"strict"
|
|
55
|
+
>;
|
|
48
56
|
|
|
49
57
|
// La sélection exhaustive crée un point d'ancrage dans le typage.
|
|
50
58
|
//
|
|
@@ -57,17 +65,25 @@ const matchedNotification = DPattern.matchWithTaggedObject(
|
|
|
57
65
|
// `matchWithTaggedObject` possède également une forme curried afin d'être
|
|
58
66
|
// directement utilisée dans un pipe.
|
|
59
67
|
|
|
60
|
-
// string
|
|
61
68
|
const matchedNotificationInPipe = DCommon.pipe(
|
|
62
69
|
notification,
|
|
63
70
|
DPattern.matchWithTaggedObject({
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
EmailNotification: (emailNotification) => {
|
|
72
|
+
type _CheckEmailNotification = DCommon.ExpectType<typeof emailNotification, EmailNotification, "strict">;
|
|
73
|
+
return emailNotification.email;
|
|
74
|
+
},
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
SmsNotification: (smsNotification) => {
|
|
77
|
+
type _CheckSmsNotification = DCommon.ExpectType<typeof smsNotification, SmsNotification, "strict">;
|
|
78
|
+
return smsNotification.phone;
|
|
79
|
+
},
|
|
69
80
|
}),
|
|
70
81
|
);
|
|
82
|
+
type _CheckMatchedNotificationInPipeLine61 = DCommon.ExpectType<
|
|
83
|
+
typeof matchedNotificationInPipe,
|
|
84
|
+
string,
|
|
85
|
+
"strict"
|
|
86
|
+
>;
|
|
71
87
|
|
|
72
88
|
// `matchWithTaggedObjectOtherwise` permet de ne sélectionner explicitement
|
|
73
89
|
// qu'une partie des tags.
|
|
@@ -75,31 +91,47 @@ const matchedNotificationInPipe = DCommon.pipe(
|
|
|
75
91
|
// `otherwise` reçoit uniquement les `TaggedObject` qui n'ont pas déjà
|
|
76
92
|
// été pris en charge par le matcher.
|
|
77
93
|
|
|
78
|
-
// string
|
|
79
94
|
const matchedNotificationOtherwise = DPattern.matchWithTaggedObjectOtherwise(
|
|
80
95
|
notification,
|
|
81
96
|
{
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
EmailNotification: (emailNotification) => {
|
|
98
|
+
type _CheckEmailNotification = DCommon.ExpectType<typeof emailNotification, EmailNotification, "strict">;
|
|
99
|
+
return emailNotification.email;
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
(smsNotification) => {
|
|
103
|
+
type _CheckSmsNotification = DCommon.ExpectType<typeof smsNotification, SmsNotification, "strict">;
|
|
104
|
+
return smsNotification.phone;
|
|
84
105
|
},
|
|
85
|
-
// SmsNotification
|
|
86
|
-
(smsNotification) => smsNotification.phone,
|
|
87
106
|
);
|
|
107
|
+
type _CheckMatchedNotificationOtherwiseLine79 = DCommon.ExpectType<
|
|
108
|
+
typeof matchedNotificationOtherwise,
|
|
109
|
+
string,
|
|
110
|
+
"strict"
|
|
111
|
+
>;
|
|
88
112
|
|
|
89
113
|
// La forme curried est également disponible.
|
|
90
114
|
//
|
|
91
115
|
// Le typage de `otherwise` évolue avec les handlers déjà déclarés.
|
|
92
116
|
// Il représente toujours précisément le reste de l'union de `TaggedObject`.
|
|
93
117
|
|
|
94
|
-
// string
|
|
95
118
|
const matchedNotificationOtherwiseInPipe = DCommon.pipe(
|
|
96
119
|
notification,
|
|
97
120
|
DPattern.matchWithTaggedObjectOtherwise(
|
|
98
121
|
{
|
|
99
|
-
|
|
100
|
-
|
|
122
|
+
EmailNotification: (emailNotification) => {
|
|
123
|
+
type _CheckEmailNotification = DCommon.ExpectType<typeof emailNotification, EmailNotification, "strict">;
|
|
124
|
+
return emailNotification.email;
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
(smsNotification) => {
|
|
128
|
+
type _CheckSmsNotification = DCommon.ExpectType<typeof smsNotification, SmsNotification, "strict">;
|
|
129
|
+
return smsNotification.phone;
|
|
101
130
|
},
|
|
102
|
-
// SmsNotification
|
|
103
|
-
(smsNotification) => smsNotification.phone,
|
|
104
131
|
),
|
|
105
132
|
);
|
|
133
|
+
type _CheckMatchedNotificationOtherwiseInPipeLine95 = DCommon.ExpectType<
|
|
134
|
+
typeof matchedNotificationOtherwiseInPipe,
|
|
135
|
+
string,
|
|
136
|
+
"strict"
|
|
137
|
+
>;
|