@plattar/auth-sdk
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
var Auth;(()=>{"use strict";var t={806:function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.CoreError=e.Service=void 0;var c=n(643);Object.defineProperty(e,"Service",{enumerable:!0,get:function(){return c.Service}}),Object.defineProperty(e,"CoreError",{enumerable:!0,get:function(){return c.CoreError}}),s(n(949),e),s(n(772),e),s(n(946),e),s(n(370),e),s(n(825),e),s(n(373),e),s(n(627),e),s(n(597),e),s(n(197),e),s(n(763),e)},627:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Access=e.AccessQueryDynamic=e.AccessQueryStatic=void 0;const r=n(772),s=n(370),c=n(643);class a extends c.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/access/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/access","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/access/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/access/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async create(){const t=await this._Fetch(new o,"/v3/access","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/access/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"PATCH");return n.length>0?n[0]:null}async push(t){const e="/v3/access/:id/push".replace(":id",t.id),n=await this._Fetch(new o,e,"POST");return n.length>0?n[0]:null}async reset(t){const e="/v3/access/:id/reset".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async delete(t){const e="/v3/access/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"DELETE");return n.length>0?n[0]:null}}e.AccessQueryStatic=a;class i extends c.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/access/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/access/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/access/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async create(){const t=await this._Fetch(new o,"/v3/access","POST");return t.length>0?t[0]:null}async update(){const t=`/v3/access/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}async push(){const t=`/v3/access/${this.instance.id}/push`,e=await this._Fetch(new o,t,"POST");return e.length>0?e[0]:null}async reset(){const t=`/v3/access/${this.instance.id}/reset`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async delete(){const t=`/v3/access/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.AccessQueryDynamic=i;class o extends c.CoreObject{static get type(){return"access"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.Access=o,c.GlobalObjectPool.register(o)},763:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AccountAccessResult=e.AccountAccessResultQueryDynamic=e.AccountAccessResultQueryStatic=void 0;const r=n(643);class s extends r.CoreQuery{}e.AccountAccessResultQueryStatic=s;class c extends r.CoreQuery{}e.AccountAccessResultQueryDynamic=c;class a extends r.CoreObject{static get type(){return"accountaccessresult"}static query(t){return new s(new a,t)}query(t){return new c(this,t)}}e.AccountAccessResult=a,r.GlobalObjectPool.register(a)},197:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AccountAccess=e.AccountAccessQueryDynamic=e.AccountAccessQueryStatic=void 0;const r=n(763),s=n(643);class c extends s.CoreQuery{async check(t){const e="/v3/accountaccess/:id/check".replace(":id",t.id),n=await this._Fetch(new r.AccountAccessResult,e,"POST");return n.length>0?n[0]:null}}e.AccountAccessQueryStatic=c;class a extends s.CoreQuery{async check(){const t=`/v3/accountaccess/${this.instance.id}/check`,e=await this._Fetch(new r.AccountAccessResult,t,"POST");return e.length>0?e[0]:null}}e.AccountAccessQueryDynamic=a;class i extends s.CoreObject{static get type(){return"accountaccess"}static query(t){return new c(new i,t)}query(t){return new a(this,t)}}e.AccountAccess=i,s.GlobalObjectPool.register(i)},597:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AccountMember=e.AccountMemberQueryDynamic=e.AccountMemberQueryStatic=void 0;const r=n(772),s=n(370),c=n(643);class a extends c.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/accountmember/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/accountmember","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/accountmember/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/accountmember/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async recover(t){const e="/v3/accountmember/:id/recover".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async refer(t){const e="/v3/accountmember/:id/:by".replace(":id",t.id).replace(":by",t.by),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async create(){const t=await this._Fetch(new o,"/v3/accountmember","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/accountmember/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"PATCH");return n.length>0?n[0]:null}async delete(t){const e="/v3/accountmember/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"DELETE");return n.length>0?n[0]:null}}e.AccountMemberQueryStatic=a;class i extends c.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/accountmember/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/accountmember/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/accountmember/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async recover(){const t=`/v3/accountmember/${this.instance.id}/recover`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/accountmember/${this.instance.id}/:by`.replace(":by",t.by),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async create(){const t=await this._Fetch(new o,"/v3/accountmember","POST");return t.length>0?t[0]:null}async update(){const t=`/v3/accountmember/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}async delete(){const t=`/v3/accountmember/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.AccountMemberQueryDynamic=i;class o extends c.CoreObject{static get type(){return"accountmember"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.AccountMember=o,c.GlobalObjectPool.register(o)},825:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Account=e.AccountQueryDynamic=e.AccountQueryStatic=void 0;const r=n(772),s=n(370),c=n(643);class a extends c.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/account/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/account","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/account/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/account/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async recover(t){const e="/v3/account/:id/recover".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async refer(t){const e="/v3/account/:id/:by".replace(":id",t.id).replace(":by",t.by),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async create(){const t=await this._Fetch(new o,"/v3/account","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/account/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"PATCH");return n.length>0?n[0]:null}async delete(t){const e="/v3/account/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"DELETE");return n.length>0?n[0]:null}async invite(t){const e="/v3/account/:id/invite".replace(":id",t.id),n=await this._Fetch(new o,e,"POST");return n.length>0?n[0]:null}}e.AccountQueryStatic=a;class i extends c.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/account/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/account/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/account/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async recover(){const t=`/v3/account/${this.instance.id}/recover`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/account/${this.instance.id}/:by`.replace(":by",t.by),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async create(){const t=await this._Fetch(new o,"/v3/account","POST");return t.length>0?t[0]:null}async update(){const t=`/v3/account/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}async delete(){const t=`/v3/account/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}async invite(){const t=`/v3/account/${this.instance.id}/invite`,e=await this._Fetch(new o,t,"POST");return e.length>0?e[0]:null}}e.AccountQueryDynamic=i;class o extends c.CoreObject{static get type(){return"account"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.Account=o,c.GlobalObjectPool.register(o)},772:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Attributes=e.AttributesQueryDynamic=e.AttributesQueryStatic=void 0;const r=n(643);class s extends r.CoreQuery{}e.AttributesQueryStatic=s;class c extends r.CoreQuery{}e.AttributesQueryDynamic=c;class a extends r.CoreObject{static get type(){return"attributes"}static query(t){return new s(new a,t)}query(t){return new c(this,t)}}e.Attributes=a,r.GlobalObjectPool.register(a)},370:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Count=e.CountQueryDynamic=e.CountQueryStatic=void 0;const r=n(643);class s extends r.CoreQuery{}e.CountQueryStatic=s;class c extends r.CoreQuery{}e.CountQueryDynamic=c;class a extends r.CoreObject{static get type(){return"count"}static query(t){return new s(new a,t)}query(t){return new c(this,t)}}e.Count=a,r.GlobalObjectPool.register(a)},946:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=e.PlanQueryDynamic=e.PlanQueryStatic=void 0;const r=n(772),s=n(370),c=n(643);class a extends c.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/plan/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/plan","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/plan/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/plan/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async recover(t){const e="/v3/plan/:id/recover".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async refer(t){const e="/v3/plan/:id/:by".replace(":id",t.id).replace(":by",t.by),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async create(){const t=await this._Fetch(new o,"/v3/plan","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/plan/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"PATCH");return n.length>0?n[0]:null}async delete(t){const e="/v3/plan/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"DELETE");return n.length>0?n[0]:null}}e.PlanQueryStatic=a;class i extends c.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/plan/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/plan/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/plan/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async recover(){const t=`/v3/plan/${this.instance.id}/recover`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/plan/${this.instance.id}/:by`.replace(":by",t.by),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async create(){const t=await this._Fetch(new o,"/v3/plan","POST");return t.length>0?t[0]:null}async update(){const t=`/v3/plan/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}async delete(){const t=`/v3/plan/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.PlanQueryDynamic=i;class o extends c.CoreObject{static get type(){return"plan"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.Plan=o,c.GlobalObjectPool.register(o)},373:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PlattarUser=e.PlattarUserQueryDynamic=e.PlattarUserQueryStatic=void 0;const r=n(772),s=n(370),c=n(643);class a extends c.CoreQuery{async login(){const t=await this._Fetch(new o,"/v3/plattaruser/login","POST");return t.length>0?t[0]:null}async register(){const t=await this._Fetch(new o,"/v3/plattaruser/register","POST");return t.length>0?t[0]:null}async resetPassword(){const t=await this._Fetch(new o,"/v3/plattaruser/resetpassword","POST");return t.length>0?t[0]:null}async current(){const t=await this._Fetch(new o,"/v3/plattaruser/current","GET");return t.length>0?t[0]:null}async loginGoogle(){await this._Fetch(new o,"/v3/plattaruser/login/google","GET")}async loginMicrosoft(){await this._Fetch(new o,"/v3/plattaruser/login/microsoft","GET")}async loginGoogleCallback(){const t=await this._Fetch(new o,"/v3/plattaruser/login/google/callback","GET");return t.length>0?t[0]:null}async loginMicrosoftCallback(){const t=await this._Fetch(new o,"/v3/plattaruser/login/microsoft/callback","GET");return t.length>0?t[0]:null}async logout(){const t=await this._Fetch(new o,"/v3/plattaruser/logout","GET");return t.length>0?t[0]:null}async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/plattaruser/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/plattaruser","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/plattaruser/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/plattaruser/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async refer(t){const e="/v3/plattaruser/:id/:by".replace(":id",t.id).replace(":by",t.by),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async update(t){const e="/v3/plattaruser/:id".replace(":id",t.id),n=await this._Fetch(new o,e,"PATCH");return n.length>0?n[0]:null}}e.PlattarUserQueryStatic=a;class i extends c.CoreQuery{async login(){const t=await this._Fetch(new o,"/v3/plattaruser/login","POST");return t.length>0?t[0]:null}async register(){const t=await this._Fetch(new o,"/v3/plattaruser/register","POST");return t.length>0?t[0]:null}async resetPassword(){const t=await this._Fetch(new o,"/v3/plattaruser/resetpassword","POST");return t.length>0?t[0]:null}async current(){const t=await this._Fetch(new o,"/v3/plattaruser/current","GET");return t.length>0?t[0]:null}async loginGoogle(){await this._Fetch(new o,"/v3/plattaruser/login/google","GET")}async loginMicrosoft(){await this._Fetch(new o,"/v3/plattaruser/login/microsoft","GET")}async loginGoogleCallback(){const t=await this._Fetch(new o,"/v3/plattaruser/login/google/callback","GET");return t.length>0?t[0]:null}async loginMicrosoftCallback(){const t=await this._Fetch(new o,"/v3/plattaruser/login/microsoft/callback","GET");return t.length>0?t[0]:null}async logout(){const t=await this._Fetch(new o,"/v3/plattaruser/logout","GET");return t.length>0?t[0]:null}async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/plattaruser/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/plattaruser/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/plattaruser/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/plattaruser/${this.instance.id}/:by`.replace(":by",t.by),n=await this._Fetch(new o,e,"GET");return n.length>0?n[0]:null}async update(){const t=`/v3/plattaruser/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}}e.PlattarUserQueryDynamic=i;class o extends c.CoreObject{static get type(){return"plattaruser"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.PlattarUser=o,c.GlobalObjectPool.register(o)},949:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SocialAuth=e.SocialAuthQueryDynamic=e.SocialAuthQueryStatic=void 0;const r=n(772),s=n(643);class c extends s.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/socialauth/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new i,"/v3/socialauth","GET")}async get(t){const e="/v3/socialauth/:id".replace(":id",t.id),n=await this._Fetch(new i,e,"GET");return n.length>0?n[0]:null}async refer(t){const e="/v3/socialauth/:id/:by".replace(":id",t.id).replace(":by",t.by),n=await this._Fetch(new i,e,"GET");return n.length>0?n[0]:null}}e.SocialAuthQueryStatic=c;class a extends s.CoreQuery{async attributes(){const t=await this._Fetch(new r.Attributes,"/v3/socialauth/attributes","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/socialauth/${this.instance.id}`,e=await this._Fetch(new i,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/socialauth/${this.instance.id}/:by`.replace(":by",t.by),n=await this._Fetch(new i,e,"GET");return n.length>0?n[0]:null}}e.SocialAuthQueryDynamic=a;class i extends s.CoreObject{static get type(){return"socialauth"}static query(t){return new c(new i,t)}query(t){return new a(this,t)}}e.SocialAuth=i,s.GlobalObjectPool.register(i)},478:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreObject=void 0;const r=n(793),s=n(168);e.CoreObject=class{_attributes;_relations;_id;constructor(t,e){this._id=t||null,this._attributes=e||{},this._relations=new s.CoreObjectRelations(this)}get attributes(){return this._attributes}get relationships(){return this._relations}get payload(){return{data:{attributes:this.attributes}}}get id(){if(!this._id)throw new Error("CoreObject.id is not configured, use constructor with a non-null id");return this._id}hasID(){return!!this._id}static get type(){throw new Error("CoreObject.type is not implemented, contact admin")}static newInstance(){return new this}get type(){return this.constructor.type}static include(...t){const e=t.map((t=>Array.isArray(t)?t.map((t=>`${this.type}.${t}`)):`${this.type}.${t.type}`)),n=new Array;return e.forEach((t=>{Array.isArray(t)?n.push(...t):n.push(t)})),n}setFromAPI(t){if(this.type!==t.object.type)throw new Error(`CoreObject.setFromAPI() - type mismatch, cannot set ${this.type} from data type ${t.object.type}`);if(this.relationships.cache.clear(),this._id=t.object.id,Object.keys(this._attributes).forEach((t=>delete this._attributes[t])),t.object.attributes)for(const[e,n]of Object.entries(t.object.attributes))this._attributes[e]=n;if(t.object.relationships)for(const[e,n]of Object.entries(t.object.relationships)){const e=n.data;Array.isArray(e)?e.forEach((e=>{this._CreateRecord(t,e)})):this._CreateRecord(t,e)}}_CreateRecord(t,e){if(!t.includes.get(e.id))return;const n=t.cache.get(e.id);if(n)return void this.relationships.cache.append(n);const s=r.GlobalObjectPool.newInstance(e.type);if(!s)throw new Error(`record constructor is unable to create a new record of type ${e.type}`);t.cache.set(e.id,s),s.setFromAPI({object:e,includes:t.includes,cache:t.cache}),this.relationships.cache.append(s)}}},793:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalObjectPool=void 0;class n{static _globalMap=new Map;static register(t){return this._globalMap.set(t.type,t),this}static get(t){return this._globalMap.get(t)||null}static newInstance(t){const e=this.get(t);return e?e.newInstance():null}}e.GlobalObjectPool=n},753:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreFileQuery=void 0;const r=n(256);class s extends r.CoreQuery{async upload(t,e){if(!this.instance.hasID())throw new Error("CoreQuery.upload() - cannot upload a file using an uninitialized instance");const n=await fetch(`${this.service.url}/${this.instance.type}/${this.instance.id}/upload`,{headers:{"Content-Type":"application/json"},credentials:"include",method:"post",mode:"cors",body:JSON.stringify({data:{attributes:{key:t,filename:e.name}}})}),r=await n.json();if(r.error)throw new Error(`CoreQuery.upload() - upload request status ${r.status} - error - ${r.title} - ${r.text}`);const s=r.data.id,c=r.data.type;await fetch(r.data.attributes.url,{method:"put",body:e});const a=await fetch(`${this.service.url}/${c}/${s}`,{method:"get"}),i=await a.json();if(i.error)throw new Error(`CoreQuery.upload() - refresh request status ${i.status} - error - ${i.title} - ${i.text}`);return this.instance.setFromAPI(i),this.instance}}e.CoreFileQuery=s},256:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreQuery=void 0;const r=n(793),s=n(928),c=n(927),a=n(14),i=n(688),o=n(671),u=n(851),l=n(931),h=n(920),d=n(562),y=n(454),p=n(206),w=n(50),g=n(362);class b{_instance;_service;_queries;_abort;constructor(t,e){this._instance=t,this._service=e||s.Service.default,this._queries=new Array,this._abort=new AbortController}get instance(){return this._instance}get service(){return this._service}abort(t){this._abort.abort(t)}join(...t){return t.forEach((t=>{const e=t.toString();""!==e&&this._queries.push(new y.JoinQuery(e))})),this}where(t,e,n){switch(e){case"like":case"~=":this._queries.push(new w.SearchQuery(this.instance.type,t,n instanceof Date?n.toISOString():n));break;default:this._queries.push(new h.FilterQuery(this.instance.type,t,e,n instanceof Date?n.toISOString():n))}return this}fields(...t){const e=t.map((t=>t));return this._queries.push(new l.FieldsQuery(this.instance.type,e)),this}include(...t){const e=t.map((t=>Array.isArray(t)?t.map((t=>`${this.instance.type}.${t}`)):t instanceof b?(this.join(t),`${this.instance.type}.${t.instance.type}`):`${this.instance.type}.${t.type}`));return this._queries.push(new d.IncludeQuery(e.flat())),this}contains(...t){const e=t.map((t=>t.type));return this._queries.push(new o.ContainsQuery("==",e)),this}notContains(...t){const e=t.map((t=>t.type));return this._queries.push(new o.ContainsQuery("!=",e)),this}deleted(...t){const e=t.map((t=>t.type));return this._queries.push(new u.DeletedQuery(e)),this}sort(t,e){return this._queries.push(new g.SortQuery(t,this.instance.type,e)),this}page(t,e){return this._queries.push(new p.PaginationQuery(t,e)),this}async _Fetch(t,e,n){return b.fetch(this.service,this.instance,t,encodeURI(`${e}${this._queries.length>0?`?${this.toString()}`:""}`),n,this._abort.signal)}toString(){const t=this._queries;if(t.length<=0)return"";let e="";return t.forEach((t=>{const n=t.toString();""!==n&&(e+=`${n}&`)})),e.slice(0,-1)}static async fetch(t,e,n,s,o,u){const l=new Array,h=`${await c.DNS.resolveLocalhost(t.config.url)}${s}`;if(!fetch)return i.CoreError.init(h,{error:{title:"Runtime Error",text:`native fetch api not available, uprade your ${a.Util.isNode()?"NodeJS":"Browser"} environment`}}).handle(t),l;if(!await t.checkHealth())return i.CoreError.init(h,{error:{title:"Network Error",text:"configured service.url is not healthy and cannot be reached, check host status"}}).handle(t),l;const d={"Content-Type":"application/json",Accept:"application/json"},y={method:o,mode:"cors",cache:"no-cache",redirect:"follow",referrerPolicy:"origin"};if(a.Util.isNode())switch(t.config.auth.type){case"cookie":t.config.auth.token&&(d.cookie=t.config.auth.token);break;case"token":t.config.auth.token&&(d.Authorization=`Bearer ${t.config.auth.token}`)}else switch(t.config.auth.type){case"cookie":y.credentials="include";break;case"token":t.config.auth.token&&(d.Authorization=`Bearer ${t.config.auth.token}`)}switch(y.headers=d,o){case"POST":case"PUT":case"PATCH":y.body=JSON.stringify(e.payload)}u&&(y.signal=u);let p=null;try{p=await this._ExpFetch(t,h,y,0,u)}catch(e){return e.handle(t),l}if(408===p.status)return i.CoreError.init(h,{error:{status:408,title:"Request Timeout",text:"request timed out"}}).handle(t),l;let w=null;try{w=await p.json()}catch(e){return i.CoreError.init(h,{error:{title:"Runtime Error",text:`something unexpected occured during results parsing, details - ${e.message}`}}).handle(t),l}if(!w)return i.CoreError.init(h,{error:{title:"Runtime Error",text:"runtime expected json results from fetch to be non-null"}}).handle(t),l;if(w.error)return i.CoreError.init(h,w).handle(t),l;if(!w.data)return i.CoreError.init(h,{error:{title:"Runtime Error",text:"runtime tried to parse malformed json data"}}).handle(t),l;const g=w.included||new Array,b=new Map;if(g.forEach((t=>{t.id&&b.set(t.id,t)})),Array.isArray(w.data)){const e=w.data;if(e.length<=0)return l;const s=new Map,c=e[0];s.set(c.id,n),n.setFromAPI({object:c,includes:b,cache:s}),l.push(n);for(let n=1;n<e.length;n++){const a=e[n],o=s.get(c.id)||r.GlobalObjectPool.newInstance(a.type);o?(s.set(a.id,o),o.setFromAPI({object:e[n],includes:b,cache:s}),l.push(o)):i.CoreError.init(h,{error:{title:"Runtime Error",text:`runtime could not create a new instance of object type ${a.type} at index ${n}`}}).handle(t)}}else{const t=w.data;if(!t.type||!t.id)return l;const e=new Map;e.set(t.id,n),n.setFromAPI({object:t,includes:b,cache:e}),l.push(n)}return l}static async _ExpFetch(t,e,n,r,s){let c=null;try{c=await fetch(e,n)}catch(t){if(s&&s.aborted)throw i.CoreError.init(e,{error:{title:"Aborted",text:"request was manually aborted"}});throw i.CoreError.init(e,{error:{title:"Runtime Error",text:`something unexpected occured during runtime, details - ${t.message}`}})}if(!c)throw i.CoreError.init(e,{error:{title:"Runtime Error",text:"something unexpected occured during runtime, request instance was null"}});if(!c.ok){const c=r+1;if(t.config.options.retry.tries>=c)return await a.Util.sleep(a.Util.expoBackoffTime(c)),this._ExpFetch(t,e,n,c,s)}return c}}e.CoreQuery=b},688:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreError=void 0;class n extends Error{_json;_source;constructor(t,e){super(`Error - (${e.error.title})${e.error.status&&e.error.status>0?` Status - (${e.error.status})`:""} Source - (${t}) Message - (${e.error.text})`),this._json=e,this._source=t}static init(t,e){return new n(t,e)}get status(){return this._json.error.status?this._json.error.status:0}get title(){return this._json.error.title}get text(){return this._json.error.text}get source(){return this._source}handle(t){try{t.config.options.errorListener(this)}catch(t){}switch(t.config.options.errorHandler){case"console.error":console.error(this.message);break;case"console.warn":console.warn(this.message);break;case"throw":throw this}}}e.CoreError=n},671:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContainsQuery=void 0;const r=n(515);class s extends r.Query{operation;objects;constructor(t,e){super(),this.operation="=="===t||"="===t?"eq":"ne",this.objects=e||[]}toString(){let t=",";return this.objects.length>0&&(t=`contains[${this.operation}]=`,this.objects.forEach((e=>{t+=`${e},`}))),t.slice(0,-1)}}e.ContainsQuery=s},851:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DeletedQuery=void 0;const r=n(515);class s extends r.Query{objects;constructor(t){super(),this.objects=t||[]}toString(){let t=",";return this.objects.length>0&&(t="deleted=",this.objects.forEach((e=>{t+=`${e},`}))),t.slice(0,-1)}}e.DeletedQuery=s},931:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FieldsQuery=void 0;const r=n(515);class s extends r.Query{attributes;object;constructor(t,e){super(),this.attributes=e||[],this.object=t}toString(){let t=",";return this.attributes.length>0&&(t=`fields[${this.object}]=`,this.attributes.forEach((e=>{t+=`${e},`}))),t.slice(0,-1)}}e.FieldsQuery=s},920:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FilterQuery=void 0;const r=n(515);class s extends r.Query{variable;operator;value;target;constructor(t,e,n,r){switch(super(),this.target=t,this.variable=e,this.value=r,n){case"=":case"==":default:this.operator="eq";break;case"!=":this.operator="ne";break;case"<":this.operator="lt";break;case">":this.operator="gt";break;case"<=":this.operator="le";break;case">=":this.operator="ge"}}toString(){return`filter[${this.target}.${this.variable}][${this.operator}]=${this.value}`}}e.FilterQuery=s},562:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IncludeQuery=void 0;const r=n(515);class s extends r.Query{objects;constructor(t){super(),this.objects=t||[]}toString(){let t=",";return this.objects.length>0&&(t="include=",this.objects.forEach((e=>{t+=`${e},`}))),t.slice(0,-1)}}e.IncludeQuery=s},454:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.JoinQuery=void 0;const r=n(515);class s extends r.Query{query;constructor(t){super(),this.query=t}toString(){return this.query}}e.JoinQuery=s},206:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PaginationQuery=void 0;const r=n(515);class s extends r.Query{count;size;constructor(t,e){super(),this.count=t||0,this.size=e||10}toString(){return`page[count]=${this.count}&page[size]=${this.size}`}}e.PaginationQuery=s},515:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Query=void 0,e.Query=class{}},50:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SearchQuery=void 0;const r=n(515);class s extends r.Query{variable;value;target;constructor(t,e,n){super(),this.target=t,this.variable=e,this.value=n}toString(){return`query[${this.target}.${this.variable}]=${this.value}`}}e.SearchQuery=s},362:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SortQuery=void 0;const r=n(515);class s extends r.Query{operation;object;attribute;constructor(t,e,n){switch(super(),t){case"asc":case"ascending":default:this.operation="";break;case"desc":case"descending":this.operation="-"}this.object=e,this.attribute=n}toString(){return`sort=${this.object}.${this.operation}${this.attribute}`}}e.SortQuery=s},168:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreObjectRelations=e.RelationCache=void 0;const r=n(256),s=n(928);class c{_cache=new Map;checkStatus(t){return this._cache.has(t.type)}clear(...t){t.length<=0?this._cache.clear():t.forEach((t=>{this._cache.delete(t.type)}))}put(t,e){this._cache.set(t,e)}append(t){const e=this._cache.get(t.type);e?e.push(t):this.put(t.type,[t])}get(t,e,n){const r=n||new Array,s=this._cache.get(t.type);return!s||s.length<=0||(e?s.forEach((t=>{try{e(t)&&r.push(t)}catch(t){}})):r.push(...s)),r}first(t,e){const n=this.get(t,e);return n.length>0?n[0]:null}}e.RelationCache=c,e.CoreObjectRelations=class{_instance;_cache;constructor(t){this._instance=t,this._cache=new c}get cache(){return this._cache}async get(t,e,n){if(this.cache.checkStatus(t))return this.cache.get(t,e);const c=n||s.Service.default,a=t.newInstance(),i=await r.CoreQuery.fetch(c,a,a,`${c.url}/${this._instance.type}/${this._instance.id}/${t.type}`,"GET");return this.cache.put(t.type,i),this.cache.get(t,e)}async first(t,e){const n=await this.get(t,e);return n.length>0?n[0]:null}}},928:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Service=void 0;const r=n(927),s=n(14);class c{static _defaultServiceInstance;_config;_health;constructor(t){this._config=Object.freeze({url:t.url,options:{version:t.options&&t.options.version?`v${t.options.version}`:"v3",tls:!(!t.options||!t.options.tls)&&s.Util.parseBool(t.options.tls),gzip:!(!t.options||!t.options.gzip)&&s.Util.parseBool(t.options.gzip),errorHandler:t.options&&t.options.errorHandler?t.options.errorHandler:"console.error",errorListener:t.options&&t.options.errorListener&&s.Util.isFunction(t.options.errorListener)?t.options.errorListener:t=>{},retry:t.options&&t.options.retry?{tries:s.Util.clamp(t.options.retry.tries,0,10)}:{tries:3}},auth:{type:t.auth&&t.auth.type?t.auth.type:"none",token:t.auth&&t.auth.token?t.auth.token:null}}),this._health=s.Util.isNode()&&t.options&&t.options.healthCheck?null:{status:!0},s.Util.isNode()&&(this._config.options.tls?process.env.NODE_TLS_REJECT_UNAUTHORIZED="1":process.env.NODE_TLS_REJECT_UNAUTHORIZED="0")}static config(t){return c._defaultServiceInstance=new c(t),c._defaultServiceInstance}static get default(){if(!c._defaultServiceInstance)throw new Error("Service.default is not configured, use Service.config() to set a new default");return c._defaultServiceInstance}async checkHealth(t=!1){return this._health||(this._health={status:await r.DNS.check(this.config.url,t)}),this._health.status}get config(){return this._config}get url(){return`${this.config.url}/${this.config.options.version}`}}e.Service=c},927:function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return s(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.DNS=void 0;const a=n(14);class i{static _DNSCache=new Map;static check(t,e=!1){return new Promise(((r,s)=>{if(!a.Util.isNode())return r(!0);if(!e){const e=i._DNSCache.get(t);if(e)return r(e.status)}Promise.resolve().then((()=>c(n(858)))).then((e=>{const n=new URL(t);e.lookup(n.hostname,(e=>{const n=!e;i._DNSCache.set(t,{status:n}),r(n)}))})).catch((e=>{i._DNSCache.set(t,{status:!1}),r(!1)}))}))}static resolveLocalhost(t){return new Promise(((e,r)=>{if(!a.Util.isNode())return e(t);const s=new URL(t);return"localhost"!==s.hostname?e(t):a.Util.isDocker()?e(`${s.protocol}//host.docker.internal${""!==s.port?`:${s.port}`:""}${"/"!==s.pathname?s.pathname:""}`):void Promise.resolve().then((()=>c(n(457)))).then((n=>{const r=n.networkInterfaces(),c={};for(const t of Object.keys(r))for(const e of r[t]){const n="string"==typeof e.family?"IPv4":4;e.family!==n||e.internal||(c[t]||(c[t]=[]),c[t].push(e.address))}const a=c.en0&&c.en0.length>0?c.en0[0]:null;return e(a?`${s.protocol}//${a}${""!==s.port?`:${s.port}`:""}${"/"!==s.pathname?s.pathname:""}`:t)})).catch((n=>{e(t)}))}))}}e.DNS=i},14:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Util=void 0;class n{static expoBackoffTime(t){return n.getRandomBetween(0,Math.min(500,15*(2<<t-1)))}static getRandomBetween(t,e){const n=Math.ceil(t),r=Math.floor(e);return Math.floor(Math.random()*(r-n+1)+n)}static clamp(t,e,n){return t?Math.min(Math.max(t,e),n):e}static isNode(){return"undefined"!=typeof process&&"node"===process.release.name}static isDocker(){return!(!n.isNode()||!process.env.LAMBDA_TASK_ROOT)}static parseBool(t){return!!t&&("string"==typeof t||t instanceof String?"true"===t.toLowerCase():!0===t)}static isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)}static sleep(t){return new Promise(((e,n)=>{setTimeout(e,t)}))}}e.Util=n},643:function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),s(n(928),e),s(n(478),e),s(n(793),e),s(n(753),e),s(n(256),e),s(n(688),e)},858:t=>{t.exports=dns},457:t=>{t.exports=os}},e={},n=function n(r){var s=e[r];if(void 0!==s)return s.exports;var c=e[r]={exports:{}};return t[r].call(c.exports,c,c.exports,n),c.exports}(806);Auth=n})(); | ||
var Auth;(()=>{"use strict";var t={806:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),s=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.CoreError=e.Service=void 0;var c=r(643);Object.defineProperty(e,"Service",{enumerable:!0,get:function(){return c.Service}}),Object.defineProperty(e,"CoreError",{enumerable:!0,get:function(){return c.CoreError}}),s(r(949),e),s(r(772),e),s(r(946),e),s(r(370),e),s(r(825),e),s(r(373),e),s(r(597),e),s(r(627),e),s(r(197),e),s(r(763),e)},627:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Access=e.AccessQueryDynamic=e.AccessQueryStatic=void 0;const n=r(772),s=r(370),c=r(643);class a extends c.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/access/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/access","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/access/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/access/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async create(){const t=await this._Fetch(new o,"/v3/access","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/access/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"PATCH");return r.length>0?r[0]:null}async push(t){const e="/v3/access/:id/push".replace(":id",t.id),r=await this._Fetch(new o,e,"POST");return r.length>0?r[0]:null}async reset(t){const e="/v3/access/:id/reset".replace(":id",t.id),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async delete(t){const e="/v3/access/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"DELETE");return r.length>0?r[0]:null}}e.AccessQueryStatic=a;class i extends c.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/access/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/access/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/access/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async create(){const t=await this._Fetch(new o,"/v3/access","POST");return t.length>0?t[0]:null}async update(){const t=`/v3/access/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}async push(){const t=`/v3/access/${this.instance.id}/push`,e=await this._Fetch(new o,t,"POST");return e.length>0?e[0]:null}async reset(){const t=`/v3/access/${this.instance.id}/reset`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async delete(){const t=`/v3/access/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.AccessQueryDynamic=i;class o extends c.CoreObject{static get type(){return"access"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.Access=o,c.GlobalObjectPool.register(o)},763:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AccountAccessResult=e.AccountAccessResultQueryDynamic=e.AccountAccessResultQueryStatic=void 0;const n=r(643);class s extends n.CoreQuery{}e.AccountAccessResultQueryStatic=s;class c extends n.CoreQuery{}e.AccountAccessResultQueryDynamic=c;class a extends n.CoreObject{static get type(){return"accountaccessresult"}static query(t){return new s(new a,t)}query(t){return new c(this,t)}}e.AccountAccessResult=a,n.GlobalObjectPool.register(a)},197:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AccountAccess=e.AccountAccessQueryDynamic=e.AccountAccessQueryStatic=void 0;const n=r(763),s=r(643);class c extends s.CoreQuery{async check(t){const e="/v3/accountaccess/:id/check".replace(":id",t.id),r=await this._Fetch(new n.AccountAccessResult,e,"POST");return r.length>0?r[0]:null}}e.AccountAccessQueryStatic=c;class a extends s.CoreQuery{async check(){const t=`/v3/accountaccess/${this.instance.id}/check`,e=await this._Fetch(new n.AccountAccessResult,t,"POST");return e.length>0?e[0]:null}}e.AccountAccessQueryDynamic=a;class i extends s.CoreObject{static get type(){return"accountaccess"}static query(t){return new c(new i,t)}query(t){return new a(this,t)}}e.AccountAccess=i,s.GlobalObjectPool.register(i)},597:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AccountMember=e.AccountMemberQueryDynamic=e.AccountMemberQueryStatic=void 0;const n=r(772),s=r(370),c=r(643);class a extends c.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/accountmember/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/accountmember","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/accountmember/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/accountmember/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async recover(t){const e="/v3/accountmember/:id/recover".replace(":id",t.id),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async refer(t){const e="/v3/accountmember/:id/:by".replace(":id",t.id).replace(":by",t.by),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async create(){const t=await this._Fetch(new o,"/v3/accountmember","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/accountmember/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"PATCH");return r.length>0?r[0]:null}async delete(t){const e="/v3/accountmember/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"DELETE");return r.length>0?r[0]:null}}e.AccountMemberQueryStatic=a;class i extends c.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/accountmember/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/accountmember/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/accountmember/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async recover(){const t=`/v3/accountmember/${this.instance.id}/recover`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/accountmember/${this.instance.id}/:by`.replace(":by",t.by),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async create(){const t=await this._Fetch(new o,"/v3/accountmember","POST");return t.length>0?t[0]:null}async update(){const t=`/v3/accountmember/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}async delete(){const t=`/v3/accountmember/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.AccountMemberQueryDynamic=i;class o extends c.CoreObject{static get type(){return"accountmember"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.AccountMember=o,c.GlobalObjectPool.register(o)},825:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Account=e.AccountQueryDynamic=e.AccountQueryStatic=void 0;const n=r(772),s=r(370),c=r(643);class a extends c.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/account/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/account","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/account/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/account/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async recover(t){const e="/v3/account/:id/recover".replace(":id",t.id),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async refer(t){const e="/v3/account/:id/:by".replace(":id",t.id).replace(":by",t.by),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async create(){const t=await this._Fetch(new o,"/v3/account","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/account/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"PATCH");return r.length>0?r[0]:null}async delete(t){const e="/v3/account/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"DELETE");return r.length>0?r[0]:null}async invite(t){const e="/v3/account/:id/invite".replace(":id",t.id),r=await this._Fetch(new o,e,"POST");return r.length>0?r[0]:null}}e.AccountQueryStatic=a;class i extends c.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/account/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/account/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/account/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async recover(){const t=`/v3/account/${this.instance.id}/recover`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/account/${this.instance.id}/:by`.replace(":by",t.by),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async create(){const t=await this._Fetch(new o,"/v3/account","POST");return t.length>0?t[0]:null}async update(){const t=`/v3/account/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}async delete(){const t=`/v3/account/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}async invite(){const t=`/v3/account/${this.instance.id}/invite`,e=await this._Fetch(new o,t,"POST");return e.length>0?e[0]:null}}e.AccountQueryDynamic=i;class o extends c.CoreObject{static get type(){return"account"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.Account=o,c.GlobalObjectPool.register(o)},772:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Attributes=e.AttributesQueryDynamic=e.AttributesQueryStatic=void 0;const n=r(643);class s extends n.CoreQuery{}e.AttributesQueryStatic=s;class c extends n.CoreQuery{}e.AttributesQueryDynamic=c;class a extends n.CoreObject{static get type(){return"attributes"}static query(t){return new s(new a,t)}query(t){return new c(this,t)}}e.Attributes=a,n.GlobalObjectPool.register(a)},370:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Count=e.CountQueryDynamic=e.CountQueryStatic=void 0;const n=r(643);class s extends n.CoreQuery{}e.CountQueryStatic=s;class c extends n.CoreQuery{}e.CountQueryDynamic=c;class a extends n.CoreObject{static get type(){return"count"}static query(t){return new s(new a,t)}query(t){return new c(this,t)}}e.Count=a,n.GlobalObjectPool.register(a)},946:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=e.PlanQueryDynamic=e.PlanQueryStatic=void 0;const n=r(772),s=r(370),c=r(643);class a extends c.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/plan/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new o,"/v3/plan","GET")}async count(){const t=await this._Fetch(new s.Count,"/v3/plan/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/plan/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async recover(t){const e="/v3/plan/:id/recover".replace(":id",t.id),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async refer(t){const e="/v3/plan/:id/:by".replace(":id",t.id).replace(":by",t.by),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async create(){const t=await this._Fetch(new o,"/v3/plan","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/plan/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"PATCH");return r.length>0?r[0]:null}async delete(t){const e="/v3/plan/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"DELETE");return r.length>0?r[0]:null}}e.PlanQueryStatic=a;class i extends c.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/plan/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new s.Count,"/v3/plan/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/plan/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async recover(){const t=`/v3/plan/${this.instance.id}/recover`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/plan/${this.instance.id}/:by`.replace(":by",t.by),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async create(){const t=await this._Fetch(new o,"/v3/plan","POST");return t.length>0?t[0]:null}async update(){const t=`/v3/plan/${this.instance.id}`,e=await this._Fetch(new o,t,"PATCH");return e.length>0?e[0]:null}async delete(){const t=`/v3/plan/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.PlanQueryDynamic=i;class o extends c.CoreObject{static get type(){return"plan"}static query(t){return new a(new o,t)}query(t){return new i(this,t)}}e.Plan=o,c.GlobalObjectPool.register(o)},373:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PlattarUser=e.PlattarUserQueryDynamic=e.PlattarUserQueryStatic=void 0;const n=r(825),s=r(597),c=r(772),a=r(370),i=r(643);class o extends i.CoreQuery{async accounts(t){const e="/v3/plattaruser/:id/accounts".replace(":id",t.id);return await this._Fetch(new n.Account,e,"GET")}async accountmembers(t){const e="/v3/plattaruser/:id/accountmembers".replace(":id",t.id);return await this._Fetch(new s.AccountMember,e,"GET")}async users(t){const e="/v3/plattaruser/:id/plattarusers".replace(":id",t.id);return await this._Fetch(new l,e,"GET")}async login(){const t=await this._Fetch(new l,"/v3/plattaruser/login","POST");return t.length>0?t[0]:null}async register(){const t=await this._Fetch(new l,"/v3/plattaruser/register","POST");return t.length>0?t[0]:null}async resetPassword(){const t=await this._Fetch(new l,"/v3/plattaruser/resetpassword","POST");return t.length>0?t[0]:null}async current(){const t=await this._Fetch(new l,"/v3/plattaruser/current","GET");return t.length>0?t[0]:null}async loginGoogle(){await this._Fetch(new l,"/v3/plattaruser/login/google","GET")}async loginMicrosoft(){await this._Fetch(new l,"/v3/plattaruser/login/microsoft","GET")}async loginGoogleCallback(){const t=await this._Fetch(new l,"/v3/plattaruser/login/google/callback","GET");return t.length>0?t[0]:null}async loginMicrosoftCallback(){const t=await this._Fetch(new l,"/v3/plattaruser/login/microsoft/callback","GET");return t.length>0?t[0]:null}async logout(){const t=await this._Fetch(new l,"/v3/plattaruser/logout","GET");return t.length>0?t[0]:null}async attributes(){const t=await this._Fetch(new c.Attributes,"/v3/plattaruser/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new l,"/v3/plattaruser","GET")}async count(){const t=await this._Fetch(new a.Count,"/v3/plattaruser/count","GET");return t.length>0?t[0]:null}async get(t){const e="/v3/plattaruser/:id".replace(":id",t.id),r=await this._Fetch(new l,e,"GET");return r.length>0?r[0]:null}async refer(t){const e="/v3/plattaruser/:id/:by".replace(":id",t.id).replace(":by",t.by),r=await this._Fetch(new l,e,"GET");return r.length>0?r[0]:null}async update(t){const e="/v3/plattaruser/:id".replace(":id",t.id),r=await this._Fetch(new l,e,"PATCH");return r.length>0?r[0]:null}}e.PlattarUserQueryStatic=o;class u extends i.CoreQuery{async login(){const t=await this._Fetch(new l,"/v3/plattaruser/login","POST");return t.length>0?t[0]:null}async register(){const t=await this._Fetch(new l,"/v3/plattaruser/register","POST");return t.length>0?t[0]:null}async resetPassword(){const t=await this._Fetch(new l,"/v3/plattaruser/resetpassword","POST");return t.length>0?t[0]:null}async current(){const t=await this._Fetch(new l,"/v3/plattaruser/current","GET");return t.length>0?t[0]:null}async loginGoogle(){await this._Fetch(new l,"/v3/plattaruser/login/google","GET")}async loginMicrosoft(){await this._Fetch(new l,"/v3/plattaruser/login/microsoft","GET")}async loginGoogleCallback(){const t=await this._Fetch(new l,"/v3/plattaruser/login/google/callback","GET");return t.length>0?t[0]:null}async loginMicrosoftCallback(){const t=await this._Fetch(new l,"/v3/plattaruser/login/microsoft/callback","GET");return t.length>0?t[0]:null}async logout(){const t=await this._Fetch(new l,"/v3/plattaruser/logout","GET");return t.length>0?t[0]:null}async attributes(){const t=await this._Fetch(new c.Attributes,"/v3/plattaruser/attributes","GET");return t.length>0?t[0]:null}async count(){const t=await this._Fetch(new a.Count,"/v3/plattaruser/count","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/plattaruser/${this.instance.id}`,e=await this._Fetch(new l,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/plattaruser/${this.instance.id}/:by`.replace(":by",t.by),r=await this._Fetch(new l,e,"GET");return r.length>0?r[0]:null}async update(){const t=`/v3/plattaruser/${this.instance.id}`,e=await this._Fetch(new l,t,"PATCH");return e.length>0?e[0]:null}}e.PlattarUserQueryDynamic=u;class l extends i.CoreObject{static get type(){return"plattaruser"}static query(t){return new o(new l,t)}query(t){return new u(this,t)}}e.PlattarUser=l,i.GlobalObjectPool.register(l)},949:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SocialAuth=e.SocialAuthQueryDynamic=e.SocialAuthQueryStatic=void 0;const n=r(772),s=r(643);class c extends s.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/socialauth/attributes","GET");return t.length>0?t[0]:null}async list(){return await this._Fetch(new i,"/v3/socialauth","GET")}async get(t){const e="/v3/socialauth/:id".replace(":id",t.id),r=await this._Fetch(new i,e,"GET");return r.length>0?r[0]:null}async refer(t){const e="/v3/socialauth/:id/:by".replace(":id",t.id).replace(":by",t.by),r=await this._Fetch(new i,e,"GET");return r.length>0?r[0]:null}}e.SocialAuthQueryStatic=c;class a extends s.CoreQuery{async attributes(){const t=await this._Fetch(new n.Attributes,"/v3/socialauth/attributes","GET");return t.length>0?t[0]:null}async get(){const t=`/v3/socialauth/${this.instance.id}`,e=await this._Fetch(new i,t,"GET");return e.length>0?e[0]:null}async refer(t){const e=`/v3/socialauth/${this.instance.id}/:by`.replace(":by",t.by),r=await this._Fetch(new i,e,"GET");return r.length>0?r[0]:null}}e.SocialAuthQueryDynamic=a;class i extends s.CoreObject{static get type(){return"socialauth"}static query(t){return new c(new i,t)}query(t){return new a(this,t)}}e.SocialAuth=i,s.GlobalObjectPool.register(i)},478:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreObject=void 0;const n=r(793),s=r(168);e.CoreObject=class{_attributes;_relations;_id;constructor(t,e){this._id=t||null,this._attributes=e||{},this._relations=new s.CoreObjectRelations(this)}get attributes(){return this._attributes}get relationships(){return this._relations}get payload(){return{data:{attributes:this.attributes}}}get id(){if(!this._id)throw new Error("CoreObject.id is not configured, use constructor with a non-null id");return this._id}hasID(){return!!this._id}static get type(){throw new Error("CoreObject.type is not implemented, contact admin")}static newInstance(){return new this}get type(){return this.constructor.type}static include(...t){const e=t.map((t=>Array.isArray(t)?t.map((t=>`${this.type}.${t}`)):`${this.type}.${t.type}`)),r=new Array;return e.forEach((t=>{Array.isArray(t)?r.push(...t):r.push(t)})),r}setFromAPI(t){if(this.type!==t.object.type)throw new Error(`CoreObject.setFromAPI() - type mismatch, cannot set ${this.type} from data type ${t.object.type}`);if(this.relationships.cache.clear(),this._id=t.object.id,Object.keys(this._attributes).forEach((t=>delete this._attributes[t])),t.object.attributes)for(const[e,r]of Object.entries(t.object.attributes))this._attributes[e]=r;if(t.object.relationships)for(const[e,r]of Object.entries(t.object.relationships)){const e=r.data;Array.isArray(e)?e.forEach((e=>{this._CreateRecord(t,e)})):this._CreateRecord(t,e)}}_CreateRecord(t,e){if(!t.includes.get(e.id))return;const r=t.cache.get(e.id);if(r)return void this.relationships.cache.append(r);const s=n.GlobalObjectPool.newInstance(e.type);if(!s)throw new Error(`record constructor is unable to create a new record of type ${e.type}`);t.cache.set(e.id,s),s.setFromAPI({object:e,includes:t.includes,cache:t.cache}),this.relationships.cache.append(s)}}},793:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalObjectPool=void 0;class r{static _globalMap=new Map;static register(t){return this._globalMap.set(t.type,t),this}static get(t){return this._globalMap.get(t)||null}static newInstance(t){const e=this.get(t);return e?e.newInstance():null}}e.GlobalObjectPool=r},753:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreFileQuery=void 0;const n=r(256);class s extends n.CoreQuery{async upload(t,e){if(!this.instance.hasID())throw new Error("CoreQuery.upload() - cannot upload a file using an uninitialized instance");const r=await fetch(`${this.service.url}/${this.instance.type}/${this.instance.id}/upload`,{headers:{"Content-Type":"application/json"},credentials:"include",method:"post",mode:"cors",body:JSON.stringify({data:{attributes:{key:t,filename:e.name}}})}),n=await r.json();if(n.error)throw new Error(`CoreQuery.upload() - upload request status ${n.status} - error - ${n.title} - ${n.text}`);const s=n.data.id,c=n.data.type;await fetch(n.data.attributes.url,{method:"put",body:e});const a=await fetch(`${this.service.url}/${c}/${s}`,{method:"get"}),i=await a.json();if(i.error)throw new Error(`CoreQuery.upload() - refresh request status ${i.status} - error - ${i.title} - ${i.text}`);return this.instance.setFromAPI(i),this.instance}}e.CoreFileQuery=s},256:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreQuery=void 0;const n=r(793),s=r(928),c=r(927),a=r(14),i=r(688),o=r(671),u=r(851),l=r(931),h=r(920),d=r(562),y=r(454),p=r(206),w=r(50),g=r(362);class b{_instance;_service;_queries;_abort;constructor(t,e){this._instance=t,this._service=e||s.Service.default,this._queries=new Array,this._abort=new AbortController}get instance(){return this._instance}get service(){return this._service}abort(t){this._abort.abort(t)}join(...t){return t.forEach((t=>{const e=t.toString();""!==e&&this._queries.push(new y.JoinQuery(e))})),this}where(t,e,r){switch(e){case"like":case"~=":this._queries.push(new w.SearchQuery(this.instance.type,t,r instanceof Date?r.toISOString():r));break;default:this._queries.push(new h.FilterQuery(this.instance.type,t,e,r instanceof Date?r.toISOString():r))}return this}fields(...t){const e=t.map((t=>t));return this._queries.push(new l.FieldsQuery(this.instance.type,e)),this}include(...t){const e=t.map((t=>Array.isArray(t)?t.map((t=>`${this.instance.type}.${t}`)):t instanceof b?(this.join(t),`${this.instance.type}.${t.instance.type}`):`${this.instance.type}.${t.type}`));return this._queries.push(new d.IncludeQuery(e.flat())),this}contains(...t){const e=t.map((t=>t.type));return this._queries.push(new o.ContainsQuery("==",e)),this}notContains(...t){const e=t.map((t=>t.type));return this._queries.push(new o.ContainsQuery("!=",e)),this}deleted(...t){const e=t.map((t=>t.type));return this._queries.push(new u.DeletedQuery(e)),this}sort(t,e){return this._queries.push(new g.SortQuery(t,this.instance.type,e)),this}page(t,e){return this._queries.push(new p.PaginationQuery(t,e)),this}async _Fetch(t,e,r){return b.fetch(this.service,this.instance,t,encodeURI(`${e}${this._queries.length>0?`?${this.toString()}`:""}`),r,this._abort.signal)}toString(){const t=this._queries;if(t.length<=0)return"";let e="";return t.forEach((t=>{const r=t.toString();""!==r&&(e+=`${r}&`)})),e.slice(0,-1)}static async fetch(t,e,r,s,o,u){const l=new Array,h=`${await c.DNS.resolveLocalhost(t.config.url)}${s}`;if(!fetch)return i.CoreError.init(h,{error:{title:"Runtime Error",text:`native fetch api not available, uprade your ${a.Util.isNode()?"NodeJS":"Browser"} environment`}}).handle(t),l;if(!await t.checkHealth())return i.CoreError.init(h,{error:{title:"Network Error",text:"configured service.url is not healthy and cannot be reached, check host status"}}).handle(t),l;const d={"Content-Type":"application/json",Accept:"application/json"},y={method:o,mode:"cors",cache:"no-cache",redirect:"follow",referrerPolicy:"origin"};if(a.Util.isNode())switch(t.config.auth.type){case"cookie":t.config.auth.token&&(d.cookie=t.config.auth.token);break;case"token":t.config.auth.token&&(d.Authorization=`Bearer ${t.config.auth.token}`)}else switch(t.config.auth.type){case"cookie":y.credentials="include";break;case"token":t.config.auth.token&&(d.Authorization=`Bearer ${t.config.auth.token}`)}switch(y.headers=d,o){case"POST":case"PUT":case"PATCH":y.body=JSON.stringify(e.payload)}u&&(y.signal=u);let p=null;try{p=await this._ExpFetch(t,h,y,0,u)}catch(e){return e.handle(t),l}if(408===p.status)return i.CoreError.init(h,{error:{status:408,title:"Request Timeout",text:"request timed out"}}).handle(t),l;let w=null;try{w=await p.json()}catch(e){return i.CoreError.init(h,{error:{title:"Runtime Error",text:`something unexpected occured during results parsing, details - ${e.message}`}}).handle(t),l}if(!w)return i.CoreError.init(h,{error:{title:"Runtime Error",text:"runtime expected json results from fetch to be non-null"}}).handle(t),l;if(w.error)return i.CoreError.init(h,w).handle(t),l;if(!w.data)return i.CoreError.init(h,{error:{title:"Runtime Error",text:"runtime tried to parse malformed json data"}}).handle(t),l;const g=w.included||new Array,b=new Map;if(g.forEach((t=>{t.id&&b.set(t.id,t)})),Array.isArray(w.data)){const e=w.data;if(e.length<=0)return l;const s=new Map,c=e[0];s.set(c.id,r),r.setFromAPI({object:c,includes:b,cache:s}),l.push(r);for(let r=1;r<e.length;r++){const a=e[r],o=s.get(c.id)||n.GlobalObjectPool.newInstance(a.type);o?(s.set(a.id,o),o.setFromAPI({object:e[r],includes:b,cache:s}),l.push(o)):i.CoreError.init(h,{error:{title:"Runtime Error",text:`runtime could not create a new instance of object type ${a.type} at index ${r}`}}).handle(t)}}else{const t=w.data;if(!t.type||!t.id)return l;const e=new Map;e.set(t.id,r),r.setFromAPI({object:t,includes:b,cache:e}),l.push(r)}return l}static async _ExpFetch(t,e,r,n,s){let c=null;try{c=await fetch(e,r)}catch(t){if(s&&s.aborted)throw i.CoreError.init(e,{error:{title:"Aborted",text:"request was manually aborted"}});throw i.CoreError.init(e,{error:{title:"Runtime Error",text:`something unexpected occured during runtime, details - ${t.message}`}})}if(!c)throw i.CoreError.init(e,{error:{title:"Runtime Error",text:"something unexpected occured during runtime, request instance was null"}});if(!c.ok){const c=n+1;if(t.config.options.retry.tries>=c)return await a.Util.sleep(a.Util.expoBackoffTime(c)),this._ExpFetch(t,e,r,c,s)}return c}}e.CoreQuery=b},688:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreError=void 0;class r extends Error{_json;_source;constructor(t,e){super(`Error - (${e.error.title})${e.error.status&&e.error.status>0?` Status - (${e.error.status})`:""} Source - (${t}) Message - (${e.error.text})`),this._json=e,this._source=t}static init(t,e){return new r(t,e)}get status(){return this._json.error.status?this._json.error.status:0}get title(){return this._json.error.title}get text(){return this._json.error.text}get source(){return this._source}handle(t){try{t.config.options.errorListener(this)}catch(t){}switch(t.config.options.errorHandler){case"console.error":console.error(this.message);break;case"console.warn":console.warn(this.message);break;case"throw":throw this}}}e.CoreError=r},671:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContainsQuery=void 0;const n=r(515);class s extends n.Query{operation;objects;constructor(t,e){super(),this.operation="=="===t||"="===t?"eq":"ne",this.objects=e||[]}toString(){let t=",";return this.objects.length>0&&(t=`contains[${this.operation}]=`,this.objects.forEach((e=>{t+=`${e},`}))),t.slice(0,-1)}}e.ContainsQuery=s},851:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DeletedQuery=void 0;const n=r(515);class s extends n.Query{objects;constructor(t){super(),this.objects=t||[]}toString(){let t=",";return this.objects.length>0&&(t="deleted=",this.objects.forEach((e=>{t+=`${e},`}))),t.slice(0,-1)}}e.DeletedQuery=s},931:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FieldsQuery=void 0;const n=r(515);class s extends n.Query{attributes;object;constructor(t,e){super(),this.attributes=e||[],this.object=t}toString(){let t=",";return this.attributes.length>0&&(t=`fields[${this.object}]=`,this.attributes.forEach((e=>{t+=`${e},`}))),t.slice(0,-1)}}e.FieldsQuery=s},920:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FilterQuery=void 0;const n=r(515);class s extends n.Query{variable;operator;value;target;constructor(t,e,r,n){switch(super(),this.target=t,this.variable=e,this.value=n,r){case"=":case"==":default:this.operator="eq";break;case"!=":this.operator="ne";break;case"<":this.operator="lt";break;case">":this.operator="gt";break;case"<=":this.operator="le";break;case">=":this.operator="ge"}}toString(){return`filter[${this.target}.${this.variable}][${this.operator}]=${this.value}`}}e.FilterQuery=s},562:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IncludeQuery=void 0;const n=r(515);class s extends n.Query{objects;constructor(t){super(),this.objects=t||[]}toString(){let t=",";return this.objects.length>0&&(t="include=",this.objects.forEach((e=>{t+=`${e},`}))),t.slice(0,-1)}}e.IncludeQuery=s},454:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.JoinQuery=void 0;const n=r(515);class s extends n.Query{query;constructor(t){super(),this.query=t}toString(){return this.query}}e.JoinQuery=s},206:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PaginationQuery=void 0;const n=r(515);class s extends n.Query{count;size;constructor(t,e){super(),this.count=t||0,this.size=e||10}toString(){return`page[count]=${this.count}&page[size]=${this.size}`}}e.PaginationQuery=s},515:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Query=void 0,e.Query=class{}},50:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SearchQuery=void 0;const n=r(515);class s extends n.Query{variable;value;target;constructor(t,e,r){super(),this.target=t,this.variable=e,this.value=r}toString(){return`query[${this.target}.${this.variable}]=${this.value}`}}e.SearchQuery=s},362:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SortQuery=void 0;const n=r(515);class s extends n.Query{operation;object;attribute;constructor(t,e,r){switch(super(),t){case"asc":case"ascending":default:this.operation="";break;case"desc":case"descending":this.operation="-"}this.object=e,this.attribute=r}toString(){return`sort=${this.object}.${this.operation}${this.attribute}`}}e.SortQuery=s},168:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreObjectRelations=e.RelationCache=void 0;const n=r(256),s=r(928);class c{_cache=new Map;checkStatus(t){return this._cache.has(t.type)}clear(...t){t.length<=0?this._cache.clear():t.forEach((t=>{this._cache.delete(t.type)}))}put(t,e){this._cache.set(t,e)}append(t){const e=this._cache.get(t.type);e?e.push(t):this.put(t.type,[t])}get(t,e,r){const n=r||new Array,s=this._cache.get(t.type);return!s||s.length<=0||(e?s.forEach((t=>{try{e(t)&&n.push(t)}catch(t){}})):n.push(...s)),n}first(t,e){const r=this.get(t,e);return r.length>0?r[0]:null}}e.RelationCache=c,e.CoreObjectRelations=class{_instance;_cache;constructor(t){this._instance=t,this._cache=new c}get cache(){return this._cache}async get(t,e,r){if(this.cache.checkStatus(t))return this.cache.get(t,e);const c=r||s.Service.default,a=t.newInstance(),i=await n.CoreQuery.fetch(c,a,a,`${c.url}/${this._instance.type}/${this._instance.id}/${t.type}`,"GET");return this.cache.put(t.type,i),this.cache.get(t,e)}async first(t,e){const r=await this.get(t,e);return r.length>0?r[0]:null}}},928:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Service=void 0;const n=r(927),s=r(14);class c{static _defaultServiceInstance;_config;_health;constructor(t){this._config=Object.freeze({url:t.url,options:{version:t.options&&t.options.version?`v${t.options.version}`:"v3",tls:!(!t.options||!t.options.tls)&&s.Util.parseBool(t.options.tls),gzip:!(!t.options||!t.options.gzip)&&s.Util.parseBool(t.options.gzip),errorHandler:t.options&&t.options.errorHandler?t.options.errorHandler:"console.error",errorListener:t.options&&t.options.errorListener&&s.Util.isFunction(t.options.errorListener)?t.options.errorListener:t=>{},retry:t.options&&t.options.retry?{tries:s.Util.clamp(t.options.retry.tries,0,10)}:{tries:3}},auth:{type:t.auth&&t.auth.type?t.auth.type:"none",token:t.auth&&t.auth.token?t.auth.token:null}}),this._health=s.Util.isNode()&&t.options&&t.options.healthCheck?null:{status:!0},s.Util.isNode()&&(this._config.options.tls?process.env.NODE_TLS_REJECT_UNAUTHORIZED="1":process.env.NODE_TLS_REJECT_UNAUTHORIZED="0")}static config(t){return c._defaultServiceInstance=new c(t),c._defaultServiceInstance}static get default(){if(!c._defaultServiceInstance)throw new Error("Service.default is not configured, use Service.config() to set a new default");return c._defaultServiceInstance}async checkHealth(t=!1){return this._health||(this._health={status:await n.DNS.check(this.config.url,t)}),this._health.status}get config(){return this._config}get url(){return`${this.config.url}/${this.config.options.version}`}}e.Service=c},927:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return s(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.DNS=void 0;const a=r(14);class i{static _DNSCache=new Map;static check(t,e=!1){return new Promise(((n,s)=>{if(!a.Util.isNode())return n(!0);if(!e){const e=i._DNSCache.get(t);if(e)return n(e.status)}Promise.resolve().then((()=>c(r(858)))).then((e=>{const r=new URL(t);e.lookup(r.hostname,(e=>{const r=!e;i._DNSCache.set(t,{status:r}),n(r)}))})).catch((e=>{i._DNSCache.set(t,{status:!1}),n(!1)}))}))}static resolveLocalhost(t){return new Promise(((e,n)=>{if(!a.Util.isNode())return e(t);const s=new URL(t);return"localhost"!==s.hostname?e(t):a.Util.isDocker()?e(`${s.protocol}//host.docker.internal${""!==s.port?`:${s.port}`:""}${"/"!==s.pathname?s.pathname:""}`):void Promise.resolve().then((()=>c(r(457)))).then((r=>{const n=r.networkInterfaces(),c={};for(const t of Object.keys(n))for(const e of n[t]){const r="string"==typeof e.family?"IPv4":4;e.family!==r||e.internal||(c[t]||(c[t]=[]),c[t].push(e.address))}const a=c.en0&&c.en0.length>0?c.en0[0]:null;return e(a?`${s.protocol}//${a}${""!==s.port?`:${s.port}`:""}${"/"!==s.pathname?s.pathname:""}`:t)})).catch((r=>{e(t)}))}))}}e.DNS=i},14:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Util=void 0;class r{static expoBackoffTime(t){return r.getRandomBetween(0,Math.min(500,15*(2<<t-1)))}static getRandomBetween(t,e){const r=Math.ceil(t),n=Math.floor(e);return Math.floor(Math.random()*(n-r+1)+r)}static clamp(t,e,r){return t?Math.min(Math.max(t,e),r):e}static isNode(){return"undefined"!=typeof process&&"node"===process.release.name}static isDocker(){return!(!r.isNode()||!process.env.LAMBDA_TASK_ROOT)}static parseBool(t){return!!t&&("string"==typeof t||t instanceof String?"true"===t.toLowerCase():!0===t)}static isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)}static sleep(t){return new Promise(((e,r)=>{setTimeout(e,t)}))}}e.Util=r},643:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),s=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),s(r(928),e),s(r(478),e),s(r(793),e),s(r(753),e),s(r(256),e),s(r(688),e)},858:t=>{t.exports=dns},457:t=>{t.exports=os}},e={},r=function r(n){var s=e[n];if(void 0!==s)return s.exports;var c=e[n]={exports:{}};return t[n].call(c.exports,c,c.exports,r),c.exports}(806);Auth=r})(); | ||
//# sourceMappingURL=bundle.min.js.map |
@@ -8,5 +8,5 @@ export { Service, ServiceConfig, ServiceAuth, ServiceOptions, ServiceAuthType, ServiceErrorHandler, ServiceErrorListener, CoreError } from '@plattar/sdk-core'; | ||
export * from "./schemas/plattar-user"; | ||
export * from "./schemas/account-member"; | ||
export * from "./schemas/access"; | ||
export * from "./schemas/account-member"; | ||
export * from "./schemas/account-access"; | ||
export * from "./schemas/account-access-result"; |
@@ -30,5 +30,5 @@ "use strict"; | ||
__exportStar(require("./schemas/plattar-user"), exports); | ||
__exportStar(require("./schemas/account-member"), exports); | ||
__exportStar(require("./schemas/access"), exports); | ||
__exportStar(require("./schemas/account-member"), exports); | ||
__exportStar(require("./schemas/account-access"), exports); | ||
__exportStar(require("./schemas/account-access-result"), exports); |
@@ -0,1 +1,3 @@ | ||
import { Account } from './account'; | ||
import { AccountMember } from './account-member'; | ||
import { Attributes } from './attributes'; | ||
@@ -18,2 +20,11 @@ import { Count } from './count'; | ||
export declare class PlattarUserQueryStatic extends CoreQuery<PlattarUser, PlattarUserAttributes> { | ||
accounts(params: { | ||
id: string; | ||
}): Promise<Array<Account>>; | ||
accountmembers(params: { | ||
id: string; | ||
}): Promise<Array<AccountMember>>; | ||
users(params: { | ||
id: string; | ||
}): Promise<Array<PlattarUser>>; | ||
login(): Promise<PlattarUser | null>; | ||
@@ -20,0 +31,0 @@ register(): Promise<PlattarUser | null>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PlattarUser = exports.PlattarUserQueryDynamic = exports.PlattarUserQueryStatic = void 0; | ||
const account_1 = require("./account"); | ||
const account_member_1 = require("./account-member"); | ||
const attributes_1 = require("./attributes"); | ||
@@ -8,2 +10,14 @@ const count_1 = require("./count"); | ||
class PlattarUserQueryStatic extends sdk_core_1.CoreQuery { | ||
async accounts(params) { | ||
const url = `/v3/plattaruser/:id/accounts`.replace(':id', params.id); | ||
return await this._Fetch(new account_1.Account(), url, 'GET'); | ||
} | ||
async accountmembers(params) { | ||
const url = `/v3/plattaruser/:id/accountmembers`.replace(':id', params.id); | ||
return await this._Fetch(new account_member_1.AccountMember(), url, 'GET'); | ||
} | ||
async users(params) { | ||
const url = `/v3/plattaruser/:id/plattarusers`.replace(':id', params.id); | ||
return await this._Fetch(new PlattarUser(), url, 'GET'); | ||
} | ||
async login() { | ||
@@ -10,0 +24,0 @@ const url = `/v3/plattaruser/login`; |
{ | ||
"name": "@plattar/auth-sdk", | ||
"version": "1.169.2", | ||
"version": "1.169.3", | ||
"description": "Generated using @plattar/sdk-core and used for interfacing with auth backend service", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,3 +5,3 @@ [](https://www.npmjs.com/package/@plattar/auth-sdk) | ||
auth-sdk v1.169.2 is automatically generated using [sdk-core](https://www.npmjs.com/package/@plattar/sdk-core) module | ||
auth-sdk v1.169.3 is automatically generated using [sdk-core](https://www.npmjs.com/package/@plattar/sdk-core) module | ||
@@ -8,0 +8,0 @@ ### Installation |
Sorry, the diff of this file is not supported yet
216860
1.18%1343
1.97%