@enterprisestandard/core 0.0.18 → 0.0.19-beta.20260507.2
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/server.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -2086,7 +2086,7 @@ type AzureSecretsConfig = {
|
|
|
2086
2086
|
apiVersion?: string;
|
|
2087
2087
|
/**
|
|
2088
2088
|
* Maps vault "path" to a Key Vault secret name.
|
|
2089
|
-
* Default: replaces `/` with
|
|
2089
|
+
* Default: replaces `/` with `-` and trims leading/trailing `/`.
|
|
2090
2090
|
*/
|
|
2091
2091
|
secretNameTransform?: (path: string) => string;
|
|
2092
2092
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as Y,a as cx,b as _x,c as Jx,d as Lx,e as Nx,f as Rx,g as $x,h as fx,i as Cx,j as Dx,k as zx,l as Hx,m as Qx,n as Xx,o as Zx,r as Ex,s as Gx,t as Yx,u as wx,v as Bx}from"./shared/core-nrs9cxe3.js";var y="0.0.18";var k=["sessionStore","userStore","groupStore","tokenStore","magicLinkStore"];function G(x){if(x===null||typeof x!=="object")return x;let A={};for(let[T,c]of Object.entries(x)){if(k.includes(T)||T==="validators"||T==="setStores")continue;A[T]=c!==null&&typeof c==="object"&&!Array.isArray(c)&&Object.getPrototypeOf(c)===Object.prototype?G(c):c}return A}function S(x){return G(x)}function Q(x,A,T,c){let _=A.length,N=c??x,J=N>0?Math.floor(T/N)+1:1,L=N>0?Math.ceil(x/N):0;return{total:x,count:_,items:A,size:N,page:J,pages:L}}class X extends Error{constructor(x,A){super(x,A);this.name="TenantRequestError",Object.setPrototypeOf(this,X.prototype)}}class Z extends Error{userId;conflictingIds;constructor(x,A,T){super(`Multiple tenants found for user id "${x}"`,T);this.name="MultipleTenantsForUserError",this.userId=x,this.conflictingIds=A,Object.setPrototypeOf(this,Z.prototype)}}function j(x){if(typeof x!=="object"||x==null)return!1;let A=x.type;return A==="vault"||A==="aws"||A==="azure"||A==="gcp"}function w(x){if(typeof x.config==="function")return x;return Y({...x,configSource:x.configSource})}class B{tenants=new Map;userTenantIds=new Map;async get(x){return this.tenants.get(x)}async list(x){let A=Array.from(this.tenants.values()),T=Math.max(0,x?.start??0),c=x?.limit,_=x?.sort;if(_?.length)A=[...A].sort(($,C)=>{for(let{field:f,direction:K}of _){let q=$[f],U=C[f],H=O(q,U);if(H!==0)return K==="desc"?-H:H}return 0});let N=A.length,J=c!=null?T+c:void 0,L=A.slice(T,J);return Q(N,L,T,c)}async upsert(x){return this.tenants.set(x.id,x),x}async delete(x){let A=this.tenants.has(x);return this.tenants.delete(x),A?1:0}async registerUserTenantId(x,A){if(!x)return;let T=I(A),c=this.userTenantIds.get(x);if(c){c.add(T);return}this.userTenantIds.set(x,new Set([T]))}async findTenantsByUser(x){let A=g(x);return this.resolveTenantsByUserId(A)}async resolveTenantsByUserId(x){let A=this.userTenantIds.get(x);if(!A||A.size===0)return[];let T=A.has(null),c=Array.from(A).filter((J)=>J!=null);if(c.length===0)return[];let _=await Promise.all(c.map(async(J)=>({id:J,tenant:await this.get(J)}))),N=_.filter((J)=>J.tenant!=null).map((J)=>J.id);if(N.length===0){if(T)this.userTenantIds.set(x,new Set([null]));else this.userTenantIds.delete(x);return[]}if(N.length!==c.length){let J=T?[null,...N]:N;this.userTenantIds.set(x,new Set(J))}return _.map((J)=>J.tenant).filter((J)=>J!=null)}}class M{store;createEs;constructor(x={}){this.createEs=x.createEs,this.store=new B}async get(x){return this.store.get(x)}async list(x){return this.store.list(x)}async upsert(x){return this.store.upsert(x)}async delete(x){return this.store.delete(x)}async registerUserTenantId(x,A){return this.store.registerUserTenantId(x,A)}async findTenantsByUser(x){return this.store.findTenantsByUser(x)}async getEs(x){let A=await this.get(x);if(!A)return;if(!this.createEs)throw Error(`${this.constructor.name} requires options.createEs to use getEs()`);return this.createEs(w(A))}}function O(x,A){let T=x===void 0||x===null,c=A===void 0||A===null;if(T&&c)return 0;if(T)return 1;if(c)return-1;if(x instanceof Date&&A instanceof Date)return x.getTime()-A.getTime();let _=String(x),N=String(A);return _.localeCompare(N)}function g(x){let A=x.id?.trim();if(!A)throw Error("Tenant lookup requires user.id");return A}function I(x){if(typeof x!=="string")return null;return x.trim()||null}function P(x,A,T){return(async()=>{try{let c=await fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!c.ok)T.error("Failed to send webhook update",{"es.operation":"webhook.update","es.outcome":"failure",status:c.status,statusText:c.statusText})}catch(c){T.error("Failed to send webhook update",{"es.operation":"webhook.update","es.outcome":"failure"},c)}})()}async function p(x,A,T){return P(x,A,T)}var m={beforeTenantSegments:["ui"]},h={beforeTenantSegments:["api"]};function W(x){return{segments:E(x?.segments)}}function E(x){return(x??[]).map((A)=>A.trim()).filter(Boolean)}function n(x){let A=x.trim();if(!A)return"/";let T=A.replace(/\\/g,"/").replace(/\/+/g,"/");return T.startsWith("/")?T:`/${T}`}function F(x){return n(x).split("/").filter(Boolean)}function D(x){return{beforeTenantSegments:E(x?.beforeTenantSegments),afterTenantSegments:E(x?.afterTenantSegments)}}function b(x){if(!x||x.type===void 0||x.type==="path"){let T=x;return{type:"path",ui:D(T?.ui),api:D(T?.api)}}let A=x;return{...A,ui:W(A.ui),api:W(A.api)}}function o(x,A){let T=D(A),c=T.beforeTenantSegments??[],_=T.afterTenantSegments??[],N=F(x),J=c.length+1+_.length;if(N.length<J)return null;for(let f=0;f<c.length;f++)if(N[f]!==c[f])return null;let L=c.length,$=N[L];if(!$)return null;for(let f=0;f<_.length;f++)if(N[L+1+f]!==_[f])return null;let C=N.slice(L+1+_.length);return{id:decodeURIComponent($),restSegments:C,restPath:C.length>0?`/${C.join("/")}`:"/"}}function v(x,A="/",T){let c=D(T),_=c.beforeTenantSegments??[],N=c.afterTenantSegments??[],J=F(A),L=[..._,encodeURIComponent(x),...N,...J];return L.length>0?`/${L.join("/")}`:"/"}function R(x,A,T,c,_){if(x===void 0||x===null){if(T)c.push({message:`${A} is required`,path:_});return}if(typeof x!=="string"){c.push({message:`${A} must be a string`,path:_});return}return x}function z(x,A,T,c){if(x===void 0||x===null)return;if(typeof x!=="boolean"){T.push({message:`${A} must be a boolean`,path:c});return}return x}function d(x,A,T){if(x===void 0||x===null)return;if(typeof x!=="object"||x===null){A.push({message:"name must be an object",path:T});return}let c=x,_={};return _.formatted=R(c.formatted,"formatted",!1,A,[...T,"formatted"]),_.familyName=R(c.familyName,"familyName",!1,A,[...T,"familyName"]),_.givenName=R(c.givenName,"givenName",!1,A,[...T,"givenName"]),_.middleName=R(c.middleName,"middleName",!1,A,[...T,"middleName"]),_.honorificPrefix=R(c.honorificPrefix,"honorificPrefix",!1,A,[...T,"honorificPrefix"]),_.honorificSuffix=R(c.honorificSuffix,"honorificSuffix",!1,A,[...T,"honorificSuffix"]),_}function t(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"emails must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"email must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($)c.push({value:$,display:R(L.display,"display",!1,A,[...J,"display"]),type:R(L.type,"type",!1,A,[...J,"type"]),primary:z(L.primary,"primary",A,[...J,"primary"])})}return c.length>0?c:void 0}function r(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"phoneNumbers must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"phoneNumber must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($)c.push({value:$,display:R(L.display,"display",!1,A,[...J,"display"]),type:R(L.type,"type",!1,A,[...J,"type"]),primary:z(L.primary,"primary",A,[...J,"primary"])})}return c.length>0?c:void 0}function l(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"addresses must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"address must be an object",path:J});continue}let L=N;c.push({formatted:R(L.formatted,"formatted",!1,A,[...J,"formatted"]),streetAddress:R(L.streetAddress,"streetAddress",!1,A,[...J,"streetAddress"]),locality:R(L.locality,"locality",!1,A,[...J,"locality"]),region:R(L.region,"region",!1,A,[...J,"region"]),postalCode:R(L.postalCode,"postalCode",!1,A,[...J,"postalCode"]),country:R(L.country,"country",!1,A,[...J,"country"]),type:R(L.type,"type",!1,A,[...J,"type"]),primary:z(L.primary,"primary",A,[...J,"primary"])})}return c.length>0?c:void 0}function i(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"groups must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"group must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($)c.push({value:$,$ref:R(L.$ref,"$ref",!1,A,[...J,"$ref"]),display:R(L.display,"display",!1,A,[...J,"display"]),type:R(L.type,"type",!1,A,[...J,"type"])})}return c.length>0?c:void 0}function u(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"roles must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"role must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($)c.push({value:$,display:R(L.display,"display",!1,A,[...J,"display"]),type:R(L.type,"type",!1,A,[...J,"type"]),primary:z(L.primary,"primary",A,[...J,"primary"])})}return c.length>0?c:void 0}function a(x,A,T){if(x===void 0||x===null)return;if(typeof x!=="object"||x===null){A.push({message:"Enterprise User extension must be an object",path:T});return}let c=x,_={};if(_.employeeNumber=R(c.employeeNumber,"employeeNumber",!1,A,[...T,"employeeNumber"]),_.costCenter=R(c.costCenter,"costCenter",!1,A,[...T,"costCenter"]),_.organization=R(c.organization,"organization",!1,A,[...T,"organization"]),_.division=R(c.division,"division",!1,A,[...T,"division"]),_.department=R(c.department,"department",!1,A,[...T,"department"]),c.manager!==void 0&&c.manager!==null)if(typeof c.manager!=="object"||c.manager===null)A.push({message:"manager must be an object",path:[...T,"manager"]});else{let N=c.manager;_.manager={value:R(N.value,"value",!1,A,[...T,"manager","value"]),$ref:R(N.$ref,"$ref",!1,A,[...T,"manager","$ref"]),displayName:R(N.displayName,"displayName",!1,A,[...T,"manager","displayName"])}}return _}function e(x){return{"~standard":{version:1,vendor:x,validate:(A)=>{if(typeof A!=="object"||A===null)return{issues:[{message:"Expected an object"}]};let T=A,c=[],_={},N=R(T.userName,"userName",!0,c,["userName"]);if(!N)return{issues:c};_.userName=N,_.id=R(T.id,"id",!1,c,["id"]),_.externalId=R(T.externalId,"externalId",!1,c,["externalId"]),_.displayName=R(T.displayName,"displayName",!1,c,["displayName"]),_.nickName=R(T.nickName,"nickName",!1,c,["nickName"]),_.profileUrl=R(T.profileUrl,"profileUrl",!1,c,["profileUrl"]),_.title=R(T.title,"title",!1,c,["title"]),_.userType=R(T.userType,"userType",!1,c,["userType"]),_.preferredLanguage=R(T.preferredLanguage,"preferredLanguage",!1,c,["preferredLanguage"]),_.locale=R(T.locale,"locale",!1,c,["locale"]),_.timezone=R(T.timezone,"timezone",!1,c,["timezone"]),_.password=R(T.password,"password",!1,c,["password"]),_.active=z(T.active,"active",c,["active"]),_.name=d(T.name,c,["name"]),_.emails=t(T.emails,c,["emails"]),_.phoneNumbers=r(T.phoneNumbers,c,["phoneNumbers"]),_.addresses=l(T.addresses,c,["addresses"]),_.groups=i(T.groups,c,["groups"]),_.roles=u(T.roles,c,["roles"]);let J="urn:ietf:params:scim:schemas:extension:enterprise:2.0:User";if(T[J]!==void 0)_[J]=a(T[J],c,[J]);if(T.schemas!==void 0)if(Array.isArray(T.schemas))_.schemas=T.schemas.filter((L)=>typeof L==="string");else c.push({message:"schemas must be an array",path:["schemas"]});if(T.meta!==void 0)if(typeof T.meta==="object"&&T.meta!==null){let L=T.meta;_.meta={resourceType:typeof L.resourceType==="string"?L.resourceType:void 0,created:typeof L.created==="string"?L.created:void 0,lastModified:typeof L.lastModified==="string"?L.lastModified:void 0,location:typeof L.location==="string"?L.location:void 0,version:typeof L.version==="string"?L.version:void 0}}else c.push({message:"meta must be an object",path:["meta"]});if(c.length>0)return{issues:c};return{value:_}}}}}function s(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"members must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"member must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($){let C=R(L.type,"type",!1,A,[...J,"type"]);c.push({value:$,$ref:R(L.$ref,"$ref",!1,A,[...J,"$ref"]),display:R(L.display,"display",!1,A,[...J,"display"]),type:C==="User"||C==="Group"?C:void 0})}}return c.length>0?c:void 0}function xx(x){return{"~standard":{version:1,vendor:x,validate:(A)=>{if(typeof A!=="object"||A===null)return{issues:[{message:"Expected an object"}]};let T=A,c=[],_={},N=R(T.displayName,"displayName",!0,c,["displayName"]);if(!N)return{issues:c};if(_.displayName=N,_.id=R(T.id,"id",!1,c,["id"]),_.externalId=R(T.externalId,"externalId",!1,c,["externalId"]),_.members=s(T.members,c,["members"]),T.schemas!==void 0)if(Array.isArray(T.schemas))_.schemas=T.schemas.filter((J)=>typeof J==="string");else c.push({message:"schemas must be an array",path:["schemas"]});if(T.meta!==void 0)if(typeof T.meta==="object"&&T.meta!==null){let J=T.meta;_.meta={resourceType:typeof J.resourceType==="string"?J.resourceType:void 0,created:typeof J.created==="string"?J.created:void 0,lastModified:typeof J.lastModified==="string"?J.lastModified:void 0,location:typeof J.location==="string"?J.location:void 0,version:typeof J.version==="string"?J.version:void 0}}else c.push({message:"meta must be an object",path:["meta"]});if(c.length>0)return{issues:c};return{value:_}}}}}function Tx(x){return{"~standard":{version:1,vendor:x,validate:(A)=>{if(typeof A!=="object"||A===null)return{issues:[{message:"Expected an object"}]};let T=A,c=[],_={...T},N=["iss","sub"];for(let $ of N)if($ in T){if(typeof T[$]!=="string")c.push({message:`${$} must be a string`,path:[$]})}else c.push({message:`${$} is required`,path:[$]});if("aud"in T&&T.aud!==void 0){let $=T.aud;if(typeof $!=="string"&&!Array.isArray($))c.push({message:"aud must be a string or array of strings",path:["aud"]});else if(Array.isArray($)&&!$.every((C)=>typeof C==="string"))c.push({message:"aud array must contain only strings",path:["aud"]})}let J=["jti","scope"];for(let $ of J)if($ in T&&T[$]!==void 0){if(typeof T[$]!=="string")c.push({message:`${$} must be a string`,path:[$]})}let L=["exp","iat"];for(let $ of L)if($ in T){if(typeof T[$]!=="number")c.push({message:`${$} must be a number`,path:[$]})}else c.push({message:`${$} is required`,path:[$]});if(c.length>0)return{issues:c};return{value:_}}}}}function Ax(x){return{"~standard":{version:1,vendor:x,validate:(A)=>{if(typeof A!=="object"||A===null)return{issues:[{message:"Expected an object"}]};let T=A,c=[],_={};if("access_token"in T)if(typeof T.access_token==="string")_.access_token=T.access_token;else c.push({message:"access_token must be a string",path:["access_token"]});else c.push({message:"access_token is required",path:["access_token"]});if("token_type"in T)if(typeof T.token_type==="string")_.token_type=T.token_type;else c.push({message:"token_type must be a string",path:["token_type"]});else c.push({message:"token_type is required",path:["token_type"]});if("scope"in T)if(typeof T.scope==="string"||T.scope===void 0)_.scope=T.scope;else c.push({message:"scope must be a string",path:["scope"]});if("refresh_token"in T)if(typeof T.refresh_token==="string"||T.refresh_token===void 0)_.refresh_token=T.refresh_token;else c.push({message:"refresh_token must be a string",path:["refresh_token"]});if("expires"in T)if(typeof T.expires==="string"||T.expires===void 0)_.expires=T.expires;else c.push({message:"expires must be a string",path:["expires"]});if("expires_in"in T)if(typeof T.expires_in==="number"||T.expires_in===void 0)_.expires_in=T.expires_in;else c.push({message:"expires_in must be a number",path:["expires_in"]});if(c.length>0)return{issues:c};return{value:_}}}}}export{Ax as workloadTokenResponseSchema,Lx as withValidate,zx as waitOn,y as version,Rx as validationFailureResponse,e as userSchema,_x as tokenResponseSchema,fx as stripJsonComments,Xx as silentLogger,Gx as setActiveSession,S as serializeESConfig,p as sendTenantWebhook,Cx as parseJsonc,cx as oidcCallbackSchema,b as normalizeTenantRoutingStrategy,D as normalizeTenantPathNamespace,Nx as must,$x as mergeConfig,o as matchTenantPath,wx as listSsoClientIdsFromCookies,Q as list,Tx as jwtAssertionClaimsSchema,j as isConfigLocator,Jx as idTokenClaimsSchema,w as hydrateTenantForEs,xx as groupResourceSchema,Ex as getActiveSession,Bx as findTenantFromStateParam,Zx as defaultLogger,Dx as deepEqualPlain,Qx as decodeUser,Yx as clearActiveSession,Hx as claimsToUser,v as buildTenantPath,X as TenantRequestError,Z as MultipleTenantsForUserError,M as InMemoryTenantStore,m as DEFAULT_TENANT_UI_NAMESPACE,h as DEFAULT_TENANT_API_NAMESPACE};
|
|
1
|
+
import{G as Y,a as c0,b as _0,c as J0,d as L0,e as N0,f as R0,g as $0,h as f0,i as C0,j as D0,k as z0,l as H0,m as Q0,n as X0,o as Z0,r as E0,s as G0,t as Y0,u as w0,v as B0}from"./shared/core-nrs9cxe3.js";var y="0.0.19-beta.20260507.2";var k=["sessionStore","userStore","groupStore","tokenStore","magicLinkStore"];function G(x){if(x===null||typeof x!=="object")return x;let A={};for(let[T,c]of Object.entries(x)){if(k.includes(T)||T==="validators"||T==="setStores")continue;A[T]=c!==null&&typeof c==="object"&&!Array.isArray(c)&&Object.getPrototypeOf(c)===Object.prototype?G(c):c}return A}function S(x){return G(x)}function Q(x,A,T,c){let _=A.length,N=c??x,J=N>0?Math.floor(T/N)+1:1,L=N>0?Math.ceil(x/N):0;return{total:x,count:_,items:A,size:N,page:J,pages:L}}class X extends Error{constructor(x,A){super(x,A);this.name="TenantRequestError",Object.setPrototypeOf(this,X.prototype)}}class Z extends Error{userId;conflictingIds;constructor(x,A,T){super(`Multiple tenants found for user id "${x}"`,T);this.name="MultipleTenantsForUserError",this.userId=x,this.conflictingIds=A,Object.setPrototypeOf(this,Z.prototype)}}function j(x){if(typeof x!=="object"||x==null)return!1;let A=x.type;return A==="vault"||A==="aws"||A==="azure"||A==="gcp"}function w(x){if(typeof x.config==="function")return x;return Y({...x,configSource:x.configSource})}class B{tenants=new Map;userTenantIds=new Map;async get(x){return this.tenants.get(x)}async list(x){let A=Array.from(this.tenants.values()),T=Math.max(0,x?.start??0),c=x?.limit,_=x?.sort;if(_?.length)A=[...A].sort(($,C)=>{for(let{field:f,direction:K}of _){let q=$[f],U=C[f],H=O(q,U);if(H!==0)return K==="desc"?-H:H}return 0});let N=A.length,J=c!=null?T+c:void 0,L=A.slice(T,J);return Q(N,L,T,c)}async upsert(x){return this.tenants.set(x.id,x),x}async delete(x){let A=this.tenants.has(x);return this.tenants.delete(x),A?1:0}async registerUserTenantId(x,A){if(!x)return;let T=I(A),c=this.userTenantIds.get(x);if(c){c.add(T);return}this.userTenantIds.set(x,new Set([T]))}async findTenantsByUser(x){let A=g(x);return this.resolveTenantsByUserId(A)}async resolveTenantsByUserId(x){let A=this.userTenantIds.get(x);if(!A||A.size===0)return[];let T=A.has(null),c=Array.from(A).filter((J)=>J!=null);if(c.length===0)return[];let _=await Promise.all(c.map(async(J)=>({id:J,tenant:await this.get(J)}))),N=_.filter((J)=>J.tenant!=null).map((J)=>J.id);if(N.length===0){if(T)this.userTenantIds.set(x,new Set([null]));else this.userTenantIds.delete(x);return[]}if(N.length!==c.length){let J=T?[null,...N]:N;this.userTenantIds.set(x,new Set(J))}return _.map((J)=>J.tenant).filter((J)=>J!=null)}}class M{store;createEs;constructor(x={}){this.createEs=x.createEs,this.store=new B}async get(x){return this.store.get(x)}async list(x){return this.store.list(x)}async upsert(x){return this.store.upsert(x)}async delete(x){return this.store.delete(x)}async registerUserTenantId(x,A){return this.store.registerUserTenantId(x,A)}async findTenantsByUser(x){return this.store.findTenantsByUser(x)}async getEs(x){let A=await this.get(x);if(!A)return;if(!this.createEs)throw Error(`${this.constructor.name} requires options.createEs to use getEs()`);return this.createEs(w(A))}}function O(x,A){let T=x===void 0||x===null,c=A===void 0||A===null;if(T&&c)return 0;if(T)return 1;if(c)return-1;if(x instanceof Date&&A instanceof Date)return x.getTime()-A.getTime();let _=String(x),N=String(A);return _.localeCompare(N)}function g(x){let A=x.id?.trim();if(!A)throw Error("Tenant lookup requires user.id");return A}function I(x){if(typeof x!=="string")return null;return x.trim()||null}function P(x,A,T){return(async()=>{try{let c=await fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!c.ok)T.error("Failed to send webhook update",{"es.operation":"webhook.update","es.outcome":"failure",status:c.status,statusText:c.statusText})}catch(c){T.error("Failed to send webhook update",{"es.operation":"webhook.update","es.outcome":"failure"},c)}})()}async function p(x,A,T){return P(x,A,T)}var m={beforeTenantSegments:["ui"]},h={beforeTenantSegments:["api"]};function W(x){return{segments:E(x?.segments)}}function E(x){return(x??[]).map((A)=>A.trim()).filter(Boolean)}function n(x){let A=x.trim();if(!A)return"/";let T=A.replace(/\\/g,"/").replace(/\/+/g,"/");return T.startsWith("/")?T:`/${T}`}function F(x){return n(x).split("/").filter(Boolean)}function D(x){return{beforeTenantSegments:E(x?.beforeTenantSegments),afterTenantSegments:E(x?.afterTenantSegments)}}function b(x){if(!x||x.type===void 0||x.type==="path"){let T=x;return{type:"path",ui:D(T?.ui),api:D(T?.api)}}let A=x;return{...A,ui:W(A.ui),api:W(A.api)}}function o(x,A){let T=D(A),c=T.beforeTenantSegments??[],_=T.afterTenantSegments??[],N=F(x),J=c.length+1+_.length;if(N.length<J)return null;for(let f=0;f<c.length;f++)if(N[f]!==c[f])return null;let L=c.length,$=N[L];if(!$)return null;for(let f=0;f<_.length;f++)if(N[L+1+f]!==_[f])return null;let C=N.slice(L+1+_.length);return{id:decodeURIComponent($),restSegments:C,restPath:C.length>0?`/${C.join("/")}`:"/"}}function v(x,A="/",T){let c=D(T),_=c.beforeTenantSegments??[],N=c.afterTenantSegments??[],J=F(A),L=[..._,encodeURIComponent(x),...N,...J];return L.length>0?`/${L.join("/")}`:"/"}function R(x,A,T,c,_){if(x===void 0||x===null){if(T)c.push({message:`${A} is required`,path:_});return}if(typeof x!=="string"){c.push({message:`${A} must be a string`,path:_});return}return x}function z(x,A,T,c){if(x===void 0||x===null)return;if(typeof x!=="boolean"){T.push({message:`${A} must be a boolean`,path:c});return}return x}function d(x,A,T){if(x===void 0||x===null)return;if(typeof x!=="object"||x===null){A.push({message:"name must be an object",path:T});return}let c=x,_={};return _.formatted=R(c.formatted,"formatted",!1,A,[...T,"formatted"]),_.familyName=R(c.familyName,"familyName",!1,A,[...T,"familyName"]),_.givenName=R(c.givenName,"givenName",!1,A,[...T,"givenName"]),_.middleName=R(c.middleName,"middleName",!1,A,[...T,"middleName"]),_.honorificPrefix=R(c.honorificPrefix,"honorificPrefix",!1,A,[...T,"honorificPrefix"]),_.honorificSuffix=R(c.honorificSuffix,"honorificSuffix",!1,A,[...T,"honorificSuffix"]),_}function t(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"emails must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"email must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($)c.push({value:$,display:R(L.display,"display",!1,A,[...J,"display"]),type:R(L.type,"type",!1,A,[...J,"type"]),primary:z(L.primary,"primary",A,[...J,"primary"])})}return c.length>0?c:void 0}function r(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"phoneNumbers must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"phoneNumber must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($)c.push({value:$,display:R(L.display,"display",!1,A,[...J,"display"]),type:R(L.type,"type",!1,A,[...J,"type"]),primary:z(L.primary,"primary",A,[...J,"primary"])})}return c.length>0?c:void 0}function l(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"addresses must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"address must be an object",path:J});continue}let L=N;c.push({formatted:R(L.formatted,"formatted",!1,A,[...J,"formatted"]),streetAddress:R(L.streetAddress,"streetAddress",!1,A,[...J,"streetAddress"]),locality:R(L.locality,"locality",!1,A,[...J,"locality"]),region:R(L.region,"region",!1,A,[...J,"region"]),postalCode:R(L.postalCode,"postalCode",!1,A,[...J,"postalCode"]),country:R(L.country,"country",!1,A,[...J,"country"]),type:R(L.type,"type",!1,A,[...J,"type"]),primary:z(L.primary,"primary",A,[...J,"primary"])})}return c.length>0?c:void 0}function i(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"groups must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"group must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($)c.push({value:$,$ref:R(L.$ref,"$ref",!1,A,[...J,"$ref"]),display:R(L.display,"display",!1,A,[...J,"display"]),type:R(L.type,"type",!1,A,[...J,"type"])})}return c.length>0?c:void 0}function u(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"roles must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"role must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($)c.push({value:$,display:R(L.display,"display",!1,A,[...J,"display"]),type:R(L.type,"type",!1,A,[...J,"type"]),primary:z(L.primary,"primary",A,[...J,"primary"])})}return c.length>0?c:void 0}function a(x,A,T){if(x===void 0||x===null)return;if(typeof x!=="object"||x===null){A.push({message:"Enterprise User extension must be an object",path:T});return}let c=x,_={};if(_.employeeNumber=R(c.employeeNumber,"employeeNumber",!1,A,[...T,"employeeNumber"]),_.costCenter=R(c.costCenter,"costCenter",!1,A,[...T,"costCenter"]),_.organization=R(c.organization,"organization",!1,A,[...T,"organization"]),_.division=R(c.division,"division",!1,A,[...T,"division"]),_.department=R(c.department,"department",!1,A,[...T,"department"]),c.manager!==void 0&&c.manager!==null)if(typeof c.manager!=="object"||c.manager===null)A.push({message:"manager must be an object",path:[...T,"manager"]});else{let N=c.manager;_.manager={value:R(N.value,"value",!1,A,[...T,"manager","value"]),$ref:R(N.$ref,"$ref",!1,A,[...T,"manager","$ref"]),displayName:R(N.displayName,"displayName",!1,A,[...T,"manager","displayName"])}}return _}function e(x){return{"~standard":{version:1,vendor:x,validate:(A)=>{if(typeof A!=="object"||A===null)return{issues:[{message:"Expected an object"}]};let T=A,c=[],_={},N=R(T.userName,"userName",!0,c,["userName"]);if(!N)return{issues:c};_.userName=N,_.id=R(T.id,"id",!1,c,["id"]),_.externalId=R(T.externalId,"externalId",!1,c,["externalId"]),_.displayName=R(T.displayName,"displayName",!1,c,["displayName"]),_.nickName=R(T.nickName,"nickName",!1,c,["nickName"]),_.profileUrl=R(T.profileUrl,"profileUrl",!1,c,["profileUrl"]),_.title=R(T.title,"title",!1,c,["title"]),_.userType=R(T.userType,"userType",!1,c,["userType"]),_.preferredLanguage=R(T.preferredLanguage,"preferredLanguage",!1,c,["preferredLanguage"]),_.locale=R(T.locale,"locale",!1,c,["locale"]),_.timezone=R(T.timezone,"timezone",!1,c,["timezone"]),_.password=R(T.password,"password",!1,c,["password"]),_.active=z(T.active,"active",c,["active"]),_.name=d(T.name,c,["name"]),_.emails=t(T.emails,c,["emails"]),_.phoneNumbers=r(T.phoneNumbers,c,["phoneNumbers"]),_.addresses=l(T.addresses,c,["addresses"]),_.groups=i(T.groups,c,["groups"]),_.roles=u(T.roles,c,["roles"]);let J="urn:ietf:params:scim:schemas:extension:enterprise:2.0:User";if(T[J]!==void 0)_[J]=a(T[J],c,[J]);if(T.schemas!==void 0)if(Array.isArray(T.schemas))_.schemas=T.schemas.filter((L)=>typeof L==="string");else c.push({message:"schemas must be an array",path:["schemas"]});if(T.meta!==void 0)if(typeof T.meta==="object"&&T.meta!==null){let L=T.meta;_.meta={resourceType:typeof L.resourceType==="string"?L.resourceType:void 0,created:typeof L.created==="string"?L.created:void 0,lastModified:typeof L.lastModified==="string"?L.lastModified:void 0,location:typeof L.location==="string"?L.location:void 0,version:typeof L.version==="string"?L.version:void 0}}else c.push({message:"meta must be an object",path:["meta"]});if(c.length>0)return{issues:c};return{value:_}}}}}function s(x,A,T){if(x===void 0||x===null)return;if(!Array.isArray(x)){A.push({message:"members must be an array",path:T});return}let c=[];for(let _=0;_<x.length;_++){let N=x[_],J=[...T,_];if(typeof N!=="object"||N===null){A.push({message:"member must be an object",path:J});continue}let L=N,$=R(L.value,"value",!0,A,[...J,"value"]);if($){let C=R(L.type,"type",!1,A,[...J,"type"]);c.push({value:$,$ref:R(L.$ref,"$ref",!1,A,[...J,"$ref"]),display:R(L.display,"display",!1,A,[...J,"display"]),type:C==="User"||C==="Group"?C:void 0})}}return c.length>0?c:void 0}function x0(x){return{"~standard":{version:1,vendor:x,validate:(A)=>{if(typeof A!=="object"||A===null)return{issues:[{message:"Expected an object"}]};let T=A,c=[],_={},N=R(T.displayName,"displayName",!0,c,["displayName"]);if(!N)return{issues:c};if(_.displayName=N,_.id=R(T.id,"id",!1,c,["id"]),_.externalId=R(T.externalId,"externalId",!1,c,["externalId"]),_.members=s(T.members,c,["members"]),T.schemas!==void 0)if(Array.isArray(T.schemas))_.schemas=T.schemas.filter((J)=>typeof J==="string");else c.push({message:"schemas must be an array",path:["schemas"]});if(T.meta!==void 0)if(typeof T.meta==="object"&&T.meta!==null){let J=T.meta;_.meta={resourceType:typeof J.resourceType==="string"?J.resourceType:void 0,created:typeof J.created==="string"?J.created:void 0,lastModified:typeof J.lastModified==="string"?J.lastModified:void 0,location:typeof J.location==="string"?J.location:void 0,version:typeof J.version==="string"?J.version:void 0}}else c.push({message:"meta must be an object",path:["meta"]});if(c.length>0)return{issues:c};return{value:_}}}}}function T0(x){return{"~standard":{version:1,vendor:x,validate:(A)=>{if(typeof A!=="object"||A===null)return{issues:[{message:"Expected an object"}]};let T=A,c=[],_={...T},N=["iss","sub"];for(let $ of N)if($ in T){if(typeof T[$]!=="string")c.push({message:`${$} must be a string`,path:[$]})}else c.push({message:`${$} is required`,path:[$]});if("aud"in T&&T.aud!==void 0){let $=T.aud;if(typeof $!=="string"&&!Array.isArray($))c.push({message:"aud must be a string or array of strings",path:["aud"]});else if(Array.isArray($)&&!$.every((C)=>typeof C==="string"))c.push({message:"aud array must contain only strings",path:["aud"]})}let J=["jti","scope"];for(let $ of J)if($ in T&&T[$]!==void 0){if(typeof T[$]!=="string")c.push({message:`${$} must be a string`,path:[$]})}let L=["exp","iat"];for(let $ of L)if($ in T){if(typeof T[$]!=="number")c.push({message:`${$} must be a number`,path:[$]})}else c.push({message:`${$} is required`,path:[$]});if(c.length>0)return{issues:c};return{value:_}}}}}function A0(x){return{"~standard":{version:1,vendor:x,validate:(A)=>{if(typeof A!=="object"||A===null)return{issues:[{message:"Expected an object"}]};let T=A,c=[],_={};if("access_token"in T)if(typeof T.access_token==="string")_.access_token=T.access_token;else c.push({message:"access_token must be a string",path:["access_token"]});else c.push({message:"access_token is required",path:["access_token"]});if("token_type"in T)if(typeof T.token_type==="string")_.token_type=T.token_type;else c.push({message:"token_type must be a string",path:["token_type"]});else c.push({message:"token_type is required",path:["token_type"]});if("scope"in T)if(typeof T.scope==="string"||T.scope===void 0)_.scope=T.scope;else c.push({message:"scope must be a string",path:["scope"]});if("refresh_token"in T)if(typeof T.refresh_token==="string"||T.refresh_token===void 0)_.refresh_token=T.refresh_token;else c.push({message:"refresh_token must be a string",path:["refresh_token"]});if("expires"in T)if(typeof T.expires==="string"||T.expires===void 0)_.expires=T.expires;else c.push({message:"expires must be a string",path:["expires"]});if("expires_in"in T)if(typeof T.expires_in==="number"||T.expires_in===void 0)_.expires_in=T.expires_in;else c.push({message:"expires_in must be a number",path:["expires_in"]});if(c.length>0)return{issues:c};return{value:_}}}}}export{A0 as workloadTokenResponseSchema,L0 as withValidate,z0 as waitOn,y as version,R0 as validationFailureResponse,e as userSchema,_0 as tokenResponseSchema,f0 as stripJsonComments,X0 as silentLogger,G0 as setActiveSession,S as serializeESConfig,p as sendTenantWebhook,C0 as parseJsonc,c0 as oidcCallbackSchema,b as normalizeTenantRoutingStrategy,D as normalizeTenantPathNamespace,N0 as must,$0 as mergeConfig,o as matchTenantPath,w0 as listSsoClientIdsFromCookies,Q as list,T0 as jwtAssertionClaimsSchema,j as isConfigLocator,J0 as idTokenClaimsSchema,w as hydrateTenantForEs,x0 as groupResourceSchema,E0 as getActiveSession,B0 as findTenantFromStateParam,Z0 as defaultLogger,D0 as deepEqualPlain,Q0 as decodeUser,Y0 as clearActiveSession,H0 as claimsToUser,v as buildTenantPath,X as TenantRequestError,Z as MultipleTenantsForUserError,M as InMemoryTenantStore,m as DEFAULT_TENANT_UI_NAMESPACE,h as DEFAULT_TENANT_API_NAMESPACE};
|
package/dist/server.d.ts
CHANGED
|
@@ -1944,7 +1944,7 @@ type AzureSecretsConfig = {
|
|
|
1944
1944
|
apiVersion?: string;
|
|
1945
1945
|
/**
|
|
1946
1946
|
* Maps vault "path" to a Key Vault secret name.
|
|
1947
|
-
* Default: replaces `/` with
|
|
1947
|
+
* Default: replaces `/` with `-` and trims leading/trailing `/`.
|
|
1948
1948
|
*/
|
|
1949
1949
|
secretNameTransform?: (path: string) => string;
|
|
1950
1950
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enterprisestandard/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19-beta.20260507.2",
|
|
4
4
|
"description": "Enterprise Standard Core (Server-only)",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "enterprisestandard",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@enterprisestandard/zod": "
|
|
31
|
-
"@enterprisestandard/valibot": "
|
|
30
|
+
"@enterprisestandard/zod": "0.0.19-beta.20260507.2",
|
|
31
|
+
"@enterprisestandard/valibot": "0.0.19-beta.20260507.2"
|
|
32
32
|
}
|
|
33
33
|
}
|