@webority/web-core 0.168.0 → 0.169.1

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 (38) hide show
  1. package/README.md +39 -0
  2. package/dist/api/contractCaller.js +1 -1
  3. package/dist/api/index.js +1 -1
  4. package/dist/api/resumableDownload.js +1 -0
  5. package/dist/api/uploadFile.js +1 -0
  6. package/dist/api-contract/dist/call.js +1 -1
  7. package/dist/errors/extractApiError.js +2 -2
  8. package/dist/formatters/house.js +1 -1
  9. package/dist/hub/hubConnection.js +1 -0
  10. package/dist/hub/index.js +1 -0
  11. package/dist/hub/useHub.js +1 -0
  12. package/dist/idle/idleTimeout.js +1 -0
  13. package/dist/idle/index.js +1 -0
  14. package/dist/index.js +1 -1
  15. package/dist/india/fieldRules.js +1 -0
  16. package/dist/india/index.js +1 -1
  17. package/dist/query/apiBaseQuery.js +1 -1
  18. package/dist/query/contractQuery.js +1 -1
  19. package/dist/types/api/downloadFile.d.ts +7 -0
  20. package/dist/types/api/index.d.ts +6 -2
  21. package/dist/types/api/resumableDownload.d.ts +36 -0
  22. package/dist/types/api/uploadFile.d.ts +15 -0
  23. package/dist/types/auth/authStore.d.ts +2 -1
  24. package/dist/types/hub/hubConnection.d.ts +38 -0
  25. package/dist/types/hub/index.d.ts +3 -0
  26. package/dist/types/hub/useHub.d.ts +12 -0
  27. package/dist/types/idle/idleTimeout.d.ts +20 -0
  28. package/dist/types/idle/index.d.ts +2 -0
  29. package/dist/types/index.d.ts +1 -0
  30. package/dist/types/india/fieldRules.d.ts +9 -0
  31. package/dist/types/india/index.d.ts +1 -0
  32. package/dist/types/query/apiBaseQuery.d.ts +2 -0
  33. package/dist/types/query/contractQuery.d.ts +1 -1
  34. package/dist/types/query/entityVersion.d.ts +1 -1
  35. package/dist/types/validators/fieldRules.d.ts +3 -0
  36. package/dist/validators/fieldRules.js +1 -1
  37. package/dist/validators/index.js +1 -1
  38. package/package.json +17 -4
package/README.md CHANGED
@@ -19,6 +19,8 @@ store.
19
19
  | `config` | `setConfig`, `getConfig`, `getConfigValue`: base URL, version, commit, build number, log settings, request timeout, retry count |
20
20
  | `errors` | `extractApiError`: any thrown value to `{ code, message, fieldErrors, status, offline, traceId, diagnostic }`, with `code` `'network'`, `'timeout'` or `'offline'` when no answer arrived (`offline` is true for all three, and `'offline'` only when the browser reports no network); `apiErrorMessage(error, fallback)`; `isNoResponse` |
21
21
  | `formatters` | house date, time, number, percent and money (`formatMinor`) formatters; India Standard Time by default, the viewer's zone on request |
22
+ | `hub` | imported from the subpath `@webority/web-core/hub`, not in the main entry: `createHubConnection`, a typed SignalR client from the generated hub types, with token refresh, reconnect and a reconnected signal for refetch; `@microsoft/signalr` is an optional peer |
23
+ | `idle` | imported from the subpath `@webority/web-core/idle`, also in the main entry: `useIdleTimeout` warns before and ends a session after a set time with no activity, shared across tabs; the session ends with reason `idle` |
22
24
  | `india` | the Indian value rules, imported from the subpath `@webority/web-core/india`: GSTIN, PAN, Aadhaar, IFSC, PIN code and mobile checks, GST state and NIC division tables, financial year, IST calendar day and paise; the same code runs in `@webority/mobile-core/india` |
23
25
  | `logger` | levelled `Logger` with secret redaction, and `Logger.requestFailed` for a failed service call |
24
26
  | `network` | `useNetworkStatus` and the online/offline listener |
