@leavittsoftware/web 11.1.1 → 11.2.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/CLAUDE.md CHANGED
@@ -1405,6 +1405,7 @@ These apply to the **host class** (`LitElement` or `Md*` subclass). They stack w
1405
1405
  | `formatAddress`, address utils | `titanium/helpers/address/*` | Address formatting |
1406
1406
  | Phone formatters | `titanium/helpers/phone-numbers/*` | Phone number display |
1407
1407
  | `convertArrayToCsv`, `startCsvDownload` | `titanium/helpers/csv/*` | CSV export |
1408
+ | `downloadAuthenticatedFile` | `titanium/helpers/download-authenticated-file` | Authenticated `fetch` + browser download. Pass `Authorization` / `X-LGAppName` in `headers`. Do not use for large files — the response is fully buffered as a `Blob`. |
1408
1409
  | `getSearchTokens` | `titanium/helpers/get-search-token` | OData search token parsing |
1409
1410
  | `escapeTerm` | `titanium/helpers/escape-term` | OData string escaping |
1410
1411
  | `groupBy`, `join`, `middleEllipsis` | `titanium/helpers/*` | General utilities |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavittsoftware/web",
3
- "version": "11.1.1",
3
+ "version": "11.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "files": [
@@ -42,5 +42,5 @@
42
42
  "url": "https://github.com/LeavittSoftware/titanium-elements/issues"
43
43
  },
44
44
  "homepage": "https://github.com/LeavittSoftware/titanium-elements/#readme",
45
- "gitHead": "7e1cee3df2dfe9321130ca4e6e99cdf175d7e94e"
45
+ "gitHead": "42cd4986d815b0855e64b28212ea8f10af9f0c57"
46
46
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Fetches a file with caller-supplied auth headers and triggers a browser download
3
+ * via a detached `<a download>` (the element is never attached to the document).
4
+ *
5
+ * Do not use for large files. The response is fully buffered as a `Blob` before
6
+ * the save starts, so peak memory is about the size of the payload.
7
+ */
8
+ export declare function downloadAuthenticatedFile(url: string, fallbackFilename: string, headers: HeadersInit): Promise<void>;
9
+ //# sourceMappingURL=download-authenticated-file.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Fetches a file with caller-supplied auth headers and triggers a browser download
3
+ * via a detached `<a download>` (the element is never attached to the document).
4
+ *
5
+ * Do not use for large files. The response is fully buffered as a `Blob` before
6
+ * the save starts, so peak memory is about the size of the payload.
7
+ */
8
+ export async function downloadAuthenticatedFile(url, fallbackFilename, headers) {
9
+ const response = await fetch(url, { headers });
10
+ if (!response.ok) {
11
+ const detail = (await response.text()).trim();
12
+ throw new Error(detail || `Download failed (${response.status})`);
13
+ }
14
+ const blob = await response.blob();
15
+ const contentDisposition = response.headers.get('content-disposition');
16
+ const filenameMatch = contentDisposition?.match(/filename\*?=(?:UTF-8'')?["']?([^"';]+)/i);
17
+ const filename = filenameMatch?.[1] ? decodeURIComponent(filenameMatch[1]) : fallbackFilename;
18
+ const objectUrl = URL.createObjectURL(blob);
19
+ const anchor = document.createElement('a');
20
+ anchor.href = objectUrl;
21
+ anchor.download = filename;
22
+ anchor.click();
23
+ URL.revokeObjectURL(objectUrl);
24
+ }
25
+ //# sourceMappingURL=download-authenticated-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-authenticated-file.js","sourceRoot":"","sources":["download-authenticated-file.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,GAAW,EAAE,gBAAwB,EAAE,OAAoB;IACzG,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAE/C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,oBAAoB,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACvE,MAAM,aAAa,GAAG,kBAAkB,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC3F,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAE9F,MAAM,SAAS,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;IACxB,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,MAAM,CAAC,KAAK,EAAE,CAAC;IACf,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { startCsvDownload } from './csv/start-csv-download';
2
2
  export { convertArrayToCsv } from './csv/convert-array-to-csv';
3
+ export { downloadAuthenticatedFile } from './download-authenticated-file';
3
4
  export { isDevelopment } from './is-development';
4
5
  export { escapeTerm } from './escape-term';
5
6
  export { installMediaQueryWatcher } from './install-media-query-watcher';
@@ -1,5 +1,6 @@
1
1
  export { startCsvDownload } from './csv/start-csv-download';
2
2
  export { convertArrayToCsv } from './csv/convert-array-to-csv';
3
+ export { downloadAuthenticatedFile } from './download-authenticated-file';
3
4
  export { isDevelopment } from './is-development';
4
5
  export { escapeTerm } from './escape-term';
5
6
  export { installMediaQueryWatcher } from './install-media-query-watcher';
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAg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