mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix merge conflicts
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -909,8 +909,6 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
|
||||
<script type="text/html" id="template-flutter-windows-update">
|
||||
<div data-ls-template="template-desktop-update" data-type="script"></div>
|
||||
</script>
|
||||
<div data-ls-template="template-macos-update" data-type="script"></div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="template-apple-ios-update">
|
||||
<div data-ls-template="template-ios-update" data-type="script"></div>
|
||||
|
||||
Vendored
+27
-14
@@ -5,14 +5,15 @@ function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e)
|
||||
function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);}
|
||||
step((generator=generator.apply(thisArg,_arguments||[])).next());});}
|
||||
class AppwriteException extends Error{constructor(message,code=0,response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.response=response;}}
|
||||
class Appwrite{constructor(){this.config={endpoint:'https://appwrite.io/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:4.0.1','X-Appwrite-Response-Format':'0.10.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1)
|
||||
class Appwrite{constructor(){this.config={endpoint:'https://appwrite.io/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:4.0.4','X-Appwrite-Response-Format':'0.12.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1)
|
||||
return;const channels=new URLSearchParams();channels.set('project',this.config.project);this.realtime.channels.forEach(channel=>{channels.append('channels[]',channel);});const url=this.config.endpointRealtime+'/realtime?'+channels.toString();if(url!==this.realtime.url||!this.realtime.socket||((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)>WebSocket.OPEN){if(this.realtime.socket&&((_b=this.realtime.socket)===null||_b===void 0?void 0:_b.readyState)<WebSocket.CLOSING){this.realtime.reconnect=false;this.realtime.socket.close();}
|
||||
this.realtime.url=url;this.realtime.socket=new WebSocket(url);this.realtime.socket.addEventListener('message',this.realtime.onMessage);this.realtime.socket.addEventListener('open',_event=>{this.realtime.reconnectAttempts=0;});this.realtime.socket.addEventListener('close',event=>{var _a,_b,_c;if(!this.realtime.reconnect||(((_b=(_a=this.realtime)===null||_a===void 0?void 0:_a.lastMessage)===null||_b===void 0?void 0:_b.type)==='error'&&((_c=this.realtime)===null||_c===void 0?void 0:_c.lastMessage.data).code===1008)){this.realtime.reconnect=true;return;}
|
||||
const timeout=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${timeout / 1000} seconds.`,event.reason);setTimeout(()=>{this.realtime.reconnectAttempts++;this.realtime.createSocket();},timeout);});}},onMessage:(event)=>{var _a,_b;try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;switch(message.type){case'connected':const cookie=JSON.parse((_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'{}');const session=cookie===null||cookie===void 0?void 0:cookie[`a_session_${this.config.project}`];const messageData=message.data;if(session&&!messageData.user){(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.send(JSON.stringify({type:'authentication',data:{session}}));}
|
||||
break;case'event':let data=message.data;if(data===null||data===void 0?void 0:data.channels){const isSubscribed=data.channels.some(channel=>this.realtime.channels.has(channel));if(!isSubscribed)
|
||||
return;this.realtime.subscriptions.forEach(subscription=>{if(data.channels.some(channel=>subscription.channels.includes(channel))){setTimeout(()=>subscription.callback(data));}});}
|
||||
break;case'error':throw message.data;default:break;}}
|
||||
catch(e){console.error(e);}},cleanUp:channels=>{this.realtime.channels.forEach(channel=>{if(channels.includes(channel)){let found=Array.from(this.realtime.subscriptions).some(([_key,subscription])=>{return subscription.channels.includes(channel);});if(!found){this.realtime.channels.delete(channel);}}});}};this.account={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(email,password,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
|
||||
catch(e){console.error(e);}},cleanUp:channels=>{this.realtime.channels.forEach(channel=>{if(channels.includes(channel)){let found=Array.from(this.realtime.subscriptions).some(([_key,subscription])=>{return subscription.channels.includes(channel);});if(!found){this.realtime.channels.delete(channel);}}});}};this.account={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(userId,email,password,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
|
||||
if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
|
||||
if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');}
|
||||
let path='/account';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
|
||||
if(typeof email!=='undefined'){payload['email']=email;}
|
||||
@@ -45,8 +46,10 @@ const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'
|
||||
if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');}
|
||||
let path='/account/sessions';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
|
||||
if(typeof password!=='undefined'){payload['password']=password;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),deleteSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),createAnonymousSession:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createMagicURLSession:(email,url)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
|
||||
let path='/account/sessions/magic-url';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),deleteSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),createAnonymousSession:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createMagicURLSession:(userId,email,url)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
|
||||
if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
|
||||
let path='/account/sessions/magic-url';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
|
||||
if(typeof email!=='undefined'){payload['email']=email;}
|
||||
if(typeof url!=='undefined'){payload['url']=url;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateMagicURLSession:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
|
||||
if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');}
|
||||
@@ -132,14 +135,23 @@ if(typeof attributeId==='undefined'){throw new AppwriteException('Missing requir
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/boolean'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEmailAttribute:(collectionId,attributeId,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/email'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEnumAttribute:(collectionId,attributeId,elements,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
if(typeof elements==='undefined'){throw new AppwriteException('Missing required parameter: "elements"');}
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/enum'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof elements!=='undefined'){payload['elements']=elements;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createFloatAttribute:(collectionId,attributeId,required,min,max,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
@@ -148,7 +160,7 @@ let path='/database/collections/{collectionId}/attributes/float'.replace('{colle
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof min!=='undefined'){payload['min']=min;}
|
||||
if(typeof max!=='undefined'){payload['max']=max;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createIntegerAttribute:(collectionId,attributeId,required,min,max,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
@@ -157,14 +169,14 @@ let path='/database/collections/{collectionId}/attributes/integer'.replace('{col
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof min!=='undefined'){payload['min']=min;}
|
||||
if(typeof max!=='undefined'){payload['max']=max;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createIpAttribute:(collectionId,attributeId,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/ip'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createStringAttribute:(collectionId,attributeId,size,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
@@ -173,14 +185,14 @@ if(typeof required==='undefined'){throw new AppwriteException('Missing required
|
||||
let path='/database/collections/{collectionId}/attributes/string'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof size!=='undefined'){payload['size']=size;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createUrlAttribute:(collectionId,attributeId,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/url'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getAttribute:(collectionId,attributeId)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
@@ -257,9 +269,10 @@ if(typeof events!=='undefined'){payload['events']=events;}
|
||||
if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
|
||||
if(typeof timeout!=='undefined'){payload['timeout']=timeout;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(functionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
|
||||
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listExecutions:(functionId,limit,offset,cursor,cursorDirection)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
|
||||
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listExecutions:(functionId,limit,offset,search,cursor,cursorDirection)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
|
||||
let path='/functions/{functionId}/executions'.replace('{functionId}',functionId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;}
|
||||
if(typeof offset!=='undefined'){payload['offset']=offset;}
|
||||
if(typeof search!=='undefined'){payload['search']=search;}
|
||||
if(typeof cursor!=='undefined'){payload['cursor']=cursor;}
|
||||
if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createExecution:(functionId,data)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
|
||||
@@ -484,9 +497,9 @@ if(typeof email==='undefined'){throw new AppwriteException('Missing required par
|
||||
if(typeof roles==='undefined'){throw new AppwriteException('Missing required parameter: "roles"');}
|
||||
if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');}
|
||||
let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={};if(typeof email!=='undefined'){payload['email']=email;}
|
||||
if(typeof name!=='undefined'){payload['name']=name;}
|
||||
if(typeof roles!=='undefined'){payload['roles']=roles;}
|
||||
if(typeof url!=='undefined'){payload['url']=url;}
|
||||
if(typeof name!=='undefined'){payload['name']=name;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getMembership:(teamId,membershipId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
|
||||
if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');}
|
||||
let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateMembershipRoles:(teamId,membershipId,roles)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
|
||||
@@ -566,7 +579,7 @@ throw new AppwriteException(e.message);}});}
|
||||
flatten(data,prefix=''){let output={};for(const key in data){let value=data[key];let finalKey=prefix?`${prefix}[${key}]`:key;if(Array.isArray(value)){output=Object.assign(output,this.flatten(value,finalKey));}
|
||||
else{output[finalKey]=value;}}
|
||||
return output;}}
|
||||
exports.Appwrite=Appwrite;Object.defineProperty(exports,'__esModule',{value:true});})(this.window=this.window||{},null,window);(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory(function(){try{return require('moment');}catch(e){}}()):typeof define==='function'&&define.amd?define(['require'],function(require){return factory(function(){try{return require('moment');}catch(e){}}());}):(global=global||self,global.Chart=factory(global.moment));}(this,(function(moment){'use strict';moment=moment&&moment.hasOwnProperty('default')?moment['default']:moment;function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports;}
|
||||
exports.Appwrite=Appwrite;Object.defineProperty(exports,'__esModule',{value:true});}(this.window=this.window||{},null,window));(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory(function(){try{return require('moment');}catch(e){}}()):typeof define==='function'&&define.amd?define(['require'],function(require){return factory(function(){try{return require('moment');}catch(e){}}());}):(global=global||self,global.Chart=factory(global.moment));}(this,(function(moment){'use strict';moment=moment&&moment.hasOwnProperty('default')?moment['default']:moment;function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports;}
|
||||
function getCjsExportFromNamespace(n){return n&&n['default']||n;}
|
||||
var colorName={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[220,20,60],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]};var conversions=createCommonjsModule(function(module){var reverseKeywords={};for(var key in colorName){if(colorName.hasOwnProperty(key)){reverseKeywords[colorName[key]]=key;}}
|
||||
var convert=module.exports={rgb:{channels:3,labels:'rgb'},hsl:{channels:3,labels:'hsl'},hsv:{channels:3,labels:'hsv'},hwb:{channels:3,labels:'hwb'},cmyk:{channels:4,labels:'cmyk'},xyz:{channels:3,labels:'xyz'},lab:{channels:3,labels:'lab'},lch:{channels:3,labels:'lch'},hex:{channels:1,labels:['hex']},keyword:{channels:1,labels:['keyword']},ansi16:{channels:1,labels:['ansi16']},ansi256:{channels:1,labels:['ansi256']},hcg:{channels:3,labels:['h','c','g']},apple:{channels:3,labels:['r16','g16','b16']},gray:{channels:1,labels:['gray']}};for(var model in convert){if(convert.hasOwnProperty(model)){if(!('channels'in convert[model])){throw new Error('missing channels property: '+model);}
|
||||
|
||||
Vendored
+27
-14
@@ -5,14 +5,15 @@ function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e)
|
||||
function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);}
|
||||
step((generator=generator.apply(thisArg,_arguments||[])).next());});}
|
||||
class AppwriteException extends Error{constructor(message,code=0,response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.response=response;}}
|
||||
class Appwrite{constructor(){this.config={endpoint:'https://appwrite.io/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:4.0.1','X-Appwrite-Response-Format':'0.10.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1)
|
||||
class Appwrite{constructor(){this.config={endpoint:'https://appwrite.io/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:4.0.4','X-Appwrite-Response-Format':'0.12.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1)
|
||||
return;const channels=new URLSearchParams();channels.set('project',this.config.project);this.realtime.channels.forEach(channel=>{channels.append('channels[]',channel);});const url=this.config.endpointRealtime+'/realtime?'+channels.toString();if(url!==this.realtime.url||!this.realtime.socket||((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)>WebSocket.OPEN){if(this.realtime.socket&&((_b=this.realtime.socket)===null||_b===void 0?void 0:_b.readyState)<WebSocket.CLOSING){this.realtime.reconnect=false;this.realtime.socket.close();}
|
||||
this.realtime.url=url;this.realtime.socket=new WebSocket(url);this.realtime.socket.addEventListener('message',this.realtime.onMessage);this.realtime.socket.addEventListener('open',_event=>{this.realtime.reconnectAttempts=0;});this.realtime.socket.addEventListener('close',event=>{var _a,_b,_c;if(!this.realtime.reconnect||(((_b=(_a=this.realtime)===null||_a===void 0?void 0:_a.lastMessage)===null||_b===void 0?void 0:_b.type)==='error'&&((_c=this.realtime)===null||_c===void 0?void 0:_c.lastMessage.data).code===1008)){this.realtime.reconnect=true;return;}
|
||||
const timeout=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${timeout / 1000} seconds.`,event.reason);setTimeout(()=>{this.realtime.reconnectAttempts++;this.realtime.createSocket();},timeout);});}},onMessage:(event)=>{var _a,_b;try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;switch(message.type){case'connected':const cookie=JSON.parse((_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'{}');const session=cookie===null||cookie===void 0?void 0:cookie[`a_session_${this.config.project}`];const messageData=message.data;if(session&&!messageData.user){(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.send(JSON.stringify({type:'authentication',data:{session}}));}
|
||||
break;case'event':let data=message.data;if(data===null||data===void 0?void 0:data.channels){const isSubscribed=data.channels.some(channel=>this.realtime.channels.has(channel));if(!isSubscribed)
|
||||
return;this.realtime.subscriptions.forEach(subscription=>{if(data.channels.some(channel=>subscription.channels.includes(channel))){setTimeout(()=>subscription.callback(data));}});}
|
||||
break;case'error':throw message.data;default:break;}}
|
||||
catch(e){console.error(e);}},cleanUp:channels=>{this.realtime.channels.forEach(channel=>{if(channels.includes(channel)){let found=Array.from(this.realtime.subscriptions).some(([_key,subscription])=>{return subscription.channels.includes(channel);});if(!found){this.realtime.channels.delete(channel);}}});}};this.account={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(email,password,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
|
||||
catch(e){console.error(e);}},cleanUp:channels=>{this.realtime.channels.forEach(channel=>{if(channels.includes(channel)){let found=Array.from(this.realtime.subscriptions).some(([_key,subscription])=>{return subscription.channels.includes(channel);});if(!found){this.realtime.channels.delete(channel);}}});}};this.account={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(userId,email,password,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
|
||||
if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
|
||||
if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');}
|
||||
let path='/account';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
|
||||
if(typeof email!=='undefined'){payload['email']=email;}
|
||||
@@ -45,8 +46,10 @@ const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'
|
||||
if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');}
|
||||
let path='/account/sessions';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
|
||||
if(typeof password!=='undefined'){payload['password']=password;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),deleteSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),createAnonymousSession:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createMagicURLSession:(email,url)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
|
||||
let path='/account/sessions/magic-url';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),deleteSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),createAnonymousSession:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createMagicURLSession:(userId,email,url)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
|
||||
if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
|
||||
let path='/account/sessions/magic-url';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
|
||||
if(typeof email!=='undefined'){payload['email']=email;}
|
||||
if(typeof url!=='undefined'){payload['url']=url;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateMagicURLSession:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
|
||||
if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');}
|
||||
@@ -132,14 +135,23 @@ if(typeof attributeId==='undefined'){throw new AppwriteException('Missing requir
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/boolean'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEmailAttribute:(collectionId,attributeId,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/email'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEnumAttribute:(collectionId,attributeId,elements,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
if(typeof elements==='undefined'){throw new AppwriteException('Missing required parameter: "elements"');}
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/enum'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof elements!=='undefined'){payload['elements']=elements;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createFloatAttribute:(collectionId,attributeId,required,min,max,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
@@ -148,7 +160,7 @@ let path='/database/collections/{collectionId}/attributes/float'.replace('{colle
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof min!=='undefined'){payload['min']=min;}
|
||||
if(typeof max!=='undefined'){payload['max']=max;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createIntegerAttribute:(collectionId,attributeId,required,min,max,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
@@ -157,14 +169,14 @@ let path='/database/collections/{collectionId}/attributes/integer'.replace('{col
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof min!=='undefined'){payload['min']=min;}
|
||||
if(typeof max!=='undefined'){payload['max']=max;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createIpAttribute:(collectionId,attributeId,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/ip'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createStringAttribute:(collectionId,attributeId,size,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
@@ -173,14 +185,14 @@ if(typeof required==='undefined'){throw new AppwriteException('Missing required
|
||||
let path='/database/collections/{collectionId}/attributes/string'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof size!=='undefined'){payload['size']=size;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createUrlAttribute:(collectionId,attributeId,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');}
|
||||
let path='/database/collections/{collectionId}/attributes/url'.replace('{collectionId}',collectionId);let payload={};if(typeof attributeId!=='undefined'){payload['attributeId']=attributeId;}
|
||||
if(typeof required!=='undefined'){payload['required']=required;}
|
||||
if(typeof xdefault!=='undefined'){payload['xdefault']=xdefault;}
|
||||
if(typeof xdefault!=='undefined'){payload['default']=xdefault;}
|
||||
if(typeof array!=='undefined'){payload['array']=array;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getAttribute:(collectionId,attributeId)=>__awaiter(this,void 0,void 0,function*(){if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
|
||||
if(typeof attributeId==='undefined'){throw new AppwriteException('Missing required parameter: "attributeId"');}
|
||||
@@ -257,9 +269,10 @@ if(typeof events!=='undefined'){payload['events']=events;}
|
||||
if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
|
||||
if(typeof timeout!=='undefined'){payload['timeout']=timeout;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(functionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
|
||||
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listExecutions:(functionId,limit,offset,cursor,cursorDirection)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
|
||||
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listExecutions:(functionId,limit,offset,search,cursor,cursorDirection)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
|
||||
let path='/functions/{functionId}/executions'.replace('{functionId}',functionId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;}
|
||||
if(typeof offset!=='undefined'){payload['offset']=offset;}
|
||||
if(typeof search!=='undefined'){payload['search']=search;}
|
||||
if(typeof cursor!=='undefined'){payload['cursor']=cursor;}
|
||||
if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createExecution:(functionId,data)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
|
||||
@@ -484,9 +497,9 @@ if(typeof email==='undefined'){throw new AppwriteException('Missing required par
|
||||
if(typeof roles==='undefined'){throw new AppwriteException('Missing required parameter: "roles"');}
|
||||
if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');}
|
||||
let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={};if(typeof email!=='undefined'){payload['email']=email;}
|
||||
if(typeof name!=='undefined'){payload['name']=name;}
|
||||
if(typeof roles!=='undefined'){payload['roles']=roles;}
|
||||
if(typeof url!=='undefined'){payload['url']=url;}
|
||||
if(typeof name!=='undefined'){payload['name']=name;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getMembership:(teamId,membershipId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
|
||||
if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');}
|
||||
let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateMembershipRoles:(teamId,membershipId,roles)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
|
||||
@@ -566,7 +579,7 @@ throw new AppwriteException(e.message);}});}
|
||||
flatten(data,prefix=''){let output={};for(const key in data){let value=data[key];let finalKey=prefix?`${prefix}[${key}]`:key;if(Array.isArray(value)){output=Object.assign(output,this.flatten(value,finalKey));}
|
||||
else{output[finalKey]=value;}}
|
||||
return output;}}
|
||||
exports.Appwrite=Appwrite;Object.defineProperty(exports,'__esModule',{value:true});})(this.window=this.window||{},null,window);(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory(function(){try{return require('moment');}catch(e){}}()):typeof define==='function'&&define.amd?define(['require'],function(require){return factory(function(){try{return require('moment');}catch(e){}}());}):(global=global||self,global.Chart=factory(global.moment));}(this,(function(moment){'use strict';moment=moment&&moment.hasOwnProperty('default')?moment['default']:moment;function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports;}
|
||||
exports.Appwrite=Appwrite;Object.defineProperty(exports,'__esModule',{value:true});}(this.window=this.window||{},null,window));(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory(function(){try{return require('moment');}catch(e){}}()):typeof define==='function'&&define.amd?define(['require'],function(require){return factory(function(){try{return require('moment');}catch(e){}}());}):(global=global||self,global.Chart=factory(global.moment));}(this,(function(moment){'use strict';moment=moment&&moment.hasOwnProperty('default')?moment['default']:moment;function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports;}
|
||||
function getCjsExportFromNamespace(n){return n&&n['default']||n;}
|
||||
var colorName={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[220,20,60],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]};var conversions=createCommonjsModule(function(module){var reverseKeywords={};for(var key in colorName){if(colorName.hasOwnProperty(key)){reverseKeywords[colorName[key]]=key;}}
|
||||
var convert=module.exports={rgb:{channels:3,labels:'rgb'},hsl:{channels:3,labels:'hsl'},hsv:{channels:3,labels:'hsv'},hwb:{channels:3,labels:'hwb'},cmyk:{channels:4,labels:'cmyk'},xyz:{channels:3,labels:'xyz'},lab:{channels:3,labels:'lab'},lch:{channels:3,labels:'lch'},hex:{channels:1,labels:['hex']},keyword:{channels:1,labels:['keyword']},ansi16:{channels:1,labels:['ansi16']},ansi256:{channels:1,labels:['ansi256']},hcg:{channels:3,labels:['h','c','g']},apple:{channels:3,labels:['r16','g16','b16']},gray:{channels:1,labels:['gray']}};for(var model in convert){if(convert.hasOwnProperty(model)){if(!('channels'in convert[model])){throw new Error('missing channels property: '+model);}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -47,8 +47,8 @@
|
||||
mode: '',
|
||||
};
|
||||
this.headers = {
|
||||
'x-sdk-version': 'appwrite:web:4.0.1',
|
||||
'X-Appwrite-Response-Format': '0.10.0',
|
||||
'x-sdk-version': 'appwrite:web:4.0.4',
|
||||
'X-Appwrite-Response-Format': '0.12.0',
|
||||
};
|
||||
this.realtime = {
|
||||
socket: undefined,
|
||||
@@ -613,17 +613,24 @@
|
||||
* the URL parameter empty, so that the login completion will be handled by
|
||||
* your Appwrite instance by default.
|
||||
*
|
||||
* @param {string} userId
|
||||
* @param {string} email
|
||||
* @param {string} url
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createMagicURLSession: (email, url) => __awaiter(this, void 0, void 0, function* () {
|
||||
createMagicURLSession: (userId, email, url) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof userId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "userId"');
|
||||
}
|
||||
if (typeof email === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "email"');
|
||||
}
|
||||
let path = '/account/sessions/magic-url';
|
||||
let payload = {};
|
||||
if (typeof userId !== 'undefined') {
|
||||
payload['userId'] = userId;
|
||||
}
|
||||
if (typeof email !== 'undefined') {
|
||||
payload['email'] = email;
|
||||
}
|
||||
@@ -1327,7 +1334,7 @@
|
||||
payload['required'] = required;
|
||||
}
|
||||
if (typeof xdefault !== 'undefined') {
|
||||
payload['xdefault'] = xdefault;
|
||||
payload['default'] = xdefault;
|
||||
}
|
||||
if (typeof array !== 'undefined') {
|
||||
payload['array'] = array;
|
||||
@@ -1368,7 +1375,55 @@
|
||||
payload['required'] = required;
|
||||
}
|
||||
if (typeof xdefault !== 'undefined') {
|
||||
payload['xdefault'] = xdefault;
|
||||
payload['default'] = xdefault;
|
||||
}
|
||||
if (typeof array !== 'undefined') {
|
||||
payload['array'] = array;
|
||||
}
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('post', uri, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* Create Enum Attribute
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string[]} elements
|
||||
* @param {boolean} required
|
||||
* @param {string} xdefault
|
||||
* @param {boolean} array
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createEnumAttribute: (collectionId, attributeId, elements, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
}
|
||||
if (typeof elements === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "elements"');
|
||||
}
|
||||
if (typeof required === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "required"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/enum'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
}
|
||||
if (typeof elements !== 'undefined') {
|
||||
payload['elements'] = elements;
|
||||
}
|
||||
if (typeof required !== 'undefined') {
|
||||
payload['required'] = required;
|
||||
}
|
||||
if (typeof xdefault !== 'undefined') {
|
||||
payload['default'] = xdefault;
|
||||
}
|
||||
if (typeof array !== 'undefined') {
|
||||
payload['array'] = array;
|
||||
@@ -1417,7 +1472,7 @@
|
||||
payload['max'] = max;
|
||||
}
|
||||
if (typeof xdefault !== 'undefined') {
|
||||
payload['xdefault'] = xdefault;
|
||||
payload['default'] = xdefault;
|
||||
}
|
||||
if (typeof array !== 'undefined') {
|
||||
payload['array'] = array;
|
||||
@@ -1466,7 +1521,7 @@
|
||||
payload['max'] = max;
|
||||
}
|
||||
if (typeof xdefault !== 'undefined') {
|
||||
payload['xdefault'] = xdefault;
|
||||
payload['default'] = xdefault;
|
||||
}
|
||||
if (typeof array !== 'undefined') {
|
||||
payload['array'] = array;
|
||||
@@ -1507,7 +1562,7 @@
|
||||
payload['required'] = required;
|
||||
}
|
||||
if (typeof xdefault !== 'undefined') {
|
||||
payload['xdefault'] = xdefault;
|
||||
payload['default'] = xdefault;
|
||||
}
|
||||
if (typeof array !== 'undefined') {
|
||||
payload['array'] = array;
|
||||
@@ -1555,7 +1610,7 @@
|
||||
payload['required'] = required;
|
||||
}
|
||||
if (typeof xdefault !== 'undefined') {
|
||||
payload['xdefault'] = xdefault;
|
||||
payload['default'] = xdefault;
|
||||
}
|
||||
if (typeof array !== 'undefined') {
|
||||
payload['array'] = array;
|
||||
@@ -1566,7 +1621,7 @@
|
||||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* Create IP Address Attribute
|
||||
* Create URL Attribute
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
@@ -1596,7 +1651,7 @@
|
||||
payload['required'] = required;
|
||||
}
|
||||
if (typeof xdefault !== 'undefined') {
|
||||
payload['xdefault'] = xdefault;
|
||||
payload['default'] = xdefault;
|
||||
}
|
||||
if (typeof array !== 'undefined') {
|
||||
payload['array'] = array;
|
||||
@@ -2216,12 +2271,13 @@
|
||||
* @param {string} functionId
|
||||
* @param {number} limit
|
||||
* @param {number} offset
|
||||
* @param {string} search
|
||||
* @param {string} cursor
|
||||
* @param {string} cursorDirection
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
listExecutions: (functionId, limit, offset, cursor, cursorDirection) => __awaiter(this, void 0, void 0, function* () {
|
||||
listExecutions: (functionId, limit, offset, search, cursor, cursorDirection) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof functionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "functionId"');
|
||||
}
|
||||
@@ -2233,6 +2289,9 @@
|
||||
if (typeof offset !== 'undefined') {
|
||||
payload['offset'] = offset;
|
||||
}
|
||||
if (typeof search !== 'undefined') {
|
||||
payload['search'] = search;
|
||||
}
|
||||
if (typeof cursor !== 'undefined') {
|
||||
payload['cursor'] = cursor;
|
||||
}
|
||||
@@ -2551,7 +2610,7 @@
|
||||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* Get Certificate Queue
|
||||
* Get Certificates Queue
|
||||
*
|
||||
* Get the number of certificates that are waiting to be issued against
|
||||
* [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
|
||||
@@ -4307,15 +4366,15 @@
|
||||
if (typeof email !== 'undefined') {
|
||||
payload['email'] = email;
|
||||
}
|
||||
if (typeof name !== 'undefined') {
|
||||
payload['name'] = name;
|
||||
}
|
||||
if (typeof roles !== 'undefined') {
|
||||
payload['roles'] = roles;
|
||||
}
|
||||
if (typeof url !== 'undefined') {
|
||||
payload['url'] = url;
|
||||
}
|
||||
if (typeof name !== 'undefined') {
|
||||
payload['name'] = name;
|
||||
}
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('post', uri, {
|
||||
'content-type': 'application/json',
|
||||
@@ -4592,6 +4651,7 @@
|
||||
/**
|
||||
* Update Email
|
||||
*
|
||||
* Update the user email by its unique ID.
|
||||
*
|
||||
* @param {string} userId
|
||||
* @param {string} email
|
||||
@@ -4638,6 +4698,7 @@
|
||||
/**
|
||||
* Update Name
|
||||
*
|
||||
* Update the user name by its unique ID.
|
||||
*
|
||||
* @param {string} userId
|
||||
* @param {string} name
|
||||
@@ -4664,6 +4725,7 @@
|
||||
/**
|
||||
* Update Password
|
||||
*
|
||||
* Update the user password by its unique ID.
|
||||
*
|
||||
* @param {string} userId
|
||||
* @param {string} password
|
||||
@@ -5075,4 +5137,4 @@
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})(this.window = this.window || {}, null, window);
|
||||
}(this.window = this.window || {}, null, window));
|
||||
|
||||
@@ -49,6 +49,7 @@ abstract class Migration
|
||||
'0.10.3' => 'V09',
|
||||
'0.10.4' => 'V09',
|
||||
'0.11.0' => 'V10',
|
||||
'0.12.0' => 'V10',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@ use Utopia\Locale\Locale as Locale;
|
||||
|
||||
class V06 extends Filter
|
||||
{
|
||||
|
||||
// Convert 0.7 Data format to 0.6 format
|
||||
public function parse(array $content, string $model): array
|
||||
{
|
||||
@@ -49,7 +48,7 @@ class V06 extends Filter
|
||||
case Response::MODEL_USER_LIST:
|
||||
$parsedResponse = $this->parseUserList($content);
|
||||
break;
|
||||
|
||||
|
||||
case Response::MODEL_TEAM:
|
||||
$parsedResponse = $this->parseTeam($content);
|
||||
break;
|
||||
@@ -61,7 +60,7 @@ class V06 extends Filter
|
||||
case Response::MODEL_MEMBERSHIP:
|
||||
$parsedResponse = $content;
|
||||
break;
|
||||
|
||||
|
||||
case Response::MODEL_MEMBERSHIP_LIST:
|
||||
$parsedResponse = $content['memberships'];
|
||||
break;
|
||||
@@ -73,11 +72,11 @@ class V06 extends Filter
|
||||
case Response::MODEL_SESSION_LIST:
|
||||
$parsedResponse = $this->parseSessionList($content);
|
||||
break;
|
||||
|
||||
|
||||
case Response::MODEL_LOG_LIST:
|
||||
$parsedResponse = $this->parseLogList($content);
|
||||
break;
|
||||
|
||||
|
||||
case Response::MODEL_TOKEN:
|
||||
$parsedResponse = $this->parseToken($content);
|
||||
break;
|
||||
@@ -113,7 +112,7 @@ class V06 extends Filter
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception('Received invalid model : '.$model);
|
||||
throw new Exception('Received invalid model : ' . $model);
|
||||
}
|
||||
|
||||
return $parsedResponse;
|
||||
@@ -245,7 +244,7 @@ class V06 extends Filter
|
||||
'model' => $log['deviceModel'],
|
||||
'time' => $log['time'],
|
||||
'geo' => [
|
||||
'isoCode' => empty($log['countryCode']) ? '---' : $log['countryCode'] ,
|
||||
'isoCode' => empty($log['countryCode']) ? '---' : $log['countryCode'],
|
||||
'country' => empty($log['countryName']) ? Locale::getText('locale.country.unknown') : $log['countryName']
|
||||
],
|
||||
'OS' => [
|
||||
@@ -280,7 +279,7 @@ class V06 extends Filter
|
||||
'ip' => $session['ip'],
|
||||
'model' => $session['deviceModel'],
|
||||
'geo' => [
|
||||
'isoCode' => empty($session['countryCode']) ? '---' : $session['countryCode'] ,
|
||||
'isoCode' => empty($session['countryCode']) ? '---' : $session['countryCode'],
|
||||
'country' => empty($session['countryName']) ? Locale::getText('locale.country.unknown') : $session['countryName']
|
||||
],
|
||||
'OS' => [
|
||||
@@ -325,10 +324,10 @@ class V06 extends Filter
|
||||
if (!$provider['enabled']) {
|
||||
continue;
|
||||
}
|
||||
$content['oauth2'.ucfirst($key)] = '';
|
||||
$content['oauth2'.ucfirst($key).'AccessToken'] = '';
|
||||
$content['oauth2' . ucfirst($key)] = '';
|
||||
$content['oauth2' . ucfirst($key) . 'AccessToken'] = '';
|
||||
}
|
||||
$content['status'] = empty($content['status']) ? 0 : $content['status'];
|
||||
$content['status'] = $content['status'] ? 0 : 2;
|
||||
$content['roles'] = Authorization::getRoles() ?? [];
|
||||
return $content;
|
||||
}
|
||||
|
||||
@@ -204,4 +204,48 @@ class Project extends Model
|
||||
{
|
||||
return Response::MODEL_PROJECT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function filter(Document $document): Document
|
||||
{
|
||||
$values = $document->getAttribute('services', []);
|
||||
$services = Config::getParam('services', []);
|
||||
|
||||
foreach($services as $service) {
|
||||
if(!$service['optional']) {
|
||||
continue;
|
||||
}
|
||||
$key = $service['key'] ?? '';
|
||||
$value = $values[$key] ?? true;
|
||||
$document->setAttribute('serviceStatusFor'.ucfirst($key), $value);
|
||||
}
|
||||
|
||||
$authValues = $document->getAttribute('auths',[]);
|
||||
$auth = Config::getParam('auth', []);
|
||||
|
||||
$document->setAttribute('authLimit', $authValues['limit'] ?? 0);
|
||||
|
||||
foreach ($auth as $index => $method) {
|
||||
$key = $method['key'];
|
||||
$value = $authValues[$key] ?? true;
|
||||
$document->setAttribute('auth' . ucfirst($key), $value);
|
||||
}
|
||||
|
||||
$providers = Config::getParam('providers', []);
|
||||
$providerValues = $document->getAttribute('providers', []);
|
||||
|
||||
foreach ($providers as $key => $provider) {
|
||||
if (!$provider['enabled']) {
|
||||
continue;
|
||||
}
|
||||
$appId = $providerValues[$key . 'Appid'] ?? '';
|
||||
$secret = $providerValues[$key . 'Secret'] ?? '';
|
||||
$document->setAttribute('provider' . ucfirst($key) . 'Appid', $appId)->setAttribute('provider' . ucfirst($key) . 'Secret', $secret);
|
||||
}
|
||||
return $document;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user