@@ -312,6 +314,43 @@ Called with no options, the house formatters print (zone IST, locale en-IN, empt
312
314
  - `formatRelative(value, { intl: true })` gives Intl's phrase without configuring a locale.
313
315
  - `addDays(value, n)` moves a date by calendar days and returns `null` for an unreadable date.
314
316
 
317
+ ## Resumable downloads
318
+
319
+ `downloadFileResumable` fetches a large file in `Range` requests, so a download that drops (a lost
320
+ connection, a closed laptop, a cancel) continues from the last byte received instead of starting over.
321
+ Each chunk goes through the same API client, so token refresh, retry and the offline check apply to
322
+ every request.
323
+
324
+ ```ts
325
+ import { createDownloadResume, downloadFileResumable } from "@webority/web-core/api";
326
+
327
+ const resume = createDownloadResume(); // keep it for the whole download
328
+ const controller = new AbortController();
329
+
330
+ const file = await downloadFileResumable(userClient, {
331
+ url: `/api/reports/${id}/file`,
332
+ resume,
333
+ signal: controller.signal,
334
+ onProgress: (loaded, total) => setProgress(loaded, total),
335
+ });
336
+ // file.blob and file.fileName, as downloadFile returns
337
+ ```
338
+
339
+ - Pass the same `resume` on every attempt: calling again after a failure or a cancel continues from
340
+ `resume.received`. A finished download clears it.
341
+ - `chunkBytes` sets the size of each request (default 4 MB, `DEFAULT_DOWNLOAD_CHUNK_BYTES`); it must be
342
+ a positive integer.
343
+ - The first answer's strong `ETag`, else its `Last-Modified`, is sent as `If-Range` on later requests.
344
+ When the file changed, or the server ignores `Range`, it answers with the whole file, which replaces
345
+ the bytes held. A `416` answer clears `resume`, so the next attempt starts from the first byte.
346
+ - A broken range answer (a missing or unreadable `Content-Range`, a different start byte, a body length
347
+ that does not match) throws the curated error `download_range_invalid`.
348
+ - A cross-origin API must list `Content-Range`, `ETag`, `Last-Modified` and `Content-Disposition` in
349
+ `Access-Control-Expose-Headers`. Without `Content-Range` the browser hides it and the first chunk
350
+ already fails with `download_range_invalid`.
351
+ - Known gap: an empty (zero-byte) file cannot be fetched this way yet; use `downloadFile` for
352
+ a file that can be empty.
353
+
315
354
  ## Storage
316
355
 
317
356
  `Storage` is async, the same API as mobile-core's, for code shared with an app. `syncStorage` is
@@ -1 +1 @@
1
- import{ContractCallError as e,IDEMPOTENCY_KEY_HEADER as t,buildContractRequest as n,contractFullReply as r,contractReply as i,isFullReplyStatus as a}from"../api-contract/dist/call.js";import{newIdempotencyKey as o}from"./idempotencyKey.js";var s=(e,t)=>Object.keys(e??{}).some(e=>e.toLowerCase()===t.toLowerCase()),c=(c,l)=>{async function u(u,d,f){let p=l[u],m=n(p,d,f);if(f?.keepalive!==void 0&&typeof f.keepalive!=`boolean`)throw new e(`${p.method} ${p.path} needs keepalive as true or false`);let h=p.idempotent===!0&&!s(m.headers,`Idempotency-Key`)?{...m.headers,[t]:o()}:m.headers,g=await c.request({method:m.method,url:m.url,...h!==void 0&&{headers:h},data:m.data,responseType:m.responseType,...m.skipErrorLog!==void 0&&{skipErrorLog:m.skipErrorLog},...m.expectedStatuses!==void 0&&{expectedStatuses:m.expectedStatuses},...m.replacesSession!==void 0&&{replacesSession:m.replacesSession},...f?.keepalive===!0&&{adapter:`fetch`,fetchOptions:{keepalive:!0}},...m.reply===`full`&&{validateStatus:a},...f?.signal!==void 0&&{signal:f.signal},...f?.timeout!==void 0&&{timeout:f.timeout},...f?.retry!==void 0&&{retry:f.retry}});return m.reply===`full`?r(p,g.status,g.headers,g.data):i(p,g.status,g.data)}return u};export{c as createContractCaller};
1
+ import{ContractCallError as e,IDEMPOTENCY_KEY_HEADER as t,buildContractRequest as n,contractFullReply as r,contractReply as i,isFullReplyStatus as a}from"../api-contract/dist/call.js";import{newIdempotencyKey as o}from"./idempotencyKey.js";var s=(e,t)=>Object.keys(e??{}).some(e=>e.toLowerCase()===t.toLowerCase()),c=(c,l)=>{async function u(u,d,f){let p=l[u],m=n(p,d,f);if(f?.keepalive!==void 0&&typeof f.keepalive!=`boolean`)throw new e(`${p.method} ${p.path} needs keepalive as true or false`);let h=p.idempotent===!0&&!s(m.headers,`Idempotency-Key`)?{...m.headers,[t]:o()}:m.headers,g=await c.request({method:m.method,url:m.url,...m.baseUrl!==void 0&&{baseURL:m.baseUrl},...h!==void 0&&{headers:h},data:m.data,responseType:m.responseType,...m.skipErrorLog!==void 0&&{skipErrorLog:m.skipErrorLog},...m.expectedStatuses!==void 0&&{expectedStatuses:m.expectedStatuses},...m.replacesSession!==void 0&&{replacesSession:m.replacesSession},...f?.keepalive===!0&&{adapter:`fetch`,fetchOptions:{keepalive:!0}},...m.reply===`full`&&{validateStatus:a},...f?.signal!==void 0&&{signal:f.signal},...f?.timeout!==void 0&&{timeout:f.timeout},...f?.retry!==void 0&&{retry:f.retry}});return m.reply===`full`?r(p,g.status,g.headers,g.data):i(p,g.status,g.data)}return u};export{c as createContractCaller};
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- import{IDEMPOTENCY_KEY_HEADER as e,listQuery as t}from"../api-contract/dist/call.js";import{initSessionAuth as n}from"../initSessionAuth.js";import{initUserAuth as r}from"../initUserAuth.js";import{readBlobErrorBody as i}from"./blobErrorBody.js";import{ACCOUNT_ID_HEADER as a,CLIENT_BUILD_HEADER as o,CLIENT_KIND as s,CLIENT_KIND_HEADER as c,getClientBuild as l}from"./clientHeaders.js";import{createContractCaller as u}from"./contractCaller.js";import{REFRESH_LOCK_NAME as d,withCrossTabRefreshLock as f}from"./crossTabRefreshLock.js";import{DESIGN_SAMPLE_HEADER as p,DESIGN_SAMPLE_QUERY_KEY as m,DESIGN_SAMPLE_STORAGE_KEY as h,applyDesignSample as g,readDesignSampleTicket as _}from"./designSample.js";import{contentDispositionFileName as v,downloadFile as y}from"./downloadFile.js";import{newIdempotencyKey as b}from"./idempotencyKey.js";import{MIN_APP_VERSION_HEADER as x,addMinAppVersionListener as S,getMinAppVersion as C}from"./minAppVersion.js";import w from"./publicClient.js";import{TRACEPARENT_HEADER as T,applyRequestDefaults as E,newTraceparent as D}from"./requestDefaults.js";import{attachRetry as O,isNeverSentError as k,isRetryableFailure as A,isRetryableStatus as j,retryAfterMs as M}from"./retry.js";import{sessionClient as N}from"./sessionClient.js";import{SESSION_EXPIRED_CODE as P,SESSION_REVOKED_CODE as F,injectStore as I,injectUserAuth as L,refreshAccessToken as R,resetRefreshState as z}from"./tokenRefresh.js";import B,{RequestOfflineError as V}from"./userClient.js";import{WORKSPACE_CHANGED_CODE as H,WorkspaceChangedError as U,isWorkspaceChangedError as W}from"./workspaceChanged.js";export{a as ACCOUNT_ID_HEADER,o as CLIENT_BUILD_HEADER,s as CLIENT_KIND,c as CLIENT_KIND_HEADER,p as DESIGN_SAMPLE_HEADER,m as DESIGN_SAMPLE_QUERY_KEY,h as DESIGN_SAMPLE_STORAGE_KEY,e as IDEMPOTENCY_KEY_HEADER,x as MIN_APP_VERSION_HEADER,d as REFRESH_LOCK_NAME,V as RequestOfflineError,P as SESSION_EXPIRED_CODE,F as SESSION_REVOKED_CODE,T as TRACEPARENT_HEADER,H as WORKSPACE_CHANGED_CODE,U as WorkspaceChangedError,S as addMinAppVersionListener,g as applyDesignSample,E as applyRequestDefaults,O as attachRetry,v as contentDispositionFileName,u as createContractCaller,y as downloadFile,l as getClientBuild,C as getMinAppVersion,n as initSessionAuth,r as initUserAuth,I as injectStore,L as injectUserAuth,k as isNeverSentError,A as isRetryableFailure,j as isRetryableStatus,W as isWorkspaceChangedError,t as listQuery,b as newIdempotencyKey,D as newTraceparent,w as publicClient,i as readBlobErrorBody,_ as readDesignSampleTicket,R as refreshAccessToken,z as resetRefreshState,M as retryAfterMs,N as sessionClient,B as userClient,f as withCrossTabRefreshLock};
1
+ import{IDEMPOTENCY_KEY_HEADER as e,listQuery as t,mergeContracts as n,withBaseUrl as r}from"../api-contract/dist/call.js";import{initSessionAuth as i}from"../initSessionAuth.js";import{initUserAuth as a}from"../initUserAuth.js";import{readBlobErrorBody as o}from"./blobErrorBody.js";import{ACCOUNT_ID_HEADER as s,CLIENT_BUILD_HEADER as c,CLIENT_KIND as l,CLIENT_KIND_HEADER as u,getClientBuild as d}from"./clientHeaders.js";import{createContractCaller as f}from"./contractCaller.js";import{REFRESH_LOCK_NAME as p,withCrossTabRefreshLock as m}from"./crossTabRefreshLock.js";import{DESIGN_SAMPLE_HEADER as h,DESIGN_SAMPLE_QUERY_KEY as g,DESIGN_SAMPLE_STORAGE_KEY as _,applyDesignSample as v,readDesignSampleTicket as y}from"./designSample.js";import{contentDispositionFileName as b,downloadFile as x}from"./downloadFile.js";import{newIdempotencyKey as S}from"./idempotencyKey.js";import{MIN_APP_VERSION_HEADER as C,addMinAppVersionListener as w,getMinAppVersion as T}from"./minAppVersion.js";import E from"./publicClient.js";import{TRACEPARENT_HEADER as D,applyRequestDefaults as O,newTraceparent as k}from"./requestDefaults.js";import{DEFAULT_DOWNLOAD_CHUNK_BYTES as A,DOWNLOAD_RANGE_INVALID_CODE as j,DOWNLOAD_RANGE_INVALID_MESSAGE as M,createDownloadResume as N,downloadFileResumable as P}from"./resumableDownload.js";import{attachRetry as F,isNeverSentError as I,isRetryableFailure as L,isRetryableStatus as R,retryAfterMs as z}from"./retry.js";import{sessionClient as B}from"./sessionClient.js";import{SESSION_EXPIRED_CODE as V,SESSION_REVOKED_CODE as H,injectStore as U,injectUserAuth as W,refreshAccessToken as G,resetRefreshState as K}from"./tokenRefresh.js";import{UPLOAD_CANCELLED_CODE as q,UPLOAD_CANCELLED_MESSAGE as J,uploadFile as Y}from"./uploadFile.js";import X,{RequestOfflineError as Z}from"./userClient.js";import{WORKSPACE_CHANGED_CODE as Q,WorkspaceChangedError as $,isWorkspaceChangedError as ee}from"./workspaceChanged.js";export{s as ACCOUNT_ID_HEADER,c as CLIENT_BUILD_HEADER,l as CLIENT_KIND,u as CLIENT_KIND_HEADER,A as DEFAULT_DOWNLOAD_CHUNK_BYTES,h as DESIGN_SAMPLE_HEADER,g as DESIGN_SAMPLE_QUERY_KEY,_ as DESIGN_SAMPLE_STORAGE_KEY,j as DOWNLOAD_RANGE_INVALID_CODE,M as DOWNLOAD_RANGE_INVALID_MESSAGE,e as IDEMPOTENCY_KEY_HEADER,C as MIN_APP_VERSION_HEADER,p as REFRESH_LOCK_NAME,Z as RequestOfflineError,V as SESSION_EXPIRED_CODE,H as SESSION_REVOKED_CODE,D as TRACEPARENT_HEADER,q as UPLOAD_CANCELLED_CODE,J as UPLOAD_CANCELLED_MESSAGE,Q as WORKSPACE_CHANGED_CODE,$ as WorkspaceChangedError,w as addMinAppVersionListener,v as applyDesignSample,O as applyRequestDefaults,F as attachRetry,b as contentDispositionFileName,f as createContractCaller,N as createDownloadResume,x as downloadFile,P as downloadFileResumable,d as getClientBuild,T as getMinAppVersion,i as initSessionAuth,a as initUserAuth,U as injectStore,W as injectUserAuth,I as isNeverSentError,L as isRetryableFailure,R as isRetryableStatus,ee as isWorkspaceChangedError,t as listQuery,n as mergeContracts,S as newIdempotencyKey,k as newTraceparent,E as publicClient,o as readBlobErrorBody,y as readDesignSampleTicket,G as refreshAccessToken,K as resetRefreshState,z as retryAfterMs,B as sessionClient,Y as uploadFile,X as userClient,r as withBaseUrl,m as withCrossTabRefreshLock};
@@ -0,0 +1 @@
1
+ import{extractApiError as e}from"../errors/extractApiError.js";import{readBlobErrorBody as t}from"./blobErrorBody.js";import{contentDispositionFileName as n}from"./downloadFile.js";var r=4194304,i=`download_range_invalid`,a=`The download could not be continued. Please try again.`,o=()=>({chunks:[],received:0,total:null,validator:null,fileName:null,contentType:``}),s=e=>{e.chunks=[],e.received=0,e.total=null,e.validator=null,e.fileName=null,e.contentType=``},c=(e,t)=>{if(typeof e==`object`&&e)return`get`in e&&typeof e.get==`function`?e.get.call(e,t):Reflect.get(e,t)},l=e=>({code:i,message:a,fieldErrors:{},status:0,offline:!1,traceId:null,diagnostic:e,extensions:{}}),u=/^bytes (\d+)-(\d+)\/(\d+)$/i,d=e=>{if(typeof e!=`string`)return null;let t=u.exec(e);if(t===null)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return[n,r,i].every(e=>Number.isSafeInteger(e))?{start:n,end:r,total:i}:null},f=e=>{let t=c(e,`etag`);if(typeof t==`string`&&t!==``&&!t.startsWith(`W/`))return t;let n=c(e,`last-modified`);return typeof n==`string`&&n!==``?n:null},p=e=>{let t=c(e,`content-disposition`);return typeof t==`string`?n(t):null},m=async(n,i)=>{let{resume:a,chunkBytes:o=r,onProgress:u,signal:m,...h}=i;if(!Number.isSafeInteger(o)||o<1)throw RangeError(`downloadFileResumable: chunkBytes must be a positive integer.`);for(;a.total===null||a.received<a.total;){let r=a.received,i=r>0&&a.validator!==null?{"If-Range":a.validator}:{},g={...h.headers,Range:`bytes=${r}-${r+o-1}`,...i},_;try{_=await n.request({...h,headers:g,responseType:`blob`,...m===void 0?{}:{signal:m},...u===void 0?{}:{onDownloadProgress:e=>u(r+e.loaded,a.total)}})}catch(n){await t(n);let r=e(n);throw r.status===416&&s(a),r}let v=_.data;if(!(v instanceof Blob))throw l(`"${h.url??``}" answered without a file body.`);if(_.status===206){let e=d(c(_.headers,`content-range`));if(e===null)throw l(`Content-Range missing or unreadable (a cross-origin server must expose it).`);if(e.start!==r)throw l(`asked for byte ${r}, got ${e.start}.`);if(v.size===0)throw l(`an empty range answer.`);if(v.size!==e.end-e.start+1)throw l(`the body length does not match Content-Range.`);r===0&&(a.validator=f(_.headers),a.contentType=v.type,a.fileName=p(_.headers)),a.total=e.total,a.chunks.push(v),a.received+=v.size}else s(a),a.chunks.push(v),a.received=v.size,a.total=v.size,a.contentType=v.type,a.validator=f(_.headers),a.fileName=p(_.headers);u?.(a.received,a.total)}let g={blob:new Blob(a.chunks,{type:a.contentType}),fileName:a.fileName};return s(a),g};export{r as DEFAULT_DOWNLOAD_CHUNK_BYTES,i as DOWNLOAD_RANGE_INVALID_CODE,a as DOWNLOAD_RANGE_INVALID_MESSAGE,o as createDownloadResume,m as downloadFileResumable};
@@ -0,0 +1 @@
1
+ import{extractApiError as e}from"../errors/extractApiError.js";var t=`upload-cancelled`,n=`The upload was cancelled.`,r=async(r,i)=>{let{onProgress:a,signal:o,method:s=`POST`,...c}=i;try{return(await r.request({...c,method:s,...o===void 0?{}:{signal:o},...a===void 0?{}:{onUploadProgress:e=>a(e.loaded,e.total??null)}})).data}catch(r){let i=e(r);throw i.code===`request_canceled`?{...i,code:t,message:n}:i}};export{t as UPLOAD_CANCELLED_CODE,n as UPLOAD_CANCELLED_MESSAGE,r as uploadFile};
@@ -1 +1 @@
1
- var e=`Idempotency-Key`,t=class extends Error{constructor(e){super(e),this.name=`ContractCallError`}},n=/\{([^{}]+)\}/g,r=e=>e instanceof Date?encodeURIComponent(e.toISOString()):encodeURIComponent(typeof e==`object`?JSON.stringify(e):String(e));function i(e){let t=[];for(let[n,i]of Object.entries(e??{})){if(i==null)continue;let e=encodeURIComponent(n);for(let n of Array.isArray(i)?i:[i])n!=null&&t.push(`${e}=${r(n)}`)}return t.join(`&`)}var a=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,o=[`content-type`,`content-length`],s=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function c(e,n,r){if(r===void 0)return n;if(!s(r))throw new t(`${e} needs call headers as an object of header names to string values`);let i=new Set(Object.keys(n??{}).map(e=>e.toLowerCase())),c={...n};for(let[n,s]of Object.entries(r)){if(!a.test(n))throw new t(`${e} has a call header named "${n}", which is not a valid header name`);let r=n.toLowerCase();if(o.includes(r))throw new t(`${e} sets "${n}" as a call header; the body decides it`);if(i.has(r))throw new t(`${e} sets "${n}" twice; set a header the contract declares on the request's headers only`);if(typeof s!=`string`||/[\r\n\0]/.test(s))throw new t(`${e} needs call header "${n}" as a string with no line break`);i.add(r),c[n]=s}return c}function l(e,n){let r=n?.skipErrorLog,i=n?.expectedStatuses;if(r!==void 0&&typeof r!=`boolean`)throw new t(`${e} needs skipErrorLog as true or false`);if(i===void 0)return{skipErrorLog:r,expectedStatuses:void 0};if(!Array.isArray(i)||i.length===0)throw new t(`${e} needs expectedStatuses as a non-empty list of failure statuses`);for(let n of i)if(!Number.isInteger(n)||n<400||n>599)throw new t(`${e} lists ${String(n)} in expectedStatuses; only a failure status from 400 to 599 is expected`);if(new Set(i).size!==i.length)throw new t(`${e} lists a status twice in expectedStatuses`);if(r===!0)throw new t(`${e} sets skipErrorLog and expectedStatuses; skipErrorLog already keeps every failure out of the log`);return{skipErrorLog:r,expectedStatuses:i}}function u(e,n){let r=n?.reply,i=n?.replacesSession;if(r!==void 0&&r!==`body`&&r!==`full`)throw new t(`${e} needs reply as "body" or "full"`);if(i!==void 0&&typeof i!=`boolean`)throw new t(`${e} needs replacesSession as true or false`);return{reply:r??`body`,replacesSession:i}}var d=e=>e>=200&&e<300||e===304;function f(e,t,n,r){let i={};for(let[e,t]of Object.entries(n))t!=null&&(i[e.toLowerCase()]=Array.isArray(t)?t.map(String).join(`, `):String(t));return t===304?{status:304,notModified:!0,headers:i,body:void 0}:{status:t,notModified:!1,headers:i,body:p(e,t,r)}}function p(e,t,n){return e.replyKind===`none`||t===204||t===205?void 0:n}function m(e,r,a){let o=`${e.method} ${e.path}`,s=e.path.replace(n,(e,n)=>{let i=r.path?.[n],a=i===void 0?``:String(i);if(a===``)throw new t(`${o} needs a non-empty path value for "${n}"`);if(a===`.`||a===`..`)throw new t(`${o} needs a path value for "${n}" other than "." or ".."`);return encodeURIComponent(a)}),d=i(r.query);return{method:e.method,url:d===``?s:`${s}?${d}`,headers:c(o,r.headers,a?.headers),data:r.body,responseType:e.replyKind===`blob`?`blob`:`json`,...l(o,a),...u(o,a)}}var h=[`page`,`pageSize`,`sortBy`,`sortOrder`,`search`],g=e=>String(e).padStart(2,`0`),_=e=>e instanceof Date?`${e.getFullYear()}-${g(e.getMonth()+1)}-${g(e.getDate())}`:e,v=e=>e==null||typeof e==`string`&&e.trim()===``,y=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date),b=h;function x(e,n,r){if(!v(r)){if(typeof r==`string`||r instanceof Date)return _(r);throw new t(`listQuery needs "${e}.${n}" as a yyyy-MM-dd string or a Date`)}}function S(e){let n={},{filters:r,...i}=e;for(let e of h){let t=i[e];v(t)||(n[e]=typeof t==`string`?t.trim():t)}n.sortBy===void 0&&delete n.sortOrder;for(let[e,i]of Object.entries(r??{})){if(b.includes(e))throw new t(`listQuery has a filter named "${e}", which the list query reserves (${h.join(`, `)})`);if(Array.isArray(i)){let t=i.filter(e=>!v(e));t.length>0&&(n[e]=t)}else if(y(i)){let t=x(e,`from`,i.from),r=x(e,`to`,i.to);t!==void 0&&(n[`${e}From`]=t),r!==void 0&&(n[`${e}To`]=r)}else i instanceof Date?n[e]=_(i):v(i)||(n[e]=i)}return n}export{t as ContractCallError,e as IDEMPOTENCY_KEY_HEADER,m as buildContractRequest,f as contractFullReply,p as contractReply,d as isFullReplyStatus,S as listQuery};
1
+ var e=`Idempotency-Key`;function t(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`}function n(e,t){return Object.keys(t).every(t=>Object.hasOwn(e,t))}function r(e,r){if(!t(r))throw new a(`withBaseUrl needs an absolute http or https address and got "${r}"`);let i=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{...t,baseUrl:r}]));if(!n(i,e))throw new a(`withBaseUrl lost an operation while binding the table`);return i}function i(e,t){let n=Object.keys(e).filter(e=>Object.hasOwn(t,e)).sort();if(n.length>0){let e=n.length===1?`is`:`are`;throw new a(`mergeContracts: the operation ${n.join(`, `)} ${e} in both contracts; an operation has one host, so rename it in one backend`)}return{...e,...t}}var a=class extends Error{constructor(e){super(e),this.name=`ContractCallError`}},o=/\{([^{}]+)\}/g,s=e=>e instanceof Date?encodeURIComponent(e.toISOString()):encodeURIComponent(typeof e==`object`?JSON.stringify(e):String(e));function c(e){let t=[];for(let[n,r]of Object.entries(e??{})){if(r==null)continue;let e=encodeURIComponent(n);for(let n of Array.isArray(r)?r:[r])n!=null&&t.push(`${e}=${s(n)}`)}return t.join(`&`)}var l=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,u=[`content-type`,`content-length`],d=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function f(e,t,n){if(n===void 0)return t;if(!d(n))throw new a(`${e} needs call headers as an object of header names to string values`);let r=new Set(Object.keys(t??{}).map(e=>e.toLowerCase())),i={...t};for(let[t,o]of Object.entries(n)){if(!l.test(t))throw new a(`${e} has a call header named "${t}", which is not a valid header name`);let n=t.toLowerCase();if(u.includes(n))throw new a(`${e} sets "${t}" as a call header; the body decides it`);if(r.has(n))throw new a(`${e} sets "${t}" twice; set a header the contract declares on the request's headers only`);if(typeof o!=`string`||/[\r\n\0]/.test(o))throw new a(`${e} needs call header "${t}" as a string with no line break`);r.add(n),i[t]=o}return i}function p(e,t){let n=t?.skipErrorLog,r=t?.expectedStatuses;if(n!==void 0&&typeof n!=`boolean`)throw new a(`${e} needs skipErrorLog as true or false`);if(r===void 0)return{skipErrorLog:n,expectedStatuses:void 0};if(!Array.isArray(r)||r.length===0)throw new a(`${e} needs expectedStatuses as a non-empty list of failure statuses`);for(let t of r)if(!Number.isInteger(t)||t<400||t>599)throw new a(`${e} lists ${String(t)} in expectedStatuses; only a failure status from 400 to 599 is expected`);if(new Set(r).size!==r.length)throw new a(`${e} lists a status twice in expectedStatuses`);if(n===!0)throw new a(`${e} sets skipErrorLog and expectedStatuses; skipErrorLog already keeps every failure out of the log`);return{skipErrorLog:n,expectedStatuses:r}}function m(e,t){let n=t?.reply,r=t?.replacesSession;if(n!==void 0&&n!==`body`&&n!==`full`)throw new a(`${e} needs reply as "body" or "full"`);if(r!==void 0&&typeof r!=`boolean`)throw new a(`${e} needs replacesSession as true or false`);return{reply:n??`body`,replacesSession:r}}var h=e=>e>=200&&e<300||e===304;function g(e,t,n,r){let i={};for(let[e,t]of Object.entries(n))t!=null&&(i[e.toLowerCase()]=Array.isArray(t)?t.map(String).join(`, `):String(t));return t===304?{status:304,notModified:!0,headers:i,body:void 0}:{status:t,notModified:!1,headers:i,body:_(e,t,r)}}function _(e,t,n){return e.replyKind===`none`||t===204||t===205?void 0:n}function v(e,t,n){let r=`${e.method} ${e.path}`,i=e.path.replace(o,(e,n)=>{let i=t.path?.[n],o=i===void 0?``:String(i);if(o===``)throw new a(`${r} needs a non-empty path value for "${n}"`);if(o===`.`||o===`..`)throw new a(`${r} needs a path value for "${n}" other than "." or ".."`);return encodeURIComponent(o)}),s=c(t.query);return{method:e.method,url:s===``?i:`${i}?${s}`,headers:f(r,t.headers,n?.headers),data:t.body,responseType:e.replyKind===`blob`?`blob`:`json`,...p(r,n),...m(r,n),...e.baseUrl===void 0?{}:{baseUrl:e.baseUrl}}}var y=[`page`,`pageSize`,`sortBy`,`sortOrder`,`search`],b=e=>String(e).padStart(2,`0`),x=e=>e instanceof Date?`${e.getFullYear()}-${b(e.getMonth()+1)}-${b(e.getDate())}`:e,S=e=>e==null||typeof e==`string`&&e.trim()===``,C=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date),w=y;function T(e,t,n){if(!S(n)){if(typeof n==`string`||n instanceof Date)return x(n);throw new a(`listQuery needs "${e}.${t}" as a yyyy-MM-dd string or a Date`)}}function E(e){let t={},{filters:n,...r}=e;for(let e of y){let n=r[e];S(n)||(t[e]=typeof n==`string`?n.trim():n)}t.sortBy===void 0&&delete t.sortOrder;for(let[e,r]of Object.entries(n??{})){if(w.includes(e))throw new a(`listQuery has a filter named "${e}", which the list query reserves (${y.join(`, `)})`);if(Array.isArray(r)){let n=r.filter(e=>!S(e));n.length>0&&(t[e]=n)}else if(C(r)){let n=T(e,`from`,r.from),i=T(e,`to`,r.to);n!==void 0&&(t[`${e}From`]=n),i!==void 0&&(t[`${e}To`]=i)}else r instanceof Date?t[e]=x(r):S(r)||(t[e]=r)}return t}export{a as ContractCallError,e as IDEMPOTENCY_KEY_HEADER,v as buildContractRequest,g as contractFullReply,_ as contractReply,h as isFullReplyStatus,E as listQuery,i as mergeContracts,r as withBaseUrl};
@@ -1,2 +1,2 @@
1
- import{isOfflineFailure as e}from"./requestPlatform.js";var t=`Something went wrong on our side. Please try again in a moment.`,n=`You appear to be offline. Check your connection and try again.`,r=`We couldn't reach the server. Check your connection and try again.`,i=`That took too long to respond. Check your connection and try again.`,a=`Something went wrong. Please try again.`,o=`request_canceled`,s=`contract_error`,c=`timeout`,l=`network`,u=`offline`,d=300,f=`internal_error`,p=e=>`Request failed (${e})`,m={401:{code:`unauthorized`,sentence:`Please sign in to continue.`},403:{code:`forbidden`,sentence:`You do not have access to this.`}},h=e=>typeof e==`object`&&!!e&&!Array.isArray(e),g=e=>typeof e==`string`&&e.trim().length>0?e:null,_=(e,t)=>{let n=m[e];if(n===void 0||t===null||t.code!==n.code)return null;let r=g(t.detail);return r===null||r===n.sentence?n.sentence:null},v=e=>e.length>d||/^\s*</.test(e)||e.includes(`
2
- at `)||/(Exception|StackTrace):/.test(e)||/\b(System|Microsoft)\.[A-Za-z]+\.[A-Za-z]/.test(e),y=e=>{let t=g(e);return t!==null&&!v(t)?t:null},b=e=>e.replace(/^\$\.?/,``).split(`.`).map(e=>e.charAt(0).toLowerCase()+e.slice(1)).join(`.`),x=e=>{if(Array.isArray(e)){for(let t of e){let e=g(t);if(e!==null)return e}return null}return g(e)},S=(e,t,n)=>{let r=b(t);r===``?e.form??=n:r in e.fields||(e.fields[r]=n)},C=e=>{let t={fields:{},form:null};if(Array.isArray(e)){for(let n of e){if(!h(n))continue;let e=g(n.message);e!==null&&S(t,typeof n.field==`string`?n.field:``,e)}return t}if(!h(e))return t;for(let[n,r]of Object.entries(e)){let e=x(r);e!==null&&S(t,n,e)}return t},w=e=>h(e)&&typeof e.message==`string`&&typeof e.status==`number`&&typeof e.offline==`boolean`&&h(e.fieldErrors)&&h(e.extensions),T=e=>({code:null,fieldErrors:{},status:0,offline:!1,traceId:null,diagnostic:null,extensions:{},...e}),E=/* @__PURE__ */ new Set([`type`,`title`,`status`,`detail`,`instance`,`code`,`errors`,`traceId`]),D=e=>e===null?{}:Object.fromEntries(Object.entries(e).filter(([e])=>!E.has(e))),O=e=>{let t=h(e.config)?e.config.headers:void 0;if(!h(t))return null;let n=typeof t.get==`function`?t.get(`traceparent`):t.traceparent??t.Traceparent;return(typeof n==`string`?/^00-([0-9a-f]{32})-[0-9a-f]{16}-[0-9a-f]{2}$/.exec(n):null)?.[1]??null},k=t=>{let s=g(t.code),d=g(t.name),f=g(t.message),p=O(t);return d===`CanceledError`||s===`ERR_CANCELED`?T({code:o,message:a,traceId:p,diagnostic:f}):s===`ECONNABORTED`||s===`ETIMEDOUT`?T({code:c,message:i,offline:!0,traceId:p,diagnostic:f}):d===`RequestOfflineError`||s===`ERR_NETWORK`||f===`Network Error`||f===`Network request failed`?e(t)?T({code:u,message:n,offline:!0,traceId:p,diagnostic:f}):T({code:l,message:r,offline:!0,traceId:p,diagnostic:f}):T({message:a,traceId:p,diagnostic:f})};function A(e){if(w(e))return e;if(typeof e==`string`)return T({message:y(e)??`Something went wrong. Please try again.`,diagnostic:e||null});if(!h(e))return T({message:a,diagnostic:e==null?null:String(e)});if(e.isContractError===!0)return T({code:s,message:y(e.message)??`Something went wrong. Please try again.`,diagnostic:g(e.message)});let t=h(e.response)?e.response:null,n=typeof t?.status==`number`?t.status:typeof e.status==`number`?e.status:0,r=t?t.data:e.body;if(n===0&&r==null)return k(e);let i=h(r)?r:null,{fields:o,form:c}=C(i?.errors),l=g(i?.code),u=g(i?.traceId)??O(e),d=g(i?.detail)??g(i?.title)??g(r)??g(e.message),m;m=n>=500?(l!==null&&l!==f?y(i?.detail):null)??`Something went wrong on our side. Please try again in a moment.`:_(n,i)??y(Object.values(o)[0])??y(c)??y(i?.detail)??y(i?.title)??y(r)??(n?p(n):`Something went wrong. Please try again.`);let v=h(e.config)?e.config:null,b=v===null?null:g(v.url),x=v!==null&&`_accountId`in v?g(v._accountId):null;return T({code:l,message:m,fieldErrors:o,status:n,traceId:u,diagnostic:d,extensions:D(i),...b===null?{}:{requestUrl:b},...x===null?{}:{accountId:x}})}var j=e=>A(e).offline;function M(e,t){let n=A(e);return n.offline||t!==null&&!t||n.status>=500&&n.message!==`Something went wrong on our side. Please try again in a moment.`?n.message:n.status>=500||n.code===`request_canceled`||n.message===`Something went wrong. Please try again.`||n.message===p(n.status)?t??null:n.message}export{s as CONTRACT_ERROR_CODE,l as NETWORK_CODE,u as OFFLINE_CODE,n as OFFLINE_MESSAGE,o as REQUEST_CANCELED_CODE,t as SERVER_FAILURE_MESSAGE,c as TIMEOUT_CODE,i as TIMEOUT_MESSAGE,a as UNEXPECTED_MESSAGE,r as UNREACHABLE_MESSAGE,M as apiErrorMessage,A as extractApiError,w as isApiError,j as isNoResponse,b as toFieldPath};
1
+ import{isOfflineFailure as e}from"./requestPlatform.js";var t=`Something went wrong on our side. Please try again in a moment.`,n=`You appear to be offline. Check your connection and try again.`,r=`We couldn't reach the server. Check your connection and try again.`,i=`That took too long to respond. Check your connection and try again.`,a=`Something went wrong. Please try again.`,o=`request_canceled`,s=`contract_error`,c=`timeout`,l=`network`,u=`offline`,d=300,f=`internal_error`,p=e=>`Request failed (${e})`,m={401:{code:`unauthorized`,sentence:`Please sign in to continue.`},403:{code:`forbidden`,sentence:`You do not have access to this.`}},h=e=>typeof e==`object`&&!!e&&!Array.isArray(e),g=e=>typeof e==`string`&&e.trim().length>0?e:null,_=(e,t)=>{let n=m[e];if(n===void 0||t===null||t.code!==n.code)return null;let r=g(t.detail);return r===null||r===n.sentence?n.sentence:null},v=e=>/^\s*</.test(e)||e.includes(`
2
+ at `)||/(Exception|StackTrace):/.test(e)||/\b(System|Microsoft)\.[A-Za-z]+\.[A-Za-z]/.test(e),y=(e,t)=>{let n=g(e);return n!==null&&!v(n)&&!(t&&n.length>d)?n:null},b=e=>e.replace(/^\$\.?/,``).split(`.`).map(e=>e.charAt(0).toLowerCase()+e.slice(1)).join(`.`),x=e=>{if(Array.isArray(e)){for(let t of e){let e=g(t);if(e!==null)return e}return null}return g(e)},S=(e,t,n)=>{let r=b(t);r===``?e.form??=n:r in e.fields||(e.fields[r]=n)},C=e=>{let t={fields:{},form:null};if(Array.isArray(e)){for(let n of e){if(!h(n))continue;let e=g(n.message);e!==null&&S(t,typeof n.field==`string`?n.field:``,e)}return t}if(!h(e))return t;for(let[n,r]of Object.entries(e)){let e=x(r);e!==null&&S(t,n,e)}return t},w=e=>h(e)&&typeof e.message==`string`&&typeof e.status==`number`&&typeof e.offline==`boolean`&&h(e.fieldErrors)&&h(e.extensions),T=e=>({code:null,fieldErrors:{},status:0,offline:!1,traceId:null,diagnostic:null,extensions:{},...e}),E=/* @__PURE__ */ new Set([`type`,`title`,`status`,`detail`,`instance`,`code`,`errors`,`traceId`]),D=e=>e===null?{}:Object.fromEntries(Object.entries(e).filter(([e])=>!E.has(e))),O=e=>{let t=h(e.config)?e.config.headers:void 0;if(!h(t))return null;let n=typeof t.get==`function`?t.get(`traceparent`):t.traceparent??t.Traceparent;return(typeof n==`string`?/^00-([0-9a-f]{32})-[0-9a-f]{16}-[0-9a-f]{2}$/.exec(n):null)?.[1]??null},k=t=>{let s=g(t.code),d=g(t.name),f=g(t.message),p=O(t);return d===`CanceledError`||s===`ERR_CANCELED`?T({code:o,message:a,traceId:p,diagnostic:f}):s===`ECONNABORTED`||s===`ETIMEDOUT`?T({code:c,message:i,offline:!0,traceId:p,diagnostic:f}):d===`RequestOfflineError`||s===`ERR_NETWORK`||f===`Network Error`||f===`Network request failed`?e(t)?T({code:u,message:n,offline:!0,traceId:p,diagnostic:f}):T({code:l,message:r,offline:!0,traceId:p,diagnostic:f}):T({message:a,traceId:p,diagnostic:f})};function A(e){if(w(e))return e;if(typeof e==`string`)return T({message:y(e,!0)??`Something went wrong. Please try again.`,diagnostic:e||null});if(!h(e))return T({message:a,diagnostic:e==null?null:String(e)});if(e.isContractError===!0)return T({code:s,message:y(e.message,!0)??`Something went wrong. Please try again.`,diagnostic:g(e.message)});let t=h(e.response)?e.response:null,n=typeof t?.status==`number`?t.status:typeof e.status==`number`?e.status:0,r=t?t.data:e.body;if(n===0&&r==null)return k(e);let i=h(r)?r:null,{fields:o,form:c}=C(i?.errors),l=g(i?.code),u=n>=500||l===null,d=g(i?.traceId)??O(e),m=g(i?.detail)??g(i?.title)??g(r)??g(e.message),v;v=n>=500?(l!==null&&l!==f?y(i?.detail,!0):null)??`Something went wrong on our side. Please try again in a moment.`:_(n,i)??y(Object.values(o)[0],u)??y(c,u)??y(i?.detail,u)??y(i?.title,u)??y(r,u)??(n?p(n):`Something went wrong. Please try again.`);let b=h(e.config)?e.config:null,x=b===null?null:g(b.url),S=b!==null&&`_accountId`in b?g(b._accountId):null;return T({code:l,message:v,fieldErrors:o,status:n,traceId:d,diagnostic:m,extensions:D(i),...x===null?{}:{requestUrl:x},...S===null?{}:{accountId:S}})}var j=e=>A(e).offline;function M(e,t){let n=A(e);return n.offline||t!==null&&!t||n.status>=500&&n.message!==`Something went wrong on our side. Please try again in a moment.`?n.message:n.status>=500||n.code===`request_canceled`||n.message===`Something went wrong. Please try again.`||n.message===p(n.status)?t??null:n.message}export{s as CONTRACT_ERROR_CODE,l as NETWORK_CODE,u as OFFLINE_CODE,n as OFFLINE_MESSAGE,o as REQUEST_CANCELED_CODE,t as SERVER_FAILURE_MESSAGE,c as TIMEOUT_CODE,i as TIMEOUT_MESSAGE,a as UNEXPECTED_MESSAGE,r as UNREACHABLE_MESSAGE,M as apiErrorMessage,A as extractApiError,w as isApiError,j as isNoResponse,b as toFieldPath};
@@ -1 +1 @@
1
- import{configuredLocale as e,getFormatterConfig as t,groupingForLocale as n,numberSeparators as r,styledNumber as i}from"./formatConfig.js";import{dateTimeFormat as a,numberFormat as o,relativeTimeFormat as s}from"./intlCache.js";var c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=330,u=[`IST`,`Asia/Kolkata`,`Asia/Calcutta`],d=/^\d{4}-\d{2}-\d{2}$/,f=e=>e<10?`0${e}`:`${e}`,p=e=>e??t().empty,m=e=>{if(e==null||e===``)return null;let t=e instanceof Date?e:new Date(typeof e==`string`?e.trim():e);return Number.isNaN(t.getTime())?null:t},h=e=>typeof e==`string`&&d.test(e.trim()),g=e=>{if(e===0)return`GMT`;let t=e>0?`+`:`-`,n=Math.abs(e),r=n%60;return`GMT${t}${Math.floor(n/60)}${r===0?``:`:${f(r)}`}`},_=(e,t,n)=>{let r=new Date(e.getTime()+t*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth(),day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),label:n}},ee=(e,t)=>{let n=a(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,hour12:!1}).format(e),r=n.match(/\d+/g)??[];if(r.length!==5)throw Error(`Unexpected date text from Intl for zone ${t}: ${n}`);let[i=``,o=``,s=``,c=``,l=``]=r,u=Number.parseInt(s,10),d=Number.parseInt(i,10)-1,f=Number.parseInt(o,10),p=Number.parseInt(c,10)%24,m=Number.parseInt(l,10);return{year:u,month:d,day:f,hour:p,minute:m,label:g(Math.round((Date.UTC(u,d,f,p,m)-Math.floor(e.getTime()/6e4)*6e4)/6e4))}},v=(e,t)=>u.includes(t)?_(e,l,`IST`):t===`UTC`?_(e,0,`UTC`):t===`viewer`?{year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),label:g(-e.getTimezoneOffset())}:ee(e,t),y=e=>e.hourCycle??12,b=e=>`${f(e.day)}-${c[e.month]}-${e.year}`,x=(e,t)=>{let n=f(e.day),r=f(e.month+1),i=String(e.year).padStart(4,`0`);return t===`DayMonthYear`?`${n}/${r}/${i}`:t===`MonthDayYear`?`${r}/${n}/${i}`:`${i}-${r}-${n}`},S=(e,t)=>t===24?`${f(e.hour)}:${f(e.minute)}`:`${e.hour%12||12}:${f(e.minute)} ${e.hour<12?`AM`:`PM`}`,C=(e,t)=>t??!u.includes(e),w=(e,t,n,r)=>C(n,r)?`${e} ${t.label}`:e,T=e=>{if(e!==`viewer`)return u.includes(e)?`Asia/Kolkata`:e},E=/* @__PURE__ */ new Map,D=e=>{let t=E.get(e);if(t!==void 0)return t;let n=new Intl.NumberFormat(e,{useGrouping:!1}),r=/* @__PURE__ */ new Set;for(let e=0;e<=9;e++)r.add(n.format(e));return E.set(e,r),r},O=(e,t)=>Array.from(e).filter(e=>t.has(e)).join(``),te=e=>typeof e.formatToParts==`function`,ne=(e,t,n)=>{let r=a(t,{day:`2-digit`,month:`short`,year:`numeric`,timeZone:n});if(!te(r)){let r=D(t);return`${O(a(t,{day:`2-digit`,timeZone:n}).format(e),r)}-${a(t,{month:`short`,timeZone:n}).format(e).trim().replace(`.`,``)}-${O(a(t,{year:`numeric`,timeZone:n}).format(e),r)}`}let i=r.formatToParts(e),o=e=>i.find(t=>t.type===e)?.value??``;return`${o(`day`)}-${o(`month`).replace(`.`,``)}-${o(`year`)}`},k=(n,r)=>{let i=t().dateOrder??`DayMonthNameYear`;if(i!==`DayMonthNameYear`)return x(v(n,r),i);let a=e();return a?ne(n,a,T(r)):b(v(n,r))},A=(e,t,n,r)=>a(t,{hour:`2-digit`,minute:`2-digit`,timeZone:T(n),timeZoneName:C(n,r.zoneLabel)?`short`:void 0,hourCycle:r.hourCycle===void 0?void 0:r.hourCycle===24?`h23`:`h12`}).format(e),j=(e,n={})=>{let r=m(e);return r?k(r,h(e)?`UTC`:n.zone??t().zone):p(n.empty)},M=(n,r={})=>{let i=m(n);if(!i)return p(r.empty);let a=r.zone??t().zone,o=e();if(o)return A(i,o,a,r);let s=v(i,a);return w(S(s,y(r)),s,a,r.zoneLabel)},N=(n,r={})=>{let i=m(n);if(!i)return p(r.empty);let a=r.zone??t().zone,o=e();if(o)return`${k(i,a)}, ${A(i,o,a,r)}`;let s=v(i,a);return w(`${k(i,a)}, ${S(s,y(r))}`,s,a,r.zoneLabel)},P=1e3,F=60*P,I=60*F,L=24*I,R=7*L,z=30*L,B=365*L,V=[[`year`,B],[`month`,z],[`day`,L],[`hour`,I],[`minute`,F]],H=(n,r={})=>{let i=m(n),a=m(r.now??Date.now());if(!i||!a)return p(r.empty);let o=i.getTime()-a.getTime(),c=Math.abs(o),l=typeof Intl.RelativeTimeFormat==`function`?Intl.RelativeTimeFormat:void 0,u=e();if((u!==null||r.intl===!0)&&typeof l==`function`){let e=s(l,u??t().locale),[n,r]=V.find(([,e])=>c>=e)??[`second`,P];return e.format(Math.round(o/r),n)}if(c<F)return`just now`;let[d,f]=c<I?[`minute`,F]:c<L?[`hour`,I]:c<R?[`day`,L]:c<z?[`week`,R]:c<B?[`month`,z]:[`year`,B],h=Math.floor(c/f),g=`${h} ${d}${h===1?``:`s`}`;return o<0?`${g} ago`:`in ${g}`},U=e=>{if(e==null||typeof e==`string`&&e.trim()===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null},W=e=>Math.min(20,Math.max(0,Math.trunc(e))),G=(e,t)=>/e/i.test(String(e))?e*10**t:Number(`${e}e${t}`),K=()=>r()??{decimal:`.`,group:`,`},q=(e,t,n)=>t===`none`||e.length<=3?e:t===`international`?e.replace(/\B(?=(\d{3})+(?!\d))/g,n):`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,n)}${n}${e.slice(-3)}`,re=()=>typeof Intl<`u`&&typeof Intl.NumberFormat==`function`,ie=(e,t)=>{if(re())return o(`en-US`,{useGrouping:!1,minimumFractionDigits:0,maximumFractionDigits:t}).format(e);let n=Math.min(t,15);return G(Math.round(G(e,n)),-n).toFixed(n)},J=(e,t,n,r)=>{let i=Math.max(W(n),W(t)),a=W(t),o=ie(Math.abs(e),i),[s=`0`,c=``]=o.split(`.`),l=c.padEnd(a,`0`);for(;l.length>a&&l.endsWith(`0`);)l=l.slice(0,-1);let u=K(),d=q(s,r,u.group)+(l?`${u.decimal}${l}`:``);return e<0&&/[1-9]/.test(o)?`-${d}`:d},ae=/* @__PURE__ */ new Set([`grouping`,`minimumFractionDigits`,`maximumFractionDigits`,`locale`,`empty`,`scale`]),Y=e=>{if(!Object.entries(e).some(([e,t])=>t!==void 0&&!ae.has(e)))return null;let{grouping:t,locale:n,empty:r,scale:i,...a}=e;return t===`none`&&a.useGrouping===void 0?{...a,useGrouping:!1}:a},X=e=>e.locale??t().locale,Z=t=>{let n=e();return n===null||t.grouping===`indian`||t.grouping===`international`?null:t.locale??n},Q=(e,t)=>{let n=W(e);return{minimumFractionDigits:n,maximumFractionDigits:Math.max(n,W(t))}},$=e=>e===`none`?{useGrouping:!1}:{},oe=(e,t={})=>{let r=U(e);if(r===null)return p(t.empty);let a=Y(t);if(a)return i(o(X(t),a),r);let s=Z(t);return s?i(o(s,{...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??3),...$(t.grouping)}),r):J(r,t.minimumFractionDigits??0,t.maximumFractionDigits??3,t.grouping??n(X(t)))},se=(e,t={})=>{let r=U(e);if(r===null)return p(t.empty);let a=Y(t);if(a){let e=t.scale===`percent`?G(r,-2):r;return i(o(X(t),{style:`percent`,...a}),e)}let s=Z(t);if(s){let e=t.scale===`percent`?G(r,-2):r;return i(o(s,{style:`percent`,...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0),...$(t.grouping)}),e)}return`${J(t.scale===`percent`?r:G(r,2),t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0,t.grouping??n(X(t)))}%`},ce={INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`},le={JPY:0,KRW:0,VND:0,BHD:3,JOD:3,KWD:3,OMR:3,TND:3},ue=(e,t)=>{if(!t?.currency)throw TypeError(`formatMinor needs options.currency, an ISO 4217 code such as "INR".`);let n=U(e);if(n===null)return p(t.empty);let r=t.currency.toUpperCase(),a=le[r]??2,s=Math.round(Math.abs(n)),c=String(s).padStart(a+1,`0`),l=c.slice(0,c.length-a),u=c.slice(c.length-a);t.dropZeroDecimals&&/^0*$/.test(u)&&(u=``);let d=Z({grouping:t.grouping});if(d)try{let e=Number(`${n<0&&s!==0?`-`:``}${l}.${c.slice(c.length-a)||`0`}`);return i(o(d,{...t.symbol===!1?{}:{style:`currency`,currency:r},...Q(u?a:0,a),...$(t.grouping)}),e)}catch(e){throw e instanceof RangeError?RangeError(`formatMinor rejected currency "${r}" or locale "${d}": ${e.message}`,{cause:e}):e}let f=t.grouping??(r===`INR`?`indian`:`international`),m=K(),h=q(l,f,m.group)+(u?`${m.decimal}${u}`:``),g=n<0&&s!==0?`-`:``;if(t.symbol===!1)return`${g}${h}`;let _=ce[r];return _?`${g}${_}${h}`:`${g}${r} ${h}`};export{j as formatDate,N as formatDateTime,ue as formatMinor,oe as formatNumber,se as formatPercent,H as formatRelative,M as formatTime};
1
+ import{configuredLocale as e,getFormatterConfig as t,groupingForLocale as n,numberSeparators as r,styledNumber as i}from"./formatConfig.js";import{dateTimeFormat as a,numberFormat as o,relativeTimeFormat as s}from"./intlCache.js";var c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=330,u=`Asia/Kolkata`,d=[`IST`,u,`Asia/Calcutta`],f=/^\d{4}-\d{2}-\d{2}$/,p=e=>e<10?`0${e}`:`${e}`,m=e=>e??t().empty,h=e=>{if(e==null||e===``)return null;let t=e instanceof Date?e:new Date(typeof e==`string`?e.trim():e);return Number.isNaN(t.getTime())?null:t},g=e=>typeof e==`string`&&f.test(e.trim()),_=e=>{if(e===0)return`GMT`;let t=e>0?`+`:`-`,n=Math.abs(e),r=n%60;return`GMT${t}${Math.floor(n/60)}${r===0?``:`:${p(r)}`}`},v=(e,t,n)=>{let r=new Date(e.getTime()+t*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth(),day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),label:n}},ee=(e,t)=>{let n=a(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,hour12:!1}).format(e),r=n.match(/\d+/g)??[];if(r.length!==5)throw Error(`Unexpected date text from Intl for zone ${t}: ${n}`);let[i=``,o=``,s=``,c=``,l=``]=r,u=Number.parseInt(s,10),d=Number.parseInt(i,10)-1,f=Number.parseInt(o,10),p=Number.parseInt(c,10)%24,m=Number.parseInt(l,10);return{year:u,month:d,day:f,hour:p,minute:m,label:_(Math.round((Date.UTC(u,d,f,p,m)-Math.floor(e.getTime()/6e4)*6e4)/6e4))}},y=(e,t)=>d.includes(t)?v(e,l,`IST`):t===`UTC`?v(e,0,`UTC`):t===`viewer`?{year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),label:_(-e.getTimezoneOffset())}:ee(e,t),b=e=>e.hourCycle??12,x=e=>`${p(e.day)}-${c[e.month]}-${e.year}`,S=(e,t)=>{let n=p(e.day),r=p(e.month+1),i=String(e.year).padStart(4,`0`);return t===`DayMonthYear`?`${n}/${r}/${i}`:t===`MonthDayYear`?`${r}/${n}/${i}`:`${i}-${r}-${n}`},C=(e,t)=>t===24?`${p(e.hour)}:${p(e.minute)}`:`${e.hour%12||12}:${p(e.minute)} ${e.hour<12?`AM`:`PM`}`,w=(e,t)=>t??!d.includes(e),T=(e,t,n,r)=>w(n,r)?`${e} ${t.label}`:e,E=e=>{if(e!==`viewer`)return d.includes(e)?u:e},D=/* @__PURE__ */ new Map,te=e=>{let t=D.get(e);if(t!==void 0)return t;let n=new Intl.NumberFormat(e,{useGrouping:!1}),r=/* @__PURE__ */ new Set;for(let e=0;e<=9;e++)r.add(n.format(e));return D.set(e,r),r},O=(e,t)=>Array.from(e).filter(e=>t.has(e)).join(``),ne=e=>typeof e.formatToParts==`function`,re=(e,t,n)=>{let r=a(t,{day:`2-digit`,month:`short`,year:`numeric`,timeZone:n});if(!ne(r)){let r=te(t);return`${O(a(t,{day:`2-digit`,timeZone:n}).format(e),r)}-${a(t,{month:`short`,timeZone:n}).format(e).trim().replace(`.`,``)}-${O(a(t,{year:`numeric`,timeZone:n}).format(e),r)}`}let i=r.formatToParts(e),o=e=>i.find(t=>t.type===e)?.value??``;return`${o(`day`)}-${o(`month`).replace(`.`,``)}-${o(`year`)}`},k=(n,r)=>{let i=t().dateOrder??`DayMonthNameYear`;if(i!==`DayMonthNameYear`)return S(y(n,r),i);let a=e();return a?re(n,a,E(r)):x(y(n,r))},A=(e,t,n,r)=>a(t,{hour:`2-digit`,minute:`2-digit`,timeZone:E(n),timeZoneName:w(n,r.zoneLabel)?`short`:void 0,hourCycle:r.hourCycle===void 0?void 0:r.hourCycle===24?`h23`:`h12`}).format(e),j=(e,n={})=>{let r=h(e);return r?k(r,g(e)?`UTC`:n.zone??t().zone):m(n.empty)},M=(n,r={})=>{let i=h(n);if(!i)return m(r.empty);let a=r.zone??t().zone,o=e();if(o)return A(i,o,a,r);let s=y(i,a);return T(C(s,b(r)),s,a,r.zoneLabel)},ie=(n,r={})=>{let i=h(n);if(!i)return m(r.empty);let a=r.zone??t().zone,o=e();if(o)return`${k(i,a)}, ${A(i,o,a,r)}`;let s=y(i,a);return T(`${k(i,a)}, ${C(s,b(r))}`,s,a,r.zoneLabel)},N=1e3,P=60*N,F=60*P,I=24*F,L=7*I,R=30*I,z=365*I,ae=[[`year`,z],[`month`,R],[`day`,I],[`hour`,F],[`minute`,P]],oe=(n,r={})=>{let i=h(n),a=h(r.now??Date.now());if(!i||!a)return m(r.empty);let o=i.getTime()-a.getTime(),c=Math.abs(o),l=typeof Intl.RelativeTimeFormat==`function`?Intl.RelativeTimeFormat:void 0,u=e();if((u!==null||r.intl===!0)&&typeof l==`function`){let e=s(l,u??t().locale),[n,r]=ae.find(([,e])=>c>=e)??[`second`,N];return e.format(Math.round(o/r),n)}if(c<P)return`just now`;let[d,f]=c<F?[`minute`,P]:c<I?[`hour`,F]:c<L?[`day`,I]:c<R?[`week`,L]:c<z?[`month`,R]:[`year`,z],p=Math.floor(c/f),g=`${p} ${d}${p===1?``:`s`}`;return o<0?`${g} ago`:`in ${g}`},B=e=>{if(e==null||typeof e==`string`&&e.trim()===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null},V=e=>Math.min(20,Math.max(0,Math.trunc(e))),H=(e,t)=>/e/i.test(String(e))?e*10**t:Number(`${e}e${t}`),U=()=>r()??{decimal:`.`,group:`,`},W=(e,t,n)=>t===`none`||e.length<=3?e:t===`international`?e.replace(/\B(?=(\d{3})+(?!\d))/g,n):`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,n)}${n}${e.slice(-3)}`,G=()=>typeof Intl<`u`&&typeof Intl.NumberFormat==`function`,K=(e,t)=>{if(G())return o(`en-US`,{useGrouping:!1,minimumFractionDigits:0,maximumFractionDigits:t}).format(e);let n=Math.min(t,15);return H(Math.round(H(e,n)),-n).toFixed(n)},q=(e,t,n,r)=>{let i=Math.max(V(n),V(t)),a=V(t),o=K(Math.abs(e),i),[s=`0`,c=``]=o.split(`.`),l=c.padEnd(a,`0`);for(;l.length>a&&l.endsWith(`0`);)l=l.slice(0,-1);let u=U(),d=W(s,r,u.group)+(l?`${u.decimal}${l}`:``);return e<0&&/[1-9]/.test(o)?`-${d}`:d},se=/* @__PURE__ */ new Set([`grouping`,`minimumFractionDigits`,`maximumFractionDigits`,`locale`,`empty`,`scale`]),J=e=>{if(!Object.entries(e).some(([e,t])=>t!==void 0&&!se.has(e)))return null;let{grouping:t,locale:n,empty:r,scale:i,...a}=e;return t===`none`&&a.useGrouping===void 0?{...a,useGrouping:!1}:a},Y=e=>e.locale??t().locale,X=t=>{let n=e();return n===null||t.grouping===`indian`||t.grouping===`international`?null:t.locale??n},Z=(e,t)=>{let n=V(e);return{minimumFractionDigits:n,maximumFractionDigits:Math.max(n,V(t))}},Q=e=>e===`none`?{useGrouping:!1}:{},$=(e,t={})=>{let r=B(e);if(r===null)return m(t.empty);let a=J(t);if(a)return i(o(Y(t),a),r);let s=X(t);return s?i(o(s,{...Z(t.minimumFractionDigits??0,t.maximumFractionDigits??3),...Q(t.grouping)}),r):q(r,t.minimumFractionDigits??0,t.maximumFractionDigits??3,t.grouping??n(Y(t)))},ce=(e,t={})=>{let r=B(e);if(r===null)return m(t.empty);let a=J(t);if(a){let e=t.scale===`percent`?H(r,-2):r;return i(o(Y(t),{style:`percent`,...a}),e)}let s=X(t);if(s){let e=t.scale===`percent`?H(r,-2):r;return i(o(s,{style:`percent`,...Z(t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0),...Q(t.grouping)}),e)}return`${q(t.scale===`percent`?r:H(r,2),t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0,t.grouping??n(Y(t)))}%`},le={INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`},ue={JPY:0,KRW:0,VND:0,BHD:3,JOD:3,KWD:3,OMR:3,TND:3},de=(e,t)=>{if(!t?.currency)throw TypeError(`formatMinor needs options.currency, an ISO 4217 code such as "INR".`);let n=B(e);if(n===null)return m(t.empty);let r=t.currency.toUpperCase(),a=ue[r]??2,s=Math.round(Math.abs(n)),c=String(s).padStart(a+1,`0`),l=c.slice(0,c.length-a),u=c.slice(c.length-a);t.dropZeroDecimals&&/^0*$/.test(u)&&(u=``);let d=X({grouping:t.grouping});if(d)try{let e=Number(`${n<0&&s!==0?`-`:``}${l}.${c.slice(c.length-a)||`0`}`);return i(o(d,{...t.symbol===!1?{}:{style:`currency`,currency:r},...Z(u?a:0,a),...Q(t.grouping)}),e)}catch(e){throw e instanceof RangeError?RangeError(`formatMinor rejected currency "${r}" or locale "${d}": ${e.message}`,{cause:e}):e}let f=t.grouping??(r===`INR`?`indian`:`international`),p=U(),h=W(l,f,p.group)+(u?`${p.decimal}${u}`:``),g=n<0&&s!==0?`-`:``;if(t.symbol===!1)return`${g}${h}`;let _=le[r];return _?`${g}${_}${h}`:`${g}${r} ${h}`};export{j as formatDate,ie as formatDateTime,de as formatMinor,$ as formatNumber,ce as formatPercent,oe as formatRelative,M as formatTime};
@@ -0,0 +1 @@
1
+ import{SessionEndedError as e,refreshAccessToken as t}from"../api/tokenRefresh.js";import{ACCESS_TOKEN_KEY as n,addSessionEndedListener as r,getToken as i}from"../auth/authStore.js";import{getConfigValue as a}from"../config/index.js";import{Logger as o}from"../logger/logger.js";import{addNetworkStatusListener as s,getNetworkStatus as c}from"../network/networkStatus.js";import{HttpError as l,HubConnectionBuilder as u,LogLevel as d}from"@microsoft/signalr";var f=class extends Error{code;constructor(e,t){super(t),this.name=`HubConnectionError`,this.code=e}},p=[0,2e3,5e3,1e4,3e4],m=.2,h=/^https:\/\//i,g=/\/+$/,_={unauthorised:`Live updates are not allowed for this session.`,notFound:`Live updates are not available on this server.`,notConnected:`Live updates are not connected.`,sessionEnded:`The session ended, so live updates have stopped.`},v={log:(e,t)=>{e===d.Warning?o.warn(t):e>=d.Error&&o.error(t)}},y=(e,t)=>{try{t()}catch(t){o.error(`[hub] a ${e} listener threw`,t)}};function b(d){let{path:b}=d;if(b===``)throw RangeError(`createHubConnection needs a path, such as "/hubs/notifications".`);if(!b.startsWith(`/`)&&!h.test(b))throw RangeError(`createHubConnection path must start with "/" or be an absolute https address.`);let x=[...d.reconnectDelaysMs??p];if(x.length===0||x.some(e=>!Number.isInteger(e)||e<0))throw RangeError(`reconnectDelaysMs needs at least one whole number of milliseconds, and none may be negative.`);let S=null,C=`stopped`,w=null,T=!1,E=!1,D=!1,O=!1,k=!1,A=null,j=null,M=/* @__PURE__ */ new Map,N=/* @__PURE__ */ new Set,P=/* @__PURE__ */ new Set,F=/* @__PURE__ */ new Set,I=/* @__PURE__ */ new Set,L=e=>{let t=x[Math.min(e,x.length-1)];return t===void 0||t===0?0:t+Math.round(t*m*Math.random())},R=e=>new Promise(t=>{let n=setTimeout(()=>{F.delete(r),t()},e),r=()=>{clearTimeout(n),F.delete(r),t()};F.add(r)}),z=()=>D?new Promise(e=>{let t=()=>{F.delete(t),I.delete(t),e()};F.add(t),I.add(t)}):Promise.resolve(),B=e=>{C=e;for(let t of[...N])y(`status`,()=>t(e))},V=()=>{for(let e of[...P])y(`reconnected`,e)},H=async()=>{if(!O){let e=await i(n);if(e!==null&&Date.parse(e.expiry)>Date.now())return e.token}let e=await t();return O=!1,e},U=t=>{if(t instanceof e)return`sessionEnded`;if(t instanceof l){if(t.statusCode===401)return k?`unauthorised`:`refreshOnce`;if(t.statusCode===403)return`unauthorised`;if(t.statusCode===404)return`notFound`}return null},W={nextRetryDelayInMilliseconds:e=>{if(T)return null;let t=U(e.retryReason);return t===`refreshOnce`?(k=!0,O=!0,0):t===null?L(e.previousRetryCount):(A=t,null)}},G=()=>{if(h.test(b))return b;let e=a(`baseUrl`);if(!e)throw Error(`createHubConnection needs the API base URL: call setConfig({ baseUrl }) before start().`);return`${e.replace(g,``)}${b}`},K=()=>{j?.(),j=null},q=()=>{K(),w=null,B(`stopped`)},J=e=>{if(D=!e.isConnected,!D)for(let e of[...I])e();else S!==null&&(C===`connected`||C===`reconnecting`)&&S.stop().catch(e=>o.error(`[hub] stopping the connection while offline failed`,e))},Y=async()=>{T=!0,w=null,K();for(let e of[...F])e();S!==null&&await S.stop(),B(`stopped`)},X=()=>{if(j!==null)return;let e=r(()=>{Y().catch(e=>o.error(`[hub] stopping after the session ended failed`,e))}),t=s(J);j=()=>{e(),t()}},Z=async(e,t)=>{E=!0;try{let n=0;for(;;){if(await z(),T)return!1;try{await e.start()}catch(e){if(T)return!1;let t=U(e);if(t===`refreshOnce`){k=!0,O=!0;continue}if(t!==null)throw new f(t,_[t]);await R(L(n)),n+=1;continue}return!T&&(k=!1,B(`connected`),t&&V(),!0)}}finally{E=!1}},Q=e=>{Z(e,!0).catch(e=>{o.error(`[hub] reconnecting stopped`,e),q()})},$=e=>{T||E||(A===null?(B(`reconnecting`),Q(e)):(o.warn(`[hub] live updates stopped: ${A}`),q()))},ee=()=>{let e=new u().withUrl(G(),{accessTokenFactory:H}).withAutomaticReconnect(W).configureLogging(v).build();for(let t of M.values())for(let n of t)n.attach(e);return e.onreconnecting(()=>B(`reconnecting`)),e.onreconnected(()=>{k=!1,B(`connected`),V()}),e.onclose(()=>$(e)),e},te=async()=>{T=!1,A=null,B(`connecting`);let e=S??ee();if(S=e,X(),D=!(await c()).isConnected,!await Z(e,!1))throw new f(`notConnected`,_.notConnected)};return{start:()=>(w===null&&(w=te().catch(e=>{throw q(),e})),w),stop:Y,invoke:async(e,...t)=>{if(C!==`connected`||S===null)throw new f(`notConnected`,_.notConnected);return S.invoke(e,...t)},on:(e,t)=>{let n={attach:n=>n.on(e,t),detach:n=>n.off(e,t)},r=M.get(e)??/* @__PURE__ */ new Set;return r.add(n),M.set(e,r),S!==null&&n.attach(S),()=>{r.delete(n)&&(r.size===0&&M.get(e)===r&&M.delete(e),S!==null&&n.detach(S))}},getStatus:()=>C,addStatusListener:e=>(N.add(e),()=>{N.delete(e)}),addReconnectedListener:e=>(P.add(e),()=>{P.delete(e)})}}export{f as HubConnectionError,b as createHubConnection};
@@ -0,0 +1 @@
1
+ import{HubConnectionError as e,createHubConnection as t}from"./hubConnection.js";import{useHubEvent as n,useHubStatus as r}from"./useHub.js";export{e as HubConnectionError,t as createHubConnection,n as useHubEvent,r as useHubStatus};
@@ -0,0 +1 @@
1
+ import{useCallback as e,useEffect as t,useRef as n,useSyncExternalStore as r}from"react";function i(t){let n=e(e=>t.addStatusListener(()=>e()),[t]);return r(n,t.getStatus,t.getStatus)}function a(e,r,i){let a=n(i);t(()=>{a.current=i},[i]),t(()=>e.on(r,(...e)=>a.current(...e)),[e,r])}export{a as useHubEvent,i as useHubStatus};
@@ -0,0 +1 @@
1
+ import{endSessionAndLogout as e}from"../api/tokenRefresh.js";import{Logger as t}from"../logger/logger.js";import{useCallback as n,useEffect as r,useRef as i,useState as a}from"react";var o=`webority.idle.lastActivityAt`,s=5e3,c=5e3,l=1e3,u=[`pointerdown`,`keydown`,`wheel`,`touchstart`],d={capture:!0,passive:!0},f=({timeoutMs:e,warningMs:t})=>{if(!Number.isInteger(e)||e<6e4)throw RangeError(`useIdleTimeout: timeoutMs must be a whole number of milliseconds, at least 60000.`);if(!(t>=0)||t>=e)throw RangeError(`useIdleTimeout: warningMs must be 0 or more and less than timeoutMs.`)},p=(e,t,n,r)=>{let i=e+n;return e>t+c||t>=i?{phase:`timedOut`,remainingMs:0}:t>=i-r?{phase:`warning`,remainingMs:i-t}:{phase:`active`,remainingMs:n}},m=(e,t)=>{try{return t(window.localStorage)}catch(t){if(!(t instanceof DOMException))throw t;return e}},h=e=>{if(e===null)return null;let t=Number(e);return Number.isFinite(t)?t:null},g=()=>m(null,e=>h(e.getItem(o))),_=e=>{m(void 0,t=>{t.setItem(o,String(e))})},v=()=>{m(void 0,e=>{e.removeItem(o)})};function y(o){f(o);let{timeoutMs:c,warningMs:y,active:b,onTimeout:x}=o,[S,C]=a({phase:`active`,remainingMs:c}),w=i(`active`),T=i(0),E=i(0),D=i(x),O=i(()=>void 0);r(()=>{D.current=x},[x]);let k=n(()=>O.current(),[]);return r(()=>{if(!b){w.current=`active`,T.current=0,v(),C(e=>e.phase===`active`&&e.remainingMs===c?e:{phase:`active`,remainingMs:c});return}T.current=Math.max(T.current,g()??Date.now());let n,r=()=>{let n=D.current??(()=>e(`idle`,null,null));Promise.resolve(n()).catch(e=>{t.error(`[useIdleTimeout] the timeout action failed`,e)})},i=e=>{let t=w.current;w.current=e.phase,C(t=>t.phase===e.phase&&t.remainingMs===e.remainingMs?t:e),e.phase===`timedOut`&&t!==`timedOut`&&r()},a=()=>{let e=g();e!==null&&e>T.current&&(T.current=e),_(T.current),E.current=Date.now()},o=()=>{clearTimeout(n);let e=Date.now(),t=T.current+c,r=p(T.current,e,c,y);i(r),r.phase===`active`?n=setTimeout(o,t-y-e):r.phase===`warning`&&(n=setTimeout(o,Math.min(l,t-e)))},f=()=>{if(w.current!==`active`)return;let e=Date.now();T.current=e,e-E.current>=s&&a()},x=e=>{let t=m(null,e=>e);if(e.key!==`webority.idle.lastActivityAt`||t===null||e.storageArea!==t)return;let n=h(e.newValue);n!==null&&(n>T.current&&(T.current=n),o())},S=()=>{document.visibilityState===`hidden`?w.current===`active`&&a():o()};O.current=()=>{w.current!==`timedOut`&&(T.current=Date.now(),a(),o())};for(let e of u)window.addEventListener(e,f,d);return window.addEventListener(`storage`,x),window.addEventListener(`focus`,o),document.addEventListener(`visibilitychange`,S),o(),()=>{for(let e of u)window.removeEventListener(e,f,d);window.removeEventListener(`storage`,x),window.removeEventListener(`focus`,o),document.removeEventListener(`visibilitychange`,S),clearTimeout(n),O.current=()=>void 0}},[b,c,y]),{phase:S.phase,remainingMs:S.remainingMs,stayActive:k}}export{o as IDLE_LAST_ACTIVITY_KEY,y as useIdleTimeout};
@@ -0,0 +1 @@
1
+ export{IDLE_LAST_ACTIVITY_KEY,useIdleTimeout}from"./idleTimeout.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{IDEMPOTENCY_KEY_HEADER as e,listQuery as t}from"./api-contract/dist/call.js";import{DEFAULT_BUILD_CHECK_INTERVAL_MS as n,DEFAULT_LOG_LEVEL as r,DEFAULT_RETRIES as i,DEFAULT_TIMEOUT_MS as a,DEFAULT_VERSION_URL as o,getConfig as s,getConfigValue as c,resetConfig as l,setConfig as u}from"./config/index.js";import{TRACEPARENT_HEADER as d,applyRequestDefaults as f,newTraceparent as p}from"./api/requestDefaults.js";import{Logger as m,configureLogger as h,getDeviceContext as g,setDeviceContext as _,setRemoteLogger as v}from"./logger/logger.js";import{parseResponse as y}from"./errors/parseResponse.js";import{ACCOUNT_ID_HEADER as b,CLIENT_BUILD_HEADER as x,CLIENT_KIND as S,CLIENT_KIND_HEADER as C,getClientBuild as w}from"./api/clientHeaders.js";import{MIN_APP_VERSION_HEADER as T,addMinAppVersionListener as E,getMinAppVersion as D}from"./api/minAppVersion.js";import{WORKSPACE_CHANGED_CODE as O,WorkspaceChangedError as k,isWorkspaceChangedError as A}from"./api/workspaceChanged.js";import{attachRetry as j,isNeverSentError as M,isRetryableFailure as N,isRetryableStatus as P,retryAfterMs as F}from"./api/retry.js";import{sessionClient as I}from"./api/sessionClient.js";import{initSessionAuth as L}from"./initSessionAuth.js";import{decodeJWT as R,getJWTExpiry as z,isJWTExpired as B}from"./auth/jwt.js";import{ACCESS_TOKEN_KEY as V,LEGACY_REFRESH_TOKEN_LIFETIME_MS as H,REFRESH_TOKEN_KEY as U,SESSION_USER_KEY as W,addSessionEndedListener as G,clearSession as K,getKeepSignedIn as q,getSessionUser as J,getToken as Y,hasSession as X,hasSessionEndedInTab as Z,removeSessionUser as Q,removeToken as $,setKeepSignedIn as ee,setLegacyTokenKeys as te,storeSessionUser as ne,storeToken as re}from"./auth/authStore.js";import{addNetworkStatusListener as ie,getNetworkStatus as ae,setNetworkStatusImplementation as oe,useNetworkStatus as se}from"./network/networkStatus.js";import{initWebority as ce}from"./initSDK.js";import{DESIGN_SAMPLE_HEADER as le,DESIGN_SAMPLE_QUERY_KEY as ue,DESIGN_SAMPLE_STORAGE_KEY as de,applyDesignSample as fe,readDesignSampleTicket as pe}from"./api/designSample.js";import{REFRESH_LOCK_NAME as me,withCrossTabRefreshLock as he}from"./api/crossTabRefreshLock.js";import ge from"./api/publicClient.js";import{SESSION_EXPIRED_CODE as _e,SESSION_REVOKED_CODE as ve,injectStore as ye,injectUserAuth as be,refreshAccessToken as xe,resetRefreshState as Se}from"./api/tokenRefresh.js";import Ce,{RequestOfflineError as we}from"./api/userClient.js";import{initUserAuth as Te}from"./initUserAuth.js";import{readBlobErrorBody as Ee}from"./api/blobErrorBody.js";import{newIdempotencyKey as De}from"./api/idempotencyKey.js";import{createContractCaller as Oe}from"./api/contractCaller.js";import{CONTRACT_ERROR_CODE as ke,NETWORK_CODE as Ae,OFFLINE_CODE as je,OFFLINE_MESSAGE as Me,REQUEST_CANCELED_CODE as Ne,SERVER_FAILURE_MESSAGE as Pe,TIMEOUT_CODE as Fe,TIMEOUT_MESSAGE as Ie,UNEXPECTED_MESSAGE as Le,UNREACHABLE_MESSAGE as Re,apiErrorMessage as ze,extractApiError as Be,isApiError as Ve,isNoResponse as He,toFieldPath as Ue}from"./errors/extractApiError.js";import{contentDispositionFileName as We,downloadFile as Ge}from"./api/downloadFile.js";import{configureFormatters as Ke,getFormatterConfig as qe}from"./formatters/formatConfig.js";import{formatCurrency as Je}from"./formatters/currency.js";import{addDays as Ye}from"./formatters/dateMath.js";import{formatDate as Xe,formatDateTime as Ze,formatMinor as Qe,formatNumber as $e,formatPercent as et,formatRelative as tt,formatTime as nt}from"./formatters/house.js";import{staticUrl as rt}from"./static/index.js";import{createApiBaseQuery as it}from"./query/apiBaseQuery.js";import{createContractQuery as at}from"./query/contractQuery.js";import{APP_API_DEFAULTS as ot,createAppApi as st}from"./query/createAppApi.js";import{useDataState as ct,useInfiniteDataState as lt}from"./query/dataState.js";import{entityTagOf as ut,saveWithVersion as dt,versionOf as ft,withIfMatch as pt}from"./query/entityVersion.js";import{setupApiListeners as mt}from"./query/listeners.js";import{LIST_QUERY_RESERVED as ht,SEARCH_PARAM as gt,emptyFacetValue as _t,isFacetActive as vt,listQueryParamNames as yt,parseListQuery as bt}from"./query/listQuery.js";import{getNextPageParam as xt,getPreviousPageParam as St,hasNextPage as Ct,hasPreviousPage as wt}from"./query/paging.js";import{LIST_TAG_ID as Tt,itemTag as Et,listTag as Dt,providesList as Ot,providesPagedList as kt}from"./query/tags.js";import{useListQuery as At}from"./query/useListQuery.js";import{errorToastMiddleware as jt,isSilentRejection as Mt}from"./redux/errorToastMiddleware.js";import{createRootReducer as Nt,resetState as Pt}from"./redux/rootReducer.js";import{SERIALIZABLE_IGNORED_ACTION_PATHS as Ft}from"./redux/serializableCheck.js";import{hasRecentlyReloaded as It,importWithReload as Lt,isChunkLoadError as Rt,lazyWithReload as zt,markReloaded as Bt}from"./router/chunkReload.js";import{classifyRouteError as Vt,useRouteErrorReport as Ht}from"./router/routeError.js";import{ErrorBoundary as Ut}from"./router/ErrorBoundary.js";import{hasPermission as Wt}from"./router/permissions.js";import{RETURN_TO_PARAM as Gt,buildLoginPath as Kt,getReturnTo as qt,toSafeReturnTo as Jt}from"./router/returnTo.js";import{PublicOnly as Yt,RequireAuth as Xt,RequirePermission as Zt}from"./router/guards.js";import{publicOnly as Qt,requireAuth as $t,requirePermission as en,withGuards as tn}from"./router/loaders.js";import{defineRouteTable as nn}from"./router/routeTable.js";import{useUnsavedChanges as rn}from"./router/unsavedChanges.js";import{Storage as an,isStorageAvailable as on,setStorageImplementation as sn,syncSessionStorage as cn,syncStorage as ln}from"./storage/index.js";import{FIELD_RULE_MESSAGES as un,checkFields as dn,fieldRules as fn,refineWith as pn}from"./validators/fieldRules.js";import{isAlphanumeric as mn,isBetween as hn,isEmail as gn,isHexColor as _n,isInteger as vn,isNonEmpty as yn,isNumeric as bn,isPhone as xn,isStrongPassword as Sn,isUrl as Cn,maxLength as wn,minLength as Tn}from"./validators/index.js";import{isBuildBelowMinimum as En,parseBuildNumber as Dn}from"./versionCheck/buildNumber.js";import{addDeployedBuildListener as On,getNewerDeployedBuild as kn,startDeployedBuildCheck as An}from"./versionCheck/deployedBuild.js";import{installReloadOnNavigate as jn,isUpdateAvailable as Mn,useVersionCheck as Nn}from"./versionCheck/index.js";export{V as ACCESS_TOKEN_KEY,b as ACCOUNT_ID_HEADER,ot as APP_API_DEFAULTS,x as CLIENT_BUILD_HEADER,S as CLIENT_KIND,C as CLIENT_KIND_HEADER,ke as CONTRACT_ERROR_CODE,n as DEFAULT_BUILD_CHECK_INTERVAL_MS,r as DEFAULT_LOG_LEVEL,i as DEFAULT_RETRIES,a as DEFAULT_TIMEOUT_MS,o as DEFAULT_VERSION_URL,le as DESIGN_SAMPLE_HEADER,ue as DESIGN_SAMPLE_QUERY_KEY,de as DESIGN_SAMPLE_STORAGE_KEY,Ut as ErrorBoundary,un as FIELD_RULE_MESSAGES,e as IDEMPOTENCY_KEY_HEADER,H as LEGACY_REFRESH_TOKEN_LIFETIME_MS,ht as LIST_QUERY_RESERVED,Tt as LIST_TAG_ID,m as Logger,T as MIN_APP_VERSION_HEADER,Ae as NETWORK_CODE,je as OFFLINE_CODE,Me as OFFLINE_MESSAGE,Yt as PublicOnly,me as REFRESH_LOCK_NAME,U as REFRESH_TOKEN_KEY,Ne as REQUEST_CANCELED_CODE,Gt as RETURN_TO_PARAM,we as RequestOfflineError,Xt as RequireAuth,Zt as RequirePermission,gt as SEARCH_PARAM,Ft as SERIALIZABLE_IGNORED_ACTION_PATHS,Pe as SERVER_FAILURE_MESSAGE,_e as SESSION_EXPIRED_CODE,ve as SESSION_REVOKED_CODE,W as SESSION_USER_KEY,an as Storage,Fe as TIMEOUT_CODE,Ie as TIMEOUT_MESSAGE,d as TRACEPARENT_HEADER,Le as UNEXPECTED_MESSAGE,Re as UNREACHABLE_MESSAGE,O as WORKSPACE_CHANGED_CODE,k as WorkspaceChangedError,Ye as addDays,On as addDeployedBuildListener,E as addMinAppVersionListener,ie as addNetworkStatusListener,G as addSessionEndedListener,ze as apiErrorMessage,fe as applyDesignSample,f as applyRequestDefaults,j as attachRetry,Kt as buildLoginPath,dn as checkFields,Vt as classifyRouteError,K as clearSession,Ke as configureFormatters,h as configureLogger,We as contentDispositionFileName,it as createApiBaseQuery,st as createAppApi,Oe as createContractCaller,at as createContractQuery,Nt as createRootReducer,R as decodeJWT,nn as defineRouteTable,Ge as downloadFile,_t as emptyFacetValue,ut as entityTagOf,jt as errorToastMiddleware,Be as extractApiError,fn as fieldRules,Je as formatCurrency,Xe as formatDate,Ze as formatDateTime,Qe as formatMinor,$e as formatNumber,et as formatPercent,tt as formatRelative,nt as formatTime,w as getClientBuild,s as getConfig,c as getConfigValue,g as getDeviceContext,qe as getFormatterConfig,z as getJWTExpiry,q as getKeepSignedIn,D as getMinAppVersion,ae as getNetworkStatus,kn as getNewerDeployedBuild,xt as getNextPageParam,St as getPreviousPageParam,qt as getReturnTo,J as getSessionUser,Y as getToken,Ct as hasNextPage,Wt as hasPermission,wt as hasPreviousPage,It as hasRecentlyReloaded,X as hasSession,Z as hasSessionEndedInTab,Lt as importWithReload,L as initSessionAuth,Te as initUserAuth,ce as initWebority,ye as injectStore,be as injectUserAuth,jn as installReloadOnNavigate,mn as isAlphanumeric,Ve as isApiError,hn as isBetween,En as isBuildBelowMinimum,Rt as isChunkLoadError,gn as isEmail,vt as isFacetActive,_n as isHexColor,vn as isInteger,B as isJWTExpired,M as isNeverSentError,He as isNoResponse,yn as isNonEmpty,bn as isNumeric,xn as isPhone,N as isRetryableFailure,P as isRetryableStatus,Mt as isSilentRejection,on as isStorageAvailable,Sn as isStrongPassword,Mn as isUpdateAvailable,Cn as isUrl,A as isWorkspaceChangedError,Et as itemTag,zt as lazyWithReload,t as listQuery,yt as listQueryParamNames,Dt as listTag,Bt as markReloaded,wn as maxLength,Tn as minLength,De as newIdempotencyKey,p as newTraceparent,Dn as parseBuildNumber,bt as parseListQuery,y as parseResponse,Ot as providesList,kt as providesPagedList,ge as publicClient,Qt as publicOnly,Ee as readBlobErrorBody,pe as readDesignSampleTicket,pn as refineWith,xe as refreshAccessToken,Q as removeSessionUser,$ as removeToken,$t as requireAuth,en as requirePermission,l as resetConfig,Se as resetRefreshState,Pt as resetState,F as retryAfterMs,dt as saveWithVersion,I as sessionClient,u as setConfig,_ as setDeviceContext,ee as setKeepSignedIn,te as setLegacyTokenKeys,oe as setNetworkStatusImplementation,v as setRemoteLogger,sn as setStorageImplementation,mt as setupApiListeners,An as startDeployedBuildCheck,rt as staticUrl,ne as storeSessionUser,re as storeToken,cn as syncSessionStorage,ln as syncStorage,Ue as toFieldPath,Jt as toSafeReturnTo,ct as useDataState,lt as useInfiniteDataState,At as useListQuery,se as useNetworkStatus,Ht as useRouteErrorReport,rn as useUnsavedChanges,Nn as useVersionCheck,Ce as userClient,ft as versionOf,he as withCrossTabRefreshLock,tn as withGuards,pt as withIfMatch};
1
+ import{IDEMPOTENCY_KEY_HEADER as e,listQuery as t,mergeContracts as n,withBaseUrl as r}from"./api-contract/dist/call.js";import{DEFAULT_BUILD_CHECK_INTERVAL_MS as i,DEFAULT_LOG_LEVEL as a,DEFAULT_RETRIES as o,DEFAULT_TIMEOUT_MS as s,DEFAULT_VERSION_URL as c,getConfig as l,getConfigValue as u,resetConfig as d,setConfig as f}from"./config/index.js";import{TRACEPARENT_HEADER as p,applyRequestDefaults as m,newTraceparent as h}from"./api/requestDefaults.js";import{Logger as g,configureLogger as _,getDeviceContext as v,setDeviceContext as y,setRemoteLogger as b}from"./logger/logger.js";import{parseResponse as x}from"./errors/parseResponse.js";import{ACCOUNT_ID_HEADER as S,CLIENT_BUILD_HEADER as C,CLIENT_KIND as w,CLIENT_KIND_HEADER as T,getClientBuild as E}from"./api/clientHeaders.js";import{MIN_APP_VERSION_HEADER as D,addMinAppVersionListener as O,getMinAppVersion as k}from"./api/minAppVersion.js";import{WORKSPACE_CHANGED_CODE as A,WorkspaceChangedError as j,isWorkspaceChangedError as M}from"./api/workspaceChanged.js";import{attachRetry as N,isNeverSentError as P,isRetryableFailure as F,isRetryableStatus as I,retryAfterMs as L}from"./api/retry.js";import{sessionClient as R}from"./api/sessionClient.js";import{initSessionAuth as z}from"./initSessionAuth.js";import{decodeJWT as B,getJWTExpiry as V,isJWTExpired as H}from"./auth/jwt.js";import{ACCESS_TOKEN_KEY as U,LEGACY_REFRESH_TOKEN_LIFETIME_MS as W,REFRESH_TOKEN_KEY as G,SESSION_USER_KEY as K,addSessionEndedListener as q,clearSession as J,getKeepSignedIn as Y,getSessionUser as X,getToken as Z,hasSession as Q,hasSessionEndedInTab as $,removeSessionUser as ee,removeToken as te,setKeepSignedIn as ne,setLegacyTokenKeys as re,storeSessionUser as ie,storeToken as ae}from"./auth/authStore.js";import{addNetworkStatusListener as oe,getNetworkStatus as se,setNetworkStatusImplementation as ce,useNetworkStatus as le}from"./network/networkStatus.js";import{initWebority as ue}from"./initSDK.js";import{DESIGN_SAMPLE_HEADER as de,DESIGN_SAMPLE_QUERY_KEY as fe,DESIGN_SAMPLE_STORAGE_KEY as pe,applyDesignSample as me,readDesignSampleTicket as he}from"./api/designSample.js";import{REFRESH_LOCK_NAME as ge,withCrossTabRefreshLock as _e}from"./api/crossTabRefreshLock.js";import ve from"./api/publicClient.js";import{SESSION_EXPIRED_CODE as ye,SESSION_REVOKED_CODE as be,injectStore as xe,injectUserAuth as Se,refreshAccessToken as Ce,resetRefreshState as we}from"./api/tokenRefresh.js";import Te,{RequestOfflineError as Ee}from"./api/userClient.js";import{initUserAuth as De}from"./initUserAuth.js";import{readBlobErrorBody as Oe}from"./api/blobErrorBody.js";import{newIdempotencyKey as ke}from"./api/idempotencyKey.js";import{createContractCaller as Ae}from"./api/contractCaller.js";import{CONTRACT_ERROR_CODE as je,NETWORK_CODE as Me,OFFLINE_CODE as Ne,OFFLINE_MESSAGE as Pe,REQUEST_CANCELED_CODE as Fe,SERVER_FAILURE_MESSAGE as Ie,TIMEOUT_CODE as Le,TIMEOUT_MESSAGE as Re,UNEXPECTED_MESSAGE as ze,UNREACHABLE_MESSAGE as Be,apiErrorMessage as Ve,extractApiError as He,isApiError as Ue,isNoResponse as We,toFieldPath as Ge}from"./errors/extractApiError.js";import{contentDispositionFileName as Ke,downloadFile as qe}from"./api/downloadFile.js";import{DEFAULT_DOWNLOAD_CHUNK_BYTES as Je,DOWNLOAD_RANGE_INVALID_CODE as Ye,DOWNLOAD_RANGE_INVALID_MESSAGE as Xe,createDownloadResume as Ze,downloadFileResumable as Qe}from"./api/resumableDownload.js";import{UPLOAD_CANCELLED_CODE as $e,UPLOAD_CANCELLED_MESSAGE as et,uploadFile as tt}from"./api/uploadFile.js";import{configureFormatters as nt,getFormatterConfig as rt}from"./formatters/formatConfig.js";import{formatCurrency as it}from"./formatters/currency.js";import{addDays as at}from"./formatters/dateMath.js";import{formatDate as ot,formatDateTime as st,formatMinor as ct,formatNumber as lt,formatPercent as ut,formatRelative as dt,formatTime as ft}from"./formatters/house.js";import{IDLE_LAST_ACTIVITY_KEY as pt,useIdleTimeout as mt}from"./idle/idleTimeout.js";import{staticUrl as ht}from"./static/index.js";import{createApiBaseQuery as gt}from"./query/apiBaseQuery.js";import{createContractQuery as _t}from"./query/contractQuery.js";import{APP_API_DEFAULTS as vt,createAppApi as yt}from"./query/createAppApi.js";import{useDataState as bt,useInfiniteDataState as xt}from"./query/dataState.js";import{entityTagOf as St,saveWithVersion as Ct,versionOf as wt,withIfMatch as Tt}from"./query/entityVersion.js";import{setupApiListeners as Et}from"./query/listeners.js";import{LIST_QUERY_RESERVED as Dt,SEARCH_PARAM as Ot,emptyFacetValue as kt,isFacetActive as At,listQueryParamNames as jt,parseListQuery as Mt}from"./query/listQuery.js";import{getNextPageParam as Nt,getPreviousPageParam as Pt,hasNextPage as Ft,hasPreviousPage as It}from"./query/paging.js";import{LIST_TAG_ID as Lt,itemTag as Rt,listTag as zt,providesList as Bt,providesPagedList as Vt}from"./query/tags.js";import{useListQuery as Ht}from"./query/useListQuery.js";import{errorToastMiddleware as Ut,isSilentRejection as Wt}from"./redux/errorToastMiddleware.js";import{createRootReducer as Gt,resetState as Kt}from"./redux/rootReducer.js";import{SERIALIZABLE_IGNORED_ACTION_PATHS as qt}from"./redux/serializableCheck.js";import{hasRecentlyReloaded as Jt,importWithReload as Yt,isChunkLoadError as Xt,lazyWithReload as Zt,markReloaded as Qt}from"./router/chunkReload.js";import{classifyRouteError as $t,useRouteErrorReport as en}from"./router/routeError.js";import{ErrorBoundary as tn}from"./router/ErrorBoundary.js";import{hasPermission as nn}from"./router/permissions.js";import{RETURN_TO_PARAM as rn,buildLoginPath as an,getReturnTo as on,toSafeReturnTo as sn}from"./router/returnTo.js";import{PublicOnly as cn,RequireAuth as ln,RequirePermission as un}from"./router/guards.js";import{publicOnly as dn,requireAuth as fn,requirePermission as pn,withGuards as mn}from"./router/loaders.js";import{defineRouteTable as hn}from"./router/routeTable.js";import{useUnsavedChanges as gn}from"./router/unsavedChanges.js";import{Storage as _n,isStorageAvailable as vn,setStorageImplementation as yn,syncSessionStorage as bn,syncStorage as xn}from"./storage/index.js";import{FIELD_RULE_MESSAGES as Sn,checkFields as Cn,fieldRules as wn,refineWith as Tn}from"./validators/fieldRules.js";import{isAlphanumeric as En,isBetween as Dn,isEmail as On,isHexColor as kn,isInteger as An,isNonEmpty as jn,isNumeric as Mn,isPhone as Nn,isStrongPassword as Pn,isUrl as Fn,maxLength as In,minLength as Ln}from"./validators/index.js";import{isBuildBelowMinimum as Rn,parseBuildNumber as zn}from"./versionCheck/buildNumber.js";import{addDeployedBuildListener as Bn,getNewerDeployedBuild as Vn,startDeployedBuildCheck as Hn}from"./versionCheck/deployedBuild.js";import{installReloadOnNavigate as Un,isUpdateAvailable as Wn,useVersionCheck as Gn}from"./versionCheck/index.js";export{U as ACCESS_TOKEN_KEY,S as ACCOUNT_ID_HEADER,vt as APP_API_DEFAULTS,C as CLIENT_BUILD_HEADER,w as CLIENT_KIND,T as CLIENT_KIND_HEADER,je as CONTRACT_ERROR_CODE,i as DEFAULT_BUILD_CHECK_INTERVAL_MS,Je as DEFAULT_DOWNLOAD_CHUNK_BYTES,a as DEFAULT_LOG_LEVEL,o as DEFAULT_RETRIES,s as DEFAULT_TIMEOUT_MS,c as DEFAULT_VERSION_URL,de as DESIGN_SAMPLE_HEADER,fe as DESIGN_SAMPLE_QUERY_KEY,pe as DESIGN_SAMPLE_STORAGE_KEY,Ye as DOWNLOAD_RANGE_INVALID_CODE,Xe as DOWNLOAD_RANGE_INVALID_MESSAGE,tn as ErrorBoundary,Sn as FIELD_RULE_MESSAGES,e as IDEMPOTENCY_KEY_HEADER,pt as IDLE_LAST_ACTIVITY_KEY,W as LEGACY_REFRESH_TOKEN_LIFETIME_MS,Dt as LIST_QUERY_RESERVED,Lt as LIST_TAG_ID,g as Logger,D as MIN_APP_VERSION_HEADER,Me as NETWORK_CODE,Ne as OFFLINE_CODE,Pe as OFFLINE_MESSAGE,cn as PublicOnly,ge as REFRESH_LOCK_NAME,G as REFRESH_TOKEN_KEY,Fe as REQUEST_CANCELED_CODE,rn as RETURN_TO_PARAM,Ee as RequestOfflineError,ln as RequireAuth,un as RequirePermission,Ot as SEARCH_PARAM,qt as SERIALIZABLE_IGNORED_ACTION_PATHS,Ie as SERVER_FAILURE_MESSAGE,ye as SESSION_EXPIRED_CODE,be as SESSION_REVOKED_CODE,K as SESSION_USER_KEY,_n as Storage,Le as TIMEOUT_CODE,Re as TIMEOUT_MESSAGE,p as TRACEPARENT_HEADER,ze as UNEXPECTED_MESSAGE,Be as UNREACHABLE_MESSAGE,$e as UPLOAD_CANCELLED_CODE,et as UPLOAD_CANCELLED_MESSAGE,A as WORKSPACE_CHANGED_CODE,j as WorkspaceChangedError,at as addDays,Bn as addDeployedBuildListener,O as addMinAppVersionListener,oe as addNetworkStatusListener,q as addSessionEndedListener,Ve as apiErrorMessage,me as applyDesignSample,m as applyRequestDefaults,N as attachRetry,an as buildLoginPath,Cn as checkFields,$t as classifyRouteError,J as clearSession,nt as configureFormatters,_ as configureLogger,Ke as contentDispositionFileName,gt as createApiBaseQuery,yt as createAppApi,Ae as createContractCaller,_t as createContractQuery,Ze as createDownloadResume,Gt as createRootReducer,B as decodeJWT,hn as defineRouteTable,qe as downloadFile,Qe as downloadFileResumable,kt as emptyFacetValue,St as entityTagOf,Ut as errorToastMiddleware,He as extractApiError,wn as fieldRules,it as formatCurrency,ot as formatDate,st as formatDateTime,ct as formatMinor,lt as formatNumber,ut as formatPercent,dt as formatRelative,ft as formatTime,E as getClientBuild,l as getConfig,u as getConfigValue,v as getDeviceContext,rt as getFormatterConfig,V as getJWTExpiry,Y as getKeepSignedIn,k as getMinAppVersion,se as getNetworkStatus,Vn as getNewerDeployedBuild,Nt as getNextPageParam,Pt as getPreviousPageParam,on as getReturnTo,X as getSessionUser,Z as getToken,Ft as hasNextPage,nn as hasPermission,It as hasPreviousPage,Jt as hasRecentlyReloaded,Q as hasSession,$ as hasSessionEndedInTab,Yt as importWithReload,z as initSessionAuth,De as initUserAuth,ue as initWebority,xe as injectStore,Se as injectUserAuth,Un as installReloadOnNavigate,En as isAlphanumeric,Ue as isApiError,Dn as isBetween,Rn as isBuildBelowMinimum,Xt as isChunkLoadError,On as isEmail,At as isFacetActive,kn as isHexColor,An as isInteger,H as isJWTExpired,P as isNeverSentError,We as isNoResponse,jn as isNonEmpty,Mn as isNumeric,Nn as isPhone,F as isRetryableFailure,I as isRetryableStatus,Wt as isSilentRejection,vn as isStorageAvailable,Pn as isStrongPassword,Wn as isUpdateAvailable,Fn as isUrl,M as isWorkspaceChangedError,Rt as itemTag,Zt as lazyWithReload,t as listQuery,jt as listQueryParamNames,zt as listTag,Qt as markReloaded,In as maxLength,n as mergeContracts,Ln as minLength,ke as newIdempotencyKey,h as newTraceparent,zn as parseBuildNumber,Mt as parseListQuery,x as parseResponse,Bt as providesList,Vt as providesPagedList,ve as publicClient,dn as publicOnly,Oe as readBlobErrorBody,he as readDesignSampleTicket,Tn as refineWith,Ce as refreshAccessToken,ee as removeSessionUser,te as removeToken,fn as requireAuth,pn as requirePermission,d as resetConfig,we as resetRefreshState,Kt as resetState,L as retryAfterMs,Ct as saveWithVersion,R as sessionClient,f as setConfig,y as setDeviceContext,ne as setKeepSignedIn,re as setLegacyTokenKeys,ce as setNetworkStatusImplementation,b as setRemoteLogger,yn as setStorageImplementation,Et as setupApiListeners,Hn as startDeployedBuildCheck,ht as staticUrl,ie as storeSessionUser,ae as storeToken,bn as syncSessionStorage,xn as syncStorage,Ge as toFieldPath,sn as toSafeReturnTo,tt as uploadFile,bt as useDataState,mt as useIdleTimeout,xt as useInfiniteDataState,Ht as useListQuery,le as useNetworkStatus,en as useRouteErrorReport,gn as useUnsavedChanges,Gn as useVersionCheck,Te as userClient,wt as versionOf,r as withBaseUrl,_e as withCrossTabRefreshLock,mn as withGuards,Tt as withIfMatch};
@@ -0,0 +1 @@
1
+ import{isIndianMobile as e}from"./indianMobile.js";import{isPincode as t}from"./pincode.js";var n={mobile:`Enter a valid 10-digit mobile number.`,pincode:`Enter a valid 6-digit PIN code.`},r=e=>e==null||typeof e==`string`&&e.trim()===``,i=(e,t)=>n=>!r(n)&&e(n)?t:void 0,a={mobile:(t=n.mobile)=>i(t=>!e(t),t),pincode:(e=n.pincode)=>i(e=>!t(e),e)};export{n as INDIA_FIELD_RULE_MESSAGES,a as indiaFieldRules};
@@ -1 +1 @@
1
- import{aadhaarLastFour as e,isAadhaar as t,maskAadhaar as n,normalizeAadhaar as r}from"./aadhaar.js";import{currentFinancialYear as i,financialYearLabel as a,financialYearOf as o,parseFinancialYear as s,recentFinancialYears as c}from"./financialYear.js";import{gstinHolderPan as l,gstinProblem as u,gstinState as d,gstinStateCode as f,isGstin as p,normalizeGstin as m,sanitizeGstinInput as h}from"./gstin.js";import{currentStateForGstin as g,gstStateFromPlaceOfSupply as _,placeOfSupplyLabel as v}from"./gstStates.js";import{isIfsc as y,normalizeIfsc as b}from"./ifsc.js";import{formatIndianMobile as x,isIndianMobile as S,normalizeIndianMobile as C}from"./indianMobile.js";import{istDateOf as w,istDayBoundsUtc as T,istToday as E}from"./indiaTime.js";import{PAISE_PER_RUPEE as D,formatPaise as O,formatRupees as k,paiseFromRupees as A}from"./paise.js";import{isPan as j,maskPan as M,normalizePan as N}from"./pan.js";import{isPincode as P,normalizePincode as F}from"./pincode.js";export{D as PAISE_PER_RUPEE,e as aadhaarLastFour,i as currentFinancialYear,g as currentStateForGstin,a as financialYearLabel,o as financialYearOf,x as formatIndianMobile,O as formatPaise,k as formatRupees,_ as gstStateFromPlaceOfSupply,l as gstinHolderPan,u as gstinProblem,d as gstinState,f as gstinStateCode,t as isAadhaar,p as isGstin,y as isIfsc,S as isIndianMobile,j as isPan,P as isPincode,w as istDateOf,T as istDayBoundsUtc,E as istToday,n as maskAadhaar,M as maskPan,r as normalizeAadhaar,m as normalizeGstin,b as normalizeIfsc,C as normalizeIndianMobile,N as normalizePan,F as normalizePincode,A as paiseFromRupees,s as parseFinancialYear,v as placeOfSupplyLabel,c as recentFinancialYears,h as sanitizeGstinInput};
1
+ import{aadhaarLastFour as e,isAadhaar as t,maskAadhaar as n,normalizeAadhaar as r}from"./aadhaar.js";import{INDIA_FIELD_RULE_MESSAGES as i,indiaFieldRules as a}from"./fieldRules.js";import{currentFinancialYear as o,financialYearLabel as s,financialYearOf as c,parseFinancialYear as l,recentFinancialYears as u}from"./financialYear.js";import{gstinHolderPan as d,gstinProblem as f,gstinState as p,gstinStateCode as m,isGstin as h,normalizeGstin as g,sanitizeGstinInput as _}from"./gstin.js";import{currentStateForGstin as v,gstStateFromPlaceOfSupply as y,placeOfSupplyLabel as b}from"./gstStates.js";import{isIfsc as x,normalizeIfsc as S}from"./ifsc.js";import{formatIndianMobile as C,isIndianMobile as w,normalizeIndianMobile as T}from"./indianMobile.js";import{istDateOf as E,istDayBoundsUtc as D,istToday as O}from"./indiaTime.js";import{PAISE_PER_RUPEE as k,formatPaise as A,formatRupees as j,paiseFromRupees as M}from"./paise.js";import{isPan as N,maskPan as P,normalizePan as F}from"./pan.js";import{isPincode as I,normalizePincode as L}from"./pincode.js";export{i as INDIA_FIELD_RULE_MESSAGES,k as PAISE_PER_RUPEE,e as aadhaarLastFour,o as currentFinancialYear,v as currentStateForGstin,s as financialYearLabel,c as financialYearOf,C as formatIndianMobile,A as formatPaise,j as formatRupees,y as gstStateFromPlaceOfSupply,d as gstinHolderPan,f as gstinProblem,p as gstinState,m as gstinStateCode,a as indiaFieldRules,t as isAadhaar,h as isGstin,x as isIfsc,w as isIndianMobile,N as isPan,I as isPincode,E as istDateOf,D as istDayBoundsUtc,O as istToday,n as maskAadhaar,P as maskPan,r as normalizeAadhaar,g as normalizeGstin,S as normalizeIfsc,T as normalizeIndianMobile,F as normalizePan,L as normalizePincode,M as paiseFromRupees,l as parseFinancialYear,b as placeOfSupplyLabel,u as recentFinancialYears,_ as sanitizeGstinInput};
@@ -1 +1 @@
1
- import{extractApiError as e}from"../errors/extractApiError.js";import{Logger as t}from"../logger/logger.js";import n from"axios";var r=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t)||t<0)throw Error(`createApiBaseQuery: "${e}" sets extraOptions.maxRetries to ${String(t)}; it must be a whole number of 0 or more.`);return t},i=e=>e instanceof Date?encodeURIComponent(e.toISOString()):encodeURIComponent(typeof e==`object`?JSON.stringify(e):String(e)),a=e=>{if(!(typeof e!=`string`||e.startsWith(`W/`)))return/^"([^"]*)"$/.exec(e)?.[1]},o=e=>{if(typeof e!=`string`||e.trim()===``)throw Error(`web-core: the record version is missing, so the update cannot be sent with If-Match. Read the record first and pass its version.`);return`"${e}"`},s=e=>{let t={};if(e.ifMatch!==void 0&&(t[`If-Match`]=o(e.ifMatch)),e.idempotencyKey&&(t[`Idempotency-Key`]=e.idempotencyKey),Object.keys(t).length===0)return e.headers;let n=Object.keys(t).map(e=>e.toLowerCase()),r=Object.entries(e.headers??{}).filter(([e])=>!n.includes(e.toLowerCase()));return{...Object.fromEntries(r),...t}},c=`precondition_failed`,l=e=>e.status===412?{...e,code:c}:e,u=e=>t=>{let n=[];for(let[r,a]of Object.entries(t)){if(a==null)continue;let t=encodeURIComponent(r);if(!Array.isArray(a))n.push(`${t}=${i(a)}`);else if(e===`comma`)n.push(`${t}=${a.map(i).join(`,`)}`);else{let r=e===`brackets`?`${t}[]`:t;for(let e of a)n.push(`${r}=${i(e)}`)}}return n.join(`&`)},d=({client:i,publicClient:o})=>async(c,{signal:d},f)=>{let p=typeof c==`string`?{url:c}:c,m=p.silent??f?.silent??!1,h=p.expectedStatuses??f?.expectedStatuses,g=p.paramsFormat??f?.paramsFormat,_=f?.maxRetries===void 0?void 0:r(p.url,f.maxRetries),v=p.public?o:i;if(!v)throw Error(`createApiBaseQuery: "${p.url}" is marked public but no publicClient was passed.`);let y=s(p),b={url:p.url,method:p.method??`GET`,data:p.data,params:p.params,...g&&{paramsSerializer:u(g)},...y!==void 0&&{headers:y},...p.responseType!==void 0&&{responseType:p.responseType},...p.timeout!==void 0&&{timeout:p.timeout},..._!==void 0&&{retry:{retries:_}},signal:d,skipErrorLog:!0};try{let e=await v.request(b),t=a(e.headers?.etag);return{data:e.data,meta:{silent:m,status:e.status,...t!==void 0&&{entityTag:t}}}}catch(r){let i=l(e(r)),o=n.isCancel(r);o||t.requestFailed(r,{...h&&{expectedStatuses:h}});let s=n.isAxiosError(r)?a(r.response?.headers?.etag):void 0;return{error:i,meta:{silent:m||o,status:i.status,...h&&{expectedStatuses:h},...s!==void 0&&{entityTag:s}}}}};export{d as createApiBaseQuery,o as ifMatchValue,a as strongEntityTag};
1
+ import{extractApiError as e}from"../errors/extractApiError.js";import{Logger as t}from"../logger/logger.js";import n from"axios";var r=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t)||t<0)throw Error(`createApiBaseQuery: "${e}" sets extraOptions.maxRetries to ${String(t)}; it must be a whole number of 0 or more.`);return t},i=e=>e instanceof Date?encodeURIComponent(e.toISOString()):encodeURIComponent(typeof e==`object`?JSON.stringify(e):String(e)),a=e=>{if(!(typeof e!=`string`||e.startsWith(`W/`)))return/^"([^"]*)"$/.exec(e)?.[1]},o=e=>{if(typeof e!=`string`||e.trim()===``)throw Error(`web-core: the record version is missing, so the update cannot be sent with If-Match. Read the record first and pass its version.`);return`"${e}"`},s=e=>{let t={};if(e.ifMatch!==void 0&&(t[`If-Match`]=o(e.ifMatch)),e.idempotencyKey&&(t[`Idempotency-Key`]=e.idempotencyKey),Object.keys(t).length===0)return e.headers;let n=Object.keys(t).map(e=>e.toLowerCase()),r=Object.entries(e.headers??{}).filter(([e])=>!n.includes(e.toLowerCase()));return{...Object.fromEntries(r),...t}},c=`precondition_failed`,l=e=>e.status===412?{...e,code:c}:e,u=e=>t=>{let n=[];for(let[r,a]of Object.entries(t)){if(a==null)continue;let t=encodeURIComponent(r);if(!Array.isArray(a))n.push(`${t}=${i(a)}`);else if(e===`comma`)n.push(`${t}=${a.map(i).join(`,`)}`);else{let r=e===`brackets`?`${t}[]`:t;for(let e of a)n.push(`${r}=${i(e)}`)}}return n.join(`&`)},d=({client:i,publicClient:o})=>async(c,{signal:d},f)=>{let p=typeof c==`string`?{url:c}:c,m=p.silent??f?.silent??!1,h=p.expectedStatuses??f?.expectedStatuses,g=p.paramsFormat??f?.paramsFormat,_=f?.maxRetries===void 0?void 0:r(p.url,f.maxRetries),v=p.public?o:i;if(!v)throw Error(`createApiBaseQuery: "${p.url}" is marked public but no publicClient was passed.`);let y=s(p),b={url:p.url,...p.baseUrl!==void 0&&{baseURL:p.baseUrl},method:p.method??`GET`,data:p.data,params:p.params,...g&&{paramsSerializer:u(g)},...y!==void 0&&{headers:y},...p.responseType!==void 0&&{responseType:p.responseType},...p.timeout!==void 0&&{timeout:p.timeout},..._!==void 0&&{retry:{retries:_}},signal:d,skipErrorLog:!0};try{let e=await v.request(b),t=a(e.headers?.etag);return{data:e.data,meta:{silent:m,status:e.status,...t!==void 0&&{entityTag:t}}}}catch(r){let i=l(e(r)),o=n.isCancel(r);o||t.requestFailed(r,{...h&&{expectedStatuses:h}});let s=n.isAxiosError(r)?a(r.response?.headers?.etag):void 0;return{error:i,meta:{silent:m||o,status:i.status,...h&&{expectedStatuses:h},...s!==void 0&&{entityTag:s}}}}};export{d as createApiBaseQuery,o as ifMatchValue,a as strongEntityTag};
@@ -1 +1 @@
1
- import{ContractCallError as e,buildContractRequest as t}from"../api-contract/dist/call.js";var n=n=>(r,i,a)=>{let o=n[r],s=t(o,i);if(o.replyKind===`blob`)throw new e(`${o.method} ${o.path} replies with a file; a file download goes through the contract caller, not a store query`);if(s.method===`QUERY`)throw new e(`${o.method} ${o.path} uses the QUERY method, which the base query does not send`);return{...a,url:s.url,method:s.method,...s.data!==void 0&&{data:s.data},...s.headers!==void 0&&{headers:s.headers}}};export{n as createContractQuery};
1
+ import{ContractCallError as e,buildContractRequest as t}from"../api-contract/dist/call.js";var n=n=>(r,i,a)=>{let o=n[r],s=t(o,i);if(o.replyKind===`blob`)throw new e(`${o.method} ${o.path} replies with a file; a file download goes through the contract caller, not a store query`);if(s.method===`QUERY`)throw new e(`${o.method} ${o.path} uses the QUERY method, which the base query does not send`);return{...a,url:s.url,method:s.method,...s.baseUrl!==void 0&&{baseUrl:s.baseUrl},...s.data!==void 0&&{data:s.data},...s.headers!==void 0&&{headers:s.headers}}};export{n as createContractQuery};
@@ -14,6 +14,13 @@ export declare const contentDispositionFileName: (header: string) => string | nu
14
14
  * retry, the offline check and logging apply. A failure rejects with the same curated `ApiError`
15
15
  * every other call gives, read from the server's problem body even though it arrived as a Blob.
16
16
  *
17
+ * Progress and cancel are plain request options: pass `onDownloadProgress` to read the bytes received as the transfer runs (`event.loaded`, and `event.total` only when the server sends `Content-Length`; a compressed or chunked reply has none), and pass an `AbortSignal` as `signal` to cancel. A cancelled download rejects with the `ApiError` code `request_canceled` and no Blob is created.
18
+ *
19
+ * @example
20
+ * const controller = new AbortController();
21
+ * const file = await downloadFile(userClient, { url, signal: controller.signal, onDownloadProgress: (e) => setBytes(e.loaded) });
22
+ * controller.abort(); // cancels the download
23
+ *
17
24
  * A download is a service call, never an RTK Query endpoint: a Blob does not belong in the store.
18
25
  */
19
26
  export declare const downloadFile: (client: AxiosInstance, request: DownloadRequest) => Promise<DownloadedFile>;
@@ -1,5 +1,5 @@
1
- export type { ContractFullReply, ContractListQueryInput } from "@webority/api-contract/call";
2
- export { listQuery } from "@webority/api-contract/call";
1
+ export type { ContractFullReply, ContractListQueryInput, OperationTable } from "@webority/api-contract/call";
2
+ export { listQuery, mergeContracts, withBaseUrl } from "@webority/api-contract/call";
3
3
  export type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
