@everfur/sdk 0.1.1 → 0.4.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/CHANGELOG.md +703 -4
- package/README.md +63 -23
- package/consent/package.json +8 -0
- package/dist/Chat-BZZ-Py5l.d.ts +128 -0
- package/dist/Chat-Dq4fffIO.d.cts +128 -0
- package/dist/DepthViews-BG3E25MD.d.ts +16 -0
- package/dist/DepthViews-B_hIypI6.d.cts +19 -0
- package/dist/DepthViews-CL75jyRA.d.cts +16 -0
- package/dist/DepthViews-CkYri51q.d.ts +19 -0
- package/dist/ErrorPolicyPort-CNf4uQZP.d.cts +22 -0
- package/dist/ErrorPolicyPort-CwbfmxzJ.d.ts +22 -0
- package/dist/{EverfurResult-D92-uL82.d.cts → EverfurResult-DN9pL2Ab.d.cts} +11 -10
- package/dist/{EverfurResult-D92-uL82.d.ts → EverfurResult-DN9pL2Ab.d.ts} +11 -10
- package/dist/{PhotoController-BItt5M7u.d.cts → PhotoController-3l7MT9jA.d.cts} +1 -1
- package/dist/{PhotoController-D8zMTdcW.d.ts → PhotoController-vzY5bfY_.d.ts} +1 -1
- package/dist/animations/index.cjs +1 -1997
- package/dist/animations/index.d.cts +35 -35
- package/dist/animations/index.d.ts +35 -35
- package/dist/animations/index.js +1 -1972
- package/dist/attachments-BorG422I.d.cts +146 -0
- package/dist/attachments-BrUWQYNK.d.ts +257 -0
- package/dist/attachments-D_SECjr1.d.cts +257 -0
- package/dist/attachments-DpldrvIW.d.ts +146 -0
- package/dist/bookingCopy-CqtDYvCR.d.ts +732 -0
- package/dist/bookingCopy-SREvkG19.d.cts +732 -0
- package/dist/branding-CsRdeNwK.d.cts +566 -0
- package/dist/branding-CsRdeNwK.d.ts +566 -0
- package/dist/callCopy-DoQKG3-L.d.cts +40 -0
- package/dist/callCopy-DoQKG3-L.d.ts +40 -0
- package/dist/casesRepository-DwtZVsbj.d.cts +51 -0
- package/dist/casesRepository-v6QczS9N.d.ts +51 -0
- package/dist/chat/index.cjs +1 -1170
- package/dist/chat/index.d.cts +32 -53
- package/dist/chat/index.d.ts +32 -53
- package/dist/chat/index.js +1 -1167
- package/dist/client/index.cjs +9 -2315
- package/dist/client/index.d.cts +80 -16
- package/dist/client/index.d.ts +80 -16
- package/dist/client/index.js +9 -2215
- package/dist/{config-CiJ0PVBB.d.ts → config--Wu1Umhd.d.cts} +64 -26
- package/dist/{config-BSjBdxrZ.d.cts → config-C7eb_IMD.d.ts} +64 -26
- package/dist/consent/index.cjs +1 -0
- package/dist/consent/index.d.cts +33 -0
- package/dist/consent/index.d.ts +33 -0
- package/dist/consent/index.js +1 -0
- package/dist/context-CL3lyuy1.d.cts +159 -0
- package/dist/context-CahAEha8.d.ts +159 -0
- package/dist/copy-DdVFDL01.d.ts +198 -0
- package/dist/copy-UeUJVk8X.d.cts +198 -0
- package/dist/core/index.cjs +13 -3178
- package/dist/core/index.d.cts +164 -29
- package/dist/core/index.d.ts +164 -29
- package/dist/core/index.js +13 -3166
- package/dist/depth-D5HwcvKC.d.cts +533 -0
- package/dist/depth-DvPwPuT_.d.ts +533 -0
- package/dist/entitlementRepository-B7egEdW6.d.ts +43 -0
- package/dist/entitlementRepository-BpJ7tiwl.d.cts +43 -0
- package/dist/{identity-Brl-lDd6.d.cts → identity-C2-08BZW.d.cts} +20 -7
- package/dist/{identity-DK9zORrG.d.ts → identity-CEi9GRFZ.d.ts} +20 -7
- package/dist/{ids-CJ1S6adf.d.cts → ids-B2GAAifq.d.cts} +1 -1
- package/dist/{ids-CJ1S6adf.d.ts → ids-B2GAAifq.d.ts} +1 -1
- package/dist/index.cjs +12 -4494
- package/dist/index.d.cts +30 -121
- package/dist/index.d.ts +30 -121
- package/dist/index.js +12 -4470
- package/dist/models-B-Uh2LTf.d.ts +214 -0
- package/dist/models-D2EUxPZY.d.cts +214 -0
- package/dist/notifications/index.cjs +2 -0
- package/dist/notifications/index.d.cts +17 -0
- package/dist/notifications/index.d.ts +17 -0
- package/dist/notifications/index.js +2 -0
- package/dist/optionalModule-DbJmsq5f.d.cts +21 -0
- package/dist/optionalModule-DbJmsq5f.d.ts +21 -0
- package/dist/pets-DJv2sj2H.d.ts +92 -0
- package/dist/pets-JVCXgRgR.d.cts +92 -0
- package/dist/petsRepository-B_gKbAzJ.d.cts +142 -0
- package/dist/petsRepository-Bk6GDwLs.d.ts +142 -0
- package/dist/photo/index.cjs +1 -2189
- package/dist/photo/index.d.cts +6 -6
- package/dist/photo/index.d.ts +6 -6
- package/dist/photo/index.js +1 -2186
- package/dist/ports-BN6RHF9W.d.cts +48 -0
- package/dist/ports-BN6RHF9W.d.ts +48 -0
- package/dist/ports-BY2ph0_y.d.cts +376 -0
- package/dist/ports-D7YW8qz9.d.ts +376 -0
- package/dist/profile-CSs1wlXT.d.cts +93 -0
- package/dist/profile-CSs1wlXT.d.ts +93 -0
- package/dist/records/depth/index.cjs +2 -0
- package/dist/records/depth/index.d.cts +13 -0
- package/dist/records/depth/index.d.ts +13 -0
- package/dist/records/depth/index.js +2 -0
- package/dist/records/index.cjs +3 -2839
- package/dist/records/index.d.cts +137 -203
- package/dist/records/index.d.ts +137 -203
- package/dist/records/index.js +3 -2833
- package/dist/requestFunnel-BjDpqqvm.d.cts +110 -0
- package/dist/requestFunnel-DFMGcluw.d.ts +110 -0
- package/dist/{resolve-Dq_4_agU.d.ts → resolve-D4Ywz5OS.d.cts} +10 -4
- package/dist/{resolve-Dq_4_agU.d.cts → resolve-D4Ywz5OS.d.ts} +10 -4
- package/dist/{runtime-Bvr8yqXm.d.cts → runtimeTypes-gZEJu-da.d.cts} +104 -132
- package/dist/{runtime-BIYzf9cK.d.ts → runtimeTypes-w5KqBMcs.d.ts} +104 -132
- package/dist/server/events/index.cjs +2 -0
- package/dist/server/events/index.d.cts +550 -0
- package/dist/server/events/index.d.ts +550 -0
- package/dist/server/events/index.js +2 -0
- package/dist/server/index.cjs +2 -533
- package/dist/server/index.d.cts +73 -18
- package/dist/server/index.d.ts +73 -18
- package/dist/server/index.js +2 -530
- package/dist/species-BXAIMh7I.d.cts +9 -0
- package/dist/species-BXAIMh7I.d.ts +9 -0
- package/dist/televet/booking/index.cjs +1 -0
- package/dist/televet/booking/index.d.cts +294 -0
- package/dist/televet/booking/index.d.ts +294 -0
- package/dist/televet/booking/index.js +1 -0
- package/dist/televet/call/index.cjs +1 -0
- package/dist/televet/call/index.d.cts +141 -0
- package/dist/televet/call/index.d.ts +141 -0
- package/dist/televet/call/index.js +1 -0
- package/dist/televet/index.cjs +1 -0
- package/dist/televet/index.d.cts +142 -0
- package/dist/televet/index.d.ts +142 -0
- package/dist/televet/index.js +1 -0
- package/dist/testing/index.cjs +5 -823
- package/dist/testing/index.d.cts +18 -4
- package/dist/testing/index.d.ts +18 -4
- package/dist/testing/index.js +5 -820
- package/dist/testing/rn/index.cjs +1 -449
- package/dist/testing/rn/index.d.cts +18 -29
- package/dist/testing/rn/index.d.ts +18 -29
- package/dist/testing/rn/index.js +1 -444
- package/dist/testing/web/index.cjs +1 -0
- package/dist/testing/web/index.d.cts +132 -0
- package/dist/testing/web/index.d.ts +132 -0
- package/dist/testing/web/index.js +1 -0
- package/dist/timelineRows-C15jxFFH.d.ts +19 -0
- package/dist/timelineRows-odO8g9r2.d.cts +19 -0
- package/dist/typeStyle-CKqVYD6L.d.cts +111 -0
- package/dist/typeStyle-DmoyacDG.d.ts +111 -0
- package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
- package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
- package/dist/useRecordsDepth-C6rjEaLn.d.cts +237 -0
- package/dist/useRecordsDepth-crhBllQK.d.ts +237 -0
- package/dist/useVetVisit-Bc84hWUU.d.cts +187 -0
- package/dist/useVetVisit-CjmMa896.d.ts +187 -0
- package/dist/video/index.cjs +1 -1941
- package/dist/video/index.d.cts +4 -4
- package/dist/video/index.d.ts +4 -4
- package/dist/video/index.js +1 -1938
- package/dist/view-Bxwxp4xD.d.ts +310 -0
- package/dist/view-DyitEO0m.d.cts +310 -0
- package/dist/visitIntent-D7_yVp1I.d.cts +8 -0
- package/dist/visitIntent-D7_yVp1I.d.ts +8 -0
- package/dist/web/consent/index.cjs +1 -0
- package/dist/web/consent/index.d.cts +34 -0
- package/dist/web/consent/index.d.ts +34 -0
- package/dist/web/consent/index.js +1 -0
- package/dist/web/index.cjs +14 -0
- package/dist/web/index.d.cts +218 -0
- package/dist/web/index.d.ts +218 -0
- package/dist/web/index.js +14 -0
- package/dist/web/notifications/index.cjs +2 -0
- package/dist/web/notifications/index.d.cts +213 -0
- package/dist/web/notifications/index.d.ts +213 -0
- package/dist/web/notifications/index.js +2 -0
- package/dist/web/records/depth/index.cjs +2 -0
- package/dist/web/records/depth/index.d.cts +12 -0
- package/dist/web/records/depth/index.d.ts +12 -0
- package/dist/web/records/depth/index.js +2 -0
- package/dist/web/records/index.cjs +4 -0
- package/dist/web/records/index.d.cts +285 -0
- package/dist/web/records/index.d.ts +285 -0
- package/dist/web/records/index.js +4 -0
- package/dist/web/televet/booking/index.cjs +1 -0
- package/dist/web/televet/booking/index.d.cts +349 -0
- package/dist/web/televet/booking/index.d.ts +349 -0
- package/dist/web/televet/booking/index.js +1 -0
- package/dist/web/televet/call/index.cjs +1 -0
- package/dist/web/televet/call/index.d.cts +142 -0
- package/dist/web/televet/call/index.d.ts +142 -0
- package/dist/web/televet/call/index.js +1 -0
- package/dist/web/televet/index.cjs +1 -0
- package/dist/web/televet/index.d.cts +136 -0
- package/dist/web/televet/index.d.ts +136 -0
- package/dist/web/televet/index.js +1 -0
- package/notifications/package.json +8 -0
- package/package.json +266 -10
- package/records/depth/package.json +8 -0
- package/server/events/device-blocked.cjs +15 -0
- package/server/events/package.json +9 -0
- package/televet/booking/package.json +8 -0
- package/televet/call/package.json +8 -0
- package/televet/package.json +8 -0
- package/testing/web/native-blocked.cjs +12 -0
- package/testing/web/package.json +8 -0
- package/web/consent/native-blocked.cjs +12 -0
- package/web/consent/package.json +8 -0
- package/web/native-blocked.cjs +12 -0
- package/web/notifications/native-blocked.cjs +12 -0
- package/web/notifications/package.json +8 -0
- package/web/package.json +8 -0
- package/web/records/depth/native-blocked.cjs +12 -0
- package/web/records/depth/package.json +8 -0
- package/web/records/native-blocked.cjs +12 -0
- package/web/records/package.json +8 -0
- package/web/televet/booking/native-blocked.cjs +12 -0
- package/web/televet/booking/package.json +8 -0
- package/web/televet/call/native-blocked.cjs +12 -0
- package/web/televet/call/package.json +8 -0
- package/web/televet/native-blocked.cjs +12 -0
- package/web/televet/package.json +8 -0
- package/dist/ChatController-CKdBvPj2.d.ts +0 -146
- package/dist/ChatController-CpUMvvZf.d.cts +0 -146
- package/dist/FilePort-BabWrv7I.d.cts +0 -22
- package/dist/FilePort-BabWrv7I.d.ts +0 -22
- package/dist/petsRepository-BEGb97M9.d.cts +0 -326
- package/dist/petsRepository-Bu18r2kK.d.ts +0 -326
- package/dist/requestFunnel-DuUH-kAe.d.cts +0 -28
- package/dist/requestFunnel-dio5OmR9.d.ts +0 -28
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createContext,useMemo,useEffect,useContext,useState,useRef,useCallback}from'react';import {AppState}from'react-native';var Ge=Object.defineProperty;var n=(e,t)=>Ge(e,"name",{value:t,configurable:true});function T(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}n(T,"ok");function u(e){return Object.freeze({ok:false,error:e})}n(u,"err");var j=class j extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,j.prototype);}};n(j,"EverfurConfigError");var P=j;var V=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(V.map(e=>e.wireCode));var We=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),ae=Object.freeze(V.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:We[e.wireCode]}))),$e=new Map(ae.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Qe=Object.freeze(["http_envelope",...[...new Set(ae.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function z(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let o of [t??"http_envelope",...Qe]){let i=$e.get(o+r);if(i)return i}}n(z,"contractErrorFor");function Xe(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Xe,"contractDocUrl");function se(e){return null}n(se,"publishedDocUrl");var Je=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function le(e){return Je[e]}n(le,"categoryFor");function ue(e){let t=z(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),o=r.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(o){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}n(ue,"fromWire");var Ze=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function B(e){return Ze.has(e)}n(B,"isAutoRetryable");var et=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function de(e){return B(e)||et.has(e)}n(de,"isRetryableCode");var tt=500,K=8e3,ce=4;function fe(e,t=Math.random){let r=Math.max(0,e),o=Math.min(tt*2**r,K);return Math.floor(t()*o)}n(fe,"backoffDelayMs");var rt=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function nt(e){return rt[e]}n(nt,"userFacingError");function pe(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}n(pe,"defineHidden");var ot=/^[a-z][a-z0-9_]{0,63}$/;function E(e,t){let r=z(t?.wireCode,t?.wireEnvelope),o={code:e,category:le(e),retryable:t?.retryable??de(e),displayMessage:nt(e)};if(t?.httpStatus!==void 0&&(o.httpStatus=t.httpStatus),t?.requestId&&(o.requestId=t.requestId),typeof t?.reasonCode=="string"&&ot.test(t.reasonCode)&&(o.reasonCode=t.reasonCode),r);return t?.wireMessage&&pe(o,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&pe(o,"raw",t.raw),Object.freeze(o)}n(E,"makeEverfurError");function ye(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}n(ye,"errorFrame");function st(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}n(st,"authHeaders");function N(e,t){return {...e,headers:{...lt(e.headers),...st(t)}}}n(N,"withAuthHeaders");function lt(e){if(!e)return {};let t={};for(let[r,o]of Object.entries(e)){let i=r.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(t[r]=o);}return t}n(lt,"stripAuthHeaders");async function ve(e,t){if(t.mode==="anonymous")return t.transport.request(N(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return u(Y())}let o=await t.transport.request(N(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await t.identity.currentToken({forceRefresh:!0});}catch{return u(Y())}let a=await t.transport.request(N(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?u(Y(a.error.httpStatus)):a}n(ve,"authedSend");function Y(e){return E("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(Y,"authRejectedError");function me(e){return E("internalError",{retryable:true,wireMessage:ut(e)})}n(me,"networkError");function ut(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(ut,"describeCause");var dt=3e4,ct=K*2,ft="idempotency-key",pt=new Set(["POST","PUT","PATCH","DELETE"]),yt=Object.freeze({onEvent(){}}),vt=Object.freeze({setTimeout:n((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function mt(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}n(mt,"seededIdempotencyKey");function U(e){let t=e.observer??yt,r=e.timers??vt,o=e.rng??Math.random,i=e.sleep??((p,c)=>Ot(p,r,c)),a=e.maxAttempts??ce,s=e.unaryTimeoutMs??dt,l=e.newIdempotencyKey??_t(),d=n(p=>{try{t.onEvent(p);}catch{}},"emit");async function g(p,c,b){let S=b?.maxAttempts,A=Math.max(1,S??a),y=b?.idempotent??pt.has(c.method),v=b?.idempotencyKey===void 0?null:mt(b.idempotencyKey),f=y?v??l():null,m=Et(c,f),h=0;for(;;){let x=n(q=>Object.freeze({call:p,method:c.method,path:c.path,attempt:h,...f?{idempotencyKey:f}:{},...q}),"stamp");d(x({phase:"attempt"}));let ne=It(s,r),oe=kt(ne.signal,c.signal),F;try{F=await ve({...m,signal:oe.signal},e.auth);}catch(q){F=u(me(q));}finally{oe.dispose(),ne.cancel();}if(F.ok)return d(x({phase:"settled",ok:true,reason:"ok"})),F;let w=F.error,D=ht(w,h,{maxAttempts:A,rng:o,now:r.now(),aborted:c.signal?.aborted===true,...S!==void 0?{perCallMaxAttempts:S}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),L={ok:false,code:w.code,reason:D.reason,...w.httpStatus!==void 0?{httpStatus:w.httpStatus}:{},...w.requestId!==void 0?{requestId:w.requestId}:{}};if(!D.retry)return d(x({phase:"settled",...L})),u(w);if(d(x({phase:"retry",...L,delayMs:D.delayMs})),await i(D.delayMs,c.signal),c.signal?.aborted===true)return d(x({phase:"settled",...L,reason:"aborted"})),u(w);h+=1;}}n(g,"send");async function C(p){return N(p,await St(e.auth))}n(C,"authorize");async function*_(p,c,b){d(Object.freeze({call:p,phase:"stream.open",method:c.method,path:c.path,attempt:0}));try{yield*e.auth.transport.stream(c,b);}catch{yield ye({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(_,"stream"),Object.freeze({send:g,authorize:C,stream:_})}n(U,"createRequestFunnel");function Et(e,t){let r={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==ft&&(r[o]=i);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}n(Et,"assembleHeaders");function _t(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(_t,"defaultIdempotencyKeyFactory");var gt=10;function ht(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let o=bt(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!B(e.code))return {retry:false,reason:"terminal-code"};let i=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=n(()=>{if(r.policy===void 0)return null;let g;try{g=r.policy.maxAttempts(e.code);}catch{return null}return typeof g!="number"||!Number.isFinite(g)?null:Math.max(1,Math.min(gt,Math.floor(g)))},"policyCeiling"),l=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=l)return {retry:false,reason:"attempts-exhausted"};let d=Rt(e,r.now);return d!==null?d>ct?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:d}:{retry:true,reason:i,delayMs:fe(t,r.rng)}}n(ht,"decideRetry");function bt(e){let t=e.code==="unknown"?ue(Tt(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}n(bt,"throttleKind");function Rt(e,t){let r=wt(e.raw);if(r===null)return null;let o=r-t;return o>0?o:0}n(Rt,"retryOverrideMs");function wt(e){for(let t of _e(e)){let r=t.resets_at,o=Ct(r);if(o!==null)return o}return null}n(wt,"findResetsAt");function _e(e){if(!Ee(e))return [];let t=[e];for(let r of ["error","detail"]){let o=e[r];Ee(o)&&t.push(o);}return t}n(_e,"candidateScopes");function Ct(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}n(Ct,"parseInstantMs");function Tt(e){for(let t of _e(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}n(Tt,"rawWireCode");function Ee(e){return typeof e=="object"&&e!==null}n(Ee,"isRecord");async function St(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}n(St,"resolveDeviceAuth");function It(e,t){let r=new AbortController,o=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:n(()=>t.clearTimeout(o),"cancel")}}n(It,"boundedSignal");function kt(e,t){let r=n(()=>{},"noop");if(!t)return {signal:e,dispose:r};let o=new AbortController;if(e.aborted||t.aborted)return o.abort(),{signal:o.signal,dispose:r};let i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i);},"dispose")}}n(kt,"mergeSignals");function Ot(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(o=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",a),o();},e),a=n(()=>{t.clearTimeout(i),o();},"onAbort");r?.addEventListener("abort",a,{once:true});})}n(Ot,"delayAbortable");function xt(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t.code;return typeof r=="string"&&r.length>0?r:null}n(xt,"wireCodeOf");function ge(e,t){let r=xt(e);if(r===null)return e;let o=t[r];return o===void 0?e:E(o.code,{retryable:o.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:r,reasonCode:r,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}n(ge,"foldWireReason");var Ce=Object.freeze({provider_unsupported:"Everfur does not send through this push provider yet. Register an Expo push token (provider expo) or an FCM registration token (provider fcm); APNs direct is not available in this version.",token_invalid:"The token is not a push token of the given provider. Expo tokens look like ExponentPushToken[...]; FCM registration tokens are long opaque strings. Pass the token exactly as your notification library printed it.",device_cipher_unavailable:"Everfur could not seal the token at rest, so nothing was stored. Retry the registration later; the SDK retries it on the next launch and login.",credentials_missing:"Everfur holds no push credential for this provider on your tenant, so deliveries to it are skipped. Expo needs nothing unless you enabled push security (then your Expo access token). A bare app using FCM supplies its Firebase service-account JSON to Everfur; push credentials are set by Everfur on your tenant, never through the SDK."}),Ft=new Set(["provider_unsupported","token_invalid","device_cipher_unavailable","credentials_missing"]);function Pt(e){let t=e.reasonCode;return t!==void 0&&Ft.has(t)?Ce[t]:null}n(Pt,"explainNotificationsReason");var Te=new Set(["expo","fcm","apns"]),Se=new Set(["ios","android"]),he=4096,be=128,Re=64,Ie=/[- ]/;function R(e,t){return E("validationFailed",{retryable:false,wireMessage:e,...t?{reasonCode:t}:{}})}n(R,"invalid");function Nt(e){if(typeof e!="object"||e===null)return R("registerDevice needs an input object");let{token:t,provider:r,platform:o,installationId:i}=e;return typeof r!="string"||!Te.has(r)?R("provider must be expo, fcm or apns"):typeof o!="string"||!Se.has(o)?R("platform must be ios or android"):typeof t!="string"||t.trim().length===0||t.length>he||Ie.test(t)?R(`token must be a push token of 1..${he} characters with no whitespace`,"token_invalid"):i!==void 0&&(typeof i!="string"||i.length===0||i.length>be)?R(`installationId must be 1..${be} characters`):null}n(Nt,"validateRegister");function At(e){return typeof e!="string"||e.length===0||e.length>Re?R(`deviceId must be 1..${Re} characters`):Ie.test(e)||e.includes("/")||e==="."||e===".."?R("deviceId is not a device id"):null}n(At,"validateDeviceId");function Dt(e){if(typeof e!="object"||e===null)return R("setPreferences needs an input object");let{pushEnabled:t,emailEnabled:r}=e;return typeof t!="boolean"||typeof r!="boolean"?R("pushEnabled and emailEnabled must both be booleans: the route replaces both switches"):null}n(Dt,"validatePreferences");function I(e){return typeof e=="string"&&e.length>0?e:null}n(I,"str");function jt(e){if(typeof e!="object"||e===null)return null;let t=e,r=I(t.device_id),o=I(t.provider),i=I(t.platform),a=I(t.registered_at),s=I(t.last_seen_at);if(r===null||o===null||i===null||a===null||s===null||!Te.has(o)||!Se.has(i))return null;let l=t.installation_id;return Object.freeze({deviceId:r,provider:o,platform:i,installationId:typeof l=="string"&&l.length>0?l:null,registeredAt:a,lastSeenAt:s})}n(jt,"parseDevice");function zt(e){if(typeof e!="object"||e===null)return null;let t=e,r=I(t.updated_at);return typeof t.push_enabled!="boolean"||typeof t.email_enabled!="boolean"||r===null?null:Object.freeze({pushEnabled:t.push_enabled,emailEnabled:t.email_enabled,updatedAt:r})}n(zt,"parsePreferences");function we(e){return E("internalError",{retryable:false,wireMessage:`${e}: the response was not the documented shape`})}n(we,"malformed");var Ut=Object.freeze({provider_unsupported:{code:"validationFailed",retryable:false},token_invalid:{code:"validationFailed",retryable:false},device_cipher_unavailable:{code:"serviceUnavailable",retryable:true}});function H(e){return ge(e,Ut)}n(H,"refine");function G(e){return E("validationFailed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${e} was called after unmount`})}n(G,"disposed");function W(e){let t=n(()=>{let{services:r}=e.registry;return $({auth:r.authFor(null),...r.errorPolicy?{errorPolicy:r.errorPolicy}:{}})},"over");return {registerDevice:n((r,o)=>e.isDisposed?Promise.resolve(u(G("registerDevice"))):t().registerDevice(r,o),"registerDevice"),unregisterDevice:n((r,o)=>e.isDisposed?Promise.resolve(u(G("unregisterDevice"))):t().unregisterDevice(r,o),"unregisterDevice"),setPreferences:n((r,o)=>e.isDisposed?Promise.resolve(u(G("setPreferences"))):t().setPreferences(r,o),"setPreferences")}}n(W,"createNotificationsClient");function $(e){let t=e.funnel??U({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=n((o,i)=>i?{...o,signal:i}:o,"withSignal");return {async registerDevice(o,i){let a=Nt(o);if(a!==null)return u(a);let s={token:o.token,provider:o.provider,platform:o.platform};o.installationId!==void 0&&(s.installation_id=o.installationId);let l=await t.send("notifications.registerDevice",r({method:"POST",path:"/widget/v1/me/devices",body:s},i?.signal));if(!l.ok)return u(H(l.error));let d=jt(l.value);return d===null?u(we("registerDevice")):T(d)},async unregisterDevice(o,i){let a=At(o);if(a!==null)return u(a);let s=await t.send("notifications.unregisterDevice",r({method:"DELETE",path:`/widget/v1/me/devices/${encodeURIComponent(o)}`},i?.signal));return s.ok?T(void 0):u(H(s.error))},async setPreferences(o,i){let a=Dt(o);if(a!==null)return u(a);let s=await t.send("notifications.setPreferences",r({method:"PUT",path:"/widget/v1/me/notification-preferences",body:{push_enabled:o.pushEnabled,email_enabled:o.emailEnabled}},i?.signal));if(!s.ok)return u(H(s.error));let l=zt(s.value);return l===null?u(we("setPreferences")):T(l)}}}n($,"createNotificationsClientOver");var k="everfur.notifications.device";var ke=3e3;var Oe=Symbol.for("@everfur/sdk#EverfurContext@v1"),xe=globalThis,Fe=xe[Oe]??(xe[Oe]=createContext(null));Fe.displayName??="EverfurContext";function Q(){let e=useContext(Fe);if(e===null)throw new P("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(Q,"useEverfurContext");var ze=1;async function J(e){try{let t=await e.getItem(k);if(t===null)return null;let r=JSON.parse(t);if(typeof r!="object"||r===null)return null;let{v:o,userRef:i,deviceId:a}=r;return o!==ze||typeof i!="string"||typeof a!="string"||a.length===0?null:{userRef:i,deviceId:a}}catch{return null}}n(J,"readStored");async function Vt(e,t){try{await e.setItem(k,JSON.stringify({v:ze,...t}));}catch{}}n(Vt,"writeStored");async function Ne(e){try{await e.removeItem(k);}catch{}}n(Ne,"clearStored");var Ae=Object.freeze({status:"signed_out",device:null,error:null}),De=Object.freeze({status:"no_token",device:null,error:null});function Z(){return E("sessionRequired",{retryable:false,wireMessage:"notifications need a signed-in user on the provider"})}n(Z,"noUser");function Ue(){let{runtime:e}=Q();return useMemo(()=>W(e),[e])}n(Ue,"useEverfurNotificationsClient");function Me(e){let{runtime:t,userRef:r}=Q(),{token:o,provider:i,platform:a,installationId:s}=e,l=t.registry.services.kv,d=Ue(),[g,C]=useState(r===null?Ae:De),_=useRef(null),p=useRef(0);useEffect(()=>{if(p.current+=1,_.current=null,C(r===null?Ae:De),r===null)return;let y=true;return J(l).then(v=>{if(!y||v===null||v.userRef!==r)return;let f=_.current;if(f===null){_.current=v;return}f.deviceId!==v.deviceId&&d.unregisterDevice(v.deviceId);}),()=>{y=false;}},[d,l,r]);let c=useCallback(async(y,v)=>{let f=p.current+=1;C({status:"registering",device:null,error:null});let m=await d.registerDevice({token:v,provider:i,platform:a,...s===void 0?{}:{installationId:s}});if(f!==p.current)return m;if(!m.ok)return C({status:m.error.httpStatus===404?"unavailable":"failed",device:null,error:m.error}),m;let h=_.current;return _.current={userRef:y,deviceId:m.value.deviceId},C({status:"registered",device:m.value,error:null}),await Vt(l,_.current),h!==null&&h.userRef===y&&h.deviceId!==m.value.deviceId&&d.unregisterDevice(h.deviceId),m},[d,l,i,a,s]);useEffect(()=>{r===null||o===null||c(r,o);},[c,r,o]),useEffect(()=>t.onBeforeLogout(async({userRef:y,auth:v})=>{let f=_.current??await J(l);if(f===null||f.userRef!==y)return;_.current=null;let m=U({auth:v,maxAttempts:1,unaryTimeoutMs:ke,...t.registry.services.errorPolicy?{errorPolicy:t.registry.services.errorPolicy}:{}}),h=await $({auth:v,funnel:m}).unregisterDevice(f.deviceId);(h.ok||h.error.httpStatus===404)&&await Ne(l);}),[t,l]);let b=useCallback(async()=>r===null?u(Z()):o===null?u(E("validationFailed",{retryable:false,reasonCode:"token_invalid",wireMessage:"no push token was given"})):c(r,o),[c,r,o]),S=useCallback(async()=>{if(r===null)return u(Z());let y=_.current??await J(l);if(y===null||y.userRef!==r)return T(void 0);let v=p.current+=1,f=await d.unregisterDevice(y.deviceId);return f.ok||f.error.httpStatus===404?(_.current=null,await Ne(l),v===p.current&&C({status:"unregistered",device:null,error:null}),f.ok?f:T(void 0)):f},[d,l,r]),A=useCallback(y=>r===null?Promise.resolve(u(Z())):d.setPreferences(y),[d,r]);return useMemo(()=>({status:g.status,device:g.device,error:g.error,register:b,unregister:S,setPreferences:A}),[g,b,S,A])}n(Me,"useEverfurNotifications");function Yt(e){let t=Me(e),{status:r,error:o,register:i}=t,a=r==="failed"&&o!==null&&o.retryable;return useEffect(()=>{if(!a)return;let s=AppState.addEventListener("change",l=>{l==="active"&&i();});return ()=>{s.remove();}},[a,i]),t}n(Yt,"useEverfurNotifications");var Le=Object.freeze({"visit.booked":"visit","visit.reminder":"join","visit.rescheduled":"visit","visit.followup_sent":"messages","visit.message_received":"messages","visit.completed":"summary","visit.ended":"visit","visit.cancelled":null,"visit.no_show":null});function qe(e){return Object.prototype.hasOwnProperty.call(Le,e)?Le[e]:"visit"}n(qe,"vetVisitIntentForEvent");var Be=1,Ke=Object.freeze(["record_request","pet","visit","case"]),Ye=Object.freeze(["record_request.updated","record.ready","pet.vaccination.due","visit.booked","visit.cancelled","visit.completed","visit.no_show","visit.rescheduled","visit.reminder","visit.followup_sent","visit.message_received","visit.ended","chat.follow_up_due","chat.reminder_due","record.activation"]),te=["v","event_id","event_type","target"],Ht=new Set(["kind","conversation_id","request_id","visit_ref","case_ref","pet_ref"]),Gt=new Set(Ye),Wt=new Set(Ke),$t=128,Qt=4096,Xt=/^evt_[A-Za-z0-9]{1,64}$/,Jt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Zt=/[-]/;function O(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(O,"isRecord");function He(e){return Object.keys(e)}n(He,"keysOf");function er(e){if(O(e))return e;if(typeof e!="string"||e.length===0||e.length>Qt)return null;let t=JSON.parse(e);return O(t)?t:null}n(er,"decodeBlock");function tr(e,t){let r=e;for(let o of t){if(!O(r))return;r=r[o];}return r}n(tr,"at");var rr=[[],["data"],["request","content","data"],["notification","request","content","data"]];function nr(e){if(!O(e))return null;for(let t of rr){let r=tr(e,t);if(O(r)&&"everfur"in r)return r.everfur}return te.every(t=>t in e)?e:null}n(nr,"locateBlock");function re(e){return typeof e!="string"||e.length===0||e.length>$t||Zt.test(e)||e.includes("://")||e.toLowerCase().startsWith("everfur")?null:e}n(re,"opaqueString");function Ve(e,t){if(!(t in e))return {ok:true,value:null};let r=re(e[t]);return r===null?{ok:false}:{ok:true,value:r}}n(Ve,"optional");function ee(e,t){return t in e?re(e[t]):null}n(ee,"required");function or(e,t){if(!O(e))return null;let r=He(e);if(!r.includes("kind")||r.some(s=>!Ht.has(s)))return null;let o=e.kind;if(typeof o!="string"||!Wt.has(o))return null;for(let s of r)if(s!=="kind"&&re(e[s])===null)return null;let i=Ve(e,"pet_ref");if(!i.ok)return null;let a=i.value;switch(o){case "record_request":{let s=ee(e,"request_id");return s===null?null:Object.freeze({kind:"record_request",requestId:s,petRef:a})}case "pet":return a===null?null:Object.freeze({kind:"pet",petRef:a});case "visit":{let s=ee(e,"visit_ref");return s===null?null:Object.freeze({kind:"visit",visitRef:s,petRef:a,intent:qe(t)})}case "case":{let s=ee(e,"case_ref");if(s===null)return null;let l=Ve(e,"conversation_id");return !l.ok||l.value!==null&&!Jt.test(l.value)?null:Object.freeze({kind:"case",caseRef:s,conversationId:l.value,petRef:a})}default:return null}}n(or,"parseTarget");function ir(e){let t=He(e);if(t.length!==te.length||te.some(a=>!t.includes(a))||e.v!==Be)return null;let r=e.event_id;if(typeof r!="string"||!Xt.test(r))return null;let o=e.event_type;if(typeof o!="string"||!Gt.has(o))return null;let i=or(e.target,o);return i===null?null:Object.freeze({eventId:r,eventType:o,target:i})}n(ir,"parseBlock");function ar(e){try{let t=er(nr(e));return t===null?null:ir(t)}catch{return null}}n(ar,"parseEverfurNotification");
|
|
2
|
+
export{Ye as EVERFUR_NOTIFICATION_EVENT_TYPES,Ke as EVERFUR_NOTIFICATION_TARGET_KINDS,Be as EVERFUR_NOTIFICATION_VERSION,Ce as NOTIFICATIONS_REASON_MESSAGES,W as createNotificationsClient,Pt as explainNotificationsReason,ar as parseEverfurNotification,Yt as useEverfurNotifications,Ue as useEverfurNotificationsClient};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** The settled outcome of a guarded optional-module load. Never a throw. */
|
|
2
|
+
type OptionalModule<T> = {
|
|
3
|
+
readonly available: true;
|
|
4
|
+
readonly module: T;
|
|
5
|
+
} | {
|
|
6
|
+
readonly available: false;
|
|
7
|
+
readonly module: null;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Load an optional native peer behind a guard. `load` is the host-provided thunk (typically a `require`).
|
|
12
|
+
* An optional `validate` type-guard rejects a present-but-wrong-shape module (a version whose surface drifted)
|
|
13
|
+
* without throwing. Returns a settled result; NEVER throws.
|
|
14
|
+
*
|
|
15
|
+
* @param name human-readable peer name, only used to build the `reason` string.
|
|
16
|
+
* @param load the thunk that resolves the module (e.g. `() => require('expo-secure-store')`).
|
|
17
|
+
* @param validate optional shape guard; when it returns false the module is treated as unavailable.
|
|
18
|
+
*/
|
|
19
|
+
declare function optionalModule<T>(name: string, load: () => unknown, validate?: (candidate: unknown) => candidate is T): OptionalModule<T>;
|
|
20
|
+
|
|
21
|
+
export { type OptionalModule as O, optionalModule as o };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** The settled outcome of a guarded optional-module load. Never a throw. */
|
|
2
|
+
type OptionalModule<T> = {
|
|
3
|
+
readonly available: true;
|
|
4
|
+
readonly module: T;
|
|
5
|
+
} | {
|
|
6
|
+
readonly available: false;
|
|
7
|
+
readonly module: null;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Load an optional native peer behind a guard. `load` is the host-provided thunk (typically a `require`).
|
|
12
|
+
* An optional `validate` type-guard rejects a present-but-wrong-shape module (a version whose surface drifted)
|
|
13
|
+
* without throwing. Returns a settled result; NEVER throws.
|
|
14
|
+
*
|
|
15
|
+
* @param name human-readable peer name, only used to build the `reason` string.
|
|
16
|
+
* @param load the thunk that resolves the module (e.g. `() => require('expo-secure-store')`).
|
|
17
|
+
* @param validate optional shape guard; when it returns false the module is treated as unavailable.
|
|
18
|
+
*/
|
|
19
|
+
declare function optionalModule<T>(name: string, load: () => unknown, validate?: (candidate: unknown) => candidate is T): OptionalModule<T>;
|
|
20
|
+
|
|
21
|
+
export { type OptionalModule as O, optionalModule as o };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { c as EverfurResult } from './EverfurResult-DN9pL2Ab.js';
|
|
2
|
+
import { j as FetchLike } from './config-C7eb_IMD.js';
|
|
3
|
+
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.js';
|
|
4
|
+
|
|
5
|
+
/** How your backend reaches Everfur for pet writes. Build it once and reuse it. */
|
|
6
|
+
interface PartnerServerClient {
|
|
7
|
+
/** The Everfur API base URL, for example `https://api.everfur.com/api/v1`. https only (loopback excepted). */
|
|
8
|
+
readonly apiBaseUrl: string;
|
|
9
|
+
/**
|
|
10
|
+
* `sk_partner_...`, or an `rk_partner_...` restricted key carrying `pets.profile.update`, `pets.health.update` to
|
|
11
|
+
* write or read the health profile, and `pets.profile.delete` to delete. Never shipped to a device.
|
|
12
|
+
*/
|
|
13
|
+
readonly partnerSecretKey: string;
|
|
14
|
+
readonly contractVersion?: string;
|
|
15
|
+
readonly fetchImpl?: FetchLike;
|
|
16
|
+
}
|
|
17
|
+
/** Which pet: your member's id and your pet's id. */
|
|
18
|
+
interface PartnerPetTarget {
|
|
19
|
+
/** Your stable member id; the session mint's user_ref rule (1 to 128 characters, no '@', printable). */
|
|
20
|
+
readonly userRef: string;
|
|
21
|
+
/** Your stable pet id, 1 to 128 characters. */
|
|
22
|
+
readonly petRef: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The profile fields, the body every partner pet write path shares. On `upsertPartnerPet` an absent or `null`
|
|
26
|
+
* identity field leaves the stored value unchanged. On `updatePartnerPet` `null` clears `name`, `species`, `breed`,
|
|
27
|
+
* `ageYears` or `weightKg`, and an empty `partnerLabelInstructions` retracts the label text.
|
|
28
|
+
*
|
|
29
|
+
* The health fields (`PetHealthProfileInput`) take the same rule on both: absent is unchanged and an explicit null
|
|
30
|
+
* clears a scalar. A health LIST you send is the complete set you hold for the pet (set-replace): items match your
|
|
31
|
+
* earlier rows by `ref`, else by name, rows you no longer name are removed, and `[]` clears your rows. Rows the
|
|
32
|
+
* member entered themselves are never touched. Any health field needs `pets.health.update` and a dog or a cat.
|
|
33
|
+
*/
|
|
34
|
+
interface PartnerPetProfile extends PetHealthProfileInput {
|
|
35
|
+
/** Up to 100 characters. */
|
|
36
|
+
readonly name?: string | null;
|
|
37
|
+
/** Up to 50 characters. Records needs `dog` or `cat`. */
|
|
38
|
+
readonly species?: string | null;
|
|
39
|
+
/** Up to 100 characters. */
|
|
40
|
+
readonly breed?: string | null;
|
|
41
|
+
/** 0 to 50. */
|
|
42
|
+
readonly ageYears?: number | null;
|
|
43
|
+
/** 0 to 500. */
|
|
44
|
+
readonly weightKg?: number | null;
|
|
45
|
+
/** Your own label text, stored verbatim and never interpreted by Everfur. */
|
|
46
|
+
readonly partnerLabelInstructions?: string | null;
|
|
47
|
+
}
|
|
48
|
+
/** A pet profile as Everfur stored it. */
|
|
49
|
+
interface PartnerPet {
|
|
50
|
+
readonly petId: string;
|
|
51
|
+
readonly petRef: string;
|
|
52
|
+
readonly name: string | null;
|
|
53
|
+
readonly species: string | null;
|
|
54
|
+
readonly breed: string | null;
|
|
55
|
+
readonly ageYears: number | null;
|
|
56
|
+
readonly weightKg: number | null;
|
|
57
|
+
/** ISO 8601. */
|
|
58
|
+
readonly updatedAt: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A pet read back with its health profile (`getPartnerPet`). The scalars are the pet's one shared profile, whoever
|
|
62
|
+
* set them last; the lists are the rows YOUR integration wrote, with your refs, never the member's own or another
|
|
63
|
+
* partner's. `profileVersion` moves on every accepted write from any path (yours, the member's device, an inbound
|
|
64
|
+
* `pet.profile.updated`), so one integer tells you whether anything changed since you last looked.
|
|
65
|
+
*/
|
|
66
|
+
interface PartnerPetWithProfile extends PartnerPet, PetHealthProfile {
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Create a member's pet profile, or merge fields into it (`PUT`). Creates the member on first use.
|
|
70
|
+
*
|
|
71
|
+
* Settles to an `EverfurResult` for HTTP and network failures. Throws `EverfurConfigError` for a request that can
|
|
72
|
+
* never be accepted: a malformed key, `userRef` or `petRef`.
|
|
73
|
+
*/
|
|
74
|
+
declare function upsertPartnerPet(client: PartnerServerClient, target: PartnerPetTarget, profile: PartnerPetProfile): Promise<EverfurResult<PartnerPet>>;
|
|
75
|
+
/**
|
|
76
|
+
* Change fields of an existing pet profile (`PATCH`). Never creates a member or a pet: either unknown settles to the
|
|
77
|
+
* not-found error. At least one field is required.
|
|
78
|
+
*/
|
|
79
|
+
declare function updatePartnerPet(client: PartnerServerClient, target: PartnerPetTarget, changes: PartnerPetProfile): Promise<EverfurResult<PartnerPet>>;
|
|
80
|
+
/**
|
|
81
|
+
* Read a member's pet back with its health profile (`GET`, PF-14), to reconcile what you hold against what Everfur
|
|
82
|
+
* holds. Needs `pets.health.update` on a restricted key. Never creates anything: an unknown member or pet settles to
|
|
83
|
+
* the not-found error.
|
|
84
|
+
*
|
|
85
|
+
* Settles to an `EverfurResult` for HTTP and network failures. Throws `EverfurConfigError` for a malformed key,
|
|
86
|
+
* `userRef` or `petRef`.
|
|
87
|
+
*/
|
|
88
|
+
declare function getPartnerPet(client: PartnerServerClient, target: PartnerPetTarget): Promise<EverfurResult<PartnerPetWithProfile>>;
|
|
89
|
+
/** Delete a pet profile (`DELETE`). An unknown member or pet settles to the not-found error. */
|
|
90
|
+
declare function deletePartnerPet(client: PartnerServerClient, target: PartnerPetTarget): Promise<EverfurResult<void>>;
|
|
91
|
+
|
|
92
|
+
export { type PartnerServerClient as P, type PartnerPet as a, type PartnerPetProfile as b, type PartnerPetTarget as c, type PartnerPetWithProfile as d, deletePartnerPet as e, upsertPartnerPet as f, getPartnerPet as g, updatePartnerPet as u };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { c as EverfurResult } from './EverfurResult-DN9pL2Ab.cjs';
|
|
2
|
+
import { j as FetchLike } from './config--Wu1Umhd.cjs';
|
|
3
|
+
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.cjs';
|
|
4
|
+
|
|
5
|
+
/** How your backend reaches Everfur for pet writes. Build it once and reuse it. */
|
|
6
|
+
interface PartnerServerClient {
|
|
7
|
+
/** The Everfur API base URL, for example `https://api.everfur.com/api/v1`. https only (loopback excepted). */
|
|
8
|
+
readonly apiBaseUrl: string;
|
|
9
|
+
/**
|
|
10
|
+
* `sk_partner_...`, or an `rk_partner_...` restricted key carrying `pets.profile.update`, `pets.health.update` to
|
|
11
|
+
* write or read the health profile, and `pets.profile.delete` to delete. Never shipped to a device.
|
|
12
|
+
*/
|
|
13
|
+
readonly partnerSecretKey: string;
|
|
14
|
+
readonly contractVersion?: string;
|
|
15
|
+
readonly fetchImpl?: FetchLike;
|
|
16
|
+
}
|
|
17
|
+
/** Which pet: your member's id and your pet's id. */
|
|
18
|
+
interface PartnerPetTarget {
|
|
19
|
+
/** Your stable member id; the session mint's user_ref rule (1 to 128 characters, no '@', printable). */
|
|
20
|
+
readonly userRef: string;
|
|
21
|
+
/** Your stable pet id, 1 to 128 characters. */
|
|
22
|
+
readonly petRef: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The profile fields, the body every partner pet write path shares. On `upsertPartnerPet` an absent or `null`
|
|
26
|
+
* identity field leaves the stored value unchanged. On `updatePartnerPet` `null` clears `name`, `species`, `breed`,
|
|
27
|
+
* `ageYears` or `weightKg`, and an empty `partnerLabelInstructions` retracts the label text.
|
|
28
|
+
*
|
|
29
|
+
* The health fields (`PetHealthProfileInput`) take the same rule on both: absent is unchanged and an explicit null
|
|
30
|
+
* clears a scalar. A health LIST you send is the complete set you hold for the pet (set-replace): items match your
|
|
31
|
+
* earlier rows by `ref`, else by name, rows you no longer name are removed, and `[]` clears your rows. Rows the
|
|
32
|
+
* member entered themselves are never touched. Any health field needs `pets.health.update` and a dog or a cat.
|
|
33
|
+
*/
|
|
34
|
+
interface PartnerPetProfile extends PetHealthProfileInput {
|
|
35
|
+
/** Up to 100 characters. */
|
|
36
|
+
readonly name?: string | null;
|
|
37
|
+
/** Up to 50 characters. Records needs `dog` or `cat`. */
|
|
38
|
+
readonly species?: string | null;
|
|
39
|
+
/** Up to 100 characters. */
|
|
40
|
+
readonly breed?: string | null;
|
|
41
|
+
/** 0 to 50. */
|
|
42
|
+
readonly ageYears?: number | null;
|
|
43
|
+
/** 0 to 500. */
|
|
44
|
+
readonly weightKg?: number | null;
|
|
45
|
+
/** Your own label text, stored verbatim and never interpreted by Everfur. */
|
|
46
|
+
readonly partnerLabelInstructions?: string | null;
|
|
47
|
+
}
|
|
48
|
+
/** A pet profile as Everfur stored it. */
|
|
49
|
+
interface PartnerPet {
|
|
50
|
+
readonly petId: string;
|
|
51
|
+
readonly petRef: string;
|
|
52
|
+
readonly name: string | null;
|
|
53
|
+
readonly species: string | null;
|
|
54
|
+
readonly breed: string | null;
|
|
55
|
+
readonly ageYears: number | null;
|
|
56
|
+
readonly weightKg: number | null;
|
|
57
|
+
/** ISO 8601. */
|
|
58
|
+
readonly updatedAt: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A pet read back with its health profile (`getPartnerPet`). The scalars are the pet's one shared profile, whoever
|
|
62
|
+
* set them last; the lists are the rows YOUR integration wrote, with your refs, never the member's own or another
|
|
63
|
+
* partner's. `profileVersion` moves on every accepted write from any path (yours, the member's device, an inbound
|
|
64
|
+
* `pet.profile.updated`), so one integer tells you whether anything changed since you last looked.
|
|
65
|
+
*/
|
|
66
|
+
interface PartnerPetWithProfile extends PartnerPet, PetHealthProfile {
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Create a member's pet profile, or merge fields into it (`PUT`). Creates the member on first use.
|
|
70
|
+
*
|
|
71
|
+
* Settles to an `EverfurResult` for HTTP and network failures. Throws `EverfurConfigError` for a request that can
|
|
72
|
+
* never be accepted: a malformed key, `userRef` or `petRef`.
|
|
73
|
+
*/
|
|
74
|
+
declare function upsertPartnerPet(client: PartnerServerClient, target: PartnerPetTarget, profile: PartnerPetProfile): Promise<EverfurResult<PartnerPet>>;
|
|
75
|
+
/**
|
|
76
|
+
* Change fields of an existing pet profile (`PATCH`). Never creates a member or a pet: either unknown settles to the
|
|
77
|
+
* not-found error. At least one field is required.
|
|
78
|
+
*/
|
|
79
|
+
declare function updatePartnerPet(client: PartnerServerClient, target: PartnerPetTarget, changes: PartnerPetProfile): Promise<EverfurResult<PartnerPet>>;
|
|
80
|
+
/**
|
|
81
|
+
* Read a member's pet back with its health profile (`GET`, PF-14), to reconcile what you hold against what Everfur
|
|
82
|
+
* holds. Needs `pets.health.update` on a restricted key. Never creates anything: an unknown member or pet settles to
|
|
83
|
+
* the not-found error.
|
|
84
|
+
*
|
|
85
|
+
* Settles to an `EverfurResult` for HTTP and network failures. Throws `EverfurConfigError` for a malformed key,
|
|
86
|
+
* `userRef` or `petRef`.
|
|
87
|
+
*/
|
|
88
|
+
declare function getPartnerPet(client: PartnerServerClient, target: PartnerPetTarget): Promise<EverfurResult<PartnerPetWithProfile>>;
|
|
89
|
+
/** Delete a pet profile (`DELETE`). An unknown member or pet settles to the not-found error. */
|
|
90
|
+
declare function deletePartnerPet(client: PartnerServerClient, target: PartnerPetTarget): Promise<EverfurResult<void>>;
|
|
91
|
+
|
|
92
|
+
export { type PartnerServerClient as P, type PartnerPet as a, type PartnerPetProfile as b, type PartnerPetTarget as c, type PartnerPetWithProfile as d, deletePartnerPet as e, upsertPartnerPet as f, getPartnerPet as g, updatePartnerPet as u };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { c as EverfurResult } from './EverfurResult-DN9pL2Ab.cjs';
|
|
2
|
+
import { A as AuthContext } from './identity-C2-08BZW.cjs';
|
|
3
|
+
import { P as PetRef } from './ids-B2GAAifq.cjs';
|
|
4
|
+
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Server-declared bounds on `WidgetPetInput`, mirrored so a violation is refused before the wire rather
|
|
8
|
+
* than returning a refusal after the caller has already driven a registration flow. Every field is optional
|
|
9
|
+
* server-side: `POST` with an empty body registers a bare pet, which is all consent needs.
|
|
10
|
+
*
|
|
11
|
+
* WHICH STATUS THE SERVER WOULD HAVE ANSWERED, because the two are not interchangeable: a body that does not
|
|
12
|
+
* PARSE is a 400 `ValidationException` (an unknown key, the birth date pair split, a `ref` repeated in a
|
|
13
|
+
* list), rendered by the app-wide validation handler. The 422s are raised AFTER the body parses: an
|
|
14
|
+
* unsupported species and an empty PATCH body. Every rule mirrored here is refused locally, so a partner
|
|
15
|
+
* using this SDK meets neither.
|
|
16
|
+
*/
|
|
17
|
+
declare const PET_NAME_MAX = 100;
|
|
18
|
+
declare const PET_SPECIES_MAX = 50;
|
|
19
|
+
declare const PET_BREED_MAX = 100;
|
|
20
|
+
declare const PET_AGE_YEARS_MAX = 50;
|
|
21
|
+
declare const PET_WEIGHT_KG_MAX = 500;
|
|
22
|
+
/**
|
|
23
|
+
* The optional profile fields. Omit all of them to register the pet without describing it.
|
|
24
|
+
*
|
|
25
|
+
* The five identity fields merge: an absent one leaves the stored value unchanged. The health fields
|
|
26
|
+
* (`PetHealthProfileInput`) follow the partner pet body's own rules: an explicit null clears a scalar, and a list you
|
|
27
|
+
* send REPLACES the rows your integration wrote for that list (`[]` clears them). A registration is an upsert, so
|
|
28
|
+
* sending a list on a later `registerPet` replaces the earlier one rather than adding to it. Health fields need a
|
|
29
|
+
* SIGNED session (403 `identitySignatureRequired` otherwise) and a pet that is a dog or a cat.
|
|
30
|
+
*/
|
|
31
|
+
interface PetProfileInput extends PetHealthProfileInput {
|
|
32
|
+
readonly name?: string;
|
|
33
|
+
readonly species?: string;
|
|
34
|
+
readonly breed?: string;
|
|
35
|
+
readonly ageYears?: number;
|
|
36
|
+
readonly weightKg?: number;
|
|
37
|
+
}
|
|
38
|
+
/** The registered profile, as the server echoes it back. */
|
|
39
|
+
interface RegisteredPet {
|
|
40
|
+
readonly petRef: string;
|
|
41
|
+
readonly name: string | null;
|
|
42
|
+
readonly species: string | null;
|
|
43
|
+
readonly breed: string | null;
|
|
44
|
+
readonly ageYears: number | null;
|
|
45
|
+
readonly weightKg: number | null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A partial profile change for `updatePet`. An omitted field is left unchanged; `null` clears it. At least one
|
|
49
|
+
* field is required. The server refuses clearing or changing `species` to an unsupported value once the pet
|
|
50
|
+
* uses Records (Records needs a dog or a cat). A health list you send replaces your rows for that list; `[]`
|
|
51
|
+
* clears them.
|
|
52
|
+
*/
|
|
53
|
+
interface PetProfilePatch extends PetHealthProfileInput {
|
|
54
|
+
readonly name?: string | null;
|
|
55
|
+
readonly species?: string | null;
|
|
56
|
+
readonly breed?: string | null;
|
|
57
|
+
readonly ageYears?: number | null;
|
|
58
|
+
readonly weightKg?: number | null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One row of `GET /widget/v1/pets` (`WidgetPetResponse`, widget_schemas.py): the profile the partner registered,
|
|
62
|
+
* keyed by its `petRef`. The roster carries the identity fields only, never health data: the health profile is its
|
|
63
|
+
* own signed read (`getPetProfile`). `ageYears` is the registered whole-or-fractional age. Unknown wire fields are
|
|
64
|
+
* dropped at the boundary.
|
|
65
|
+
*/
|
|
66
|
+
interface WidgetPet {
|
|
67
|
+
/** The server's own id for the row; opaque, never a scope key (`petRef` is). */
|
|
68
|
+
readonly petId: string | null;
|
|
69
|
+
readonly petRef: PetRef;
|
|
70
|
+
readonly name: string | null;
|
|
71
|
+
readonly species: string | null;
|
|
72
|
+
readonly breed: string | null;
|
|
73
|
+
readonly ageYears: number | null;
|
|
74
|
+
readonly weightKg: number | null;
|
|
75
|
+
readonly updatedAt: string | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One pet read back WITH its health profile (`GET /widget/v1/pets/{pet_ref}/profile`, `WidgetPetProfileResponse`):
|
|
79
|
+
* the list row's fields plus `profileVersion`, the health scalars and your integration's four lists.
|
|
80
|
+
*/
|
|
81
|
+
interface WidgetPetProfile extends WidgetPet, PetHealthProfile {
|
|
82
|
+
}
|
|
83
|
+
interface PetsRepository {
|
|
84
|
+
/**
|
|
85
|
+
* `GET /widget/v1/pets` - every pet registered for the current user, as the server lists them. Settles
|
|
86
|
+
* `ok(readonly WidgetPet[])` on 200 (an empty list when none); `err(EverfurError)` otherwise. A row without a
|
|
87
|
+
* `pet_ref` is dropped rather than failing the page. Never throws.
|
|
88
|
+
*/
|
|
89
|
+
list(opts?: {
|
|
90
|
+
signal?: AbortSignal;
|
|
91
|
+
}): Promise<EverfurResult<readonly WidgetPet[]>>;
|
|
92
|
+
/**
|
|
93
|
+
* `POST /widget/v1/pets/{pet_ref}` - create or update the widget pet profile. Idempotent by construction:
|
|
94
|
+
* the route is an upsert, so calling it for an already-registered pet updates rather than duplicates.
|
|
95
|
+
*
|
|
96
|
+
* Settles: `ok(RegisteredPet)` on 201, `err(EverfurError)` otherwise. Never throws.
|
|
97
|
+
*/
|
|
98
|
+
registerPet(petRef: PetRef, profile?: PetProfileInput, opts?: {
|
|
99
|
+
signal?: AbortSignal;
|
|
100
|
+
}): Promise<EverfurResult<RegisteredPet>>;
|
|
101
|
+
/**
|
|
102
|
+
* `PATCH /widget/v1/pets/{pet_ref}` - change part of a registered pet's profile. Settles `ok(RegisteredPet)`
|
|
103
|
+
* on 200; an unknown pet is the not-found error; an empty change is refused before the wire.
|
|
104
|
+
*/
|
|
105
|
+
updatePet(petRef: PetRef, patch: PetProfilePatch, opts?: {
|
|
106
|
+
signal?: AbortSignal;
|
|
107
|
+
}): Promise<EverfurResult<RegisteredPet>>;
|
|
108
|
+
/**
|
|
109
|
+
* `GET /widget/v1/pets/{pet_ref}/profile` - one pet with its health profile, so a partner app can show what
|
|
110
|
+
* Everfur holds. A SIGNED session only: any other session settles to the route's 403 `identitySignatureRequired`.
|
|
111
|
+
* An unknown pet is the not-found error. Never throws.
|
|
112
|
+
*/
|
|
113
|
+
getPetProfile(petRef: PetRef, opts?: {
|
|
114
|
+
signal?: AbortSignal;
|
|
115
|
+
}): Promise<EverfurResult<WidgetPetProfile>>;
|
|
116
|
+
/**
|
|
117
|
+
* `DELETE /widget/v1/pets/{pet_ref}` - delete the pet profile. The server also retires the pet's Records
|
|
118
|
+
* data. Settles `ok(undefined)` on 204; an unknown pet is the not-found error.
|
|
119
|
+
*/
|
|
120
|
+
deletePet(petRef: PetRef, opts?: {
|
|
121
|
+
signal?: AbortSignal;
|
|
122
|
+
}): Promise<EverfurResult<void>>;
|
|
123
|
+
/**
|
|
124
|
+
* `DELETE /widget/v1/me` - permanently erase everything Everfur holds for the current user (right to
|
|
125
|
+
* erasure). Settles `ok(undefined)` on 204. A 503 means the erasure did not finish: it is retryable and a
|
|
126
|
+
* repeat call resumes it. Sent once per call (never auto-retried, so two erasures never overlap), with a
|
|
127
|
+
* per-attempt deadline of `ERASE_USER_DATA_TIMEOUT_MS`. The next request for the same user starts a fresh,
|
|
128
|
+
* empty user.
|
|
129
|
+
*/
|
|
130
|
+
eraseUserData(opts?: {
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
}): Promise<EverfurResult<void>>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The allowlist mapper for one `GET /widget/v1/pets` row: the named fields, each type-checked; anything else on
|
|
136
|
+
* the wire is dropped. null for a row that is not an object or carries no `pet_ref` (nothing to scope by).
|
|
137
|
+
*/
|
|
138
|
+
declare function widgetPetFromWire(raw: unknown): WidgetPet | null;
|
|
139
|
+
/** Build the repository over a device AuthContext (personalized bearer XOR anonymous pk). */
|
|
140
|
+
declare function createPetsRepository(auth: AuthContext): PetsRepository;
|
|
141
|
+
|
|
142
|
+
export { type PetProfileInput as P, type RegisteredPet as R, type WidgetPet as W, type PetProfilePatch as a, type WidgetPetProfile as b, PET_AGE_YEARS_MAX as c, PET_BREED_MAX as d, PET_NAME_MAX as e, PET_SPECIES_MAX as f, PET_WEIGHT_KG_MAX as g, type PetsRepository as h, createPetsRepository as i, widgetPetFromWire as w };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { c as EverfurResult } from './EverfurResult-DN9pL2Ab.js';
|
|
2
|
+
import { A as AuthContext } from './identity-CEi9GRFZ.js';
|
|
3
|
+
import { P as PetRef } from './ids-B2GAAifq.js';
|
|
4
|
+
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Server-declared bounds on `WidgetPetInput`, mirrored so a violation is refused before the wire rather
|
|
8
|
+
* than returning a refusal after the caller has already driven a registration flow. Every field is optional
|
|
9
|
+
* server-side: `POST` with an empty body registers a bare pet, which is all consent needs.
|
|
10
|
+
*
|
|
11
|
+
* WHICH STATUS THE SERVER WOULD HAVE ANSWERED, because the two are not interchangeable: a body that does not
|
|
12
|
+
* PARSE is a 400 `ValidationException` (an unknown key, the birth date pair split, a `ref` repeated in a
|
|
13
|
+
* list), rendered by the app-wide validation handler. The 422s are raised AFTER the body parses: an
|
|
14
|
+
* unsupported species and an empty PATCH body. Every rule mirrored here is refused locally, so a partner
|
|
15
|
+
* using this SDK meets neither.
|
|
16
|
+
*/
|
|
17
|
+
declare const PET_NAME_MAX = 100;
|
|
18
|
+
declare const PET_SPECIES_MAX = 50;
|
|
19
|
+
declare const PET_BREED_MAX = 100;
|
|
20
|
+
declare const PET_AGE_YEARS_MAX = 50;
|
|
21
|
+
declare const PET_WEIGHT_KG_MAX = 500;
|
|
22
|
+
/**
|
|
23
|
+
* The optional profile fields. Omit all of them to register the pet without describing it.
|
|
24
|
+
*
|
|
25
|
+
* The five identity fields merge: an absent one leaves the stored value unchanged. The health fields
|
|
26
|
+
* (`PetHealthProfileInput`) follow the partner pet body's own rules: an explicit null clears a scalar, and a list you
|
|
27
|
+
* send REPLACES the rows your integration wrote for that list (`[]` clears them). A registration is an upsert, so
|
|
28
|
+
* sending a list on a later `registerPet` replaces the earlier one rather than adding to it. Health fields need a
|
|
29
|
+
* SIGNED session (403 `identitySignatureRequired` otherwise) and a pet that is a dog or a cat.
|
|
30
|
+
*/
|
|
31
|
+
interface PetProfileInput extends PetHealthProfileInput {
|
|
32
|
+
readonly name?: string;
|
|
33
|
+
readonly species?: string;
|
|
34
|
+
readonly breed?: string;
|
|
35
|
+
readonly ageYears?: number;
|
|
36
|
+
readonly weightKg?: number;
|
|
37
|
+
}
|
|
38
|
+
/** The registered profile, as the server echoes it back. */
|
|
39
|
+
interface RegisteredPet {
|
|
40
|
+
readonly petRef: string;
|
|
41
|
+
readonly name: string | null;
|
|
42
|
+
readonly species: string | null;
|
|
43
|
+
readonly breed: string | null;
|
|
44
|
+
readonly ageYears: number | null;
|
|
45
|
+
readonly weightKg: number | null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A partial profile change for `updatePet`. An omitted field is left unchanged; `null` clears it. At least one
|
|
49
|
+
* field is required. The server refuses clearing or changing `species` to an unsupported value once the pet
|
|
50
|
+
* uses Records (Records needs a dog or a cat). A health list you send replaces your rows for that list; `[]`
|
|
51
|
+
* clears them.
|
|
52
|
+
*/
|
|
53
|
+
interface PetProfilePatch extends PetHealthProfileInput {
|
|
54
|
+
readonly name?: string | null;
|
|
55
|
+
readonly species?: string | null;
|
|
56
|
+
readonly breed?: string | null;
|
|
57
|
+
readonly ageYears?: number | null;
|
|
58
|
+
readonly weightKg?: number | null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One row of `GET /widget/v1/pets` (`WidgetPetResponse`, widget_schemas.py): the profile the partner registered,
|
|
62
|
+
* keyed by its `petRef`. The roster carries the identity fields only, never health data: the health profile is its
|
|
63
|
+
* own signed read (`getPetProfile`). `ageYears` is the registered whole-or-fractional age. Unknown wire fields are
|
|
64
|
+
* dropped at the boundary.
|
|
65
|
+
*/
|
|
66
|
+
interface WidgetPet {
|
|
67
|
+
/** The server's own id for the row; opaque, never a scope key (`petRef` is). */
|
|
68
|
+
readonly petId: string | null;
|
|
69
|
+
readonly petRef: PetRef;
|
|
70
|
+
readonly name: string | null;
|
|
71
|
+
readonly species: string | null;
|
|
72
|
+
readonly breed: string | null;
|
|
73
|
+
readonly ageYears: number | null;
|
|
74
|
+
readonly weightKg: number | null;
|
|
75
|
+
readonly updatedAt: string | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One pet read back WITH its health profile (`GET /widget/v1/pets/{pet_ref}/profile`, `WidgetPetProfileResponse`):
|
|
79
|
+
* the list row's fields plus `profileVersion`, the health scalars and your integration's four lists.
|
|
80
|
+
*/
|
|
81
|
+
interface WidgetPetProfile extends WidgetPet, PetHealthProfile {
|
|
82
|
+
}
|
|
83
|
+
interface PetsRepository {
|
|
84
|
+
/**
|
|
85
|
+
* `GET /widget/v1/pets` - every pet registered for the current user, as the server lists them. Settles
|
|
86
|
+
* `ok(readonly WidgetPet[])` on 200 (an empty list when none); `err(EverfurError)` otherwise. A row without a
|
|
87
|
+
* `pet_ref` is dropped rather than failing the page. Never throws.
|
|
88
|
+
*/
|
|
89
|
+
list(opts?: {
|
|
90
|
+
signal?: AbortSignal;
|
|
91
|
+
}): Promise<EverfurResult<readonly WidgetPet[]>>;
|
|
92
|
+
/**
|
|
93
|
+
* `POST /widget/v1/pets/{pet_ref}` - create or update the widget pet profile. Idempotent by construction:
|
|
94
|
+
* the route is an upsert, so calling it for an already-registered pet updates rather than duplicates.
|
|
95
|
+
*
|
|
96
|
+
* Settles: `ok(RegisteredPet)` on 201, `err(EverfurError)` otherwise. Never throws.
|
|
97
|
+
*/
|
|
98
|
+
registerPet(petRef: PetRef, profile?: PetProfileInput, opts?: {
|
|
99
|
+
signal?: AbortSignal;
|
|
100
|
+
}): Promise<EverfurResult<RegisteredPet>>;
|
|
101
|
+
/**
|
|
102
|
+
* `PATCH /widget/v1/pets/{pet_ref}` - change part of a registered pet's profile. Settles `ok(RegisteredPet)`
|
|
103
|
+
* on 200; an unknown pet is the not-found error; an empty change is refused before the wire.
|
|
104
|
+
*/
|
|
105
|
+
updatePet(petRef: PetRef, patch: PetProfilePatch, opts?: {
|
|
106
|
+
signal?: AbortSignal;
|
|
107
|
+
}): Promise<EverfurResult<RegisteredPet>>;
|
|
108
|
+
/**
|
|
109
|
+
* `GET /widget/v1/pets/{pet_ref}/profile` - one pet with its health profile, so a partner app can show what
|
|
110
|
+
* Everfur holds. A SIGNED session only: any other session settles to the route's 403 `identitySignatureRequired`.
|
|
111
|
+
* An unknown pet is the not-found error. Never throws.
|
|
112
|
+
*/
|
|
113
|
+
getPetProfile(petRef: PetRef, opts?: {
|
|
114
|
+
signal?: AbortSignal;
|
|
115
|
+
}): Promise<EverfurResult<WidgetPetProfile>>;
|
|
116
|
+
/**
|
|
117
|
+
* `DELETE /widget/v1/pets/{pet_ref}` - delete the pet profile. The server also retires the pet's Records
|
|
118
|
+
* data. Settles `ok(undefined)` on 204; an unknown pet is the not-found error.
|
|
119
|
+
*/
|
|
120
|
+
deletePet(petRef: PetRef, opts?: {
|
|
121
|
+
signal?: AbortSignal;
|
|
122
|
+
}): Promise<EverfurResult<void>>;
|
|
123
|
+
/**
|
|
124
|
+
* `DELETE /widget/v1/me` - permanently erase everything Everfur holds for the current user (right to
|
|
125
|
+
* erasure). Settles `ok(undefined)` on 204. A 503 means the erasure did not finish: it is retryable and a
|
|
126
|
+
* repeat call resumes it. Sent once per call (never auto-retried, so two erasures never overlap), with a
|
|
127
|
+
* per-attempt deadline of `ERASE_USER_DATA_TIMEOUT_MS`. The next request for the same user starts a fresh,
|
|
128
|
+
* empty user.
|
|
129
|
+
*/
|
|
130
|
+
eraseUserData(opts?: {
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
}): Promise<EverfurResult<void>>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The allowlist mapper for one `GET /widget/v1/pets` row: the named fields, each type-checked; anything else on
|
|
136
|
+
* the wire is dropped. null for a row that is not an object or carries no `pet_ref` (nothing to scope by).
|
|
137
|
+
*/
|
|
138
|
+
declare function widgetPetFromWire(raw: unknown): WidgetPet | null;
|
|
139
|
+
/** Build the repository over a device AuthContext (personalized bearer XOR anonymous pk). */
|
|
140
|
+
declare function createPetsRepository(auth: AuthContext): PetsRepository;
|
|
141
|
+
|
|
142
|
+
export { type PetProfileInput as P, type RegisteredPet as R, type WidgetPet as W, type PetProfilePatch as a, type WidgetPetProfile as b, PET_AGE_YEARS_MAX as c, PET_BREED_MAX as d, PET_NAME_MAX as e, PET_SPECIES_MAX as f, PET_WEIGHT_KG_MAX as g, type PetsRepository as h, createPetsRepository as i, widgetPetFromWire as w };
|