diff --git a/CHANGES.md b/CHANGES.md index 340aec16d4..2c649ab5f0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## Bugs - Fix license detection for Flutter and Dart SDKs [#4435](https://github.com/appwrite/appwrite/pull/4435) +- Fix missing realtime event for create function deployment [#4574](https://github.com/appwrite/appwrite/pull/4574) # Version 1.0.3 ## Bugs diff --git a/README-CN.md b/README-CN.md index eaada5a34b..3f10f862c2 100644 --- a/README-CN.md +++ b/README-CN.md @@ -21,6 +21,8 @@ [English](README.md) | 简体中文 +[**我们发布了 Appwrite 1.0 版本!**](https://appwrite.io/1.0) + Appwrite是一个基于Docker的端到端开发者平台,其容器化的微服务库可应用于网页端,移动端,以及后端。Appwrite 通过视觉化界面极简了从零编写 API 的繁琐过程,在保证软件安全的前提下为开发者创造了一个高效的开发环境。 Appwrite 可以提供给开发者用户验证,外部授权,用户数据读写检索,文件储存,图像处理,云函数计算,[等多种服务](https://appwrite.io/docs). diff --git a/app/config/collections.php b/app/config/collections.php index 4d88518737..6d1cc81f41 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2216,69 +2216,69 @@ $collections = [ ], ], 'indexes' => [ - // [ - // '$id' => ID::custom('_key_search'), - // 'type' => Database::INDEX_FULLTEXT, - // 'attributes' => ['search'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_name'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['name'], - // 'lengths' => [700], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_enabled'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['enabled'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_runtime'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['runtime'], - // 'lengths' => [700], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_deployment'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['deployment'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_schedule'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['schedule'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_scheduleNext'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['scheduleNext'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_schedulePrevious'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['schedulePrevious'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_timeout'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['timeout'], - // 'lengths' => [], - // 'orders' => [], - // ], + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_name'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['name'], + 'lengths' => [768], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_enabled'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['enabled'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_runtime'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['runtime'], + 'lengths' => [768], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_deployment'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['deployment'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_schedule'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['schedule'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_scheduleNext'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['scheduleNext'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_schedulePrevious'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['schedulePrevious'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_timeout'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['timeout'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], ], ], @@ -2410,55 +2410,55 @@ $collections = [ ] ], 'indexes' => [ - // [ - // '$id' => ID::custom('_key_resource'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['resourceId'], - // 'lengths' => [Database::LENGTH_KEY], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_resource_type'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['resourceType'], - // 'lengths' => [Database::LENGTH_KEY], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_search'), - // 'type' => Database::INDEX_FULLTEXT, - // 'attributes' => ['search'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_entrypoint'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['entrypoint'], - // 'lengths' => [Database::LENGTH_KEY], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_size'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['size'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_buildId'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['buildId'], - // 'lengths' => [Database::LENGTH_KEY], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_activate'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['activate'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], + [ + '$id' => ID::custom('_key_resource'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['resourceId'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_resource_type'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['resourceType'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_entrypoint'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['entrypoint'], + 'lengths' => [768], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_size'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['size'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_buildId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['buildId'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_activate'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['activate'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], ], ], @@ -2946,62 +2946,62 @@ $collections = [ ], ], 'indexes' => [ - // [ - // '$id' => ID::custom('_fulltext_name'), - // 'type' => Database::INDEX_FULLTEXT, - // 'attributes' => ['name'], - // 'lengths' => [1024], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_search'), - // 'type' => Database::INDEX_FULLTEXT, - // 'attributes' => ['search'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_enabled'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['enabled'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_name'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['name'], - // 'lengths' => [128], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_fileSecurity'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['fileSecurity'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_maximumFileSize'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['maximumFileSize'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_encryption'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['encryption'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_antivirus'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['antivirus'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], + [ + '$id' => ID::custom('_fulltext_name'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['name'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_enabled'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['enabled'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_name'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['name'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_fileSecurity'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['fileSecurity'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_maximumFileSize'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['maximumFileSize'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_encryption'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['encryption'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_antivirus'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['antivirus'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], ] ], @@ -3390,62 +3390,62 @@ $collections = [ ], ], 'indexes' => [ - // [ - // '$id' => ID::custom('_key_search'), - // 'type' => Database::INDEX_FULLTEXT, - // 'attributes' => ['search'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_bucket'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['bucketId'], - // 'lengths' => [Database::LENGTH_KEY], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_name'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['name'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_signature'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['signature'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_mimeType'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['mimeType'], - // 'lengths' => [127], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_sizeOriginal'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['sizeOriginal'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_chunksTotal'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['chunksTotal'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], - // [ - // '$id' => ID::custom('_key_chunksUploaded'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['chunksUploaded'], - // 'lengths' => [], - // 'orders' => [Database::ORDER_ASC], - // ], + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_bucket'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['bucketId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_name'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['name'], + 'lengths' => [768], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_signature'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['signature'], + 'lengths' => [768], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_mimeType'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['mimeType'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_sizeOriginal'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['sizeOriginal'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_chunksTotal'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['chunksTotal'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_chunksUploaded'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['chunksUploaded'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], ] ], diff --git a/app/config/locale/translations/hi.json b/app/config/locale/translations/hi.json index 1fa7d0555a..2a4229acce 100644 --- a/app/config/locale/translations/hi.json +++ b/app/config/locale/translations/hi.json @@ -6,25 +6,25 @@ "emails.verification.subject": "अकाउंट वेरिफिकेशन ", "emails.verification.hello": "नमस्ते {{name}}", "emails.verification.body": "इस लिंक के माध्यम से अपने ईमेल को सत्यापित कीजिये।", - "emails.verification.footer": "यदि आपने इस पते को सत्यापित नहीं करना चाहते है, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", + "emails.verification.footer": "यदि आप इस पते को सत्यापित नहीं करना चाहते हैं, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", "emails.verification.thanks": "धन्यवाद", "emails.verification.signature": "{{project}} टीम", "emails.magicSession.subject": "लॉग इन", "emails.magicSession.hello": "नमस्ते,", "emails.magicSession.body": "इस लिंक के माध्यम से लॉग-इन करें।", - "emails.magicSession.footer": "यदि आप इस ईमेल द्वारा लॉगिन नहीं करना चाहते है, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", + "emails.magicSession.footer": "यदि आप इस ईमेल द्वारा लॉगिन नहीं करना चाहते हैं, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", "emails.magicSession.thanks": "धन्यवाद", "emails.magicSession.signature": "{{project}} टीम", "emails.recovery.subject": "पासवर्ड रीसेट", "emails.recovery.hello": "नमस्ते {{name}}", "emails.recovery.body": "इस लिंक के माध्यम से अपना {{project}} पासवर्ड रीसेट करें।", - "emails.recovery.footer": "यदि आप अपना पासवर्ड रिसेट नहीं करना चाहते है, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", + "emails.recovery.footer": "यदि आप अपना पासवर्ड रीसेट नहीं करना चाहते हैं, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", "emails.recovery.thanks": "धन्यवाद", "emails.recovery.signature": "{{project}} टीम", "emails.invitation.subject": "%s टीम का यहाँ %s पर आमंत्रण", "emails.invitation.hello": "नमस्ते", - "emails.invitation.body": "यह मेल आपको इसलिए भेजा गया था क्योंकि {{owner}} आपको {{team}} टीम का सदस्य बनाना चाहते थे, जो {{project}} से जुड़ा हुआ है।", - "emails.invitation.footer": "यदि आप इसमे रूचि नहीं रखते, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", + "emails.invitation.body": "यह मेल आपको इसलिए भेजा गया है क्योंकि {{owner}} आपको {{team}} टीम का सदस्य बनाना चाहते है, जो {{project}} से जुड़ा हुआ है।", + "emails.invitation.footer": "यदि आप इसमें रूचि नहीं रखते, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", "emails.invitation.thanks": "धन्यवाद", "emails.invitation.signature": "{{project}} टीम", "locale.country.unknown": "अज्ञात", @@ -35,7 +35,7 @@ "countries.ae": "संयुक्त अरब अमीरात", "countries.ar": "अर्जेंटीना", "countries.am": "आर्मीनिया", - "countries.ag": "अंटीगुआ और बारबूडा", + "countries.ag": "एंटीगुआ और बारबूडा", "countries.au": "ऑस्ट्रेलिया", "countries.at": "ऑस्ट्रिया", "countries.az": "अज़रबैजान", @@ -46,7 +46,7 @@ "countries.bd": "बांग्लादेश", "countries.bg": "बुल्गारिया", "countries.bh": "बहरीन", - "countries.bs": "बहामास", + "countries.bs": "द बाहामास", "countries.ba": "बॉस्निया और हर्ज़ेगोविना", "countries.by": "बेलारूस", "countries.bz": "बेलीज़", diff --git a/app/config/platforms.php b/app/config/platforms.php index 828e4d3245..ee2e528eb1 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -85,7 +85,7 @@ return [ 'url' => 'https://github.com/appwrite/sdk-for-apple', 'package' => 'https://github.com/appwrite/sdk-for-apple', 'enabled' => true, - 'beta' => true, + 'beta' => false, 'dev' => false, 'hidden' => false, 'family' => APP_PLATFORM_CLIENT, @@ -120,7 +120,7 @@ return [ 'url' => 'https://github.com/appwrite/sdk-for-android', 'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-android', 'enabled' => true, - 'beta' => true, + 'beta' => false, 'dev' => false, 'hidden' => false, 'family' => APP_PLATFORM_CLIENT, @@ -374,7 +374,7 @@ return [ 'url' => 'https://github.com/appwrite/sdk-for-kotlin', 'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-kotlin', 'enabled' => true, - 'beta' => true, + 'beta' => false, 'dev' => false, 'hidden' => false, 'family' => APP_PLATFORM_SERVER, @@ -396,7 +396,7 @@ return [ 'url' => 'https://github.com/appwrite/sdk-for-swift', 'package' => 'https://github.com/appwrite/sdk-for-swift', 'enabled' => true, - 'beta' => true, + 'beta' => false, 'dev' => false, 'hidden' => false, 'family' => APP_PLATFORM_SERVER, diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 8bebf307b9..9b83c6dfce 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -62,7 +62,7 @@ App::post('/v1/account') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ACCOUNT) ->label('abuse-limit', 10) - ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password. Must be at least 8 chars.') ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) @@ -139,7 +139,7 @@ App::post('/v1/account') App::post('/v1/account/sessions/email') ->alias('/v1/account/sessions') - ->desc('Create Account Session with Email') + ->desc('Create Email Session') ->groups(['api', 'account', 'auth']) ->label('event', 'users.[userId].sessions.[sessionId].create') ->label('scope', 'public') @@ -253,7 +253,7 @@ App::post('/v1/account/sessions/email') }); App::get('/v1/account/sessions/oauth2/:provider') - ->desc('Create Account Session with OAuth2') + ->desc('Create OAuth2 Session') ->groups(['api', 'account']) ->label('error', __DIR__ . '/../../views/general/error.phtml') ->label('scope', 'public') @@ -617,7 +617,7 @@ App::post('/v1/account/sessions/magic-url') ->label('sdk.response.model', Response::MODEL_TOKEN) ->label('abuse-limit', 10) ->label('abuse-key', 'url:{url},email:{param-email}') - ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('url', '', fn($clients) => new Host($clients), 'URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true, ['clients']) ->inject('request') @@ -870,7 +870,7 @@ App::post('/v1/account/sessions/phone') ->label('sdk.response.model', Response::MODEL_TOKEN) ->label('abuse-limit', 10) ->label('abuse-key', 'url:{url},email:{param-email}') - ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('phone', '', new Phone(), 'Phone number. Format this number with a leading \'+\' and a country code, e.g., +16175551212.') ->inject('request') ->inject('response') @@ -1221,7 +1221,7 @@ App::post('/v1/account/sessions/anonymous') }); App::post('/v1/account/jwt') - ->desc('Create Account JWT') + ->desc('Create JWT') ->groups(['api', 'account', 'auth']) ->label('scope', 'account') ->label('auth.type', 'jwt') @@ -1308,7 +1308,7 @@ App::get('/v1/account/prefs') }); App::get('/v1/account/sessions') - ->desc('List Account Sessions') + ->desc('List Sessions') ->groups(['api', 'account']) ->label('scope', 'account') ->label('usage.metric', 'users.{scope}.requests.read') @@ -1343,7 +1343,7 @@ App::get('/v1/account/sessions') }); App::get('/v1/account/logs') - ->desc('List Account Logs') + ->desc('List Logs') ->groups(['api', 'account']) ->label('scope', 'account') ->label('usage.metric', 'users.{scope}.requests.read') @@ -1404,7 +1404,7 @@ App::get('/v1/account/logs') }); App::get('/v1/account/sessions/:sessionId') - ->desc('Get Session By ID') + ->desc('Get Session') ->groups(['api', 'account']) ->label('scope', 'account') ->label('usage.metric', 'users.{scope}.requests.read') @@ -1444,7 +1444,7 @@ App::get('/v1/account/sessions/:sessionId') }); App::patch('/v1/account/name') - ->desc('Update Account Name') + ->desc('Update Name') ->groups(['api', 'account']) ->label('event', 'users.[userId].update.name') ->label('scope', 'account') @@ -1475,7 +1475,7 @@ App::patch('/v1/account/name') }); App::patch('/v1/account/password') - ->desc('Update Account Password') + ->desc('Update Password') ->groups(['api', 'account']) ->label('event', 'users.[userId].update.password') ->label('scope', 'account') @@ -1515,7 +1515,7 @@ App::patch('/v1/account/password') }); App::patch('/v1/account/email') - ->desc('Update Account Email') + ->desc('Update Email') ->groups(['api', 'account']) ->label('event', 'users.[userId].update.email') ->label('scope', 'account') @@ -1567,7 +1567,7 @@ App::patch('/v1/account/email') }); App::patch('/v1/account/phone') - ->desc('Update Account Phone') + ->desc('Update Phone') ->groups(['api', 'account']) ->label('event', 'users.[userId].update.phone') ->label('scope', 'account') @@ -1615,7 +1615,7 @@ App::patch('/v1/account/phone') }); App::patch('/v1/account/prefs') - ->desc('Update Account Preferences') + ->desc('Update Preferences') ->groups(['api', 'account']) ->label('event', 'users.[userId].update.prefs') ->label('scope', 'account') @@ -1644,7 +1644,7 @@ App::patch('/v1/account/prefs') }); App::patch('/v1/account/status') - ->desc('Update Account Status') + ->desc('Update Status') ->groups(['api', 'account']) ->label('event', 'users.[userId].update.status') ->label('scope', 'account') @@ -1679,7 +1679,7 @@ App::patch('/v1/account/status') }); App::delete('/v1/account/sessions/:sessionId') - ->desc('Delete Account Session') + ->desc('Delete Session') ->groups(['api', 'account']) ->label('scope', 'account') ->label('event', 'users.[userId].sessions.[sessionId].delete') @@ -1750,7 +1750,7 @@ App::delete('/v1/account/sessions/:sessionId') }); App::patch('/v1/account/sessions/:sessionId') - ->desc('Update Session (Refresh Tokens)') + ->desc('Update OAuth Session (Refresh Tokens)') ->groups(['api', 'account']) ->label('scope', 'account') ->label('event', 'users.[userId].sessions.[sessionId].update') @@ -1832,7 +1832,7 @@ App::patch('/v1/account/sessions/:sessionId') }); App::delete('/v1/account/sessions') - ->desc('Delete All Account Sessions') + ->desc('Delete Sessions') ->groups(['api', 'account']) ->label('scope', 'account') ->label('event', 'users.[userId].sessions.[sessionId].delete') @@ -1884,8 +1884,6 @@ App::delete('/v1/account/sessions') $dbForProject->deleteCachedDocument('users', $user->getId()); - $numOfSessions = count($sessions); - $events ->setParam('userId', $user->getId()) ->setParam('sessionId', $session->getId()); diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 5656dbc64e..ace987d726 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -163,7 +163,7 @@ App::post('/v1/databases') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_DATABASE) // Model for database needs to be created - ->param('databaseId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('databaseId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', '', new Text(128), 'Collection name. Max length: 128 chars.') ->inject('response') ->inject('dbForProject') @@ -489,7 +489,7 @@ App::post('/v1/databases/:databaseId/collections') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_COLLECTION) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('collectionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('collectionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', '', new Text(128), 'Collection name. Max length: 128 chars.') ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).', true) ->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).', true) @@ -1855,7 +1855,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_DOCUMENT) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('documentId', '', new CustomId(), 'Document ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('documentId', '', new CustomId(), 'Document ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.') ->param('data', [], new JSON(), 'Document data as JSON object.') ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE, [Database::PERMISSION_READ, Database::PERMISSION_UPDATE, Database::PERMISSION_DELETE, Database::PERMISSION_WRITE]), 'An array of permissions strings. By default the current user is granted with all permissions. [Learn more about permissions](/docs/permissions).', true) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index f2745281fc..188c5e453c 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -59,7 +59,7 @@ App::post('/v1/functions') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_FUNCTION) - ->param('functionId', '', new CustomId(), 'Function ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('functionId', '', new CustomId(), 'Function ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', '', new Text(128), 'Function name. Max length: 128 chars.') ->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of strings with execution roles. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.') ->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution runtime.') diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 9e7e3f9a10..3935a71a9d 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -57,7 +57,7 @@ App::post('/v1/projects') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_PROJECT) - ->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', null, new Text(128), 'Project name. Max length: 128 chars.') ->param('teamId', '', new UID(), 'Team unique ID.') ->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index f236285749..530f174cd0 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -58,7 +58,7 @@ App::post('/v1/storage/buckets') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_BUCKET) - ->param('bucketId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('bucketId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', '', new Text(128), 'Bucket name') ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).', true) ->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).', true) @@ -347,7 +347,7 @@ App::post('/v1/storage/buckets/:bucketId/files') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_FILE) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).') - ->param('fileId', '', new CustomId(), 'File ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('fileId', '', new CustomId(), 'File ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('file', [], new File(), 'Binary file.', false) ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE, [Database::PERMISSION_READ, Database::PERMISSION_UPDATE, Database::PERMISSION_DELETE, Database::PERMISSION_WRITE]), 'An array of permission strings. By default the current user is granted with all permissions. [Learn more about permissions](/docs/permissions).', true) ->inject('request') diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 9f1aedf483..b87017dbd2 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -51,7 +51,7 @@ App::post('/v1/teams') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_TEAM) - ->param('teamId', '', new CustomId(), 'Team ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('teamId', '', new CustomId(), 'Team ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', null, new Text(128), 'Team name. Max length: 128 chars.') ->param('roles', ['owner'], new ArrayList(new Key(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 32 characters long.', true) ->inject('response') diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index c95105b775..8c8e4143ab 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -98,7 +98,7 @@ App::post('/v1/users') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', null, new Email(), 'User email.', true) ->param('phone', null, new Phone(), 'Phone number. Format this number with a leading \'+\' and a country code, e.g., +16175551212.', true) ->param('password', null, new Password(), 'Plain text user password. Must be at least 8 chars.', true) @@ -129,7 +129,7 @@ App::post('/v1/users/bcrypt') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password hashed using Bcrypt.') ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) @@ -159,7 +159,7 @@ App::post('/v1/users/md5') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password hashed using MD5.') ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) @@ -189,7 +189,7 @@ App::post('/v1/users/argon2') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password hashed using Argon2.') ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) @@ -219,7 +219,7 @@ App::post('/v1/users/sha') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password hashed using SHA.') ->param('passwordVersion', '', new WhiteList(['sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512']), "Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'", true) @@ -256,7 +256,7 @@ App::post('/v1/users/phpass') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string `ID.unique()`to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password hashed using PHPass.') ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) @@ -286,7 +286,7 @@ App::post('/v1/users/scrypt') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password hashed using Scrypt.') ->param('passwordSalt', '', new Text(128), 'Optional salt used to hash password.') @@ -329,7 +329,7 @@ App::post('/v1/users/scrypt-modified') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'User ID. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password hashed using Scrypt Modified.') ->param('passwordSalt', '', new Text(128), 'Salt used to hash password.') diff --git a/app/controllers/general.php b/app/controllers/general.php index e56357869d..fd7599595a 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -403,11 +403,6 @@ App::error() $version = App::getEnv('_APP_VERSION', 'UNKNOWN'); $route = $utopia->match($request); - /** Delegate PDO exceptions to the global handler so the database connection can be returned to the pool */ - if ($error instanceof PDOException) { - throw $error; - } - if ($logger) { if ($error->getCode() >= 500 || $error->getCode() === 0) { try { diff --git a/app/preload.php b/app/preload.php index 4935db3da4..8789936417 100644 --- a/app/preload.php +++ b/app/preload.php @@ -35,7 +35,7 @@ foreach ( realpath(__DIR__ . '/../vendor/symfony'), realpath(__DIR__ . '/../vendor/mongodb'), realpath(__DIR__ . '/../vendor/utopia-php/websocket'), // TODO: remove workerman autoload - realpath(__DIR__ . '/../vendor/utopia-php/cache'), // TODO: remove memcached autoload + realpath(__DIR__ . '/../vendor/utopia-php/cache'), // TODO: remove memcache autoload ] as $key => $value ) { if ($value !== false) { diff --git a/composer.json b/composer.json index 957810ef0e..adc193fcae 100644 --- a/composer.json +++ b/composer.json @@ -45,13 +45,13 @@ "appwrite/php-runtimes": "0.11.*", "utopia-php/framework": "0.21.*", "utopia-php/logger": "0.3.*", - "utopia-php/abuse": "0.14.*", + "utopia-php/abuse": "0.16.*", "utopia-php/analytics": "0.2.*", - "utopia-php/audit": "0.15.*", "utopia-php/cache": "0.8.*", + "utopia-php/audit": "0.17.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "dev-feat-update-create as 0.26.1", + "utopia-php/database": "0.28.*", "utopia-php/locale": "0.4.*", "utopia-php/registry": "0.5.*", "utopia-php/preloader": "0.2.*", diff --git a/composer.lock b/composer.lock index 262b6d1846..16709511ab 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "8e777148ca3643e8186eec24ad045eb1", + "content-hash": "51f81d435f4b5b7a9a6ea8f81b470353", "packages": [ { "name": "adhocore/jwt", @@ -620,16 +620,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.4.2", + "version": "2.4.3", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "3148458748274be1546f8f2809a6c09fe66f44aa" + "reference": "67c26b443f348a51926030c83481b85718457d3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/3148458748274be1546f8f2809a6c09fe66f44aa", - "reference": "3148458748274be1546f8f2809a6c09fe66f44aa", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d", + "reference": "67c26b443f348a51926030c83481b85718457d3d", "shasum": "" }, "require": { @@ -719,7 +719,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.2" + "source": "https://github.com/guzzle/psr7/tree/2.4.3" }, "funding": [ { @@ -735,7 +735,7 @@ "type": "tidelift" } ], - "time": "2022-10-25T13:49:28+00:00" + "time": "2022-10-26T14:07:24+00:00" }, { "name": "influxdb/influxdb-php", @@ -1462,23 +1462,23 @@ }, { "name": "utopia-php/abuse", - "version": "0.14.0", + "version": "0.16.0", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "1a5da248e74c1bfc39bc440fa949de6935acceeb" + "reference": "6370d9150425460416583feba0990504ac789e98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/1a5da248e74c1bfc39bc440fa949de6935acceeb", - "reference": "1a5da248e74c1bfc39bc440fa949de6935acceeb", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/6370d9150425460416583feba0990504ac789e98", + "reference": "6370d9150425460416583feba0990504ac789e98", "shasum": "" }, "require": { "ext-curl": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.26.*" + "utopia-php/database": "0.28.*" }, "require-dev": { "phpunit/phpunit": "^9.4", @@ -1510,9 +1510,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.14.0" + "source": "https://github.com/utopia-php/abuse/tree/0.16.0" }, - "time": "2022-10-14T11:26:39+00:00" + "time": "2022-10-31T14:46:41+00:00" }, { "name": "utopia-php/analytics", @@ -1571,22 +1571,22 @@ }, { "name": "utopia-php/audit", - "version": "0.15.0", + "version": "0.17.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "937ffd13e7a5ac9ad220b329247569ef2a4881d9" + "reference": "455471bd4de8d74026809e843f8c9740eb32922c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/937ffd13e7a5ac9ad220b329247569ef2a4881d9", - "reference": "937ffd13e7a5ac9ad220b329247569ef2a4881d9", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/455471bd4de8d74026809e843f8c9740eb32922c", + "reference": "455471bd4de8d74026809e843f8c9740eb32922c", "shasum": "" }, "require": { "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.26.*" + "utopia-php/database": "0.28.*" }, "require-dev": { "phpunit/phpunit": "^9.3", @@ -1612,9 +1612,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.15.0" + "source": "https://github.com/utopia-php/audit/tree/0.17.0" }, - "time": "2022-10-14T11:39:18+00:00" + "time": "2022-10-31T14:44:52+00:00" }, { "name": "utopia-php/cache", @@ -1771,16 +1771,16 @@ }, { "name": "utopia-php/database", - "version": "dev-feat-update-create", + "version": "0.28.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "cdc81747329f562c05d4843ad736811e20a81d34" + "reference": "ef6506af1c09c22f5dc1e7859159d323f7fafa94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/cdc81747329f562c05d4843ad736811e20a81d34", - "reference": "cdc81747329f562c05d4843ad736811e20a81d34", + "url": "https://api.github.com/repos/utopia-php/database/zipball/ef6506af1c09c22f5dc1e7859159d323f7fafa94", + "reference": "ef6506af1c09c22f5dc1e7859159d323f7fafa94", "shasum": "" }, "require": { @@ -1819,9 +1819,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/feat-update-create" + "source": "https://github.com/utopia-php/database/tree/0.28.0" }, - "time": "2022-10-26T09:10:13+00:00" + "time": "2022-10-31T09:58:46+00:00" }, { "name": "utopia-php/domains", @@ -3295,16 +3295,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.17", + "version": "9.2.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" + "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a", + "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a", "shasum": "" }, "require": { @@ -3360,7 +3360,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18" }, "funding": [ { @@ -3368,7 +3368,7 @@ "type": "github" } ], - "time": "2022-08-30T12:24:04+00:00" + "time": "2022-10-27T13:35:33+00:00" }, { "name": "phpunit/php-file-iterator", @@ -5120,9 +5120,9 @@ "aliases": [ { "package": "utopia-php/database", - "version": "dev-feat-update-create", - "alias": "0.26.1", - "alias_normalized": "0.26.1.0" + "version": "0.28.0.0", + "alias": "0.26.99", + "alias_normalized": "0.26.99.0" } ], "minimum-stability": "stable", @@ -5152,5 +5152,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index 9151a5c0b5..dddbc59e7f 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -321,7 +321,7 @@ class Realtime extends Adapter } } elseif ($parts[2] === 'deployments') { $channels[] = 'console'; - + $projectId = 'console'; $roles = [Role::team($project->getAttribute('teamId'))->toString()]; } diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index efcfe95f53..500b3d48be 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -2,16 +2,19 @@ namespace Tests\E2E\Services\Realtime; +use CURLFile; use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideConsole; +use Tests\E2E\Services\Functions\FunctionsBase; use Utopia\Database\ID; use Utopia\Database\Permission; use Utopia\Database\Role; class RealtimeConsoleClientTest extends Scope { + use FunctionsBase; use RealtimeBase; use ProjectCustom; use SideConsole; @@ -425,4 +428,78 @@ class RealtimeConsoleClientTest extends Scope $client->close(); } + + public function testCreateDeployment() + { + $response1 = $this->client->call(Client::METHOD_POST, '/functions', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'functionId' => ID::unique(), + 'name' => 'Test', + 'runtime' => 'php-8.0', + 'events' => [ + 'users.*.create', + 'users.*.delete', + ], + 'schedule' => '0 0 1 1 *', + 'timeout' => 10, + ]); + + $functionId = $response1['body']['$id'] ?? ''; + + $this->assertEquals(201, $response1['headers']['status-code']); + + + $projectId = 'console'; + + $client = $this->getWebsocket(['console'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + ], $projectId); + + $response = json_decode($client->receive(), true); + + $this->assertArrayHasKey('type', $response); + $this->assertArrayHasKey('data', $response); + $this->assertEquals('connected', $response['type']); + $this->assertNotEmpty($response['data']); + $this->assertCount(1, $response['data']['channels']); + $this->assertContains('console', $response['data']['channels']); + $this->assertNotEmpty($response['data']['user']); + + /** + * Test Create Deployment + */ + + $folder = 'php'; + $code = realpath(__DIR__ . '/../../../resources/functions') . "/$folder/code.tar.gz"; + $this->packageCode($folder); + + $deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/deployments', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'entrypoint' => 'index.php', + 'code' => new CURLFile($code, 'application/x-gzip', \basename($code)), + ]); + + $deploymentId = $deployment['body']['$id'] ?? ''; + + $this->assertEquals(202, $deployment['headers']['status-code']); + + $response = json_decode($client->receive(), true); + + $this->assertArrayHasKey('type', $response); + $this->assertArrayHasKey('data', $response); + $this->assertEquals('event', $response['type']); + $this->assertNotEmpty($response['data']); + $this->assertArrayHasKey('timestamp', $response['data']); + $this->assertCount(1, $response['data']['channels']); + $this->assertContains('console', $response['data']['channels']); + $this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.create", $response['data']['events']); + $this->assertNotEmpty($response['data']['payload']); + + $client->close(); + } }