4
4
  export type { SessionAuthOptions } from "../initSessionAuth";
5
5
  export { initSessionAuth } from "../initSessionAuth";
@@ -19,10 +19,14 @@ export type { MinAppVersionListener } from "./minAppVersion";
19
19
  export { addMinAppVersionListener, getMinAppVersion, MIN_APP_VERSION_HEADER } from "./minAppVersion";
20
20
  export { default as publicClient } from "./publicClient";
21
21
  export { applyRequestDefaults, newTraceparent, TRACEPARENT_HEADER } from "./requestDefaults";
22
+ export type { DownloadProgressHandler, DownloadResume, ResumableDownloadRequest } from "./resumableDownload";
23
+ export { createDownloadResume, DEFAULT_DOWNLOAD_CHUNK_BYTES, DOWNLOAD_RANGE_INVALID_CODE, DOWNLOAD_RANGE_INVALID_MESSAGE, downloadFileResumable, } from "./resumableDownload";
22
24
  export type { RetryPolicy } from "./retry";
23
25
  export { attachRetry, IDEMPOTENCY_KEY_HEADER, isNeverSentError, isRetryableFailure, isRetryableStatus, retryAfterMs, } from "./retry";
24
26
  export { sessionClient } from "./sessionClient";
25
27
  export { refreshAccessToken } from "./tokenRefresh";
