@gusnips/react 0.9.24 → 0.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -36
- package/dist/api-client.d.ts +51 -51
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +3 -3
- package/dist/api-error.d.ts +11 -11
- package/dist/api-error.js +11 -11
- package/dist/auth-email.d.ts +40 -0
- package/dist/auth-email.d.ts.map +1 -0
- package/dist/auth-email.js +106 -0
- package/dist/auth-email.js.map +1 -0
- package/dist/auth-store.d.ts +23 -23
- package/dist/auth-store.js +13 -13
- package/dist/copy.d.ts +3 -3
- package/dist/copy.js +3 -3
- package/dist/deploy-recovery.d.ts +40 -40
- package/dist/deploy-recovery.js +40 -40
- package/dist/describe-error.d.ts +68 -68
- package/dist/describe-error.d.ts.map +1 -1
- package/dist/describe-error.js +5 -5
- package/dist/error-boundary.d.ts +12 -12
- package/dist/guards.d.ts +15 -15
- package/dist/guards.js +3 -3
- package/dist/hydrate.d.ts +15 -16
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.js +9 -9
- package/dist/hydrate.js.map +1 -1
- package/dist/i18n.d.ts +15 -16
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +5 -6
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal-path.d.ts +8 -7
- package/dist/internal-path.d.ts.map +1 -1
- package/dist/internal-path.js +8 -7
- package/dist/internal-path.js.map +1 -1
- package/dist/prerender-contract.d.ts +7 -7
- package/dist/prerender-contract.js +7 -7
- package/dist/query.d.ts +16 -17
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +2 -2
- package/dist/query.js.map +1 -1
- package/dist/sse.d.ts +19 -20
- package/dist/sse.d.ts.map +1 -1
- package/dist/sse.js +18 -19
- package/dist/sse.js.map +1 -1
- package/dist/states.d.ts +12 -12
- package/dist/states.d.ts.map +1 -1
- package/dist/supabase-session.d.ts +47 -48
- package/dist/supabase-session.d.ts.map +1 -1
- package/dist/supabase-session.js +35 -35
- package/dist/supabase-session.js.map +1 -1
- package/dist/theme.d.ts +4 -4
- package/dist/theme.js +4 -4
- package/dist/ui/class-name.d.ts +3 -4
- package/dist/ui/class-name.d.ts.map +1 -1
- package/dist/ui/class-name.js +3 -4
- package/dist/ui/class-name.js.map +1 -1
- package/dist/ui/combobox.d.ts +11 -11
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/dialog.d.ts +5 -5
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/drawer.d.ts +10 -10
- package/dist/ui/drawer.d.ts.map +1 -1
- package/dist/ui/drawer.js +2 -2
- package/dist/ui/input.d.ts +2 -2
- package/dist/ui/input.js +2 -2
- package/dist/ui/menu.d.ts +8 -8
- package/dist/ui/menu.d.ts.map +1 -1
- package/dist/ui/menu.js +4 -4
- package/dist/ui/menu.js.map +1 -1
- package/dist/ui/select.d.ts +12 -12
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +3 -3
- package/dist/ui/tabs.d.ts +14 -15
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +13 -14
- package/dist/ui/tabs.js.map +1 -1
- package/package.json +1 -1
- package/src/api-client.ts +51 -51
- package/src/api-error.ts +11 -11
- package/src/auth-email.test.ts +145 -0
- package/src/auth-email.ts +112 -0
- package/src/auth-store.ts +23 -23
- package/src/copy.ts +3 -3
- package/src/deploy-recovery.ts +40 -40
- package/src/describe-error.ts +68 -68
- package/src/error-boundary.tsx +12 -12
- package/src/guards.tsx +15 -15
- package/src/hydrate.ts +15 -16
- package/src/i18n.ts +15 -16
- package/src/index.ts +2 -0
- package/src/internal-path.ts +8 -7
- package/src/prerender-contract.ts +7 -7
- package/src/query.ts +16 -17
- package/src/sse.ts +19 -20
- package/src/states.ts +12 -12
- package/src/supabase-session.ts +46 -47
- package/src/theme.ts +4 -4
- package/src/ui/class-name.ts +3 -4
- package/src/ui/combobox.tsx +11 -11
- package/src/ui/dialog.tsx +5 -5
- package/src/ui/drawer.tsx +10 -10
- package/src/ui/input.tsx +2 -2
- package/src/ui/menu.tsx +8 -8
- package/src/ui/select.tsx +12 -12
- package/src/ui/tabs.tsx +14 -15
package/dist/i18n.js
CHANGED
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
10
|
* Keeping the options here is what stops a console, a storefront and a docs site in the same
|
|
11
|
-
* product from drifting apart on the details below
|
|
12
|
-
* shipped.
|
|
11
|
+
* product from drifting apart on the details below. Each is a bug somebody already shipped.
|
|
13
12
|
*/
|
|
14
13
|
export function i18nInitOptions({ fallbackLng, supportedLngs, storageKey, queryKey, storageWriter = "detector", }) {
|
|
15
14
|
// i18next picks the first EXACT match anywhere in the detected list before it tries a base
|
|
@@ -55,13 +54,13 @@ export function i18nInitOptions({ fallbackLng, supportedLngs, storageKey, queryK
|
|
|
55
54
|
* i18next ever sees it.
|
|
56
55
|
*
|
|
57
56
|
* Done here rather than through interpolation because i18next v26 has no global interpolation
|
|
58
|
-
* defaults, and these strings are often resolved by dynamic key
|
|
57
|
+
* defaults, and these strings are often resolved by dynamic key, so a wrapping `t()` would not
|
|
59
58
|
* reach them. The point is that a rename or a domain move is ONE edit in the brand constants
|
|
60
59
|
* instead of a sweep across every locale file.
|
|
61
60
|
*
|
|
62
|
-
* Returns a fresh tree; the input is untouched. The placeholder names come from `vars`, so
|
|
63
|
-
*
|
|
64
|
-
*
|
|
61
|
+
* Returns a fresh tree; the input is untouched. The placeholder names come from `vars`, so adding
|
|
62
|
+
* one needs no change here. Two donors hardcoded their own list in the regex and both had to
|
|
63
|
+
* remember to update it.
|
|
65
64
|
*/
|
|
66
65
|
export function applyBrandVars(resources, vars) {
|
|
67
66
|
const names = Object.keys(vars);
|
package/dist/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA0CH,MAAM,UAAU,eAAe,CAAC,EAC9B,WAAW,EACX,aAAa,EACb,UAAU,EACV,QAAQ,EACR,aAAa,GAAG,UAAU,GACV;IAChB,2FAA2F;IAC3F,+FAA+F;IAC/F,iGAAiG;IACjG,gGAAgG;IAChG,iGAAiG;IACjG,+CAA+C;IAC/C,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE;QACrC,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,OAAO,CACL,aAAa,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;YACxD,aAAa,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;YACtE,GAAG,CACJ,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,WAAW;QACX,aAAa,EAAE,CAAC,GAAG,aAAa,CAAC;QACjC,IAAI,EAAE,aAAsB;QAC5B,aAAa,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,yBAAyB;QAChE,SAAS,EAAE;YACT,KAAK,EAAE,QAAQ;gBACb,CAAC,CAAC,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC;gBAC9C,CAAC,CAAC,CAAC,cAAc,EAAE,WAAW,CAAC;YACjC,8EAA8E;YAC9E,MAAM,EAAE,aAAa,KAAK,UAAU,CAAC,CAAC,CAA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,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;YACpC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAM,CAAC;AAC9B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { cn } from "./cn.ts";
|
|
2
2
|
export { copyText, useCopy, type CopyOptions, type CopyState } from "./copy.ts";
|
|
3
3
|
export { returnPathFromLocation, safeInternalPath, type PathParts } from "./internal-path.ts";
|
|
4
|
+
export { forgetAuthEmail, recallAuthEmail, rememberAuthEmail } from "./auth-email.ts";
|
|
4
5
|
export { ApiError, isAbortError } from "./api-error.ts";
|
|
5
6
|
export { retryAfterSecs } from "@gusnips/http/retry";
|
|
6
7
|
export { createApiClient, type ApiClient, type ApiClientOptions, type RefreshResult, type RequestOptions, type SessionAdapter, } from "./api-client.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qB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CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
export { cn } from "./cn.js";
|
|
33
33
|
export { copyText, useCopy } from "./copy.js";
|
|
34
34
|
export { returnPathFromLocation, safeInternalPath } from "./internal-path.js";
|
|
35
|
+
export { forgetAuthEmail, recallAuthEmail, rememberAuthEmail } from "./auth-email.js";
|
|
35
36
|
export { ApiError, isAbortError } from "./api-error.js";
|
|
36
37
|
export { retryAfterSecs } from "@gusnips/http/retry";
|
|
37
38
|
export { createApiClient, } from "./api-client.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,2CAA2C;AAC3C,EAAE;AACF,+FAA+F;AAC/F,gGAAgG;AAChG,+FAA+F;AAC/F,iGAAiG;AACjG,0BAA0B;AAC1B,EAAE;AACF,qEAAqE;AACrE,8DAA8D;AAC9D,uEAAuE;AACvE,gEAAgE;AAChE,4EAA4E;AAC5E,4FAA4F;AAC5F,8FAA8F;AAC9F,EAAE;AACF,2FAA2F;AAC3F,iGAAiG;AACjG,+FAA+F;AAC/F,gGAAgG;AAChG,4EAA4E;AAC5E,EAAE;AACF,2FAA2F;AAC3F,iGAAiG;AACjG,qFAAqF;AACrF,6FAA6F;AAC7F,iGAAiG;AACjG,yFAAyF;AACzF,uBAAuB;AAEvB,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAoC,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAkB,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,eAAe,GAMhB,MAAM,iBAAiB,CAAC;AACz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oBAAoB,CAAC;AAE9F,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEtF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,eAAe,GAMhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAiB,MAAM,UAAU,CAAC;AAEzE,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,WAAW,GAGZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,aAAa,GAGd,MAAM,qBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,YAAY,GASb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,iGAAiG;AACjG,kGAAkG;AAClG,6FAA6F;AAC7F,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAwB,MAAM,WAAW,CAAC"}
|
package/dist/internal-path.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* A route the browser can follow without leaving the current origin.
|
|
3
3
|
*
|
|
4
4
|
* Return targets cross a trust boundary: query strings, history state and storage are all writable
|
|
5
|
-
* by somebody outside the app. `startsWith("/")` is not enough
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* by somebody outside the app. `startsWith("/")` is not enough: URL parsers read both `//host` and
|
|
6
|
+
* `/\\host` as another origin, and strip tabs or newlines before making the same decision. Parsing
|
|
7
|
+
* against a fixed origin applies the browser's own rules rather than trying to copy them.
|
|
8
8
|
*/
|
|
9
9
|
export declare function safeInternalPath(value: unknown): string | null;
|
|
10
10
|
/** Anything shaped like the current page: `window.location` and react-router's `useLocation()`. */
|
|
@@ -18,14 +18,15 @@ export interface PathParts {
|
|
|
18
18
|
*
|
|
19
19
|
* The fragment is the half that is easy to get wrong, and getting it wrong leaks a credential. A
|
|
20
20
|
* Supabase client with no `flowType` uses the IMPLICIT flow, which returns the session in the
|
|
21
|
-
* fragment
|
|
22
|
-
*
|
|
21
|
+
* fragment, `#access_token=…&refresh_token=…`. A return target is recorded in a query string, and a
|
|
22
|
+
* query string is not a fragment: it rides in `Referer`, it is written to every access log on the
|
|
23
23
|
* way, and it stays in history. So a fragment carrying a credential is dropped and the page is
|
|
24
24
|
* kept, because the page is the part worth returning to and the anchor is the part that is
|
|
25
25
|
* dangerous.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
* construction. Use `safeInternalPath` for the other direction, where someone else
|
|
27
|
+
* Accepts every caller address on purpose. The caller is handing over its OWN address, which is on
|
|
28
|
+
* this origin by construction. Use `safeInternalPath` for the other direction, where someone else
|
|
29
|
+
* wrote the value.
|
|
29
30
|
*/
|
|
30
31
|
export declare function returnPathFromLocation({ pathname, search, hash }: PathParts): string;
|
|
31
32
|
//# sourceMappingURL=internal-path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-path.d.ts","sourceRoot":"","sources":["../src/internal-path.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAU9D;AAiBD,mGAAmG;AACnG,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED
|
|
1
|
+
{"version":3,"file":"internal-path.d.ts","sourceRoot":"","sources":["../src/internal-path.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAU9D;AAiBD,mGAAmG;AACnG,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,SAAS,GAAG,MAAM,CAKpF"}
|
package/dist/internal-path.js
CHANGED
|
@@ -11,9 +11,9 @@ function containsControl(value) {
|
|
|
11
11
|
* A route the browser can follow without leaving the current origin.
|
|
12
12
|
*
|
|
13
13
|
* Return targets cross a trust boundary: query strings, history state and storage are all writable
|
|
14
|
-
* by somebody outside the app. `startsWith("/")` is not enough
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* by somebody outside the app. `startsWith("/")` is not enough: URL parsers read both `//host` and
|
|
15
|
+
* `/\\host` as another origin, and strip tabs or newlines before making the same decision. Parsing
|
|
16
|
+
* against a fixed origin applies the browser's own rules rather than trying to copy them.
|
|
17
17
|
*/
|
|
18
18
|
export function safeInternalPath(value) {
|
|
19
19
|
if (typeof value !== "string" || !value.startsWith("/") || containsControl(value))
|
|
@@ -47,14 +47,15 @@ const CREDENTIAL_FRAGMENT_KEYS = [
|
|
|
47
47
|
*
|
|
48
48
|
* The fragment is the half that is easy to get wrong, and getting it wrong leaks a credential. A
|
|
49
49
|
* Supabase client with no `flowType` uses the IMPLICIT flow, which returns the session in the
|
|
50
|
-
* fragment
|
|
51
|
-
*
|
|
50
|
+
* fragment, `#access_token=…&refresh_token=…`. A return target is recorded in a query string, and a
|
|
51
|
+
* query string is not a fragment: it rides in `Referer`, it is written to every access log on the
|
|
52
52
|
* way, and it stays in history. So a fragment carrying a credential is dropped and the page is
|
|
53
53
|
* kept, because the page is the part worth returning to and the anchor is the part that is
|
|
54
54
|
* dangerous.
|
|
55
55
|
*
|
|
56
|
-
*
|
|
57
|
-
* construction. Use `safeInternalPath` for the other direction, where someone else
|
|
56
|
+
* Accepts every caller address on purpose. The caller is handing over its OWN address, which is on
|
|
57
|
+
* this origin by construction. Use `safeInternalPath` for the other direction, where someone else
|
|
58
|
+
* wrote the value.
|
|
58
59
|
*/
|
|
59
60
|
export function returnPathFromLocation({ pathname, search, hash }) {
|
|
60
61
|
const fragment = hash.startsWith("#") ? hash.slice(1) : hash;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-path.js","sourceRoot":"","sources":["../src/internal-path.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAEnD,SAAS,eAAe,CAAC,KAAa;IACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;IACjD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE/F,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;QAC5C,IAAI,GAAG,CAAC,MAAM,KAAK,eAAe;YAAE,OAAO,IAAI,CAAC;QAChD,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAA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IAAI,EAAa;IAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7D,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAClF,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The two constants the build and the browser both need
|
|
2
|
+
* The two constants the build and the browser both need. Keep **nothing else in this file**.
|
|
3
3
|
*
|
|
4
4
|
* It is separate from `hydrate.ts` for one reason: that module imports `react-dom/client`, and
|
|
5
5
|
* `@gusnips/vite` needs these constants to WRITE the attribute at build time. If the constants
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* string value each time. See `hydrate.ts` for why it exists at all.
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
|
-
* The attribute a prerendered file names its own route
|
|
15
|
-
*
|
|
14
|
+
* The attribute where a prerendered file names its own route. The build writes it and the browser
|
|
15
|
+
* entry reads it.
|
|
16
16
|
*
|
|
17
17
|
* One constant because the writer and the reader are in different builds, and a typo between
|
|
18
18
|
* them would show up only as a silent full re-render: a page that works, and a bug nobody sees.
|
|
@@ -21,10 +21,10 @@ export declare const PRERENDERED_ROUTE_ATTR = "data-prerendered-route";
|
|
|
21
21
|
/**
|
|
22
22
|
* What a 404 shell writes instead of a route.
|
|
23
23
|
*
|
|
24
|
-
* It is the pattern that actually matched
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* It is the catch-all pattern that actually matched, and it can never equal an address, which is
|
|
25
|
+
* the property that matters: every route a static host answers from the shell mounts fresh rather
|
|
26
|
+
* than hydrating the not-found page over itself. A real 404 pays one redundant client render for
|
|
27
|
+
* that, and keeps the markup a crawler reads.
|
|
28
28
|
*/
|
|
29
29
|
export declare const SHELL_ROUTE = "*";
|
|
30
30
|
//# sourceMappingURL=prerender-contract.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The two constants the build and the browser both need
|
|
2
|
+
* The two constants the build and the browser both need. Keep **nothing else in this file**.
|
|
3
3
|
*
|
|
4
4
|
* It is separate from `hydrate.ts` for one reason: that module imports `react-dom/client`, and
|
|
5
5
|
* `@gusnips/vite` needs these constants to WRITE the attribute at build time. If the constants
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* string value each time. See `hydrate.ts` for why it exists at all.
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
|
-
* The attribute a prerendered file names its own route
|
|
15
|
-
*
|
|
14
|
+
* The attribute where a prerendered file names its own route. The build writes it and the browser
|
|
15
|
+
* entry reads it.
|
|
16
16
|
*
|
|
17
17
|
* One constant because the writer and the reader are in different builds, and a typo between
|
|
18
18
|
* them would show up only as a silent full re-render: a page that works, and a bug nobody sees.
|
|
@@ -21,10 +21,10 @@ export const PRERENDERED_ROUTE_ATTR = "data-prerendered-route";
|
|
|
21
21
|
/**
|
|
22
22
|
* What a 404 shell writes instead of a route.
|
|
23
23
|
*
|
|
24
|
-
* It is the pattern that actually matched
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* It is the catch-all pattern that actually matched, and it can never equal an address, which is
|
|
25
|
+
* the property that matters: every route a static host answers from the shell mounts fresh rather
|
|
26
|
+
* than hydrating the not-found page over itself. A real 404 pays one redundant client render for
|
|
27
|
+
* that, and keeps the markup a crawler reads.
|
|
28
28
|
*/
|
|
29
29
|
export const SHELL_ROUTE = "*";
|
|
30
30
|
//# sourceMappingURL=prerender-contract.js.map
|
package/dist/query.d.ts
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import type { DefaultOptions } from "@tanstack/react-query";
|
|
2
2
|
/**
|
|
3
|
-
* react-query defaults
|
|
3
|
+
* react-query defaults merged from three repos that each got part of this right.
|
|
4
4
|
*
|
|
5
5
|
* The default is three blind retries, which is wrong for an API that answers refusals
|
|
6
6
|
* precisely: a 402, a 403 or a 451 says exactly the same thing three times, and a 429 we hammer
|
|
7
7
|
* is a 429 we deserve. All three donors knew that much. What each knew alone:
|
|
8
8
|
*
|
|
9
9
|
* - one allowed **408** through, the only 4xx that a second attempt genuinely fixes;
|
|
10
|
-
* - one refused to retry a 429 whose CODE says the limit is durable
|
|
11
|
-
* spent balance clears by buying, not by waiting, so retrying burns another request against
|
|
10
|
+
* - one refused to retry a 429 whose CODE says the limit is durable. A monthly quota or a spent balance clears by buying, not by waiting, so retrying burns another request against
|
|
12
11
|
* the limiter and cannot succeed;
|
|
13
12
|
* - one set **`refetchOnReconnect`**, which none of the others had, and which is the single
|
|
14
13
|
* most useful refetch there is: coming back from a tunnel is exactly when the screen is stale.
|
|
15
14
|
*
|
|
16
15
|
* The second migration added the fourth rule, which no donor had: **when a 429 says how long,
|
|
17
16
|
* believe it.** Its limiter answers `Retry-After: 60` on a per-minute window, and the default
|
|
18
|
-
* backoff retries at 1s and 2s
|
|
19
|
-
* same limiter, and three seconds added before the screen says anything. So a stated wait is
|
|
17
|
+
* backoff retries at 1s and 2s, sending two more requests that cannot succeed, both charged against
|
|
18
|
+
* the same limiter, and three seconds added before the screen says anything. So a stated wait is
|
|
20
19
|
* waited out when it is short, and is an ANSWER when it is not.
|
|
21
20
|
*
|
|
22
21
|
* The fifth rule came from the server half of this fleet rather than from a donor: a refusal can
|
|
23
22
|
* state that waiting will never fix it at all, by sending `details.retryAfterSecs: null`. Read as
|
|
24
|
-
* "did not say how long"
|
|
25
|
-
*
|
|
23
|
+
* "did not say how long", as every version before this one did, that 429 is retried against a limit
|
|
24
|
+
* no amount of time moves.
|
|
26
25
|
*
|
|
27
26
|
* This is invariant 8. The rule itself lives in `@gusnips/http/retry`, so an SDK with no React
|
|
28
27
|
* in it follows the same one; what is here is the binding to react-query.
|
|
29
28
|
*/
|
|
30
29
|
export interface QueryDefaultsOptions {
|
|
31
30
|
/**
|
|
32
|
-
* Error codes
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* Error codes for limits that do not clear by waiting, such as a spent monthly quota or a balance
|
|
32
|
+
* that needs topping up. They usually arrive as 402 or 429; the status alone cannot tell them
|
|
33
|
+
* apart from a burst limit, which is why the caller names them.
|
|
35
34
|
*
|
|
36
35
|
* Only needed where the server does not say so itself. One that sends
|
|
37
36
|
* `details.retryAfterSecs: null` has already made the claim and `shouldRetry` reads it, which
|
|
@@ -43,10 +42,10 @@ export interface QueryDefaultsOptions {
|
|
|
43
42
|
/**
|
|
44
43
|
* Longest stated wait still worth retrying. Default 10 seconds.
|
|
45
44
|
*
|
|
46
|
-
* Only applies when the refusal named its own expiry (`Retry-After`, or `retryAfterSecs` in
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
45
|
+
* Only applies when the refusal named its own expiry (`Retry-After`, or `retryAfterSecs` in the
|
|
46
|
+
* body). A burst limit that clears in two seconds is worth sitting out; a monthly ceiling that
|
|
47
|
+
* clears in an hour is an answer, and holding a spinner for it helps nobody. Show the wait
|
|
48
|
+
* instead, which is what `humanizeWait` is for.
|
|
50
49
|
*/
|
|
51
50
|
maxRetryWaitSecs?: number;
|
|
52
51
|
staleTime?: number;
|
|
@@ -67,8 +66,8 @@ export interface QueryDefaultsOptions {
|
|
|
67
66
|
export declare function shouldRetry(error: unknown, durableLimitCodes?: readonly string[], maxRetryWaitSecs?: number): boolean;
|
|
68
67
|
/**
|
|
69
68
|
* How long before the next attempt: the server's stated wait when there is one, an exponential
|
|
70
|
-
* backoff with jitter otherwise, and never less than the backoff
|
|
71
|
-
*
|
|
69
|
+
* backoff with jitter otherwise, and never less than the backoff. A `Retry-After: 0` is a server
|
|
70
|
+
* saying "immediately", which for a client that just got refused is still too soon.
|
|
72
71
|
*/
|
|
73
72
|
export declare function retryDelayMs(attemptIndex: number, error: unknown): number;
|
|
74
73
|
export declare function queryDefaults({ durableLimitCodes, maxRetries, maxRetryWaitSecs, staleTime, gcTime, refetchOnWindowFocus, }?: QueryDefaultsOptions): DefaultOptions;
|
|
@@ -77,7 +76,7 @@ export declare function queryDefaults({ durableLimitCodes, maxRetries, maxRetryW
|
|
|
77
76
|
* When it is ready, `refreshError` says whether the last refresh failed.
|
|
78
77
|
*
|
|
79
78
|
* **Never gate a screen on `isError`.** It is also true when a BACKGROUND refetch fails over data
|
|
80
|
-
* already on screen
|
|
79
|
+
* already on screen after a window regains focus, a poll or the invalidation after a save. So
|
|
81
80
|
* `isError ? <failure panel> : <data>` throws away what the reader was looking at over one blip.
|
|
82
81
|
* The adopters that had noticed each wrote `isLoadingError` beside a comment saying so; the ones
|
|
83
82
|
* that had not were a boundary and a great many inline ternaries. A refresh that failed is not a
|
package/dist/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;OAOG;IACH,gBAAgB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ED
|
@@ -16,8 +16,8 @@ export function shouldRetry(error, durableLimitCodes = [], maxRetryWaitSecs) {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* How long before the next attempt: the server's stated wait when there is one, an exponential
|
|
19
|
-
* backoff with jitter otherwise, and never less than the backoff
|
|
20
|
-
*
|
|
19
|
+
* backoff with jitter otherwise, and never less than the backoff. A `Retry-After: 0` is a server
|
|
20
|
+
* saying "immediately", which for a client that just got refused is still too soon.
|
|
21
21
|
*/
|
|
22
22
|
export function retryDelayMs(attemptIndex, error) {
|
|
23
23
|
return delayFor(attemptIndex, answerOf(error));
|
package/dist/query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,WAAW,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,WAAW,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA8D1C;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,KAAc,EACd,oBAAuC,EAAE,EACzC,gBAAyB;IAEzB,gGAAgG;IAChG,OAAO,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAChC,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,iBAAiB;QAC/B,WAAW,EAAE,gBAAgB;KAC9B,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,YAAoB,EAAE,KAAc;IAC/D,OAAO,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,KAA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
|
|
1
1
|
/**
|
|
2
2
|
* Server-sent events: the framing and the transport, kept apart.
|
|
3
3
|
*
|
|
4
|
-
* Three donors had three readers and each had half the answer. One was spec-correct about the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Three donors had three readers and each had half the answer. One was spec-correct about the wire
|
|
5
|
+
* but welded to `TextDecoderStream`, so the React Native app, whose fetch has no body reader, could
|
|
6
|
+
* not use a line of it. One was a platform-free `feed(text)` that three transports shared, and it
|
|
7
|
+
* silently dropped data. One was a whole second transport with its own fetch and its own 401
|
|
8
|
+
* handling, bypassing the app's only API client.
|
|
9
9
|
*
|
|
10
10
|
* So: {@link createSseParser} is the state machine and knows about no platform at all;
|
|
11
11
|
* {@link readSseStream} is fifteen lines of `ReadableStream` on top of it. A caller on a
|
|
12
12
|
* platform without body readers keeps its own fifteen lines and shares the machine underneath.
|
|
13
13
|
* (providerkit reached this exact split from the other direction and for the same reason.)
|
|
14
14
|
*
|
|
15
|
-
* And streams ride the ordinary API client
|
|
16
|
-
* "text/event-stream"}, timeoutMs: null})`. Not `EventSource`, which cannot carry an
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* And streams ride the ordinary API client: `client.request(path, {headers: {Accept:
|
|
16
|
+
* "text/event-stream"}, timeoutMs: null})`. Not `EventSource`, which cannot carry an Authorization
|
|
17
|
+
* header, and not a second fetch, which would need its own copy of the refresh logic and would
|
|
18
|
+
* drift from it.
|
|
19
19
|
*/
|
|
20
20
|
/** One frame off the wire. `data` is raw text; see {@link createSseParser} on why. */
|
|
21
21
|
export interface SseFrame {
|
|
22
|
-
/** The `event:` field, or `"message"`
|
|
22
|
+
/** The `event:` field, or `"message"` for an unnamed frame, as the spec requires. */
|
|
23
23
|
event: string;
|
|
24
24
|
/** Every `data:` line in the frame, joined with newlines. Never parsed here. */
|
|
25
25
|
data: string;
|
|
@@ -29,23 +29,22 @@ export interface SseFrame {
|
|
|
29
29
|
/**
|
|
30
30
|
* An incremental parser. Feed it text in whatever sizes the transport delivers.
|
|
31
31
|
*
|
|
32
|
-
* Frames split across reads are held until they complete, so a payload cut mid-line is never
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* Frames split across reads are held until they complete, so a payload cut mid-line is never lost
|
|
33
|
+
* or truncated. That is the failure this shape exists to prevent, and the one that only shows up
|
|
34
|
+
* under a slow network.
|
|
35
35
|
*
|
|
36
36
|
* Three rules that are easy to get wrong, and one donor got each of them wrong:
|
|
37
37
|
*
|
|
38
38
|
* - **`data:` repeats.** A frame may carry several `data:` lines and they are JOINED with
|
|
39
|
-
* newlines. One donor assigned instead of appending, so a multi-line payload arrived as its
|
|
40
|
-
* last line only — no error, no warning, just a truncated message.
|
|
39
|
+
* newlines. One donor assigned instead of appending, so a multi-line payload arrived as its last line only, with no error or warning, just a truncated message.
|
|
41
40
|
* - **Strip ONE leading space after the colon**, not all whitespace. `.trim()` is the obvious
|
|
42
41
|
* thing and it corrupts any payload whose own content begins or ends with a space.
|
|
43
42
|
* - **A frame with no `data:` is not dispatched.** That is what lets a server send bare
|
|
44
43
|
* `event: heartbeat` keepalives, or `:` comment lines, without waking a consumer.
|
|
45
44
|
*
|
|
46
|
-
* `data` is handed back as a raw string and deliberately NOT JSON-parsed. One donor parsed here
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* `data` is handed back as a raw string and deliberately NOT JSON-parsed. One donor parsed here and
|
|
46
|
+
* its three consumers wanted three different things: one wraps non-JSON, one uses a tolerant
|
|
47
|
+
* parser, one parses directly. Parsing in the parser picks a policy for all of them.
|
|
49
48
|
*/
|
|
50
49
|
export declare function createSseParser(onFrame: (frame: SseFrame) => void): {
|
|
51
50
|
feed: (text: string) => void;
|
|
@@ -57,8 +56,8 @@ export declare function createSseParser(onFrame: (frame: SseFrame) => void): {
|
|
|
57
56
|
* single-flight refresh, and a 402 or a 404 arriving as an `ApiError` the page can explain
|
|
58
57
|
* rather than an `onerror` event with nothing in it.
|
|
59
58
|
*
|
|
60
|
-
* Cancels the reader on the way out however it leaves
|
|
61
|
-
*
|
|
59
|
+
* Cancels the reader on the way out however it leaves. A stream abandoned without cancelling holds
|
|
60
|
+
* the connection open until the server gives up on it.
|
|
62
61
|
*/
|
|
63
62
|
export declare function readSseStream(response: Response, onFrame: (frame: SseFrame) => void): Promise<void>;
|
|
64
63
|
//# sourceMappingURL=sse.d.ts.map
|
package/dist/sse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../src/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sFAAsF;AACtF,MAAM,WAAW,QAAQ;IACvB,
|
|
1
|
+
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../src/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sFAAsF;AACtF,MAAM,WAAW,QAAQ;IACvB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG;IACnE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B,CAgBA;AAqBD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GACjC,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
package/dist/sse.js
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server-sent events: the framing and the transport, kept apart.
|
|
3
3
|
*
|
|
4
|
-
* Three donors had three readers and each had half the answer. One was spec-correct about the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Three donors had three readers and each had half the answer. One was spec-correct about the wire
|
|
5
|
+
* but welded to `TextDecoderStream`, so the React Native app, whose fetch has no body reader, could
|
|
6
|
+
* not use a line of it. One was a platform-free `feed(text)` that three transports shared, and it
|
|
7
|
+
* silently dropped data. One was a whole second transport with its own fetch and its own 401
|
|
8
|
+
* handling, bypassing the app's only API client.
|
|
9
9
|
*
|
|
10
10
|
* So: {@link createSseParser} is the state machine and knows about no platform at all;
|
|
11
11
|
* {@link readSseStream} is fifteen lines of `ReadableStream` on top of it. A caller on a
|
|
12
12
|
* platform without body readers keeps its own fifteen lines and shares the machine underneath.
|
|
13
13
|
* (providerkit reached this exact split from the other direction and for the same reason.)
|
|
14
14
|
*
|
|
15
|
-
* And streams ride the ordinary API client
|
|
16
|
-
* "text/event-stream"}, timeoutMs: null})`. Not `EventSource`, which cannot carry an
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* And streams ride the ordinary API client: `client.request(path, {headers: {Accept:
|
|
16
|
+
* "text/event-stream"}, timeoutMs: null})`. Not `EventSource`, which cannot carry an Authorization
|
|
17
|
+
* header, and not a second fetch, which would need its own copy of the refresh logic and would
|
|
18
|
+
* drift from it.
|
|
19
19
|
*/
|
|
20
20
|
/**
|
|
21
21
|
* An incremental parser. Feed it text in whatever sizes the transport delivers.
|
|
22
22
|
*
|
|
23
|
-
* Frames split across reads are held until they complete, so a payload cut mid-line is never
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* Frames split across reads are held until they complete, so a payload cut mid-line is never lost
|
|
24
|
+
* or truncated. That is the failure this shape exists to prevent, and the one that only shows up
|
|
25
|
+
* under a slow network.
|
|
26
26
|
*
|
|
27
27
|
* Three rules that are easy to get wrong, and one donor got each of them wrong:
|
|
28
28
|
*
|
|
29
29
|
* - **`data:` repeats.** A frame may carry several `data:` lines and they are JOINED with
|
|
30
|
-
* newlines. One donor assigned instead of appending, so a multi-line payload arrived as its
|
|
31
|
-
* last line only — no error, no warning, just a truncated message.
|
|
30
|
+
* newlines. One donor assigned instead of appending, so a multi-line payload arrived as its last line only, with no error or warning, just a truncated message.
|
|
32
31
|
* - **Strip ONE leading space after the colon**, not all whitespace. `.trim()` is the obvious
|
|
33
32
|
* thing and it corrupts any payload whose own content begins or ends with a space.
|
|
34
33
|
* - **A frame with no `data:` is not dispatched.** That is what lets a server send bare
|
|
35
34
|
* `event: heartbeat` keepalives, or `:` comment lines, without waking a consumer.
|
|
36
35
|
*
|
|
37
|
-
* `data` is handed back as a raw string and deliberately NOT JSON-parsed. One donor parsed here
|
|
38
|
-
*
|
|
39
|
-
*
|
|
36
|
+
* `data` is handed back as a raw string and deliberately NOT JSON-parsed. One donor parsed here and
|
|
37
|
+
* its three consumers wanted three different things: one wraps non-JSON, one uses a tolerant
|
|
38
|
+
* parser, one parses directly. Parsing in the parser picks a policy for all of them.
|
|
40
39
|
*/
|
|
41
40
|
export function createSseParser(onFrame) {
|
|
42
41
|
let buffer = "";
|
|
@@ -82,8 +81,8 @@ function parseFrame(raw) {
|
|
|
82
81
|
* single-flight refresh, and a 402 or a 404 arriving as an `ApiError` the page can explain
|
|
83
82
|
* rather than an `onerror` event with nothing in it.
|
|
84
83
|
*
|
|
85
|
-
* Cancels the reader on the way out however it leaves
|
|
86
|
-
*
|
|
84
|
+
* Cancels the reader on the way out however it leaves. A stream abandoned without cancelling holds
|
|
85
|
+
* the connection open until the server gives up on it.
|
|
87
86
|
*/
|
|
88
87
|
export async function readSseStream(response, onFrame) {
|
|
89
88
|
if (!response.body)
|
package/dist/sse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../src/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAYH
|
|
1
|
+
{"version":3,"file":"sse.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E,CAAC,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
|
package/dist/states.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ import type { ReactNode } from "react";
|
|
|
4
4
|
* somebody remembers.
|
|
5
5
|
*
|
|
6
6
|
* **No component ships here, on purpose.** Seven repos have an `EmptyState.tsx` and an
|
|
7
|
-
* `ErrorState.tsx`, and read side by side they overlap 9–37%: one draws a tinted icon badge,
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* `ErrorState.tsx`, and read side by side they overlap 9–37%: one draws a tinted icon badge, one a
|
|
8
|
+
* branded illustration set, one a mascot. What they genuinely share is the PROP SHAPE, which is the
|
|
9
|
+
* rule itself, and the only part a package can hold without deciding how eight brands look. Same
|
|
10
|
+
* reasoning as the styled Button: share behaviour, skin per product.
|
|
11
11
|
*
|
|
12
12
|
* Import the type, write your own component against it, and the compiler enforces the rest.
|
|
13
13
|
*/
|
|
@@ -20,16 +20,16 @@ import type { ReactNode } from "react";
|
|
|
20
20
|
* `action` is optional only because some panels fill themselves once a job upstream finishes.
|
|
21
21
|
*/
|
|
22
22
|
export interface EmptyStateProps {
|
|
23
|
-
/** What this panel is for. "No lookups yet"
|
|
23
|
+
/** What this panel is for. Use "No lookups yet", not "No results". */
|
|
24
24
|
title: string;
|
|
25
25
|
/** What belongs here, and what it will show once it does. */
|
|
26
26
|
description: ReactNode;
|
|
27
27
|
/** The way forward, as a control. Usually one button. */
|
|
28
28
|
action?: ReactNode;
|
|
29
29
|
/**
|
|
30
|
-
* `3`
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* Defaults to `3` for a panel that already sits under a page heading, the common case. `1` when
|
|
31
|
+
* this composer IS the page (a 404, a suspended account), which otherwise ships a document with
|
|
32
|
+
* no `h1` in it at all.
|
|
33
33
|
*
|
|
34
34
|
* Only one donor had this, and it is the difference between a screen reader announcing a
|
|
35
35
|
* page and announcing nothing.
|
|
@@ -46,9 +46,9 @@ export interface EmptyStateProps {
|
|
|
46
46
|
* Something did not work.
|
|
47
47
|
*
|
|
48
48
|
* `problem` names what failed, `cause` says why it most likely happened, `fix` says what to do
|
|
49
|
-
* about it, and `action` is that fix as a control. **`fix` and `action` are both required
|
|
50
|
-
* required prop is the only version of "never dead-end" that a caller in a hurry cannot skip,
|
|
51
|
-
*
|
|
49
|
+
* about it, and `action` is that fix as a control. **`fix` and `action` are both required**. A
|
|
50
|
+
* required prop is the only version of "never dead-end" that a caller in a hurry cannot skip, and
|
|
51
|
+
* the donor that made them required is the one whose error screens all have a way out.
|
|
52
52
|
*
|
|
53
53
|
* Not a place for a stack trace. `cause` is what a person can act on ("the site answered too
|
|
54
54
|
* slowly"), with the request id, if there is one, alongside it in `reference`.
|
|
@@ -63,7 +63,7 @@ export interface ErrorStateProps {
|
|
|
63
63
|
cause?: ReactNode;
|
|
64
64
|
/** The way forward, in words. */
|
|
65
65
|
fix: ReactNode;
|
|
66
|
-
/** The way forward
|
|
66
|
+
/** The way forward as a control, usually a retry button. */
|
|
67
67
|
action: ReactNode;
|
|
68
68
|
/** A request id or code, for a support thread. Set in mono, never shouted. */
|
|
69
69
|
reference?: ReactNode;
|
package/dist/states.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../src/states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,
|
|
1
|
+
{"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../src/states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,WAAW,EAAE,SAAS,CAAC;IACvB,yDAAyD;IACzD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iCAAiC;IACjC,GAAG,EAAE,SAAS,CAAC;IACf,4DAA4D;IAC5D,MAAM,EAAE,SAAS,CAAC;IAClB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gDAAgD;IAChD,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|