@everfur/sdk 0.1.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/LICENSE +21 -0
  3. package/README.md +161 -0
  4. package/animations/package.json +8 -0
  5. package/chat/package.json +8 -0
  6. package/client/package.json +8 -0
  7. package/core/package.json +8 -0
  8. package/dist/CameraPort-Cv31Pz7g.d.cts +29 -0
  9. package/dist/CameraPort-Cv31Pz7g.d.ts +29 -0
  10. package/dist/ChatController-CKdBvPj2.d.ts +146 -0
  11. package/dist/ChatController-CpUMvvZf.d.cts +146 -0
  12. package/dist/EverfurResult-D92-uL82.d.cts +240 -0
  13. package/dist/EverfurResult-D92-uL82.d.ts +240 -0
  14. package/dist/FilePort-BabWrv7I.d.cts +22 -0
  15. package/dist/FilePort-BabWrv7I.d.ts +22 -0
  16. package/dist/PhotoController-BItt5M7u.d.cts +43 -0
  17. package/dist/PhotoController-D8zMTdcW.d.ts +43 -0
  18. package/dist/TelemetryPort-BDNr00hu.d.cts +12 -0
  19. package/dist/TelemetryPort-BDNr00hu.d.ts +12 -0
  20. package/dist/animations/index.cjs +1997 -0
  21. package/dist/animations/index.d.cts +517 -0
  22. package/dist/animations/index.d.ts +517 -0
  23. package/dist/animations/index.js +1972 -0
  24. package/dist/cacheEpoch-DknKn3S0.d.cts +36 -0
  25. package/dist/cacheEpoch-DknKn3S0.d.ts +36 -0
  26. package/dist/chat/index.cjs +1170 -0
  27. package/dist/chat/index.d.cts +59 -0
  28. package/dist/chat/index.d.ts +59 -0
  29. package/dist/chat/index.js +1167 -0
  30. package/dist/client/index.cjs +2317 -0
  31. package/dist/client/index.d.cts +65 -0
  32. package/dist/client/index.d.ts +65 -0
  33. package/dist/client/index.js +2217 -0
  34. package/dist/config-BSjBdxrZ.d.cts +501 -0
  35. package/dist/config-CiJ0PVBB.d.ts +501 -0
  36. package/dist/core/index.cjs +3175 -0
  37. package/dist/core/index.d.cts +70 -0
  38. package/dist/core/index.d.ts +70 -0
  39. package/dist/core/index.js +3163 -0
  40. package/dist/identity-Brl-lDd6.d.cts +91 -0
  41. package/dist/identity-DK9zORrG.d.ts +91 -0
  42. package/dist/ids-CJ1S6adf.d.cts +46 -0
  43. package/dist/ids-CJ1S6adf.d.ts +46 -0
  44. package/dist/index.cjs +4488 -0
  45. package/dist/index.d.cts +156 -0
  46. package/dist/index.d.ts +156 -0
  47. package/dist/index.js +4464 -0
  48. package/dist/petsRepository-BEGb97M9.d.cts +326 -0
  49. package/dist/petsRepository-Bu18r2kK.d.ts +326 -0
  50. package/dist/photo/index.cjs +2189 -0
  51. package/dist/photo/index.d.cts +43 -0
  52. package/dist/photo/index.d.ts +43 -0
  53. package/dist/photo/index.js +2186 -0
  54. package/dist/projection-CeIUsbSk.d.cts +8 -0
  55. package/dist/projection-CeIUsbSk.d.ts +8 -0
  56. package/dist/records/index.cjs +2840 -0
  57. package/dist/records/index.d.cts +224 -0
  58. package/dist/records/index.d.ts +224 -0
  59. package/dist/records/index.js +2834 -0
  60. package/dist/requestFunnel-DuUH-kAe.d.cts +28 -0
  61. package/dist/requestFunnel-dio5OmR9.d.ts +28 -0
  62. package/dist/resolve-Dq_4_agU.d.cts +86 -0
  63. package/dist/resolve-Dq_4_agU.d.ts +86 -0
  64. package/dist/runtime-BgQnA594.d.cts +349 -0
  65. package/dist/runtime-CBA-LvdM.d.ts +349 -0
  66. package/dist/server/index.cjs +533 -0
  67. package/dist/server/index.d.cts +48 -0
  68. package/dist/server/index.d.ts +48 -0
  69. package/dist/server/index.js +530 -0
  70. package/dist/testing/index.cjs +825 -0
  71. package/dist/testing/index.d.cts +113 -0
  72. package/dist/testing/index.d.ts +113 -0
  73. package/dist/testing/index.js +822 -0
  74. package/dist/testing/rn/index.cjs +449 -0
  75. package/dist/testing/rn/index.d.cts +49 -0
  76. package/dist/testing/rn/index.d.ts +49 -0
  77. package/dist/testing/rn/index.js +444 -0
  78. package/dist/video/index.cjs +1941 -0
  79. package/dist/video/index.d.cts +66 -0
  80. package/dist/video/index.d.ts +66 -0
  81. package/dist/video/index.js +1938 -0
  82. package/package.json +311 -0
  83. package/photo/package.json +8 -0
  84. package/records/package.json +8 -0
  85. package/server/device-blocked.cjs +15 -0
  86. package/server/package.json +9 -0
  87. package/testing/package.json +8 -0
  88. package/testing/rn/package.json +8 -0
  89. package/video/package.json +8 -0
