Merge branch '0.9.x' into feat-upgrade-runtimes
This commit is contained in:
commit
02c5eba4e4
45 changed files with 6336 additions and 1600 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.php_cs.cache
|
.php_cs.cache
|
||||||
debug/
|
debug/
|
||||||
|
app/sdks
|
|
@ -3,6 +3,7 @@
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Added support for Android
|
- Added support for Android
|
||||||
|
- Added a new Cloud Functions runtime for Java
|
||||||
- Added a new gravity option when croping storage images using the file preview endpoint (#1260)
|
- Added a new gravity option when croping storage images using the file preview endpoint (#1260)
|
||||||
- Upgraded GEOIP DB file to Jun 2021 release (#1256)
|
- Upgraded GEOIP DB file to Jun 2021 release (#1256)
|
||||||
- Added file created date to file info on the console (#1183)
|
- Added file created date to file info on the console (#1183)
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
- _APP_INFLUXDB_HOST
|
- _APP_INFLUXDB_HOST
|
||||||
- _APP_INFLUXDB_PORT
|
- _APP_INFLUXDB_PORT
|
||||||
- Added new endpoint to get a session based on it's ID (#1294)
|
- Added new endpoint to get a session based on it's ID (#1294)
|
||||||
|
- Added added a new version param to the migration script (#1342)
|
||||||
|
|
||||||
## Breaking Changes (Read before upgrading!)
|
## Breaking Changes (Read before upgrading!)
|
||||||
- Renamed `env` param on `/v1/functions` to `runtime` (#1314)
|
- Renamed `env` param on `/v1/functions` to `runtime` (#1314)
|
||||||
|
@ -39,6 +41,7 @@
|
||||||
- Fixed missing session object when OAuth session creation event is triggered (#1208)
|
- Fixed missing session object when OAuth session creation event is triggered (#1208)
|
||||||
- Fixed bug where we didn't ignore the email case, converted all emails to lowercase internally (#1243)
|
- Fixed bug where we didn't ignore the email case, converted all emails to lowercase internally (#1243)
|
||||||
- Fixed a console bug where you can't click a user with no name, added a placehoder for anonyomous users (#1220)
|
- Fixed a console bug where you can't click a user with no name, added a placehoder for anonyomous users (#1220)
|
||||||
|
- Fixed unique keys not being updated when changing a user's email address (#1301)
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ FROM php:8.0-cli-alpine as step1
|
||||||
|
|
||||||
ENV PHP_REDIS_VERSION=5.3.4 \
|
ENV PHP_REDIS_VERSION=5.3.4 \
|
||||||
PHP_SWOOLE_VERSION=v4.6.7 \
|
PHP_SWOOLE_VERSION=v4.6.7 \
|
||||||
PHP_IMAGICK_VERSION=master \
|
PHP_IMAGICK_VERSION=3.5.0 \
|
||||||
PHP_YAML_VERSION=2.2.1 \
|
PHP_YAML_VERSION=2.2.1 \
|
||||||
PHP_MAXMINDDB_VERSION=v1.10.1
|
PHP_MAXMINDDB_VERSION=v1.10.1
|
||||||
|
|
||||||
|
@ -53,10 +53,8 @@ RUN \
|
||||||
make && make install && \
|
make && make install && \
|
||||||
cd .. && \
|
cd .. && \
|
||||||
## Imagick Extension
|
## Imagick Extension
|
||||||
## Last working commit https://github.com/Imagick/imagick/commit/35741750aa1cda2b7ac354bfa6128fa037e9cf32
|
git clone --depth 1 --branch $PHP_IMAGICK_VERSION https://github.com/imagick/imagick && \
|
||||||
git clone --branch $PHP_IMAGICK_VERSION https://github.com/Imagick/imagick && \
|
|
||||||
cd imagick && \
|
cd imagick && \
|
||||||
git checkout 35741750aa1cda2b7ac354bfa6128fa037e9cf32 && \
|
|
||||||
phpize && \
|
phpize && \
|
||||||
./configure && \
|
./configure && \
|
||||||
make && make install && \
|
make && make install && \
|
||||||
|
@ -152,10 +150,12 @@ RUN \
|
||||||
brotli-dev \
|
brotli-dev \
|
||||||
yaml-dev \
|
yaml-dev \
|
||||||
imagemagick \
|
imagemagick \
|
||||||
|
imagemagick-dev \
|
||||||
libmaxminddb-dev \
|
libmaxminddb-dev \
|
||||||
certbot \
|
certbot \
|
||||||
docker-cli \
|
docker-cli \
|
||||||
docker-compose \
|
docker-compose \
|
||||||
|
libgomp \
|
||||||
&& docker-php-ext-install sockets opcache pdo_mysql \
|
&& docker-php-ext-install sockets opcache pdo_mysql \
|
||||||
&& apk del .deps \
|
&& apk del .deps \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
|
@ -15,7 +15,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'web',
|
'key' => 'web',
|
||||||
'name' => 'Web',
|
'name' => 'Web',
|
||||||
'version' => '3.1.0',
|
'version' => '3.2.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-web',
|
'url' => 'https://github.com/appwrite/sdk-for-web',
|
||||||
'package' => 'https://www.npmjs.com/package/appwrite',
|
'package' => 'https://www.npmjs.com/package/appwrite',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -62,7 +62,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'flutter',
|
'key' => 'flutter',
|
||||||
'name' => 'Flutter',
|
'name' => 'Flutter',
|
||||||
'version' => '0.6.4',
|
'version' => '0.7.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-flutter',
|
'url' => 'https://github.com/appwrite/sdk-for-flutter',
|
||||||
'package' => 'https://pub.dev/packages/appwrite',
|
'package' => 'https://pub.dev/packages/appwrite',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -152,7 +152,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'web',
|
'key' => 'web',
|
||||||
'name' => 'Console',
|
'name' => 'Console',
|
||||||
'version' => '2.0.0',
|
'version' => '2.1.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-console',
|
'url' => 'https://github.com/appwrite/sdk-for-console',
|
||||||
'package' => '',
|
'package' => '',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -179,7 +179,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'nodejs',
|
'key' => 'nodejs',
|
||||||
'name' => 'Node.js',
|
'name' => 'Node.js',
|
||||||
'version' => '2.3.0',
|
'version' => '2.4.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-node',
|
'url' => 'https://github.com/appwrite/sdk-for-node',
|
||||||
'package' => 'https://www.npmjs.com/package/node-appwrite',
|
'package' => 'https://www.npmjs.com/package/node-appwrite',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -196,7 +196,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'deno',
|
'key' => 'deno',
|
||||||
'name' => 'Deno',
|
'name' => 'Deno',
|
||||||
'version' => '0.2.2',
|
'version' => '0.3.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-deno',
|
'url' => 'https://github.com/appwrite/sdk-for-deno',
|
||||||
'package' => 'https://deno.land/x/appwrite',
|
'package' => 'https://deno.land/x/appwrite',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -213,7 +213,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'php',
|
'key' => 'php',
|
||||||
'name' => 'PHP',
|
'name' => 'PHP',
|
||||||
'version' => '2.1.2',
|
'version' => '2.2.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-php',
|
'url' => 'https://github.com/appwrite/sdk-for-php',
|
||||||
'package' => 'https://packagist.org/packages/appwrite/appwrite',
|
'package' => 'https://packagist.org/packages/appwrite/appwrite',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -230,7 +230,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'python',
|
'key' => 'python',
|
||||||
'name' => 'Python',
|
'name' => 'Python',
|
||||||
'version' => '0.3.0',
|
'version' => '0.4.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-python',
|
'url' => 'https://github.com/appwrite/sdk-for-python',
|
||||||
'package' => 'https://pypi.org/project/appwrite/',
|
'package' => 'https://pypi.org/project/appwrite/',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -247,7 +247,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'ruby',
|
'key' => 'ruby',
|
||||||
'name' => 'Ruby',
|
'name' => 'Ruby',
|
||||||
'version' => '2.2.0',
|
'version' => '2.3.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-ruby',
|
'url' => 'https://github.com/appwrite/sdk-for-ruby',
|
||||||
'package' => 'https://rubygems.org/gems/appwrite',
|
'package' => 'https://rubygems.org/gems/appwrite',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -264,7 +264,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'go',
|
'key' => 'go',
|
||||||
'name' => 'Go',
|
'name' => 'Go',
|
||||||
'version' => '0.0.7',
|
'version' => '0.1.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-go',
|
'url' => 'https://github.com/appwrite/sdk-for-go',
|
||||||
'package' => '',
|
'package' => '',
|
||||||
'enabled' => false,
|
'enabled' => false,
|
||||||
|
@ -315,7 +315,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'dart',
|
'key' => 'dart',
|
||||||
'name' => 'Dart',
|
'name' => 'Dart',
|
||||||
'version' => '0.6.3',
|
'version' => '0.7.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-dart',
|
'url' => 'https://github.com/appwrite/sdk-for-dart',
|
||||||
'package' => 'https://pub.dev/packages/dart_appwrite',
|
'package' => 'https://pub.dev/packages/dart_appwrite',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -332,7 +332,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'cli',
|
'key' => 'cli',
|
||||||
'name' => 'Command Line',
|
'name' => 'Command Line',
|
||||||
'version' => '0.10.0',
|
'version' => '0.11.0',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-cli',
|
'url' => 'https://github.com/appwrite/sdk-for-cli',
|
||||||
'package' => 'https://github.com/appwrite/sdk-for-cli',
|
'package' => 'https://github.com/appwrite/sdk-for-cli',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1155,7 +1155,12 @@ App::patch('/v1/account/email')
|
||||||
|
|
||||||
// TODO after this user needs to confirm mail again
|
// TODO after this user needs to confirm mail again
|
||||||
|
|
||||||
$user = $projectDB->updateDocument(\array_merge(
|
if (!$isAnonymousUser) {
|
||||||
|
// Remove previous unique ID.
|
||||||
|
$projectDB->deleteUniqueKey(\md5($user->getArrayCopy()['$collection'].':'.'email'.'='.$user->getAttribute('email')));
|
||||||
|
}
|
||||||
|
|
||||||
|
$document = (\array_merge(
|
||||||
$user->getArrayCopy(),
|
$user->getArrayCopy(),
|
||||||
($isAnonymousUser ? [ 'password' => Auth::passwordHash($password) ] : []),
|
($isAnonymousUser ? [ 'password' => Auth::passwordHash($password) ] : []),
|
||||||
[
|
[
|
||||||
|
@ -1164,6 +1169,10 @@ App::patch('/v1/account/email')
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$user = $projectDB->updateDocument($document);
|
||||||
|
|
||||||
|
$projectDB->addUniqueKey(\md5($document['$collection'].':'.'email'.'='.$email));
|
||||||
|
|
||||||
if (false === $user) {
|
if (false === $user) {
|
||||||
throw new Exception('Failed saving user to DB', 500);
|
throw new Exception('Failed saving user to DB', 500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ use Utopia\Image\Image;
|
||||||
use Appwrite\OpenSSL\OpenSSL;
|
use Appwrite\OpenSSL\OpenSSL;
|
||||||
use Appwrite\Utopia\Response;
|
use Appwrite\Utopia\Response;
|
||||||
use Utopia\Config\Config;
|
use Utopia\Config\Config;
|
||||||
use Utopia\Validator\Numeric;
|
|
||||||
|
|
||||||
App::post('/v1/storage/files')
|
App::post('/v1/storage/files')
|
||||||
->desc('Create File')
|
->desc('Create File')
|
||||||
|
@ -280,7 +279,7 @@ App::get('/v1/storage/files/:fileId/preview')
|
||||||
$fileLogos = Config::getParam('storage-logos');
|
$fileLogos = Config::getParam('storage-logos');
|
||||||
|
|
||||||
$date = \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT'; // 45 days cache
|
$date = \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT'; // 45 days cache
|
||||||
$key = \md5($fileId.$width.$height.$quality.$borderWidth.$borderColor.$borderRadius.$opacity.$rotation.$background.$storage.$output);
|
$key = \md5($fileId.$width.$height.$gravity.$quality.$borderWidth.$borderColor.$borderRadius.$opacity.$rotation.$background.$storage.$output);
|
||||||
|
|
||||||
$file = $projectDB->getDocument($fileId);
|
$file = $projectDB->getDocument($fileId);
|
||||||
|
|
||||||
|
@ -300,7 +299,7 @@ App::get('/v1/storage/files/:fileId/preview')
|
||||||
$cipher = null;
|
$cipher = null;
|
||||||
$background = (empty($background)) ? 'eceff1' : $background;
|
$background = (empty($background)) ? 'eceff1' : $background;
|
||||||
$type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION));
|
$type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION));
|
||||||
$key = \md5($path.$width.$height.$quality.$borderWidth.$borderColor.$borderRadius.$opacity.$rotation.$background.$storage.$output);
|
$key = \md5($path.$width.$height.$gravity.$quality.$borderWidth.$borderColor.$borderRadius.$opacity.$rotation.$background.$storage.$output);
|
||||||
}
|
}
|
||||||
|
|
||||||
$compressor = new GZIP();
|
$compressor = new GZIP();
|
||||||
|
|
|
@ -7,7 +7,7 @@ use Appwrite\Network\Validator\Host;
|
||||||
use Appwrite\Utopia\Response;
|
use Appwrite\Utopia\Response;
|
||||||
use Utopia\App;
|
use Utopia\App;
|
||||||
use Utopia\Validator\ArrayList;
|
use Utopia\Validator\ArrayList;
|
||||||
use Utopia\Validator\Integer;
|
use Utopia\Validator\Numeric;
|
||||||
use Utopia\Validator\Text;
|
use Utopia\Validator\Text;
|
||||||
use Utopia\Storage\Validator\File;
|
use Utopia\Storage\Validator\File;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ App::get('/v1/mock/tests/foo')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,7 @@ App::post('/v1/mock/tests/foo')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -60,7 +60,7 @@ App::patch('/v1/mock/tests/foo')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -78,7 +78,7 @@ App::put('/v1/mock/tests/foo')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -96,7 +96,7 @@ App::delete('/v1/mock/tests/foo')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -114,7 +114,7 @@ App::get('/v1/mock/tests/bar')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -132,7 +132,7 @@ App::post('/v1/mock/tests/bar')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -150,7 +150,7 @@ App::patch('/v1/mock/tests/bar')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -168,7 +168,7 @@ App::put('/v1/mock/tests/bar')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -186,7 +186,7 @@ App::delete('/v1/mock/tests/bar')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->action(function ($x, $y, $z) {
|
->action(function ($x, $y, $z) {
|
||||||
});
|
});
|
||||||
|
@ -230,7 +230,7 @@ App::post('/v1/mock/tests/general/upload')
|
||||||
->label('sdk.response.model', Response::MODEL_MOCK)
|
->label('sdk.response.model', Response::MODEL_MOCK)
|
||||||
->label('sdk.mock', true)
|
->label('sdk.mock', true)
|
||||||
->param('x', '', new Text(100), 'Sample string param')
|
->param('x', '', new Text(100), 'Sample string param')
|
||||||
->param('y', '', new Integer(), 'Sample numeric param')
|
->param('y', '', new Numeric(), 'Sample numeric param')
|
||||||
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
|
||||||
->param('file', [], new File(), 'Sample file param', false)
|
->param('file', [], new File(), 'Sample file param', false)
|
||||||
->inject('request')
|
->inject('request')
|
||||||
|
|
|
@ -8,12 +8,20 @@ use Appwrite\Database\Database;
|
||||||
use Appwrite\Database\Validator\Authorization;
|
use Appwrite\Database\Validator\Authorization;
|
||||||
use Appwrite\Database\Adapter\MySQL as MySQLAdapter;
|
use Appwrite\Database\Adapter\MySQL as MySQLAdapter;
|
||||||
use Appwrite\Database\Adapter\Redis as RedisAdapter;
|
use Appwrite\Database\Adapter\Redis as RedisAdapter;
|
||||||
use Appwrite\Migration\Version;
|
use Appwrite\Migration\Migration;
|
||||||
|
use Utopia\Validator\Text;
|
||||||
|
|
||||||
$cli
|
$cli
|
||||||
->task('migrate')
|
->task('migrate')
|
||||||
->action(function () use ($register) {
|
->param('version', APP_VERSION_STABLE, new Text(8), 'Version to migrate to.', true)
|
||||||
Console::success('Starting Data Migration');
|
->action(function ($version) use ($register) {
|
||||||
|
if (!array_key_exists($version, Migration::$versions)) {
|
||||||
|
Console::error("Version {$version} not found.");
|
||||||
|
Console::exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::success('Starting Data Migration to version '.$version);
|
||||||
$db = $register->get('db', true);
|
$db = $register->get('db', true);
|
||||||
$cache = $register->get('cache', true);
|
$cache = $register->get('cache', true);
|
||||||
|
|
||||||
|
@ -38,7 +46,8 @@ $cli
|
||||||
$projects = [$console];
|
$projects = [$console];
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
$migration = new Version\V08($register->get('db')); //TODO: remove hardcoded version and move to dynamic migration
|
$class = 'Appwrite\\Migration\\Version\\'.Migration::$versions[$version];
|
||||||
|
$migration = new $class($register->get('db'));
|
||||||
|
|
||||||
while ($sum > 0) {
|
while ($sum > 0) {
|
||||||
foreach ($projects as $project) {
|
foreach ($projects as $project) {
|
||||||
|
|
|
@ -225,8 +225,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
\exec('mkdir -p '.$resultExamples.' && cp -r '.$result.'/docs/examples '.$resultExamples);
|
\exec('mkdir -p '.$resultExamples.' && cp -r '.$result.'/docs/examples '.$resultExamples);
|
||||||
Console::success("Copied code examples for {$language['name']} SDK to: {$resultExamples}");
|
Console::success("Copied code examples for {$language['name']} SDK to: {$resultExamples}");
|
||||||
|
|
||||||
\exec('rm -rf '.$result);
|
|
||||||
Console::success("Removed source code directory '{$result}' for {$language['name']} SDK");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -612,7 +612,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true);
|
||||||
--code='/myrepo/myfunction'" data-forms-code="powershell" data-lang="powershell" data-lang-label="PowerShell"></textarea>
|
--code='/myrepo/myfunction'" data-forms-code="powershell" data-lang="powershell" data-lang-label="PowerShell"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Learn more about <a href="" target="_blank">creating tags</a>, installing and using the <a href="" target="_blank">Appwrite CLI</a>.</p>
|
<p>Learn more about <a href="https://appwrite.io/docs/server/functions#functionsCreateTag" target="_blank">creating tags</a>, installing and using the <a href="https://appwrite.io/docs/command-line" target="_blank">Appwrite CLI</a>.</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h2 style="display: none">Manual</h2>
|
<h2 style="display: none">Manual</h2>
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
"slickdeals/statsd": "3.1.0"
|
"slickdeals/statsd": "3.1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"appwrite/sdk-generator": "0.11.0",
|
"appwrite/sdk-generator": "0.11.1",
|
||||||
"swoole/ide-helper": "4.6.7",
|
"swoole/ide-helper": "4.6.7",
|
||||||
"phpunit/phpunit": "9.5.6",
|
"phpunit/phpunit": "9.5.6",
|
||||||
"vimeo/psalm": "4.7.2"
|
"vimeo/psalm": "4.7.2"
|
||||||
|
|
26
composer.lock
generated
26
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "8133b7af84411021118804b9d174b9d5",
|
"content-hash": "65ff5003b9122286423aa030cb6983ea",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adhocore/jwt",
|
"name": "adhocore/jwt",
|
||||||
|
@ -2403,16 +2403,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "appwrite/sdk-generator",
|
"name": "appwrite/sdk-generator",
|
||||||
"version": "0.11.0",
|
"version": "0.11.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||||
"reference": "96c41c44f930a4d40184cd0f3c7dca76d2cca7e1"
|
"reference": "9809c31f27037d088fb832cdec0e8fbc93d1d388"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/96c41c44f930a4d40184cd0f3c7dca76d2cca7e1",
|
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/9809c31f27037d088fb832cdec0e8fbc93d1d388",
|
||||||
"reference": "96c41c44f930a4d40184cd0f3c7dca76d2cca7e1",
|
"reference": "9809c31f27037d088fb832cdec0e8fbc93d1d388",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2446,9 +2446,9 @@
|
||||||
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
||||||
"source": "https://github.com/appwrite/sdk-generator/tree/0.11.0"
|
"source": "https://github.com/appwrite/sdk-generator/tree/0.11.1"
|
||||||
},
|
},
|
||||||
"time": "2021-07-01T13:51:23+00:00"
|
"time": "2021-07-02T10:15:53+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "composer/package-versions-deprecated",
|
"name": "composer/package-versions-deprecated",
|
||||||
|
@ -3117,16 +3117,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nikic/php-parser",
|
"name": "nikic/php-parser",
|
||||||
"version": "v4.10.5",
|
"version": "v4.11.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||||
"reference": "4432ba399e47c66624bc73c8c0f811e5c109576f"
|
"reference": "fe14cf3672a149364fb66dfe11bf6549af899f94"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4432ba399e47c66624bc73c8c0f811e5c109576f",
|
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fe14cf3672a149364fb66dfe11bf6549af899f94",
|
||||||
"reference": "4432ba399e47c66624bc73c8c0f811e5c109576f",
|
"reference": "fe14cf3672a149364fb66dfe11bf6549af899f94",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3167,9 +3167,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.10.5"
|
"source": "https://github.com/nikic/PHP-Parser/tree/v4.11.0"
|
||||||
},
|
},
|
||||||
"time": "2021-05-03T19:11:20+00:00"
|
"time": "2021-07-03T13:36:55+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "openlss/lib-array2xml",
|
"name": "openlss/lib-array2xml",
|
||||||
|
|
|
@ -5,7 +5,7 @@ sdk
|
||||||
.setProject('5df5acd0d48c2') // Your project ID
|
.setProject('5df5acd0d48c2') // Your project ID
|
||||||
;
|
;
|
||||||
|
|
||||||
let promise = sdk.functions.create('[NAME]', [], 'java-11');
|
let promise = sdk.functions.create('[NAME]', [], 'java-11.0');
|
||||||
|
|
||||||
promise.then(function (response) {
|
promise.then(function (response) {
|
||||||
console.log(response); // Success
|
console.log(response); // Success
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
appwrite functions create --name="[NAME]" --execute="" --runtime="java-11" --vars="{}" --events="" --schedule="" --timeout="1"
|
appwrite functions create --name="[NAME]" --execute="" --runtime="java-11.0" --vars="{}" --events="" --schedule="" --timeout="1"
|
|
@ -13,7 +13,7 @@ void main() { // Init SDK
|
||||||
Future result = functions.create(
|
Future result = functions.create(
|
||||||
name: '[NAME]',
|
name: '[NAME]',
|
||||||
execute: [],
|
execute: [],
|
||||||
runtime: 'java-11',
|
runtime: 'java-11.0',
|
||||||
);
|
);
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
|
@ -12,7 +12,7 @@ client
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
let promise = functions.create('[NAME]', [], 'java-11');
|
let promise = functions.create('[NAME]', [], 'java-11.0');
|
||||||
|
|
||||||
promise.then(function (response) {
|
promise.then(function (response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
|
@ -10,4 +10,4 @@ client
|
||||||
|
|
||||||
Functions functions = new Functions(client);
|
Functions functions = new Functions(client);
|
||||||
|
|
||||||
HttpResponseMessage result = await functions.Create("[NAME]", [List<object>], "java-11");
|
HttpResponseMessage result = await functions.Create("[NAME]", [List<object>], "java-11.0");
|
||||||
|
|
|
@ -11,7 +11,7 @@ suspend fun main() {
|
||||||
val response = functions.create(
|
val response = functions.create(
|
||||||
name = "[NAME]",
|
name = "[NAME]",
|
||||||
execute = listOf(),
|
execute = listOf(),
|
||||||
runtime = "java-11",
|
runtime = "java-11.0",
|
||||||
)
|
)
|
||||||
val json = response.body?.string()
|
val json = response.body?.string()
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ client
|
||||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||||
;
|
;
|
||||||
|
|
||||||
let promise = functions.create('[NAME]', [], 'java-11');
|
let promise = functions.create('[NAME]', [], 'java-11.0');
|
||||||
|
|
||||||
promise.then(function (response) {
|
promise.then(function (response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
|
@ -13,4 +13,4 @@ $client
|
||||||
|
|
||||||
$functions = new Functions($client);
|
$functions = new Functions($client);
|
||||||
|
|
||||||
$result = $functions->create('[NAME]', [], 'java-11');
|
$result = $functions->create('[NAME]', [], 'java-11.0');
|
|
@ -11,4 +11,4 @@ client = Client()
|
||||||
|
|
||||||
functions = Functions(client)
|
functions = Functions(client)
|
||||||
|
|
||||||
result = functions.create('[NAME]', [], 'java-11')
|
result = functions.create('[NAME]', [], 'java-11.0')
|
||||||
|
|
|
@ -10,6 +10,6 @@ client
|
||||||
|
|
||||||
functions = Appwrite::Functions.new(client);
|
functions = Appwrite::Functions.new(client);
|
||||||
|
|
||||||
response = functions.create(name: '[NAME]', execute: [], runtime: 'java-11');
|
response = functions.create(name: '[NAME]', execute: [], runtime: 'java-11.0');
|
||||||
|
|
||||||
puts response
|
puts response
|
|
@ -1 +1,3 @@
|
||||||
Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
||||||
|
|
||||||
|
If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user..
|
||||||
|
|
|
@ -40,7 +40,7 @@ try {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
|
@ -68,7 +68,7 @@ try {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
|
@ -45,7 +45,7 @@ try {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
|
@ -122,7 +122,7 @@ try {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-flutter)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-flutter)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
85
docs/sdks/kotlin/GETTING_STARTED.md
Normal file
85
docs/sdks/kotlin/GETTING_STARTED.md
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
### Init your SDK
|
||||||
|
|
||||||
|
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key project API keys section.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.services.Account
|
||||||
|
|
||||||
|
suspend fun main() {
|
||||||
|
val client = Client(context)
|
||||||
|
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||||
|
.setProject("5df5acd0d48c2") // Your project ID
|
||||||
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||||
|
.setSelfSigned(true) // Use only on dev mode with a self-signed SSL cert
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Make Your First Request
|
||||||
|
|
||||||
|
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val users = Users(client)
|
||||||
|
val response = users.create(
|
||||||
|
email = "email@example.com",
|
||||||
|
password = "password",
|
||||||
|
)
|
||||||
|
val json = response.body?.string()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Full Example
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.services.Users
|
||||||
|
|
||||||
|
suspend fun main() {
|
||||||
|
val client = Client(context)
|
||||||
|
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||||
|
.setProject("5df5acd0d48c2") // Your project ID
|
||||||
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||||
|
.setSelfSigned(true) // Use only on dev mode with a self-signed SSL cert
|
||||||
|
|
||||||
|
val users = Users(client)
|
||||||
|
val response = users.create(
|
||||||
|
email = "email@example.com",
|
||||||
|
password = "password",
|
||||||
|
)
|
||||||
|
val json = response.body?.string()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Error Handling
|
||||||
|
|
||||||
|
The Appwrite Kotlin SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.services.Users
|
||||||
|
|
||||||
|
suspend fun main() {
|
||||||
|
val users = Users(client)
|
||||||
|
try {
|
||||||
|
val response = users.create(
|
||||||
|
email = "email@example.com",
|
||||||
|
password = "password",
|
||||||
|
)
|
||||||
|
var jsonString = response.body?.string() ?: ""
|
||||||
|
|
||||||
|
} catch (e: AppwriteException) {
|
||||||
|
println(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Learn more
|
||||||
|
|
||||||
|
You can use following resources to learn more and get help
|
||||||
|
|
||||||
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
||||||
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
- 🚂 [Appwrite Kotlin Playground](https://github.com/appwrite/playground-for-kotlin)
|
|
@ -68,7 +68,7 @@ try {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
|
@ -56,7 +56,7 @@ try {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
|
@ -57,7 +57,7 @@ except AppwriteException as e:
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
|
@ -57,7 +57,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
|
@ -52,7 +52,7 @@ sdk.account.create('me@example.com', 'password', 'Jane Doe')
|
||||||
```
|
```
|
||||||
|
|
||||||
### Learn more
|
### Learn more
|
||||||
You can use followng resources to learn more and get help
|
You can use following resources to learn more and get help
|
||||||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-flutter)
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-flutter)
|
||||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
|
7487
package-lock.json
generated
7487
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -14,8 +14,6 @@
|
||||||
"gulp-clean-css": "^4.3.0",
|
"gulp-clean-css": "^4.3.0",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
"gulp-jsmin": "^0.1.5",
|
"gulp-jsmin": "^0.1.5",
|
||||||
"gulp-less": "^4.0.1",
|
"gulp-less": "^5.0.0"
|
||||||
"ls-service-form2json": "^1.0.0",
|
|
||||||
"yargs-parser": "^20.2.7"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,12 +91,21 @@ abstract class Adapter
|
||||||
/**
|
/**
|
||||||
* Delete Unique Key.
|
* Delete Unique Key.
|
||||||
*
|
*
|
||||||
* @param int $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
abstract public function deleteUniqueKey($key);
|
abstract public function deleteUniqueKey($key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Unique Key.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
abstract public function addUniqueKey($key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Namespace.
|
* Create Namespace.
|
||||||
*
|
*
|
||||||
|
|
|
@ -366,7 +366,7 @@ class MySQL extends Adapter
|
||||||
/**
|
/**
|
||||||
* Delete Unique Key.
|
* Delete Unique Key.
|
||||||
*
|
*
|
||||||
* @param int $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
|
@ -383,6 +383,30 @@ class MySQL extends Adapter
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Unique Key.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function addUniqueKey($key)
|
||||||
|
{
|
||||||
|
$st = $this->getPDO()->prepare('INSERT INTO `'.$this->getNamespace().'.database.unique`
|
||||||
|
SET `key` = :key;
|
||||||
|
');
|
||||||
|
|
||||||
|
$st->bindValue(':key', $key, PDO::PARAM_STR);
|
||||||
|
|
||||||
|
if (!$st->execute()) {
|
||||||
|
throw new Duplicate('Duplicated Property: '.$key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Relation.
|
* Create Relation.
|
||||||
*
|
*
|
||||||
|
|
|
@ -168,6 +168,22 @@ class Redis extends Adapter
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Unique Key.
|
||||||
|
*
|
||||||
|
* @param $key
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function addUniqueKey($key)
|
||||||
|
{
|
||||||
|
$data = $this->adapter->addUniqueKey($key);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Namespace.
|
* Create Namespace.
|
||||||
*
|
*
|
||||||
|
|
|
@ -370,6 +370,18 @@ class Database
|
||||||
return new Document($this->adapter->deleteUniqueKey($key));
|
return new Document($this->adapter->deleteUniqueKey($key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $key
|
||||||
|
*
|
||||||
|
* @return Document|false
|
||||||
|
*
|
||||||
|
* @throws AuthorizationException
|
||||||
|
*/
|
||||||
|
public function addUniqueKey($key)
|
||||||
|
{
|
||||||
|
return new Document($this->adapter->addUniqueKey($key));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,6 +31,16 @@ abstract class Migration
|
||||||
*/
|
*/
|
||||||
protected $projectDB;
|
protected $projectDB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static array $versions = [
|
||||||
|
'0.6.0' => 'V05',
|
||||||
|
'0.7.0' => 'V06',
|
||||||
|
'0.8.0' => 'V07',
|
||||||
|
'0.9.0' => 'V08',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Migration constructor.
|
* Migration constructor.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Appwrite\Migration\Version;
|
|
||||||
|
|
||||||
use Utopia\CLI\Console;
|
|
||||||
use Appwrite\Migration\Migration;
|
|
||||||
|
|
||||||
class V04 extends Migration
|
|
||||||
{
|
|
||||||
public function execute(): void
|
|
||||||
{
|
|
||||||
Console::log('I got nothing to do.');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -591,6 +591,29 @@ trait AccountBase
|
||||||
|
|
||||||
$this->assertEquals($response['headers']['status-code'], 400);
|
$this->assertEquals($response['headers']['status-code'], 400);
|
||||||
|
|
||||||
|
// Test if we can create a new account with the old email
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for SUCCESS
|
||||||
|
*/
|
||||||
|
$response = $this->client->call(Client::METHOD_POST, '/account', array_merge([
|
||||||
|
'origin' => 'http://localhost',
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
]), [
|
||||||
|
'email' => $data['email'],
|
||||||
|
'password' => $data['password'],
|
||||||
|
'name' => $data['name'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals($response['headers']['status-code'], 201);
|
||||||
|
$this->assertNotEmpty($response['body']);
|
||||||
|
$this->assertNotEmpty($response['body']['$id']);
|
||||||
|
$this->assertIsNumeric($response['body']['registration']);
|
||||||
|
$this->assertEquals($response['body']['email'], $data['email']);
|
||||||
|
$this->assertEquals($response['body']['name'], $data['name'],);
|
||||||
|
|
||||||
|
|
||||||
$data['email'] = $newEmail;
|
$data['email'] = $newEmail;
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|
|
@ -36,4 +36,17 @@ abstract class MigrationTest extends TestCase
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check versions array integrity.
|
||||||
|
*/
|
||||||
|
public function testMigrationVersions()
|
||||||
|
{
|
||||||
|
require_once __DIR__.'/../../../app/init.php';
|
||||||
|
|
||||||
|
foreach (Migration::$versions as $version => $class) {
|
||||||
|
$this->assertTrue(class_exists('Appwrite\\Migration\\Version\\'.$class));
|
||||||
|
}
|
||||||
|
// Test if current version exists
|
||||||
|
$this->assertArrayHasKey(APP_VERSION_STABLE, Migration::$versions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue