@incodetech/core 2.1.1 → 2.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{3dAvatarProvider-BwOmTMOy.esm.js → 3dAvatarProvider-g02DTFqT.esm.js} +811 -880
- package/dist/Actor-iTq7YY48.d.ts +1 -0
- package/dist/BrowserDiagnosticsCryptoProvider-CriIh1Gt.esm.js +95 -0
- package/dist/BrowserLazyImportProvider-BhoA957O.esm.js +114 -0
- package/dist/{BrowserStorageProvider-CBHBhKQN.esm.js → BrowserStorageProvider-k-FDkC4W.esm.js} +2 -4
- package/dist/{BrowserTimerProvider-CHloo0eQ.esm.js → BrowserTimerProvider-BXhgNxLt.esm.js} +1 -2
- package/dist/{BrowserVisibilityObserverProvider-GBS6XSii.esm.js → BrowserVisibilityObserverProvider-BX1BiLDK.esm.js} +1 -2
- package/dist/Face2DProvider-UUQt_vRC.esm.js +437 -0
- package/dist/{createFaceAvatar-CpdYp9Iy.d.ts → FaceDetectionProvider-Mh6q3EbA.d.ts} +107 -159
- package/dist/IBrowserEnvironmentCapability-DEaRRk-R.esm.js +9 -0
- package/dist/IFaceAvatarCapability-BrL19G0s.d.ts +23 -0
- package/dist/IFeatureManagementCapability-DdEUp6tB.d.ts +1125 -0
- package/dist/IIdCaptureCapability-DHTT3FC2.d.ts +237 -0
- package/dist/IStorageCapability-ORkQfK3F.d.ts +242 -0
- package/dist/{ITimerCapability-DJ73P4RK.esm.js → ITimerCapability-DgdDzp8G.esm.js} +1 -2
- package/dist/{Manager-goNPc_h_.d.ts → Manager-CQQ99QOI.d.ts} +1 -0
- package/dist/{MotionSensorProvider-BHuHoYvJ.esm.js → MotionSensorProvider-DGiV77J_.esm.js} +2 -37
- package/dist/{OpenViduRecordingProvider-CK6A5kiU.esm.js → OpenViduRecordingProvider-Du98qevC.esm.js} +2 -4
- package/dist/PrivacyLensProvider-D8PS7AJa.esm.js +405 -0
- package/dist/StateMachine-EDpYWy0i.d.ts +6 -0
- package/dist/{StreamCanvasCapture-CAqUdVkM.esm.js → StreamCanvasCapture-D2XcXCZ4.esm.js} +2 -4
- package/dist/{addressSearch-D7msRieq.esm.js → addressSearch-DQyrvDQj.esm.js} +10 -21
- package/dist/ae-signature.d.ts +4 -6
- package/dist/ae-signature.esm.js +10 -11
- package/dist/antifraud.d.ts +1 -6
- package/dist/antifraud.esm.js +3 -8
- package/dist/{antifraudManager-5KA84wtF.esm.js → antifraudManager-B8Plzf7a.esm.js} +11 -8
- package/dist/{antifraudManager-DCiNI6np.d.ts → antifraudManager-BY36bS12.d.ts} +3 -3
- package/dist/{antifraudStateMachine-BQVw46N5.esm.js → antifraudStateMachine-r4VxSBS4.esm.js} +5 -7
- package/dist/api-Bx3gKW_y.esm.js +129 -0
- package/dist/{apiError-DkOXfFBu.esm.js → apiError-DZfAyExM.esm.js} +25 -3
- package/dist/authentication.d.ts +3 -19
- package/dist/authentication.esm.js +3 -35
- package/dist/{authenticationManager-BeT6tNZm.d.ts → authenticationManager-BBMGTcwW.d.ts} +3 -4
- package/dist/{authenticationManager-BryLnSaF.esm.js → authenticationManager-DscbQwIl.esm.js} +7 -10
- package/dist/{authenticationStateMachine-DbdxfGHx.esm.js → authenticationStateMachine-SyuM00Fa.esm.js} +11 -15
- package/dist/avatar.d.ts +2 -2
- package/dist/avatar.esm.js +2 -3
- package/dist/avatar2dWarm-DqucNFX4.esm.js +1330 -0
- package/dist/avatarStats-CdUOb3VD.esm.js +136 -0
- package/dist/{backCameraStream-ChrMTJv-.esm.js → backCameraStream-CUeYm5eu.esm.js} +20 -8
- package/dist/browser-DlFgHpoC-DnyrCR8r.esm.js +1513 -0
- package/dist/callback-645_omgz.d.ts +133 -0
- package/dist/camera-_2sXMXiF.esm.js +140 -0
- package/dist/camera.d.ts +19 -2
- package/dist/camera.esm.js +2 -6
- package/dist/{canvas-Pi10hG_l.esm.js → canvas-E1zGkel4.esm.js} +1 -2
- package/dist/certificate-issuance.d.ts +34 -39
- package/dist/certificate-issuance.esm.js +4 -11
- package/dist/{certificateIssuanceStateMachine-DlZQT1_u.esm.js → certificateIssuanceStateMachine-COd7_l2T.esm.js} +7 -11
- package/dist/consent.d.ts +1 -4
- package/dist/consent.esm.js +3 -8
- package/dist/{consentManager-BwNu-uC-.esm.js → consentManager-BApTlfA0.esm.js} +5 -7
- package/dist/{consentManager-B4PMGXW-.d.ts → consentManager-uhDPdU6i.d.ts} +55 -61
- package/dist/{consentStateMachine-BOkVFiU7.esm.js → consentStateMachine-WD-S-Yhs.esm.js} +5 -7
- package/dist/{cpf-16m_cGAM.esm.js → cpf-BIADjddF.esm.js} +1 -2
- package/dist/createFaceAvatar-BEj18KXi.d.ts +50 -0
- package/dist/createFaceAvatar-DQKaRise.esm.js +103 -0
- package/dist/cross-document-data-match.d.ts +2 -26
- package/dist/cross-document-data-match.esm.js +2 -71
- package/dist/crossDocumentDataMatchManager-Dq8Z3SOg.d.ts +41 -0
- package/dist/crossDocumentDataMatchManager-OmYvyung.esm.js +84 -0
- package/dist/curp-validation.d.ts +1 -11
- package/dist/curp-validation.esm.js +3 -8
- package/dist/{curpValidationManager-CoqODZx5.d.ts → curpValidationManager-DVGr7Fq7.d.ts} +4 -6
- package/dist/{curpValidationManager-Cbji2inV.esm.js → curpValidationManager-UZxcrsrz.esm.js} +11 -7
- package/dist/{curpValidationStateMachine-Dlw4qfFb.esm.js → curpValidationStateMachine-9KwnqeoB.esm.js} +22 -14
- package/dist/custom-fields.d.ts +2 -5
- package/dist/custom-fields.esm.js +24 -11
- package/dist/custom-watchlist.d.ts +1 -3
- package/dist/custom-watchlist.esm.js +11 -10
- package/dist/{customWatchlistStateMachine-D8w0mNxm.esm.js → customWatchlistStateMachine-B_ey3TFj.esm.js} +5 -7
- package/dist/{dateUtils-BW6mBV6p.esm.js → dateUtils-CvG0FvK8.esm.js} +1 -2
- package/dist/{deepsightService-CViys6T4.esm.js → deepsightLoader-DcWjMC6A.esm.js} +68 -14
- package/dist/{deepsightService-BuTOFTr8.d.ts → deepsightService-DLVQS_RH.d.ts} +41 -2
- package/dist/device.d.ts +10 -2
- package/dist/device.esm.js +21 -21
- package/dist/document-capture.d.ts +3 -1816
- package/dist/document-capture.esm.js +3 -245
- package/dist/document-upload.d.ts +48 -55
- package/dist/document-upload.esm.js +8 -14
- package/dist/documentCaptureManager-B4Kivr8_.d.ts +2062 -0
- package/dist/documentCaptureManager-DszmcU-l.esm.js +296 -0
- package/dist/{documentCaptureStateMachine-BkTvU3yq.esm.js → documentCaptureStateMachine-D2jBwwVb.esm.js} +66 -40
- package/dist/dynamic-forms.d.ts +2 -4
- package/dist/dynamic-forms.esm.js +3 -9
- package/dist/{dynamicFormsManager-CHXUBNs4.esm.js → dynamicFormsManager-BoZ2-OUI.esm.js} +48 -9
- package/dist/{dynamicFormsManager-CKZkE7Wo.d.ts → dynamicFormsManager-fhK0yINk.d.ts} +22 -46
- package/dist/{dynamicFormsStateMachine-DJ1HGZff.esm.js → dynamicFormsStateMachine-D0RzkoEV.esm.js} +161 -34
- package/dist/ekyb.d.ts +5 -137
- package/dist/ekyb.esm.js +4 -179
- package/dist/ekybManager-DTvfxAOZ.esm.js +178 -0
- package/dist/ekybManager-Dzswb_b8.d.ts +114 -0
- package/dist/{ekybStateMachine-D9GzA4MW.esm.js → ekybStateMachine-BlTIozb6.esm.js} +16 -193
- package/dist/ekyc.d.ts +2 -79
- package/dist/ekyc.esm.js +4 -154
- package/dist/ekycManager-BFpHbBoT.d.ts +97 -0
- package/dist/ekycManager-oTstTJuL.esm.js +156 -0
- package/dist/{ekycStateMachine-DnVRiu3s.esm.js → ekycStateMachine-DHvksnrr.esm.js} +141 -423
- package/dist/ekycUtils-Dew1rBG0.esm.js +223 -0
- package/dist/electronic-signature.d.ts +3 -5
- package/dist/electronic-signature.esm.js +2 -10
- package/dist/{index-36QX_21w.d.ts → electronicSignatureManager-CcUXQZS7.d.ts} +220 -251
- package/dist/{electronicSignatureManager-DESRgObX.esm.js → electronicSignatureManager-DRYlHPjT.esm.js} +47 -33
- package/dist/email.d.ts +1 -5
- package/dist/email.esm.js +3 -10
- package/dist/{emailManager-CMS4q_r6.d.ts → emailManager-CADXW_9X.d.ts} +4 -7
- package/dist/{emailManager-B9Vrv3Ma.esm.js → emailManager-tE-YvNtS.esm.js} +76 -12
- package/dist/{emailStateMachine-CbmKFVSi.esm.js → emailStateMachine-Bm894MHB.esm.js} +7 -9
- package/dist/{endpoints-CwrFQfW7.esm.js → endpoints-CCzL3XD_.esm.js} +55 -6
- package/dist/{events-1wxZ97yf.esm.js → events-CxfNJVZW.esm.js} +43 -176
- package/dist/events.d.ts +28 -10
- package/dist/events.esm.js +2 -4
- package/dist/extensibility.d.ts +37 -37
- package/dist/extensibility.esm.js +31 -80
- package/dist/{externalFetch-hvmz_npP.esm.js → externalFetch-BKBThAUC.esm.js} +2 -4
- package/dist/face-match.d.ts +2 -225
- package/dist/face-match.esm.js +3 -173
- package/dist/{faceCaptureManagerFactory-C9TiGbkA.esm.js → faceCaptureManagerFactory-BDAsBCkh.esm.js} +52 -31
- package/dist/{faceCaptureManagerFactory-DiJ64oem.d.ts → faceCaptureManagerFactory-BxWPpxyd.d.ts} +63 -24
- package/dist/{faceCaptureSetup-BqhqfFHL.esm.js → faceCaptureSetup-C7Qv79fA.esm.js} +57 -36
- package/dist/faceMatchManager-BXp2WUT-.esm.js +201 -0
- package/dist/faceMatchManager-BnvrZM2F.d.ts +268 -0
- package/dist/{faceMatchStateMachine-MDb30gCm.esm.js → faceMatchStateMachine-CJiO2yLO.esm.js} +14 -10
- package/dist/feature-management-DS_Nj5Gg.esm.js +615 -0
- package/dist/feature-management.d.ts +173 -0
- package/dist/feature-management.esm.js +2 -0
- package/dist/field-comparison.d.ts +1 -4
- package/dist/field-comparison.esm.js +2 -7
- package/dist/{fieldComparisonManager-OLKVsG2Z.d.ts → fieldComparisonManager-CBvEGxFx.d.ts} +3 -5
- package/dist/{fieldComparisonManager-Cw4uzD7S.esm.js → fieldComparisonManager-DhnYdYZ2.esm.js} +6 -11
- package/dist/fiscal-qr.d.ts +1 -6
- package/dist/fiscal-qr.esm.js +14 -29
- package/dist/flow-events.d.ts +2 -9
- package/dist/flow.d.ts +59 -21
- package/dist/flow.esm.js +132 -49
- package/dist/{flowCompletionService-B6P6_EF3.esm.js → flowCompletionService-BSe3p7pg.esm.js} +4 -6
- package/dist/flowServices-unhF9V9F.esm.js +620 -0
- package/dist/geolocation.d.ts +1 -4
- package/dist/geolocation.esm.js +3 -9
- package/dist/{geolocationManager-CF6-NizA.esm.js → geolocationManager-Bv9MSVNr.esm.js} +44 -16
- package/dist/geolocationManager-Cz744E5S.d.ts +506 -0
- package/dist/{geolocationStateMachine-CD2XJs1b.esm.js → geolocationStateMachine-BxD6JK1M.esm.js} +53 -28
- package/dist/{getBrowser-1yNcfFZR.esm.js → getBrowser-Cb8Zgrgp.esm.js} +1 -2
- package/dist/getBrowser-DNrQeL4T.esm.js +16 -0
- package/dist/getDeviceClass-9y-kbVDw.esm.js +19 -0
- package/dist/{getDeviceClass-C-Dg6IsJ.esm.js → getDeviceClass-CeBiEayS.esm.js} +1 -2
- package/dist/getParsedUserAgent-pJjATANs.esm.js +1622 -0
- package/dist/government-validation.d.ts +3 -6
- package/dist/government-validation.esm.js +7 -13
- package/dist/{governmentValidationStateMachine-BE5wiQ7Y.esm.js → governmentValidationStateMachine-BYKYUdza.esm.js} +8 -11
- package/dist/home.d.ts +14 -22
- package/dist/home.esm.js +3 -8
- package/dist/http.d.ts +0 -1
- package/dist/http.esm.js +2 -4
- package/dist/id-ocr.d.ts +8 -7
- package/dist/id-ocr.esm.js +20 -9
- package/dist/id-selfie-flow.d.ts +179 -0
- package/dist/id-selfie-flow.esm.js +917 -0
- package/dist/id-verification.d.ts +2 -191
- package/dist/id-verification.esm.js +3 -43
- package/dist/id.d.ts +7 -18
- package/dist/id.esm.js +47 -53
- package/dist/{idCaptureDefaults-CZajItdO.esm.js → idCaptureDefaults-WeHbQM7W.esm.js} +54 -17
- package/dist/idCaptureManager-BjU-Wyow.d.ts +429 -0
- package/dist/{idCaptureManager-DASPUMtC.esm.js → idCaptureManager-BjiBSrHm.esm.js} +173 -34
- package/dist/idCaptureServices-CFDwqTtQ.esm.js +396 -0
- package/dist/{idCaptureStateMachine-DZ2ZTSxu.esm.js → idCaptureStateMachine-CRwQh8jc.esm.js} +438 -585
- package/dist/{idOcrManager-Tm4LzKR0.esm.js → idOcrManager-CvJZhmBR.esm.js} +4 -7
- package/dist/{idOcrManager-DLfAjDZn.d.ts → idOcrManager-DXc_xRN7.d.ts} +62 -229
- package/dist/{idOcrStateMachine-BJxZCxwS.esm.js → idOcrStateMachine-Bq_e3l4E.esm.js} +15 -20
- package/dist/idVerificationManager-BB4Pj_N6.d.ts +197 -0
- package/dist/idVerificationManager-CduNXhWd.esm.js +51 -0
- package/dist/{idVerificationStateMachine-DXN9WcdM.esm.js → idVerificationStateMachine-GEQWUPU2.esm.js} +5 -7
- package/dist/identity-reuse.d.ts +1 -4
- package/dist/identity-reuse.esm.js +3 -8
- package/dist/{identityReuseManager-LjkPvSQN.esm.js → identityReuseManager-D5vXknnJ.esm.js} +24 -7
- package/dist/{identityReuseManager-CLVOYxcp.d.ts → identityReuseManager-v2TH5g7e.d.ts} +38 -43
- package/dist/{identityReuseStateMachine-Bp-zONoV.esm.js → identityReuseStateMachine-AubRPhIi.esm.js} +6 -8
- package/dist/index-B8weJxmL.d.ts +1 -0
- package/dist/index-BKOWUhxG.d.ts +258 -0
- package/dist/{index-DrpWp15Z.d.ts → index-CLMF0QLQ.d.ts} +3 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.esm.js +2 -15
- package/dist/{invokeOnCaptureCallback-CCS2Ruzi.esm.js → invokeOnCaptureCallback-1m1VJ3Q4.esm.js} +2 -4
- package/dist/{lib-Bjd6nOLG.esm.js → lib-DAyUtOTj.esm.js} +1510 -1589
- package/dist/mandatory-consent.d.ts +2 -10
- package/dist/mandatory-consent.esm.js +3 -8
- package/dist/{mandatoryConsentManager-DeBmOHcQ.d.ts → mandatoryConsentManager-B29kR0XA.d.ts} +60 -85
- package/dist/{mandatoryConsentManager-DZ26sg4B.esm.js → mandatoryConsentManager-BeELm1zS.esm.js} +4 -7
- package/dist/{mandatoryConsentStateMachine-_44ZoDSh.esm.js → mandatoryConsentStateMachine-zroQGzwb.esm.js} +5 -7
- package/dist/manualReviewService-D4IkipnN.esm.js +15 -0
- package/dist/{mediaRecorderOptions-CClCKAiF.esm.js → mediaRecorderOptions-dALSV8af.esm.js} +2 -4
- package/dist/{mediapipeShared-Bcmkzs3x.esm.js → mediapipeShared-B6oNoXEQ.esm.js} +21 -9
- package/dist/{onDeviceFaceResults-DILtthks.esm.js → onDeviceFaceResults-f81FVdQs.esm.js} +30 -87
- package/dist/openviduLazy-CCDpFWg1.esm.js +10 -0
- package/dist/{otp-B1YeyRXu.d.ts → otp-CEWfTj9v.d.ts} +0 -1
- package/dist/{otp-uaXiKt_R.esm.js → otp-D2k3PeSL.esm.js} +3 -14
- package/dist/{permissionGuards-BNOe4Tnu.esm.js → permissionGuards-KINpmKtI.esm.js} +2 -4
- package/dist/{permissionServices-C_kxhNeo.esm.js → permissionServices-UvUcOSRb.esm.js} +35 -28
- package/dist/personhood.d.ts +13 -20
- package/dist/personhood.esm.js +153 -85
- package/dist/phone.d.ts +1 -5
- package/dist/phone.esm.js +3 -10
- package/dist/{phoneManager-_KtitbUA.d.ts → phoneManager-BBU8Lq0O.d.ts} +4 -7
- package/dist/{phoneManager-CRblfdcI.esm.js → phoneManager-Cpiai2IM.esm.js} +82 -12
- package/dist/{phoneStateMachine-DjFGWMjQ.esm.js → phoneStateMachine-E1fUUcNM.esm.js} +7 -9
- package/dist/{platform-0Ot-bF_a.esm.js → platform-BJrm5nzZ.esm.js} +31 -11
- package/dist/privacyLensWorker-DI-Rg83h.esm.js +355 -0
- package/dist/qe-signature.d.ts +4 -6
- package/dist/qe-signature.esm.js +10 -11
- package/dist/{recordingService-CxaYkITO.esm.js → recordingService-CFpfdXSS.esm.js} +13 -31
- package/dist/redirect-to-mobile.d.ts +2 -6
- package/dist/redirect-to-mobile.esm.js +3 -10
- package/dist/{redirectToMobileManager-dv29o_LS.d.ts → redirectToMobileManager-BD2PvT5B.d.ts} +8 -44
- package/dist/{redirectToMobileManager-DbuNUlru.esm.js → redirectToMobileManager-C0dfc7f6.esm.js} +28 -8
- package/dist/{redirectToMobileStateMachine-BRaIJWOM.esm.js → redirectToMobileStateMachine-C9SYCJcH.esm.js} +74 -18
- package/dist/rolldown-runtime-FZ4Itg2g.esm.js +42 -0
- package/dist/{runChildModule-kojSv3MH.esm.js → runChildModule-DpvgAGFA.esm.js} +10 -9
- package/dist/{WasmUtilProvider-BgzcXBdl.esm.js → safeStorage-Ep56I-f_.esm.js} +98 -473
- package/dist/selfie.d.ts +8 -21
- package/dist/selfie.esm.js +40 -47
- package/dist/selfieErrorUtils-C2PYBVsp.esm.js +90 -0
- package/dist/{selfieManager-B1Px3GGa.esm.js → selfieManager-Br4onIMy.esm.js} +7 -10
- package/dist/{selfieManager-4juKfrHG.d.ts → selfieManager-DwlCppg0.d.ts} +3 -4
- package/dist/{selfieStateMachine-D0TS93Tu.esm.js → selfieStateMachine-CNGs8vFK.esm.js} +14 -29
- package/dist/{session-CLsU2Jnb.esm.js → session-CX2H3tmI.esm.js} +16 -7
- package/dist/session.d.ts +12 -10
- package/dist/session.esm.js +5 -15
- package/dist/sessionInitializer-CV6Rj_dn.esm.js +1865 -0
- package/dist/{setup-CfNsYAeB.esm.js → setup-CYdVacqv.esm.js} +319 -137
- package/dist/{setup-CmA2apmN.d.ts → setup-DywQeePQ.d.ts} +186 -4
- package/dist/signature.d.ts +2 -96
- package/dist/signature.esm.js +3 -108
- package/dist/signatureManager-DGBSWz2_.d.ts +106 -0
- package/dist/signatureManager-DdPgcmou.esm.js +113 -0
- package/dist/{signatureStateMachine-CdhlMih-.esm.js → signatureStateMachine-Cf73DGWO.esm.js} +5 -7
- package/dist/spawn-D9jgw9pW.d.ts +1441 -0
- package/dist/src-0Jurt29N.esm.js +4482 -0
- package/dist/{stats-BVy52wLy.esm.js → stats-B0nFKawG.esm.js} +3 -5
- package/dist/stats.esm.js +2 -5
- package/dist/topLevelStateName-B5i2avbh.esm.js +41 -0
- package/dist/{tri-CFAPtAUM.esm.js → tri-4RsGrIt6.esm.js} +3 -119
- package/dist/tri.d.ts +2 -2
- package/dist/tri.esm-BIjHhBJ2.esm.js +2620 -0
- package/dist/tri.esm.js +2 -4
- package/dist/trueSight-B8G85W4z.esm.js +1 -0
- package/dist/trueSightService-6dTpiaTh.esm.js +1894 -0
- package/dist/trust-graph.d.ts +4 -5
- package/dist/trust-graph.esm.js +13 -9
- package/dist/types-BEwVKkLJ.d.ts +15 -0
- package/dist/{types-BKLb3C42.esm.js → types-BN5RPPIZ.esm.js} +1 -2
- package/dist/types-BSBzhHRH.d.ts +57 -0
- package/dist/types-BX_XkMsQ2.d.ts +21 -0
- package/dist/types-BfHiko5D.d.ts +48 -0
- package/dist/{types-D8Cl1N2Z.d.ts → types-BfgmV7s72.d.ts} +2 -2
- package/dist/types-CJ7Yl9K-2.d.ts +164 -0
- package/dist/types-DPIDuhut.d.ts +40 -0
- package/dist/types-DVmXIdzW.d.ts +82 -0
- package/dist/types-DelMqZLe.d.ts +105 -0
- package/dist/types-EELWyWpd.d.ts +6 -0
- package/dist/{types-fO6KIdol.d.ts → types-Hmd7U0JA.d.ts} +80 -6
- package/dist/{types-BUgeB2X6.d.ts → types-KPvmag_B.d.ts} +7 -7
- package/dist/types-M6eb82ra2.d.ts +589 -0
- package/dist/{types-DV3wkhQ4.d.ts → types-Vb4P9ovf.d.ts} +1 -3
- package/dist/{urlUtils-CpiYwn7w.esm.js → urlUtils-D6phjq1-.esm.js} +1 -2
- package/dist/{video-ZY92rkel.esm.js → video-BtSWtHy1.esm.js} +1 -2
- package/dist/video-selfie.d.ts +71 -117
- package/dist/video-selfie.esm.js +575 -643
- package/dist/videoSelfieCameraWarmer-h_VUk5Vu.esm.js +651 -0
- package/dist/videoSelfieStepDetector-D3oo2ofo.d.ts +123 -0
- package/dist/wasm.d.ts +2 -4
- package/dist/wasm.esm.js +4 -15
- package/dist/wasmDefaults-DTUrftxR.esm.js +125 -0
- package/dist/{wasmDsFlagSync-Ch0mFJNT.esm.js → wasmDsFlagSync-BqUCwLY8.esm.js} +2 -4
- package/dist/wasmWebClient-DM8lkb0z.esm.js +407 -0
- package/dist/watchlist-for-business.d.ts +1 -3
- package/dist/watchlist-for-business.esm.js +9 -9
- package/dist/watchlist.d.ts +1 -52
- package/dist/watchlist.esm.js +3 -70
- package/dist/{watchlistForBusinessStateMachine-R1Yp1g5A.esm.js → watchlistForBusinessStateMachine-BcBMkMvV.esm.js} +5 -7
- package/dist/watchlistManager-CjSMmbyq.esm.js +83 -0
- package/dist/watchlistManager-DLXef90v.d.ts +68 -0
- package/dist/{watchlistStateMachine-D07UVq1m.esm.js → watchlistStateMachine-Bl7Wy9Cm.esm.js} +5 -7
- package/dist/workflow.d.ts +239 -203
- package/dist/workflow.esm.js +156 -101
- package/dist/xstate-actors.esm-CtI5S0f4.esm.js +310 -0
- package/dist/{xstate.esm-nY3M5UYm.esm.js → xstate.esm-Cf4e0Cfd.esm.js} +136 -610
- package/package.json +14 -9
- package/dist/Actor-BwgmOPkb.d.ts +0 -2
- package/dist/Face2DProvider-CZU11g6r.esm.js +0 -824
- package/dist/FaceDetectionProvider-CPWg-PAH.d.ts +0 -119
- package/dist/IWasmUtilCapability-DaSNxgA8.d.ts +0 -150
- package/dist/PrivacyLensProvider-B_zrV25p.esm.js +0 -339
- package/dist/StateMachine-D5WO6lHS.d.ts +0 -2
- package/dist/StreamCanvasCapture-DHaWferF.d.ts +0 -42
- package/dist/ae-signature-Pp4oCAHD.esm.js +0 -12
- package/dist/api-DsbUi7TO.esm.js +0 -72
- package/dist/browser-DlFgHpoC-Br3G10gw.esm.js +0 -1425
- package/dist/browserSimulation-DZwEy9bu.esm.js +0 -2804
- package/dist/camera-CxxXV0VN.esm.js +0 -79
- package/dist/canvas-90BqS0NF.d.ts +0 -112
- package/dist/chunk-CIKcdghV.esm.js +0 -49
- package/dist/clientLifecycle-VyzRfALg.esm.js +0 -534
- package/dist/cpf-ocr.d.ts +0 -10
- package/dist/cpf-ocr.esm.js +0 -8
- package/dist/cpfOcrManager-9eM4z4o7.esm.js +0 -190
- package/dist/cpfOcrManager-C5U9E0hf.d.ts +0 -216
- package/dist/createFaceAvatar-BZSg2MNo.esm.js +0 -46
- package/dist/deepsightLoader-CU_tiLMx.esm.js +0 -62
- package/dist/flowServices-DkQmOkLV.esm.js +0 -208
- package/dist/geolocationManager-DaHYFkVO.d.ts +0 -156
- package/dist/getDeviceClass-DIjnTPjR.esm.js +0 -14
- package/dist/http-CnsKEaJY.esm.js +0 -0
- package/dist/idCaptureManager-CwuXtVu6.d.ts +0 -1013
- package/dist/index-BAyZ8_iI.d.ts +0 -93
- package/dist/openviduLazy-jPgABwrt.esm.js +0 -3
- package/dist/openviduLazy-wEojM41w.esm.js +0 -12
- package/dist/qe-signature-BnWIpR-O.esm.js +0 -12
- package/dist/sessionInitializer-Dj7-aJaP.esm.js +0 -547
- package/dist/tri.esm-DDJ1zOqG.esm.js +0 -2593
- package/dist/types-BcF-fii5.d.ts +0 -5
- package/dist/videoSelfieSteps-Djpv7cjb.esm.js +0 -58
- /package/dist/{IVisibilityObserverCapability-BZ1rE7ly.d.ts → IVisibilityObserverCapability-D4tvIB5v.d.ts} +0 -0
- /package/dist/{camera-CKU96nwJ.d.ts → camera-9wWD-pwg.d.ts} +0 -0
- /package/dist/{flowCompletionService-BOSTlAWo.d.ts → flowCompletionService-BlAHsKyv.d.ts} +0 -0
- /package/dist/{types-BgjMAEXl.d.ts → types-Bk_6dmDa.d.ts} +0 -0
- /package/dist/{warmup-Dd0iq6KF.d.ts → warmup-Dv2alr2-.d.ts} +0 -0
|
@@ -0,0 +1,1441 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/inspection.d.ts
|
|
2
|
+
type InspectionEvent = InspectedSnapshotEvent | InspectedEventEvent | InspectedActorEvent | InspectedMicrostepEvent | InspectedActionEvent;
|
|
3
|
+
interface BaseInspectionEventProperties {
|
|
4
|
+
rootId: string;
|
|
5
|
+
/**
|
|
6
|
+
* The relevant actorRef for the inspection event.
|
|
7
|
+
*
|
|
8
|
+
* - For snapshot events, this is the `actorRef` of the snapshot.
|
|
9
|
+
* - For event events, this is the target `actorRef` (recipient of event).
|
|
10
|
+
* - For actor events, this is the `actorRef` of the registered actor.
|
|
11
|
+
*/
|
|
12
|
+
actorRef: ActorRefLike;
|
|
13
|
+
}
|
|
14
|
+
interface InspectedSnapshotEvent extends BaseInspectionEventProperties {
|
|
15
|
+
type: '@xstate.snapshot';
|
|
16
|
+
event: AnyEventObject;
|
|
17
|
+
snapshot: Snapshot<unknown>;
|
|
18
|
+
}
|
|
19
|
+
interface InspectedMicrostepEvent extends BaseInspectionEventProperties {
|
|
20
|
+
type: '@xstate.microstep';
|
|
21
|
+
event: AnyEventObject;
|
|
22
|
+
snapshot: Snapshot<unknown>;
|
|
23
|
+
_transitions: AnyTransitionDefinition[];
|
|
24
|
+
}
|
|
25
|
+
interface InspectedActionEvent extends BaseInspectionEventProperties {
|
|
26
|
+
type: '@xstate.action';
|
|
27
|
+
action: {
|
|
28
|
+
type: string;
|
|
29
|
+
params: unknown;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface InspectedEventEvent extends BaseInspectionEventProperties {
|
|
33
|
+
type: '@xstate.event';
|
|
34
|
+
sourceRef: ActorRefLike | undefined;
|
|
35
|
+
event: AnyEventObject;
|
|
36
|
+
}
|
|
37
|
+
interface InspectedActorEvent extends BaseInspectionEventProperties {
|
|
38
|
+
type: '@xstate.actor';
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/system.d.ts
|
|
42
|
+
interface ScheduledEvent {
|
|
43
|
+
id: string;
|
|
44
|
+
event: EventObject;
|
|
45
|
+
startedAt: number;
|
|
46
|
+
delay: number;
|
|
47
|
+
source: AnyActorRef;
|
|
48
|
+
target: AnyActorRef;
|
|
49
|
+
}
|
|
50
|
+
interface Clock {
|
|
51
|
+
setTimeout(fn: (...args: any[]) => void, timeout: number): any;
|
|
52
|
+
clearTimeout(id: any): void;
|
|
53
|
+
}
|
|
54
|
+
interface Scheduler {
|
|
55
|
+
schedule(source: AnyActorRef, target: AnyActorRef, event: EventObject, delay: number, id: string | undefined): void;
|
|
56
|
+
cancel(source: AnyActorRef, id: string): void;
|
|
57
|
+
cancelAll(actorRef: AnyActorRef): void;
|
|
58
|
+
}
|
|
59
|
+
interface ActorSystem<T extends ActorSystemInfo> {
|
|
60
|
+
get: <K extends keyof T['actors']>(key: K) => T['actors'][K] | undefined;
|
|
61
|
+
getAll: () => Partial<T['actors']>;
|
|
62
|
+
inspect: (observer: Observer<InspectionEvent> | ((inspectionEvent: InspectionEvent) => void)) => Subscription;
|
|
63
|
+
scheduler: Scheduler;
|
|
64
|
+
getSnapshot: () => {
|
|
65
|
+
_scheduledEvents: Record<string, ScheduledEvent>;
|
|
66
|
+
};
|
|
67
|
+
start: () => void;
|
|
68
|
+
_clock: Clock;
|
|
69
|
+
_logger: (...args: any[]) => void;
|
|
70
|
+
}
|
|
71
|
+
type AnyActorSystem = ActorSystem<any>;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/StateMachine.d.ts
|
|
74
|
+
declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TStateValue extends StateValue, TTag extends string, TInput, TOutput, TEmitted extends EventObject, TMeta extends MetaObject, TConfig extends StateSchema> implements ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, TInput, AnyActorSystem, TEmitted> {
|
|
75
|
+
/** The raw config used to create the machine. */
|
|
76
|
+
config: MachineConfig<TContext, TEvent, any, any, any, any, any, any, TOutput, any // TEmitted
|
|
77
|
+
, any> & {
|
|
78
|
+
schemas?: unknown;
|
|
79
|
+
};
|
|
80
|
+
/** The machine's own version. */
|
|
81
|
+
version?: string;
|
|
82
|
+
schemas: unknown;
|
|
83
|
+
implementations: MachineImplementationsSimplified<TContext, TEvent>;
|
|
84
|
+
root: StateNode<TContext, TEvent>;
|
|
85
|
+
id: string;
|
|
86
|
+
states: StateNode<TContext, TEvent>['states'];
|
|
87
|
+
events: Array<EventDescriptor<TEvent>>;
|
|
88
|
+
constructor(
|
|
89
|
+
/** The raw config used to create the machine. */
|
|
90
|
+
config: MachineConfig<TContext, TEvent, any, any, any, any, any, any, TOutput, any // TEmitted
|
|
91
|
+
, any> & {
|
|
92
|
+
schemas?: unknown;
|
|
93
|
+
}, implementations?: MachineImplementationsSimplified<TContext, TEvent>);
|
|
94
|
+
/**
|
|
95
|
+
* Clones this state machine with the provided implementations.
|
|
96
|
+
*
|
|
97
|
+
* @param implementations Options (`actions`, `guards`, `actors`, `delays`) to
|
|
98
|
+
* recursively merge with the existing options.
|
|
99
|
+
* @returns A new `StateMachine` instance with the provided implementations.
|
|
100
|
+
*/
|
|
101
|
+
provide(implementations: InternalMachineImplementations<ResolvedStateMachineTypes<TContext, DoNotInfer<TEvent>, TActor, TAction, TGuard, TDelay, TTag, TEmitted>>): StateMachine<TContext, TEvent, TChildren, TActor, TAction, TGuard, TDelay, TStateValue, TTag, TInput, TOutput, TEmitted, TMeta, TConfig>;
|
|
102
|
+
resolveState(config: {
|
|
103
|
+
value: StateValue;
|
|
104
|
+
context?: TContext;
|
|
105
|
+
historyValue?: HistoryValue<TContext, TEvent>;
|
|
106
|
+
status?: SnapshotStatus;
|
|
107
|
+
output?: TOutput;
|
|
108
|
+
error?: unknown;
|
|
109
|
+
} & (Equals<TContext, MachineContext> extends false ? {
|
|
110
|
+
context: unknown;
|
|
111
|
+
} : {})): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
|
|
112
|
+
/**
|
|
113
|
+
* Determines the next snapshot given the current `snapshot` and received
|
|
114
|
+
* `event`. Calculates a full macrostep from all microsteps.
|
|
115
|
+
*
|
|
116
|
+
* @param snapshot The current snapshot
|
|
117
|
+
* @param event The received event
|
|
118
|
+
*/
|
|
119
|
+
transition(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent, actorScope: ActorScope<typeof snapshot, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
|
|
120
|
+
/**
|
|
121
|
+
* Determines the next state given the current `state` and `event`. Calculates
|
|
122
|
+
* a microstep.
|
|
123
|
+
*
|
|
124
|
+
* @param state The current state
|
|
125
|
+
* @param event The received event
|
|
126
|
+
*/
|
|
127
|
+
microstep(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent, actorScope: AnyActorScope): Array<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>>;
|
|
128
|
+
getTransitionData(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent): Array<TransitionDefinition<TContext, TEvent>>;
|
|
129
|
+
/**
|
|
130
|
+
* The initial state _before_ evaluating any microsteps. This "pre-initial"
|
|
131
|
+
* state is provided to initial actions executed in the initial state.
|
|
132
|
+
*/
|
|
133
|
+
private getPreInitialState;
|
|
134
|
+
/**
|
|
135
|
+
* Returns the initial `State` instance, with reference to `self` as an
|
|
136
|
+
* `ActorRef`.
|
|
137
|
+
*/
|
|
138
|
+
getInitialSnapshot(actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, AnyActorSystem, TEmitted>, input?: TInput): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
|
|
139
|
+
start(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>): void;
|
|
140
|
+
getStateNodeById(stateId: string): StateNode<TContext, TEvent>;
|
|
141
|
+
get definition(): StateMachineDefinition<TContext, TEvent>;
|
|
142
|
+
toJSON(): StateMachineDefinition<TContext, TEvent>;
|
|
143
|
+
getPersistedSnapshot(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, options?: unknown): Snapshot<unknown>;
|
|
144
|
+
restoreSnapshot(snapshot: Snapshot<unknown>, _actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/StateNode.d.ts
|
|
148
|
+
interface StateNodeOptions<TContext extends MachineContext, TEvent extends EventObject> {
|
|
149
|
+
_key: string;
|
|
150
|
+
_parent?: StateNode<TContext, TEvent>;
|
|
151
|
+
_machine: AnyStateMachine;
|
|
152
|
+
}
|
|
153
|
+
declare class StateNode<TContext extends MachineContext = MachineContext, TEvent extends EventObject = EventObject> {
|
|
154
|
+
/** The raw config used to create the machine. */
|
|
155
|
+
config: StateNodeConfig<TContext, TEvent, TODO // actors
|
|
156
|
+
, TODO // actions
|
|
157
|
+
, TODO // guards
|
|
158
|
+
, TODO // delays
|
|
159
|
+
, TODO // tags
|
|
160
|
+
, TODO // output
|
|
161
|
+
, TODO // emitted
|
|
162
|
+
, TODO>;
|
|
163
|
+
/**
|
|
164
|
+
* The relative key of the state node, which represents its location in the
|
|
165
|
+
* overall state value.
|
|
166
|
+
*/
|
|
167
|
+
key: string;
|
|
168
|
+
/** The unique ID of the state node. */
|
|
169
|
+
id: string;
|
|
170
|
+
/**
|
|
171
|
+
* The type of this state node:
|
|
172
|
+
*
|
|
173
|
+
* - `'atomic'` - no child state nodes
|
|
174
|
+
* - `'compound'` - nested child state nodes (XOR)
|
|
175
|
+
* - `'parallel'` - orthogonal nested child state nodes (AND)
|
|
176
|
+
* - `'history'` - history state node
|
|
177
|
+
* - `'final'` - final state node
|
|
178
|
+
*/
|
|
179
|
+
type: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';
|
|
180
|
+
/** The string path from the root machine node to this node. */
|
|
181
|
+
path: string[];
|
|
182
|
+
/** The child state nodes. */
|
|
183
|
+
states: StateNodesConfig<TContext, TEvent>;
|
|
184
|
+
/**
|
|
185
|
+
* The type of history on this state node. Can be:
|
|
186
|
+
*
|
|
187
|
+
* - `'shallow'` - recalls only top-level historical state value
|
|
188
|
+
* - `'deep'` - recalls historical state value at all levels
|
|
189
|
+
*/
|
|
190
|
+
history: false | 'shallow' | 'deep';
|
|
191
|
+
/** The action(s) to be executed upon entering the state node. */
|
|
192
|
+
entry: UnknownAction[];
|
|
193
|
+
/** The action(s) to be executed upon exiting the state node. */
|
|
194
|
+
exit: UnknownAction[];
|
|
195
|
+
/** The parent state node. */
|
|
196
|
+
parent?: StateNode<TContext, TEvent>;
|
|
197
|
+
/** The root machine node. */
|
|
198
|
+
machine: StateMachine<TContext, TEvent, any // children
|
|
199
|
+
, any // actor
|
|
200
|
+
, any // action
|
|
201
|
+
, any // guard
|
|
202
|
+
, any // delay
|
|
203
|
+
, any // state value
|
|
204
|
+
, any // tag
|
|
205
|
+
, any // input
|
|
206
|
+
, any // output
|
|
207
|
+
, any // emitted
|
|
208
|
+
, any // meta
|
|
209
|
+
, any>;
|
|
210
|
+
/**
|
|
211
|
+
* The meta data associated with this state node, which will be returned in
|
|
212
|
+
* State instances.
|
|
213
|
+
*/
|
|
214
|
+
meta?: any;
|
|
215
|
+
/**
|
|
216
|
+
* The output data sent with the "xstate.done.state._id_" event if this is a
|
|
217
|
+
* final state node.
|
|
218
|
+
*/
|
|
219
|
+
output?: Mapper<MachineContext, EventObject, unknown, EventObject> | NonReducibleUnknown;
|
|
220
|
+
/**
|
|
221
|
+
* The order this state node appears. Corresponds to the implicit document
|
|
222
|
+
* order.
|
|
223
|
+
*/
|
|
224
|
+
order: number;
|
|
225
|
+
description?: string;
|
|
226
|
+
tags: string[];
|
|
227
|
+
transitions: Map<string, TransitionDefinition<TContext, TEvent>[]>;
|
|
228
|
+
always?: Array<TransitionDefinition<TContext, TEvent>>;
|
|
229
|
+
constructor(
|
|
230
|
+
/** The raw config used to create the machine. */
|
|
231
|
+
config: StateNodeConfig<TContext, TEvent, TODO // actors
|
|
232
|
+
, TODO // actions
|
|
233
|
+
, TODO // guards
|
|
234
|
+
, TODO // delays
|
|
235
|
+
, TODO // tags
|
|
236
|
+
, TODO // output
|
|
237
|
+
, TODO // emitted
|
|
238
|
+
, TODO>, options: StateNodeOptions<TContext, TEvent>);
|
|
239
|
+
/** The well-structured state node definition. */
|
|
240
|
+
get definition(): StateNodeDefinition<TContext, TEvent>;
|
|
241
|
+
/** The logic invoked as actors by this state node. */
|
|
242
|
+
get invoke(): Array<InvokeDefinition<TContext, TEvent, ProvidedActor, ParameterizedObject, ParameterizedObject, string, TODO // TEmitted
|
|
243
|
+
, TODO>>;
|
|
244
|
+
/** The mapping of events to transitions. */
|
|
245
|
+
get on(): TransitionDefinitionMap<TContext, TEvent>;
|
|
246
|
+
get after(): Array<DelayedTransitionDefinition<TContext, TEvent>>;
|
|
247
|
+
get initial(): InitialTransitionDefinition<TContext, TEvent>;
|
|
248
|
+
/** All the event types accepted by this state node and its descendants. */
|
|
249
|
+
get events(): Array<EventDescriptor<TEvent>>;
|
|
250
|
+
/**
|
|
251
|
+
* All the events that have transitions directly from this state node.
|
|
252
|
+
*
|
|
253
|
+
* Excludes any inert events.
|
|
254
|
+
*/
|
|
255
|
+
get ownEvents(): Array<EventDescriptor<TEvent>>;
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/State.d.ts
|
|
259
|
+
type ToTestStateValue<TStateValue extends StateValue> = TStateValue extends string ? TStateValue : IsNever<keyof TStateValue> extends true ? never : keyof TStateValue | { [K in keyof TStateValue]?: ToTestStateValue<NonNullable<TStateValue[K]>>; };
|
|
260
|
+
interface MachineSnapshotBase<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta, TStateSchema extends StateSchema = StateSchema> {
|
|
261
|
+
/** The state machine that produced this state snapshot. */
|
|
262
|
+
machine: StateMachine<TContext, TEvent, TChildren, ProvidedActor, ParameterizedObject, ParameterizedObject, string, TStateValue, TTag, unknown, TOutput, EventObject // TEmitted
|
|
263
|
+
, any // TMeta
|
|
264
|
+
, TStateSchema>;
|
|
265
|
+
/** The tags of the active state nodes that represent the current state value. */
|
|
266
|
+
tags: Set<string>;
|
|
267
|
+
/**
|
|
268
|
+
* The current state value.
|
|
269
|
+
*
|
|
270
|
+
* This represents the active state nodes in the state machine.
|
|
271
|
+
*
|
|
272
|
+
* - For atomic state nodes, it is a string.
|
|
273
|
+
* - For compound parent state nodes, it is an object where:
|
|
274
|
+
*
|
|
275
|
+
* - The key is the parent state node's key
|
|
276
|
+
* - The value is the current state value of the active child state node(s)
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
*
|
|
280
|
+
* ```ts
|
|
281
|
+
* // single-level state node
|
|
282
|
+
* snapshot.value; // => 'yellow'
|
|
283
|
+
*
|
|
284
|
+
* // nested state nodes
|
|
285
|
+
* snapshot.value; // => { red: 'wait' }
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
value: TStateValue;
|
|
289
|
+
/** The current status of this snapshot. */
|
|
290
|
+
status: SnapshotStatus;
|
|
291
|
+
error: unknown;
|
|
292
|
+
context: TContext;
|
|
293
|
+
historyValue: Readonly<HistoryValue<TContext, TEvent>>;
|
|
294
|
+
/** The enabled state nodes representative of the state value. */
|
|
295
|
+
_nodes: Array<StateNode<TContext, TEvent>>;
|
|
296
|
+
/** An object mapping actor names to spawned/invoked actors. */
|
|
297
|
+
children: TChildren;
|
|
298
|
+
/**
|
|
299
|
+
* Whether the current state value is a subset of the given partial state
|
|
300
|
+
* value.
|
|
301
|
+
*
|
|
302
|
+
* @param partialStateValue
|
|
303
|
+
*/
|
|
304
|
+
matches: (partialStateValue: ToTestStateValue<TStateValue>) => boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Whether the current state nodes has a state node with the specified `tag`.
|
|
307
|
+
*
|
|
308
|
+
* @param tag
|
|
309
|
+
*/
|
|
310
|
+
hasTag: (tag: TTag) => boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Determines whether sending the `event` will cause a non-forbidden
|
|
313
|
+
* transition to be selected, even if the transitions have no actions nor
|
|
314
|
+
* change the state value.
|
|
315
|
+
*
|
|
316
|
+
* @param event The event to test
|
|
317
|
+
* @returns Whether the event will cause a transition
|
|
318
|
+
*/
|
|
319
|
+
can: (event: TEvent) => boolean;
|
|
320
|
+
getMeta: () => Record<StateId<TStateSchema> & string, TMeta | undefined>;
|
|
321
|
+
toJSON: () => unknown;
|
|
322
|
+
}
|
|
323
|
+
interface ActiveMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> {
|
|
324
|
+
status: 'active';
|
|
325
|
+
output: undefined;
|
|
326
|
+
error: undefined;
|
|
327
|
+
}
|
|
328
|
+
interface DoneMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> {
|
|
329
|
+
status: 'done';
|
|
330
|
+
output: TOutput;
|
|
331
|
+
error: undefined;
|
|
332
|
+
}
|
|
333
|
+
interface ErrorMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> {
|
|
334
|
+
status: 'error';
|
|
335
|
+
output: undefined;
|
|
336
|
+
error: unknown;
|
|
337
|
+
}
|
|
338
|
+
interface StoppedMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> {
|
|
339
|
+
status: 'stopped';
|
|
340
|
+
output: undefined;
|
|
341
|
+
error: undefined;
|
|
342
|
+
}
|
|
343
|
+
type MachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> = ActiveMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> | DoneMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> | ErrorMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> | StoppedMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/actors/promise.d.ts
|
|
346
|
+
type PromiseSnapshot<TOutput, TInput> = Snapshot<TOutput> & {
|
|
347
|
+
input: TInput | undefined;
|
|
348
|
+
};
|
|
349
|
+
type PromiseActorLogic<TOutput, TInput = unknown, TEmitted extends EventObject = EventObject> = ActorLogic<PromiseSnapshot<TOutput, TInput>, {
|
|
350
|
+
type: string;
|
|
351
|
+
[k: string]: unknown;
|
|
352
|
+
}, TInput // input
|
|
353
|
+
, AnyActorSystem, TEmitted>;
|
|
354
|
+
/**
|
|
355
|
+
* Represents an actor created by `fromPromise`.
|
|
356
|
+
*
|
|
357
|
+
* The type of `self` within the actor's logic.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
*
|
|
361
|
+
* ```ts
|
|
362
|
+
* import { fromPromise, createActor } from 'xstate';
|
|
363
|
+
*
|
|
364
|
+
* // The actor's resolved output
|
|
365
|
+
* type Output = string;
|
|
366
|
+
* // The actor's input.
|
|
367
|
+
* type Input = { message: string };
|
|
368
|
+
*
|
|
369
|
+
* // Actor logic that fetches the url of an image of a cat saying `input.message`.
|
|
370
|
+
* const logic = fromPromise<Output, Input>(async ({ input, self }) => {
|
|
371
|
+
* self;
|
|
372
|
+
* // ^? PromiseActorRef<Output, Input>
|
|
373
|
+
*
|
|
374
|
+
* const data = await fetch(
|
|
375
|
+
* `https://cataas.com/cat/says/${input.message}`
|
|
376
|
+
* );
|
|
377
|
+
* const url = await data.json();
|
|
378
|
+
* return url;
|
|
379
|
+
* });
|
|
380
|
+
*
|
|
381
|
+
* const actor = createActor(logic, { input: { message: 'hello world' } });
|
|
382
|
+
* // ^? PromiseActorRef<Output, Input>
|
|
383
|
+
* ```
|
|
384
|
+
*
|
|
385
|
+
* @see {@link fromPromise}
|
|
386
|
+
*/
|
|
387
|
+
type PromiseActorRef<TOutput> = ActorRefFromLogic<PromiseActorLogic<TOutput, unknown>>;
|
|
388
|
+
/**
|
|
389
|
+
* An actor logic creator which returns promise logic as defined by an async
|
|
390
|
+
* process that resolves or rejects after some time.
|
|
391
|
+
*
|
|
392
|
+
* Actors created from promise actor logic (“promise actors”) can:
|
|
393
|
+
*
|
|
394
|
+
* - Emit the resolved value of the promise
|
|
395
|
+
* - Output the resolved value of the promise
|
|
396
|
+
*
|
|
397
|
+
* Sending events to promise actors will have no effect.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
*
|
|
401
|
+
* ```ts
|
|
402
|
+
* const promiseLogic = fromPromise(async () => {
|
|
403
|
+
* const result = await fetch('https://example.com/...').then((data) =>
|
|
404
|
+
* data.json()
|
|
405
|
+
* );
|
|
406
|
+
*
|
|
407
|
+
* return result;
|
|
408
|
+
* });
|
|
409
|
+
*
|
|
410
|
+
* const promiseActor = createActor(promiseLogic);
|
|
411
|
+
* promiseActor.subscribe((snapshot) => {
|
|
412
|
+
* console.log(snapshot);
|
|
413
|
+
* });
|
|
414
|
+
* promiseActor.start();
|
|
415
|
+
* // => {
|
|
416
|
+
* // output: undefined,
|
|
417
|
+
* // status: 'active'
|
|
418
|
+
* // ...
|
|
419
|
+
* // }
|
|
420
|
+
*
|
|
421
|
+
* // After promise resolves
|
|
422
|
+
* // => {
|
|
423
|
+
* // output: { ... },
|
|
424
|
+
* // status: 'done',
|
|
425
|
+
* // ...
|
|
426
|
+
* // }
|
|
427
|
+
* ```
|
|
428
|
+
*
|
|
429
|
+
* @param promiseCreator A function which returns a Promise, and accepts an
|
|
430
|
+
* object with the following properties:
|
|
431
|
+
*
|
|
432
|
+
* - `input` - Data that was provided to the promise actor
|
|
433
|
+
* - `self` - The parent actor of the promise actor
|
|
434
|
+
* - `system` - The actor system to which the promise actor belongs
|
|
435
|
+
*
|
|
436
|
+
* @see {@link https://stately.ai/docs/input | Input docs} for more information about how input is passed
|
|
437
|
+
*/
|
|
438
|
+
declare function fromPromise<TOutput, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject>(promiseCreator: ({ input, system, self, signal, emit }: {
|
|
439
|
+
/** Data that was provided to the promise actor */
|
|
440
|
+
input: TInput;
|
|
441
|
+
/** The actor system to which the promise actor belongs */
|
|
442
|
+
system: AnyActorSystem;
|
|
443
|
+
/** The parent actor of the promise actor */
|
|
444
|
+
self: PromiseActorRef<TOutput>;
|
|
445
|
+
signal: AbortSignal;
|
|
446
|
+
emit: (emitted: TEmitted) => void;
|
|
447
|
+
}) => PromiseLike<TOutput>): PromiseActorLogic<TOutput, TInput, TEmitted>;
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/symbolObservable.d.ts
|
|
450
|
+
declare const symbolObservable: typeof Symbol.observable;
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/createActor.d.ts
|
|
453
|
+
/**
|
|
454
|
+
* An Actor is a running process that can receive events, send events and change
|
|
455
|
+
* its behavior based on the events it receives, which can cause effects outside
|
|
456
|
+
* of the actor. When you run a state machine, it becomes an actor.
|
|
457
|
+
*/
|
|
458
|
+
declare class Actor<TLogic extends AnyActorLogic> implements ActorRef<SnapshotFrom<TLogic>, EventFromLogic<TLogic>, EmittedFrom<TLogic>> {
|
|
459
|
+
logic: TLogic;
|
|
460
|
+
/** The current internal state of the actor. */
|
|
461
|
+
private _snapshot;
|
|
462
|
+
/**
|
|
463
|
+
* The clock that is responsible for setting and clearing timeouts, such as
|
|
464
|
+
* delayed events and transitions.
|
|
465
|
+
*/
|
|
466
|
+
clock: Clock;
|
|
467
|
+
options: Readonly<ActorOptions<TLogic>>;
|
|
468
|
+
/** The unique identifier for this actor relative to its parent. */
|
|
469
|
+
id: string;
|
|
470
|
+
private mailbox;
|
|
471
|
+
private observers;
|
|
472
|
+
private eventListeners;
|
|
473
|
+
private logger;
|
|
474
|
+
_parent?: AnyActorRef;
|
|
475
|
+
ref: ActorRef<SnapshotFrom<TLogic>, EventFromLogic<TLogic>, EmittedFrom<TLogic>>;
|
|
476
|
+
private _actorScope;
|
|
477
|
+
systemId: string | undefined;
|
|
478
|
+
/** The globally unique process ID for this invocation. */
|
|
479
|
+
sessionId: string;
|
|
480
|
+
/** The system to which this actor belongs. */
|
|
481
|
+
system: AnyActorSystem;
|
|
482
|
+
private _doneEvent?;
|
|
483
|
+
src: string | AnyActorLogic;
|
|
484
|
+
/**
|
|
485
|
+
* Creates a new actor instance for the given logic with the provided options,
|
|
486
|
+
* if any.
|
|
487
|
+
*
|
|
488
|
+
* @param logic The logic to create an actor from
|
|
489
|
+
* @param options Actor options
|
|
490
|
+
*/
|
|
491
|
+
constructor(logic: TLogic, options?: ActorOptions<TLogic>);
|
|
492
|
+
private _initState;
|
|
493
|
+
private _deferred;
|
|
494
|
+
private update;
|
|
495
|
+
/**
|
|
496
|
+
* Subscribe an observer to an actor’s snapshot values.
|
|
497
|
+
*
|
|
498
|
+
* @remarks
|
|
499
|
+
* The observer will receive the actor’s snapshot value when it is emitted.
|
|
500
|
+
* The observer can be:
|
|
501
|
+
*
|
|
502
|
+
* - A plain function that receives the latest snapshot, or
|
|
503
|
+
* - An observer object whose `.next(snapshot)` method receives the latest
|
|
504
|
+
* snapshot
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
*
|
|
508
|
+
* ```ts
|
|
509
|
+
* // Observer as a plain function
|
|
510
|
+
* const subscription = actor.subscribe((snapshot) => {
|
|
511
|
+
* console.log(snapshot);
|
|
512
|
+
* });
|
|
513
|
+
* ```
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
*
|
|
517
|
+
* ```ts
|
|
518
|
+
* // Observer as an object
|
|
519
|
+
* const subscription = actor.subscribe({
|
|
520
|
+
* next(snapshot) {
|
|
521
|
+
* console.log(snapshot);
|
|
522
|
+
* },
|
|
523
|
+
* error(err) {
|
|
524
|
+
* // ...
|
|
525
|
+
* },
|
|
526
|
+
* complete() {
|
|
527
|
+
* // ...
|
|
528
|
+
* }
|
|
529
|
+
* });
|
|
530
|
+
* ```
|
|
531
|
+
*
|
|
532
|
+
* The return value of `actor.subscribe(observer)` is a subscription object
|
|
533
|
+
* that has an `.unsubscribe()` method. You can call
|
|
534
|
+
* `subscription.unsubscribe()` to unsubscribe the observer:
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
*
|
|
538
|
+
* ```ts
|
|
539
|
+
* const subscription = actor.subscribe((snapshot) => {
|
|
540
|
+
* // ...
|
|
541
|
+
* });
|
|
542
|
+
*
|
|
543
|
+
* // Unsubscribe the observer
|
|
544
|
+
* subscription.unsubscribe();
|
|
545
|
+
* ```
|
|
546
|
+
*
|
|
547
|
+
* When the actor is stopped, all of its observers will automatically be
|
|
548
|
+
* unsubscribed.
|
|
549
|
+
*
|
|
550
|
+
* @param observer - Either a plain function that receives the latest
|
|
551
|
+
* snapshot, or an observer object whose `.next(snapshot)` method receives
|
|
552
|
+
* the latest snapshot
|
|
553
|
+
*/
|
|
554
|
+
subscribe(observer: Observer<SnapshotFrom<TLogic>>): Subscription;
|
|
555
|
+
subscribe(nextListener?: (snapshot: SnapshotFrom<TLogic>) => void, errorListener?: (error: any) => void, completeListener?: () => void): Subscription;
|
|
556
|
+
on<TType extends EmittedFrom<TLogic>['type'] | '*'>(type: TType, handler: (emitted: EmittedFrom<TLogic> & (TType extends '*' ? unknown : {
|
|
557
|
+
type: TType;
|
|
558
|
+
})) => void): Subscription;
|
|
559
|
+
/** Starts the Actor from the initial state */
|
|
560
|
+
start(): this;
|
|
561
|
+
private _process;
|
|
562
|
+
private _stop;
|
|
563
|
+
/** Stops the Actor and unsubscribe all listeners. */
|
|
564
|
+
stop(): this;
|
|
565
|
+
private _complete;
|
|
566
|
+
private _reportError;
|
|
567
|
+
private _error;
|
|
568
|
+
private _stopProcedure;
|
|
569
|
+
/**
|
|
570
|
+
* Sends an event to the running Actor to trigger a transition.
|
|
571
|
+
*
|
|
572
|
+
* @param event The event to send
|
|
573
|
+
*/
|
|
574
|
+
send(event: EventFromLogic<TLogic>): void;
|
|
575
|
+
private attachDevTools;
|
|
576
|
+
toJSON(): {
|
|
577
|
+
xstate$$type: number;
|
|
578
|
+
id: string;
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* Obtain the internal state of the actor, which can be persisted.
|
|
582
|
+
*
|
|
583
|
+
* @remarks
|
|
584
|
+
* The internal state can be persisted from any actor, not only machines.
|
|
585
|
+
*
|
|
586
|
+
* Note that the persisted state is not the same as the snapshot from
|
|
587
|
+
* {@link Actor.getSnapshot}. Persisted state represents the internal state of
|
|
588
|
+
* the actor, while snapshots represent the actor's last emitted value.
|
|
589
|
+
*
|
|
590
|
+
* Can be restored with {@link ActorOptions.state}
|
|
591
|
+
* @see https://stately.ai/docs/persistence
|
|
592
|
+
*/
|
|
593
|
+
getPersistedSnapshot(): Snapshot<unknown>;
|
|
594
|
+
[symbolObservable](): InteropSubscribable<SnapshotFrom<TLogic>>;
|
|
595
|
+
/**
|
|
596
|
+
* Read an actor’s snapshot synchronously.
|
|
597
|
+
*
|
|
598
|
+
* @remarks
|
|
599
|
+
* The snapshot represent an actor's last emitted value.
|
|
600
|
+
*
|
|
601
|
+
* When an actor receives an event, its internal state may change. An actor
|
|
602
|
+
* may emit a snapshot when a state transition occurs.
|
|
603
|
+
*
|
|
604
|
+
* Note that some actors, such as callback actors generated with
|
|
605
|
+
* `fromCallback`, will not emit snapshots.
|
|
606
|
+
* @see {@link Actor.subscribe} to subscribe to an actor’s snapshot values.
|
|
607
|
+
* @see {@link Actor.getPersistedSnapshot} to persist the internal state of an actor (which is more than just a snapshot).
|
|
608
|
+
*/
|
|
609
|
+
getSnapshot(): SnapshotFrom<TLogic>;
|
|
610
|
+
}
|
|
611
|
+
type RequiredActorOptionsKeys<TLogic extends AnyActorLogic> = undefined extends InputFrom<TLogic> ? never : 'input';
|
|
612
|
+
/**
|
|
613
|
+
* Creates a new actor instance for the given actor logic with the provided
|
|
614
|
+
* options, if any.
|
|
615
|
+
*
|
|
616
|
+
* @remarks
|
|
617
|
+
* When you create an actor from actor logic via `createActor(logic)`, you
|
|
618
|
+
* implicitly create an actor system where the created actor is the root actor.
|
|
619
|
+
* Any actors spawned from this root actor and its descendants are part of that
|
|
620
|
+
* actor system.
|
|
621
|
+
* @example
|
|
622
|
+
*
|
|
623
|
+
* ```ts
|
|
624
|
+
* import { createActor } from 'xstate';
|
|
625
|
+
* import { someActorLogic } from './someActorLogic.ts';
|
|
626
|
+
*
|
|
627
|
+
* // Creating the actor, which implicitly creates an actor system with itself as the root actor
|
|
628
|
+
* const actor = createActor(someActorLogic);
|
|
629
|
+
*
|
|
630
|
+
* actor.subscribe((snapshot) => {
|
|
631
|
+
* console.log(snapshot);
|
|
632
|
+
* });
|
|
633
|
+
*
|
|
634
|
+
* // Actors must be started by calling `actor.start()`, which will also start the actor system.
|
|
635
|
+
* actor.start();
|
|
636
|
+
*
|
|
637
|
+
* // Actors can receive events
|
|
638
|
+
* actor.send({ type: 'someEvent' });
|
|
639
|
+
*
|
|
640
|
+
* // You can stop root actors by calling `actor.stop()`, which will also stop the actor system and all actors in that system.
|
|
641
|
+
* actor.stop();
|
|
642
|
+
* ```
|
|
643
|
+
*
|
|
644
|
+
* @param logic - The actor logic to create an actor from. For a state machine
|
|
645
|
+
* actor logic creator, see {@link createMachine}. Other actor logic creators
|
|
646
|
+
* include {@link fromCallback}, {@link fromEventObservable},
|
|
647
|
+
* {@link fromObservable}, {@link fromPromise}, and {@link fromTransition}.
|
|
648
|
+
* @param options - Actor options
|
|
649
|
+
*/
|
|
650
|
+
declare function createActor<TLogic extends AnyActorLogic>(logic: TLogic, ...[options]: ConditionalRequired<[options?: ActorOptions<TLogic> & { [K in RequiredActorOptionsKeys<TLogic>]: unknown; }], IsNotNever<RequiredActorOptionsKeys<TLogic>>>): Actor<TLogic>;
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/guards.d.ts
|
|
653
|
+
type GuardPredicate<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TGuard extends ParameterizedObject> = {
|
|
654
|
+
(args: GuardArgs<TContext, TExpressionEvent>, params: TParams): boolean;
|
|
655
|
+
_out_TGuard?: TGuard;
|
|
656
|
+
};
|
|
657
|
+
interface GuardArgs<TContext extends MachineContext, TExpressionEvent extends EventObject> {
|
|
658
|
+
context: TContext;
|
|
659
|
+
event: TExpressionEvent;
|
|
660
|
+
}
|
|
661
|
+
type Guard<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TGuard extends ParameterizedObject> = NoRequiredParams<TGuard> | WithDynamicParams<TContext, TExpressionEvent, TGuard> | GuardPredicate<TContext, TExpressionEvent, TParams, TGuard>;
|
|
662
|
+
type UnknownGuard = UnknownReferencedGuard | UnknownInlineGuard;
|
|
663
|
+
type UnknownReferencedGuard = Guard<MachineContext, EventObject, ParameterizedObject['params'], ParameterizedObject>;
|
|
664
|
+
type UnknownInlineGuard = Guard<MachineContext, EventObject, undefined, ParameterizedObject>;
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/types.d.ts
|
|
667
|
+
type GetParameterizedParams<T extends ParameterizedObject | undefined> = T extends any ? ('params' extends keyof T ? T['params'] : undefined) : never;
|
|
668
|
+
/**
|
|
669
|
+
* @remarks
|
|
670
|
+
* `T | unknown` reduces to `unknown` and that can be problematic when it comes
|
|
671
|
+
* to contextual typing. It especially is a problem when the union has a
|
|
672
|
+
* function member, like here:
|
|
673
|
+
*
|
|
674
|
+
* ```ts
|
|
675
|
+
* declare function test(
|
|
676
|
+
* cbOrVal: ((arg: number) => unknown) | unknown
|
|
677
|
+
* ): void;
|
|
678
|
+
* test((arg) => {}); // oops, implicit any
|
|
679
|
+
* ```
|
|
680
|
+
*
|
|
681
|
+
* This type can be used to avoid this problem. This union represents the same
|
|
682
|
+
* value space as `unknown`.
|
|
683
|
+
*/
|
|
684
|
+
type NonReducibleUnknown = {} | null | undefined;
|
|
685
|
+
type AnyFunction = (...args: any[]) => any;
|
|
686
|
+
type ReturnTypeOrValue<T> = T extends AnyFunction ? ReturnType<T> : T;
|
|
687
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
688
|
+
type IsNotNever<T> = [T] extends [never] ? false : true;
|
|
689
|
+
type Compute<A> = { [K in keyof A]: A[K]; } & unknown;
|
|
690
|
+
type Values<T> = T[keyof T];
|
|
691
|
+
type Equals<A1, A2> = (<A>() => A extends A2 ? true : false) extends (<A>() => A extends A1 ? true : false) ? true : false;
|
|
692
|
+
type DoNotInfer<T> = [T][T extends any ? 0 : any];
|
|
693
|
+
type LowInfer<T> = T & NonNullable<unknown>;
|
|
694
|
+
type MetaObject = Record<string, any>;
|
|
695
|
+
/** The full definition of an event, with a string `type`. */
|
|
696
|
+
type EventObject = {
|
|
697
|
+
/** The type of event that is sent. */
|
|
698
|
+
type: string;
|
|
699
|
+
};
|
|
700
|
+
interface AnyEventObject extends EventObject {
|
|
701
|
+
[key: string]: any;
|
|
702
|
+
}
|
|
703
|
+
interface ParameterizedObject {
|
|
704
|
+
type: string;
|
|
705
|
+
params?: NonReducibleUnknown;
|
|
706
|
+
}
|
|
707
|
+
interface UnifiedArg<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject> {
|
|
708
|
+
context: TContext;
|
|
709
|
+
event: TExpressionEvent;
|
|
710
|
+
self: ActorRef<MachineSnapshot<TContext, TEvent, Record<string, AnyActorRef | undefined> // TODO: this should be replaced with `TChildren`
|
|
711
|
+
, StateValue, string, unknown, TODO // TMeta
|
|
712
|
+
, TODO>, TEvent, AnyEventObject>;
|
|
713
|
+
system: AnyActorSystem;
|
|
714
|
+
}
|
|
715
|
+
type MachineContext = Record<string, any>;
|
|
716
|
+
interface ActionArgs<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject> extends UnifiedArg<TContext, TExpressionEvent, TEvent> {}
|
|
717
|
+
type InputFrom<T> = T extends StateMachine<infer _TContext, infer _TEvent, infer _TChildren, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer _TStateValue, infer _TTag, infer TInput, infer _TOutput, infer _TEmitted, infer _TMeta, infer _TStateSchema> ? TInput : T extends ActorLogic<infer _TSnapshot, infer _TEvent, infer TInput, infer _TSystem, infer _TEmitted> ? TInput : never;
|
|
718
|
+
type OutputFrom<T> = T extends ActorLogic<infer TSnapshot, infer _TEvent, infer _TInput, infer _TSystem, infer _TEmitted> ? (TSnapshot & {
|
|
719
|
+
status: 'done';
|
|
720
|
+
})['output'] : T extends ActorRef<infer TSnapshot, infer _TEvent, infer _TEmitted> ? (TSnapshot & {
|
|
721
|
+
status: 'done';
|
|
722
|
+
})['output'] : never;
|
|
723
|
+
type ActionFunction<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject> = {
|
|
724
|
+
(args: ActionArgs<TContext, TExpressionEvent, TEvent>, params: TParams): void;
|
|
725
|
+
_out_TEvent?: TEvent;
|
|
726
|
+
_out_TActor?: TActor;
|
|
727
|
+
_out_TAction?: TAction;
|
|
728
|
+
_out_TGuard?: TGuard;
|
|
729
|
+
_out_TDelay?: TDelay;
|
|
730
|
+
_out_TEmitted?: TEmitted;
|
|
731
|
+
};
|
|
732
|
+
type NoRequiredParams<T extends ParameterizedObject> = T extends any ? undefined extends T['params'] ? T['type'] : never : never;
|
|
733
|
+
type ConditionalRequired<T, Condition extends boolean> = Condition extends true ? Required<T> : T;
|
|
734
|
+
type WithDynamicParams<TContext extends MachineContext, TExpressionEvent extends EventObject, T extends ParameterizedObject> = T extends any ? ConditionalRequired<{
|
|
735
|
+
type: T['type'];
|
|
736
|
+
params?: T['params'] | (({ context, event }: {
|
|
737
|
+
context: TContext;
|
|
738
|
+
event: TExpressionEvent;
|
|
739
|
+
}) => T['params']);
|
|
740
|
+
}, undefined extends T['params'] ? false : true> : never;
|
|
741
|
+
type Action<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject> = NoRequiredParams<TAction> | WithDynamicParams<TContext, TExpressionEvent, TAction> | ActionFunction<TContext, TExpressionEvent, TEvent, TParams, TActor, TAction, TGuard, TDelay, TEmitted>;
|
|
742
|
+
type UnknownAction = Action<MachineContext, EventObject, EventObject, ParameterizedObject['params'] | undefined, ProvidedActor, ParameterizedObject, ParameterizedObject, string, EventObject>;
|
|
743
|
+
type Actions<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject> = SingleOrArray<Action<TContext, TExpressionEvent, TEvent, TParams, TActor, TAction, TGuard, TDelay, TEmitted>>;
|
|
744
|
+
interface StateValueMap {
|
|
745
|
+
[key: string]: StateValue | undefined;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* The string or object representing the state value relative to the parent
|
|
749
|
+
* state node.
|
|
750
|
+
*
|
|
751
|
+
* @remarks
|
|
752
|
+
* - For a child atomic state node, this is a string, e.g., `"pending"`.
|
|
753
|
+
* - For complex state nodes, this is an object, e.g., `{ success:
|
|
754
|
+
* "someChildState" }`.
|
|
755
|
+
*/
|
|
756
|
+
type StateValue = string | StateValueMap;
|
|
757
|
+
type TransitionTarget = SingleOrArray<string>;
|
|
758
|
+
interface TransitionConfig<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject = EventObject, TMeta extends MetaObject = MetaObject> {
|
|
759
|
+
guard?: Guard<TContext, TExpressionEvent, undefined, TGuard>;
|
|
760
|
+
actions?: Actions<TContext, TExpressionEvent, TEvent, undefined, TActor, TAction, TGuard, TDelay, TEmitted>;
|
|
761
|
+
reenter?: boolean;
|
|
762
|
+
target?: TransitionTarget | undefined;
|
|
763
|
+
meta?: TMeta;
|
|
764
|
+
description?: string;
|
|
765
|
+
}
|
|
766
|
+
interface InitialTransitionConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string> extends TransitionConfig<TContext, TEvent, TEvent, TActor, TAction, TGuard, TDelay, TODO // TEmitted
|
|
767
|
+
, TODO> {
|
|
768
|
+
target: string;
|
|
769
|
+
}
|
|
770
|
+
interface InvokeDefinition<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject, TMeta extends MetaObject> {
|
|
771
|
+
id: string;
|
|
772
|
+
systemId: string | undefined;
|
|
773
|
+
/** The source of the actor logic to be invoked */
|
|
774
|
+
src: AnyActorLogic | string;
|
|
775
|
+
input?: Mapper<TContext, TEvent, NonReducibleUnknown, TEvent> | NonReducibleUnknown;
|
|
776
|
+
/**
|
|
777
|
+
* The transition to take upon the invoked child machine reaching its final
|
|
778
|
+
* top-level state.
|
|
779
|
+
*/
|
|
780
|
+
onDone?: string | SingleOrArray<TransitionConfig<TContext, DoneActorEvent<unknown>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
781
|
+
/**
|
|
782
|
+
* The transition to take upon the invoked child machine sending an error
|
|
783
|
+
* event.
|
|
784
|
+
*/
|
|
785
|
+
onError?: string | SingleOrArray<TransitionConfig<TContext, ErrorActorEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
786
|
+
onSnapshot?: string | SingleOrArray<TransitionConfig<TContext, SnapshotEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
787
|
+
toJSON: () => Omit<InvokeDefinition<TContext, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>, 'onDone' | 'onError' | 'toJSON'>;
|
|
788
|
+
}
|
|
789
|
+
type Delay<TDelay extends string> = TDelay | number;
|
|
790
|
+
type DelayedTransitions<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string> = { [K in Delay<TDelay>]?: string | SingleOrArray<TransitionConfig<TContext, TEvent, TEvent, TActor, TAction, TGuard, TDelay, TODO // TEmitted
|
|
791
|
+
, TODO>>; };
|
|
792
|
+
type SingleOrArray<T> = readonly T[] | T;
|
|
793
|
+
type StateNodesConfig<TContext extends MachineContext, TEvent extends EventObject> = { [K in string]: StateNode<TContext, TEvent>; };
|
|
794
|
+
type StatesConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, TOutput, TEmitted extends EventObject, TMeta extends MetaObject> = { [K in string]: StateNodeConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TOutput, TEmitted, TMeta>; };
|
|
795
|
+
type StatesDefinition<TContext extends MachineContext, TEvent extends EventObject> = { [K in string]: StateNodeDefinition<TContext, TEvent>; };
|
|
796
|
+
type TransitionConfigTarget = string | undefined;
|
|
797
|
+
type TransitionConfigOrTarget<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject, TMeta extends MetaObject> = SingleOrArray<TransitionConfigTarget | TransitionConfig<TContext, TExpressionEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
798
|
+
type TransitionsConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject, TMeta extends MetaObject> = { [K in EventDescriptor<TEvent>]?: TransitionConfigOrTarget<TContext, ExtractEvent<TEvent, K>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>; };
|
|
799
|
+
type PartialEventDescriptor<TEventType extends string> = TEventType extends `${infer TLeading}.${infer TTail}` ? `${TLeading}.*` | `${TLeading}.${PartialEventDescriptor<TTail>}` : never;
|
|
800
|
+
type EventDescriptor<TEvent extends EventObject> = TEvent['type'] | PartialEventDescriptor<TEvent['type']> | '*';
|
|
801
|
+
type NormalizeDescriptor<TDescriptor extends string> = TDescriptor extends '*' ? string : TDescriptor extends `${infer TLeading}.*` ? `${TLeading}.${string}` : TDescriptor;
|
|
802
|
+
type IsLiteralString<T extends string> = string extends T ? false : true;
|
|
803
|
+
type DistributeActors<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject, TMeta extends MetaObject, TSpecificActor extends ProvidedActor> = TSpecificActor extends {
|
|
804
|
+
src: infer TSrc;
|
|
805
|
+
} ? Compute<{
|
|
806
|
+
systemId?: string;
|
|
807
|
+
/** The source of the machine to be invoked, or the machine itself. */
|
|
808
|
+
src: TSrc;
|
|
809
|
+
/**
|
|
810
|
+
* The unique identifier for the invoked machine. If not specified,
|
|
811
|
+
* this will be the machine's own `id`, or the URL (from `src`).
|
|
812
|
+
*/
|
|
813
|
+
id?: TSpecificActor['id'];
|
|
814
|
+
input?: Mapper<TContext, TEvent, InputFrom<TSpecificActor['logic']>, TEvent> | InputFrom<TSpecificActor['logic']>;
|
|
815
|
+
/**
|
|
816
|
+
* The transition to take upon the invoked child machine reaching
|
|
817
|
+
* its final top-level state.
|
|
818
|
+
*/
|
|
819
|
+
onDone?: string | SingleOrArray<TransitionConfigOrTarget<TContext, DoneActorEvent<OutputFrom<TSpecificActor['logic']>>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
820
|
+
/**
|
|
821
|
+
* The transition to take upon the invoked child machine sending an
|
|
822
|
+
* error event.
|
|
823
|
+
*/
|
|
824
|
+
onError?: string | SingleOrArray<TransitionConfigOrTarget<TContext, ErrorActorEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
825
|
+
onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent<SnapshotFrom<TSpecificActor['logic']>>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
826
|
+
} & { [K in RequiredActorOptions<TSpecificActor>]: unknown; }> | {
|
|
827
|
+
id?: never;
|
|
828
|
+
systemId?: string;
|
|
829
|
+
src: AnyActorLogic;
|
|
830
|
+
input?: Mapper<TContext, TEvent, NonReducibleUnknown, TEvent> | NonReducibleUnknown;
|
|
831
|
+
onDone?: string | SingleOrArray<TransitionConfigOrTarget<TContext, DoneActorEvent<unknown>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
832
|
+
onError?: string | SingleOrArray<TransitionConfigOrTarget<TContext, ErrorActorEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
833
|
+
onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
834
|
+
} : never;
|
|
835
|
+
type InvokeConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject, TMeta extends MetaObject> = IsLiteralString<TActor['src']> extends true ? DistributeActors<TContext, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta, TActor> : {
|
|
836
|
+
/**
|
|
837
|
+
* The unique identifier for the invoked machine. If not specified, this
|
|
838
|
+
* will be the machine's own `id`, or the URL (from `src`).
|
|
839
|
+
*/
|
|
840
|
+
id?: string;
|
|
841
|
+
systemId?: string;
|
|
842
|
+
/** The source of the machine to be invoked, or the machine itself. */
|
|
843
|
+
src: AnyActorLogic | string;
|
|
844
|
+
input?: Mapper<TContext, TEvent, NonReducibleUnknown, TEvent> | NonReducibleUnknown;
|
|
845
|
+
/**
|
|
846
|
+
* The transition to take upon the invoked child machine reaching its
|
|
847
|
+
* final top-level state.
|
|
848
|
+
*/
|
|
849
|
+
onDone?: string | SingleOrArray<TransitionConfigOrTarget<TContext, DoneActorEvent<any> // TODO: consider replacing with `unknown`
|
|
850
|
+
, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
851
|
+
/**
|
|
852
|
+
* The transition to take upon the invoked child machine sending an
|
|
853
|
+
* error event.
|
|
854
|
+
*/
|
|
855
|
+
onError?: string | SingleOrArray<TransitionConfigOrTarget<TContext, ErrorActorEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
856
|
+
onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
857
|
+
};
|
|
858
|
+
interface StateNodeConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, _TOutput, TEmitted extends EventObject, TMeta extends MetaObject> {
|
|
859
|
+
/** The initial state transition. */
|
|
860
|
+
initial?: InitialTransitionConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay> | string | undefined;
|
|
861
|
+
/**
|
|
862
|
+
* The type of this state node:
|
|
863
|
+
*
|
|
864
|
+
* - `'atomic'` - no child state nodes
|
|
865
|
+
* - `'compound'` - nested child state nodes (XOR)
|
|
866
|
+
* - `'parallel'` - orthogonal nested child state nodes (AND)
|
|
867
|
+
* - `'history'` - history state node
|
|
868
|
+
* - `'final'` - final state node
|
|
869
|
+
*/
|
|
870
|
+
type?: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';
|
|
871
|
+
/**
|
|
872
|
+
* Indicates whether the state node is a history state node, and what type of
|
|
873
|
+
* history: shallow, deep, true (shallow), false (none), undefined (none)
|
|
874
|
+
*/
|
|
875
|
+
history?: 'shallow' | 'deep' | boolean | undefined;
|
|
876
|
+
/**
|
|
877
|
+
* The mapping of state node keys to their state node configurations
|
|
878
|
+
* (recursive).
|
|
879
|
+
*/
|
|
880
|
+
states?: StatesConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, NonReducibleUnknown, TEmitted, TMeta> | undefined;
|
|
881
|
+
/**
|
|
882
|
+
* The services to invoke upon entering this state node. These services will
|
|
883
|
+
* be stopped upon exiting this state node.
|
|
884
|
+
*/
|
|
885
|
+
invoke?: SingleOrArray<InvokeConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>;
|
|
886
|
+
/** The mapping of event types to their potential transition(s). */
|
|
887
|
+
on?: TransitionsConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>;
|
|
888
|
+
/** The action(s) to be executed upon entering the state node. */
|
|
889
|
+
entry?: Actions<TContext, TEvent, TEvent, undefined, TActor, TAction, TGuard, TDelay, TEmitted>;
|
|
890
|
+
/** The action(s) to be executed upon exiting the state node. */
|
|
891
|
+
exit?: Actions<TContext, TEvent, TEvent, undefined, TActor, TAction, TGuard, TDelay, TEmitted>;
|
|
892
|
+
/**
|
|
893
|
+
* The potential transition(s) to be taken upon reaching a final child state
|
|
894
|
+
* node.
|
|
895
|
+
*
|
|
896
|
+
* This is equivalent to defining a `[done(id)]` transition on this state
|
|
897
|
+
* node's `on` property.
|
|
898
|
+
*/
|
|
899
|
+
onDone?: string | SingleOrArray<TransitionConfig<TContext, DoneStateEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>> | undefined;
|
|
900
|
+
/**
|
|
901
|
+
* The mapping (or array) of delays (in milliseconds) to their potential
|
|
902
|
+
* transition(s). The delayed transitions are taken after the specified delay
|
|
903
|
+
* in an interpreter.
|
|
904
|
+
*/
|
|
905
|
+
after?: DelayedTransitions<TContext, TEvent, TActor, TAction, TGuard, TDelay>;
|
|
906
|
+
/**
|
|
907
|
+
* An eventless transition that is always taken when this state node is
|
|
908
|
+
* active.
|
|
909
|
+
*/
|
|
910
|
+
always?: TransitionConfigOrTarget<TContext, TEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>;
|
|
911
|
+
parent?: StateNode<TContext, TEvent>;
|
|
912
|
+
/**
|
|
913
|
+
* The meta data associated with this state node, which will be returned in
|
|
914
|
+
* State instances.
|
|
915
|
+
*/
|
|
916
|
+
meta?: TMeta;
|
|
917
|
+
/**
|
|
918
|
+
* The output data sent with the "xstate.done.state._id_" event if this is a
|
|
919
|
+
* final state node.
|
|
920
|
+
*
|
|
921
|
+
* The output data will be evaluated with the current `context` and placed on
|
|
922
|
+
* the `.data` property of the event.
|
|
923
|
+
*/
|
|
924
|
+
output?: Mapper<TContext, TEvent, unknown, TEvent> | NonReducibleUnknown;
|
|
925
|
+
/**
|
|
926
|
+
* The unique ID of the state node, which can be referenced as a transition
|
|
927
|
+
* target via the `#id` syntax.
|
|
928
|
+
*/
|
|
929
|
+
id?: string | undefined;
|
|
930
|
+
/**
|
|
931
|
+
* The order this state node appears. Corresponds to the implicit document
|
|
932
|
+
* order.
|
|
933
|
+
*/
|
|
934
|
+
order?: number;
|
|
935
|
+
/**
|
|
936
|
+
* The tags for this state node, which are accumulated into the `state.tags`
|
|
937
|
+
* property.
|
|
938
|
+
*/
|
|
939
|
+
tags?: SingleOrArray<TTag>;
|
|
940
|
+
/** A text description of the state node */
|
|
941
|
+
description?: string;
|
|
942
|
+
/** A default target for a history state */
|
|
943
|
+
target?: string | undefined;
|
|
944
|
+
}
|
|
945
|
+
interface StateNodeDefinition<TContext extends MachineContext, TEvent extends EventObject> {
|
|
946
|
+
id: string;
|
|
947
|
+
version?: string | undefined;
|
|
948
|
+
key: string;
|
|
949
|
+
type: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';
|
|
950
|
+
initial: InitialTransitionDefinition<TContext, TEvent> | undefined;
|
|
951
|
+
history: boolean | 'shallow' | 'deep' | undefined;
|
|
952
|
+
states: StatesDefinition<TContext, TEvent>;
|
|
953
|
+
on: TransitionDefinitionMap<TContext, TEvent>;
|
|
954
|
+
transitions: Array<TransitionDefinition<TContext, TEvent>>;
|
|
955
|
+
entry: UnknownAction[];
|
|
956
|
+
exit: UnknownAction[];
|
|
957
|
+
meta: any;
|
|
958
|
+
order: number;
|
|
959
|
+
output?: StateNodeConfig<TContext, TEvent, ProvidedActor, ParameterizedObject, ParameterizedObject, string, string, unknown, EventObject // TEmitted
|
|
960
|
+
, any>['output'];
|
|
961
|
+
invoke: Array<InvokeDefinition<TContext, TEvent, TODO, TODO, TODO, TODO, TODO // TEmitted
|
|
962
|
+
, TODO>>;
|
|
963
|
+
description?: string;
|
|
964
|
+
tags: string[];
|
|
965
|
+
}
|
|
966
|
+
interface StateMachineDefinition<TContext extends MachineContext, TEvent extends EventObject> extends StateNodeDefinition<TContext, TEvent> {}
|
|
967
|
+
type AnyStateMachine = StateMachine<any // context
|
|
968
|
+
, any // event
|
|
969
|
+
, any // children
|
|
970
|
+
, any // actor
|
|
971
|
+
, any // action
|
|
972
|
+
, any // guard
|
|
973
|
+
, any // delay
|
|
974
|
+
, any // state value
|
|
975
|
+
, any // tag
|
|
976
|
+
, any // input
|
|
977
|
+
, any // output
|
|
978
|
+
, any // emitted
|
|
979
|
+
, any // TMeta
|
|
980
|
+
, any>;
|
|
981
|
+
type ActionFunctionMap<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject = ParameterizedObject, TGuard extends ParameterizedObject = ParameterizedObject, TDelay extends string = string, TEmitted extends EventObject = EventObject> = { [K in TAction['type']]?: ActionFunction<TContext, TEvent, TEvent, GetParameterizedParams<TAction extends {
|
|
982
|
+
type: K;
|
|
983
|
+
} ? TAction : never>, TActor, TAction, TGuard, TDelay, TEmitted>; };
|
|
984
|
+
type GuardMap<TContext extends MachineContext, TEvent extends EventObject, TGuard extends ParameterizedObject> = { [K in TGuard['type']]?: GuardPredicate<TContext, TEvent, GetParameterizedParams<TGuard extends {
|
|
985
|
+
type: K;
|
|
986
|
+
} ? TGuard : never>, TGuard>; };
|
|
987
|
+
type DelayFunctionMap<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject> = Record<string, DelayConfig<TContext, TEvent, TAction['params'], TEvent>>;
|
|
988
|
+
type DelayConfig<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject> = number | DelayExpr<TContext, TExpressionEvent, TParams, TEvent>;
|
|
989
|
+
/** @ignore */
|
|
990
|
+
interface MachineImplementationsSimplified<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor = ProvidedActor, TAction extends ParameterizedObject = ParameterizedObject, TGuard extends ParameterizedObject = ParameterizedObject> {
|
|
991
|
+
guards: GuardMap<TContext, TEvent, TGuard>;
|
|
992
|
+
actions: ActionFunctionMap<TContext, TEvent, TActor, TAction>;
|
|
993
|
+
actors: Record<string, AnyActorLogic | {
|
|
994
|
+
src: AnyActorLogic;
|
|
995
|
+
input: Mapper<TContext, TEvent, unknown, TEvent> | NonReducibleUnknown;
|
|
996
|
+
}>;
|
|
997
|
+
delays: DelayFunctionMap<TContext, TEvent, TAction>;
|
|
998
|
+
}
|
|
999
|
+
type MachineImplementationsActions<TTypes extends StateMachineTypes> = { [K in TTypes['actions']['type']]?: ActionFunction<TTypes['context'], TTypes['events'], TTypes['events'], GetConcreteByKey<TTypes['actions'], 'type', K>['params'], TTypes['actors'], TTypes['actions'], TTypes['guards'], TTypes['delays'], TTypes['emitted']>; };
|
|
1000
|
+
type MachineImplementationsActors<TTypes extends StateMachineTypes> = { [K in TTypes['actors']['src']]?: GetConcreteByKey<TTypes['actors'], 'src', K>['logic']; };
|
|
1001
|
+
type MachineImplementationsDelays<TTypes extends StateMachineTypes> = { [K in TTypes['delays']]?: DelayConfig<TTypes['context'], TTypes['events'], undefined, TTypes['events']>; };
|
|
1002
|
+
type MachineImplementationsGuards<TTypes extends StateMachineTypes> = { [K in TTypes['guards']['type']]?: Guard<TTypes['context'], TTypes['events'], GetConcreteByKey<TTypes['guards'], 'type', K>['params'], TTypes['guards']>; };
|
|
1003
|
+
type InternalMachineImplementations<TTypes extends StateMachineTypes> = {
|
|
1004
|
+
actions?: MachineImplementationsActions<TTypes>;
|
|
1005
|
+
actors?: MachineImplementationsActors<TTypes>;
|
|
1006
|
+
delays?: MachineImplementationsDelays<TTypes>;
|
|
1007
|
+
guards?: MachineImplementationsGuards<TTypes>;
|
|
1008
|
+
};
|
|
1009
|
+
type InitialContext<TContext extends MachineContext, TActor extends ProvidedActor, TInput, TEvent extends EventObject> = TContext | ContextFactory<TContext, TActor, TInput, TEvent>;
|
|
1010
|
+
type ContextFactory<TContext extends MachineContext, TActor extends ProvidedActor, TInput, TEvent extends EventObject = EventObject> = ({ spawn, input, self }: {
|
|
1011
|
+
spawn: Spawner<TActor>;
|
|
1012
|
+
input: TInput;
|
|
1013
|
+
self: ActorRef<MachineSnapshot<TContext, TEvent, Record<string, AnyActorRef | undefined> // TODO: this should be replaced with `TChildren`
|
|
1014
|
+
, StateValue, string, unknown, TODO // TMeta
|
|
1015
|
+
, TODO>, TEvent, AnyEventObject>;
|
|
1016
|
+
}) => TContext;
|
|
1017
|
+
type MachineConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor = ProvidedActor, TAction extends ParameterizedObject = ParameterizedObject, TGuard extends ParameterizedObject = ParameterizedObject, TDelay extends string = string, TTag extends string = string, TInput = any, TOutput = unknown, TEmitted extends EventObject = EventObject, TMeta extends MetaObject = MetaObject> = (Omit<StateNodeConfig<DoNotInfer<TContext>, DoNotInfer<TEvent>, DoNotInfer<TActor>, DoNotInfer<TAction>, DoNotInfer<TGuard>, DoNotInfer<TDelay>, DoNotInfer<TTag>, DoNotInfer<TOutput>, DoNotInfer<TEmitted>, DoNotInfer<TMeta>>, 'output'> & {
|
|
1018
|
+
/** The initial context (extended state) */
|
|
1019
|
+
/** The machine's own version. */
|
|
1020
|
+
version?: string;
|
|
1021
|
+
output?: Mapper<TContext, DoneStateEvent, TOutput, TEvent> | TOutput;
|
|
1022
|
+
}) & (MachineContext extends TContext ? {
|
|
1023
|
+
context?: InitialContext<LowInfer<TContext>, TActor, TInput, TEvent>;
|
|
1024
|
+
} : {
|
|
1025
|
+
context: InitialContext<LowInfer<TContext>, TActor, TInput, TEvent>;
|
|
1026
|
+
});
|
|
1027
|
+
interface ProvidedActor {
|
|
1028
|
+
src: string;
|
|
1029
|
+
logic: UnknownActorLogic;
|
|
1030
|
+
id?: string | undefined;
|
|
1031
|
+
}
|
|
1032
|
+
type HistoryValue<TContext extends MachineContext, TEvent extends EventObject> = Record<string, Array<StateNode<TContext, TEvent>>>;
|
|
1033
|
+
interface DoneActorEvent<TOutput = unknown, TId extends string = string> extends EventObject {
|
|
1034
|
+
type: `xstate.done.actor.${TId}`;
|
|
1035
|
+
output: TOutput;
|
|
1036
|
+
actorId: TId;
|
|
1037
|
+
}
|
|
1038
|
+
interface ErrorActorEvent<TErrorData = unknown, TId extends string = string> extends EventObject {
|
|
1039
|
+
type: `xstate.error.actor.${TId}`;
|
|
1040
|
+
error: TErrorData;
|
|
1041
|
+
actorId: TId;
|
|
1042
|
+
}
|
|
1043
|
+
interface SnapshotEvent<TSnapshot extends Snapshot<unknown> = Snapshot<unknown>> extends EventObject {
|
|
1044
|
+
type: `xstate.snapshot.${string}`;
|
|
1045
|
+
snapshot: TSnapshot;
|
|
1046
|
+
}
|
|
1047
|
+
interface DoneStateEvent<TOutput = unknown> extends EventObject {
|
|
1048
|
+
type: `xstate.done.state.${string}`;
|
|
1049
|
+
output: TOutput;
|
|
1050
|
+
}
|
|
1051
|
+
type DelayExpr<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject> = (args: ActionArgs<TContext, TExpressionEvent, TEvent>, params: TParams) => number;
|
|
1052
|
+
type Mapper<TContext extends MachineContext, TExpressionEvent extends EventObject, TResult, TEvent extends EventObject> = (args: {
|
|
1053
|
+
context: TContext;
|
|
1054
|
+
event: TExpressionEvent;
|
|
1055
|
+
self: ActorRef<MachineSnapshot<TContext, TEvent, Record<string, AnyActorRef> // TODO: this should be replaced with `TChildren`
|
|
1056
|
+
, StateValue, string, unknown, TODO // TMeta
|
|
1057
|
+
, TODO>, TEvent, AnyEventObject>;
|
|
1058
|
+
}) => TResult;
|
|
1059
|
+
interface TransitionDefinition<TContext extends MachineContext, TEvent extends EventObject> extends Omit<TransitionConfig<TContext, TEvent, TEvent, TODO, TODO, TODO, TODO, TODO // TEmitted
|
|
1060
|
+
, TODO>, 'target' | 'guard'> {
|
|
1061
|
+
target: ReadonlyArray<StateNode<TContext, TEvent>> | undefined;
|
|
1062
|
+
source: StateNode<TContext, TEvent>;
|
|
1063
|
+
actions: readonly UnknownAction[];
|
|
1064
|
+
reenter: boolean;
|
|
1065
|
+
guard?: UnknownGuard;
|
|
1066
|
+
eventType: EventDescriptor<TEvent>;
|
|
1067
|
+
toJSON: () => {
|
|
1068
|
+
target: string[] | undefined;
|
|
1069
|
+
source: string;
|
|
1070
|
+
actions: readonly UnknownAction[];
|
|
1071
|
+
guard?: UnknownGuard;
|
|
1072
|
+
eventType: EventDescriptor<TEvent>;
|
|
1073
|
+
meta?: Record<string, any>;
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
type AnyTransitionDefinition = TransitionDefinition<any, any>;
|
|
1077
|
+
interface InitialTransitionDefinition<TContext extends MachineContext, TEvent extends EventObject> extends TransitionDefinition<TContext, TEvent> {
|
|
1078
|
+
target: ReadonlyArray<StateNode<TContext, TEvent>>;
|
|
1079
|
+
guard?: never;
|
|
1080
|
+
}
|
|
1081
|
+
type TransitionDefinitionMap<TContext extends MachineContext, TEvent extends EventObject> = { [K in EventDescriptor<TEvent>]: Array<TransitionDefinition<TContext, ExtractEvent<TEvent, K>>>; };
|
|
1082
|
+
interface DelayedTransitionDefinition<TContext extends MachineContext, TEvent extends EventObject> extends TransitionDefinition<TContext, TEvent> {
|
|
1083
|
+
delay: number | string | DelayExpr<TContext, TEvent, undefined, TEvent>;
|
|
1084
|
+
}
|
|
1085
|
+
interface ActorOptions<TLogic extends AnyActorLogic> {
|
|
1086
|
+
/**
|
|
1087
|
+
* The clock that is responsible for setting and clearing timeouts, such as
|
|
1088
|
+
* delayed events and transitions.
|
|
1089
|
+
*
|
|
1090
|
+
* @remarks
|
|
1091
|
+
* You can create your own “clock”. The clock interface is an object with two
|
|
1092
|
+
* functions/methods:
|
|
1093
|
+
*
|
|
1094
|
+
* - `setTimeout` - same arguments as `window.setTimeout(fn, timeout)`
|
|
1095
|
+
* - `clearTimeout` - same arguments as `window.clearTimeout(id)`
|
|
1096
|
+
*
|
|
1097
|
+
* By default, the native `setTimeout` and `clearTimeout` functions are used.
|
|
1098
|
+
*
|
|
1099
|
+
* For testing, XState provides `SimulatedClock`.
|
|
1100
|
+
* @see {@link Clock}
|
|
1101
|
+
* @see {@link SimulatedClock}
|
|
1102
|
+
*/
|
|
1103
|
+
clock?: Clock;
|
|
1104
|
+
/**
|
|
1105
|
+
* Specifies the logger to be used for `log(...)` actions. Defaults to the
|
|
1106
|
+
* native `console.log(...)` method.
|
|
1107
|
+
*/
|
|
1108
|
+
logger?: (...args: any[]) => void;
|
|
1109
|
+
parent?: AnyActorRef;
|
|
1110
|
+
/** The custom `id` for referencing this service. */
|
|
1111
|
+
id?: string;
|
|
1112
|
+
/** @deprecated Use `inspect` instead. */
|
|
1113
|
+
devTools?: never;
|
|
1114
|
+
/** The system ID to register this actor under. */
|
|
1115
|
+
systemId?: string;
|
|
1116
|
+
/** The input data to pass to the actor. */
|
|
1117
|
+
input?: InputFrom<TLogic>;
|
|
1118
|
+
/**
|
|
1119
|
+
* Initializes actor logic from a specific persisted internal state.
|
|
1120
|
+
*
|
|
1121
|
+
* @remarks
|
|
1122
|
+
* If the state is compatible with the actor logic, when the actor is started
|
|
1123
|
+
* it will be at that persisted state. Actions from machine actors will not be
|
|
1124
|
+
* re-executed, because they are assumed to have been already executed.
|
|
1125
|
+
* However, invocations will be restarted, and spawned actors will be restored
|
|
1126
|
+
* recursively.
|
|
1127
|
+
*
|
|
1128
|
+
* Can be generated with {@link Actor.getPersistedSnapshot}.
|
|
1129
|
+
* @see https://stately.ai/docs/persistence
|
|
1130
|
+
*/
|
|
1131
|
+
snapshot?: Snapshot<unknown>;
|
|
1132
|
+
/** @deprecated Use `snapshot` instead. */
|
|
1133
|
+
state?: Snapshot<unknown>;
|
|
1134
|
+
/** The source actor logic. */
|
|
1135
|
+
src?: string | AnyActorLogic;
|
|
1136
|
+
/**
|
|
1137
|
+
* A callback function or observer object which can be used to inspect actor
|
|
1138
|
+
* system updates.
|
|
1139
|
+
*
|
|
1140
|
+
* @remarks
|
|
1141
|
+
* If a callback function is provided, it can accept an inspection event
|
|
1142
|
+
* argument. The types of inspection events that can be observed include:
|
|
1143
|
+
*
|
|
1144
|
+
* - `@xstate.actor` - An actor ref has been created in the system
|
|
1145
|
+
* - `@xstate.event` - An event was sent from a source actor ref to a target
|
|
1146
|
+
* actor ref in the system
|
|
1147
|
+
* - `@xstate.snapshot` - An actor ref emitted a snapshot due to a received
|
|
1148
|
+
* event
|
|
1149
|
+
*
|
|
1150
|
+
* @example
|
|
1151
|
+
*
|
|
1152
|
+
* ```ts
|
|
1153
|
+
* import { createMachine } from 'xstate';
|
|
1154
|
+
*
|
|
1155
|
+
* const machine = createMachine({
|
|
1156
|
+
* // ...
|
|
1157
|
+
* });
|
|
1158
|
+
*
|
|
1159
|
+
* const actor = createActor(machine, {
|
|
1160
|
+
* inspect: (inspectionEvent) => {
|
|
1161
|
+
* if (inspectionEvent.actorRef === actor) {
|
|
1162
|
+
* // This event is for the root actor
|
|
1163
|
+
* }
|
|
1164
|
+
*
|
|
1165
|
+
* if (inspectionEvent.type === '@xstate.actor') {
|
|
1166
|
+
* console.log(inspectionEvent.actorRef);
|
|
1167
|
+
* }
|
|
1168
|
+
*
|
|
1169
|
+
* if (inspectionEvent.type === '@xstate.event') {
|
|
1170
|
+
* console.log(inspectionEvent.sourceRef);
|
|
1171
|
+
* console.log(inspectionEvent.actorRef);
|
|
1172
|
+
* console.log(inspectionEvent.event);
|
|
1173
|
+
* }
|
|
1174
|
+
*
|
|
1175
|
+
* if (inspectionEvent.type === '@xstate.snapshot') {
|
|
1176
|
+
* console.log(inspectionEvent.actorRef);
|
|
1177
|
+
* console.log(inspectionEvent.event);
|
|
1178
|
+
* console.log(inspectionEvent.snapshot);
|
|
1179
|
+
* }
|
|
1180
|
+
* }
|
|
1181
|
+
* });
|
|
1182
|
+
* ```
|
|
1183
|
+
*
|
|
1184
|
+
* Alternately, an observer object (`{ next?, error?, complete? }`) can be
|
|
1185
|
+
* provided:
|
|
1186
|
+
*
|
|
1187
|
+
* @example
|
|
1188
|
+
*
|
|
1189
|
+
* ```ts
|
|
1190
|
+
* const actor = createActor(machine, {
|
|
1191
|
+
* inspect: {
|
|
1192
|
+
* next: (inspectionEvent) => {
|
|
1193
|
+
* if (inspectionEvent.actorRef === actor) {
|
|
1194
|
+
* // This event is for the root actor
|
|
1195
|
+
* }
|
|
1196
|
+
*
|
|
1197
|
+
* if (inspectionEvent.type === '@xstate.actor') {
|
|
1198
|
+
* console.log(inspectionEvent.actorRef);
|
|
1199
|
+
* }
|
|
1200
|
+
*
|
|
1201
|
+
* if (inspectionEvent.type === '@xstate.event') {
|
|
1202
|
+
* console.log(inspectionEvent.sourceRef);
|
|
1203
|
+
* console.log(inspectionEvent.actorRef);
|
|
1204
|
+
* console.log(inspectionEvent.event);
|
|
1205
|
+
* }
|
|
1206
|
+
*
|
|
1207
|
+
* if (inspectionEvent.type === '@xstate.snapshot') {
|
|
1208
|
+
* console.log(inspectionEvent.actorRef);
|
|
1209
|
+
* console.log(inspectionEvent.event);
|
|
1210
|
+
* console.log(inspectionEvent.snapshot);
|
|
1211
|
+
* }
|
|
1212
|
+
* }
|
|
1213
|
+
* }
|
|
1214
|
+
* });
|
|
1215
|
+
* ```
|
|
1216
|
+
*/
|
|
1217
|
+
inspect?: Observer<InspectionEvent> | ((inspectionEvent: InspectionEvent) => void);
|
|
1218
|
+
}
|
|
1219
|
+
type Observer<T> = {
|
|
1220
|
+
next?: (value: T) => void;
|
|
1221
|
+
error?: (err: unknown) => void;
|
|
1222
|
+
complete?: () => void;
|
|
1223
|
+
};
|
|
1224
|
+
interface Subscription {
|
|
1225
|
+
unsubscribe(): void;
|
|
1226
|
+
}
|
|
1227
|
+
interface InteropObservable<T> {
|
|
1228
|
+
[Symbol.observable]: () => InteropSubscribable<T>;
|
|
1229
|
+
}
|
|
1230
|
+
interface InteropSubscribable<T> {
|
|
1231
|
+
subscribe(observer: Observer<T>): Subscription;
|
|
1232
|
+
}
|
|
1233
|
+
interface Subscribable<T> extends InteropSubscribable<T> {
|
|
1234
|
+
subscribe(observer: Observer<T>): Subscription;
|
|
1235
|
+
subscribe(next: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
|
|
1236
|
+
}
|
|
1237
|
+
type EventDescriptorMatches<TEventType extends string, TNormalizedDescriptor> = TEventType extends TNormalizedDescriptor ? true : false;
|
|
1238
|
+
type ExtractEvent<TEvent extends EventObject, TDescriptor extends EventDescriptor<TEvent>> = string extends TEvent['type'] ? TEvent : NormalizeDescriptor<TDescriptor> extends (infer TNormalizedDescriptor) ? TEvent extends any ? true extends EventDescriptorMatches<TEvent['type'], TNormalizedDescriptor> ? TEvent : never : never : never;
|
|
1239
|
+
interface ActorRef<TSnapshot extends Snapshot<unknown>, TEvent extends EventObject, TEmitted extends EventObject = EventObject> extends Subscribable<TSnapshot>, InteropObservable<TSnapshot> {
|
|
1240
|
+
/** The unique identifier for this actor relative to its parent. */
|
|
1241
|
+
id: string;
|
|
1242
|
+
sessionId: string;
|
|
1243
|
+
send: (event: TEvent) => void;
|
|
1244
|
+
start: () => void;
|
|
1245
|
+
getSnapshot: () => TSnapshot;
|
|
1246
|
+
getPersistedSnapshot: () => Snapshot<unknown>;
|
|
1247
|
+
stop: () => void;
|
|
1248
|
+
toJSON?: () => any;
|
|
1249
|
+
_parent?: AnyActorRef;
|
|
1250
|
+
system: AnyActorSystem;
|
|
1251
|
+
src: string | AnyActorLogic;
|
|
1252
|
+
on: <TType extends TEmitted['type'] | '*'>(type: TType, handler: (emitted: TEmitted & (TType extends '*' ? unknown : {
|
|
1253
|
+
type: TType;
|
|
1254
|
+
})) => void) => Subscription;
|
|
1255
|
+
}
|
|
1256
|
+
type AnyActorRef = ActorRef<any, any // TODO: shouldn't this be AnyEventObject?
|
|
1257
|
+
, any>;
|
|
1258
|
+
type ActorRefLike = Pick<AnyActorRef, 'sessionId' | 'send' | 'getSnapshot'>;
|
|
1259
|
+
type ActorRefFrom<T> = ReturnTypeOrValue<T> extends (infer R) ? R extends StateMachine<infer TContext, infer TEvent, infer TChildren, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer TStateValue, infer TTag, infer _TInput, infer TOutput, infer TEmitted, infer TMeta, infer TStateSchema> ? ActorRef<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, TEvent, TEmitted> : R extends Promise<infer U> ? ActorRefFrom<PromiseActorLogic<U>> : R extends ActorLogic<infer TSnapshot, infer TEvent, infer _TInput, infer _TSystem, infer TEmitted> ? ActorRef<TSnapshot, TEvent, TEmitted> : never : never;
|
|
1260
|
+
type ActorRefFromLogic<T extends AnyActorLogic> = ActorRef<SnapshotFrom<T>, EventFromLogic<T>, EmittedFrom<T>>;
|
|
1261
|
+
interface ActorScope<TSnapshot extends Snapshot<unknown>, TEvent extends EventObject, TSystem extends AnyActorSystem = AnyActorSystem, TEmitted extends EventObject = EventObject> {
|
|
1262
|
+
self: ActorRef<TSnapshot, TEvent, TEmitted>;
|
|
1263
|
+
id: string;
|
|
1264
|
+
sessionId: string;
|
|
1265
|
+
logger: (...args: any[]) => void;
|
|
1266
|
+
defer: (fn: () => void) => void;
|
|
1267
|
+
emit: (event: TEmitted) => void;
|
|
1268
|
+
system: TSystem;
|
|
1269
|
+
stopChild: (child: AnyActorRef) => void;
|
|
1270
|
+
actionExecutor: ActionExecutor;
|
|
1271
|
+
}
|
|
1272
|
+
type AnyActorScope = ActorScope<any // TSnapshot
|
|
1273
|
+
, any // TEvent
|
|
1274
|
+
, AnyActorSystem, any>;
|
|
1275
|
+
type SnapshotStatus = 'active' | 'done' | 'error' | 'stopped';
|
|
1276
|
+
type Snapshot<TOutput> = {
|
|
1277
|
+
status: 'active';
|
|
1278
|
+
output: undefined;
|
|
1279
|
+
error: undefined;
|
|
1280
|
+
} | {
|
|
1281
|
+
status: 'done';
|
|
1282
|
+
output: TOutput;
|
|
1283
|
+
error: undefined;
|
|
1284
|
+
} | {
|
|
1285
|
+
status: 'error';
|
|
1286
|
+
output: undefined;
|
|
1287
|
+
error: unknown;
|
|
1288
|
+
} | {
|
|
1289
|
+
status: 'stopped';
|
|
1290
|
+
output: undefined;
|
|
1291
|
+
error: undefined;
|
|
1292
|
+
};
|
|
1293
|
+
/**
|
|
1294
|
+
* Represents logic which can be used by an actor.
|
|
1295
|
+
*
|
|
1296
|
+
* @template TSnapshot - The type of the snapshot.
|
|
1297
|
+
* @template TEvent - The type of the event object.
|
|
1298
|
+
* @template TInput - The type of the input.
|
|
1299
|
+
* @template TSystem - The type of the actor system.
|
|
1300
|
+
*/
|
|
1301
|
+
interface ActorLogic<in out TSnapshot extends Snapshot<unknown> // it's invariant because it's also part of `ActorScope["self"]["getSnapshot"]`
|
|
1302
|
+
, in out TEvent extends EventObject // it's invariant because it's also part of `ActorScope["self"]["send"]`
|
|
1303
|
+
, in TInput = NonReducibleUnknown, TSystem extends AnyActorSystem = AnyActorSystem, in out TEmitted extends EventObject = EventObject> {
|
|
1304
|
+
/** The initial setup/configuration used to create the actor logic. */
|
|
1305
|
+
config?: unknown;
|
|
1306
|
+
/**
|
|
1307
|
+
* Transition function that processes the current state and an incoming event
|
|
1308
|
+
* to produce a new state.
|
|
1309
|
+
*
|
|
1310
|
+
* @param snapshot - The current state.
|
|
1311
|
+
* @param event - The incoming event.
|
|
1312
|
+
* @param actorScope - The actor scope.
|
|
1313
|
+
* @returns The new state.
|
|
1314
|
+
*/
|
|
1315
|
+
transition: (snapshot: TSnapshot, event: TEvent, actorScope: ActorScope<TSnapshot, TEvent, TSystem, TEmitted>) => TSnapshot;
|
|
1316
|
+
/**
|
|
1317
|
+
* Called to provide the initial state of the actor.
|
|
1318
|
+
*
|
|
1319
|
+
* @param actorScope - The actor scope.
|
|
1320
|
+
* @param input - The input for the initial state.
|
|
1321
|
+
* @returns The initial state.
|
|
1322
|
+
*/
|
|
1323
|
+
getInitialSnapshot: (actorScope: ActorScope<TSnapshot, TEvent, TSystem, TEmitted>, input: TInput) => TSnapshot;
|
|
1324
|
+
/**
|
|
1325
|
+
* Called when Actor is created to restore the internal state of the actor
|
|
1326
|
+
* given a persisted state. The persisted state can be created by
|
|
1327
|
+
* `getPersistedSnapshot`.
|
|
1328
|
+
*
|
|
1329
|
+
* @param persistedState - The persisted state to restore from.
|
|
1330
|
+
* @param actorScope - The actor scope.
|
|
1331
|
+
* @returns The restored state.
|
|
1332
|
+
*/
|
|
1333
|
+
restoreSnapshot?: (persistedState: Snapshot<unknown>, actorScope: ActorScope<TSnapshot, TEvent, AnyActorSystem, TEmitted>) => TSnapshot;
|
|
1334
|
+
/**
|
|
1335
|
+
* Called when the actor is started.
|
|
1336
|
+
*
|
|
1337
|
+
* @param snapshot - The starting state.
|
|
1338
|
+
* @param actorScope - The actor scope.
|
|
1339
|
+
*/
|
|
1340
|
+
start?: (snapshot: TSnapshot, actorScope: ActorScope<TSnapshot, TEvent, AnyActorSystem, TEmitted>) => void;
|
|
1341
|
+
/**
|
|
1342
|
+
* Obtains the internal state of the actor in a representation which can be be
|
|
1343
|
+
* persisted. The persisted state can be restored by `restoreSnapshot`.
|
|
1344
|
+
*
|
|
1345
|
+
* @param snapshot - The current state.
|
|
1346
|
+
* @returns The a representation of the internal state to be persisted.
|
|
1347
|
+
*/
|
|
1348
|
+
getPersistedSnapshot: (snapshot: TSnapshot, options?: unknown) => Snapshot<unknown>;
|
|
1349
|
+
}
|
|
1350
|
+
type AnyActorLogic = ActorLogic<any // snapshot
|
|
1351
|
+
, any // event
|
|
1352
|
+
, any // input
|
|
1353
|
+
, any // system
|
|
1354
|
+
, any>;
|
|
1355
|
+
type UnknownActorLogic = ActorLogic<any // snapshot
|
|
1356
|
+
, any // event
|
|
1357
|
+
, any // input
|
|
1358
|
+
, AnyActorSystem, any>;
|
|
1359
|
+
type SnapshotFrom<T> = ReturnTypeOrValue<T> extends (infer R) ? R extends ActorRef<infer TSnapshot, infer _, infer __> ? TSnapshot : R extends Actor<infer TLogic> ? SnapshotFrom<TLogic> : R extends ActorLogic<infer _TSnapshot, infer _TEvent, infer _TInput, infer _TEmitted, infer _TSystem> ? ReturnType<R['transition']> : R extends ActorScope<infer TSnapshot, infer _TEvent, infer _TEmitted, infer _TSystem> ? TSnapshot : never : never;
|
|
1360
|
+
type EventFromLogic<TLogic extends AnyActorLogic> = TLogic extends ActorLogic<infer _TSnapshot, infer TEvent, infer _TInput, infer _TEmitted, infer _TSystem> ? TEvent : never;
|
|
1361
|
+
type EmittedFrom<TLogic extends AnyActorLogic> = TLogic extends ActorLogic<infer _TSnapshot, infer _TEvent, infer _TInput, infer _TSystem, infer TEmitted> ? TEmitted : never;
|
|
1362
|
+
type TODO = any;
|
|
1363
|
+
interface ActorSystemInfo {
|
|
1364
|
+
actors: Record<string, AnyActorRef>;
|
|
1365
|
+
}
|
|
1366
|
+
type RequiredActorOptions<TActor extends ProvidedActor> = (undefined extends TActor['id'] ? never : 'id') | (undefined extends InputFrom<TActor['logic']> ? never : 'input');
|
|
1367
|
+
type RequiredLogicInput<TLogic extends AnyActorLogic> = undefined extends InputFrom<TLogic> ? never : 'input';
|
|
1368
|
+
type StateSchema = {
|
|
1369
|
+
id?: string;
|
|
1370
|
+
states?: Record<string, StateSchema>;
|
|
1371
|
+
type?: unknown;
|
|
1372
|
+
invoke?: unknown;
|
|
1373
|
+
on?: unknown;
|
|
1374
|
+
entry?: unknown;
|
|
1375
|
+
exit?: unknown;
|
|
1376
|
+
onDone?: unknown;
|
|
1377
|
+
after?: unknown;
|
|
1378
|
+
always?: unknown;
|
|
1379
|
+
meta?: unknown;
|
|
1380
|
+
output?: unknown;
|
|
1381
|
+
tags?: unknown;
|
|
1382
|
+
description?: unknown;
|
|
1383
|
+
};
|
|
1384
|
+
type StateId<TSchema extends StateSchema, TKey extends string = '(machine)', TParentKey extends string | null = null> = (TSchema extends {
|
|
1385
|
+
id: string;
|
|
1386
|
+
} ? TSchema['id'] : TParentKey extends null ? TKey : `${TParentKey}.${TKey}`) | (TSchema['states'] extends Record<string, any> ? Values<{ [K in keyof TSchema['states'] & string]: StateId<TSchema['states'][K], K, TParentKey extends string ? `${TParentKey}.${TKey}` : TSchema['id'] extends string ? TSchema['id'] : TKey>; }> : never);
|
|
1387
|
+
interface StateMachineTypes {
|
|
1388
|
+
context: MachineContext;
|
|
1389
|
+
events: EventObject;
|
|
1390
|
+
actors: ProvidedActor;
|
|
1391
|
+
actions: ParameterizedObject;
|
|
1392
|
+
guards: ParameterizedObject;
|
|
1393
|
+
delays: string;
|
|
1394
|
+
tags: string;
|
|
1395
|
+
emitted: EventObject;
|
|
1396
|
+
}
|
|
1397
|
+
/** @deprecated */
|
|
1398
|
+
interface ResolvedStateMachineTypes<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, TEmitted extends EventObject = EventObject> {
|
|
1399
|
+
context: TContext;
|
|
1400
|
+
events: TEvent;
|
|
1401
|
+
actors: TActor;
|
|
1402
|
+
actions: TAction;
|
|
1403
|
+
guards: TGuard;
|
|
1404
|
+
delays: TDelay;
|
|
1405
|
+
tags: TTag;
|
|
1406
|
+
emitted: TEmitted;
|
|
1407
|
+
}
|
|
1408
|
+
type GetConcreteByKey<T, TKey extends keyof T, TValue extends T[TKey]> = T & Record<TKey, TValue>;
|
|
1409
|
+
interface ExecutableActionObject {
|
|
1410
|
+
type: string;
|
|
1411
|
+
info: ActionArgs<MachineContext, EventObject, EventObject>;
|
|
1412
|
+
params: NonReducibleUnknown;
|
|
1413
|
+
exec: ((info: ActionArgs<any, any, any>, params: unknown) => void) | undefined;
|
|
1414
|
+
}
|
|
1415
|
+
type ActionExecutor = (actionToExecute: ExecutableActionObject) => void;
|
|
1416
|
+
//#endregion
|
|
1417
|
+
//#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dist/declarations/src/spawn.d.ts
|
|
1418
|
+
type SpawnOptions<TActor extends ProvidedActor, TSrc extends TActor['src']> = TActor extends {
|
|
1419
|
+
src: TSrc;
|
|
1420
|
+
} ? ConditionalRequired<[options?: {
|
|
1421
|
+
id?: TActor['id'];
|
|
1422
|
+
systemId?: string;
|
|
1423
|
+
input?: InputFrom<TActor['logic']>;
|
|
1424
|
+
syncSnapshot?: boolean;
|
|
1425
|
+
} & { [K in RequiredActorOptions<TActor>]: unknown; }], IsNotNever<RequiredActorOptions<TActor>>> : never;
|
|
1426
|
+
type Spawner<TActor extends ProvidedActor> = IsLiteralString<TActor['src']> extends true ? {
|
|
1427
|
+
<TSrc extends TActor['src']>(logic: TSrc, ...[options]: SpawnOptions<TActor, TSrc>): ActorRefFromLogic<GetConcreteByKey<TActor, 'src', TSrc>['logic']>;
|
|
1428
|
+
<TLogic extends AnyActorLogic>(src: TLogic, ...[options]: ConditionalRequired<[options?: {
|
|
1429
|
+
id?: never;
|
|
1430
|
+
systemId?: string;
|
|
1431
|
+
input?: InputFrom<TLogic>;
|
|
1432
|
+
syncSnapshot?: boolean;
|
|
1433
|
+
} & { [K in RequiredLogicInput<TLogic>]: unknown; }], IsNotNever<RequiredLogicInput<TLogic>>>): ActorRefFromLogic<TLogic>;
|
|
1434
|
+
} : <TLogic extends AnyActorLogic | string>(src: TLogic, ...[options]: ConditionalRequired<[options?: {
|
|
1435
|
+
id?: string;
|
|
1436
|
+
systemId?: string;
|
|
1437
|
+
input?: TLogic extends string ? unknown : InputFrom<TLogic>;
|
|
1438
|
+
syncSnapshot?: boolean;
|
|
1439
|
+
} & (TLogic extends AnyActorLogic ? { [K in RequiredLogicInput<TLogic>]: unknown; } : {})], IsNotNever<TLogic extends AnyActorLogic ? RequiredLogicInput<TLogic> : never>>) => TLogic extends AnyActorLogic ? ActorRefFromLogic<TLogic> : AnyActorRef;
|
|
1440
|
+
//#endregion
|
|
1441
|
+
export { StateMachine as A, StateValue as C, PromiseActorLogic as D, createActor as E, fromPromise as O, Snapshot as S, Actor as T, MachineContext as _, ActorRefFromLogic as a, RequiredActorOptions as b, AnyEventObject as c, DoneActorEvent as d, ErrorActorEvent as f, IsNotNever as g, InputFrom as h, ActorRefFrom as i, AnyActorSystem as j, MachineSnapshot as k, AnyStateMachine as l, GetConcreteByKey as m, ActorLogic as n, AnyActorLogic as o, EventObject as p, ActorRef as r, AnyActorRef as s, ActionFunction as t, ConditionalRequired as u, MetaObject as v, Values as w, RequiredLogicInput as x, NonReducibleUnknown as y };
|