@@ -0,0 +1,113 @@
1
+ import { E as EverfurResult } from '../EverfurResult-D92-uL82.cjs';
2
+ import { T as TransportPort, E as EverfurRequest, F as Frame } from '../config-BSjBdxrZ.cjs';
3
+
4
+ /** One scripted stream outcome. Each block is a JSON `data:` payload string; MockTransport wraps it in SSE. */
5
+ type StreamScript = {
6
+ readonly kind: 'sse';
7
+ readonly blocks: readonly string[];
8
+ readonly gapMs?: number;
9
+ } | {
10
+ readonly kind: 'stall';
11
+ readonly preface?: readonly string[];
12
+ } | {
13
+ readonly kind: 'drop';
14
+ readonly blocks: readonly string[];
15
+ } | {
16
+ readonly kind: 'partialByte';
17
+ readonly body: string;
18
+ readonly splitAt: readonly number[];
19
+ } | {
20
+ readonly kind: 'httpError';
21
+ readonly status: number;
22
+ readonly body?: unknown;
23
+ } | {
24
+ readonly kind: 'network';
25
+ };
26
+ /** One scripted unary response (createConversation / getPrompts). */
27
+ interface RequestScript {
28
+ readonly status?: number;
29
+ readonly body?: unknown;
30
+ }
31
+ /** A captured stream request, for auth-refresh assertions. */
32
+ interface StreamRequestRecord {
33
+ readonly path: string;
34
+ readonly authorization: string | null;
35
+ readonly partnerKey: string | null;
36
+ readonly idempotencyKey: string | null;
37
+ /**
38
+ * The request body, so a test can assert WHAT was streamed, not merely that a stream happened.
39
+ *
40
+ * This was absent, and its absence had a real cost: the chat send body carried a `pet_ref` the server
41
+ * silently discarded (`extra="ignore"`) on every turn, and no test could observe it because the only
42
+ * captured streaming fields were the path and three headers.
43
+ */
44
+ readonly body?: unknown;
45
+ /**
46
+ * ALL request headers, so a test can assert any of them rather than only the three that happened to be
47
+ * named here. The narrow capture was its own blind spot: `x-everfur-session-id` is the header that makes
48
+ * anonymous identity stable, and no test could observe whether it was sent, or whether it matched the one
49
+ * on the unary create.
50
+ */
51
+ readonly headers?: Readonly<Record<string, string>>;
52
+ }
53
+ /** A captured unary request. */
54
+ interface RequestRecord {
55
+ readonly method: string;
56
+ readonly path: string;
57
+ readonly headers: Readonly<Record<string, string>>;
58
+ readonly body?: unknown;
59
+ /**
60
+ * Query parameters, so a test can assert them. They were dropped from the record entirely, which is the
61
+ * same blind spot the missing stream `body` and `headers` were: a value the SDK puts on the wire that no
62
+ * test could see. `region` on the entitlements poll is one such parameter.
63
+ */
64
+ readonly query?: Readonly<Record<string, string | number | undefined>>;
65
+ }
66
+ /** Wire-payload builders so tests read declaratively (`wire.delta('Hi')`). */
67
+ declare const wire: Readonly<{
68
+ accepted: (streamId?: string) => string;
69
+ heartbeat: () => string;
70
+ delta: (text: string) => string;
71
+ done: (fields?: Record<string, unknown>) => string;
72
+ error: (code: string, retryable?: boolean) => string;
73
+ }>;
74
+ /** Construction options. `strictPaths` is opt-OUT so the safe behaviour is the default. */
75
+ interface MockTransportOptions {
76
+ /**
77
+ * Reject a request whose path the backend does not serve. Default true.
78
+ * Set false only to script a route deliberately outside the known set.
79
+ */
80
+ readonly strictPaths?: boolean;
81
+ }
82
+ declare class MockTransport implements TransportPort {
83
+ private readonly strictPaths;
84
+ private readonly streamQueue;
85
+ private readonly requestQueue;
86
+ /** The last script dequeued, replayed once the queue drains. See `request` for why. */
87
+ /**
88
+ * The last scripted response, KEYED BY ENDPOINT.
89
+ *
90
+ * It used to be a single field, so a `enqueueRequest({ status: 500 })` scripted for one endpoint kept
91
+ * replaying for every OTHER endpoint once the queue drained — the comment below says the fallback means
92
+ * "this endpoint is down", and a global field cannot mean that. A fault leaked across endpoints and a
93
+ * test could assert an outcome the SDK would never produce.
94
+ */
95
+ private lastRequestScript;
96
+ private openCount;
97
+ constructor(options?: MockTransportOptions);
98
+ readonly requests: RequestRecord[];
99
+ readonly streamRequests: StreamRequestRecord[];
100
+ /** Live count of streams that have opened but not yet torn down. MUST return to 0 after a cancel. */
101
+ get openStreams(): number;
102
+ /** Peak concurrent open streams observed (bulkhead assertions). */
103
+ private peak;
104
+ get peakOpenStreams(): number;
105
+ enqueueStream(...scripts: StreamScript[]): this;
106
+ enqueueRequest(...scripts: RequestScript[]): this;
107
+ request<T>(req: EverfurRequest): Promise<EverfurResult<T>>;
108
+ stream(req: EverfurRequest, signal: AbortSignal): AsyncIterable<Frame>;
109
+ private openStream;
110
+ private runScript;
111
+ }
112
+
113
+ export { MockTransport, type RequestRecord, type RequestScript, type StreamRequestRecord, type StreamScript, wire };
@@ -0,0 +1,113 @@
1
+ import { E as EverfurResult } from '../EverfurResult-D92-uL82.js';
2
+ import { T as TransportPort, E as EverfurRequest, F as Frame } from '../config-CiJ0PVBB.js';
3
+
4
+ /** One scripted stream outcome. Each block is a JSON `data:` payload string; MockTransport wraps it in SSE. */
5
+ type StreamScript = {
6
+ readonly kind: 'sse';
7
+ readonly blocks: readonly string[];
8
+ readonly gapMs?: number;
9
+ } | {
10
+ readonly kind: 'stall';
11
+ readonly preface?: readonly string[];
12
+ } | {
13
+ readonly kind: 'drop';
14
+ readonly blocks: readonly string[];
15
+ } | {
16
+ readonly kind: 'partialByte';
17
+ readonly body: string;
18
+ readonly splitAt: readonly number[];
19
+ } | {
20
+ readonly kind: 'httpError';
21
+ readonly status: number;
22
+ readonly body?: unknown;
23
+ } | {
24
+ readonly kind: 'network';
25
+ };
26
+ /** One scripted unary response (createConversation / getPrompts). */
27
+ interface RequestScript {
28
+ readonly status?: number;
29
+ readonly body?: unknown;
30
+ }
31
+ /** A captured stream request, for auth-refresh assertions. */
32
+ interface StreamRequestRecord {
33
+ readonly path: string;
34
+ readonly authorization: string | null;
35
+ readonly partnerKey: string | null;
36
+ readonly idempotencyKey: string | null;
37
+ /**
38
+ * The request body, so a test can assert WHAT was streamed, not merely that a stream happened.
39
+ *
40
+ * This was absent, and its absence had a real cost: the chat send body carried a `pet_ref` the server
41
+ * silently discarded (`extra="ignore"`) on every turn, and no test could observe it because the only
42
+ * captured streaming fields were the path and three headers.
43
+ */
44
+ readonly body?: unknown;
45
+ /**
46
+ * ALL request headers, so a test can assert any of them rather than only the three that happened to be
47
+ * named here. The narrow capture was its own blind spot: `x-everfur-session-id` is the header that makes
48
+ * anonymous identity stable, and no test could observe whether it was sent, or whether it matched the one
49
+ * on the unary create.
50
+ */
51
+ readonly headers?: Readonly<Record<string, string>>;
52
+ }
53
+ /** A captured unary request. */
54
+ interface RequestRecord {
55
+ readonly method: string;
56
+ readonly path: string;
57
+ readonly headers: Readonly<Record<string, string>>;
58
+ readonly body?: unknown;
59
+ /**
60
+ * Query parameters, so a test can assert them. They were dropped from the record entirely, which is the
61
+ * same blind spot the missing stream `body` and `headers` were: a value the SDK puts on the wire that no
62
+ * test could see. `region` on the entitlements poll is one such parameter.
63
+ */
64
+ readonly query?: Readonly<Record<string, string | number | undefined>>;
65
+ }
66
+ /** Wire-payload builders so tests read declaratively (`wire.delta('Hi')`). */
67
+ declare const wire: Readonly<{
68
+ accepted: (streamId?: string) => string;
69
+ heartbeat: () => string;
70
+ delta: (text: string) => string;
71
+ done: (fields?: Record<string, unknown>) => string;
72
+ error: (code: string, retryable?: boolean) => string;
73
+ }>;
74
+ /** Construction options. `strictPaths` is opt-OUT so the safe behaviour is the default. */
75
+ interface MockTransportOptions {
76
+ /**
77
+ * Reject a request whose path the backend does not serve. Default true.
78
+ * Set false only to script a route deliberately outside the known set.
79
+ */
80
+ readonly strictPaths?: boolean;
81
+ }
82
+ declare class MockTransport implements TransportPort {
83
+ private readonly strictPaths;
84
+ private readonly streamQueue;
85
+ private readonly requestQueue;
86
+ /** The last script dequeued, replayed once the queue drains. See `request` for why. */
87
+ /**
88
+ * The last scripted response, KEYED BY ENDPOINT.
89
+ *
90
+ * It used to be a single field, so a `enqueueRequest({ status: 500 })` scripted for one endpoint kept
91
+ * replaying for every OTHER endpoint once the queue drained — the comment below says the fallback means
92
+ * "this endpoint is down", and a global field cannot mean that. A fault leaked across endpoints and a
93
+ * test could assert an outcome the SDK would never produce.
94
+ */
95
+ private lastRequestScript;
96
+ private openCount;
97
+ constructor(options?: MockTransportOptions);
98
+ readonly requests: RequestRecord[];
99
+ readonly streamRequests: StreamRequestRecord[];
100
+ /** Live count of streams that have opened but not yet torn down. MUST return to 0 after a cancel. */
101
+ get openStreams(): number;
102
+ /** Peak concurrent open streams observed (bulkhead assertions). */
103
+ private peak;
104
+ get peakOpenStreams(): number;
105
+ enqueueStream(...scripts: StreamScript[]): this;
106
+ enqueueRequest(...scripts: RequestScript[]): this;
107
+ request<T>(req: EverfurRequest): Promise<EverfurResult<T>>;
108
+ stream(req: EverfurRequest, signal: AbortSignal): AsyncIterable<Frame>;
109
+ private openStream;
110
+ private runScript;
111
+ }
112
+
113
+ export { MockTransport, type RequestRecord, type RequestScript, type StreamRequestRecord, type StreamScript, wire };