chore(deps): update sdks and sdk-generator
This commit is contained in:
parent
0571dbe378
commit
ed75e88e09
|
@ -15,7 +15,7 @@ return [
|
|||
[
|
||||
'key' => 'web',
|
||||
'name' => 'Web',
|
||||
'version' => '4.0.0',
|
||||
'version' => '4.0.1',
|
||||
'url' => 'https://github.com/appwrite/sdk-for-web',
|
||||
'package' => 'https://www.npmjs.com/package/appwrite',
|
||||
'enabled' => true,
|
||||
|
@ -62,7 +62,7 @@ return [
|
|||
[
|
||||
'key' => 'flutter',
|
||||
'name' => 'Flutter',
|
||||
'version' => '1.0.0',
|
||||
'version' => '1.0.1',
|
||||
'url' => 'https://github.com/appwrite/sdk-for-flutter',
|
||||
'package' => 'https://pub.dev/packages/appwrite',
|
||||
'enabled' => true,
|
||||
|
@ -156,7 +156,7 @@ return [
|
|||
[
|
||||
'key' => 'web',
|
||||
'name' => 'Console',
|
||||
'version' => '3.0.0',
|
||||
'version' => '4.0.1',
|
||||
'url' => 'https://github.com/appwrite/sdk-for-console',
|
||||
'package' => '',
|
||||
'enabled' => true,
|
||||
|
@ -319,7 +319,7 @@ return [
|
|||
[
|
||||
'key' => 'dart',
|
||||
'name' => 'Dart',
|
||||
'version' => '1.0.0',
|
||||
'version' => '1.0.1',
|
||||
'url' => 'https://github.com/appwrite/sdk-for-dart',
|
||||
'package' => 'https://pub.dev/packages/dart_appwrite',
|
||||
'enabled' => true,
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
"slickdeals/statsd": "3.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"appwrite/sdk-generator": "0.14.0",
|
||||
"appwrite/sdk-generator": "0.14.2",
|
||||
"phpunit/phpunit": "9.5.6",
|
||||
"swoole/ide-helper": "4.6.7",
|
||||
"textalk/websocket": "1.5.2",
|
||||
|
|
14
composer.lock
generated
14
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "e86dfb61222e6281eaa23561c5958534",
|
||||
"content-hash": "517376ae7cf900970c397488c82d0fb3",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/jwt",
|
||||
|
@ -2516,16 +2516,16 @@
|
|||
},
|
||||
{
|
||||
"name": "appwrite/sdk-generator",
|
||||
"version": "0.14.0",
|
||||
"version": "0.14.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||
"reference": "7a30fac0de583559b9c4cdd8308ab5a1f5803e60"
|
||||
"reference": "ac40262c4e90544adaab893172125f8c43f7e5da"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/7a30fac0de583559b9c4cdd8308ab5a1f5803e60",
|
||||
"reference": "7a30fac0de583559b9c4cdd8308ab5a1f5803e60",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ac40262c4e90544adaab893172125f8c43f7e5da",
|
||||
"reference": "ac40262c4e90544adaab893172125f8c43f7e5da",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2559,9 +2559,9 @@
|
|||
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
||||
"support": {
|
||||
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/0.14.0"
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/0.14.2"
|
||||
},
|
||||
"time": "2021-09-02T09:50:30+00:00"
|
||||
"time": "2021-09-06T07:34:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/package-versions-deprecated",
|
||||
|
|
16
public/dist/scripts/app-all.js
vendored
16
public/dist/scripts/app-all.js
vendored
|
@ -5,11 +5,11 @@ 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:2.1.0','X-Appwrite-Response-Format':'0.9.0',};this.realtime={socket:undefined,timeout:undefined,channels:{},lastMessage:undefined,createSocket:()=>{var _a,_b;const channels=new URLSearchParams();channels.set('project',this.config.project);for(const property in this.realtime.channels){channels.append('channels[]',property);}
|
||||
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,channels:{},lastMessage:undefined,createSocket:()=>{var _a,_b;const channels=new URLSearchParams();channels.set('project',this.config.project);for(const property in this.realtime.channels){channels.append('channels[]',property);}
|
||||
if(((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)===WebSocket.OPEN){this.realtime.socket.close();}
|
||||
this.realtime.socket=new WebSocket(this.config.endpointRealtime+'/realtime?'+channels.toString());(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.addEventListener('message',this.realtime.authenticate);for(const channel in this.realtime.channels){this.realtime.channels[channel].forEach(callback=>{var _a;(_a=this.realtime.socket)===null||_a===void 0?void 0:_a.addEventListener('message',callback);});}
|
||||
this.realtime.socket.addEventListener('close',event=>{var _a,_b,_c;if(((_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){return;}
|
||||
console.error('Realtime got disconnected. Reconnect will be attempted in 1 second.',event.reason);setTimeout(()=>{this.realtime.createSocket();},1000);});},authenticate:(event)=>{var _a,_b;const message=JSON.parse(event.data);if(message.type==='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 data=message.data;if(session&&!data.user){(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.send(JSON.stringify({type:"authentication",data:{session}}));}}},onMessage:(channel,callback)=>(event)=>{try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;if(message.type==='event'){let data=message.data;if(data.channels&&data.channels.includes(channel)){callback(data);}}
|
||||
console.error('Realtime got disconnected. Reconnect will be attempted in 1 second.',event.reason);setTimeout(()=>{this.realtime.createSocket();},1000);});},authenticate:(event)=>{var _a,_b,_c;const message=JSON.parse(event.data);if(message.type==='connected'&&((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)===WebSocket.OPEN){const cookie=JSON.parse((_b=window.localStorage.getItem('cookieFallback'))!==null&&_b!==void 0?_b:"{}");const session=cookie===null||cookie===void 0?void 0:cookie[`a_session_${this.config.project}`];const data=message.data;if(session&&!data.user){(_c=this.realtime.socket)===null||_c===void 0?void 0:_c.send(JSON.stringify({type:"authentication",data:{session}}));}}},onMessage:(channel,callback)=>(event)=>{try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;if(message.type==='event'){let data=message.data;if(data.channels&&data.channels.includes(channel)){callback(data);}}
|
||||
else if(message.type==='error'){throw message.data;}}
|
||||
catch(e){console.error(e);}}};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"');}
|
||||
if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');}
|
||||
|
@ -43,7 +43,14 @@ 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);}),createOAuth2Session:(provider,success,failure,scopes)=>{if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');}
|
||||
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;}
|
||||
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"');}
|
||||
let path='/account/sessions/magic-url';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
|
||||
if(typeof secret!=='undefined'){payload['secret']=secret;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),createOAuth2Session:(provider,success,failure,scopes)=>{if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');}
|
||||
let path='/account/sessions/oauth2/{provider}'.replace('{provider}',provider);let payload={};if(typeof success!=='undefined'){payload['success']=success;}
|
||||
if(typeof failure!=='undefined'){payload['failure']=failure;}
|
||||
if(typeof scopes!=='undefined'){payload['scopes']=scopes;}
|
||||
|
@ -474,7 +481,8 @@ else{data={message:yield response.text()};}
|
|||
if(400<=response.status){throw new AppwriteException(data===null||data===void 0?void 0:data.message,response.status,data);}
|
||||
const cookieFallback=response.headers.get('X-Fallback-Cookies');if(typeof window!=='undefined'&&window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);}
|
||||
return data;}
|
||||
catch(e){throw new AppwriteException(e.message);}});}
|
||||
catch(e){if(e instanceof AppwriteException){throw e;}
|
||||
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;}}
|
||||
|
|
16
public/dist/scripts/app-dep.js
vendored
16
public/dist/scripts/app-dep.js
vendored
|
@ -5,11 +5,11 @@ 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:2.1.0','X-Appwrite-Response-Format':'0.9.0',};this.realtime={socket:undefined,timeout:undefined,channels:{},lastMessage:undefined,createSocket:()=>{var _a,_b;const channels=new URLSearchParams();channels.set('project',this.config.project);for(const property in this.realtime.channels){channels.append('channels[]',property);}
|
||||
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,channels:{},lastMessage:undefined,createSocket:()=>{var _a,_b;const channels=new URLSearchParams();channels.set('project',this.config.project);for(const property in this.realtime.channels){channels.append('channels[]',property);}
|
||||
if(((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)===WebSocket.OPEN){this.realtime.socket.close();}
|
||||
this.realtime.socket=new WebSocket(this.config.endpointRealtime+'/realtime?'+channels.toString());(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.addEventListener('message',this.realtime.authenticate);for(const channel in this.realtime.channels){this.realtime.channels[channel].forEach(callback=>{var _a;(_a=this.realtime.socket)===null||_a===void 0?void 0:_a.addEventListener('message',callback);});}
|
||||
this.realtime.socket.addEventListener('close',event=>{var _a,_b,_c;if(((_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){return;}
|
||||
console.error('Realtime got disconnected. Reconnect will be attempted in 1 second.',event.reason);setTimeout(()=>{this.realtime.createSocket();},1000);});},authenticate:(event)=>{var _a,_b;const message=JSON.parse(event.data);if(message.type==='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 data=message.data;if(session&&!data.user){(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.send(JSON.stringify({type:"authentication",data:{session}}));}}},onMessage:(channel,callback)=>(event)=>{try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;if(message.type==='event'){let data=message.data;if(data.channels&&data.channels.includes(channel)){callback(data);}}
|
||||
console.error('Realtime got disconnected. Reconnect will be attempted in 1 second.',event.reason);setTimeout(()=>{this.realtime.createSocket();},1000);});},authenticate:(event)=>{var _a,_b,_c;const message=JSON.parse(event.data);if(message.type==='connected'&&((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)===WebSocket.OPEN){const cookie=JSON.parse((_b=window.localStorage.getItem('cookieFallback'))!==null&&_b!==void 0?_b:"{}");const session=cookie===null||cookie===void 0?void 0:cookie[`a_session_${this.config.project}`];const data=message.data;if(session&&!data.user){(_c=this.realtime.socket)===null||_c===void 0?void 0:_c.send(JSON.stringify({type:"authentication",data:{session}}));}}},onMessage:(channel,callback)=>(event)=>{try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;if(message.type==='event'){let data=message.data;if(data.channels&&data.channels.includes(channel)){callback(data);}}
|
||||
else if(message.type==='error'){throw message.data;}}
|
||||
catch(e){console.error(e);}}};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"');}
|
||||
if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');}
|
||||
|
@ -43,7 +43,14 @@ 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);}),createOAuth2Session:(provider,success,failure,scopes)=>{if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');}
|
||||
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;}
|
||||
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"');}
|
||||
let path='/account/sessions/magic-url';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
|
||||
if(typeof secret!=='undefined'){payload['secret']=secret;}
|
||||
const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),createOAuth2Session:(provider,success,failure,scopes)=>{if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');}
|
||||
let path='/account/sessions/oauth2/{provider}'.replace('{provider}',provider);let payload={};if(typeof success!=='undefined'){payload['success']=success;}
|
||||
if(typeof failure!=='undefined'){payload['failure']=failure;}
|
||||
if(typeof scopes!=='undefined'){payload['scopes']=scopes;}
|
||||
|
@ -474,7 +481,8 @@ else{data={message:yield response.text()};}
|
|||
if(400<=response.status){throw new AppwriteException(data===null||data===void 0?void 0:data.message,response.status,data);}
|
||||
const cookieFallback=response.headers.get('X-Fallback-Cookies');if(typeof window!=='undefined'&&window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);}
|
||||
return data;}
|
||||
catch(e){throw new AppwriteException(e.message);}});}
|
||||
catch(e){if(e instanceof AppwriteException){throw e;}
|
||||
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;}}
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
mode: '',
|
||||
};
|
||||
this.headers = {
|
||||
'x-sdk-version': 'appwrite:web:2.1.0',
|
||||
'X-Appwrite-Response-Format': '0.9.0',
|
||||
'x-sdk-version': 'appwrite:web:4.0.1',
|
||||
'X-Appwrite-Response-Format': '0.10.0',
|
||||
};
|
||||
this.realtime = {
|
||||
socket: undefined,
|
||||
|
@ -85,14 +85,14 @@
|
|||
});
|
||||
},
|
||||
authenticate: (event) => {
|
||||
var _a, _b;
|
||||
var _a, _b, _c;
|
||||
const message = JSON.parse(event.data);
|
||||
if (message.type === 'connected') {
|
||||
const cookie = JSON.parse((_a = window.localStorage.getItem('cookieFallback')) !== null && _a !== void 0 ? _a : "{}");
|
||||
if (message.type === 'connected' && ((_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN) {
|
||||
const cookie = JSON.parse((_b = window.localStorage.getItem('cookieFallback')) !== null && _b !== void 0 ? _b : "{}");
|
||||
const session = cookie === null || cookie === void 0 ? void 0 : cookie[`a_session_${this.config.project}`];
|
||||
const data = message.data;
|
||||
if (session && !data.user) {
|
||||
(_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.send(JSON.stringify({
|
||||
(_c = this.realtime.socket) === null || _c === void 0 ? void 0 : _c.send(JSON.stringify({
|
||||
type: "authentication",
|
||||
data: {
|
||||
session
|
||||
|
@ -398,7 +398,7 @@
|
|||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* Complete Password Recovery
|
||||
* Create Password Recovery (confirmation)
|
||||
*
|
||||
* Use this endpoint to complete the user account password reset. Both the
|
||||
* **userId** and **secret** arguments will be passed as query parameters to
|
||||
|
@ -535,6 +535,82 @@
|
|||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* Create Magic URL session
|
||||
*
|
||||
* Sends the user an email with a secret key for creating a session. When the
|
||||
* user clicks the link in the email, the user is redirected back to the URL
|
||||
* you provided with the secret key and userId values attached to the URL
|
||||
* query string. Use the query string parameters to submit a request to the
|
||||
* [PUT
|
||||
* /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession)
|
||||
* endpoint to complete the login process. The link sent to the user's email
|
||||
* address is valid for 1 hour. If you are on a mobile device you can leave
|
||||
* the URL parameter empty, so that the login completion will be handled by
|
||||
* your Appwrite instance by default.
|
||||
*
|
||||
* @param {string} email
|
||||
* @param {string} url
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}),
|
||||
/**
|
||||
* Create Magic URL session (confirmation)
|
||||
*
|
||||
* Use this endpoint to complete creating the session with the Magic URL. Both
|
||||
* the **userId** and **secret** arguments will be passed as query parameters
|
||||
* to the redirect URL you have provided when sending your request to the
|
||||
* [POST
|
||||
* /account/sessions/magic-url](/docs/client/account#accountCreateMagicURLSession)
|
||||
* endpoint.
|
||||
*
|
||||
* Please note that in order to avoid a [Redirect
|
||||
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
* the only valid redirect URLs are the ones from domains you have set when
|
||||
* adding your platforms in the console interface.
|
||||
*
|
||||
* @param {string} userId
|
||||
* @param {string} secret
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
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"');
|
||||
}
|
||||
let path = '/account/sessions/magic-url';
|
||||
let payload = {};
|
||||
if (typeof userId !== 'undefined') {
|
||||
payload['userId'] = userId;
|
||||
}
|
||||
if (typeof secret !== 'undefined') {
|
||||
payload['secret'] = secret;
|
||||
}
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('put', uri, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* Create Account Session with OAuth2
|
||||
*
|
||||
|
@ -666,7 +742,7 @@
|
|||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* Complete Email Verification
|
||||
* Create Email Verification (confirmation)
|
||||
*
|
||||
* Use this endpoint to complete the user email verification process. Use both
|
||||
* the **userId** and **secret** parameters that were attached to your app URL
|
||||
|
@ -4377,6 +4453,9 @@
|
|||
return data;
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof AppwriteException) {
|
||||
throw e;
|
||||
}
|
||||
throw new AppwriteException(e.message);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue