@ionite/core 0.0.23 → 0.0.24-beta.20260907.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 +555 -314
- package/dist/index.js +1 -1
- package/dist/server.d.ts +539 -331
- package/dist/server.js +1 -1
- package/dist/shared/core-ys2a23v0.js +4 -0
- package/package.json +1 -1
- package/dist/shared/core-fm0d5w83.js +0 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
function g(H){if(H===void 0||H===null)return[];return Array.isArray(H)?H:[H]}function m(H){if(typeof H!=="string")return;return H.endsWith("/")?H.slice(0,-1):H}function QH(H,X){if(m(X.issuer)!==m(H.claims?.iss))return!1;let Z=g(X.audience);if(Z.length===0)return!1;let $=g(H.claims?.aud),Q=typeof H.claims?.azp==="string"?H.claims.azp:void 0;if(!(Z.some((G)=>$.includes(G))||(Q?Z.includes(Q):!1)))return!1;let W=H.clientId??H.workloadId??H.claims?.sub;return X.clientId===W}function PH(H,X){let Z=H?.trustedProvisioningClients;if(!Z?.length)return;let $=new Set;for(let Q of Z){if(!QH(X,Q))continue;for(let Y of Q.permissions??[])$.add(Y)}return $.size>0?$:void 0}function kH(H){let X=H?.trustedProvisioningClients;if(!X?.length)return[];let Z=[];for(let $ of X)for(let Q of $.permissions??[])Z.push({subject:$.clientId,subjectType:"workload",targetType:"permission",target:Q,status:"active",provenance:{source:"eci-trusted",actor:$.clientId}});return Z}function E(H,X,Z,$){let Q=X.length,Y=$??H,W=Y>0?Math.floor(Z/Y)+1:1,G=Y>0?Math.ceil(H/Y):0;return{total:H,count:Q,items:X,size:Y,page:W,pages:G}}async function*R(H,X,Z=1000){let $=0;while(!0){let Q=await H($,Z);if(Q.items.length===0)break;for(let Y of Q.items)yield(X?await X(Y):Y)??Y;if(Q.items.length<Z||$+Q.items.length>=Q.total)break;$+=Z}}function SH(H,X){if(!X)return!0;if(X.requestable!==void 0&&Boolean(H.requestable)!==X.requestable)return!1;if(X.userName!==void 0){if((H.userName??H.clientId)!==X.userName)return!1}if(X.externalId!==void 0&&H.externalId!==X.externalId)return!1;if(X.updatedAfter!==void 0){if(!(H.updatedAt instanceof Date))return!1;let Z=X.updatedAfter instanceof Date?X.updatedAfter:new Date(X.updatedAfter);if(Number.isNaN(Z.getTime())||H.updatedAt<=Z)return!1}return!0}var yH="urn:ionite:params:scim:schemas:extension:authz:2.0:Group",T=["user","workload","customer"];function v(H){let{assignableSubjectTypes:X,recommendedSubjectTypes:Z}=H,$=H.id?` for "${H.id}"`:"";if(!X||X.length===0)throw Error(`assignableSubjectTypes${$} is required and must be a non-empty subset of [${T.join(", ")}]`);let Q=X.filter((Y)=>!T.includes(Y));if(Q.length>0)throw Error(`assignableSubjectTypes${$} contains values outside the platform ceiling [${T.join(", ")}]: ${Q.join(", ")}`);if(Z){let Y=Z.filter((W)=>!X.includes(W));if(Y.length>0)throw Error(`recommendedSubjectTypes${$} must be a subset of assignableSubjectTypes; offending values: ${Y.join(", ")}`)}}function I(H,X="subjectType"){if(H!=="user"&&H!=="customer"&&H!=="workload")throw Error(`${X} is required and must be one of [user, customer, workload]; got ${H===void 0?"undefined":JSON.stringify(H)}`)}class c extends Error{policy;requestUrl;constructor(H,X,Z){super(H);this.name="AssignmentPolicyError",this.policy=X,this.requestUrl=Z,Object.setPrototypeOf(this,c.prototype)}}function YH(H){return typeof H.groups?.get==="function"}function mH(H){return YH(H)?H:GH(H)}class N extends Error{constructor(H){super(`defineCatalog: ${H}`);this.name="CodeCatalogError"}}function p(H){return typeof H==="string"?H:H.id}function WH(H){for(let X of Object.values(H))if(Array.isArray(X))Object.freeze(X);if(H.metadata)Object.freeze(H.metadata);Object.freeze(H)}function P(H,X){try{v(X)}catch(Z){throw new N(`${H} "${X.id}": ${Z instanceof Error?Z.message:String(Z)}`)}}function k(H){let X=new Map(H.map(($)=>[$.id,$])),Z=Object.freeze([...H]);return Object.freeze({get:($)=>X.get($),list:()=>Z})}function GH(H){let X=H.groups??[],Z=H.roles??[],$=H.permissions??[],Q=new Map,Y=(B,M)=>{for(let D of M){if(!D.id)throw new N(`a ${B} is missing its required "id".`);let J=Q.get(D.id);if(J)throw new N(`duplicate id "${D.id}" (declared as both ${J} and ${B}).`);Q.set(D.id,B)}};Y("group",X),Y("role",Z),Y("permission",$);let W=(B,M,D,J)=>{let F=p(J),q=Q.get(F);if(q===void 0)throw new N(`${B} "${M}" references ${D} "${F}", which is not declared in the catalog.`);if(q!==D)throw new N(`${B} "${M}" references "${F}" as a ${D}, but it is a ${q}.`)};for(let B of Z){P("role",B);for(let M of B.permissions??[])W("role",B.id,"permission",M)}for(let B of $)P("permission",B);for(let B of X){P("group",B);for(let M of B.groups??[])W("group",B.id,"group",M);for(let M of B.roles??[])W("group",B.id,"role",M);for(let M of B.permissions??[])W("group",B.id,"permission",M)}let G=new Map(X.map((B)=>[B.id,B])),U=new Map,_=(B,M)=>{let D=U.get(B);if(D==="done")return;if(D==="visiting")throw new N(`group composition cycle: ${[...M,B].join(" -> ")}.`);U.set(B,"visiting");for(let J of G.get(B)?.groups??[])_(p(J),[...M,B]);U.set(B,"done")};for(let B of X)_(B.id,[]);for(let B of[...X,...Z,...$])WH(B);return Object.freeze({groups:k(X),roles:k(Z),permissions:k($)})}function vH(H,X){let Z=H?.groups.get(X);if(Z)return{entity:Z,kind:"group"};let $=H?.roles.get(X);if($)return{entity:$,kind:"role"};let Q=H?.permissions.get(X);return Q?{entity:Q,kind:"permission"}:void 0}function cH(H,X){return X==="group"?H.groups:X==="role"?H.roles:H.permissions}function x(H,X,Z){let $={...X,...Z,id:X.id,requestable:X.requestable,source:Z.source??"code",assignableSubjectTypes:X.assignableSubjectTypes,recommendedSubjectTypes:X.recommendedSubjectTypes};if(H==="group"){let Y=X;return{...$,groups:Y.groups,roles:Y.roles,permissions:Y.permissions,resources:Y.resources}}if(H==="role")return{...$,permissions:X.permissions};let Q=X;return{...$,action:Q.action,permissionTypes:Q.permissionTypes,resourceTypes:Q.resourceTypes,applyToSubResources:Q.applyToSubResources}}async function pH(H,X,Z){let $=await Z.get(X.id);if($)return x(H,X,$);let Q={...X,source:"code"},Y=Z.insertIfAbsent(Q);await Y.ready();let W=await Z.get(X.id)??Y;return x(H,X,W)}async function dH(H,X,Z){let $=async(Q,Y)=>{let W=Z?[await Q.get(Z)].filter((G)=>G!==void 0):R((G,U)=>Q.list({start:G,limit:U}));for await(let G of W){if(G.source!=="code"||G.deprecated===!0||Y?.get(G.id))continue;await Q.set({...G,deprecated:!0}).ready()}};await $(X.groups,H?.groups),await $(X.roles,H?.roles),await $(X.permissions,H?.permissions)}function w(H,X,Z){let $=()=>{if(!Z)throw Error(`Cannot write ${H} definitions: no AccessCatalogStore is wired (the code-declared catalog is read-only).`);return Z};return{async get(Y){let W=X.get(Y);if(!Z)return W;let G=await Z.get(Y);return G&&W?x(H,W,G):G??W},set(Y){return $().set(Y)},insertIfAbsent(Y){return $().insertIfAbsent(Y)},async delete(Y){await $().delete(Y)},async list(Y){let W=Math.max(0,Y?.start??0),G=Y?.limit,U=Y?.filter?.requestable,_=[];if(Z)for await(let J of R((F,q)=>Z.list({start:F,limit:q})))_.push(J);let B=new Map(_.map((J)=>[J.id,J])),M=[...X.list().map((J)=>{let F=B.get(J.id);return F?x(H,J,F):J}),..._.filter((J)=>!X.get(J.id))].filter((J)=>U===void 0||Boolean(J.requestable)===U),D=G!=null?W+G:void 0;return E(M.length,M.slice(W,D),W,G)}}}function nH(H,X){if(!H)return X;return{groups:w("group",H.groups,X?.groups),roles:w("role",H.roles,X?.roles),permissions:w("permission",H.permissions,X?.permissions),afterChange:X?.afterChange?.bind(X)}}function z(H){if(typeof H==="string")return H.trim();if(H&&typeof H==="object"){let X=H;for(let Z of["id","value","name","displayName"]){let $=X[Z];if(typeof $==="string"&&$.trim())return $.trim()}}return""}function n(H){let X=z(H.subject),Z=z(H.target);if(!X)throw Error("Access change subject must resolve to a non-empty id.");if(!H.targetType)throw Error("Access change targetType is required.");if(!Z)throw Error("Access change target must resolve to a non-empty id.");let $=(H.resources??[]).map((Y)=>Y.trim()).filter(Boolean),Q=!H.applyToApplication&&$.length>0?[...$].sort().join(","):"app";return I(H.subjectType,"Access change subjectType"),`${H.subjectType}:${X}:${H.targetType}:${Z}:${Q}`}function LH(H){let X=(H.resources??[]).map((Z)=>Z.trim()).filter(Boolean);if(H.applyToApplication||X.length===0)return[void 0];return X}async function u(H,X,Z,$,Q){if($==="resource")return Z?.get(Q);let Y=X?$==="group"?X.groups.get(Q):$==="role"?X.roles.get(Q):X.permissions.get(Q):void 0;if(H){let G=await($==="group"?H.groups:$==="role"?H.roles:H.permissions).get(Q);if(G)return Y?x($,Y,G):G}return Y}class BH{catalog;resources;code;nodes=new Map;subResources=new Map;children=new Map;constructor(H,X,Z){this.catalog=H;this.resources=X;this.code=Z}getNode(H,X){let Z=`${H}:${X}`,$=this.nodes.get(Z);if(!$)$=u(this.catalog,this.code,this.resources,H,X),this.nodes.set(Z,$);return $}resourceChildren(H){let X=this.children.get(H);if(!X)X=l(H,this.view()),this.children.set(H,X);return X}resourceAndSubResourceIds(H){let X=this.subResources.get(H);if(!X)X=r(H,this.view()),this.subResources.set(H,X);return X}view(){return{catalog:this.catalog,code:this.code,resources:this.resources,cache:this}}invalidate(H){this.clear()}clear(){this.nodes.clear(),this.subResources.clear(),this.children.clear()}}async function O(H,X,Z){if(H.cache)return H.cache.getNode(X,Z);return u(H.catalog,H.code,H.resources,X,Z)}async function d(H,X){if(typeof H!=="string")return H;return O(X,"resource",H)}async function l(H,X){if(X.resources?.children)return X.resources.children(H);let Z=await d(H,X),$=[];for(let Q of Z?.resources??[]){let Y=await d(Q,X);if(Y)$.push(Y);else if(typeof Q==="string"&&Q.trim())$.push({id:Q.trim()})}return $}async function o(H,X){if(X.cache)return X.cache.resourceChildren(H);return l(H,X)}async function r(H,X){let Z=[],$=new Set,Q=async(Y)=>{if(!Y||$.has(Y))return;$.add(Y),Z.push(Y);for(let W of await o(Y,X))await Q(z(W))};return await Q(z(H)),Z}async function DH(H,X){let Z=H.id??n(H),$=z(H.subject);if(!$)throw Error("Access change subject must resolve to a non-empty id.");I(H.subjectType,"Access change subjectType");let Q=H.subjectType,Y=LH(H),W=[],G=new Set,U=new Set,_=(D,J,F)=>{if(!J)return;let q=`${D}:${J}:${F??""}`;if(G.has(q))return;G.add(q),W.push({subject:$,subjectType:Q,targetType:D,target:J,resource:F,rootId:Z})},B=async(D,J,F)=>{for(let q of Y)if(D==="permission"&&F?.applyToSubResources&&q){let A=X.cache?await X.cache.resourceAndSubResourceIds(q):await r(q,X);for(let V of A)_("permission",J,V)}else _(D,J,q)},M=async(D,J)=>{let F=z(J);if(!F)return;let q=`${D}:${F}`;if(U.has(q))return;if(U.add(q),D==="group"){let V=typeof J==="string"?await O(X,"group",F):J;await B("group",F,void 0);for(let K of V?.groups??[])await M("group",K);for(let K of V?.roles??[])await M("role",K);for(let K of V?.permissions??[])await M("permission",K);return}if(D==="role"){let V=typeof J==="string"?await O(X,"role",F):J;await B("role",F,void 0);for(let K of V?.permissions??[])await M("permission",K);return}let A=typeof J==="string"?await O(X,"permission",F):J;await B("permission",F,A)};return await M(H.targetType,H.target),W}async function iH(H,X,Z,$){let{accessStore:Q,accessIndex:Y,catalogStore:W,code:G,resources:U}=Z;if(!Y||!W&&!G)return 0;if(!Q)return await Y.replaceSubject(H,X,[]),0;let _={catalog:W,code:G,resources:U,cache:$},B=[],M=0;for await(let D of R((J,F)=>Q.listBySubject(H,X,{start:J,limit:F}))){let J=D.id??n(D),F=await DH({...D,id:J},_);B.push(...F),M+=1}return await Y.replaceSubject(H,X,B),M}async function tH(H,X,Z){let $=new Map,Q=new Map,Y=new Map,W=new Map,G=new Set,U=(M,D)=>O(Z,M,D),_=async(M)=>{let D=z(M);if(!D||W.has(D))return;let J=typeof M==="string"?await U("resource",D):M;if(!J)return;W.set(D,J);let F=J.resources??(J.id?await o(J.id,Z):[]);for(let q of F)await _(q)},B=async(M,D)=>{let J=z(D);if(!J)return;let F=`${M}:${J}`;if(G.has(F))return;if(G.add(F),M==="group"){let A=typeof D==="string"?await U("group",J):D;if(!A)return;$.set(J,A);for(let V of A.groups??[])await B("group",V);for(let V of A.roles??[])await B("role",V);for(let V of A.permissions??[])await B("permission",V);for(let V of A.resources??[])await _(V);return}if(M==="role"){let A=typeof D==="string"?await U("role",J):D;if(!A)return;Q.set(J,A);for(let V of A.permissions??[])await B("permission",V);return}let q=typeof D==="string"?await U("permission",J):D;if(!q)return;Y.set(J,q)};if(G.add(`${X}:${z(H)}`),X==="group"){let M=H;for(let D of M.groups??[])await B("group",D);for(let D of M.roles??[])await B("role",D);for(let D of M.permissions??[])await B("permission",D);for(let D of M.resources??[])await _(D)}else{let M=H;for(let D of M.permissions??[])await B("permission",D)}return{groups:[...$.values()],roles:[...Q.values()],permissions:[...Y.values()],resources:[...W.values()]}}var sH="ecid",i=/^ecid:([A-Za-z0-9._-]+):([A-Za-z0-9_-]+)$/,JH=/^[A-Za-z0-9._-]+$/,MH=/^[A-Za-z0-9_-]+$/;class j extends Error{constructor(H){super(H);this.name="EcidFormatError"}}function _H(H){return typeof H==="string"&&i.test(H)}function eH(H,X){if(!H||!JH.test(H))throw new j(`Invalid ECID realm ${JSON.stringify(H)}: must be non-empty and match [A-Za-z0-9._-].`);if(!X||!MH.test(X))throw new j(`Invalid ECID opaque ${JSON.stringify(X)}: must be non-empty and match [A-Za-z0-9_-].`);return`ecid:${H}:${X}`}function HX(H){let X=typeof H==="string"?H.match(i):null;if(!X)throw new j(`Invalid ECID ${JSON.stringify(H)}: expected "ecid:<realm>:<opaque>".`);return{realm:X[1],opaque:X[2]}}function XX(H){if(!_H(H))throw new j(`Invalid ECID ${JSON.stringify(H)}: expected "ecid:<realm>:<opaque>".`);return H}function $X(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={};if("code"in Z)if(typeof Z.code==="string")Q.code=Z.code;else $.push({message:"code must be a string",path:["code"]});else if(!("error"in Z))$.push({message:"code is required",path:["code"]});if("state"in Z)if(typeof Z.state==="string"||Z.state===void 0)Q.state=Z.state;else $.push({message:"state must be a string",path:["state"]});if("session_state"in Z)if(typeof Z.session_state==="string"||Z.session_state===void 0)Q.session_state=Z.session_state;else $.push({message:"session_state must be a string",path:["session_state"]});if("error"in Z){if(typeof Z.error==="string")Q.error=Z.error;else $.push({message:"error must be a string",path:["error"]});if("error_description"in Z)if(typeof Z.error_description==="string"||Z.error_description===void 0)Q.error_description=Z.error_description;else $.push({message:"error_description must be a string",path:["error_description"]});if("error_uri"in Z)if(typeof Z.error_uri==="string"||Z.error_uri===void 0)Q.error_uri=Z.error_uri;else $.push({message:"error_uri must be a string",path:["error_uri"]})}if("iss"in Z)if(typeof Z.iss==="string"||Z.iss===void 0)Q.iss=Z.iss;else $.push({message:"iss must be a string",path:["iss"]});if($.length>0)return{issues:$};return{value:Q}}}}}function QX(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={};if("access_token"in Z)if(typeof Z.access_token==="string")Q.access_token=Z.access_token;else $.push({message:"access_token must be a string",path:["access_token"]});else $.push({message:"access_token is required",path:["access_token"]});if("id_token"in Z)if(typeof Z.id_token==="string")Q.id_token=Z.id_token;else $.push({message:"id_token must be a string",path:["id_token"]});else $.push({message:"id_token is required",path:["id_token"]});if("token_type"in Z)if(typeof Z.token_type==="string")Q.token_type=Z.token_type;else $.push({message:"token_type must be a string",path:["token_type"]});else $.push({message:"token_type is required",path:["token_type"]});if("refresh_token"in Z)if(typeof Z.refresh_token==="string"||Z.refresh_token===void 0)Q.refresh_token=Z.refresh_token;else $.push({message:"refresh_token must be a string",path:["refresh_token"]});if("scope"in Z)if(typeof Z.scope==="string"||Z.scope===void 0)Q.scope=Z.scope;else $.push({message:"scope must be a string",path:["scope"]});if("session_state"in Z)if(typeof Z.session_state==="string"||Z.session_state===void 0)Q.session_state=Z.session_state;else $.push({message:"session_state must be a string",path:["session_state"]});if("expires"in Z)if(typeof Z.expires==="string"||Z.expires===void 0)Q.expires=Z.expires;else $.push({message:"expires must be a string",path:["expires"]});if("expires_in"in Z)if(typeof Z.expires_in==="number"||Z.expires_in===void 0)Q.expires_in=Z.expires_in;else $.push({message:"expires_in must be a number",path:["expires_in"]});if("refresh_expires_in"in Z)if(typeof Z.refresh_expires_in==="number"||Z.refresh_expires_in===void 0)Q.refresh_expires_in=Z.refresh_expires_in;else $.push({message:"refresh_expires_in must be a number",path:["refresh_expires_in"]});if($.length>0)return{issues:$};return{value:Q}}}}}function t(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={...Z},Y=["iss","sub"];for(let _ of Y)if(typeof Z[_]!=="string")$.push({message:`${_} is required and must be a string`,path:[_]});let W=Z.aud;if(!(typeof W==="string"||Array.isArray(W)&&W.length>0&&W.every((_)=>typeof _==="string")))$.push({message:"aud is required and must be a string or a non-empty array of strings",path:["aud"]});if(typeof Z.exp!=="number")$.push({message:"exp is required and must be a number",path:["exp"]});let U=["sid","name","email","preferred_username","picture"];for(let _ of U)if(_ in Z&&Z[_]!==void 0){if(typeof Z[_]!=="string")$.push({message:`${_} must be a string`,path:[_]})}if("iat"in Z&&Z.iat!==void 0&&typeof Z.iat!=="number")$.push({message:"iat must be a number",path:["iat"]});if($.length>0)return{issues:$};return{value:Q}}}}}function s(H){let X=H["~standard"];return Object.assign(H,{validate(Z){return Promise.resolve(X.validate(Z))}})}function WX(H,X="Assertion failed. Required value is null or undefined."){if(H===void 0||H===null)throw Error(X);return H}function GX(H,X){return Response.json({error:"validation_failed",message:X,issues:H},{status:400,headers:{"Content-Type":"application/json"}})}function LX(H,X,Z=[]){let $={...H,...X};for(let Q of Z)$[Q]=H?.[Q]??X?.[Q];return $}function UH(H){let X="",Z=0,$=H.length;while(Z<$){let Q=H[Z];if(Q==='"'||Q==="'"){let Y=Q;X+=Q,Z++;while(Z<$){let W=H[Z];if(W==="\\"){if(X+=W,Z+1<$)X+=H[Z+1],Z+=2;else Z++;continue}if(W===Y){X+=W,Z++;break}X+=W,Z++}continue}if(Q==="/"&&Z+1<$){let Y=H[Z+1];if(Y==="/"){Z+=2;while(Z<$&&H[Z]!==`
|
|
2
|
+
`)Z++;if(Z<$)X+=`
|
|
3
|
+
`;Z++;continue}if(Y==="*"){Z+=2;while(Z+1<$&&!(H[Z]==="*"&&H[Z+1]==="/"))Z++;Z+=2;continue}}X+=Q,Z++}return X}function FH(H){let X="",Z=!1,$=!1;for(let Q=0;Q<H.length;Q+=1){let Y=H[Q];if(Z){if(X+=Y,$)$=!1;else if(Y==="\\")$=!0;else if(Y==='"')Z=!1;continue}if(Y==='"'){Z=!0,X+=Y;continue}if(Y===","){let W=Q+1;while(W<H.length&&/\s/.test(H[W]??""))W+=1;let G=H[W];if(G==="}"||G==="]")continue}X+=Y}return X}function BX(H){let X=FH(UH(H));return JSON.parse(X)}function DX(H){return H==="/"?H:H.replace(/\/+$/,"")}function S(H){if(H===null||typeof H!=="object"||Array.isArray(H))return!1;let X=Object.getPrototypeOf(H);return X===Object.prototype||X===null}function f(H){return Object.keys(H).filter((X)=>H[X]!==void 0).sort()}function a(H,X){if(Object.is(H,X))return!0;if(H===null||X===null)return H===X;if(Array.isArray(H)||Array.isArray(X)){if(!Array.isArray(H)||!Array.isArray(X)||H.length!==X.length)return!1;for(let Q=0;Q<H.length;Q+=1)if(!a(H[Q],X[Q]))return!1;return!0}if(!S(H)||!S(X))return!1;let Z=f(H),$=f(X);if(Z.length!==$.length)return!1;for(let Q=0;Q<Z.length;Q+=1)if(Z[Q]!==$[Q])return!1;for(let Q of Z)if(!a(H[Q],X[Q]))return!1;return!0}function y(H,X){if(H===null||H===void 0){X.push("n");return}if(Array.isArray(H)){X.push("[");for(let Z of H)y(Z,X);X.push("]");return}if(S(H)){X.push("{");for(let Z of f(H))X.push(JSON.stringify(Z),":"),y(H[Z],X);X.push("}");return}X.push(JSON.stringify(H))}function JX(H){let X=[];y(H,X);let Z=X.join(""),$=2166136261;for(let Q=0;Q<Z.length;Q+=1)$^=Z.charCodeAt(Q),$=$*16777619%9007199254740992;return`${Z.length.toString(36)}:${$.toString(36)}`}async function MX(H,X=async(W)=>W.status===200,Z=1000,$=1e4,Q,Y){let W=Date.now(),G=`Awaiting Ping (${H})`;return new Promise((U,_)=>{let B=null,M=null,D=null,J=!1,F=()=>{if(B)clearTimeout(B);if(M)clearInterval(M);if(D)clearTimeout(D);B=null,M=null,D=null},q=(K)=>{if(J)return;J=!0,F(),K()},A=Math.max(Z,1e4),V=async()=>{try{let K=await fetch(H,{signal:AbortSignal.timeout(A)});if(K.ok){if(await X(K)){q(U);return}G=`Response test failed: ${K.status}: ${K.statusText} - ${H}`}else try{let h=await K.json();G=`Response error: ${K.status}: ${K.statusText} - ${H}: ${JSON.stringify(h)}`}catch(h){G=`Response error: ${K.status}: ${K.statusText} - ${H}`}}catch(K){G=`${K instanceof Error?K.message:String(K)} - ${H}`}if(!J)B=setTimeout(()=>void V(),Z)};if($>0)M=setInterval(()=>{Y?.warn(`${G}: ${Date.now()-W}ms`)},$);if(Q)D=setTimeout(()=>{q(()=>_(Error(`Timeout: ${Q}ms: ${G}`)))},Q);V()})}var qH="@ionite/core",KH=s(t(qH));function VH(H){let X=H.exp!=null?new Date(H.exp*1000):new Date,Z=H.iss??"";return{id:H.sub??"",userName:H.preferred_username??"",name:H.name??"",email:H.email??"",avatar:H.picture,sso:{profile:{...H,iss:H.iss??Z,aud:H.aud},tenant:{id:H.idp??Z,name:Z},tokenType:"Bearer",expires:X}}}function AH(H){let X=H.replace(/-/g,"+").replace(/_/g,"/");return atob(X)}async function qX(H){let X=H.split(".");if(X.length!==3)throw Error("Invalid JWT");let Z=AH(X[1]),$=JSON.parse(Z),Q=await KH.validate($);if(Q.issues)throw Error(`ID token claims validation failed: ${Q.issues.map((Y)=>Y.message).join("; ")}`);if(Q.value)return VH(Q.value);throw Error("ID token claims validation failed")}class b extends Error{code="conflict";kind;field;constructor(H,X,Z){super(H);this.name="StoreConflictError",this.kind=X,this.field=Z,Object.setPrototypeOf(this,b.prototype)}}function VX(H){return H instanceof b||typeof H==="object"&&H!=null&&H.code==="conflict"}class HH extends Error{status;statusText;constructor(H,X={}){super(H,{cause:X.cause});this.name="IoniteError",this.status=X.status,this.statusText=X.statusText,Object.setPrototypeOf(this,HH.prototype)}}function e(H){if(typeof H!=="object"||H==null)return!1;let X=H.type;if(X==="vault"||X==="aws"||X==="azure"||X==="gcp")return!0;if(X!=="mirror")return!1;let Z=H;return e(Z.from)&&Z.from.type!=="mirror"&&e(Z.to)&&Z.to.type==="vault"}class XH{tenants=new Map;async get(H){return this.tenants.get(H)}async list(H){let X=Array.from(this.tenants.values()),Z=Math.max(0,H?.start??0),$=H?.limit,Q=X.length,Y=$!=null?Z+$:void 0,W=X.slice(Z,Y);return E(Q,W,Z,$)}async upsert(H){return this.tenants.set(H.id,H),H}async delete(H){let X=this.tenants.has(H);return this.tenants.delete(H),X?1:0}}class zH{store;ionCache;constructor(H={}){this.ionCache=H.ionCache,this.store=new XH}async get(H){return this.store.get(H)}async list(H){return this.store.list(H)}async upsert(H){let X=await this.store.upsert(H);return this.ionCache?.delete(H.id),X}async delete(H){let X=await this.store.delete(H);return this.ionCache?.delete(H),X}async getIon(H){if(!this.ionCache)throw Error(`${this.constructor.name}.getIon() requires an app-owned ionCache. Pass { ionCache } (an lru-cache instance whose fetchMethod builds the tenant Ionite and whose dispose `+"closes it) — the SDK does not cache tenant runtimes. See the multi-tenant docs.");return this.ionCache.fetch(H)}}function NH(H,X,Z){return(async()=>{try{let $=await fetch(H,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)});if(!$.ok)Z.error("Failed to send webhook update",{"ion.operation":"webhook.update","ion.outcome":"failure",status:$.status,statusText:$.statusText})}catch($){Z.error("Failed to send webhook update",{"ion.operation":"webhook.update","ion.outcome":"failure"},$)}})()}async function NX(H,X,Z){return NH(H,X,Z)}var RX="urn:ionite:scim:schemas:extension:ion:2.0:User",OX="urn:ionite:scim:schemas:core:2.0:Workload",jX="urn:ionite:scim:schemas:core:2.0:Customer";function L(H,X,Z,$,Q){if(H===void 0||H===null){if(Z)$.push({message:`${X} is required`,path:Q});return}if(typeof H!=="string"){$.push({message:`${X} must be a string`,path:Q});return}return H}function C(H,X,Z,$){if(H===void 0||H===null)return;if(typeof H!=="boolean"){Z.push({message:`${X} must be a boolean`,path:$});return}return H}function xH(H,X,Z){if(H===void 0||H===null)return;if(typeof H!=="object"||H===null){X.push({message:"name must be an object",path:Z});return}let $=H,Q={};return Q.formatted=L($.formatted,"formatted",!1,X,[...Z,"formatted"]),Q.familyName=L($.familyName,"familyName",!1,X,[...Z,"familyName"]),Q.givenName=L($.givenName,"givenName",!1,X,[...Z,"givenName"]),Q.middleName=L($.middleName,"middleName",!1,X,[...Z,"middleName"]),Q.honorificPrefix=L($.honorificPrefix,"honorificPrefix",!1,X,[...Z,"honorificPrefix"]),Q.honorificSuffix=L($.honorificSuffix,"honorificSuffix",!1,X,[...Z,"honorificSuffix"]),Q}function RH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"emails must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],W=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"email must be an object",path:W});continue}let G=Y,U=L(G.value,"value",!0,X,[...W,"value"]);if(U)$.push({value:U,display:L(G.display,"display",!1,X,[...W,"display"]),type:L(G.type,"type",!1,X,[...W,"type"]),primary:C(G.primary,"primary",X,[...W,"primary"])})}return $.length>0?$:void 0}function OH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"phoneNumbers must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],W=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"phoneNumber must be an object",path:W});continue}let G=Y,U=L(G.value,"value",!0,X,[...W,"value"]);if(U)$.push({value:U,display:L(G.display,"display",!1,X,[...W,"display"]),type:L(G.type,"type",!1,X,[...W,"type"]),primary:C(G.primary,"primary",X,[...W,"primary"])})}return $.length>0?$:void 0}function jH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"addresses must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],W=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"address must be an object",path:W});continue}let G=Y;$.push({formatted:L(G.formatted,"formatted",!1,X,[...W,"formatted"]),streetAddress:L(G.streetAddress,"streetAddress",!1,X,[...W,"streetAddress"]),locality:L(G.locality,"locality",!1,X,[...W,"locality"]),region:L(G.region,"region",!1,X,[...W,"region"]),postalCode:L(G.postalCode,"postalCode",!1,X,[...W,"postalCode"]),country:L(G.country,"country",!1,X,[...W,"country"]),type:L(G.type,"type",!1,X,[...W,"type"]),primary:C(G.primary,"primary",X,[...W,"primary"])})}return $.length>0?$:void 0}function CH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"groups must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],W=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"group must be an object",path:W});continue}let G=Y,U=L(G.value,"value",!0,X,[...W,"value"]);if(U)$.push({value:U,$ref:L(G.$ref,"$ref",!1,X,[...W,"$ref"]),display:L(G.display,"display",!1,X,[...W,"display"]),type:L(G.type,"type",!1,X,[...W,"type"])})}return $.length>0?$:void 0}function EH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"roles must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],W=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"role must be an object",path:W});continue}let G=Y,U=L(G.value,"value",!0,X,[...W,"value"]);if(U)$.push({value:U,display:L(G.display,"display",!1,X,[...W,"display"]),type:L(G.type,"type",!1,X,[...W,"type"]),primary:C(G.primary,"primary",X,[...W,"primary"])})}return $.length>0?$:void 0}function TH(H,X,Z){if(H===void 0||H===null)return;if(typeof H!=="object"||H===null){X.push({message:"Enterprise User extension must be an object",path:Z});return}let $=H,Q={};if(Q.employeeNumber=L($.employeeNumber,"employeeNumber",!1,X,[...Z,"employeeNumber"]),Q.costCenter=L($.costCenter,"costCenter",!1,X,[...Z,"costCenter"]),Q.organization=L($.organization,"organization",!1,X,[...Z,"organization"]),Q.division=L($.division,"division",!1,X,[...Z,"division"]),Q.department=L($.department,"department",!1,X,[...Z,"department"]),$.manager!==void 0&&$.manager!==null)if(typeof $.manager!=="object"||$.manager===null)X.push({message:"manager must be an object",path:[...Z,"manager"]});else{let Y=$.manager;Q.manager={value:L(Y.value,"value",!1,X,[...Z,"manager","value"]),$ref:L(Y.$ref,"$ref",!1,X,[...Z,"manager","$ref"]),displayName:L(Y.displayName,"displayName",!1,X,[...Z,"manager","displayName"])}}return Q}function CX(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={},Y=L(Z.userName,"userName",!0,$,["userName"]);if(!Y)return{issues:$};if(Q.userName=Y,Q.id=L(Z.id,"id",!1,$,["id"]),Q.externalId=L(Z.externalId,"externalId",!1,$,["externalId"]),Q.displayName=L(Z.displayName,"displayName",!1,$,["displayName"]),Q.nickName=L(Z.nickName,"nickName",!1,$,["nickName"]),Q.profileUrl=L(Z.profileUrl,"profileUrl",!1,$,["profileUrl"]),Q.title=L(Z.title,"title",!1,$,["title"]),Q.userType=L(Z.userType,"userType",!1,$,["userType"]),Q.preferredLanguage=L(Z.preferredLanguage,"preferredLanguage",!1,$,["preferredLanguage"]),Q.locale=L(Z.locale,"locale",!1,$,["locale"]),Q.timezone=L(Z.timezone,"timezone",!1,$,["timezone"]),Z.password!==void 0)$.push({message:"password is not supported: the SDK does not accept credentials via SCIM",path:["password"]});Q.active=C(Z.active,"active",$,["active"]),Q.name=xH(Z.name,$,["name"]),Q.emails=RH(Z.emails,$,["emails"]),Q.phoneNumbers=OH(Z.phoneNumbers,$,["phoneNumbers"]),Q.addresses=jH(Z.addresses,$,["addresses"]),Q.groups=CH(Z.groups,$,["groups"]),Q.roles=EH(Z.roles,$,["roles"]);let W="urn:ietf:params:scim:schemas:extension:enterprise:2.0:User";if(Z[W]!==void 0)Q[W]=TH(Z[W],$,[W]);if(Z.schemas!==void 0)if(Array.isArray(Z.schemas))Q.schemas=Z.schemas.filter((G)=>typeof G==="string");else $.push({message:"schemas must be an array",path:["schemas"]});if(Z.meta!==void 0)if(typeof Z.meta==="object"&&Z.meta!==null){let G=Z.meta;Q.meta={resourceType:typeof G.resourceType==="string"?G.resourceType:void 0,created:typeof G.created==="string"?G.created:void 0,lastModified:typeof G.lastModified==="string"?G.lastModified:void 0,location:typeof G.location==="string"?G.location:void 0,version:typeof G.version==="string"?G.version:void 0}}else $.push({message:"meta must be an object",path:["meta"]});if($.length>0)return{issues:$};return{value:Q}}}}}function IH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"members must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],W=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"member must be an object",path:W});continue}let G=Y,U=L(G.value,"value",!0,X,[...W,"value"]);if(U){let _=L(G.type,"type",!1,X,[...W,"type"]);if(_!==void 0&&_!=="User"&&_!=="Group"&&_!=="Workload"&&_!=="Customer")X.push({message:"type must be 'User', 'Group', 'Workload', or 'Customer'",path:[...W,"type"]});$.push({value:U,$ref:L(G.$ref,"$ref",!1,X,[...W,"$ref"]),display:L(G.display,"display",!1,X,[...W,"display"]),type:_==="User"||_==="Group"||_==="Workload"||_==="Customer"?_:void 0})}}return $.length>0?$:void 0}function EX(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={},Y=L(Z.displayName,"displayName",!0,$,["displayName"]);if(!Y)return{issues:$};if(Q.displayName=Y,Q.id=L(Z.id,"id",!1,$,["id"]),Q.externalId=L(Z.externalId,"externalId",!1,$,["externalId"]),Q.members=IH(Z.members,$,["members"]),Z.schemas!==void 0)if(Array.isArray(Z.schemas))Q.schemas=Z.schemas.filter((W)=>typeof W==="string");else $.push({message:"schemas must be an array",path:["schemas"]});if(Z.meta!==void 0)if(typeof Z.meta==="object"&&Z.meta!==null){let W=Z.meta;Q.meta={resourceType:typeof W.resourceType==="string"?W.resourceType:void 0,created:typeof W.created==="string"?W.created:void 0,lastModified:typeof W.lastModified==="string"?W.lastModified:void 0,location:typeof W.location==="string"?W.location:void 0,version:typeof W.version==="string"?W.version:void 0}}else $.push({message:"meta must be an object",path:["meta"]});if($.length>0)return{issues:$};return{value:Q}}}}}function ZH(H,X){if(H===void 0)return;if(typeof H!=="object"||H===null){X.push({message:"meta must be an object",path:["meta"]});return}let Z=H;return{resourceType:typeof Z.resourceType==="string"?Z.resourceType:void 0,created:typeof Z.created==="string"?Z.created:void 0,lastModified:typeof Z.lastModified==="string"?Z.lastModified:void 0,location:typeof Z.location==="string"?Z.location:void 0,version:typeof Z.version==="string"?Z.version:void 0}}function $H(H,X){if(H===void 0)return;if(!Array.isArray(H)){X.push({message:"schemas must be an array",path:["schemas"]});return}return H.filter((Z)=>typeof Z==="string")}var TX={"~standard":{version:1,vendor:"ionite",validate:(H)=>{let X=[];if(typeof H!=="object"||H===null)return{issues:[{message:"Workload must be an object"}]};let Z=H,$={schemas:$H(Z.schemas,X),id:L(Z.id,"id",!1,X,["id"]),externalId:L(Z.externalId,"externalId",!1,X,["externalId"]),userName:L(Z.userName,"userName",!1,X,["userName"]),displayName:L(Z.displayName,"displayName",!1,X,["displayName"]),description:L(Z.description,"description",!1,X,["description"]),active:typeof Z.active==="boolean"?Z.active:void 0,providerId:L(Z.providerId,"providerId",!1,X,["providerId"]),requestUrl:L(Z.requestUrl,"requestUrl",!1,X,["requestUrl"]),meta:ZH(Z.meta,X)};if(X.length>0)return{issues:X};return{value:$}}}},IX={"~standard":{version:1,vendor:"ionite",validate:(H)=>{let X=[];if(typeof H!=="object"||H===null)return{issues:[{message:"Customer must be an object"}]};let Z=H,$=Z.emails,Q;if($!==void 0)if(!Array.isArray($))X.push({message:"emails must be an array",path:["emails"]});else Q=$.filter((W)=>typeof W==="object"&&W!==null&&typeof W.value==="string");let Y={schemas:$H(Z.schemas,X),id:L(Z.id,"id",!1,X,["id"]),externalId:L(Z.externalId,"externalId",!1,X,["externalId"]),userName:L(Z.userName,"userName",!1,X,["userName"]),displayName:L(Z.displayName,"displayName",!1,X,["displayName"]),active:typeof Z.active==="boolean"?Z.active:void 0,emails:Q,providerId:L(Z.providerId,"providerId",!1,X,["providerId"]),requestUrl:L(Z.requestUrl,"requestUrl",!1,X,["requestUrl"]),meta:ZH(Z.meta,X)};if(X.length>0)return{issues:X};return{value:Y}}}};
|
|
4
|
+
export{PH as a,kH as b,E as c,R as d,SH as e,yH as f,T as g,v as h,I as i,c as j,YH as k,mH as l,GH as m,vH as n,cH as o,x as p,pH as q,dH as r,nH as s,z as t,n as u,BH as v,DH as w,iH as x,tH as y,sH as z,j as A,_H as B,eH as C,HX as D,XX as E,$X as F,QX as G,t as H,s as I,WX as J,GX as K,LX as L,UH as M,BX as N,DX as O,a as P,JX as Q,MX as R,VH as S,qX as T,b as U,VX as V,HH as W,e as X,zH as Y,NX as Z,RX as _,OX as $,jX as aa,CX as ba,EX as ca,TX as da,IX as ea};
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
function h(H){if(H===void 0||H===null)return[];return Array.isArray(H)?H:[H]}function g(H){if(typeof H!=="string")return;return H.endsWith("/")?H.slice(0,-1):H}function HH(H,X){if(g(X.issuer)!==g(H.claims?.iss))return!1;let Z=h(X.audience);if(Z.length===0)return!1;let $=h(H.claims?.aud),Q=typeof H.claims?.azp==="string"?H.claims.azp:void 0;if(!(Z.some((W)=>$.includes(W))||(Q?Z.includes(Q):!1)))return!1;let G=H.clientId??H.workloadId??H.claims?.sub;return X.clientId===G}function EH(H,X){let Z=H?.trustedProvisioningClients;if(!Z?.length)return;let $=new Set;for(let Q of Z){if(!HH(X,Q))continue;for(let Y of Q.permissions??[])$.add(Y)}return $.size>0?$:void 0}function jH(H){let X=H?.trustedProvisioningClients;if(!X?.length)return[];let Z=[];for(let $ of X)for(let Q of $.permissions??[])Z.push({subject:$.clientId,subjectType:"workload",targetType:"permission",target:Q,status:"active",provenance:{source:"eci-trusted",actor:$.clientId}});return Z}function j(H,X,Z,$){let Q=X.length,Y=$??H,G=Y>0?Math.floor(Z/Y)+1:1,W=Y>0?Math.ceil(H/Y):0;return{total:H,count:Q,items:X,size:Y,page:G,pages:W}}async function*R(H,X,Z=1000){let $=0;while(!0){let Q=await H($,Z);if(Q.items.length===0)break;for(let Y of Q.items)yield(X?await X(Y):Y)??Y;if(Q.items.length<Z||$+Q.items.length>=Q.total)break;$+=Z}}function XH(H){return typeof H.groups?.get==="function"}function kH(H){return XH(H)?H:$H(H)}class N extends Error{constructor(H){super(`defineCatalog: ${H}`);this.name="CodeCatalogError"}}function v(H){return typeof H==="string"?H:H.id}function ZH(H){for(let X of Object.values(H))if(Array.isArray(X))Object.freeze(X);if(H.metadata)Object.freeze(H.metadata);Object.freeze(H)}function T(H,X){let{assignableSubjectTypes:Z,recommendedSubjectTypes:$}=X;if(!$?.length)return;if(!Z)return;for(let Q of $)if(!Z.includes(Q))throw new N(`${H} "${X.id}": recommendedSubjectTypes "${Q}" is not in assignableSubjectTypes.`)}function I(H){let X=new Map(H.map(($)=>[$.id,$])),Z=Object.freeze([...H]);return Object.freeze({get:($)=>X.get($),list:()=>Z})}function $H(H){let X=H.groups??[],Z=H.roles??[],$=H.permissions??[],Q=new Map,Y=(L,J)=>{for(let M of J){if(!M.id)throw new N(`a ${L} is missing its required "id".`);let _=Q.get(M.id);if(_)throw new N(`duplicate id "${M.id}" (declared as both ${_} and ${L}).`);Q.set(M.id,L)}};Y("group",X),Y("role",Z),Y("permission",$);let G=(L,J,M,_)=>{let q=v(_),F=Q.get(q);if(F===void 0)throw new N(`${L} "${J}" references ${M} "${q}", which is not declared in the catalog.`);if(F!==M)throw new N(`${L} "${J}" references "${q}" as a ${M}, but it is a ${F}.`)};for(let L of Z){T("role",L);for(let J of L.permissions??[])G("role",L.id,"permission",J)}for(let L of $)T("permission",L);for(let L of X){T("group",L);for(let J of L.groups??[])G("group",L.id,"group",J);for(let J of L.roles??[])G("group",L.id,"role",J);for(let J of L.permissions??[])G("group",L.id,"permission",J)}let W=new Map(X.map((L)=>[L.id,L])),D=new Map,U=(L,J)=>{let M=D.get(L);if(M==="done")return;if(M==="visiting")throw new N(`group composition cycle: ${[...J,L].join(" -> ")}.`);D.set(L,"visiting");for(let _ of W.get(L)?.groups??[])U(v(_),[...J,L]);D.set(L,"done")};for(let L of X)U(L.id,[]);for(let L of[...X,...Z,...$])ZH(L);return Object.freeze({groups:I(X),roles:I(Z),permissions:I($)})}function wH(H,X){let Z=H?.groups.get(X);if(Z)return{entity:Z,kind:"group"};let $=H?.roles.get(X);if($)return{entity:$,kind:"role"};let Q=H?.permissions.get(X);return Q?{entity:Q,kind:"permission"}:void 0}function SH(H,X){return X==="group"?H.groups:X==="role"?H.roles:H.permissions}function x(H,X,Z){let $={...X,...Z,id:X.id,requestable:X.requestable,source:Z.source??"code",assignableSubjectTypes:X.assignableSubjectTypes,recommendedSubjectTypes:X.recommendedSubjectTypes};if(H==="group"){let Y=X;return{...$,groups:Y.groups,roles:Y.roles,permissions:Y.permissions,resources:Y.resources}}if(H==="role")return{...$,permissions:X.permissions};let Q=X;return{...$,action:Q.action,permissionTypes:Q.permissionTypes,resourceTypes:Q.resourceTypes,applyToSubResources:Q.applyToSubResources}}async function fH(H,X,Z){let $=await Z.get(X.id);if($)return x(H,X,$);let Q={...X,source:"code"},Y=Z.insertIfAbsent(Q);await Y.ready();let G=await Z.get(X.id)??Y;return x(H,X,G)}async function yH(H,X,Z){let $=async(Q,Y)=>{let G=Z?[await Q.get(Z)].filter((W)=>W!==void 0):R((W,D)=>Q.list({start:W,limit:D}));for await(let W of G){if(W.source!=="code"||W.deprecated===!0||Y?.get(W.id))continue;await Q.set({...W,deprecated:!0}).ready()}};await $(X.groups,H?.groups),await $(X.roles,H?.roles),await $(X.permissions,H?.permissions)}function P(H,X,Z){let $=()=>{if(!Z)throw Error(`Cannot write ${H} definitions: no AccessCatalogStore is wired (the code-declared catalog is read-only).`);return Z};return{async get(Y){let G=X.get(Y);if(!Z)return G;let W=await Z.get(Y);return W&&G?x(H,G,W):W??G},set(Y){return $().set(Y)},insertIfAbsent(Y){return $().insertIfAbsent(Y)},async delete(Y){await $().delete(Y)},async list(Y){let G=Math.max(0,Y?.start??0),W=Y?.limit,D=Y?.filter?.requestable,U=[];if(Z)for await(let _ of R((q,F)=>Z.list({start:q,limit:F})))U.push(_);let L=new Map(U.map((_)=>[_.id,_])),J=[...X.list().map((_)=>{let q=L.get(_.id);return q?x(H,_,q):_}),...U.filter((_)=>!X.get(_.id))].filter((_)=>D===void 0||Boolean(_.requestable)===D),M=W!=null?G+W:void 0;return j(J.length,J.slice(G,M),G,W)}}}function bH(H,X){if(!H)return X;return{groups:P("group",H.groups,X?.groups),roles:P("role",H.roles,X?.roles),permissions:P("permission",H.permissions,X?.permissions),afterChange:X?.afterChange?.bind(X)}}var gH="urn:ionite:params:scim:schemas:extension:authz:2.0:Group",m=["user","workload"];function vH(H){let{assignableSubjectTypes:X,recommendedSubjectTypes:Z}=H,$=H.id?` for "${H.id}"`:"";if(X){let Q=X.filter((Y)=>!m.includes(Y));if(Q.length>0)throw Error(`assignableSubjectTypes${$} contains values outside the platform ceiling [${m.join(", ")}]: ${Q.join(", ")}`)}if(Z&&X){let Q=Z.filter((Y)=>!X.includes(Y));if(Q.length>0)throw Error(`recommendedSubjectTypes${$} must be a subset of assignableSubjectTypes; offending values: ${Q.join(", ")}`)}}function k(H,X="subjectType"){if(H!=="user"&&H!=="customer"&&H!=="workload")throw Error(`${X} is required and must be one of [user, customer, workload]; got ${H===void 0?"undefined":JSON.stringify(H)}`)}function z(H){if(typeof H==="string")return H.trim();if(H&&typeof H==="object"){let X=H;for(let Z of["id","value","name","displayName"]){let $=X[Z];if(typeof $==="string"&&$.trim())return $.trim()}}return""}function p(H){let X=z(H.subject),Z=z(H.target);if(!X)throw Error("Access change subject must resolve to a non-empty id.");if(!H.targetType)throw Error("Access change targetType is required.");if(!Z)throw Error("Access change target must resolve to a non-empty id.");let $=(H.resources??[]).map((Y)=>Y.trim()).filter(Boolean),Q=!H.applyToApplication&&$.length>0?[...$].sort().join(","):"app";return k(H.subjectType,"Access change subjectType"),`${H.subjectType}:${X}:${H.targetType}:${Z}:${Q}`}function QH(H){let X=(H.resources??[]).map((Z)=>Z.trim()).filter(Boolean);if(H.applyToApplication||X.length===0)return[void 0];return X}async function d(H,X,Z,$,Q){if($==="resource")return Z?.get(Q);let Y=X?$==="group"?X.groups.get(Q):$==="role"?X.roles.get(Q):X.permissions.get(Q):void 0;if(H){let W=await($==="group"?H.groups:$==="role"?H.roles:H.permissions).get(Q);if(W)return Y?x($,Y,W):W}return Y}class YH{catalog;resources;code;nodes=new Map;subResources=new Map;children=new Map;constructor(H,X,Z){this.catalog=H;this.resources=X;this.code=Z}getNode(H,X){let Z=`${H}:${X}`,$=this.nodes.get(Z);if(!$)$=d(this.catalog,this.code,this.resources,H,X),this.nodes.set(Z,$);return $}resourceChildren(H){let X=this.children.get(H);if(!X)X=n(H,this.view()),this.children.set(H,X);return X}resourceAndSubResourceIds(H){let X=this.subResources.get(H);if(!X)X=u(H,this.view()),this.subResources.set(H,X);return X}view(){return{catalog:this.catalog,code:this.code,resources:this.resources,cache:this}}invalidate(H){this.clear()}clear(){this.nodes.clear(),this.subResources.clear(),this.children.clear()}}async function O(H,X,Z){if(H.cache)return H.cache.getNode(X,Z);return d(H.catalog,H.code,H.resources,X,Z)}async function c(H,X){if(typeof H!=="string")return H;return O(X,"resource",H)}async function n(H,X){if(X.resources?.children)return X.resources.children(H);let Z=await c(H,X),$=[];for(let Q of Z?.resources??[]){let Y=await c(Q,X);if(Y)$.push(Y);else if(typeof Q==="string"&&Q.trim())$.push({id:Q.trim()})}return $}async function l(H,X){if(X.cache)return X.cache.resourceChildren(H);return n(H,X)}async function u(H,X){let Z=[],$=new Set,Q=async(Y)=>{if(!Y||$.has(Y))return;$.add(Y),Z.push(Y);for(let G of await l(Y,X))await Q(z(G))};return await Q(z(H)),Z}async function GH(H,X){let Z=H.id??p(H),$=z(H.subject);if(!$)throw Error("Access change subject must resolve to a non-empty id.");k(H.subjectType,"Access change subjectType");let Q=H.subjectType,Y=QH(H),G=[],W=new Set,D=new Set,U=(M,_,q)=>{if(!_)return;let F=`${M}:${_}:${q??""}`;if(W.has(F))return;W.add(F),G.push({subject:$,subjectType:Q,targetType:M,target:_,resource:q,rootId:Z})},L=async(M,_,q)=>{for(let F of Y)if(M==="permission"&&q?.applyToSubResources&&F){let A=X.cache?await X.cache.resourceAndSubResourceIds(F):await u(F,X);for(let V of A)U("permission",_,V)}else U(M,_,F)},J=async(M,_)=>{let q=z(_);if(!q)return;let F=`${M}:${q}`;if(D.has(F))return;if(D.add(F),M==="group"){let V=typeof _==="string"?await O(X,"group",q):_;await L("group",q,void 0);for(let K of V?.groups??[])await J("group",K);for(let K of V?.roles??[])await J("role",K);for(let K of V?.permissions??[])await J("permission",K);return}if(M==="role"){let V=typeof _==="string"?await O(X,"role",q):_;await L("role",q,void 0);for(let K of V?.permissions??[])await J("permission",K);return}let A=typeof _==="string"?await O(X,"permission",q):_;await L("permission",q,A)};return await J(H.targetType,H.target),G}async function nH(H,X,Z,$){let{accessStore:Q,accessIndex:Y,catalogStore:G,code:W,resources:D}=Z;if(!Y||!G&&!W)return 0;if(!Q)return await Y.replaceSubject(H,X,[]),0;let U={catalog:G,code:W,resources:D,cache:$},L=[],J=0;for await(let M of R((_,q)=>Q.listBySubject(H,X,{start:_,limit:q}))){let _=M.id??p(M),q=await GH({...M,id:_},U);L.push(...q),J+=1}return await Y.replaceSubject(H,X,L),J}async function lH(H,X,Z){let $=new Map,Q=new Map,Y=new Map,G=new Map,W=new Set,D=(J,M)=>O(Z,J,M),U=async(J)=>{let M=z(J);if(!M||G.has(M))return;let _=typeof J==="string"?await D("resource",M):J;if(!_)return;G.set(M,_);let q=_.resources??(_.id?await l(_.id,Z):[]);for(let F of q)await U(F)},L=async(J,M)=>{let _=z(M);if(!_)return;let q=`${J}:${_}`;if(W.has(q))return;if(W.add(q),J==="group"){let A=typeof M==="string"?await D("group",_):M;if(!A)return;$.set(_,A);for(let V of A.groups??[])await L("group",V);for(let V of A.roles??[])await L("role",V);for(let V of A.permissions??[])await L("permission",V);for(let V of A.resources??[])await U(V);return}if(J==="role"){let A=typeof M==="string"?await D("role",_):M;if(!A)return;Q.set(_,A);for(let V of A.permissions??[])await L("permission",V);return}let F=typeof M==="string"?await D("permission",_):M;if(!F)return;Y.set(_,F)};if(W.add(`${X}:${z(H)}`),X==="group"){let J=H;for(let M of J.groups??[])await L("group",M);for(let M of J.roles??[])await L("role",M);for(let M of J.permissions??[])await L("permission",M);for(let M of J.resources??[])await U(M)}else{let J=H;for(let M of J.permissions??[])await L("permission",M)}return{groups:[...$.values()],roles:[...Q.values()],permissions:[...Y.values()],resources:[...G.values()]}}var oH="ecid",o=/^ecid:([A-Za-z0-9._-]+):([A-Za-z0-9_-]+)$/,WH=/^[A-Za-z0-9._-]+$/,LH=/^[A-Za-z0-9_-]+$/;class C extends Error{constructor(H){super(H);this.name="EcidFormatError"}}function MH(H){return typeof H==="string"&&o.test(H)}function rH(H,X){if(!H||!WH.test(H))throw new C(`Invalid ECID realm ${JSON.stringify(H)}: must be non-empty and match [A-Za-z0-9._-].`);if(!X||!LH.test(X))throw new C(`Invalid ECID opaque ${JSON.stringify(X)}: must be non-empty and match [A-Za-z0-9_-].`);return`ecid:${H}:${X}`}function iH(H){let X=typeof H==="string"?H.match(o):null;if(!X)throw new C(`Invalid ECID ${JSON.stringify(H)}: expected "ecid:<realm>:<opaque>".`);return{realm:X[1],opaque:X[2]}}function tH(H){if(!MH(H))throw new C(`Invalid ECID ${JSON.stringify(H)}: expected "ecid:<realm>:<opaque>".`);return H}function sH(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={};if("code"in Z)if(typeof Z.code==="string")Q.code=Z.code;else $.push({message:"code must be a string",path:["code"]});else if(!("error"in Z))$.push({message:"code is required",path:["code"]});if("state"in Z)if(typeof Z.state==="string"||Z.state===void 0)Q.state=Z.state;else $.push({message:"state must be a string",path:["state"]});if("session_state"in Z)if(typeof Z.session_state==="string"||Z.session_state===void 0)Q.session_state=Z.session_state;else $.push({message:"session_state must be a string",path:["session_state"]});if("error"in Z){if(typeof Z.error==="string")Q.error=Z.error;else $.push({message:"error must be a string",path:["error"]});if("error_description"in Z)if(typeof Z.error_description==="string"||Z.error_description===void 0)Q.error_description=Z.error_description;else $.push({message:"error_description must be a string",path:["error_description"]});if("error_uri"in Z)if(typeof Z.error_uri==="string"||Z.error_uri===void 0)Q.error_uri=Z.error_uri;else $.push({message:"error_uri must be a string",path:["error_uri"]})}if("iss"in Z)if(typeof Z.iss==="string"||Z.iss===void 0)Q.iss=Z.iss;else $.push({message:"iss must be a string",path:["iss"]});if($.length>0)return{issues:$};return{value:Q}}}}}function eH(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={};if("access_token"in Z)if(typeof Z.access_token==="string")Q.access_token=Z.access_token;else $.push({message:"access_token must be a string",path:["access_token"]});else $.push({message:"access_token is required",path:["access_token"]});if("id_token"in Z)if(typeof Z.id_token==="string")Q.id_token=Z.id_token;else $.push({message:"id_token must be a string",path:["id_token"]});else $.push({message:"id_token is required",path:["id_token"]});if("token_type"in Z)if(typeof Z.token_type==="string")Q.token_type=Z.token_type;else $.push({message:"token_type must be a string",path:["token_type"]});else $.push({message:"token_type is required",path:["token_type"]});if("refresh_token"in Z)if(typeof Z.refresh_token==="string"||Z.refresh_token===void 0)Q.refresh_token=Z.refresh_token;else $.push({message:"refresh_token must be a string",path:["refresh_token"]});if("scope"in Z)if(typeof Z.scope==="string"||Z.scope===void 0)Q.scope=Z.scope;else $.push({message:"scope must be a string",path:["scope"]});if("session_state"in Z)if(typeof Z.session_state==="string"||Z.session_state===void 0)Q.session_state=Z.session_state;else $.push({message:"session_state must be a string",path:["session_state"]});if("expires"in Z)if(typeof Z.expires==="string"||Z.expires===void 0)Q.expires=Z.expires;else $.push({message:"expires must be a string",path:["expires"]});if("expires_in"in Z)if(typeof Z.expires_in==="number"||Z.expires_in===void 0)Q.expires_in=Z.expires_in;else $.push({message:"expires_in must be a number",path:["expires_in"]});if("refresh_expires_in"in Z)if(typeof Z.refresh_expires_in==="number"||Z.refresh_expires_in===void 0)Q.refresh_expires_in=Z.refresh_expires_in;else $.push({message:"refresh_expires_in must be a number",path:["refresh_expires_in"]});if($.length>0)return{issues:$};return{value:Q}}}}}function r(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={...Z},Y=["iss","sub"];for(let U of Y)if(typeof Z[U]!=="string")$.push({message:`${U} is required and must be a string`,path:[U]});let G=Z.aud;if(!(typeof G==="string"||Array.isArray(G)&&G.length>0&&G.every((U)=>typeof U==="string")))$.push({message:"aud is required and must be a string or a non-empty array of strings",path:["aud"]});if(typeof Z.exp!=="number")$.push({message:"exp is required and must be a number",path:["exp"]});let D=["sid","name","email","preferred_username","picture"];for(let U of D)if(U in Z&&Z[U]!==void 0){if(typeof Z[U]!=="string")$.push({message:`${U} must be a string`,path:[U]})}if("iat"in Z&&Z.iat!==void 0&&typeof Z.iat!=="number")$.push({message:"iat must be a number",path:["iat"]});if($.length>0)return{issues:$};return{value:Q}}}}}function t(H){let X=H["~standard"];return Object.assign(H,{validate(Z){return Promise.resolve(X.validate(Z))}})}function XX(H,X="Assertion failed. Required value is null or undefined."){if(H===void 0||H===null)throw Error(X);return H}function ZX(H,X){return Response.json({error:"validation_failed",message:X,issues:H},{status:400,headers:{"Content-Type":"application/json"}})}function $X(H,X,Z=[]){let $={...H,...X};for(let Q of Z)$[Q]=H?.[Q]??X?.[Q];return $}function _H(H){let X="",Z=0,$=H.length;while(Z<$){let Q=H[Z];if(Q==='"'||Q==="'"){let Y=Q;X+=Q,Z++;while(Z<$){let G=H[Z];if(G==="\\"){if(X+=G,Z+1<$)X+=H[Z+1],Z+=2;else Z++;continue}if(G===Y){X+=G,Z++;break}X+=G,Z++}continue}if(Q==="/"&&Z+1<$){let Y=H[Z+1];if(Y==="/"){Z+=2;while(Z<$&&H[Z]!==`
|
|
2
|
-
`)Z++;if(Z<$)X+=`
|
|
3
|
-
`;Z++;continue}if(Y==="*"){Z+=2;while(Z+1<$&&!(H[Z]==="*"&&H[Z+1]==="/"))Z++;Z+=2;continue}}X+=Q,Z++}return X}function BH(H){let X="",Z=!1,$=!1;for(let Q=0;Q<H.length;Q+=1){let Y=H[Q];if(Z){if(X+=Y,$)$=!1;else if(Y==="\\")$=!0;else if(Y==='"')Z=!1;continue}if(Y==='"'){Z=!0,X+=Y;continue}if(Y===","){let G=Q+1;while(G<H.length&&/\s/.test(H[G]??""))G+=1;let W=H[G];if(W==="}"||W==="]")continue}X+=Y}return X}function QX(H){let X=BH(_H(H));return JSON.parse(X)}function YX(H){return H==="/"?H:H.replace(/\/+$/,"")}function w(H){if(H===null||typeof H!=="object"||Array.isArray(H))return!1;let X=Object.getPrototypeOf(H);return X===Object.prototype||X===null}function S(H){return Object.keys(H).filter((X)=>H[X]!==void 0).sort()}function i(H,X){if(Object.is(H,X))return!0;if(H===null||X===null)return H===X;if(Array.isArray(H)||Array.isArray(X)){if(!Array.isArray(H)||!Array.isArray(X)||H.length!==X.length)return!1;for(let Q=0;Q<H.length;Q+=1)if(!i(H[Q],X[Q]))return!1;return!0}if(!w(H)||!w(X))return!1;let Z=S(H),$=S(X);if(Z.length!==$.length)return!1;for(let Q=0;Q<Z.length;Q+=1)if(Z[Q]!==$[Q])return!1;for(let Q of Z)if(!i(H[Q],X[Q]))return!1;return!0}function f(H,X){if(H===null||H===void 0){X.push("n");return}if(Array.isArray(H)){X.push("[");for(let Z of H)f(Z,X);X.push("]");return}if(w(H)){X.push("{");for(let Z of S(H))X.push(JSON.stringify(Z),":"),f(H[Z],X);X.push("}");return}X.push(JSON.stringify(H))}function GX(H){let X=[];f(H,X);let Z=X.join(""),$=2166136261;for(let Q=0;Q<Z.length;Q+=1)$^=Z.charCodeAt(Q),$=$*16777619%9007199254740992;return`${Z.length.toString(36)}:${$.toString(36)}`}async function WX(H,X=async(G)=>G.status===200,Z=1000,$=1e4,Q,Y){let G=Date.now(),W=`Awaiting Ping (${H})`;return new Promise((D,U)=>{let L=null,J=null,M=null,_=!1,q=()=>{if(L)clearTimeout(L);if(J)clearInterval(J);if(M)clearTimeout(M);L=null,J=null,M=null},F=(K)=>{if(_)return;_=!0,q(),K()},A=Math.max(Z,1e4),V=async()=>{try{let K=await fetch(H,{signal:AbortSignal.timeout(A)});if(K.ok){if(await X(K)){F(D);return}W=`Response test failed: ${K.status}: ${K.statusText} - ${H}`}else try{let b=await K.json();W=`Response error: ${K.status}: ${K.statusText} - ${H}: ${JSON.stringify(b)}`}catch(b){W=`Response error: ${K.status}: ${K.statusText} - ${H}`}}catch(K){W=`${K instanceof Error?K.message:String(K)} - ${H}`}if(!_)L=setTimeout(()=>void V(),Z)};if($>0)J=setInterval(()=>{Y?.warn(`${W}: ${Date.now()-G}ms`)},$);if(Q)M=setTimeout(()=>{F(()=>U(Error(`Timeout: ${Q}ms: ${W}`)))},Q);V()})}var JH="@ionite/core",DH=t(r(JH));function UH(H){let X=H.exp!=null?new Date(H.exp*1000):new Date,Z=H.iss??"";return{id:H.sub??"",userName:H.preferred_username??"",name:H.name??"",email:H.email??"",avatar:H.picture,sso:{profile:{...H,iss:H.iss??Z,aud:H.aud},tenant:{id:H.idp??Z,name:Z},tokenType:"Bearer",expires:X}}}function qH(H){let X=H.replace(/-/g,"+").replace(/_/g,"/");return atob(X)}async function BX(H){let X=H.split(".");if(X.length!==3)throw Error("Invalid JWT");let Z=qH(X[1]),$=JSON.parse(Z),Q=await DH.validate($);if(Q.issues)throw Error(`ID token claims validation failed: ${Q.issues.map((Y)=>Y.message).join("; ")}`);if(Q.value)return UH(Q.value);throw Error("ID token claims validation failed")}class y extends Error{code="conflict";kind;field;constructor(H,X,Z){super(H);this.name="StoreConflictError",this.kind=X,this.field=Z,Object.setPrototypeOf(this,y.prototype)}}function DX(H){return H instanceof y||typeof H==="object"&&H!=null&&H.code==="conflict"}class s extends Error{status;statusText;constructor(H,X={}){super(H,{cause:X.cause});this.name="IoniteError",this.status=X.status,this.statusText=X.statusText,Object.setPrototypeOf(this,s.prototype)}}function a(H){if(typeof H!=="object"||H==null)return!1;let X=H.type;if(X==="vault"||X==="aws"||X==="azure"||X==="gcp")return!0;if(X!=="mirror")return!1;let Z=H;return a(Z.from)&&Z.from.type!=="mirror"&&a(Z.to)&&Z.to.type==="vault"}class e{tenants=new Map;async get(H){return this.tenants.get(H)}async list(H){let X=Array.from(this.tenants.values()),Z=Math.max(0,H?.start??0),$=H?.limit,Q=X.length,Y=$!=null?Z+$:void 0,G=X.slice(Z,Y);return j(Q,G,Z,$)}async upsert(H){return this.tenants.set(H.id,H),H}async delete(H){let X=this.tenants.has(H);return this.tenants.delete(H),X?1:0}}class FH{store;ionCache;constructor(H={}){this.ionCache=H.ionCache,this.store=new e}async get(H){return this.store.get(H)}async list(H){return this.store.list(H)}async upsert(H){let X=await this.store.upsert(H);return this.ionCache?.delete(H.id),X}async delete(H){let X=await this.store.delete(H);return this.ionCache?.delete(H),X}async getIon(H){if(!this.ionCache)throw Error(`${this.constructor.name}.getIon() requires an app-owned ionCache. Pass { ionCache } (an lru-cache instance whose fetchMethod builds the tenant Ionite and whose dispose `+"closes it) — the SDK does not cache tenant runtimes. See the multi-tenant docs.");return this.ionCache.fetch(H)}}function KH(H,X,Z){return(async()=>{try{let $=await fetch(H,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)});if(!$.ok)Z.error("Failed to send webhook update",{"ion.operation":"webhook.update","ion.outcome":"failure",status:$.status,statusText:$.statusText})}catch($){Z.error("Failed to send webhook update",{"ion.operation":"webhook.update","ion.outcome":"failure"},$)}})()}async function FX(H,X,Z){return KH(H,X,Z)}var VX="urn:ionite:scim:schemas:extension:ion:2.0:User";function B(H,X,Z,$,Q){if(H===void 0||H===null){if(Z)$.push({message:`${X} is required`,path:Q});return}if(typeof H!=="string"){$.push({message:`${X} must be a string`,path:Q});return}return H}function E(H,X,Z,$){if(H===void 0||H===null)return;if(typeof H!=="boolean"){Z.push({message:`${X} must be a boolean`,path:$});return}return H}function VH(H,X,Z){if(H===void 0||H===null)return;if(typeof H!=="object"||H===null){X.push({message:"name must be an object",path:Z});return}let $=H,Q={};return Q.formatted=B($.formatted,"formatted",!1,X,[...Z,"formatted"]),Q.familyName=B($.familyName,"familyName",!1,X,[...Z,"familyName"]),Q.givenName=B($.givenName,"givenName",!1,X,[...Z,"givenName"]),Q.middleName=B($.middleName,"middleName",!1,X,[...Z,"middleName"]),Q.honorificPrefix=B($.honorificPrefix,"honorificPrefix",!1,X,[...Z,"honorificPrefix"]),Q.honorificSuffix=B($.honorificSuffix,"honorificSuffix",!1,X,[...Z,"honorificSuffix"]),Q}function AH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"emails must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],G=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"email must be an object",path:G});continue}let W=Y,D=B(W.value,"value",!0,X,[...G,"value"]);if(D)$.push({value:D,display:B(W.display,"display",!1,X,[...G,"display"]),type:B(W.type,"type",!1,X,[...G,"type"]),primary:E(W.primary,"primary",X,[...G,"primary"])})}return $.length>0?$:void 0}function zH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"phoneNumbers must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],G=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"phoneNumber must be an object",path:G});continue}let W=Y,D=B(W.value,"value",!0,X,[...G,"value"]);if(D)$.push({value:D,display:B(W.display,"display",!1,X,[...G,"display"]),type:B(W.type,"type",!1,X,[...G,"type"]),primary:E(W.primary,"primary",X,[...G,"primary"])})}return $.length>0?$:void 0}function NH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"addresses must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],G=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"address must be an object",path:G});continue}let W=Y;$.push({formatted:B(W.formatted,"formatted",!1,X,[...G,"formatted"]),streetAddress:B(W.streetAddress,"streetAddress",!1,X,[...G,"streetAddress"]),locality:B(W.locality,"locality",!1,X,[...G,"locality"]),region:B(W.region,"region",!1,X,[...G,"region"]),postalCode:B(W.postalCode,"postalCode",!1,X,[...G,"postalCode"]),country:B(W.country,"country",!1,X,[...G,"country"]),type:B(W.type,"type",!1,X,[...G,"type"]),primary:E(W.primary,"primary",X,[...G,"primary"])})}return $.length>0?$:void 0}function xH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"groups must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],G=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"group must be an object",path:G});continue}let W=Y,D=B(W.value,"value",!0,X,[...G,"value"]);if(D)$.push({value:D,$ref:B(W.$ref,"$ref",!1,X,[...G,"$ref"]),display:B(W.display,"display",!1,X,[...G,"display"]),type:B(W.type,"type",!1,X,[...G,"type"])})}return $.length>0?$:void 0}function RH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"roles must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],G=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"role must be an object",path:G});continue}let W=Y,D=B(W.value,"value",!0,X,[...G,"value"]);if(D)$.push({value:D,display:B(W.display,"display",!1,X,[...G,"display"]),type:B(W.type,"type",!1,X,[...G,"type"]),primary:E(W.primary,"primary",X,[...G,"primary"])})}return $.length>0?$:void 0}function OH(H,X,Z){if(H===void 0||H===null)return;if(typeof H!=="object"||H===null){X.push({message:"Enterprise User extension must be an object",path:Z});return}let $=H,Q={};if(Q.employeeNumber=B($.employeeNumber,"employeeNumber",!1,X,[...Z,"employeeNumber"]),Q.costCenter=B($.costCenter,"costCenter",!1,X,[...Z,"costCenter"]),Q.organization=B($.organization,"organization",!1,X,[...Z,"organization"]),Q.division=B($.division,"division",!1,X,[...Z,"division"]),Q.department=B($.department,"department",!1,X,[...Z,"department"]),$.manager!==void 0&&$.manager!==null)if(typeof $.manager!=="object"||$.manager===null)X.push({message:"manager must be an object",path:[...Z,"manager"]});else{let Y=$.manager;Q.manager={value:B(Y.value,"value",!1,X,[...Z,"manager","value"]),$ref:B(Y.$ref,"$ref",!1,X,[...Z,"manager","$ref"]),displayName:B(Y.displayName,"displayName",!1,X,[...Z,"manager","displayName"])}}return Q}function AX(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={},Y=B(Z.userName,"userName",!0,$,["userName"]);if(!Y)return{issues:$};if(Q.userName=Y,Q.id=B(Z.id,"id",!1,$,["id"]),Q.externalId=B(Z.externalId,"externalId",!1,$,["externalId"]),Q.displayName=B(Z.displayName,"displayName",!1,$,["displayName"]),Q.nickName=B(Z.nickName,"nickName",!1,$,["nickName"]),Q.profileUrl=B(Z.profileUrl,"profileUrl",!1,$,["profileUrl"]),Q.title=B(Z.title,"title",!1,$,["title"]),Q.userType=B(Z.userType,"userType",!1,$,["userType"]),Q.preferredLanguage=B(Z.preferredLanguage,"preferredLanguage",!1,$,["preferredLanguage"]),Q.locale=B(Z.locale,"locale",!1,$,["locale"]),Q.timezone=B(Z.timezone,"timezone",!1,$,["timezone"]),Z.password!==void 0)$.push({message:"password is not supported: the SDK does not accept credentials via SCIM",path:["password"]});Q.active=E(Z.active,"active",$,["active"]),Q.name=VH(Z.name,$,["name"]),Q.emails=AH(Z.emails,$,["emails"]),Q.phoneNumbers=zH(Z.phoneNumbers,$,["phoneNumbers"]),Q.addresses=NH(Z.addresses,$,["addresses"]),Q.groups=xH(Z.groups,$,["groups"]),Q.roles=RH(Z.roles,$,["roles"]);let G="urn:ietf:params:scim:schemas:extension:enterprise:2.0:User";if(Z[G]!==void 0)Q[G]=OH(Z[G],$,[G]);if(Z.schemas!==void 0)if(Array.isArray(Z.schemas))Q.schemas=Z.schemas.filter((W)=>typeof W==="string");else $.push({message:"schemas must be an array",path:["schemas"]});if(Z.meta!==void 0)if(typeof Z.meta==="object"&&Z.meta!==null){let W=Z.meta;Q.meta={resourceType:typeof W.resourceType==="string"?W.resourceType:void 0,created:typeof W.created==="string"?W.created:void 0,lastModified:typeof W.lastModified==="string"?W.lastModified:void 0,location:typeof W.location==="string"?W.location:void 0,version:typeof W.version==="string"?W.version:void 0}}else $.push({message:"meta must be an object",path:["meta"]});if($.length>0)return{issues:$};return{value:Q}}}}}function CH(H,X,Z){if(H===void 0||H===null)return;if(!Array.isArray(H)){X.push({message:"members must be an array",path:Z});return}let $=[];for(let Q=0;Q<H.length;Q++){let Y=H[Q],G=[...Z,Q];if(typeof Y!=="object"||Y===null){X.push({message:"member must be an object",path:G});continue}let W=Y,D=B(W.value,"value",!0,X,[...G,"value"]);if(D){let U=B(W.type,"type",!1,X,[...G,"type"]);if(U!==void 0&&U!=="User"&&U!=="Group"&&U!=="Workload")X.push({message:"type must be 'User', 'Group', or 'Workload'",path:[...G,"type"]});$.push({value:D,$ref:B(W.$ref,"$ref",!1,X,[...G,"$ref"]),display:B(W.display,"display",!1,X,[...G,"display"]),type:U==="User"||U==="Group"||U==="Workload"?U:void 0})}}return $.length>0?$:void 0}function zX(H){return{"~standard":{version:1,vendor:H,validate:(X)=>{if(typeof X!=="object"||X===null)return{issues:[{message:"Expected an object"}]};let Z=X,$=[],Q={},Y=B(Z.displayName,"displayName",!0,$,["displayName"]);if(!Y)return{issues:$};if(Q.displayName=Y,Q.id=B(Z.id,"id",!1,$,["id"]),Q.externalId=B(Z.externalId,"externalId",!1,$,["externalId"]),Q.members=CH(Z.members,$,["members"]),Z.schemas!==void 0)if(Array.isArray(Z.schemas))Q.schemas=Z.schemas.filter((G)=>typeof G==="string");else $.push({message:"schemas must be an array",path:["schemas"]});if(Z.meta!==void 0)if(typeof Z.meta==="object"&&Z.meta!==null){let G=Z.meta;Q.meta={resourceType:typeof G.resourceType==="string"?G.resourceType:void 0,created:typeof G.created==="string"?G.created:void 0,lastModified:typeof G.lastModified==="string"?G.lastModified:void 0,location:typeof G.location==="string"?G.location:void 0,version:typeof G.version==="string"?G.version:void 0}}else $.push({message:"meta must be an object",path:["meta"]});if($.length>0)return{issues:$};return{value:Q}}}}}
|
|
4
|
-
export{EH as a,jH as b,j as c,R as d,XH as e,kH as f,$H as g,wH as h,SH as i,x as j,fH as k,yH as l,bH as m,gH as n,m as o,vH as p,k as q,z as r,p as s,YH as t,GH as u,nH as v,lH as w,oH as x,C as y,MH as z,rH as A,iH as B,tH as C,sH as D,eH as E,r as F,t as G,XX as H,ZX as I,$X as J,_H as K,QX as L,YX as M,i as N,GX as O,WX as P,UH as Q,BX as R,y as S,DX as T,s as U,a as V,FH as W,FX as X,VX as Y,AX as Z,zX as _};
|