@plattar/auth-sdk
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
var Auth;(()=>{"use strict";var t={736: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 a=n(520);Object.defineProperty(e,"Service",{enumerable:!0,get:function(){return a.Service}}),Object.defineProperty(e,"CoreError",{enumerable:!0,get:function(){return a.CoreError}}),s(n(684),e),s(n(444),e),s(n(704),e),s(n(548),e),s(n(440),e),s(n(480),e),s(n(0),e),s(n(624),e)},0:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Access=e.AccessQueryDynamic=e.AccessQueryStatic=void 0;const r=n(444),s=n(548),a=n(520);class i extends a.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(){const t=`/v3/access/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async recover(){const t=`/v3/access/${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/access/${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/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 delete(){const t=`/v3/access/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.AccessQueryStatic=i;class c extends a.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 recover(){const t=`/v3/access/${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/access/${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/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 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=c;class o extends a.CoreObject{static get type(){return"access"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.Access=o,a.GlobalObjectPool.register(o)},624:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AccountMember=e.AccountMemberQueryDynamic=e.AccountMemberQueryStatic=void 0;const r=n(444),s=n(548),a=n(520);class i extends a.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(){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.AccountMemberQueryStatic=i;class c extends a.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=c;class o extends a.CoreObject{static get type(){return"accountmember"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.AccountMember=o,a.GlobalObjectPool.register(o)},440:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Account=e.AccountQueryDynamic=e.AccountQueryStatic=void 0;const r=n(444),s=n(548),a=n(520);class i extends a.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(){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}}e.AccountQueryStatic=i;class c extends a.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}}e.AccountQueryDynamic=c;class o extends a.CoreObject{static get type(){return"account"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.Account=o,a.GlobalObjectPool.register(o)},444:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Attributes=e.AttributesQueryDynamic=e.AttributesQueryStatic=void 0;const r=n(520);class s extends r.CoreQuery{}e.AttributesQueryStatic=s;class a extends r.CoreQuery{}e.AttributesQueryDynamic=a;class i extends r.CoreObject{static get type(){return"attributes"}static query(t){return new s(new i,t)}query(t){return new a(this,t)}}e.Attributes=i,r.GlobalObjectPool.register(i)},548:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Count=e.CountQueryDynamic=e.CountQueryStatic=void 0;const r=n(520);class s extends r.CoreQuery{}e.CountQueryStatic=s;class a extends r.CoreQuery{}e.CountQueryDynamic=a;class i extends r.CoreObject{static get type(){return"count"}static query(t){return new s(new i,t)}query(t){return new a(this,t)}}e.Count=i,r.GlobalObjectPool.register(i)},704:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=e.PlanQueryDynamic=e.PlanQueryStatic=void 0;const r=n(444),s=n(548),a=n(520);class i extends a.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(){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.PlanQueryStatic=i;class c extends a.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=c;class o extends a.CoreObject{static get type(){return"plan"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.Plan=o,a.GlobalObjectPool.register(o)},480:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PlattarUser=e.PlattarUserQueryDynamic=e.PlattarUserQueryStatic=void 0;const r=n(444),s=n(548),a=n(520);class i extends a.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(){const t=`/v3/plattaruser/${this.instance.id}`,e=await this._Fetch(new o,t,"GET");return e.length>0?e[0]:null}async recover(){const t=`/v3/plattaruser/${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/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 create(){const t=await this._Fetch(new o,"/v3/plattaruser","POST");return t.length>0?t[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}async delete(){const t=`/v3/plattaruser/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.PlattarUserQueryStatic=i;class c extends a.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 recover(){const t=`/v3/plattaruser/${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/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 create(){const t=await this._Fetch(new o,"/v3/plattaruser","POST");return t.length>0?t[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}async delete(){const t=`/v3/plattaruser/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.PlattarUserQueryDynamic=c;class o extends a.CoreObject{static get type(){return"plattaruser"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.PlattarUser=o,a.GlobalObjectPool.register(o)},684:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SocialAuth=e.SocialAuthQueryDynamic=e.SocialAuthQueryStatic=void 0;const r=n(444),s=n(520);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 list(){return await this._Fetch(new c,"/v3/socialauth","GET")}async get(){const t=`/v3/socialauth/${this.instance.id}`,e=await this._Fetch(new c,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 c,e,"GET");return n.length>0?n[0]:null}}e.SocialAuthQueryStatic=a;class i 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 c,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 c,e,"GET");return n.length>0?n[0]:null}}e.SocialAuthQueryDynamic=i;class c extends s.CoreObject{static get type(){return"socialauth"}static query(t){return new a(new c,t)}query(t){return new i(this,t)}}e.SocialAuth=c,s.GlobalObjectPool.register(c)},312:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreObject=void 0;const r=n(372),s=n(276);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)}}},372:(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},901:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreFileQuery=void 0;const r=n(516);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,a=r.data.type;await fetch(r.data.attributes.url,{method:"put",body:e});const i=await fetch(`${this.service.url}/${a}/${s}`,{method:"get"}),c=await i.json();if(c.error)throw new Error(`CoreQuery.upload() - refresh request status ${c.status} - error - ${c.title} - ${c.text}`);return this.instance.setFromAPI(c),this.instance}}e.CoreFileQuery=s},516:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreQuery=void 0;const r=n(372),s=n(815),a=n(824),i=n(700),c=n(956),o=n(996),u=n(319),l=n(236),h=n(868),y=n(464),d=n(596),p=n(352),w=n(32);class g{_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 p.SearchQuery(this.instance.type,t,n instanceof Date?n.toISOString():n));break;default:this._queries.push(new l.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 u.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 g?(this.join(t),`${this.instance.type}.${t.instance.type}`):`${this.instance.type}.${t.type}`));return this._queries.push(new h.IncludeQuery(e.flat())),this}contains(...t){const e=t.map((t=>t.type));return this._queries.push(new c.ContainsQuery("==",e)),this}notContains(...t){const e=t.map((t=>t.type));return this._queries.push(new c.ContainsQuery("!=",e)),this}deleted(...t){const e=t.map((t=>t.type));return this._queries.push(new o.DeletedQuery(e)),this}sort(t,e){return this._queries.push(new w.SortQuery(t,this.instance.type,e)),this}page(t,e){return this._queries.push(new d.PaginationQuery(t,e)),this}async _Fetch(t,e,n){return g.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,c,o){const u=new Array,l=`${t.config.url}${s}`;if(!fetch)return i.CoreError.init(l,{error:{title:"Runtime Error",text:`native fetch api not available, uprade your ${a.Util.isNode()?"NodeJS":"Browser"} environment`}}).handle(t),u;if(!await t.checkHealth())return i.CoreError.init(l,{error:{title:"Network Error",text:"configured service hostname is not healthy and cannot be reached, check host status"}}).handle(t),u;const h={"Content-Type":"application/json",Accept:"application/json"},y={method:c,mode:"cors",cache:"no-cache",redirect:"follow",referrerPolicy:"origin"};if(a.Util.isNode())switch(t.config.auth.type){case"cookie":t.config.auth.token&&(h.cookie=t.config.auth.token);break;case"token":t.config.auth.token&&(h.Authorization=`Bearer ${t.config.auth.token}`)}else switch(t.config.auth.type){case"cookie":y.credentials="include";break;case"token":t.config.auth.token&&(h.Authorization=`Bearer ${t.config.auth.token}`)}switch(y.headers=h,c){case"POST":case"PUT":case"PATCH":y.body=JSON.stringify(e.payload)}o&&(y.signal=o);let d=null;try{d=await this._ExpFetch(t,l,y,0,o)}catch(e){return e.handle(t),u}if(408===d.status)return i.CoreError.init(l,{error:{status:408,title:"Request Timeout",text:"request timed out"}}).handle(t),u;let p=null;try{p=await d.json()}catch(e){return i.CoreError.init(l,{error:{title:"Runtime Error",text:`something unexpected occured during results parsing, details - ${e.message}`}}).handle(t),u}if(!p)return i.CoreError.init(l,{error:{title:"Runtime Error",text:"runtime expected json results from fetch to be non-null"}}).handle(t),u;if(p.error)return i.CoreError.init(l,p).handle(t),u;if(!p.data)return i.CoreError.init(l,{error:{title:"Runtime Error",text:"runtime tried to parse malformed json data"}}).handle(t),u;const w=p.included||new Array,g=new Map;if(w.forEach((t=>{t.id&&g.set(t.id,t)})),Array.isArray(p.data)){const e=p.data;if(e.length<=0)return u;const s=new Map,a=e[0];s.set(a.id,n),n.setFromAPI({object:a,includes:g,cache:s}),u.push(n);for(let n=1;n<e.length;n++){const c=e[n],o=s.get(a.id)||r.GlobalObjectPool.newInstance(c.type);o?(s.set(c.id,o),o.setFromAPI({object:e[n],includes:g,cache:s}),u.push(o)):i.CoreError.init(l,{error:{title:"Runtime Error",text:`runtime could not create a new instance of object type ${c.type} at index ${n}`}}).handle(t)}}else{const t=p.data;if(!t.type||!t.id)return u;const e=new Map;e.set(t.id,n),n.setFromAPI({object:t,includes:g,cache:e}),u.push(n)}return u}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 i=r+1;if(t.config.options.retry.tries>=i)return await a.Util.sleep(a.Util.expoBackoffTime(i)),this._ExpFetch(t,e,n,i,s)}return c}}e.CoreQuery=g},700:(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},956:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContainsQuery=void 0;const r=n(616);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},996:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DeletedQuery=void 0;const r=n(616);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},319:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FieldsQuery=void 0;const r=n(616);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},236:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FilterQuery=void 0;const r=n(616);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},868:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IncludeQuery=void 0;const r=n(616);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},464:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.JoinQuery=void 0;const r=n(616);class s extends r.Query{query;constructor(t){super(),this.query=t}toString(){return this.query}}e.JoinQuery=s},596:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PaginationQuery=void 0;const r=n(616);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},616:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Query=void 0,e.Query=class{}},352:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SearchQuery=void 0;const r=n(616);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},32:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SortQuery=void 0;const r=n(616);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},276:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreObjectRelations=e.RelationCache=void 0;const r=n(516),s=n(815);class a{_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=a,e.CoreObjectRelations=class{_instance;_cache;constructor(t){this._instance=t,this._cache=new a}get cache(){return this._cache}async get(t,e,n){if(this.cache.checkStatus(t))return this.cache.get(t,e);const a=n||s.Service.default,i=t.newInstance(),c=await r.CoreQuery.fetch(a,i,i,`${a.url}/${this._instance.type}/${this._instance.id}/${t.type}`,"GET");return this.cache.put(t.type,c),this.cache.get(t,e)}async first(t,e){const n=await this.get(t,e);return n.length>0?n[0]:null}}},815:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Service=void 0;const r=n(824);class s{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)&&r.Util.parseBool(t.options.tls),gzip:!(!t.options||!t.options.gzip)&&r.Util.parseBool(t.options.gzip),errorHandler:t.options&&t.options.errorHandler?t.options.errorHandler:"console.error",errorListener:t.options&&t.options.errorListener&&r.Util.isFunction(t.options.errorListener)?t.options.errorListener:t=>{},retry:t.options&&t.options.retry?{tries:r.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=null,r.Util.isNode()&&(this._config.options.tls?process.env.NODE_TLS_REJECT_UNAUTHORIZED="1":process.env.NODE_TLS_REJECT_UNAUTHORIZED="0")}static config(t){return s._defaultServiceInstance=new s(t),s._defaultServiceInstance}static get default(){if(!s._defaultServiceInstance)throw new Error("Service.default is not configured, use Service.config() to set a new default");return s._defaultServiceInstance}async checkHealth(){return!r.Util.isNode()||(this._health||(this._health={status:await r.Util.dnsCheck(this.config.url)}),this._health.status)}get config(){return this._config}get url(){return`${this.config.url}/${this.config.options.version}`}}e.Service=s},824: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}),a=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.Util=void 0;class i{static expoBackoffTime(t){return i.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 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)}))}static dnsCheck(t){return new Promise(((e,r)=>{if(!i.isNode())return e(!0);Promise.resolve().then((()=>a(n(576)))).then((n=>{n.lookup(t,(t=>{e(!t)}))})).catch((()=>e(!1)))}))}}e.Util=i},520: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(815),e),s(n(312),e),s(n(372),e),s(n(901),e),s(n(516),e),s(n(700),e)},576:t=>{t.exports=dns}},e={},n=function n(r){var s=e[r];if(void 0!==s)return s.exports;var a=e[r]={exports:{}};return t[r].call(a.exports,a,a.exports,n),a.exports}(736);Auth=n})(); | ||
var Auth;(()=>{"use strict";var t={736: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 a=r(520);Object.defineProperty(e,"Service",{enumerable:!0,get:function(){return a.Service}}),Object.defineProperty(e,"CoreError",{enumerable:!0,get:function(){return a.CoreError}}),s(r(684),e),s(r(444),e),s(r(704),e),s(r(548),e),s(r(440),e),s(r(480),e),s(r(0),e),s(r(624),e)},0:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Access=e.AccessQueryDynamic=e.AccessQueryStatic=void 0;const n=r(444),s=r(548),a=r(520);class i extends a.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 recover(t){const e="/v3/access/: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/access/: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/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 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=i;class c extends a.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 recover(){const t=`/v3/access/${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/access/${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/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 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=c;class o extends a.CoreObject{static get type(){return"access"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.Access=o,a.GlobalObjectPool.register(o)},624:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AccountMember=e.AccountMemberQueryDynamic=e.AccountMemberQueryStatic=void 0;const n=r(444),s=r(548),a=r(520);class i extends a.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=i;class c extends a.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=c;class o extends a.CoreObject{static get type(){return"accountmember"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.AccountMember=o,a.GlobalObjectPool.register(o)},440:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Account=e.AccountQueryDynamic=e.AccountQueryStatic=void 0;const n=r(444),s=r(548),a=r(520);class i extends a.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}}e.AccountQueryStatic=i;class c extends a.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}}e.AccountQueryDynamic=c;class o extends a.CoreObject{static get type(){return"account"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.Account=o,a.GlobalObjectPool.register(o)},444:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Attributes=e.AttributesQueryDynamic=e.AttributesQueryStatic=void 0;const n=r(520);class s extends n.CoreQuery{}e.AttributesQueryStatic=s;class a extends n.CoreQuery{}e.AttributesQueryDynamic=a;class i extends n.CoreObject{static get type(){return"attributes"}static query(t){return new s(new i,t)}query(t){return new a(this,t)}}e.Attributes=i,n.GlobalObjectPool.register(i)},548:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Count=e.CountQueryDynamic=e.CountQueryStatic=void 0;const n=r(520);class s extends n.CoreQuery{}e.CountQueryStatic=s;class a extends n.CoreQuery{}e.CountQueryDynamic=a;class i extends n.CoreObject{static get type(){return"count"}static query(t){return new s(new i,t)}query(t){return new a(this,t)}}e.Count=i,n.GlobalObjectPool.register(i)},704:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=e.PlanQueryDynamic=e.PlanQueryStatic=void 0;const n=r(444),s=r(548),a=r(520);class i extends a.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=i;class c extends a.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=c;class o extends a.CoreObject{static get type(){return"plan"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.Plan=o,a.GlobalObjectPool.register(o)},480:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PlattarUser=e.PlattarUserQueryDynamic=e.PlattarUserQueryStatic=void 0;const n=r(444),s=r(548),a=r(520);class i extends a.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 n.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),r=await this._Fetch(new o,e,"GET");return r.length>0?r[0]:null}async recover(t){const e="/v3/plattaruser/: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/plattaruser/: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/plattaruser","POST");return t.length>0?t[0]:null}async update(t){const e="/v3/plattaruser/: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/plattaruser/:id".replace(":id",t.id),r=await this._Fetch(new o,e,"DELETE");return r.length>0?r[0]:null}}e.PlattarUserQueryStatic=i;class c extends a.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 n.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 recover(){const t=`/v3/plattaruser/${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/plattaruser/${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/plattaruser","POST");return t.length>0?t[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}async delete(){const t=`/v3/plattaruser/${this.instance.id}`,e=await this._Fetch(new o,t,"DELETE");return e.length>0?e[0]:null}}e.PlattarUserQueryDynamic=c;class o extends a.CoreObject{static get type(){return"plattaruser"}static query(t){return new i(new o,t)}query(t){return new c(this,t)}}e.PlattarUser=o,a.GlobalObjectPool.register(o)},684:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SocialAuth=e.SocialAuthQueryDynamic=e.SocialAuthQueryStatic=void 0;const n=r(444),s=r(520);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 list(){return await this._Fetch(new c,"/v3/socialauth","GET")}async get(t){const e="/v3/socialauth/:id".replace(":id",t.id),r=await this._Fetch(new c,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 c,e,"GET");return r.length>0?r[0]:null}}e.SocialAuthQueryStatic=a;class i 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 c,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 c,e,"GET");return r.length>0?r[0]:null}}e.SocialAuthQueryDynamic=i;class c extends s.CoreObject{static get type(){return"socialauth"}static query(t){return new a(new c,t)}query(t){return new i(this,t)}}e.SocialAuth=c,s.GlobalObjectPool.register(c)},312:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreObject=void 0;const n=r(372),s=r(276);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)}}},372:(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},901:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreFileQuery=void 0;const n=r(516);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,a=n.data.type;await fetch(n.data.attributes.url,{method:"put",body:e});const i=await fetch(`${this.service.url}/${a}/${s}`,{method:"get"}),c=await i.json();if(c.error)throw new Error(`CoreQuery.upload() - refresh request status ${c.status} - error - ${c.title} - ${c.text}`);return this.instance.setFromAPI(c),this.instance}}e.CoreFileQuery=s},516:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreQuery=void 0;const n=r(372),s=r(815),a=r(824),i=r(700),c=r(956),o=r(996),u=r(319),l=r(236),h=r(868),d=r(464),y=r(596),p=r(352),w=r(32);class g{_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 d.JoinQuery(e))})),this}where(t,e,r){switch(e){case"like":case"~=":this._queries.push(new p.SearchQuery(this.instance.type,t,r instanceof Date?r.toISOString():r));break;default:this._queries.push(new l.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 u.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 g?(this.join(t),`${this.instance.type}.${t.instance.type}`):`${this.instance.type}.${t.type}`));return this._queries.push(new h.IncludeQuery(e.flat())),this}contains(...t){const e=t.map((t=>t.type));return this._queries.push(new c.ContainsQuery("==",e)),this}notContains(...t){const e=t.map((t=>t.type));return this._queries.push(new c.ContainsQuery("!=",e)),this}deleted(...t){const e=t.map((t=>t.type));return this._queries.push(new o.DeletedQuery(e)),this}sort(t,e){return this._queries.push(new w.SortQuery(t,this.instance.type,e)),this}page(t,e){return this._queries.push(new y.PaginationQuery(t,e)),this}async _Fetch(t,e,r){return g.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,c,o){const u=new Array,l=`${t.config.url}${s}`;if(!fetch)return i.CoreError.init(l,{error:{title:"Runtime Error",text:`native fetch api not available, uprade your ${a.Util.isNode()?"NodeJS":"Browser"} environment`}}).handle(t),u;if(!await t.checkHealth())return i.CoreError.init(l,{error:{title:"Network Error",text:"configured service.url is not healthy and cannot be reached, check host status"}}).handle(t),u;const h={"Content-Type":"application/json",Accept:"application/json"},d={method:c,mode:"cors",cache:"no-cache",redirect:"follow",referrerPolicy:"origin"};if(a.Util.isNode())switch(t.config.auth.type){case"cookie":t.config.auth.token&&(h.cookie=t.config.auth.token);break;case"token":t.config.auth.token&&(h.Authorization=`Bearer ${t.config.auth.token}`)}else switch(t.config.auth.type){case"cookie":d.credentials="include";break;case"token":t.config.auth.token&&(h.Authorization=`Bearer ${t.config.auth.token}`)}switch(d.headers=h,c){case"POST":case"PUT":case"PATCH":d.body=JSON.stringify(e.payload)}o&&(d.signal=o);let y=null;try{y=await this._ExpFetch(t,l,d,0,o)}catch(e){return e.handle(t),u}if(408===y.status)return i.CoreError.init(l,{error:{status:408,title:"Request Timeout",text:"request timed out"}}).handle(t),u;let p=null;try{p=await y.json()}catch(e){return i.CoreError.init(l,{error:{title:"Runtime Error",text:`something unexpected occured during results parsing, details - ${e.message}`}}).handle(t),u}if(!p)return i.CoreError.init(l,{error:{title:"Runtime Error",text:"runtime expected json results from fetch to be non-null"}}).handle(t),u;if(p.error)return i.CoreError.init(l,p).handle(t),u;if(!p.data)return i.CoreError.init(l,{error:{title:"Runtime Error",text:"runtime tried to parse malformed json data"}}).handle(t),u;const w=p.included||new Array,g=new Map;if(w.forEach((t=>{t.id&&g.set(t.id,t)})),Array.isArray(p.data)){const e=p.data;if(e.length<=0)return u;const s=new Map,a=e[0];s.set(a.id,r),r.setFromAPI({object:a,includes:g,cache:s}),u.push(r);for(let r=1;r<e.length;r++){const c=e[r],o=s.get(a.id)||n.GlobalObjectPool.newInstance(c.type);o?(s.set(c.id,o),o.setFromAPI({object:e[r],includes:g,cache:s}),u.push(o)):i.CoreError.init(l,{error:{title:"Runtime Error",text:`runtime could not create a new instance of object type ${c.type} at index ${r}`}}).handle(t)}}else{const t=p.data;if(!t.type||!t.id)return u;const e=new Map;e.set(t.id,r),r.setFromAPI({object:t,includes:g,cache:e}),u.push(r)}return u}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 i=n+1;if(t.config.options.retry.tries>=i)return await a.Util.sleep(a.Util.expoBackoffTime(i)),this._ExpFetch(t,e,r,i,s)}return c}}e.CoreQuery=g},700:(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},956:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContainsQuery=void 0;const n=r(616);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},996:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DeletedQuery=void 0;const n=r(616);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},319:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FieldsQuery=void 0;const n=r(616);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},236:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FilterQuery=void 0;const n=r(616);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},868:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IncludeQuery=void 0;const n=r(616);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},464:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.JoinQuery=void 0;const n=r(616);class s extends n.Query{query;constructor(t){super(),this.query=t}toString(){return this.query}}e.JoinQuery=s},596:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PaginationQuery=void 0;const n=r(616);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},616:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Query=void 0,e.Query=class{}},352:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SearchQuery=void 0;const n=r(616);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},32:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SortQuery=void 0;const n=r(616);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},276:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreObjectRelations=e.RelationCache=void 0;const n=r(516),s=r(815);class a{_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=a,e.CoreObjectRelations=class{_instance;_cache;constructor(t){this._instance=t,this._cache=new a}get cache(){return this._cache}async get(t,e,r){if(this.cache.checkStatus(t))return this.cache.get(t,e);const a=r||s.Service.default,i=t.newInstance(),c=await n.CoreQuery.fetch(a,i,i,`${a.url}/${this._instance.type}/${this._instance.id}/${t.type}`,"GET");return this.cache.put(t.type,c),this.cache.get(t,e)}async first(t,e){const r=await this.get(t,e);return r.length>0?r[0]:null}}},815:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Service=void 0;const n=r(656),s=r(824);class a{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()?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 a._defaultServiceInstance=new a(t),a._defaultServiceInstance}static get default(){if(!a._defaultServiceInstance)throw new Error("Service.default is not configured, use Service.config() to set a new default");return a._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=a},656: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}),a=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 i=r(824);class c{static _DNSCache=new Map;static check(t,e=!1){return new Promise(((n,s)=>{if(!i.Util.isNode())return n(!0);if(!e){const e=c._DNSCache.get(t);if(e)return n(e.status)}Promise.resolve().then((()=>a(r(576)))).then((e=>{e.lookup(t,(e=>{const r=!e;c._DNSCache.set(t,{status:r}),n(r)}))})).catch((()=>{c._DNSCache.set(t,{status:!1}),n(!1)}))}))}}e.DNS=c},824:(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 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},520: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(815),e),s(r(312),e),s(r(372),e),s(r(901),e),s(r(516),e),s(r(700),e)},576:t=>{t.exports=dns}},e={},r=function r(n){var s=e[n];if(void 0!==s)return s.exports;var a=e[n]={exports:{}};return t[n].call(a.exports,a,a.exports,r),a.exports}(736);Auth=r})(); | ||
//# sourceMappingURL=bundle.min.js.map |
@@ -13,10 +13,19 @@ import { Attributes } from './attributes'; | ||
count(): Promise<Count | null>; | ||
get(): Promise<Access | null>; | ||
recover(): Promise<Access | null>; | ||
get(params: { | ||
id: string; | ||
}): Promise<Access | null>; | ||
recover(params: { | ||
id: string; | ||
}): Promise<Access | null>; | ||
refer(params: { | ||
id: string; | ||
by: string; | ||
}): Promise<Access | null>; | ||
create(): Promise<Access | null>; | ||
update(): Promise<Access | null>; | ||
delete(): Promise<Access | null>; | ||
update(params: { | ||
id: string; | ||
}): Promise<Access | null>; | ||
delete(params: { | ||
id: string; | ||
}): Promise<Access | null>; | ||
} | ||
@@ -23,0 +32,0 @@ export declare class AccessQueryDynamic extends CoreQuery<Access, AccessAttributes> { |
@@ -22,9 +22,9 @@ "use strict"; | ||
} | ||
async get() { | ||
const url = `/v3/access/${this.instance.id}`; | ||
async get(params) { | ||
const url = `/v3/access/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Access(), url, 'GET'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async recover() { | ||
const url = `/v3/access/${this.instance.id}/recover`; | ||
async recover(params) { | ||
const url = `/v3/access/:id/recover`.replace(':id', params.id); | ||
const result = await this._Fetch(new Access(), url, 'GET'); | ||
@@ -34,3 +34,3 @@ return result.length > 0 ? result[0] : null; | ||
async refer(params) { | ||
const url = `/v3/access/${this.instance.id}/:by`.replace(':by', params.by); | ||
const url = `/v3/access/:id/:by`.replace(':id', params.id).replace(':by', params.by); | ||
const result = await this._Fetch(new Access(), url, 'GET'); | ||
@@ -44,9 +44,9 @@ return result.length > 0 ? result[0] : null; | ||
} | ||
async update() { | ||
const url = `/v3/access/${this.instance.id}`; | ||
async update(params) { | ||
const url = `/v3/access/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Access(), url, 'PATCH'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async delete() { | ||
const url = `/v3/access/${this.instance.id}`; | ||
async delete(params) { | ||
const url = `/v3/access/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Access(), url, 'DELETE'); | ||
@@ -53,0 +53,0 @@ return result.length > 0 ? result[0] : null; |
@@ -16,10 +16,19 @@ import { Attributes } from './attributes'; | ||
count(): Promise<Count | null>; | ||
get(): Promise<AccountMember | null>; | ||
recover(): Promise<AccountMember | null>; | ||
get(params: { | ||
id: string; | ||
}): Promise<AccountMember | null>; | ||
recover(params: { | ||
id: string; | ||
}): Promise<AccountMember | null>; | ||
refer(params: { | ||
id: string; | ||
by: string; | ||
}): Promise<AccountMember | null>; | ||
create(): Promise<AccountMember | null>; | ||
update(): Promise<AccountMember | null>; | ||
delete(): Promise<AccountMember | null>; | ||
update(params: { | ||
id: string; | ||
}): Promise<AccountMember | null>; | ||
delete(params: { | ||
id: string; | ||
}): Promise<AccountMember | null>; | ||
} | ||
@@ -26,0 +35,0 @@ export declare class AccountMemberQueryDynamic extends CoreQuery<AccountMember, AccountMemberAttributes> { |
@@ -22,9 +22,9 @@ "use strict"; | ||
} | ||
async get() { | ||
const url = `/v3/accountmember/${this.instance.id}`; | ||
async get(params) { | ||
const url = `/v3/accountmember/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new AccountMember(), url, 'GET'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async recover() { | ||
const url = `/v3/accountmember/${this.instance.id}/recover`; | ||
async recover(params) { | ||
const url = `/v3/accountmember/:id/recover`.replace(':id', params.id); | ||
const result = await this._Fetch(new AccountMember(), url, 'GET'); | ||
@@ -34,3 +34,3 @@ return result.length > 0 ? result[0] : null; | ||
async refer(params) { | ||
const url = `/v3/accountmember/${this.instance.id}/:by`.replace(':by', params.by); | ||
const url = `/v3/accountmember/:id/:by`.replace(':id', params.id).replace(':by', params.by); | ||
const result = await this._Fetch(new AccountMember(), url, 'GET'); | ||
@@ -44,9 +44,9 @@ return result.length > 0 ? result[0] : null; | ||
} | ||
async update() { | ||
const url = `/v3/accountmember/${this.instance.id}`; | ||
async update(params) { | ||
const url = `/v3/accountmember/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new AccountMember(), url, 'PATCH'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async delete() { | ||
const url = `/v3/accountmember/${this.instance.id}`; | ||
async delete(params) { | ||
const url = `/v3/accountmember/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new AccountMember(), url, 'DELETE'); | ||
@@ -53,0 +53,0 @@ return result.length > 0 ? result[0] : null; |
@@ -20,10 +20,19 @@ import { Attributes } from './attributes'; | ||
count(): Promise<Count | null>; | ||
get(): Promise<Account | null>; | ||
recover(): Promise<Account | null>; | ||
get(params: { | ||
id: string; | ||
}): Promise<Account | null>; | ||
recover(params: { | ||
id: string; | ||
}): Promise<Account | null>; | ||
refer(params: { | ||
id: string; | ||
by: string; | ||
}): Promise<Account | null>; | ||
create(): Promise<Account | null>; | ||
update(): Promise<Account | null>; | ||
delete(): Promise<Account | null>; | ||
update(params: { | ||
id: string; | ||
}): Promise<Account | null>; | ||
delete(params: { | ||
id: string; | ||
}): Promise<Account | null>; | ||
} | ||
@@ -30,0 +39,0 @@ export declare class AccountQueryDynamic extends CoreQuery<Account, AccountAttributes> { |
@@ -22,9 +22,9 @@ "use strict"; | ||
} | ||
async get() { | ||
const url = `/v3/account/${this.instance.id}`; | ||
async get(params) { | ||
const url = `/v3/account/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Account(), url, 'GET'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async recover() { | ||
const url = `/v3/account/${this.instance.id}/recover`; | ||
async recover(params) { | ||
const url = `/v3/account/:id/recover`.replace(':id', params.id); | ||
const result = await this._Fetch(new Account(), url, 'GET'); | ||
@@ -34,3 +34,3 @@ return result.length > 0 ? result[0] : null; | ||
async refer(params) { | ||
const url = `/v3/account/${this.instance.id}/:by`.replace(':by', params.by); | ||
const url = `/v3/account/:id/:by`.replace(':id', params.id).replace(':by', params.by); | ||
const result = await this._Fetch(new Account(), url, 'GET'); | ||
@@ -44,9 +44,9 @@ return result.length > 0 ? result[0] : null; | ||
} | ||
async update() { | ||
const url = `/v3/account/${this.instance.id}`; | ||
async update(params) { | ||
const url = `/v3/account/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Account(), url, 'PATCH'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async delete() { | ||
const url = `/v3/account/${this.instance.id}`; | ||
async delete(params) { | ||
const url = `/v3/account/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Account(), url, 'DELETE'); | ||
@@ -53,0 +53,0 @@ return result.length > 0 ? result[0] : null; |
@@ -20,10 +20,19 @@ import { Attributes } from './attributes'; | ||
count(): Promise<Count | null>; | ||
get(): Promise<Plan | null>; | ||
recover(): Promise<Plan | null>; | ||
get(params: { | ||
id: string; | ||
}): Promise<Plan | null>; | ||
recover(params: { | ||
id: string; | ||
}): Promise<Plan | null>; | ||
refer(params: { | ||
id: string; | ||
by: string; | ||
}): Promise<Plan | null>; | ||
create(): Promise<Plan | null>; | ||
update(): Promise<Plan | null>; | ||
delete(): Promise<Plan | null>; | ||
update(params: { | ||
id: string; | ||
}): Promise<Plan | null>; | ||
delete(params: { | ||
id: string; | ||
}): Promise<Plan | null>; | ||
} | ||
@@ -30,0 +39,0 @@ export declare class PlanQueryDynamic extends CoreQuery<Plan, PlanAttributes> { |
@@ -22,9 +22,9 @@ "use strict"; | ||
} | ||
async get() { | ||
const url = `/v3/plan/${this.instance.id}`; | ||
async get(params) { | ||
const url = `/v3/plan/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Plan(), url, 'GET'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async recover() { | ||
const url = `/v3/plan/${this.instance.id}/recover`; | ||
async recover(params) { | ||
const url = `/v3/plan/:id/recover`.replace(':id', params.id); | ||
const result = await this._Fetch(new Plan(), url, 'GET'); | ||
@@ -34,3 +34,3 @@ return result.length > 0 ? result[0] : null; | ||
async refer(params) { | ||
const url = `/v3/plan/${this.instance.id}/:by`.replace(':by', params.by); | ||
const url = `/v3/plan/:id/:by`.replace(':id', params.id).replace(':by', params.by); | ||
const result = await this._Fetch(new Plan(), url, 'GET'); | ||
@@ -44,9 +44,9 @@ return result.length > 0 ? result[0] : null; | ||
} | ||
async update() { | ||
const url = `/v3/plan/${this.instance.id}`; | ||
async update(params) { | ||
const url = `/v3/plan/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Plan(), url, 'PATCH'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async delete() { | ||
const url = `/v3/plan/${this.instance.id}`; | ||
async delete(params) { | ||
const url = `/v3/plan/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new Plan(), url, 'DELETE'); | ||
@@ -53,0 +53,0 @@ return result.length > 0 ? result[0] : null; |
@@ -30,10 +30,19 @@ import { Attributes } from './attributes'; | ||
count(): Promise<Count | null>; | ||
get(): Promise<PlattarUser | null>; | ||
recover(): Promise<PlattarUser | null>; | ||
get(params: { | ||
id: string; | ||
}): Promise<PlattarUser | null>; | ||
recover(params: { | ||
id: string; | ||
}): Promise<PlattarUser | null>; | ||
refer(params: { | ||
id: string; | ||
by: string; | ||
}): Promise<PlattarUser | null>; | ||
create(): Promise<PlattarUser | null>; | ||
update(): Promise<PlattarUser | null>; | ||
delete(): Promise<PlattarUser | null>; | ||
update(params: { | ||
id: string; | ||
}): Promise<PlattarUser | null>; | ||
delete(params: { | ||
id: string; | ||
}): Promise<PlattarUser | null>; | ||
} | ||
@@ -40,0 +49,0 @@ export declare class PlattarUserQueryDynamic extends CoreQuery<PlattarUser, PlattarUserAttributes> { |
@@ -67,9 +67,9 @@ "use strict"; | ||
} | ||
async get() { | ||
const url = `/v3/plattaruser/${this.instance.id}`; | ||
async get(params) { | ||
const url = `/v3/plattaruser/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new PlattarUser(), url, 'GET'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async recover() { | ||
const url = `/v3/plattaruser/${this.instance.id}/recover`; | ||
async recover(params) { | ||
const url = `/v3/plattaruser/:id/recover`.replace(':id', params.id); | ||
const result = await this._Fetch(new PlattarUser(), url, 'GET'); | ||
@@ -79,3 +79,3 @@ return result.length > 0 ? result[0] : null; | ||
async refer(params) { | ||
const url = `/v3/plattaruser/${this.instance.id}/:by`.replace(':by', params.by); | ||
const url = `/v3/plattaruser/:id/:by`.replace(':id', params.id).replace(':by', params.by); | ||
const result = await this._Fetch(new PlattarUser(), url, 'GET'); | ||
@@ -89,9 +89,9 @@ return result.length > 0 ? result[0] : null; | ||
} | ||
async update() { | ||
const url = `/v3/plattaruser/${this.instance.id}`; | ||
async update(params) { | ||
const url = `/v3/plattaruser/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new PlattarUser(), url, 'PATCH'); | ||
return result.length > 0 ? result[0] : null; | ||
} | ||
async delete() { | ||
const url = `/v3/plattaruser/${this.instance.id}`; | ||
async delete(params) { | ||
const url = `/v3/plattaruser/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new PlattarUser(), url, 'DELETE'); | ||
@@ -98,0 +98,0 @@ return result.length > 0 ? result[0] : null; |
@@ -10,4 +10,7 @@ import { Attributes } from './attributes'; | ||
list(): Promise<Array<SocialAuth>>; | ||
get(): Promise<SocialAuth | null>; | ||
get(params: { | ||
id: string; | ||
}): Promise<SocialAuth | null>; | ||
refer(params: { | ||
id: string; | ||
by: string; | ||
@@ -14,0 +17,0 @@ }): Promise<SocialAuth | null>; |
@@ -16,4 +16,4 @@ "use strict"; | ||
} | ||
async get() { | ||
const url = `/v3/socialauth/${this.instance.id}`; | ||
async get(params) { | ||
const url = `/v3/socialauth/:id`.replace(':id', params.id); | ||
const result = await this._Fetch(new SocialAuth(), url, 'GET'); | ||
@@ -23,3 +23,3 @@ return result.length > 0 ? result[0] : null; | ||
async refer(params) { | ||
const url = `/v3/socialauth/${this.instance.id}/:by`.replace(':by', params.by); | ||
const url = `/v3/socialauth/:id/:by`.replace(':id', params.id).replace(':by', params.by); | ||
const result = await this._Fetch(new SocialAuth(), url, 'GET'); | ||
@@ -26,0 +26,0 @@ return result.length > 0 ? result[0] : null; |
{ | ||
"name": "@plattar/auth-sdk", | ||
"version": "1.167.2", | ||
"version": "1.167.3", | ||
"description": "Generated using @plattar/sdk-core and used for interfacing with auth backend service", | ||
@@ -29,3 +29,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@plattar/sdk-core": "^1.167.2" | ||
"@plattar/sdk-core": "^1.167.3" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
@@ -5,3 +5,3 @@ [](https://www.npmjs.com/package/@plattar/auth-sdk) | ||
auth-sdk v1.167.2 is automatically generated using [sdk-core](https://www.npmjs.com/package/@plattar/sdk-core) module | ||
auth-sdk v1.167.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
202917
1.93%1246
4.18%Updated