@webority/web-core 0.164.0 → 0.165.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  Copyright (c) Webority Technologies. All rights reserved.
2
2
 
3
- This software and its NuGet packages are the proprietary and confidential property
3
+ This software and its Webority packages are the proprietary and confidential property
4
4
  of Webority Technologies. They are published publicly only for the convenience of
5
5
  Webority's own projects and internal consumption.
6
6
 
package/README.md CHANGED
@@ -247,6 +247,8 @@ function LeaveList() {
247
247
 
248
248
  `tableProps` feeds `AppDataTable` and `paginationProps` feeds its pager. The server answers `{ items, page, pageSize, totalCount, totalPages }`, and the hook takes the page size from that answer when the URL names none. With a generated contract, pass the operation's query type, `useListQuery<Leave, LeaveListQuery>`, and `fetchPage` hands `call("Leave_List", { query: listQuery(query) })` a typed query with no cast; a facet key the query does not declare is a type error, and an enum facet ignores a URL value outside its options.
249
249
 
250
+ `setFilters(values)` writes several filters in one address change; pass it to `AppFilterBar`'s `onChangeMany`, because `setFilter` called once per key from the same render overwrites the earlier writes.
251
+
250
252
  ## Versioned saves
251
253
 
252
254
  A record another writer can change carries a `version`. A list item holds it in its `version` string. A single record's read sends it as a strong `ETag`, and the screen passes that ETag as `entityTag`. `versionOf(record, entityTag)` returns the version a write sends back.
@@ -496,6 +498,8 @@ call that reads a header or a 304. A 304 resolves as `notModified: true` with no
496
498
  `{ replacesSession: true }` marks a call that ends the session and answers with a new one (a workspace switch,
497
499
  a two-factor change). `{ keepalive: true }` sends the call so it outlives the page, for the last save on page hide.
498
500
 
501
+ A service wrapper that only reads the body types its config as `ContractBodyCallConfig`; `ContractCallConfig` also allows `reply: "full"`, which the body call refuses. `@webority/mobile-core` exports the same type.
502
+
499
503
  ```ts
500
504
  const file = await call("Workspace_Export", {}, { reply: "full", timeout: 0 });
501
505
  const name = contentDispositionFileName(file.headers["content-disposition"] ?? "");
@@ -1 +1 @@
1
- import{ContractCallError as e,buildContractRequest as t,contractFullReply as n,contractReply as r,isFullReplyStatus as i}from"../api-contract/dist/call.js";var a=(a,o)=>{async function s(s,c,l){let u=o[s],d=t(u,c,l);if(l?.keepalive!==void 0&&typeof l.keepalive!=`boolean`)throw new e(`${u.method} ${u.path} needs keepalive as true or false`);let f=await a.request({method:d.method,url:d.url,...d.headers!==void 0&&{headers:d.headers},data:d.data,responseType:d.responseType,...d.skipErrorLog!==void 0&&{skipErrorLog:d.skipErrorLog},...d.expectedStatuses!==void 0&&{expectedStatuses:d.expectedStatuses},...d.replacesSession!==void 0&&{replacesSession:d.replacesSession},...l?.keepalive===!0&&{adapter:`fetch`,fetchOptions:{keepalive:!0}},...d.reply===`full`&&{validateStatus:i},...l?.signal!==void 0&&{signal:l.signal},...l?.timeout!==void 0&&{timeout:l.timeout},...l?.retry!==void 0&&{retry:l.retry}});return d.reply===`full`?n(u,f.status,f.headers,f.data):r(u,f.status,f.data)}return s};export{a 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,...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{listQuery as e}from"../api-contract/dist/call.js";import{initUserAuth as t}from"../initUserAuth.js";import{readBlobErrorBody as n}from"./blobErrorBody.js";import{ACCOUNT_ID_HEADER as r,CLIENT_BUILD_HEADER as i,CLIENT_KIND as a,CLIENT_KIND_HEADER as o,getClientBuild as s}from"./clientHeaders.js";import{createContractCaller as c}from"./contractCaller.js";import{REFRESH_LOCK_NAME as l,withCrossTabRefreshLock as u}from"./crossTabRefreshLock.js";import{DESIGN_SAMPLE_HEADER as d,DESIGN_SAMPLE_QUERY_KEY as f,DESIGN_SAMPLE_STORAGE_KEY as p,applyDesignSample as m,readDesignSampleTicket as h}from"./designSample.js";import{contentDispositionFileName as g,downloadFile as _}from"./downloadFile.js";import{newIdempotencyKey as v}from"./idempotencyKey.js";import{MIN_APP_VERSION_HEADER as y,addMinAppVersionListener as b,getMinAppVersion as x}from"./minAppVersion.js";import S from"./publicClient.js";import{TRACEPARENT_HEADER as C,applyRequestDefaults as w,newTraceparent as T}from"./requestDefaults.js";import{IDEMPOTENCY_KEY_HEADER as E,attachRetry as D,isNeverSentError as O,isRetryableFailure as k,isRetryableStatus as A,retryAfterMs as j}from"./retry.js";import{SESSION_EXPIRED_CODE as M,SESSION_REVOKED_CODE as N,injectStore as P,injectUserAuth as F,refreshAccessToken as I,resetRefreshState as L}from"./tokenRefresh.js";import R,{RequestOfflineError as z}from"./userClient.js";import{WORKSPACE_CHANGED_CODE as B,WorkspaceChangedError as V,isWorkspaceChangedError as H}from"./workspaceChanged.js";export{r as ACCOUNT_ID_HEADER,i as CLIENT_BUILD_HEADER,a as CLIENT_KIND,o as CLIENT_KIND_HEADER,d as DESIGN_SAMPLE_HEADER,f as DESIGN_SAMPLE_QUERY_KEY,p as DESIGN_SAMPLE_STORAGE_KEY,E as IDEMPOTENCY_KEY_HEADER,y as MIN_APP_VERSION_HEADER,l as REFRESH_LOCK_NAME,z as RequestOfflineError,M as SESSION_EXPIRED_CODE,N as SESSION_REVOKED_CODE,C as TRACEPARENT_HEADER,B as WORKSPACE_CHANGED_CODE,V as WorkspaceChangedError,b as addMinAppVersionListener,m as applyDesignSample,w as applyRequestDefaults,D as attachRetry,g as contentDispositionFileName,c as createContractCaller,_ as downloadFile,s as getClientBuild,x as getMinAppVersion,t as initUserAuth,P as injectStore,F as injectUserAuth,O as isNeverSentError,k as isRetryableFailure,A as isRetryableStatus,H as isWorkspaceChangedError,e as listQuery,v as newIdempotencyKey,T as newTraceparent,S as publicClient,n as readBlobErrorBody,h as readDesignSampleTicket,I as refreshAccessToken,L as resetRefreshState,j as retryAfterMs,R as userClient,u as withCrossTabRefreshLock};
1
+ import{IDEMPOTENCY_KEY_HEADER as e,listQuery as t}from"../api-contract/dist/call.js";import{initUserAuth as n}from"../initUserAuth.js";import{readBlobErrorBody as r}from"./blobErrorBody.js";import{ACCOUNT_ID_HEADER as i,CLIENT_BUILD_HEADER as a,CLIENT_KIND as o,CLIENT_KIND_HEADER as s,getClientBuild as c}from"./clientHeaders.js";import{createContractCaller as l}from"./contractCaller.js";import{REFRESH_LOCK_NAME as u,withCrossTabRefreshLock as d}from"./crossTabRefreshLock.js";import{DESIGN_SAMPLE_HEADER as f,DESIGN_SAMPLE_QUERY_KEY as p,DESIGN_SAMPLE_STORAGE_KEY as m,applyDesignSample as h,readDesignSampleTicket as g}from"./designSample.js";import{contentDispositionFileName as _,downloadFile as v}from"./downloadFile.js";import{newIdempotencyKey as y}from"./idempotencyKey.js";import{MIN_APP_VERSION_HEADER as b,addMinAppVersionListener as x,getMinAppVersion as S}from"./minAppVersion.js";import C from"./publicClient.js";import{TRACEPARENT_HEADER as w,applyRequestDefaults as T,newTraceparent as E}from"./requestDefaults.js";import{attachRetry as D,isNeverSentError as O,isRetryableFailure as k,isRetryableStatus as A,retryAfterMs as j}from"./retry.js";import{SESSION_EXPIRED_CODE as M,SESSION_REVOKED_CODE as N,injectStore as P,injectUserAuth as F,refreshAccessToken as I,resetRefreshState as L}from"./tokenRefresh.js";import R,{RequestOfflineError as z}from"./userClient.js";import{WORKSPACE_CHANGED_CODE as B,WorkspaceChangedError as V,isWorkspaceChangedError as H}from"./workspaceChanged.js";export{i as ACCOUNT_ID_HEADER,a as CLIENT_BUILD_HEADER,o as CLIENT_KIND,s as CLIENT_KIND_HEADER,f as DESIGN_SAMPLE_HEADER,p as DESIGN_SAMPLE_QUERY_KEY,m as DESIGN_SAMPLE_STORAGE_KEY,e as IDEMPOTENCY_KEY_HEADER,b as MIN_APP_VERSION_HEADER,u as REFRESH_LOCK_NAME,z as RequestOfflineError,M as SESSION_EXPIRED_CODE,N as SESSION_REVOKED_CODE,w as TRACEPARENT_HEADER,B as WORKSPACE_CHANGED_CODE,V as WorkspaceChangedError,x as addMinAppVersionListener,h as applyDesignSample,T as applyRequestDefaults,D as attachRetry,_ as contentDispositionFileName,l as createContractCaller,v as downloadFile,c as getClientBuild,S as getMinAppVersion,n as initUserAuth,P as injectStore,F as injectUserAuth,O as isNeverSentError,k as isRetryableFailure,A as isRetryableStatus,H as isWorkspaceChangedError,t as listQuery,y as newIdempotencyKey,E as newTraceparent,C as publicClient,r as readBlobErrorBody,g as readDesignSampleTicket,I as refreshAccessToken,L as resetRefreshState,j as retryAfterMs,R as userClient,d as withCrossTabRefreshLock};
package/dist/api/retry.js CHANGED
@@ -1 +1 @@
1
- import{getConfigValue as e}from"../config/index.js";import{isWorkspaceChangedResponse as t}from"./workspaceChanged.js";import n from"axios";var r=`Idempotency-Key`,i=e=>typeof e==`number`&&(e===429||e>=500&&e<=599),a=/* @__PURE__ */ new Set([`get`,`head`,`options`,`put`,`delete`]),o=/* @__PURE__ */ new Set([`ECONNREFUSED`,`ENOTFOUND`,`EAI_AGAIN`,`ENETUNREACH`,`EHOSTUNREACH`]),s=e=>!e.response&&typeof e.code==`string`&&o.has(e.code),c=3e4,l=e=>typeof e==`object`&&!!e,u=(e,t)=>{if(!l(e))return;let n=e.get;return typeof n==`function`?n.call(e,t):e[t]},d=e=>{let t=e.response;if(!t)return null;let n=u(t.headers,`retry-after`),r=Number(n);return n!=null&&Number.isFinite(r)&&r>0?r*1e3:null},f=e=>{let t=u(e?.headers,r);return typeof t==`string`&&t!==``},p=e=>{if(n.isCancel(e)||e.code===`ERR_CANCELED`)return!1;if(s(e))return!0;let t=(e.config?.method??`get`).toLowerCase(),r=a.has(t),o=e.response?.status;if(o===void 0)return r;if(!i(o))return!1;let l=d(e);return l!==null&&l>c?!1:r||(o===429||o===503)&&f(e.config)},m={retryDelayMs:e=>e<=1?0:Math.random()*Math.min(3e4,1e3*2**e),shouldRetry:p,onRetry:()=>void 0},h=(e,t)=>new Promise(n=>{let r=()=>{clearTimeout(i),n(!1)},i=setTimeout(()=>{t?.removeEventListener?.(`abort`,r),n(!0)},e);t?.addEventListener?.(`abort`,r,{once:!0})}),g=(r,i={})=>{r.interceptors.response.use(void 0,async a=>{if(!n.isAxiosError(a))return Promise.reject(a);let o=a,s=o.config;if(!s||s.retry===!1)return Promise.reject(a);let c=typeof s.retry==`object`?s.retry:{},l={...m,retries:e(`retries`),...i,...c},u=(s.__retryAttempt??0)+1;return t(o)||u>l.retries||!l.shouldRetry(o)||s.signal?.aborted||(s.__retryAttempt=u,s.transformRequest=[e=>e],l.onRetry(u,o),!await h(d(o)??l.retryDelayMs(u),s.signal))?Promise.reject(a):r.request(s)})};export{r as IDEMPOTENCY_KEY_HEADER,g as attachRetry,s as isNeverSentError,p as isRetryableFailure,i as isRetryableStatus,d as retryAfterMs};
1
+ import{IDEMPOTENCY_KEY_HEADER as e}from"../api-contract/dist/call.js";import{getConfigValue as t}from"../config/index.js";import{isWorkspaceChangedResponse as n}from"./workspaceChanged.js";import r from"axios";var i=e=>typeof e==`number`&&(e===429||e>=500&&e<=599),a=/* @__PURE__ */ new Set([`get`,`head`,`options`,`put`,`delete`]),o=/* @__PURE__ */ new Set([`post`,`patch`]),s=/* @__PURE__ */ new Set([`ECONNREFUSED`,`ENOTFOUND`,`EAI_AGAIN`,`ENETUNREACH`,`EHOSTUNREACH`]),c=e=>!e.response&&typeof e.code==`string`&&s.has(e.code),l=3e4,u=e=>typeof e==`object`&&!!e,d=(e,t)=>{if(!u(e))return;let n=e.get;return typeof n==`function`?n.call(e,t):e[t]},f=e=>{let t=e.response;if(!t)return null;let n=d(t.headers,`retry-after`),r=Number(n);return n!=null&&Number.isFinite(r)&&r>0?r*1e3:null},p=t=>{let n=d(t?.headers,e);return typeof n==`string`&&n!==``},m=e=>{if(r.isCancel(e)||e.code===`ERR_CANCELED`)return!1;if(c(e))return!0;let t=(e.config?.method??`get`).toLowerCase(),n=a.has(t),s=e.response?.status;if(s===void 0)return n||o.has(t)&&p(e.config);if(!i(s))return!1;let u=f(e);return u!==null&&u>l?!1:n||(s===429||s===503)&&p(e.config)},h={retryDelayMs:e=>e<=1?0:Math.random()*Math.min(3e4,1e3*2**e),shouldRetry:m,onRetry:()=>void 0},g=(e,t)=>new Promise(n=>{let r=()=>{clearTimeout(i),n(!1)},i=setTimeout(()=>{t?.removeEventListener?.(`abort`,r),n(!0)},e);t?.addEventListener?.(`abort`,r,{once:!0})}),_=(e,i={})=>{e.interceptors.response.use(void 0,async a=>{if(!r.isAxiosError(a))return Promise.reject(a);let o=a,s=o.config;if(!s||s.retry===!1)return Promise.reject(a);let c=typeof s.retry==`object`?s.retry:{},l={...h,retries:t(`retries`),...i,...c},u=(s.__retryAttempt??0)+1;return n(o)||u>l.retries||!l.shouldRetry(o)||s.signal?.aborted||(s.__retryAttempt=u,s.transformRequest=[e=>e],l.onRetry(u,o),!await g(f(o)??l.retryDelayMs(u),s.signal))?Promise.reject(a):e.request(s)})};export{e as IDEMPOTENCY_KEY_HEADER,_ as attachRetry,c as isNeverSentError,m as isRetryableFailure,i as isRetryableStatus,f as retryAfterMs};
@@ -1 +1 @@
1
- var e=class extends Error{constructor(e){super(e),this.name=`ContractCallError`}},t=/\{([^{}]+)\}/g,n=e=>e instanceof Date?encodeURIComponent(e.toISOString()):encodeURIComponent(typeof e==`object`?JSON.stringify(e):String(e));function r(e){let t=[];for(let[r,i]of Object.entries(e??{})){if(i==null)continue;let e=encodeURIComponent(r);for(let r of Array.isArray(i)?i:[i])r!=null&&t.push(`${e}=${n(r)}`)}return t.join(`&`)}var i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,a=[`content-type`,`content-length`],o=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function s(t,n,r){if(r===void 0)return n;if(!o(r))throw new e(`${t} needs call headers as an object of header names to string values`);let s=new Set(Object.keys(n??{}).map(e=>e.toLowerCase())),c={...n};for(let[n,o]of Object.entries(r)){if(!i.test(n))throw new e(`${t} has a call header named "${n}", which is not a valid header name`);let r=n.toLowerCase();if(a.includes(r))throw new e(`${t} sets "${n}" as a call header; the body decides it`);if(s.has(r))throw new e(`${t} sets "${n}" twice; set a header the contract declares on the request's headers only`);if(typeof o!=`string`||/[\r\n\0]/.test(o))throw new e(`${t} needs call header "${n}" as a string with no line break`);s.add(r),c[n]=o}return c}function c(t,n){let r=n?.skipErrorLog,i=n?.expectedStatuses;if(r!==void 0&&typeof r!=`boolean`)throw new e(`${t} 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 e(`${t} 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 e(`${t} lists ${String(n)} in expectedStatuses; only a failure status from 400 to 599 is expected`);if(new Set(i).size!==i.length)throw new e(`${t} lists a status twice in expectedStatuses`);if(r===!0)throw new e(`${t} sets skipErrorLog and expectedStatuses; skipErrorLog already keeps every failure out of the log`);return{skipErrorLog:r,expectedStatuses:i}}function l(t,n){let r=n?.reply,i=n?.replacesSession;if(r!==void 0&&r!==`body`&&r!==`full`)throw new e(`${t} needs reply as "body" or "full"`);if(i!==void 0&&typeof i!=`boolean`)throw new e(`${t} needs replacesSession as true or false`);return{reply:r??`body`,replacesSession:i}}var u=e=>e>=200&&e<300||e===304;function d(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:f(e,t,r)}}function f(e,t,n){return e.replyKind===`none`||t===204||t===205?void 0:n}function p(n,i,a){let o=`${n.method} ${n.path}`,u=n.path.replace(t,(t,n)=>{let r=i.path?.[n],a=r===void 0?``:String(r);if(a===``)throw new e(`${o} needs a non-empty path value for "${n}"`);if(a===`.`||a===`..`)throw new e(`${o} needs a path value for "${n}" other than "." or ".."`);return encodeURIComponent(a)}),d=r(i.query);return{method:n.method,url:d===``?u:`${u}?${d}`,headers:s(o,i.headers,a?.headers),data:i.body,responseType:n.replyKind===`blob`?`blob`:`json`,...c(o,a),...l(o,a)}}var m=[`page`,`pageSize`,`sortBy`,`sortOrder`,`search`],h=e=>String(e).padStart(2,`0`),g=e=>e instanceof Date?`${e.getFullYear()}-${h(e.getMonth()+1)}-${h(e.getDate())}`:e,_=e=>e==null||typeof e==`string`&&e.trim()===``,v=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date),y=m;function b(t,n,r){if(!_(r)){if(typeof r==`string`||r instanceof Date)return g(r);throw new e(`listQuery needs "${t}.${n}" as a yyyy-MM-dd string or a Date`)}}function x(t){let n={},{filters:r,...i}=t;for(let e of m){let t=i[e];_(t)||(n[e]=typeof t==`string`?t.trim():t)}n.sortBy===void 0&&delete n.sortOrder;for(let[t,i]of Object.entries(r??{})){if(y.includes(t))throw new e(`listQuery has a filter named "${t}", which the list query reserves (${m.join(`, `)})`);if(Array.isArray(i)){let e=i.filter(e=>!_(e));e.length>0&&(n[t]=e)}else if(v(i)){let e=b(t,`from`,i.from),r=b(t,`to`,i.to);e!==void 0&&(n[`${t}From`]=e),r!==void 0&&(n[`${t}To`]=r)}else i instanceof Date?n[t]=g(i):_(i)||(n[t]=i)}return n}export{e as ContractCallError,p as buildContractRequest,d as contractFullReply,f as contractReply,u as isFullReplyStatus,x as listQuery};
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 +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}},v=(e,t)=>{let n=a(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,hour12:!1}).formatToParts(e),r=e=>Number.parseInt(n.find(t=>t.type===e)?.value??``,10),i=r(`year`),o=r(`month`)-1,s=r(`day`),c=r(`hour`)%24,l=r(`minute`);return{year:i,month:o,day:s,hour:c,minute:l,label:g(Math.round((Date.UTC(i,o,s,c,l)-Math.floor(e.getTime()/6e4)*6e4)/6e4))}},y=(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())}:v(e,t),b=e=>e.hourCycle??12,x=e=>`${f(e.day)}-${c[e.month]}-${e.year}`,S=(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}`},C=(e,t)=>t===24?`${f(e.hour)}:${f(e.minute)}`:`${e.hour%12||12}:${f(e.minute)} ${e.hour<12?`AM`:`PM`}`,w=(e,t)=>t??!u.includes(e),T=(e,t,n,r)=>w(n,r)?`${e} ${t.label}`:e,E=e=>{if(e!==`viewer`)return u.includes(e)?`Asia/Kolkata`:e},D=(e,t,n)=>{let r=a(t,{day:`2-digit`,month:`short`,year:`numeric`,timeZone:n}).formatToParts(e),i=e=>r.find(t=>t.type===e)?.value??``;return`${i(`day`)}-${i(`month`).replace(`.`,``)}-${i(`year`)}`},O=(n,r)=>{let i=t().dateOrder??`DayMonthNameYear`;if(i!==`DayMonthNameYear`)return S(y(n,r),i);let a=e();return a?D(n,a,E(r)):x(y(n,r))},k=(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),A=(e,n={})=>{let r=m(e);return r?O(r,h(e)?`UTC`:n.zone??t().zone):p(n.empty)},ee=(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,o,a,r);let s=y(i,a);return T(C(s,b(r)),s,a,r.zoneLabel)},te=(n,r={})=>{let i=m(n);if(!i)return p(r.empty);let a=r.zone??t().zone,o=e();if(o)return`${O(i,a)}, ${k(i,o,a,r)}`;let s=y(i,a);return T(`${O(i,a)}, ${C(s,b(r))}`,s,a,r.zoneLabel)},j=1e3,M=60*j,N=60*M,P=24*N,F=7*P,I=30*P,L=365*P,R=[[`year`,L],[`month`,I],[`day`,P],[`hour`,N],[`minute`,M]],z=(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]=R.find(([,e])=>c>=e)??[`second`,j];return e.format(Math.round(o/r),n)}if(c<M)return`just now`;let[d,f]=c<N?[`minute`,M]:c<P?[`hour`,N]:c<F?[`day`,P]:c<I?[`week`,F]:c<L?[`month`,I]:[`year`,L],h=Math.floor(c/f),g=`${h} ${d}${h===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},J=/* @__PURE__ */ new Set([`grouping`,`minimumFractionDigits`,`maximumFractionDigits`,`locale`,`empty`,`scale`]),Y=e=>{if(!Object.entries(e).some(([e,t])=>t!==void 0&&!J.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=V(e);return{minimumFractionDigits:n,maximumFractionDigits:Math.max(n,V(t))}},$=e=>e===`none`?{useGrouping:!1}:{},ne=(e,t={})=>{let r=B(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):q(r,t.minimumFractionDigits??0,t.maximumFractionDigits??3,t.grouping??n(X(t)))},re=(e,t={})=>{let r=B(e);if(r===null)return p(t.empty);let a=Y(t);if(a){let e=t.scale===`percent`?H(r,-2):r;return i(o(X(t),{style:`percent`,...a}),e)}let s=Z(t);if(s){let e=t.scale===`percent`?H(r,-2):r;return i(o(s,{style:`percent`,...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0),...$(t.grouping)}),e)}return`${q(t.scale===`percent`?r:H(r,2),t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0,t.grouping??n(X(t)))}%`},ie={INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`},ae={JPY:0,KRW:0,VND:0,BHD:3,JOD:3,KWD:3,OMR:3,TND:3},oe=(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 p(t.empty);let r=t.currency.toUpperCase(),a=ae[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=U(),h=W(l,f,m.group)+(u?`${m.decimal}${u}`:``),g=n<0&&s!==0?`-`:``;if(t.symbol===!1)return`${g}${h}`;let _=ie[r];return _?`${g}${_}${h}`:`${g}${r} ${h}`};export{A as formatDate,te as formatDateTime,oe as formatMinor,ne as formatNumber,re as formatPercent,z as formatRelative,ee 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=[`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};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{listQuery as e}from"./api-contract/dist/call.js";import{DEFAULT_BUILD_CHECK_INTERVAL_MS as t,DEFAULT_LOG_LEVEL as n,DEFAULT_RETRIES as r,DEFAULT_TIMEOUT_MS as i,DEFAULT_VERSION_URL as a,getConfig as o,getConfigValue as s,resetConfig as c,setConfig as l}from"./config/index.js";import{TRACEPARENT_HEADER as u,applyRequestDefaults as d,newTraceparent as f}from"./api/requestDefaults.js";import{Logger as p,configureLogger as m,getDeviceContext as h,setDeviceContext as g,setRemoteLogger as _}from"./logger/logger.js";import{decodeJWT as v,getJWTExpiry as y,isJWTExpired as b}from"./auth/jwt.js";import{ACCESS_TOKEN_KEY as x,LEGACY_REFRESH_TOKEN_LIFETIME_MS as S,REFRESH_TOKEN_KEY as C,SESSION_USER_KEY as w,addSessionEndedListener as T,clearSession as E,getKeepSignedIn as D,getSessionUser as O,getToken as k,hasSession as A,hasSessionEndedInTab as j,removeSessionUser as M,removeToken as N,setKeepSignedIn as P,setLegacyTokenKeys as F,storeSessionUser as I,storeToken as L}from"./auth/authStore.js";import{addNetworkStatusListener as R,getNetworkStatus as z,setNetworkStatusImplementation as B,useNetworkStatus as V}from"./network/networkStatus.js";import{ACCOUNT_ID_HEADER as H,CLIENT_BUILD_HEADER as U,CLIENT_KIND as W,CLIENT_KIND_HEADER as G,getClientBuild as K}from"./api/clientHeaders.js";import{initWebority as q}from"./initSDK.js";import{DESIGN_SAMPLE_HEADER as J,DESIGN_SAMPLE_QUERY_KEY as Y,DESIGN_SAMPLE_STORAGE_KEY as X,applyDesignSample as Z,readDesignSampleTicket as Q}from"./api/designSample.js";import{MIN_APP_VERSION_HEADER as $,addMinAppVersionListener as ee,getMinAppVersion as te}from"./api/minAppVersion.js";import{WORKSPACE_CHANGED_CODE as ne,WorkspaceChangedError as re,isWorkspaceChangedError as ie}from"./api/workspaceChanged.js";import{IDEMPOTENCY_KEY_HEADER as ae,attachRetry as oe,isNeverSentError as se,isRetryableFailure as ce,isRetryableStatus as le,retryAfterMs as ue}from"./api/retry.js";import{REFRESH_LOCK_NAME as de,withCrossTabRefreshLock as fe}from"./api/crossTabRefreshLock.js";import pe from"./api/publicClient.js";import{SESSION_EXPIRED_CODE as me,SESSION_REVOKED_CODE as he,injectStore as ge,injectUserAuth as _e,refreshAccessToken as ve,resetRefreshState as ye}from"./api/tokenRefresh.js";import be,{RequestOfflineError as xe}from"./api/userClient.js";import{initUserAuth as Se}from"./initUserAuth.js";import{readBlobErrorBody as Ce}from"./api/blobErrorBody.js";import{createContractCaller as we}from"./api/contractCaller.js";import{CONTRACT_ERROR_CODE as Te,NETWORK_CODE as Ee,OFFLINE_CODE as De,OFFLINE_MESSAGE as Oe,REQUEST_CANCELED_CODE as ke,SERVER_FAILURE_MESSAGE as Ae,TIMEOUT_CODE as je,TIMEOUT_MESSAGE as Me,UNEXPECTED_MESSAGE as Ne,UNREACHABLE_MESSAGE as Pe,apiErrorMessage as Fe,extractApiError as Ie,isApiError as Le,isNoResponse as Re,toFieldPath as ze}from"./errors/extractApiError.js";import{parseResponse as Be}from"./errors/parseResponse.js";import{contentDispositionFileName as Ve,downloadFile as He}from"./api/downloadFile.js";import{newIdempotencyKey as Ue}from"./api/idempotencyKey.js";import{configureFormatters as We,getFormatterConfig as Ge}from"./formatters/formatConfig.js";import{formatCurrency as Ke}from"./formatters/currency.js";import{addDays as qe}from"./formatters/dateMath.js";import{formatDate as Je,formatDateTime as Ye,formatMinor as Xe,formatNumber as Ze,formatPercent as Qe,formatRelative as $e,formatTime as et}from"./formatters/house.js";import{staticUrl as tt}from"./static/index.js";import{createApiBaseQuery as nt}from"./query/apiBaseQuery.js";import{createContractQuery as rt}from"./query/contractQuery.js";import{APP_API_DEFAULTS as it,createAppApi as at}from"./query/createAppApi.js";import{useDataState as ot,useInfiniteDataState as st}from"./query/dataState.js";import{entityTagOf as ct,saveWithVersion as lt,versionOf as ut,withIfMatch as dt}from"./query/entityVersion.js";import{setupApiListeners as ft}from"./query/listeners.js";import{LIST_QUERY_RESERVED as pt,SEARCH_PARAM as mt,emptyFacetValue as ht,isFacetActive as gt,listQueryParamNames as _t,parseListQuery as vt}from"./query/listQuery.js";import{getNextPageParam as yt,getPreviousPageParam as bt,hasNextPage as xt,hasPreviousPage as St}from"./query/paging.js";import{LIST_TAG_ID as Ct,itemTag as wt,listTag as Tt,providesList as Et,providesPagedList as Dt}from"./query/tags.js";import{useListQuery as Ot}from"./query/useListQuery.js";import{errorToastMiddleware as kt,isSilentRejection as At}from"./redux/errorToastMiddleware.js";import{createRootReducer as jt,resetState as Mt}from"./redux/rootReducer.js";import{SERIALIZABLE_IGNORED_ACTION_PATHS as Nt}from"./redux/serializableCheck.js";import{hasRecentlyReloaded as Pt,importWithReload as Ft,isChunkLoadError as It,lazyWithReload as Lt,markReloaded as Rt}from"./router/chunkReload.js";import{classifyRouteError as zt,useRouteErrorReport as Bt}from"./router/routeError.js";import{ErrorBoundary as Vt}from"./router/ErrorBoundary.js";import{hasPermission as Ht}from"./router/permissions.js";import{RETURN_TO_PARAM as Ut,buildLoginPath as Wt,getReturnTo as Gt,toSafeReturnTo as Kt}from"./router/returnTo.js";import{PublicOnly as qt,RequireAuth as Jt,RequirePermission as Yt}from"./router/guards.js";import{publicOnly as Xt,requireAuth as Zt,requirePermission as Qt,withGuards as $t}from"./router/loaders.js";import{defineRouteTable as en}from"./router/routeTable.js";import{Storage as tn,isStorageAvailable as nn,setStorageImplementation as rn,syncSessionStorage as an,syncStorage as on}from"./storage/index.js";import{isBuildBelowMinimum as sn,parseBuildNumber as cn}from"./versionCheck/buildNumber.js";import{addDeployedBuildListener as ln,getNewerDeployedBuild as un,startDeployedBuildCheck as dn}from"./versionCheck/deployedBuild.js";import{installReloadOnNavigate as fn,isUpdateAvailable as pn,useVersionCheck as mn}from"./versionCheck/index.js";export{x as ACCESS_TOKEN_KEY,H as ACCOUNT_ID_HEADER,it as APP_API_DEFAULTS,U as CLIENT_BUILD_HEADER,W as CLIENT_KIND,G as CLIENT_KIND_HEADER,Te as CONTRACT_ERROR_CODE,t as DEFAULT_BUILD_CHECK_INTERVAL_MS,n as DEFAULT_LOG_LEVEL,r as DEFAULT_RETRIES,i as DEFAULT_TIMEOUT_MS,a as DEFAULT_VERSION_URL,J as DESIGN_SAMPLE_HEADER,Y as DESIGN_SAMPLE_QUERY_KEY,X as DESIGN_SAMPLE_STORAGE_KEY,Vt as ErrorBoundary,ae as IDEMPOTENCY_KEY_HEADER,S as LEGACY_REFRESH_TOKEN_LIFETIME_MS,pt as LIST_QUERY_RESERVED,Ct as LIST_TAG_ID,p as Logger,$ as MIN_APP_VERSION_HEADER,Ee as NETWORK_CODE,De as OFFLINE_CODE,Oe as OFFLINE_MESSAGE,qt as PublicOnly,de as REFRESH_LOCK_NAME,C as REFRESH_TOKEN_KEY,ke as REQUEST_CANCELED_CODE,Ut as RETURN_TO_PARAM,xe as RequestOfflineError,Jt as RequireAuth,Yt as RequirePermission,mt as SEARCH_PARAM,Nt as SERIALIZABLE_IGNORED_ACTION_PATHS,Ae as SERVER_FAILURE_MESSAGE,me as SESSION_EXPIRED_CODE,he as SESSION_REVOKED_CODE,w as SESSION_USER_KEY,tn as Storage,je as TIMEOUT_CODE,Me as TIMEOUT_MESSAGE,u as TRACEPARENT_HEADER,Ne as UNEXPECTED_MESSAGE,Pe as UNREACHABLE_MESSAGE,ne as WORKSPACE_CHANGED_CODE,re as WorkspaceChangedError,qe as addDays,ln as addDeployedBuildListener,ee as addMinAppVersionListener,R as addNetworkStatusListener,T as addSessionEndedListener,Fe as apiErrorMessage,Z as applyDesignSample,d as applyRequestDefaults,oe as attachRetry,Wt as buildLoginPath,zt as classifyRouteError,E as clearSession,We as configureFormatters,m as configureLogger,Ve as contentDispositionFileName,nt as createApiBaseQuery,at as createAppApi,we as createContractCaller,rt as createContractQuery,jt as createRootReducer,v as decodeJWT,en as defineRouteTable,He as downloadFile,ht as emptyFacetValue,ct as entityTagOf,kt as errorToastMiddleware,Ie as extractApiError,Ke as formatCurrency,Je as formatDate,Ye as formatDateTime,Xe as formatMinor,Ze as formatNumber,Qe as formatPercent,$e as formatRelative,et as formatTime,K as getClientBuild,o as getConfig,s as getConfigValue,h as getDeviceContext,Ge as getFormatterConfig,y as getJWTExpiry,D as getKeepSignedIn,te as getMinAppVersion,z as getNetworkStatus,un as getNewerDeployedBuild,yt as getNextPageParam,bt as getPreviousPageParam,Gt as getReturnTo,O as getSessionUser,k as getToken,xt as hasNextPage,Ht as hasPermission,St as hasPreviousPage,Pt as hasRecentlyReloaded,A as hasSession,j as hasSessionEndedInTab,Ft as importWithReload,Se as initUserAuth,q as initWebority,ge as injectStore,_e as injectUserAuth,fn as installReloadOnNavigate,Le as isApiError,sn as isBuildBelowMinimum,It as isChunkLoadError,gt as isFacetActive,b as isJWTExpired,se as isNeverSentError,Re as isNoResponse,ce as isRetryableFailure,le as isRetryableStatus,At as isSilentRejection,nn as isStorageAvailable,pn as isUpdateAvailable,ie as isWorkspaceChangedError,wt as itemTag,Lt as lazyWithReload,e as listQuery,_t as listQueryParamNames,Tt as listTag,Rt as markReloaded,Ue as newIdempotencyKey,f as newTraceparent,cn as parseBuildNumber,vt as parseListQuery,Be as parseResponse,Et as providesList,Dt as providesPagedList,pe as publicClient,Xt as publicOnly,Ce as readBlobErrorBody,Q as readDesignSampleTicket,ve as refreshAccessToken,M as removeSessionUser,N as removeToken,Zt as requireAuth,Qt as requirePermission,c as resetConfig,ye as resetRefreshState,Mt as resetState,ue as retryAfterMs,lt as saveWithVersion,l as setConfig,g as setDeviceContext,P as setKeepSignedIn,F as setLegacyTokenKeys,B as setNetworkStatusImplementation,_ as setRemoteLogger,rn as setStorageImplementation,ft as setupApiListeners,dn as startDeployedBuildCheck,tt as staticUrl,I as storeSessionUser,L as storeToken,an as syncSessionStorage,on as syncStorage,ze as toFieldPath,Kt as toSafeReturnTo,ot as useDataState,st as useInfiniteDataState,Ot as useListQuery,V as useNetworkStatus,Bt as useRouteErrorReport,mn as useVersionCheck,be as userClient,ut as versionOf,fe as withCrossTabRefreshLock,$t as withGuards,dt as withIfMatch};
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{decodeJWT as y,getJWTExpiry as b,isJWTExpired as x}from"./auth/jwt.js";import{ACCESS_TOKEN_KEY as S,LEGACY_REFRESH_TOKEN_LIFETIME_MS as C,REFRESH_TOKEN_KEY as w,SESSION_USER_KEY as T,addSessionEndedListener as E,clearSession as D,getKeepSignedIn as O,getSessionUser as k,getToken as A,hasSession as j,hasSessionEndedInTab as M,removeSessionUser as N,removeToken as P,setKeepSignedIn as F,setLegacyTokenKeys as I,storeSessionUser as L,storeToken as R}from"./auth/authStore.js";import{addNetworkStatusListener as z,getNetworkStatus as B,setNetworkStatusImplementation as V,useNetworkStatus as H}from"./network/networkStatus.js";import{ACCOUNT_ID_HEADER as U,CLIENT_BUILD_HEADER as W,CLIENT_KIND as G,CLIENT_KIND_HEADER as K,getClientBuild as q}from"./api/clientHeaders.js";import{initWebority as J}from"./initSDK.js";import{DESIGN_SAMPLE_HEADER as Y,DESIGN_SAMPLE_QUERY_KEY as X,DESIGN_SAMPLE_STORAGE_KEY as Z,applyDesignSample as Q,readDesignSampleTicket as $}from"./api/designSample.js";import{MIN_APP_VERSION_HEADER as ee,addMinAppVersionListener as te,getMinAppVersion as ne}from"./api/minAppVersion.js";import{WORKSPACE_CHANGED_CODE as re,WorkspaceChangedError as ie,isWorkspaceChangedError as ae}from"./api/workspaceChanged.js";import{attachRetry as oe,isNeverSentError as se,isRetryableFailure as ce,isRetryableStatus as le,retryAfterMs as ue}from"./api/retry.js";import{REFRESH_LOCK_NAME as de,withCrossTabRefreshLock as fe}from"./api/crossTabRefreshLock.js";import pe from"./api/publicClient.js";import{SESSION_EXPIRED_CODE as me,SESSION_REVOKED_CODE as he,injectStore as ge,injectUserAuth as _e,refreshAccessToken as ve,resetRefreshState as ye}from"./api/tokenRefresh.js";import be,{RequestOfflineError as xe}from"./api/userClient.js";import{initUserAuth as Se}from"./initUserAuth.js";import{readBlobErrorBody as Ce}from"./api/blobErrorBody.js";import{newIdempotencyKey as we}from"./api/idempotencyKey.js";import{createContractCaller as Te}from"./api/contractCaller.js";import{CONTRACT_ERROR_CODE as Ee,NETWORK_CODE as De,OFFLINE_CODE as Oe,OFFLINE_MESSAGE as ke,REQUEST_CANCELED_CODE as Ae,SERVER_FAILURE_MESSAGE as je,TIMEOUT_CODE as Me,TIMEOUT_MESSAGE as Ne,UNEXPECTED_MESSAGE as Pe,UNREACHABLE_MESSAGE as Fe,apiErrorMessage as Ie,extractApiError as Le,isApiError as Re,isNoResponse as ze,toFieldPath as Be}from"./errors/extractApiError.js";import{parseResponse as Ve}from"./errors/parseResponse.js";import{contentDispositionFileName as He,downloadFile as Ue}from"./api/downloadFile.js";import{configureFormatters as We,getFormatterConfig as Ge}from"./formatters/formatConfig.js";import{formatCurrency as Ke}from"./formatters/currency.js";import{addDays as qe}from"./formatters/dateMath.js";import{formatDate as Je,formatDateTime as Ye,formatMinor as Xe,formatNumber as Ze,formatPercent as Qe,formatRelative as $e,formatTime as et}from"./formatters/house.js";import{staticUrl as tt}from"./static/index.js";import{createApiBaseQuery as nt}from"./query/apiBaseQuery.js";import{createContractQuery as rt}from"./query/contractQuery.js";import{APP_API_DEFAULTS as it,createAppApi as at}from"./query/createAppApi.js";import{useDataState as ot,useInfiniteDataState as st}from"./query/dataState.js";import{entityTagOf as ct,saveWithVersion as lt,versionOf as ut,withIfMatch as dt}from"./query/entityVersion.js";import{setupApiListeners as ft}from"./query/listeners.js";import{LIST_QUERY_RESERVED as pt,SEARCH_PARAM as mt,emptyFacetValue as ht,isFacetActive as gt,listQueryParamNames as _t,parseListQuery as vt}from"./query/listQuery.js";import{getNextPageParam as yt,getPreviousPageParam as bt,hasNextPage as xt,hasPreviousPage as St}from"./query/paging.js";import{LIST_TAG_ID as Ct,itemTag as wt,listTag as Tt,providesList as Et,providesPagedList as Dt}from"./query/tags.js";import{useListQuery as Ot}from"./query/useListQuery.js";import{errorToastMiddleware as kt,isSilentRejection as At}from"./redux/errorToastMiddleware.js";import{createRootReducer as jt,resetState as Mt}from"./redux/rootReducer.js";import{SERIALIZABLE_IGNORED_ACTION_PATHS as Nt}from"./redux/serializableCheck.js";import{hasRecentlyReloaded as Pt,importWithReload as Ft,isChunkLoadError as It,lazyWithReload as Lt,markReloaded as Rt}from"./router/chunkReload.js";import{classifyRouteError as zt,useRouteErrorReport as Bt}from"./router/routeError.js";import{ErrorBoundary as Vt}from"./router/ErrorBoundary.js";import{hasPermission as Ht}from"./router/permissions.js";import{RETURN_TO_PARAM as Ut,buildLoginPath as Wt,getReturnTo as Gt,toSafeReturnTo as Kt}from"./router/returnTo.js";import{PublicOnly as qt,RequireAuth as Jt,RequirePermission as Yt}from"./router/guards.js";import{publicOnly as Xt,requireAuth as Zt,requirePermission as Qt,withGuards as $t}from"./router/loaders.js";import{defineRouteTable as en}from"./router/routeTable.js";import{useUnsavedChanges as tn}from"./router/unsavedChanges.js";import{Storage as nn,isStorageAvailable as rn,setStorageImplementation as an,syncSessionStorage as on,syncStorage as sn}from"./storage/index.js";import{FIELD_RULE_MESSAGES as cn,checkFields as ln,fieldRules as un,refineWith as dn}from"./validators/fieldRules.js";import{isAlphanumeric as fn,isBetween as pn,isEmail as mn,isHexColor as hn,isInteger as gn,isNonEmpty as _n,isNumeric as vn,isPhone as yn,isStrongPassword as bn,isUrl as xn,maxLength as Sn,minLength as Cn}from"./validators/index.js";import{isBuildBelowMinimum as wn,parseBuildNumber as Tn}from"./versionCheck/buildNumber.js";import{addDeployedBuildListener as En,getNewerDeployedBuild as Dn,startDeployedBuildCheck as On}from"./versionCheck/deployedBuild.js";import{installReloadOnNavigate as kn,isUpdateAvailable as An,useVersionCheck as jn}from"./versionCheck/index.js";export{S as ACCESS_TOKEN_KEY,U as ACCOUNT_ID_HEADER,it as APP_API_DEFAULTS,W as CLIENT_BUILD_HEADER,G as CLIENT_KIND,K as CLIENT_KIND_HEADER,Ee 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,Y as DESIGN_SAMPLE_HEADER,X as DESIGN_SAMPLE_QUERY_KEY,Z as DESIGN_SAMPLE_STORAGE_KEY,Vt as ErrorBoundary,cn as FIELD_RULE_MESSAGES,e as IDEMPOTENCY_KEY_HEADER,C as LEGACY_REFRESH_TOKEN_LIFETIME_MS,pt as LIST_QUERY_RESERVED,Ct as LIST_TAG_ID,m as Logger,ee as MIN_APP_VERSION_HEADER,De as NETWORK_CODE,Oe as OFFLINE_CODE,ke as OFFLINE_MESSAGE,qt as PublicOnly,de as REFRESH_LOCK_NAME,w as REFRESH_TOKEN_KEY,Ae as REQUEST_CANCELED_CODE,Ut as RETURN_TO_PARAM,xe as RequestOfflineError,Jt as RequireAuth,Yt as RequirePermission,mt as SEARCH_PARAM,Nt as SERIALIZABLE_IGNORED_ACTION_PATHS,je as SERVER_FAILURE_MESSAGE,me as SESSION_EXPIRED_CODE,he as SESSION_REVOKED_CODE,T as SESSION_USER_KEY,nn as Storage,Me as TIMEOUT_CODE,Ne as TIMEOUT_MESSAGE,d as TRACEPARENT_HEADER,Pe as UNEXPECTED_MESSAGE,Fe as UNREACHABLE_MESSAGE,re as WORKSPACE_CHANGED_CODE,ie as WorkspaceChangedError,qe as addDays,En as addDeployedBuildListener,te as addMinAppVersionListener,z as addNetworkStatusListener,E as addSessionEndedListener,Ie as apiErrorMessage,Q as applyDesignSample,f as applyRequestDefaults,oe as attachRetry,Wt as buildLoginPath,ln as checkFields,zt as classifyRouteError,D as clearSession,We as configureFormatters,h as configureLogger,He as contentDispositionFileName,nt as createApiBaseQuery,at as createAppApi,Te as createContractCaller,rt as createContractQuery,jt as createRootReducer,y as decodeJWT,en as defineRouteTable,Ue as downloadFile,ht as emptyFacetValue,ct as entityTagOf,kt as errorToastMiddleware,Le as extractApiError,un as fieldRules,Ke as formatCurrency,Je as formatDate,Ye as formatDateTime,Xe as formatMinor,Ze as formatNumber,Qe as formatPercent,$e as formatRelative,et as formatTime,q as getClientBuild,s as getConfig,c as getConfigValue,g as getDeviceContext,Ge as getFormatterConfig,b as getJWTExpiry,O as getKeepSignedIn,ne as getMinAppVersion,B as getNetworkStatus,Dn as getNewerDeployedBuild,yt as getNextPageParam,bt as getPreviousPageParam,Gt as getReturnTo,k as getSessionUser,A as getToken,xt as hasNextPage,Ht as hasPermission,St as hasPreviousPage,Pt as hasRecentlyReloaded,j as hasSession,M as hasSessionEndedInTab,Ft as importWithReload,Se as initUserAuth,J as initWebority,ge as injectStore,_e as injectUserAuth,kn as installReloadOnNavigate,fn as isAlphanumeric,Re as isApiError,pn as isBetween,wn as isBuildBelowMinimum,It as isChunkLoadError,mn as isEmail,gt as isFacetActive,hn as isHexColor,gn as isInteger,x as isJWTExpired,se as isNeverSentError,ze as isNoResponse,_n as isNonEmpty,vn as isNumeric,yn as isPhone,ce as isRetryableFailure,le as isRetryableStatus,At as isSilentRejection,rn as isStorageAvailable,bn as isStrongPassword,An as isUpdateAvailable,xn as isUrl,ae as isWorkspaceChangedError,wt as itemTag,Lt as lazyWithReload,t as listQuery,_t as listQueryParamNames,Tt as listTag,Rt as markReloaded,Sn as maxLength,Cn as minLength,we as newIdempotencyKey,p as newTraceparent,Tn as parseBuildNumber,vt as parseListQuery,Ve as parseResponse,Et as providesList,Dt as providesPagedList,pe as publicClient,Xt as publicOnly,Ce as readBlobErrorBody,$ as readDesignSampleTicket,dn as refineWith,ve as refreshAccessToken,N as removeSessionUser,P as removeToken,Zt as requireAuth,Qt as requirePermission,l as resetConfig,ye as resetRefreshState,Mt as resetState,ue as retryAfterMs,lt as saveWithVersion,u as setConfig,_ as setDeviceContext,F as setKeepSignedIn,I as setLegacyTokenKeys,V as setNetworkStatusImplementation,v as setRemoteLogger,an as setStorageImplementation,ft as setupApiListeners,On as startDeployedBuildCheck,tt as staticUrl,L as storeSessionUser,R as storeToken,on as syncSessionStorage,sn as syncStorage,Be as toFieldPath,Kt as toSafeReturnTo,ot as useDataState,st as useInfiniteDataState,Ot as useListQuery,H as useNetworkStatus,Bt as useRouteErrorReport,tn as useUnsavedChanges,jn as useVersionCheck,be as userClient,ut as versionOf,fe as withCrossTabRefreshLock,$t as withGuards,dt as withIfMatch};
@@ -1 +1 @@
1
- import{extractApiError as e}from"../errors/extractApiError.js";import{isFacetActive as t,listQueryParamNames as n,listQueryParams as r,parseListQuery as i}from"./listQuery.js";import{useCallback as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{useSearchParams as u}from"react-router";var d=300,f=20,p=`No results match these filters.`,m=[];function h(e,t,r){let a=n(t),o=[...e.keys()].some(e=>a.has(e)),s=i(e,{facets:t,defaults:r});return{page:s.page,...s.pageSize!==void 0&&{pageSize:s.pageSize},...s.sortBy!==void 0&&{sortBy:s.sortBy},sortOrder:s.sortOrder,search:o?s.search:r.search??``,filters:s.filters}}function g(e){return r({page:e.page,...e.pageSize!==void 0&&{pageSize:e.pageSize},...e.sortBy!==void 0&&{sortBy:e.sortBy},sortOrder:e.sortOrder,search:e.search,filters:e.filters})}function _(e){return{page:e.page,...e.pageSize!==void 0&&{pageSize:e.pageSize},...e.sortBy!==void 0&&{sortBy:e.sortBy},sortOrder:e.sortOrder,search:e.search,filters:e.filters}}function v(n){let{fetchPage:r,facets:i=[],defaults:v={},debounceMs:y=d,onRefreshError:b}=n,[x,S]=u(),C=h(x,i,v),[w,T]=l(C.search),[E,D]=l(),O=c(E);O.current=E;let[k,A]=l(),[j,M]=l(!0),[N,P]=l(0),F={...C,search:w},I=c(F);I.current=F;let L=c(r);L.current=r;let R=c(b);R.current=b;let z=`${g(F)}#${N}`,B=c(z);B.current=z,o(()=>{if(C.search===w)return;let e=setTimeout(()=>T(C.search),y);return()=>clearTimeout(e)},[C.search,w,y]),o(()=>{let t=new AbortController,n=()=>t.signal.aborted||B.current!==z;return M(!0),new Promise(e=>{e(L.current(_(I.current),{signal:t.signal}))}).then(e=>{n()||(D(e),A(void 0),M(!1))},t=>{n()||(O.current!==void 0&&R.current?.(e(t)),A({reason:t}),M(!1))}),()=>t.abort()},[z]);let V=(e,t)=>{S(g(e),{replace:!0}),t&&T(e.search)},H=e=>V({...C,page:e},!0),U=e=>V({...C,pageSize:e},!0),W=e=>V({...C,page:1,search:e},!1),G=(e,t)=>V({...C,page:1,filters:{...C.filters,[e]:t}},!0),K=(e,t=`asc`)=>V({...C,page:1,sortBy:e,sortOrder:t},!0),q=e=>K(e,e===C.sortBy&&C.sortOrder===`asc`?`desc`:`asc`),J=()=>{let e=h(new URLSearchParams,i,v);S(new URLSearchParams,{replace:!0}),T(e.search)},Y=a(()=>P(e=>e+1),[]),X=C.search!==``||i.some(e=>t(e,C.filters[e.key])),Z=E?.totalCount??0,Q=E?.totalPages??0,$=E?.totalCountCapped===!0,ee=s(()=>E===void 0?k===void 0||j?{status:`loading`,refetch:Y}:{status:`error`,error:e(k.reason),retry:Y,refetch:Y}:E.items.length===0?{status:`empty`,refreshing:j,refresh:Y,refetch:Y}:{status:`data`,data:E,refreshing:j,refresh:Y,refetch:Y},[E,k,j,Y]);return{query:C,rows:E?.items??m,state:ee,totalCount:Z,totalPages:Q,totalCountCapped:$,setFilter:G,setSearch:W,setSort:K,setPage:H,setPageSize:U,reset:J,tableProps:{rows:E?.items??m,...C.sortBy?{sort:{key:C.sortBy,dir:C.sortOrder}}:{},onSort:q,loading:j,...X?{emptyFiltered:p}:{},sourceCount:X?Math.max(Z,1):Z},paginationProps:{page:C.page,totalPages:Q,pageSize:C.pageSize??E?.pageSize??f,onPageChange:H,onPageSizeChange:U}}}export{v as useListQuery};
1
+ import{extractApiError as e}from"../errors/extractApiError.js";import{isFacetActive as t,listQueryParamNames as n,listQueryParams as r,parseListQuery as i}from"./listQuery.js";import{useCallback as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{useSearchParams as u}from"react-router";var d=300,f=20,p=`No results match these filters.`,m=[];function h(e,t,r){let a=n(t),o=[...e.keys()].some(e=>a.has(e)),s=i(e,{facets:t,defaults:r});return{page:s.page,...s.pageSize!==void 0&&{pageSize:s.pageSize},...s.sortBy!==void 0&&{sortBy:s.sortBy},sortOrder:s.sortOrder,search:o?s.search:r.search??``,filters:s.filters}}function g(e){return r({page:e.page,...e.pageSize!==void 0&&{pageSize:e.pageSize},...e.sortBy!==void 0&&{sortBy:e.sortBy},sortOrder:e.sortOrder,search:e.search,filters:e.filters})}function _(e){return{page:e.page,...e.pageSize!==void 0&&{pageSize:e.pageSize},...e.sortBy!==void 0&&{sortBy:e.sortBy},sortOrder:e.sortOrder,search:e.search,filters:e.filters}}function v(n){let{fetchPage:r,facets:i=[],defaults:v={},debounceMs:y=d,onRefreshError:b}=n,[x,S]=u(),C=h(x,i,v),[w,T]=l(C.search),[E,D]=l(),O=c(E);O.current=E;let[k,A]=l(),[j,M]=l(!0),[N,P]=l(0),F={...C,search:w},I=c(F);I.current=F;let L=c(r);L.current=r;let R=c(b);R.current=b;let z=`${g(F)}#${N}`,B=c(z);B.current=z,o(()=>{if(C.search===w)return;let e=setTimeout(()=>T(C.search),y);return()=>clearTimeout(e)},[C.search,w,y]),o(()=>{let t=new AbortController,n=()=>t.signal.aborted||B.current!==z;return M(!0),new Promise(e=>{e(L.current(_(I.current),{signal:t.signal}))}).then(e=>{n()||(D(e),A(void 0),M(!1))},t=>{n()||(O.current!==void 0&&R.current?.(e(t)),A({reason:t}),M(!1))}),()=>t.abort()},[z]);let V=(e,t)=>{S(g(e),{replace:!0}),t&&T(e.search)},H=e=>V({...C,page:e},!0),U=e=>V({...C,pageSize:e},!0),W=e=>V({...C,page:1,search:e},!1),G=(e,t)=>V({...C,page:1,filters:{...C.filters,[e]:t}},!0),K=e=>V({...C,page:1,filters:{...C.filters,...e}},!0),q=(e,t=`asc`)=>V({...C,page:1,sortBy:e,sortOrder:t},!0),J=e=>q(e,e===C.sortBy&&C.sortOrder===`asc`?`desc`:`asc`),Y=()=>{let e=h(new URLSearchParams,i,v);S(new URLSearchParams,{replace:!0}),T(e.search)},X=a(()=>P(e=>e+1),[]),Z=C.search!==``||i.some(e=>t(e,C.filters[e.key])),Q=E?.totalCount??0,$=E?.totalPages??0,ee=E?.totalCountCapped===!0,te=s(()=>E===void 0?k===void 0||j?{status:`loading`,refetch:X}:{status:`error`,error:e(k.reason),retry:X,refetch:X}:E.items.length===0?{status:`empty`,refreshing:j,refresh:X,refetch:X}:{status:`data`,data:E,refreshing:j,refresh:X,refetch:X},[E,k,j,X]);return{query:C,rows:E?.items??m,state:te,totalCount:Q,totalPages:$,totalCountCapped:ee,setFilter:G,setFilters:K,setSearch:W,setSort:q,setPage:H,setPageSize:U,reset:Y,tableProps:{rows:E?.items??m,...C.sortBy?{sort:{key:C.sortBy,dir:C.sortOrder}}:{},onSort:J,loading:j,...Z?{emptyFiltered:p}:{},sourceCount:Z?Math.max(Q,1):Q},paginationProps:{page:C.page,totalPages:$,pageSize:C.pageSize??E?.pageSize??f,onPageChange:H,onPageSizeChange:U}}}export{v as useListQuery};
@@ -1 +1 @@
1
- import{hasRecentlyReloaded as e,importWithReload as t,isChunkLoadError as n,lazyWithReload as r,markReloaded as i}from"./chunkReload.js";import{ErrorBoundary as a}from"./ErrorBoundary.js";import{PublicOnly as o,RequireAuth as s,RequirePermission as c}from"./guards.js";import{publicOnly as l,requireAuth as u,requirePermission as d,withGuards as f}from"./loaders.js";import{hasPermission as p}from"./permissions.js";import{RETURN_TO_PARAM as m,buildLoginPath as h,getReturnTo as g,toSafeReturnTo as _}from"./returnTo.js";import{classifyRouteError as v,useRouteErrorReport as y}from"./routeError.js";import{defineRouteTable as b}from"./routeTable.js";export{a as ErrorBoundary,o as PublicOnly,m as RETURN_TO_PARAM,s as RequireAuth,c as RequirePermission,h as buildLoginPath,v as classifyRouteError,b as defineRouteTable,g as getReturnTo,p as hasPermission,e as hasRecentlyReloaded,t as importWithReload,n as isChunkLoadError,r as lazyWithReload,i as markReloaded,l as publicOnly,u as requireAuth,d as requirePermission,_ as toSafeReturnTo,y as useRouteErrorReport,f as withGuards};
1
+ import{hasRecentlyReloaded as e,importWithReload as t,isChunkLoadError as n,lazyWithReload as r,markReloaded as i}from"./chunkReload.js";import{ErrorBoundary as a}from"./ErrorBoundary.js";import{PublicOnly as o,RequireAuth as s,RequirePermission as c}from"./guards.js";import{publicOnly as l,requireAuth as u,requirePermission as d,withGuards as f}from"./loaders.js";import{hasPermission as p}from"./permissions.js";import{RETURN_TO_PARAM as m,buildLoginPath as h,getReturnTo as g,toSafeReturnTo as _}from"./returnTo.js";import{classifyRouteError as v,useRouteErrorReport as y}from"./routeError.js";import{defineRouteTable as b}from"./routeTable.js";import{useUnsavedChanges as x}from"./unsavedChanges.js";export{a as ErrorBoundary,o as PublicOnly,m as RETURN_TO_PARAM,s as RequireAuth,c as RequirePermission,h as buildLoginPath,v as classifyRouteError,b as defineRouteTable,g as getReturnTo,p as hasPermission,e as hasRecentlyReloaded,t as importWithReload,n as isChunkLoadError,r as lazyWithReload,i as markReloaded,l as publicOnly,u as requireAuth,d as requirePermission,_ as toSafeReturnTo,y as useRouteErrorReport,x as useUnsavedChanges,f as withGuards};
@@ -0,0 +1 @@
1
+ import{useEffect as e,useRef as t}from"react";import{useBeforeUnload as n,useBlocker as r}from"react-router";function i(i){let a=t(!1),o=r(({currentLocation:e,nextLocation:t})=>i&&!a.current&&(e.pathname!==t.pathname||e.search!==t.search));return e(()=>{a.current=!1}),n(e=>{i&&!a.current&&e.preventDefault()}),{blocked:o.state===`blocked`,discard:()=>{o.state===`blocked`&&o.proceed()},keep:()=>{o.state===`blocked`&&o.reset()},leave:e=>{a.current=!0,e()}}}export{i as useUnsavedChanges};
@@ -10,6 +10,10 @@ import type { AxiosInstance, AxiosRequestConfig } from "axios";
10
10
  export type ContractCallConfig = Pick<AxiosRequestConfig, "signal" | "timeout" | "retry"> & ContractCallOptions & {
11
11
  readonly keepalive?: boolean | undefined;
12
12
  };
13
+ /** The call config of a wrapper that only reads the body: `ContractCallConfig` without `reply: "full"`, so it forwards to the body overload of a `ContractCaller`. */
14
+ export type ContractBodyCallConfig = ContractCallConfig & {
15
+ readonly reply?: "body" | undefined;
16
+ };
13
17
  /**
14
18
  * Calls one operation of a generated contract by its id. `reply: "full"` resolves to the status, the headers and the body;
15
19
  * otherwise the call resolves to the body the contract types for the operation.
@@ -20,9 +24,7 @@ export interface ContractCaller<TOperations extends {
20
24
  <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config: ContractCallConfig & {
21
25
  readonly reply: "full";
22
26
  }): Promise<ContractFullReply<TOperations[TId]["response"]>>;
23
- <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?: ContractCallConfig & {
24
- readonly reply?: "body" | undefined;
25
- }): Promise<TOperations[TId]["response"]>;
27
+ <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?: ContractBodyCallConfig): Promise<TOperations[TId]["response"]>;
26
28
  }
27
29
  /**
28
30
  * Builds the typed caller for one generated contract. Errors are the client's own: an interceptor
@@ -6,7 +6,7 @@ export { initUserAuth } from "../initUserAuth";
6
6
  export { readBlobErrorBody } from "./blobErrorBody";
7
7
  export type { AccountIdProvider, ClientKind } from "./clientHeaders";
8
8
  export { ACCOUNT_ID_HEADER, CLIENT_BUILD_HEADER, CLIENT_KIND, CLIENT_KIND_HEADER, getClientBuild, } from "./clientHeaders";
9
- export type { ContractCallConfig, ContractCaller } from "./contractCaller";
9
+ export type { ContractBodyCallConfig, ContractCallConfig, ContractCaller } from "./contractCaller";
10
10
  export { createContractCaller } from "./contractCaller";
11
11
  export { REFRESH_LOCK_NAME, withCrossTabRefreshLock } from "./crossTabRefreshLock";
12
12
  export { applyDesignSample, DESIGN_SAMPLE_HEADER, DESIGN_SAMPLE_QUERY_KEY, DESIGN_SAMPLE_STORAGE_KEY, readDesignSampleTicket, } from "./designSample";
@@ -1,3 +1,4 @@
1
+ import { IDEMPOTENCY_KEY_HEADER } from "@webority/api-contract/call";
1
2
  import { type AxiosError, type AxiosInstance } from "axios";
2
3
  export interface RetryPolicy {
3
4
  retries?: number;
@@ -12,11 +13,7 @@ declare module "axios" {
12
13
  retry?: boolean | RetryPolicy;
13
14
  }
14
15
  }
15
- /**
16
- * A write carrying this header asserts that the API deduplicates it, which is
17
- * the only thing that makes a POST or PATCH safe to send twice.
18
- */
19
- export declare const IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
16
+ export { IDEMPOTENCY_KEY_HEADER };
20
17
  export declare const isRetryableStatus: (status: number | undefined) => boolean;
21
18
  export declare const isNeverSentError: (error: AxiosError) => boolean;
22
19
  /**
@@ -30,8 +27,10 @@ export declare const retryAfterMs: (error: AxiosError) => number | null;
30
27
  * - a request that provably never reached the server is resent, whatever its method;
31
28
  * - GET, HEAD, OPTIONS, PUT and DELETE are resent on 429, any 5xx, a timeout or a
32
29
  * dropped connection, because a second one leaves the server as one would;
33
- * - POST and PATCH are resent only on 429 or 503 (the server refused before
34
- * doing the work) AND only when they carry an `Idempotency-Key`; otherwise never;
30
+ * - POST and PATCH are resent only when they carry an `Idempotency-Key`, and then
31
+ * on 429 or 503 (the server refused before doing the work), or on a timeout or
32
+ * no answer (the reply was lost, and the key lets the server deduplicate);
33
+ * otherwise never;
35
34
  * - a refusal that names a wait longer than 30 seconds is final;
36
35
  * - a cancelled request is never resent.
37
36
  * A request that knows better passes its own `shouldRetry`.
@@ -11,7 +11,7 @@
11
11
  * Intl options exist at all (Hermes has no RelativeTimeFormat and no
12
12
  * trailingZeroDisplay). IST and the viewer's zone are therefore computed with
13
13
  * plain Date arithmetic; Intl is used only to read the wall clock of an
14
- * explicitly named IANA zone, through formatToParts with numeric fields, to
14
+ * explicitly named IANA zone, through format() with numeric fields read as digit runs, to
15
15
  * read the locale's 12- or 24-hour clock, and where a caller asks for Intl
16
16
  * output itself (Intl number options, `formatRelative({ intl: true })`).
17
17
  *
@@ -26,7 +26,9 @@
26
26
  * With a configured locale (`configureFormatters({ locale })`), the words and separators come
27
27
  * from Intl for that locale and the date order stays DD-MMM-YYYY. For en-IN in the viewer zone:
28
28
  * "08-Sept-2026", "08:05 pm", "08-Sept-2026, 08:05 pm IST", "yesterday", "12,34,567.891",
29
- * "₹1,50,000". For de-DE: "08-Sept-2026", "20:05", "1.234.567,891".
29
+ * "₹1,50,000". For de-DE: "08-Sept-2026", "20:05", "1.234.567,891". A runtime whose
30
+ * DateTimeFormat has no formatToParts (iOS) reads each date part from its own single-field format,
31
+ * so a few configured locales print a different month word there: de-DE "Sep", ja-JP "9月".
30
32
  *
31
33
  * A configured `numberStyle` puts its decimal mark and group separator in every number and amount,
32
34
  * whichever path wrote it: "1.23.456,789" for `'CommaWithPointGroups'` with the house text. A
@@ -18,4 +18,5 @@ export * from "./redux";
18
18
  export * from "./router";
19
19
  export * from "./static";
20
20
  export * from "./storage";
21
+ export * from "./validators";
21
22
  export * from "./versionCheck";
@@ -33,6 +33,7 @@ export interface UseListQueryResult<TRow> {
33
33
  /** True when totalCount is the server's cap: show it with a trailing plus. */
34
34
  totalCountCapped: boolean;
35
35
  setFilter(key: string, value: ListFilterValue): void;
36
+ setFilters(values: Record<string, ListFilterValue>): void;
36
37
  setSearch(text: string): void;
37
38
  setSort(sortBy: string, sortOrder?: SortOrder): void;
38
39
  setPage(page: number): void;
@@ -13,3 +13,5 @@ export type { RouteErrorKind, RouteErrorReport } from "./routeError";
13
13
  export { classifyRouteError, useRouteErrorReport } from "./routeError";
14
14
  export type { RouteTableEntry, RouteTablePages } from "./routeTable";
15
15
  export { defineRouteTable } from "./routeTable";
16
+ export type { UnsavedChangesGuard } from "./unsavedChanges";
17
+ export { useUnsavedChanges } from "./unsavedChanges";
@@ -0,0 +1,15 @@
1
+ export interface UnsavedChangesGuard {
2
+ /** True while a navigation is held and the person has not answered. */
3
+ blocked: boolean;
4
+ /** Goes ahead with the held navigation. */
5
+ discard: () => void;
6
+ /** Drops the held navigation; the person stays on the form. */
7
+ keep: () => void;
8
+ /** Leaves on purpose (after a save): the guard lifts, then `go` runs. */
9
+ leave: (go: () => void) => void;
10
+ }
11
+ /**
12
+ * Holds in-app navigation (react-router's blocker; needs the data router) and the tab close
13
+ * (beforeunload) while `when` is true. A change of hash on the same page is never held.
14
+ */
15
+ export declare function useUnsavedChanges(when: boolean): UnsavedChangesGuard;
@@ -0,0 +1,37 @@
1
+ /** Checks one value: the message when it fails, undefined when it passes. Fits react-hook-form's `rules.validate` as it stands. */
2
+ export type FieldRule = (value: unknown) => string | undefined;
3
+ /** Field name to its rule. */
4
+ export type FieldRuleSet = Readonly<Record<string, FieldRule>>;
5
+ export declare const FIELD_RULE_MESSAGES: Readonly<{
6
+ required: string;
7
+ minLength: (length: number) => string;
8
+ maxLength: (length: number) => string;
9
+ email: string;
10
+ phone: string;
11
+ url: string;
12
+ integer: string;
13
+ between: (min: number, max: number) => string;
14
+ }>;
15
+ /** Every rule but `required` passes an empty value (null, undefined, or a string of spaces). */
16
+ export declare const fieldRules: Readonly<{
17
+ required: (message?: string) => FieldRule;
18
+ minLength: (length: number, message?: string) => FieldRule;
19
+ maxLength: (length: number, message?: string) => FieldRule;
20
+ pattern: (pattern: RegExp, message: string) => FieldRule;
21
+ email: (message?: string) => FieldRule;
22
+ phone: (message?: string) => FieldRule;
23
+ url: (message?: string) => FieldRule;
24
+ integer: (message?: string) => FieldRule;
25
+ between: (min: number, max: number, message?: string) => FieldRule;
26
+ /** The first failing rule's message. */
27
+ all: (...rules: readonly FieldRule[]) => FieldRule;
28
+ }>;
29
+ /** Runs each field's rule over `values`; returns field name to message, the shape of `ApiError.fieldErrors`. */
30
+ export declare function checkFields(values: Readonly<Record<string, unknown>>, rules: FieldRuleSet): Record<string, string>;
31
+ /** A rule as a zod `superRefine` callback: `z.string().superRefine(refineWith(rule))`. No zod import. */
32
+ export declare function refineWith(rule: FieldRule): (value: unknown, context: {
33
+ addIssue: (issue: {
34
+ code: "custom";
35
+ message: string;
36
+ }) => void;
37
+ }) => void;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Generic validators returning `boolean`. All accept `null`/`undefined` safely.
3
+ *
4
+ * Tradeoff: regexes are pragmatic, not RFC-strict. They reject the things real users
5
+ * typo and accept the long tail of legitimate inputs. For RFC-grade validation use
6
+ * a dedicated library at the boundary.
7
+ */
8
+ export declare const isNonEmpty: (value: unknown) => boolean;
9
+ export declare const isEmail: (value: unknown) => boolean;
10
+ /**
11
+ * Generic phone validator: 7 to 15 digits, optional `+` prefix.
12
+ * Use `isIndianMobile` from `@webority/mobile-core/india` when you specifically need an Indian mobile number.
13
+ */
14
+ export declare const isPhone: (value: unknown) => boolean;
15
+ export declare const isUrl: (value: unknown) => boolean;
16
+ export declare const isNumeric: (value: unknown) => boolean;
17
+ export declare const isInteger: (value: unknown) => boolean;
18
+ export declare const isAlphanumeric: (value: unknown) => boolean;
19
+ export interface PasswordRules {
20
+ minLength?: number | undefined;
21
+ requireUppercase?: boolean | undefined;
22
+ requireLowercase?: boolean | undefined;
23
+ requireNumber?: boolean | undefined;
24
+ requireSymbol?: boolean | undefined;
25
+ }
26
+ /**
27
+ * Common password complexity check. Defaults to 8+ chars,
28
+ * one uppercase, one lowercase, one digit.
29
+ */
30
+ export declare const isStrongPassword: (value: unknown, rules?: PasswordRules) => boolean;
31
+ export declare const isHexColor: (value: unknown) => boolean;
32
+ export declare const isBetween: (value: unknown, min: number, max: number, inclusive?: boolean) => boolean;
33
+ export declare const minLength: (value: unknown, length: number) => boolean;
34
+ export declare const maxLength: (value: unknown, length: number) => boolean;
35
+ export * from "./fieldRules";
@@ -0,0 +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};
@@ -0,0 +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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/web-core",
3
- "version": "0.164.0",
3
+ "version": "0.165.0",
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",
@@ -86,6 +86,10 @@
86
86
  "types": "./dist/types/storage/index.d.ts",
87
87
  "default": "./dist/storage/index.js"
88
88
  },
89
+ "./validators": {
90
+ "types": "./dist/types/validators/index.d.ts",
91
+ "default": "./dist/validators/index.js"
92
+ },
89
93
  "./versionCheck": {
90
94
  "types": "./dist/types/versionCheck/index.d.ts",
91
95
  "default": "./dist/versionCheck/index.js"
@@ -98,7 +102,7 @@
98
102
  },
99
103
  "sideEffects": false,
100
104
  "dependencies": {
101
- "@webority/api-contract": "0.164.0"
105
+ "@webority/api-contract": "0.165.0"
102
106
  },
103
107
  "peerDependencies": {
104
108
  "@microsoft/applicationinsights-web": "^3.4.5",
@@ -120,7 +124,7 @@
120
124
  "@types/node": "25.6.0",
121
125
  "@types/react": "^19.3.0",
122
126
  "@vitest/coverage-v8": "5.1.0",
123
- "@webority/biome-config": "0.164.0",
127
+ "@webority/biome-config": "0.165.0",
124
128
  "axios": "^1.18.0",
125
129
  "jsdom": "30.1.1",
126
130
  "react": "^19.3.1",