@farthershore/farthershore-js 0.1.8 → 0.1.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-product-docs.d.ts","sourceRoot":"","sources":["../../../src/components/product-docs/fetch-product-docs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-product-docs.d.ts","sourceRoot":"","sources":["../../../src/components/product-docs/fetch-product-docs.ts"],"names":[],"mappings":"AAkBA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,cAAc,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC/C,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAiFF,oEAAoE;AACpE,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAyB7B"}
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
// every page .mdx in parallel, with the env-host variant
|
|
4
4
|
// (`env/{name}/current` prefix, versions.json skipped entirely).
|
|
5
5
|
//
|
|
6
|
-
// `docsBaseUrl` is
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// no CORS headers; the SSR original only could read it because its fetch ran
|
|
11
|
-
// server-side in Node.)
|
|
6
|
+
// `docsBaseUrl` is the public docs CDN origin for this product
|
|
7
|
+
// (`https://documentation.farthershore-*/docs/{productId}` — the docs R2
|
|
8
|
+
// bucket's custom domain, which serves a public GET/HEAD CORS policy), as
|
|
9
|
+
// provided by `boot.product.docsBaseUrl`.
|
|
12
10
|
//
|
|
13
11
|
// Differences from the SSR original (client-side instead of server-side):
|
|
14
|
-
// no `next: { revalidate }` (the
|
|
12
|
+
// no `next: { revalidate }` (the CDN serves `Cache-Control:
|
|
15
13
|
// public,max-age=300`, which the browser HTTP cache honours) and React's
|
|
16
14
|
// per-render `cache()` is replaced by a session-scoped promise memo —
|
|
17
|
-
// successes are reused across route navigations
|
|
18
|
-
//
|
|
15
|
+
// complete successes are reused across route navigations; failures AND
|
|
16
|
+
// partial results (an indexed page whose fetch transiently failed) are
|
|
17
|
+
// evicted so the next visit retries.
|
|
19
18
|
import { parseProductDocsIndex, parseProductDocsVersions, } from "./product-docs-index.js";
|
|
20
19
|
function encodeDocsObjectPath(path) {
|
|
21
20
|
return path
|
|
@@ -45,8 +44,7 @@ async function fetchProductDocsUncached(docsBaseUrl, options) {
|
|
|
45
44
|
if (!currentTag)
|
|
46
45
|
return null;
|
|
47
46
|
currentVersion =
|
|
48
|
-
versions.releases.find((release) => release.tag === currentTag) ??
|
|
49
|
-
null;
|
|
47
|
+
versions.releases.find((release) => release.tag === currentTag) ?? null;
|
|
50
48
|
if (!currentVersion)
|
|
51
49
|
return null;
|
|
52
50
|
prefix = `${docsBaseUrl}/releases/${encodeURIComponent(currentTag)}`;
|
|
@@ -101,7 +99,18 @@ export function fetchProductDocs(docsBaseUrl, options = {}) {
|
|
|
101
99
|
if (hit)
|
|
102
100
|
return hit;
|
|
103
101
|
const promise = fetchProductDocsUncached(docsBaseUrl, options).then((docs) => {
|
|
104
|
-
|
|
102
|
+
// Evict total failures AND partial results. A page fetch that failed
|
|
103
|
+
// transiently (network blip, CDN 5xx, 10s timeout) is skipped above so
|
|
104
|
+
// the rest of the docs render — but memoizing that partial result
|
|
105
|
+
// would pin "Page not found" on the missing page for the whole SPA
|
|
106
|
+
// session even though the file is published. Evicting means the next
|
|
107
|
+
// docs navigation refetches; the pages that DID land come back from
|
|
108
|
+
// the browser HTTP cache (max-age=300), so only the missing page
|
|
109
|
+
// actually retries. The sync pipeline uploads pages before the index,
|
|
110
|
+
// so a published _index.yaml never references pages that don't exist —
|
|
111
|
+
// an incomplete map always means a client-side fetch failure.
|
|
112
|
+
const partial = docs !== null && docs.index.pages.some((page) => !(page in docs.docs));
|
|
113
|
+
if (docs === null || partial)
|
|
105
114
|
docsCache.delete(key);
|
|
106
115
|
return docs;
|
|
107
116
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-product-docs.js","sourceRoot":"","sources":["../../../src/components/product-docs/fetch-product-docs.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,kEAAkE;AAClE,yDAAyD;AACzD,iEAAiE;AACjE,EAAE;AACF,yEAAyE;AACzE,
|
|
1
|
+
{"version":3,"file":"fetch-product-docs.js","sourceRoot":"","sources":["../../../src/components/product-docs/fetch-product-docs.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,kEAAkE;AAClE,yDAAyD;AACzD,iEAAiE;AACjE,EAAE;AACF,+DAA+D;AAC/D,yEAAyE;AACzE,0EAA0E;AAC1E,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,4DAA4D;AAC5D,yEAAyE;AACzE,sEAAsE;AACtE,uEAAuE;AACvE,uEAAuE;AACvE,qCAAqC;AAErC,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GAIzB,MAAM,yBAAyB,CAAC;AAejC,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CA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,CAAC,CAAC;IAC5B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farthershore/farthershore-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Farther Shore Frontend SDK — the browser integration layer between static frontends and the Farther Shore platform (Core + Gateway).",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|