@corva/ui 3.75.0-14 → 3.75.0-15
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/cjs-bundle/components/AttachmentPreview/useStoredAttachments.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachments.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/useAttachmentUpload.js +1 -1
- package/cjs-bundle/components/CommentComposer/useAttachmentUpload.js.map +1 -1
- package/cjs-bundle/effects/useSignedURL.js +1 -1
- package/cjs-bundle/effects/useSignedURL.js.map +1 -1
- package/cjs-bundle/utils/signedLinkCache.js +2 -0
- package/cjs-bundle/utils/signedLinkCache.js.map +1 -0
- package/components/AttachmentPreview/useStoredAttachments.d.ts.map +1 -1
- package/components/AttachmentPreview/useStoredAttachments.js +1 -1
- package/components/AttachmentPreview/useStoredAttachments.js.map +1 -1
- package/components/CommentComposer/useAttachmentUpload.d.ts.map +1 -1
- package/components/CommentComposer/useAttachmentUpload.js +1 -1
- package/components/CommentComposer/useAttachmentUpload.js.map +1 -1
- package/components/Drillstring/BHAComponentDetail/constants.d.ts +2 -2
- package/effects/useSignedURL.d.ts +1 -1
- package/effects/useSignedURL.d.ts.map +1 -1
- package/effects/useSignedURL.js +1 -1
- package/effects/useSignedURL.js.map +1 -1
- package/mcp-server/server.mjs +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/__tests__/signedLinkCache.test.d.ts +2 -0
- package/utils/__tests__/signedLinkCache.test.d.ts.map +1 -0
- package/utils/signedLinkCache.d.ts +9 -0
- package/utils/signedLinkCache.d.ts.map +1 -0
- package/utils/signedLinkCache.js +2 -0
- package/utils/signedLinkCache.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signedLinkCache.test.d.ts","sourceRoot":"","sources":["../../../src/utils/__tests__/signedLinkCache.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Any Content-Disposition value the API accepts, usually plain 'attachment' or 'inline'. */
|
|
2
|
+
type Disposition = string;
|
|
3
|
+
/** Cached `getS3DownloadLink`: remounts reuse the same url, so the browser HTTP cache holds. */
|
|
4
|
+
export declare const getSignedLink: (fileName: string, disposition?: Disposition) => Promise<string>;
|
|
5
|
+
/** The cached link when already resolved, for synchronous initial state. */
|
|
6
|
+
export declare const peekSignedLink: (fileName: string, disposition?: Disposition) => string | undefined;
|
|
7
|
+
export declare const clearSignedLinkCache: () => void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=signedLinkCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signedLinkCache.d.ts","sourceRoot":"","sources":["../../src/utils/signedLinkCache.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,KAAK,WAAW,GAAG,MAAM,CAAC;AAW1B,gGAAgG;AAChG,eAAO,MAAM,aAAa,aACd,MAAM,gBACH,WAAW,KACvB,OAAO,CAAC,MAAM,CAmBhB,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,cAAc,aACf,MAAM,gBACH,WAAW,KACvB,MAAM,GAAG,SAIX,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAO,IAAqB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getS3DownloadLink as t}from"../clients/jsonApi/index.js";var e=new Map,n=function(t,e){return"".concat(e,":").concat(t)},r=function(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"attachment",i=n(r,o),a=e.get(i);if(a&&a.expiresAt>Date.now())return a.promise;var c={expiresAt:Date.now()+72e4,promise:t(r,o).then((function(t){var e=t.url;return c.url=e,e}))};return c.promise.catch((function(){e.get(i)===c&&e.delete(i)})),e.set(i,c),c.promise},o=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"attachment",o=e.get(n(t,r));return o&&o.expiresAt>Date.now()?o.url:void 0};export{r as getSignedLink,o as peekSignedLink};
|
|
2
|
+
//# sourceMappingURL=signedLinkCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signedLinkCache.js","sources":["../../src/utils/signedLinkCache.ts"],"sourcesContent":["import { getS3DownloadLink } from '~/clients/jsonApi';\n\n/** Any Content-Disposition value the API accepts, usually plain 'attachment' or 'inline'. */\ntype Disposition = string;\n\n// S3 signs download links for fifteen minutes; leave the last recipient time to fetch.\nconst TTL_MS = 12 * 60 * 1000;\n\ntype CacheEntry = { promise: Promise<string>; url?: string; expiresAt: number };\n\nconst cache = new Map<string, CacheEntry>();\n\nconst toKey = (fileName: string, disposition: Disposition) => `${disposition}:${fileName}`;\n\n/** Cached `getS3DownloadLink`: remounts reuse the same url, so the browser HTTP cache holds. */\nexport const getSignedLink = (\n fileName: string,\n disposition: Disposition = 'attachment'\n): Promise<string> => {\n const key = toKey(fileName, disposition);\n const cached = cache.get(key);\n if (cached && cached.expiresAt > Date.now()) return cached.promise;\n\n const entry: CacheEntry = {\n expiresAt: Date.now() + TTL_MS,\n promise: getS3DownloadLink(fileName, disposition).then(({ url }: { url: string }) => {\n entry.url = url;\n\n return url;\n }),\n };\n entry.promise.catch(() => {\n if (cache.get(key) === entry) cache.delete(key);\n });\n cache.set(key, entry);\n\n return entry.promise;\n};\n\n/** The cached link when already resolved, for synchronous initial state. */\nexport const peekSignedLink = (\n fileName: string,\n disposition: Disposition = 'attachment'\n): string | undefined => {\n const cached = cache.get(toKey(fileName, disposition));\n\n return cached && cached.expiresAt > Date.now() ? cached.url : undefined;\n};\n\nexport const clearSignedLinkCache = (): void => cache.clear();\n"],"names":["cache","Map","toKey","fileName","disposition","getSignedLink","key","cached","get","expiresAt","Date","now","promise","entry","getS3DownloadLink","then","_ref","url","catch","delete","set","peekSignedLink","undefined"],"mappings":"gEAMA,IAIMA,EAAQ,IAAIC,IAEZC,EAAQ,SAACC,EAAkBC,GAAwB,MAAQA,GAAAA,OAAAA,cAAeD,EAAQ,EAG3EE,EAAgB,SAC3BF,GAEoB,IADpBC,yDAA2B,aAErBE,EAAMJ,EAAMC,EAAUC,GACtBG,EAASP,EAAMQ,IAAIF,GACzB,GAAIC,GAAUA,EAAOE,UAAYC,KAAKC,MAAO,OAAOJ,EAAOK,QAE3D,IAAMC,EAAoB,CACxBJ,UAAWC,KAAKC,MAlBL,KAmBXC,QAASE,EAAkBX,EAAUC,GAAaW,MAAK,SAA8BC,GAAA,IAA3BC,IAAAA,IAGxD,OAFAJ,EAAMI,IAAMA,EAELA,MAQX,OALAJ,EAAMD,QAAQM,OAAM,WACdlB,EAAMQ,IAAIF,KAASO,GAAOb,EAAMmB,OAAOb,EAC7C,IACAN,EAAMoB,IAAId,EAAKO,GAERA,EAAMD,OACf,EAGaS,EAAiB,SAC5BlB,GAEuB,IADvBC,yDAA2B,aAErBG,EAASP,EAAMQ,IAAIN,EAAMC,EAAUC,IAEzC,OAAOG,GAAUA,EAAOE,UAAYC,KAAKC,MAAQJ,EAAOU,SAAMK,CAChE"}
|