@everfur/sdk 0.1.0 → 0.3.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 +648 -1
- package/README.md +58 -23
- package/consent/package.json +8 -0
- package/dist/Chat-DPUD6dnc.d.cts +128 -0
- package/dist/Chat-DwAC2vhB.d.ts +128 -0
- package/dist/DepthViews-DNEM96Se.d.ts +16 -0
- package/dist/DepthViews-DP0R-DhB.d.cts +19 -0
- package/dist/DepthViews-D_3hl4xk.d.ts +19 -0
- package/dist/DepthViews-DbFhR4Du.d.cts +16 -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-5NeobOCd.d.ts +256 -0
- package/dist/attachments-Bw3iMQgu.d.ts +146 -0
- package/dist/attachments-CQgFrEQ7.d.cts +146 -0
- package/dist/attachments-D8T5re7e.d.cts +256 -0
- package/dist/casesRepository-ClLv6qMl.d.ts +188 -0
- package/dist/casesRepository-DHwtGRYY.d.cts +188 -0
- package/dist/chat/index.cjs +1 -1170
- package/dist/chat/index.d.cts +31 -53
- package/dist/chat/index.d.ts +31 -53
- package/dist/chat/index.js +1 -1167
- package/dist/client/index.cjs +9 -2315
- package/dist/client/index.d.cts +77 -15
- package/dist/client/index.d.ts +77 -15
- package/dist/client/index.js +9 -2215
- package/dist/{config-CiJ0PVBB.d.ts → config-CzTZGlfF.d.cts} +63 -25
- package/dist/{config-BSjBdxrZ.d.cts → config-DW60uRb9.d.ts} +63 -25
- 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-DXhqHlPU.d.ts +159 -0
- package/dist/context-XvTzq1tE.d.cts +159 -0
- package/dist/copy-Mjoo91aS.d.ts +198 -0
- package/dist/copy-bKDNigLb.d.cts +198 -0
- package/dist/core/index.cjs +13 -3175
- package/dist/core/index.d.cts +58 -12
- package/dist/core/index.d.ts +58 -12
- package/dist/core/index.js +13 -3163
- package/dist/depth-CErXCU8J.d.cts +502 -0
- package/dist/depth-DjDcJ6kH.d.ts +502 -0
- package/dist/entitlementRepository-DKdXFgTo.d.cts +698 -0
- package/dist/entitlementRepository-DSbzuyAW.d.ts +698 -0
- package/dist/{identity-DK9zORrG.d.ts → identity-BMx2SUOM.d.ts} +19 -6
- package/dist/{identity-Brl-lDd6.d.cts → identity-DI4eVx9S.d.cts} +19 -6
- 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 -4488
- package/dist/index.d.cts +29 -121
- package/dist/index.d.ts +29 -121
- package/dist/index.js +12 -4464
- 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/pets-CtQdRpWo.d.ts +92 -0
- package/dist/pets-aB8q0JyX.d.cts +92 -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-DEBzEhbp.d.cts +386 -0
- package/dist/ports-DMolTRzU.d.ts +386 -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-CjW7uDuA.d.ts +87 -0
- package/dist/requestFunnel-L-BQfi0z.d.cts +87 -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-BgQnA594.d.cts → runtime-B8s-_hv8.d.cts} +134 -59
- package/dist/{runtime-CBA-LvdM.d.ts → runtime-BR9ysG0J.d.ts} +134 -59
- 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/index.cjs +1 -0
- package/dist/televet/index.d.cts +60 -0
- package/dist/televet/index.d.ts +60 -0
- package/dist/televet/index.js +1 -0
- package/dist/testing/index.cjs +5 -823
- package/dist/testing/index.d.cts +17 -3
- package/dist/testing/index.d.ts +17 -3
- package/dist/testing/index.js +5 -820
- package/dist/testing/rn/index.cjs +1 -449
- package/dist/testing/rn/index.d.cts +17 -29
- package/dist/testing/rn/index.d.ts +17 -29
- package/dist/testing/rn/index.js +1 -444
- package/dist/testing/web/index.cjs +1 -0
- package/dist/testing/web/index.d.cts +131 -0
- package/dist/testing/web/index.d.ts +131 -0
- package/dist/testing/web/index.js +1 -0
- package/dist/timelineRows-CaohZzXS.d.cts +19 -0
- package/dist/timelineRows-DZed6dAM.d.ts +19 -0
- package/dist/typeStyle-0TydiZ1w.d.cts +19 -0
- package/dist/typeStyle-CWMsoe6b.d.ts +19 -0
- package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
- package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
- package/dist/useRecordsDepth-BHBzJ76R.d.cts +237 -0
- package/dist/useRecordsDepth-BU-OhzH6.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-C3qPIXGX.d.cts +310 -0
- package/dist/view-DtSPYpKa.d.ts +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 +217 -0
- package/dist/web/index.d.ts +217 -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 +194 -0
- package/dist/web/records/index.d.ts +194 -0
- package/dist/web/records/index.js +4 -0
- package/dist/web/televet/index.cjs +1 -0
- package/dist/web/televet/index.d.cts +50 -0
- package/dist/web/televet/index.d.ts +50 -0
- package/dist/web/televet/index.js +1 -0
- package/notifications/package.json +8 -0
- package/package.json +197 -9
- package/records/depth/package.json +8 -0
- package/server/events/device-blocked.cjs +15 -0
- package/server/events/package.json +9 -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/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,87 @@
|
|
|
1
|
+
import { c as EverfurResult, b as EverfurErrorCode } from './EverfurResult-DN9pL2Ab.js';
|
|
2
|
+
import { E as ErrorPolicyPort } from './ErrorPolicyPort-CwbfmxzJ.js';
|
|
3
|
+
import { d as EverfurRequest, F as Frame } from './config-DW60uRb9.js';
|
|
4
|
+
import { A as AuthContext } from './identity-BMx2SUOM.js';
|
|
5
|
+
|
|
6
|
+
/** Why the funnel stopped, or kept going. Every settle and every retry names one. */
|
|
7
|
+
type FunnelRetryReason = 'ok' | 'aborted' | 'terminal-code' | 'attempts-exhausted' | 'daily-quota-exhausted' | 'burst-throttle' | 'retryable-code' | 'server-reset-beyond-budget';
|
|
8
|
+
/**
|
|
9
|
+
* One funnel observation. Codes, statuses and ids ONLY: `wireMessage` is untrusted, healthcare-adjacent
|
|
10
|
+
* free text and must never leave the SDK through a telemetry sink, so it is structurally absent here.
|
|
11
|
+
*/
|
|
12
|
+
interface FunnelEvent {
|
|
13
|
+
/** Stable call-site name, e.g. `records.createRequest`. */
|
|
14
|
+
readonly call: string;
|
|
15
|
+
readonly phase: 'attempt' | 'retry' | 'settled' | 'stream.open';
|
|
16
|
+
readonly method: string;
|
|
17
|
+
readonly path: string;
|
|
18
|
+
/** 0-based attempt index. */
|
|
19
|
+
readonly attempt: number;
|
|
20
|
+
readonly ok?: boolean;
|
|
21
|
+
readonly code?: EverfurErrorCode;
|
|
22
|
+
readonly httpStatus?: number;
|
|
23
|
+
/** `X-Request-ID` of the failing response, when the server sent one. The support-ticket join key. */
|
|
24
|
+
readonly requestId?: string;
|
|
25
|
+
/** The client-minted key, when this request carried one. Never a caller-supplied value. */
|
|
26
|
+
readonly idempotencyKey?: string;
|
|
27
|
+
readonly reason?: FunnelRetryReason;
|
|
28
|
+
readonly delayMs?: number;
|
|
29
|
+
}
|
|
30
|
+
interface FunnelObserver {
|
|
31
|
+
onEvent(event: FunnelEvent): void;
|
|
32
|
+
}
|
|
33
|
+
/** The timer seam, mirroring the shape core already uses, so a test drives the deadline deterministically. */
|
|
34
|
+
interface FunnelTimers {
|
|
35
|
+
setTimeout(handler: () => void, ms: number): unknown;
|
|
36
|
+
clearTimeout(handle: unknown): void;
|
|
37
|
+
now(): number;
|
|
38
|
+
}
|
|
39
|
+
interface RequestFunnelDeps {
|
|
40
|
+
readonly auth: AuthContext;
|
|
41
|
+
readonly observer?: FunnelObserver;
|
|
42
|
+
readonly timers?: FunnelTimers;
|
|
43
|
+
/** Injected for deterministic jitter in tests. */
|
|
44
|
+
readonly rng?: () => number;
|
|
45
|
+
/** Injected so a test asserts the backoff schedule without burning wall-clock time. */
|
|
46
|
+
readonly sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
47
|
+
/** Total attempts (initial try plus retries) before a retryable failure surfaces. */
|
|
48
|
+
readonly maxAttempts?: number;
|
|
49
|
+
/**
|
|
50
|
+
* The partner's `EverfurConfig.errorPolicy`. Consulted per FAILURE, because both of its knobs are keyed
|
|
51
|
+
* on the error code, which is not known until one arrives. It can only NARROW what the funnel would do
|
|
52
|
+
* on its own: see `decideRetry`.
|
|
53
|
+
*/
|
|
54
|
+
readonly errorPolicy?: ErrorPolicyPort;
|
|
55
|
+
readonly unaryTimeoutMs?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Idempotency-key minter. Injected ONLY for deterministic tests. It is never reachable from partner
|
|
58
|
+
* code and never fed a caller-supplied value: the whole point is that the SDK owns the key.
|
|
59
|
+
*/
|
|
60
|
+
readonly newIdempotencyKey?: () => string;
|
|
61
|
+
}
|
|
62
|
+
interface FunnelSendOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Force the idempotency decision. Omit to derive it from the method (mutating -> minted). Pass `false`
|
|
65
|
+
* for a mutating request the server does not dedup and that must not claim to be idempotent.
|
|
66
|
+
*/
|
|
67
|
+
readonly idempotent?: boolean;
|
|
68
|
+
/** Per-call attempt ceiling override (a poll loop that owns its own budget passes 1). */
|
|
69
|
+
readonly maxAttempts?: number;
|
|
70
|
+
}
|
|
71
|
+
interface RequestFunnel {
|
|
72
|
+
/** The ONE unary path: headers, auth, deadline, retry, idempotency, request-id, telemetry. */
|
|
73
|
+
send<T>(call: string, req: EverfurRequest, opts?: FunnelSendOptions): Promise<EverfurResult<T>>;
|
|
74
|
+
/**
|
|
75
|
+
* Resolve device auth onto a request (bearer XOR publishable key, caller auth headers stripped).
|
|
76
|
+
* Rejects only when the TokenProvider fails; the caller settles that into its own terminal outcome.
|
|
77
|
+
*/
|
|
78
|
+
authorize(req: EverfurRequest): Promise<EverfurRequest>;
|
|
79
|
+
/**
|
|
80
|
+
* Open an SSE stream. NOT idempotency-wrapped and NOT buffered: frames are yielded as they arrive.
|
|
81
|
+
* `req` is expected to have been through `authorize`.
|
|
82
|
+
*/
|
|
83
|
+
stream(call: string, req: EverfurRequest, signal: AbortSignal): AsyncIterable<Frame>;
|
|
84
|
+
}
|
|
85
|
+
declare function createRequestFunnel(deps: RequestFunnelDeps): RequestFunnel;
|
|
86
|
+
|
|
87
|
+
export { type FunnelSendOptions as F, type RequestFunnel as R, type RequestFunnelDeps as a, createRequestFunnel as c };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { c as EverfurResult, b as EverfurErrorCode } from './EverfurResult-DN9pL2Ab.cjs';
|
|
2
|
+
import { E as ErrorPolicyPort } from './ErrorPolicyPort-CNf4uQZP.cjs';
|
|
3
|
+
import { d as EverfurRequest, F as Frame } from './config-CzTZGlfF.cjs';
|
|
4
|
+
import { A as AuthContext } from './identity-DI4eVx9S.cjs';
|
|
5
|
+
|
|
6
|
+
/** Why the funnel stopped, or kept going. Every settle and every retry names one. */
|
|
7
|
+
type FunnelRetryReason = 'ok' | 'aborted' | 'terminal-code' | 'attempts-exhausted' | 'daily-quota-exhausted' | 'burst-throttle' | 'retryable-code' | 'server-reset-beyond-budget';
|
|
8
|
+
/**
|
|
9
|
+
* One funnel observation. Codes, statuses and ids ONLY: `wireMessage` is untrusted, healthcare-adjacent
|
|
10
|
+
* free text and must never leave the SDK through a telemetry sink, so it is structurally absent here.
|
|
11
|
+
*/
|
|
12
|
+
interface FunnelEvent {
|
|
13
|
+
/** Stable call-site name, e.g. `records.createRequest`. */
|
|
14
|
+
readonly call: string;
|
|
15
|
+
readonly phase: 'attempt' | 'retry' | 'settled' | 'stream.open';
|
|
16
|
+
readonly method: string;
|
|
17
|
+
readonly path: string;
|
|
18
|
+
/** 0-based attempt index. */
|
|
19
|
+
readonly attempt: number;
|
|
20
|
+
readonly ok?: boolean;
|
|
21
|
+
readonly code?: EverfurErrorCode;
|
|
22
|
+
readonly httpStatus?: number;
|
|
23
|
+
/** `X-Request-ID` of the failing response, when the server sent one. The support-ticket join key. */
|
|
24
|
+
readonly requestId?: string;
|
|
25
|
+
/** The client-minted key, when this request carried one. Never a caller-supplied value. */
|
|
26
|
+
readonly idempotencyKey?: string;
|
|
27
|
+
readonly reason?: FunnelRetryReason;
|
|
28
|
+
readonly delayMs?: number;
|
|
29
|
+
}
|
|
30
|
+
interface FunnelObserver {
|
|
31
|
+
onEvent(event: FunnelEvent): void;
|
|
32
|
+
}
|
|
33
|
+
/** The timer seam, mirroring the shape core already uses, so a test drives the deadline deterministically. */
|
|
34
|
+
interface FunnelTimers {
|
|
35
|
+
setTimeout(handler: () => void, ms: number): unknown;
|
|
36
|
+
clearTimeout(handle: unknown): void;
|
|
37
|
+
now(): number;
|
|
38
|
+
}
|
|
39
|
+
interface RequestFunnelDeps {
|
|
40
|
+
readonly auth: AuthContext;
|
|
41
|
+
readonly observer?: FunnelObserver;
|
|
42
|
+
readonly timers?: FunnelTimers;
|
|
43
|
+
/** Injected for deterministic jitter in tests. */
|
|
44
|
+
readonly rng?: () => number;
|
|
45
|
+
/** Injected so a test asserts the backoff schedule without burning wall-clock time. */
|
|
46
|
+
readonly sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
47
|
+
/** Total attempts (initial try plus retries) before a retryable failure surfaces. */
|
|
48
|
+
readonly maxAttempts?: number;
|
|
49
|
+
/**
|
|
50
|
+
* The partner's `EverfurConfig.errorPolicy`. Consulted per FAILURE, because both of its knobs are keyed
|
|
51
|
+
* on the error code, which is not known until one arrives. It can only NARROW what the funnel would do
|
|
52
|
+
* on its own: see `decideRetry`.
|
|
53
|
+
*/
|
|
54
|
+
readonly errorPolicy?: ErrorPolicyPort;
|
|
55
|
+
readonly unaryTimeoutMs?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Idempotency-key minter. Injected ONLY for deterministic tests. It is never reachable from partner
|
|
58
|
+
* code and never fed a caller-supplied value: the whole point is that the SDK owns the key.
|
|
59
|
+
*/
|
|
60
|
+
readonly newIdempotencyKey?: () => string;
|
|
61
|
+
}
|
|
62
|
+
interface FunnelSendOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Force the idempotency decision. Omit to derive it from the method (mutating -> minted). Pass `false`
|
|
65
|
+
* for a mutating request the server does not dedup and that must not claim to be idempotent.
|
|
66
|
+
*/
|
|
67
|
+
readonly idempotent?: boolean;
|
|
68
|
+
/** Per-call attempt ceiling override (a poll loop that owns its own budget passes 1). */
|
|
69
|
+
readonly maxAttempts?: number;
|
|
70
|
+
}
|
|
71
|
+
interface RequestFunnel {
|
|
72
|
+
/** The ONE unary path: headers, auth, deadline, retry, idempotency, request-id, telemetry. */
|
|
73
|
+
send<T>(call: string, req: EverfurRequest, opts?: FunnelSendOptions): Promise<EverfurResult<T>>;
|
|
74
|
+
/**
|
|
75
|
+
* Resolve device auth onto a request (bearer XOR publishable key, caller auth headers stripped).
|
|
76
|
+
* Rejects only when the TokenProvider fails; the caller settles that into its own terminal outcome.
|
|
77
|
+
*/
|
|
78
|
+
authorize(req: EverfurRequest): Promise<EverfurRequest>;
|
|
79
|
+
/**
|
|
80
|
+
* Open an SSE stream. NOT idempotency-wrapped and NOT buffered: frames are yielded as they arrive.
|
|
81
|
+
* `req` is expected to have been through `authorize`.
|
|
82
|
+
*/
|
|
83
|
+
stream(call: string, req: EverfurRequest, signal: AbortSignal): AsyncIterable<Frame>;
|
|
84
|
+
}
|
|
85
|
+
declare function createRequestFunnel(deps: RequestFunnelDeps): RequestFunnel;
|
|
86
|
+
|
|
87
|
+
export { type FunnelSendOptions as F, type RequestFunnel as R, type RequestFunnelDeps as a, createRequestFunnel as c };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Every entitlement key the PUBLIC contract declares. Internal packs are absent by construction (the
|
|
3
3
|
* projection redacts them), so this union is exactly what a partner surface may require.
|
|
4
4
|
*/
|
|
5
|
-
type EverfurCapabilityKey = "animations.state.read" | "chat.conversation.read" | "chat.message.create" | "photo.checkup.execute" | "records.record.export" | "records.record.read" | "records.record.share" | "records.upload.create" | "video.gait.execute";
|
|
5
|
+
type EverfurCapabilityKey = "animations.state.read" | "chat.conversation.read" | "chat.message.create" | "partner_events.event.read" | "partner_events.inbound.create" | "pets.health.update" | "pets.profile.delete" | "pets.profile.update" | "photo.checkup.execute" | "records.clinic.create" | "records.record.create" | "records.record.export" | "records.record.read" | "records.record.share" | "records.upload.create" | "televet.visit.create" | "video.gait.execute";
|
|
6
6
|
|
|
7
7
|
interface LevelGrant {
|
|
8
8
|
/** capability keys this level permits */
|
|
@@ -24,7 +24,7 @@ interface ResolvedEntitlements {
|
|
|
24
24
|
*/
|
|
25
25
|
declare function resolveEntitlements(levels: readonly LevelGrant[]): ResolvedEntitlements;
|
|
26
26
|
/** Coarse UI capability ids. NOT valid entitlement keys; bridged to resource keys by `requires`. */
|
|
27
|
-
type CapabilityName = 'chat' | 'records' | 'video' | 'photo' | 'animations';
|
|
27
|
+
type CapabilityName = 'chat' | 'records' | 'recordsClinic' | 'video' | 'photo' | 'animations' | 'televet';
|
|
28
28
|
type DisabledLevel = 'contract' | 'partner_config' | 'user_entitlement' | 'version_floor' | 'kill_switch'
|
|
29
29
|
/**
|
|
30
30
|
* The SDK itself is not configured (no publishableKey, or no resolvable apiBaseUrl), so NOTHING can be
|
|
@@ -72,7 +72,13 @@ declare function requires(name: CapabilityName): readonly EverfurCapabilityKey[]
|
|
|
72
72
|
*/
|
|
73
73
|
declare function deniedDecisionsFor(level: DisabledLevel, reason: string): readonly EntitlementDecision[];
|
|
74
74
|
interface DecideOptions {
|
|
75
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* The first verdict of the scope is still being fetched. It pends ONLY a capability the decision set leaves
|
|
77
|
+
* undecided (a required key absent from it): a gate then shows its skeleton rather than the fail-closed
|
|
78
|
+
* off-state it would have to retract when the verdict lands. A capability every key of which the set already
|
|
79
|
+
* decides renders that decision at once, granted (chat, on the compiled floor) or denied (every key of a
|
|
80
|
+
* disabled runtime), so a verdict in flight never adds a loading step to what the floor has settled.
|
|
81
|
+
*/
|
|
76
82
|
readonly isPending?: boolean;
|
|
77
83
|
}
|
|
78
84
|
/**
|
|
@@ -83,4 +89,4 @@ interface DecideOptions {
|
|
|
83
89
|
*/
|
|
84
90
|
declare function decideCapability(name: CapabilityName, decisions: readonly EntitlementDecision[], opts?: DecideOptions): CapabilityDecision;
|
|
85
91
|
|
|
86
|
-
export { type
|
|
92
|
+
export { type CapabilityName as C, type DisabledLevel as D, type EntitlementDecision as E, type LevelGrant as L, type ResolvedEntitlements as R, type CapabilityDecision as a, type CapabilityDisabled as b, type DecideOptions as c, decideCapability as d, deniedDecisionsFor as e, resolveEntitlements as f, requires as r };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Every entitlement key the PUBLIC contract declares. Internal packs are absent by construction (the
|
|
3
3
|
* projection redacts them), so this union is exactly what a partner surface may require.
|
|
4
4
|
*/
|
|
5
|
-
type EverfurCapabilityKey = "animations.state.read" | "chat.conversation.read" | "chat.message.create" | "photo.checkup.execute" | "records.record.export" | "records.record.read" | "records.record.share" | "records.upload.create" | "video.gait.execute";
|
|
5
|
+
type EverfurCapabilityKey = "animations.state.read" | "chat.conversation.read" | "chat.message.create" | "partner_events.event.read" | "partner_events.inbound.create" | "pets.health.update" | "pets.profile.delete" | "pets.profile.update" | "photo.checkup.execute" | "records.clinic.create" | "records.record.create" | "records.record.export" | "records.record.read" | "records.record.share" | "records.upload.create" | "televet.visit.create" | "video.gait.execute";
|
|
6
6
|
|
|
7
7
|
interface LevelGrant {
|
|
8
8
|
/** capability keys this level permits */
|
|
@@ -24,7 +24,7 @@ interface ResolvedEntitlements {
|
|
|
24
24
|
*/
|
|
25
25
|
declare function resolveEntitlements(levels: readonly LevelGrant[]): ResolvedEntitlements;
|
|
26
26
|
/** Coarse UI capability ids. NOT valid entitlement keys; bridged to resource keys by `requires`. */
|
|
27
|
-
type CapabilityName = 'chat' | 'records' | 'video' | 'photo' | 'animations';
|
|
27
|
+
type CapabilityName = 'chat' | 'records' | 'recordsClinic' | 'video' | 'photo' | 'animations' | 'televet';
|
|
28
28
|
type DisabledLevel = 'contract' | 'partner_config' | 'user_entitlement' | 'version_floor' | 'kill_switch'
|
|
29
29
|
/**
|
|
30
30
|
* The SDK itself is not configured (no publishableKey, or no resolvable apiBaseUrl), so NOTHING can be
|
|
@@ -72,7 +72,13 @@ declare function requires(name: CapabilityName): readonly EverfurCapabilityKey[]
|
|
|
72
72
|
*/
|
|
73
73
|
declare function deniedDecisionsFor(level: DisabledLevel, reason: string): readonly EntitlementDecision[];
|
|
74
74
|
interface DecideOptions {
|
|
75
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* The first verdict of the scope is still being fetched. It pends ONLY a capability the decision set leaves
|
|
77
|
+
* undecided (a required key absent from it): a gate then shows its skeleton rather than the fail-closed
|
|
78
|
+
* off-state it would have to retract when the verdict lands. A capability every key of which the set already
|
|
79
|
+
* decides renders that decision at once, granted (chat, on the compiled floor) or denied (every key of a
|
|
80
|
+
* disabled runtime), so a verdict in flight never adds a loading step to what the floor has settled.
|
|
81
|
+
*/
|
|
76
82
|
readonly isPending?: boolean;
|
|
77
83
|
}
|
|
78
84
|
/**
|
|
@@ -83,4 +89,4 @@ interface DecideOptions {
|
|
|
83
89
|
*/
|
|
84
90
|
declare function decideCapability(name: CapabilityName, decisions: readonly EntitlementDecision[], opts?: DecideOptions): CapabilityDecision;
|
|
85
91
|
|
|
86
|
-
export { type
|
|
92
|
+
export { type CapabilityName as C, type DisabledLevel as D, type EntitlementDecision as E, type LevelGrant as L, type ResolvedEntitlements as R, type CapabilityDecision as a, type CapabilityDisabled as b, type DecideOptions as c, decideCapability as d, deniedDecisionsFor as e, resolveEntitlements as f, requires as r };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { T as TransportPort, p as EventSourceFactory, G as SdkPlatform } from './config-CzTZGlfF.cjs';
|
|
2
|
+
import { E as EntitlementDecision, C as CapabilityName } from './resolve-D4Ywz5OS.cjs';
|
|
3
|
+
import { P as PetProfileInput, R as RegisteredPet, c as PetProfilePatch } from './casesRepository-DHwtGRYY.cjs';
|
|
4
|
+
import { c as EverfurResult } from './EverfurResult-DN9pL2Ab.cjs';
|
|
5
|
+
import { J as EntitlementResolution, C as ClientBranding, M as FetchEntitlementsArgs, c as EverfurThemeInput } from './entitlementRepository-DKdXFgTo.cjs';
|
|
6
|
+
import { A as AuthContext, T as TokenProvider } from './identity-DI4eVx9S.cjs';
|
|
7
|
+
import { U as UserRef, P as PetRef, C as ConversationId } from './ids-B2GAAifq.cjs';
|
|
7
8
|
import { I as ImageCachePort, K as KvPort } from './cacheEpoch-DknKn3S0.cjs';
|
|
8
9
|
import { T as TelemetryPort } from './TelemetryPort-BDNr00hu.cjs';
|
|
9
|
-
import {
|
|
10
|
-
import { F as FileHandle } from './FilePort-BabWrv7I.cjs';
|
|
10
|
+
import { U as UploadPort, m as ChatController } from './ports-DEBzEhbp.cjs';
|
|
11
11
|
import { C as CameraPort } from './CameraPort-Cv31Pz7g.cjs';
|
|
12
|
+
import { E as ErrorPolicyPort } from './ErrorPolicyPort-CNf4uQZP.cjs';
|
|
13
|
+
import { U as UploadTransport } from './ports-BN6RHF9W.cjs';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Opt-in encrypted secret storage. Backed by a Keychain / Keystore native peer through an rn-layer adapter.
|
|
@@ -69,6 +71,13 @@ interface EntitlementPollerDeps {
|
|
|
69
71
|
readonly update: (decisions: readonly EntitlementDecision[], branding: ClientBranding | null) => void;
|
|
70
72
|
/** Optional region hint forwarded to the endpoint. */
|
|
71
73
|
readonly region?: string;
|
|
74
|
+
/** Called synchronously as each fetch starts; the runtime marks the store pending for a scope's first one. */
|
|
75
|
+
readonly onFetch?: () => void;
|
|
76
|
+
/**
|
|
77
|
+
* Called when a fetch settles for the current scope, whatever the outcome (`updated` after `update`,
|
|
78
|
+
* `notModified`, `failed`, a thrown resolve). Not called for a fetch a refresh() or stop() superseded.
|
|
79
|
+
*/
|
|
80
|
+
readonly onSettled?: () => void;
|
|
72
81
|
readonly telemetry?: TelemetryPort;
|
|
73
82
|
/** Test seam; defaults to global timers (unref'd so a live poll never pins a Node event loop). */
|
|
74
83
|
readonly scheduler?: PollScheduler;
|
|
@@ -89,56 +98,15 @@ interface EntitlementPoller {
|
|
|
89
98
|
* the next request must be UNCONDITIONAL (no If-None-Match) to force a fresh 200 for the new scope.
|
|
90
99
|
*/
|
|
91
100
|
refresh(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Settle ONE verdict fetch and report it: the poll already in flight when one is (the warm-up rides the
|
|
103
|
+
* first tick rather than racing it), otherwise a fresh one. On a poller that was never started it fetches
|
|
104
|
+
* once and arms nothing. Resolves null when a stop() or refresh() superseded the fetch before it landed.
|
|
105
|
+
*/
|
|
106
|
+
prime(): Promise<EntitlementResolution | null>;
|
|
92
107
|
}
|
|
93
108
|
declare function createEntitlementPoller(deps: EntitlementPollerDeps): EntitlementPoller;
|
|
94
109
|
|
|
95
|
-
/** The presigned POST/PUT policy returned by `/uploads/initiate` (SPEC-11b §2.1). */
|
|
96
|
-
interface PresignedPolicy {
|
|
97
|
-
/** Absolute S3 endpoint URL to POST/PUT the bytes at. */
|
|
98
|
-
readonly url: string;
|
|
99
|
-
/** POST-policy form fields to include with the upload (empty for a plain PUT). */
|
|
100
|
-
readonly fields: Readonly<Record<string, string>>;
|
|
101
|
-
/** The owned-uploads-prefixed key the analyze call then references. */
|
|
102
|
-
readonly s3Key: string;
|
|
103
|
-
/** epoch seconds the policy expires; telemetry only. */
|
|
104
|
-
readonly expiresAt: number | null;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* The native upload seam. It PUTs `file` at the presigned `target` (SPEC-11b §2.1). `idempotencyKey` is reused
|
|
108
|
-
* on every retry so a re-uploaded identical file dedupes server-side. A network failure REJECTS; the controller
|
|
109
|
-
* normalizes that to a `mediaUploadFailed` and exposes a retake affordance (never auto-retried, SPEC-00 §3.2).
|
|
110
|
-
*
|
|
111
|
-
* NOTE: the spine `FilePort.presignedPut(file, { idempotencyKey, signal })` has no slot for the presigned
|
|
112
|
-
* target; this richer port is the shape it must grow to. See the manifest gap note.
|
|
113
|
-
*/
|
|
114
|
-
interface UploadPort {
|
|
115
|
-
presignedPut(file: FileHandle, opts: {
|
|
116
|
-
readonly target: PresignedPolicy;
|
|
117
|
-
readonly idempotencyKey: string;
|
|
118
|
-
readonly signal?: AbortSignal;
|
|
119
|
-
}): Promise<void>;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
interface UploadPolicyWire {
|
|
123
|
-
readonly upload_id: string;
|
|
124
|
-
readonly upload_url: string;
|
|
125
|
-
readonly upload_fields: Readonly<Record<string, string>>;
|
|
126
|
-
readonly expires_in_seconds: number;
|
|
127
|
-
readonly max_content_length: number;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Platform-specific: the rn adapter binds `expo-file-system` (uploadAsync) behind `optionalModule`; the
|
|
131
|
-
* controller stays platform-neutral and never sees a native module. Resolves on S3's 204; rejects on a
|
|
132
|
-
* policy 403 / stream failure, which the controller normalizes to a typed `mediaUploadFailed` (never a throw
|
|
133
|
-
* that escapes the controller).
|
|
134
|
-
*/
|
|
135
|
-
interface UploadTransport {
|
|
136
|
-
postMultipart(policy: UploadPolicyWire, file: FileHandle, opts: {
|
|
137
|
-
readonly onProgress?: (fraction: number) => void;
|
|
138
|
-
readonly signal?: AbortSignal;
|
|
139
|
-
}): Promise<void>;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
110
|
/**
|
|
143
111
|
* The public init config the host passes at EverfurProvider mount: the lean client subset
|
|
144
112
|
* (publishableKey / apiBaseUrl / contractVersion / transport / debug) PLUS the host-seam ports. The client
|
|
@@ -189,8 +157,8 @@ interface RuntimeUser {
|
|
|
189
157
|
readonly userRef: UserRef;
|
|
190
158
|
readonly getToken: TokenProvider;
|
|
191
159
|
}
|
|
192
|
-
/**
|
|
193
|
-
type RuntimeTheme =
|
|
160
|
+
/** The client `theme` prop as the provider hands it over (tolerant shape; sanitized by the theme provider). */
|
|
161
|
+
type RuntimeTheme = EverfurThemeInput;
|
|
194
162
|
interface CreateEverfurRuntimeInput {
|
|
195
163
|
readonly config: EverfurRuntimeConfig;
|
|
196
164
|
/** null => general (anonymous) mode: pk alone on the wire. */
|
|
@@ -221,6 +189,12 @@ interface CapabilityServices {
|
|
|
221
189
|
readonly uploadTransport: UploadTransport;
|
|
222
190
|
readonly imageCache: ImageCachePort;
|
|
223
191
|
readonly kv: KvPort;
|
|
192
|
+
/**
|
|
193
|
+
* The API base URL the transport was built for (the config's, or the environment's), or null with an
|
|
194
|
+
* injected transport and no base URL. A relative link the server returns (a share link's path) is
|
|
195
|
+
* resolved against this origin, never opened raw.
|
|
196
|
+
*/
|
|
197
|
+
readonly apiBaseUrl: string | null;
|
|
224
198
|
}
|
|
225
199
|
/**
|
|
226
200
|
* The ONE ref-counted capability registry (SPEC-10 §7.4). Chat (the spine) is acquired by its typed method;
|
|
@@ -236,6 +210,12 @@ interface CapabilityRegistry {
|
|
|
236
210
|
/** Chat is the spine capability; the registry constructs + ref-counts it directly. */
|
|
237
211
|
acquireChat(scope: ChatScope): ChatController;
|
|
238
212
|
releaseChat(controller: ChatController): void;
|
|
213
|
+
/**
|
|
214
|
+
* The live controller for a scope WITHOUT taking a hold, or null. A mount reads it synchronously on its
|
|
215
|
+
* first render so a scope `prepare()` primed renders its settled snapshot at once (no bootstrapping frame),
|
|
216
|
+
* then takes its hold through `acquireChat` in the commit effect as before.
|
|
217
|
+
*/
|
|
218
|
+
peekChat(scope: ChatScope): ChatController | null;
|
|
239
219
|
/**
|
|
240
220
|
* Ref-counted acquire for the tree-shakeable capabilities. Two calls with the same (kind, scopeKey) under
|
|
241
221
|
* the current epoch share ONE controller; the last release disposes it via `destroy`.
|
|
@@ -249,7 +229,12 @@ type ChatControllerRegistry = CapabilityRegistry;
|
|
|
249
229
|
/** The already-resolved server verdict the capability hooks render (never re-folded here). */
|
|
250
230
|
interface EntitlementSnapshot {
|
|
251
231
|
readonly decisions: readonly EntitlementDecision[];
|
|
252
|
-
/**
|
|
232
|
+
/**
|
|
233
|
+
* The first verdict of the current scope is still being fetched. `decideCapability` pends only what the
|
|
234
|
+
* decisions leave undecided: a key absent from the compiled floor (records) shows its skeleton, a key the
|
|
235
|
+
* floor grants (chat) renders at once. false once that fetch settles, whatever it settled to (a failure keeps
|
|
236
|
+
* the floor: fail-closed, never a skeleton left up), and always on a runtime that never fetched.
|
|
237
|
+
*/
|
|
253
238
|
readonly isPending: boolean;
|
|
254
239
|
/**
|
|
255
240
|
* Server-driven theme branding from the SAME entitlements body (orthogonal to decisions). null/absent =>
|
|
@@ -267,6 +252,48 @@ interface EntitlementStore {
|
|
|
267
252
|
subscribe(listener: () => void): () => void;
|
|
268
253
|
getSnapshot(): EntitlementSnapshot;
|
|
269
254
|
}
|
|
255
|
+
interface PrepareOptions {
|
|
256
|
+
/**
|
|
257
|
+
* The pet the first chat mount will be scoped to. Names it and the warm-up ALSO primes that scope's chat
|
|
258
|
+
* bootstrap (conversation + suggested prompts), held for the first mount. It registers nothing: a pet the
|
|
259
|
+
* partner has not upserted is registered with `registerPet`, not here.
|
|
260
|
+
*/
|
|
261
|
+
readonly petRef?: PetRef;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* `ready`: token minted (when a user is set), verdict resolved, chat primed (when a pet was named).
|
|
265
|
+
* `partial`: the token is ready but the verdict fetch or the chat prime settled to an error; surfaces still
|
|
266
|
+
* mount and self-heal (the poller re-polls, the first send recreates the conversation).
|
|
267
|
+
* `failed`: nothing authenticated can proceed: the mint failed, or the runtime is disposed / not configured.
|
|
268
|
+
*/
|
|
269
|
+
type PrepareStatus = 'ready' | 'partial' | 'failed';
|
|
270
|
+
/** The settled warm-up. Each step carries the same `EverfurError` the surfaces settle to; nothing throws. */
|
|
271
|
+
interface PrepareResult {
|
|
272
|
+
readonly status: PrepareStatus;
|
|
273
|
+
/** Milliseconds from the `prepare()` call to settlement: the login-to-ready number, also on telemetry. */
|
|
274
|
+
readonly durationMs: number;
|
|
275
|
+
/** The session-token mint. `ok` without a user (anonymous mode mints nothing). */
|
|
276
|
+
readonly session: EverfurResult<void>;
|
|
277
|
+
/** The entitlement verdict fetch into the store every gate reads. */
|
|
278
|
+
readonly entitlements: EverfurResult<void>;
|
|
279
|
+
/** The chat prime for `petRef`; absent when no pet was named. */
|
|
280
|
+
readonly chat?: EverfurResult<void>;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* What a before-logout hook receives: who is leaving, and an auth context that keeps signing requests for the
|
|
284
|
+
* length of the hook budget even though the runtime drops the live identity synchronously right after the hooks
|
|
285
|
+
* start. The bearer is read from the identity's cache at that instant (or minted then, if none was cached), so a
|
|
286
|
+
* request the hook issues after an `await` still goes out under the signed-out user, never re-minted afterwards.
|
|
287
|
+
*/
|
|
288
|
+
interface BeforeLogoutContext {
|
|
289
|
+
readonly userRef: UserRef;
|
|
290
|
+
readonly auth: AuthContext;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* A hook that runs when a signed-in user is about to leave (`logout()`, `setUser(null)`, a switch to another
|
|
294
|
+
* user). It may return a promise; `logout()` waits for it up to `LOGOUT_HOOK_BUDGET_MS` and never fails on it.
|
|
295
|
+
*/
|
|
296
|
+
type BeforeLogoutHook = (context: BeforeLogoutContext) => unknown;
|
|
270
297
|
interface EverfurRuntime {
|
|
271
298
|
readonly registry: CapabilityRegistry;
|
|
272
299
|
/**
|
|
@@ -277,6 +304,19 @@ interface EverfurRuntime {
|
|
|
277
304
|
* dead runtime.
|
|
278
305
|
*/
|
|
279
306
|
readonly isDisposed: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Bumped by every re-scope. React surfaces put this in their acquire-effect deps so an imperative
|
|
309
|
+
* verb that changes no identity STRING still re-acquires.
|
|
310
|
+
*
|
|
311
|
+
* WHY THIS EXISTS. `logout()` on an already-anonymous runtime rotates the session id and re-scopes,
|
|
312
|
+
* but nothing a React effect watches changes: `userRef` is null on both sides, so the context memo
|
|
313
|
+
* republishes the same object and the effect never re-runs. The mounted surface kept serving the
|
|
314
|
+
* PREVIOUS anonymous visitor's scope, because the captured AuthContext holds the OLD session id and
|
|
315
|
+
* the widget plane derives anonymous identity as `anon-{session_id}`. On a shared device that is one
|
|
316
|
+
* visitor reading the last one's conversation. The epoch is the only thing that changes in that
|
|
317
|
+
* transition, so it is the only honest dep.
|
|
318
|
+
*/
|
|
319
|
+
readonly scopeEpoch: number;
|
|
280
320
|
readonly entitlements: EntitlementStore;
|
|
281
321
|
/** null => logout: drops the cached bearer and re-scopes every open capability. */
|
|
282
322
|
setUser(user: RuntimeUser | null): void;
|
|
@@ -290,6 +330,14 @@ interface EverfurRuntime {
|
|
|
290
330
|
* calling `setUser(nextUser)`.
|
|
291
331
|
*/
|
|
292
332
|
logout(): Promise<void>;
|
|
333
|
+
/**
|
|
334
|
+
* Run `hook` BEFORE a signed-in user leaves: on `logout()`, on `setUser(null)` and on a switch to another user,
|
|
335
|
+
* with the leaving user's `userRef` and a grace auth that still signs requests. Started synchronously, before
|
|
336
|
+
* the bearer drops and the capabilities re-scope; `logout()` additionally awaits it, bounded by
|
|
337
|
+
* `LOGOUT_HOOK_BUDGET_MS`, and a hook that throws, rejects or hangs never fails or delays sign-out beyond that.
|
|
338
|
+
* The per-user KV sweep runs after the hooks. Returns the unsubscribe. Nothing runs for an anonymous runtime.
|
|
339
|
+
*/
|
|
340
|
+
onBeforeLogout(hook: BeforeLogoutHook): () => void;
|
|
293
341
|
/** Re-scopes pet-bound controllers in the same commit. */
|
|
294
342
|
setActivePet(pet: PetRef | null): void;
|
|
295
343
|
/**
|
|
@@ -302,6 +350,19 @@ interface EverfurRuntime {
|
|
|
302
350
|
* way to call it. This is that way. Idempotent: the route is an upsert keyed on `pet_ref`.
|
|
303
351
|
*/
|
|
304
352
|
registerPet(pet: PetRef, profile?: PetProfileInput): Promise<EverfurResult<RegisteredPet>>;
|
|
353
|
+
/**
|
|
354
|
+
* Change part of a registered pet's profile (`PATCH /widget/v1/pets/{pet_ref}`). An omitted field is unchanged,
|
|
355
|
+
* `null` clears it. An unknown pet settles to the not-found error.
|
|
356
|
+
*/
|
|
357
|
+
updatePet(pet: PetRef, patch: PetProfilePatch): Promise<EverfurResult<RegisteredPet>>;
|
|
358
|
+
/** Delete a pet profile (`DELETE /widget/v1/pets/{pet_ref}`); the server also retires its Records data. */
|
|
359
|
+
deletePet(pet: PetRef): Promise<EverfurResult<void>>;
|
|
360
|
+
/**
|
|
361
|
+
* Permanently erase everything Everfur holds for the current user (`DELETE /widget/v1/me`). A failure is
|
|
362
|
+
* retryable and a repeat call resumes the erasure. It does not sign the user out: call `logout()` or
|
|
363
|
+
* `setUser(null)` afterwards so mounted surfaces stop showing the erased data.
|
|
364
|
+
*/
|
|
365
|
+
eraseUserData(): Promise<EverfurResult<void>>;
|
|
305
366
|
/**
|
|
306
367
|
* Replace the rendered entitlement verdict (a future poller / a manifest refresh). The SERVER stays
|
|
307
368
|
* authoritative: this only feeds the render store, so the pending/enabled paths become reachable while a
|
|
@@ -310,6 +371,14 @@ interface EverfurRuntime {
|
|
|
310
371
|
updateEntitlements(next: EntitlementSnapshot): void;
|
|
311
372
|
/** Navigate / mount a prebuilt capability screen (host-routed). No-op at the spine. */
|
|
312
373
|
open(capability: CapabilityName): void;
|
|
374
|
+
/**
|
|
375
|
+
* Warm up during the partner's OWN login so no Everfur surface adds a loading step of its own: mint the
|
|
376
|
+
* session token, resolve the entitlement verdict into the gate store and, when a pet is named, prime its
|
|
377
|
+
* chat bootstrap. Concurrent calls coalesce onto one run; a settled `ready` is returned again without I/O
|
|
378
|
+
* until the identity or pet re-scopes; a `partial` / `failed` run is retried on the next call. Never
|
|
379
|
+
* throws. Emits `sdk.prepare.timing` (`durationMs`, `status`) on the host telemetry sink once per run.
|
|
380
|
+
*/
|
|
381
|
+
prepare(opts?: PrepareOptions): Promise<PrepareResult>;
|
|
313
382
|
/**
|
|
314
383
|
* Idempotent teardown: aborts in-flight capability requests, tears down every open SSE stream, and stops
|
|
315
384
|
* the entitlement poller (an in-flight entitlement poll's result is DROPPED, not aborted mid-flight).
|
|
@@ -333,6 +402,12 @@ interface CreateRuntimeOptions {
|
|
|
333
402
|
* through). Absent (web/expo, or an injected transport) => the fetch-body streaming path is used.
|
|
334
403
|
*/
|
|
335
404
|
readonly eventSourceFactory?: EventSourceFactory;
|
|
405
|
+
/**
|
|
406
|
+
* Host-wiring seam: which entry point built this runtime, sent as X-Everfur-SDK-Platform on every request.
|
|
407
|
+
* The rn facade leaves it at the default; the web facade names `web`. Never read from partner config, for
|
|
408
|
+
* the reason on `SdkPlatform`.
|
|
409
|
+
*/
|
|
410
|
+
readonly platform?: SdkPlatform;
|
|
336
411
|
}
|
|
337
412
|
/**
|
|
338
413
|
* Construct the runtime once (EverfurProvider mount). Builds the transport (injected test seam, else the
|
|
@@ -346,4 +421,4 @@ interface CreateRuntimeOptions {
|
|
|
346
421
|
*/
|
|
347
422
|
declare function createEverfurRuntime(input: CreateEverfurRuntimeInput, opts?: CreateRuntimeOptions): EverfurRuntime;
|
|
348
423
|
|
|
349
|
-
export { type CapabilityKind as C, type
|
|
424
|
+
export { type BeforeLogoutContext as B, type CapabilityKind as C, type EntitlementSnapshot as E, type LogLevel as L, MIN_POLL_INTERVAL_SECONDS as M, NULL_SECURE_STORE as N, type PrepareOptions as P, type RuntimeTheme as R, type SecureStorePort as S, type TimerHandle as T, type LogRecord as a, type LogSink as b, type PrepareResult as c, type PrepareStatus as d, type BeforeLogoutHook as e, type CapabilityRegistry as f, type CapabilityServices as g, type ChatControllerRegistry as h, type ChatScope as i, type CreateEverfurRuntimeInput as j, type CreateRuntimeOptions as k, type EntitlementPoller as l, type EntitlementPollerDeps as m, type EntitlementStore as n, type EverfurRuntime as o, type EverfurRuntimeConfig as p, type PollScheduler as q, type RuntimeUser as r, createEntitlementPoller as s, createEverfurRuntime as t };
|