28
+ export type { UploadProgressHandler, UploadRequest } from "./uploadFile";
29
+ export { UPLOAD_CANCELLED_CODE, UPLOAD_CANCELLED_MESSAGE, uploadFile } from "./uploadFile";
26
30
  export type { RefreshableStore } from "./userClient";
27
31
  export { default as userClient, injectStore, injectUserAuth, RequestOfflineError, resetRefreshState, SESSION_EXPIRED_CODE, SESSION_REVOKED_CODE, } from "./userClient";
28
32
  export { isWorkspaceChangedError, WORKSPACE_CHANGED_CODE, WorkspaceChangedError } from "./workspaceChanged";
@@ -0,0 +1,36 @@
1
+ import type { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ import { type DownloadedFile } from "./downloadFile";
3
+ export declare const DEFAULT_DOWNLOAD_CHUNK_BYTES: number;
4
+ export declare const DOWNLOAD_RANGE_INVALID_CODE = "download_range_invalid";
5
+ export declare const DOWNLOAD_RANGE_INVALID_MESSAGE = "The download could not be continued. Please try again.";
6
+ /** The record of one download: the caller keeps it and passes it on every attempt. */
7
+ export interface DownloadResume {
8
+ /** Bytes received so far, in order. */
9
+ chunks: Blob[];
10
+ /** Total size of `chunks`. */
11
+ received: number;
12
+ /** File size from `Content-Range`; null before the first answer. */
13
+ total: number | null;
14
+ /** The value sent as `If-Range` on the next request; null when the server gave no strong validator. */
15
+ validator: string | null;
16
+ fileName: string | null;
17
+ contentType: string;
18
+ }
19
+ export declare const createDownloadResume: () => DownloadResume;
20
+ export type DownloadProgressHandler = (loaded: number, total: number | null) => void;
21
+ export type ResumableDownloadRequest = Omit<AxiosRequestConfig, "method" | "data" | "responseType" | "onDownloadProgress" | "signal"> & {
22
+ /** The record of this download; pass the same one on every attempt. */
23
+ resume: DownloadResume;
24
+ /** Bytes per request; a positive integer. */
25
+ chunkBytes?: number | undefined;
26
+ onProgress?: DownloadProgressHandler | undefined;
27
+ /** Abort it to cancel; the record keeps what arrived. */
28
+ signal?: AbortSignal | undefined;
29
+ };
30
+ /**
31
+ * Fetches a file in `Range` requests through the same API client, so refresh, retry and the offline
32
+ * check apply to every chunk. Calling again with the same `resume` continues from the last byte held.
33
+ * A server that ignores Range, or whose file changed (`If-Range` no longer matches), answers 200 with
34
+ * the whole file, which replaces the held chunks.
35
+ */
36
+ export declare const downloadFileResumable: (client: AxiosInstance, request: ResumableDownloadRequest) => Promise<DownloadedFile>;
@@ -0,0 +1,15 @@
1
+ import type { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ export declare const UPLOAD_CANCELLED_CODE = "upload-cancelled";
3
+ export declare const UPLOAD_CANCELLED_MESSAGE = "The upload was cancelled.";
4
+ /** Bytes sent so far and the body size; total is null when the browser cannot tell. */
5
+ export type UploadProgressHandler = (loaded: number, total: number | null) => void;
6
+ export type UploadRequest = Omit<AxiosRequestConfig, "method" | "onUploadProgress" | "responseType" | "signal"> & {
7
+ /** POST unless set. */
8
+ method?: "POST" | "PUT" | "PATCH";
9
+ /** Body: a FormData, File or Blob. */
10
+ data: FormData | Blob;
11
+ onProgress?: UploadProgressHandler | undefined;
12
+ /** Abort it to cancel; the call rejects with ApiError code "upload-cancelled". */
13
+ signal?: AbortSignal | undefined;
14
+ };
15
+ export declare const uploadFile: <T = unknown>(client: AxiosInstance, request: UploadRequest) => Promise<T>;
@@ -19,8 +19,9 @@ export interface StoredToken {
19
19
  * - `terminated`: the API reported the session dead (revoked or expired).
20
20
  * - `corrupt`: a stored token could not be read back as a token.
21
21
  * - `otherTab`: web only. Another tab signed out of the shared session.
22
+ * - `idle`: the idle timeout ended the session after a period with no activity.
22
23
  */
23
- export type SessionEndReason = "signedOut" | "rejected" | "terminated" | "corrupt" | "otherTab";
24
+ export type SessionEndReason = "signedOut" | "rejected" | "terminated" | "corrupt" | "otherTab" | "idle";
24
25
  /** What else is known about a session end, beside its reason. */
25
26
  export interface SessionEndDetail {
26
27
  /** The server's session code (`session_revoked`, `session_expired`) when the server ended the session; null when the app or another tab did. */
@@ -0,0 +1,38 @@
1
+ export type HubConnectionStatus = "stopped" | "connecting" | "connected" | "reconnecting";
2
+ /** One method or event of a generated hub type: its argument tuple and its result. */
3
+ export interface HubMember {
4
+ readonly args: readonly unknown[];
5
+ readonly result: unknown;
6
+ }
7
+ export type HubConnectionErrorCode = "unauthorised" | "notFound" | "notConnected" | "sessionEnded";
8
+ export declare class HubConnectionError extends Error {
9
+ readonly code: HubConnectionErrorCode;
10
+ constructor(code: HubConnectionErrorCode, message: string);
11
+ }
12
+ export interface HubConnectionOptions {
13
+ /** The hub's path on the API, such as "/hubs/notifications", joined to the configured base URL when `start` runs. An absolute https address is used as given. */
14
+ path: string;
15
+ /** Waits between reconnect attempts, in milliseconds; the last value repeats. Default 0, 2 000, 5 000, 10 000, 30 000. */
16
+ reconnectDelaysMs?: readonly number[] | undefined;
17
+ }
18
+ export interface HubClient<TMethods extends {
19
+ readonly [K in keyof TMethods]: HubMember;
20
+ }, TEvents extends {
21
+ readonly [K in keyof TEvents]: HubMember;
22
+ }> {
23
+ /** Resolves on the first connection. Rejects only with a HubConnectionError; a transport fault is retried, not rejected. */
24
+ start: () => Promise<void>;
25
+ stop: () => Promise<void>;
26
+ invoke: <K extends keyof TMethods & string>(method: K, ...args: TMethods[K]["args"]) => Promise<TMethods[K]["result"]>;
27
+ /** Returns the unsubscribe. The handler stays registered across reconnects. */
28
+ on: <K extends keyof TEvents & string>(event: K, handler: (...args: TEvents[K]["args"]) => void) => () => void;
29
+ getStatus: () => HubConnectionStatus;
30
+ addStatusListener: (listener: (status: HubConnectionStatus) => void) => () => void;
31
+ /** Fires after each reconnect: events sent while disconnected were lost, so refetch and rejoin groups here. */
32
+ addReconnectedListener: (listener: () => void) => () => void;
33
+ }
34
+ export declare function createHubConnection<TMethods extends {
35
+ readonly [K in keyof TMethods]: HubMember;
36
+ }, TEvents extends {
37
+ readonly [K in keyof TEvents]: HubMember;
38
+ }>(options: HubConnectionOptions): HubClient<TMethods, TEvents>;
@@ -0,0 +1,3 @@
1
+ export type { HubClient, HubConnectionErrorCode, HubConnectionOptions, HubConnectionStatus, HubMember } from "./hubConnection";
2
+ export { createHubConnection, HubConnectionError } from "./hubConnection";
3
+ export { useHubEvent, useHubStatus } from "./useHub";
@@ -0,0 +1,12 @@
1
+ import type { HubClient, HubConnectionStatus, HubMember } from "./hubConnection";
2
+ export declare function useHubStatus<TMethods extends {
3
+ readonly [K in keyof TMethods]: HubMember;
4
+ }, TEvents extends {
5
+ readonly [K in keyof TEvents]: HubMember;
6
+ }>(client: HubClient<TMethods, TEvents>): HubConnectionStatus;
7
+ /** Subscribes while mounted. The newest handler is always the one called; a new handler identity does not resubscribe. */
8
+ export declare function useHubEvent<TMethods extends {
9
+ readonly [K in keyof TMethods]: HubMember;
10
+ }, TEvents extends {
11
+ readonly [K in keyof TEvents]: HubMember;
12
+ }, K extends keyof TEvents & string>(client: HubClient<TMethods, TEvents>, event: K, handler: (...args: TEvents[K]["args"]) => void): void;
@@ -0,0 +1,20 @@
1
+ export declare const IDLE_LAST_ACTIVITY_KEY = "webority.idle.lastActivityAt";
2
+ export type IdlePhase = "active" | "warning" | "timedOut";
3
+ export interface IdleTimeoutOptions {
4
+ /** No activity for this long ends the session. A whole number of milliseconds, at least 60 000. */
5
+ timeoutMs: number;
6
+ /** The warning phase starts this long before the end. 0 gives no warning. Less than `timeoutMs`. */
7
+ warningMs: number;
8
+ /** True while a person is signed in. False watches nothing and clears the saved activity time. */
9
+ active: boolean;
10
+ /** Runs once when the time is up. Default: end the session with reason "idle" and dispatch the app's logout. */
11
+ onTimeout?: (() => void | Promise<void>) | undefined;
12
+ }
13
+ export interface IdleTimeoutState {
14
+ phase: IdlePhase;
15
+ /** Time left before the end. Updates once a second in the warning phase; `timeoutMs` in the active phase; 0 once timed out. */
16
+ remainingMs: number;
17
+ /** The answer to the warning: counts as activity and returns every tab to the active phase. */
18
+ stayActive: () => void;
19
+ }
20
+ export declare function useIdleTimeout(options: IdleTimeoutOptions): IdleTimeoutState;
@@ -0,0 +1,2 @@
1
+ export type { IdlePhase, IdleTimeoutOptions, IdleTimeoutState } from "./idleTimeout";
2
+ export { IDLE_LAST_ACTIVITY_KEY, useIdleTimeout } from "./idleTimeout";
@@ -9,6 +9,7 @@ export * from "./auth";
9
9
  export * from "./config";
10
10
  export * from "./errors";
11
11
  export * from "./formatters";
12
+ export * from "./idle";
12
13
  export type { InitConfig } from "./initSDK";
13
14
  export { initWebority } from "./initSDK";
14
15
  export * from "./logger";
@@ -0,0 +1,9 @@
1
+ import type { FieldRule } from "../validators/fieldRules";
2
+ export declare const INDIA_FIELD_RULE_MESSAGES: Readonly<{
3
+ mobile: string;
4
+ pincode: string;
5
+ }>;
6
+ export declare const indiaFieldRules: Readonly<{
7
+ mobile: (message?: string) => FieldRule;
8
+ pincode: (message?: string) => FieldRule;
9
+ }>;
@@ -1,4 +1,5 @@
1
1
  export { aadhaarLastFour, isAadhaar, maskAadhaar, normalizeAadhaar } from "./aadhaar";
2
+ export { INDIA_FIELD_RULE_MESSAGES, indiaFieldRules } from "./fieldRules";
2
3
  export type { FinancialYear } from "./financialYear";
3
4
  export { currentFinancialYear, financialYearLabel, financialYearOf, parseFinancialYear, recentFinancialYears } from "./financialYear";
4
5
  export type { GstinProblem } from "./gstin";
@@ -16,6 +16,8 @@ import { type ApiError } from "../errors";
16
16
  export type ParamsFormat = "repeat" | "brackets" | "comma";
17
17
  export interface ApiRequest {
18
18
  url: string;
19
+ /** The base address of the API that serves the call; absent means the client's own base address. */
20
+ baseUrl?: string;
19
21
  method?: Method;
20
22
  /** The request body. FormData is sent as multipart by the client. */
21
23
  data?: unknown;
@@ -1,7 +1,7 @@
1
1
  import { type OperationEntry, type OperationShape } from "@webority/api-contract/call";
2
2
  import type { ApiRequest } from "./apiBaseQuery";
3
3
  /** Base query options a contract call keeps: every ApiRequest field the contract does not decide. */
4
- export type ContractQueryOptions = Omit<ApiRequest, "url" | "method" | "data" | "headers" | "responseType" | "params" | "paramsFormat">;
4
+ export type ContractQueryOptions = Omit<ApiRequest, "url" | "method" | "baseUrl" | "data" | "headers" | "responseType" | "params" | "paramsFormat">;
5
5
  /** The reply type of one contract operation, for an endpoint's result type. */
6
6
  export type ContractResponse<TOperations extends {
7
7
  readonly [K in keyof TOperations]: OperationShape;
@@ -6,7 +6,7 @@ import { type ApiError } from "../errors";
6
6
  */
7
7
  export declare const versionOf: (record: unknown, entityTag?: string | undefined) => string | undefined;
8
8
  /** A copy of `cfg` that sends `version` as `If-Match`, replacing an `If-Match` under any casing; `cfg` itself is not changed. */
9
- export declare const withIfMatch: (version: string, cfg?: AxiosRequestConfig) => AxiosRequestConfig;
9
+ export declare const withIfMatch: (version: string | null | undefined, cfg?: AxiosRequestConfig) => AxiosRequestConfig;
10
10
  /** The strong ETag of a response's `etag` header, without quotes; undefined when there is none or it is weak. */
11
11
  export declare const entityTagOf: (response: {
12
12
  headers: unknown;
@@ -1,3 +1,4 @@
1
+ import type { PasswordRules } from "./index";
1
2
  /** Checks one value: the message when it fails, undefined when it passes. Fits react-hook-form's `rules.validate` as it stands. */
2
3
  export type FieldRule = (value: unknown) => string | undefined;
3
4
  /** Field name to its rule. */
@@ -11,6 +12,7 @@ export declare const FIELD_RULE_MESSAGES: Readonly<{
11
12
  url: string;
12
13
  integer: string;
13
14
  between: (min: number, max: number) => string;
15
+ strongPassword: string;
14
16
  }>;
15
17
  /** Every rule but `required` passes an empty value (null, undefined, or a string of spaces). */
16
18
  export declare const fieldRules: Readonly<{
@@ -23,6 +25,7 @@ export declare const fieldRules: Readonly<{
23
25
  url: (message?: string) => FieldRule;
24
26
  integer: (message?: string) => FieldRule;
25
27
  between: (min: number, max: number, message?: string) => FieldRule;
28
+ strongPassword: (rules?: PasswordRules, message?: string) => FieldRule;
26
29
  /** The first failing rule's message. */
27
30
  all: (...rules: readonly FieldRule[]) => FieldRule;
28
31
  }>;
@@ -1 +1 @@
1
- import{isBetween as e,isEmail as t,isInteger as n,isPhone as r,isUrl as i,maxLength as a,minLength as o}from"./index.js";var s={required:`This field is required.`,minLength:e=>`Use at least ${e} characters.`,maxLength:e=>`Use ${e} characters or fewer.`,email:`Enter a valid email address.`,phone:`Enter a valid phone number.`,url:`Enter a valid web address.`,integer:`Enter a whole number.`,between:(e,t)=>`Enter a number from ${e} to ${t}.`},c=e=>e==null||typeof e==`string`&&e.trim()===``,l=(e,t)=>n=>!c(n)&&e(n)?t:void 0,u={required:(e=s.required)=>t=>c(t)?e:void 0,minLength:(e,t=s.minLength(e))=>l(t=>!o(t,e),t),maxLength:(e,t=s.maxLength(e))=>l(t=>!a(t,e),t),pattern:(e,t)=>n=>{if(!c(n))return e.lastIndex=0,e.test(String(n))?void 0:t},email:(e=s.email)=>l(e=>!t(e),e),phone:(e=s.phone)=>l(e=>!r(e),e),url:(e=s.url)=>l(e=>!i(e),e),integer:(e=s.integer)=>l(e=>!n(e),e),between:(t,n,r=s.between(t,n))=>l(r=>!e(r,t,n),r),all:(...e)=>t=>{for(let n of e){let e=n(t);if(e!==void 0)return e}}};function d(e,t){let n={};for(let[r,i]of Object.entries(t)){let t=i(e[r]);t!==void 0&&(n[r]=t)}return n}function f(e){return(t,n)=>{let r=e(t);r!==void 0&&n.addIssue({code:`custom`,message:r})}}export{s as FIELD_RULE_MESSAGES,d as checkFields,u as fieldRules,f as refineWith};
1
+ import{isBetween as e,isEmail as t,isInteger as n,isPhone as r,isStrongPassword as i,isUrl as a,maxLength as o,minLength as s}from"./index.js";var c={required:`This field is required.`,minLength:e=>`Use at least ${e} characters.`,maxLength:e=>`Use ${e} characters or fewer.`,email:`Enter a valid email address.`,phone:`Enter a valid phone number.`,url:`Enter a valid web address.`,integer:`Enter a whole number.`,between:(e,t)=>`Enter a number from ${e} to ${t}.`,strongPassword:`Use a stronger password.`},l=e=>e==null||typeof e==`string`&&e.trim()===``,u=(e,t)=>n=>!l(n)&&e(n)?t:void 0,d={required:(e=c.required)=>t=>l(t)?e:void 0,minLength:(e,t=c.minLength(e))=>u(t=>!s(t,e),t),maxLength:(e,t=c.maxLength(e))=>u(t=>!o(t,e),t),pattern:(e,t)=>n=>{if(!l(n))return e.lastIndex=0,e.test(String(n))?void 0:t},email:(e=c.email)=>u(e=>!t(e),e),phone:(e=c.phone)=>u(e=>!r(e),e),url:(e=c.url)=>u(e=>!a(e),e),integer:(e=c.integer)=>u(e=>!n(e),e),between:(t,n,r=c.between(t,n))=>u(r=>!e(r,t,n),r),strongPassword:(e={},t=c.strongPassword)=>u(t=>!i(t,e),t),all:(...e)=>t=>{for(let n of e){let e=n(t);if(e!==void 0)return e}}};function f(e,t){let n={};for(let[r,i]of Object.entries(t)){let t=i(e[r]);t!==void 0&&(n[r]=t)}return n}function p(e){return(t,n)=>{let r=e(t);r!==void 0&&n.addIssue({code:`custom`,message:r})}}export{c as FIELD_RULE_MESSAGES,f as checkFields,d as fieldRules,p as refineWith};
@@ -1 +1 @@
1
- import{FIELD_RULE_MESSAGES as e,checkFields as t,fieldRules as n,refineWith as r}from"./fieldRules.js";var i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,a=/^-?\d+(?:\.\d+)?$/,o=/^-?\d+$/,s=/^[a-zA-Z0-9]+$/,c=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,l=e=>typeof e==`string`?e.trim():null,u=e=>{let t=l(e);return!!t&&t.length>0},d=e=>{let t=l(e);return!!t&&i.test(t)},f=e=>{let t=l(e);if(!t)return!1;let n=t.replace(/[^\d+]/g,``).replace(/^\+/,``);return n.length>=7&&n.length<=15&&/^\d+$/.test(n)},p=e=>{let t=l(e);if(!t)return!1;try{return new URL(t),/^https?:\/\//i.test(t)||/^[a-z][a-z0-9+\-.]*:\/\//i.test(t)}catch{return!1}},m=e=>{if(typeof e==`number`)return Number.isFinite(e);let t=l(e);return!!t&&a.test(t)},h=e=>{if(typeof e==`number`)return Number.isInteger(e);let t=l(e);return!!t&&o.test(t)},g=e=>{let t=l(e);return!!t&&s.test(t)},_=(e,t={})=>{if(typeof e!=`string`)return!1;let{minLength:n=8,requireUppercase:r=!0,requireLowercase:i=!0,requireNumber:a=!0,requireSymbol:o=!1}=t;return!(e.length<n||r&&!/[A-Z]/.test(e)||i&&!/[a-z]/.test(e)||a&&!/\d/.test(e)||o&&!/[^A-Za-z0-9]/.test(e))},v=e=>{let t=l(e);return!!t&&c.test(t)},y=(e,t,n,r=!0)=>{let i=typeof e==`number`?e:Number(l(e));return Number.isFinite(i)?r?i>=t&&i<=n:i>t&&i<n:!1},b=(e,t)=>{let n=l(e);return!!n&&n.length>=t},x=(e,t)=>{let n=l(e);return n==null||n.length<=t};export{e as FIELD_RULE_MESSAGES,t as checkFields,n as fieldRules,g as isAlphanumeric,y as isBetween,d as isEmail,v as isHexColor,h as isInteger,u as isNonEmpty,m as isNumeric,f as isPhone,_ as isStrongPassword,p as isUrl,x as maxLength,b as minLength,r as refineWith};
1
+ import{FIELD_RULE_MESSAGES as e,checkFields as t,fieldRules as n,refineWith as r}from"./fieldRules.js";var i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,a=/^-?\d+(?:\.\d+)?$/,o=/^-?\d+$/,s=/^[a-zA-Z0-9]+$/,c=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,l=e=>typeof e==`string`?e.trim():null,u=e=>{let t=l(e);return!!t&&t.length>0},d=e=>{let t=l(e);return!!t&&i.test(t)},f=e=>{let t=l(e);if(!t)return!1;let n=t.replace(/[^\d+]/g,``).replace(/^\+/,``);return n.length>=7&&n.length<=15&&/^\d+$/.test(n)},p=e=>{let t=l(e);if(!t)return!1;try{return new URL(t),/^https?:\/\//i.test(t)||/^[a-z][a-z0-9+\-.]*:\/\//i.test(t)}catch{return!1}},m=e=>{if(typeof e==`number`)return Number.isFinite(e);let t=l(e);return!!t&&a.test(t)},h=e=>{if(typeof e==`number`)return Number.isInteger(e);let t=l(e);return!!t&&o.test(t)},g=e=>{let t=l(e);return!!t&&s.test(t)},_=(e,t={})=>{if(typeof e!=`string`)return!1;let{minLength:n=10,requireUppercase:r=!0,requireLowercase:i=!0,requireNumber:a=!0,requireSymbol:o=!0}=t;return!(e.length<n||r&&!/[A-Z]/.test(e)||i&&!/[a-z]/.test(e)||a&&!/\d/.test(e)||o&&!/[^A-Za-z0-9]/.test(e))},v=e=>{let t=l(e);return!!t&&c.test(t)},y=(e,t,n,r=!0)=>{let i=typeof e==`number`?e:Number(l(e));return Number.isFinite(i)?r?i>=t&&i<=n:i>t&&i<n:!1},b=(e,t)=>{let n=l(e);return!!n&&n.length>=t},x=(e,t)=>{let n=l(e);return n==null||n.length<=t};export{e as FIELD_RULE_MESSAGES,t as checkFields,n as fieldRules,g as isAlphanumeric,y as isBetween,d as isEmail,v as isHexColor,h as isInteger,u as isNonEmpty,m as isNumeric,f as isPhone,_ as isStrongPassword,p as isUrl,x as maxLength,b as minLength,r as refineWith};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/web-core",
3
- "version": "0.168.0",
3
+ "version": "0.169.1",
4
4
  "description": "Platform layer for Webority React web portals: HTTP clients with single-flight token refresh, auth store, API error extraction, RTK Query base query, logger, formatters, storage, version check and route guards. No UI.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -46,6 +46,14 @@
46
46
  "types": "./dist/types/formatters/index.d.ts",
47
47
  "default": "./dist/formatters/index.js"
48
48
  },
49
+ "./hub": {
50
+ "types": "./dist/types/hub/index.d.ts",
51
+ "default": "./dist/hub/index.js"
52
+ },
53
+ "./idle": {
54
+ "types": "./dist/types/idle/index.d.ts",
55
+ "default": "./dist/idle/index.js"
56
+ },
49
57
  "./india": {
50
58
  "types": "./dist/types/india/index.d.ts",
51
59
  "default": "./dist/india/index.js"
@@ -102,10 +110,11 @@
102
110
  },
103
111
  "sideEffects": false,
104
112
  "dependencies": {
105
- "@webority/api-contract": "0.168.0"
113
+ "@webority/api-contract": "0.169.1"
106
114
  },
107
115
  "peerDependencies": {
108
116
  "@microsoft/applicationinsights-web": "^3.4.5",
117
+ "@microsoft/signalr": "^11.0.0",
109
118
  "@reduxjs/toolkit": "^2.12.0",
110
119
  "axios": "^1.18.0",
111
120
  "react": "^19.2.7",
@@ -115,16 +124,20 @@
115
124
  "peerDependenciesMeta": {
116
125
  "@microsoft/applicationinsights-web": {
117
126
  "optional": true
127
+ },
128
+ "@microsoft/signalr": {
129
+ "optional": true
118
130
  }
119
131
  },
120
132
  "devDependencies": {
121
133
  "@microsoft/applicationinsights-web": "^3.4.5",
134
+ "@microsoft/signalr": "11.0.0",
122
135
  "@reduxjs/toolkit": "^2.14.0",
123
136
  "@testing-library/react": "^16.3.0",
124
137
  "@types/node": "25.6.0",
125
138
  "@types/react": "^19.3.0",
126
139
  "@vitest/coverage-v8": "5.1.0",
127
- "@webority/biome-config": "0.168.0",
140
+ "@webority/biome-config": "0.169.1",
128
141
  "axios": "^1.18.0",
129
142
  "jsdom": "30.1.1",
130
143
  "react": "^19.3.1",
@@ -137,7 +150,7 @@
137
150
  },
138
151
  "scripts": {
139
152
  "build": "vite build && tsc -p tsconfig.json",
140
- "typecheck": "tsc -p tsconfig.test.json --noEmit",
153
+ "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.node.json && tsc --noEmit -p tsconfig.test.json",
141
154
  "test": "vitest run",
142
155
  "test:watch": "vitest",
143
156
  "test:coverage": "vitest run --coverage"