1
0
Fork 0
mirror of synced 2024-05-19 20:22:33 +12:00

Merge branch '0.16.x' of https://github.com/appwrite/appwrite into feat-migration-1.0.0

This commit is contained in:
Torsten Dittmann 2022-09-14 10:26:08 +02:00
commit bb2b46cdc1
52 changed files with 243 additions and 225 deletions

View file

@ -12,6 +12,20 @@
- `createExecution` parameter `async` default value was changed from `true` to `false` [#3781](https://github.com/appwrite/appwrite/pull/3781)
- String attribute `status` has been refactored to a Boolean attribute `enabled` in the functions collection [#3798](https://github.com/appwrite/appwrite/pull/3798)
- `time` attribute in Execution response model has been reanamed to `duration` to be more consistent with other response models. [#3801](https://github.com/appwrite/appwrite/pull/3801)
- Renamed the following list endpoints to stay consistent with other endpoints [#3825](https://github.com/appwrite/appwrite/pull/3825)
- `getMemberships` to `listMemberships` in Teams API
- `getMemberships` to `listMemberships` in Users API
- `getLogs` to `listLogs` in Users API
- `getLogs` to `listLogs` in Accounts API
- `getSessions` to `listSessions` in Accounts API
- `getSessions` to `listSessions` in Users API
- `getCountries` to `listCountries` in Locale API
- `getCountriesEU` to `listCountriesEU` in Locale API
- `getCountriesPhones` to `listCountriesPhones` in Locale API
- `getContinents` to `listContinents` in Locale API
- `getCurrencies` to `listCurrencies` in Locale API
- `getLanguages` to `listLanguages` in Locale API
## Features
- Added the UI to see the Parent ID of all resources within the UI. [#3653](https://github.com/appwrite/appwrite/pull/3653)

View file

@ -162,7 +162,7 @@ return [
[
'key' => 'web',
'name' => 'Console',
'version' => '7.0.0-RC2',
'version' => '7.0.0',
'url' => 'https://github.com/appwrite/sdk-for-console',
'package' => '',
'enabled' => true,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1311,14 +1311,14 @@ App::get('/v1/account/prefs')
});
App::get('/v1/account/sessions')
->desc('Get Account Sessions')
->desc('List Account Sessions')
->groups(['api', 'account'])
->label('scope', 'account')
->label('usage.metric', 'users.{scope}.requests.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'account')
->label('sdk.method', 'getSessions')
->label('sdk.description', '/docs/references/account/get-sessions.md')
->label('sdk.method', 'listSessions')
->label('sdk.description', '/docs/references/account/list-sessions.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_SESSION_LIST)
@ -1346,14 +1346,14 @@ App::get('/v1/account/sessions')
});
App::get('/v1/account/logs')
->desc('Get Account Logs')
->desc('List Account Logs')
->groups(['api', 'account'])
->label('scope', 'account')
->label('usage.metric', 'users.{scope}.requests.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'account')
->label('sdk.method', 'getLogs')
->label('sdk.description', '/docs/references/account/get-logs.md')
->label('sdk.method', 'listLogs')
->label('sdk.description', '/docs/references/account/list-logs.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_LOG_LIST)

View file

@ -1941,7 +1941,8 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents')
try {
$document = $dbForProject->createDocument('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), new Document($data));
$document->setAttribute('$collection', $collectionId);
$document->setAttribute('$collectionId', $collectionId);
$document->setAttribute('$databaseId', $databaseId);
} catch (StructureException $exception) {
throw new Exception(Exception::DOCUMENT_INVALID_STRUCTURE, $exception->getMessage());
} catch (DuplicateException $exception) {
@ -2046,7 +2047,11 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
/**
* Reset $collection attribute to remove prefix.
*/
$documents = array_map(fn(Document $document) => $document->setAttribute('$collection', $collectionId), $documents);
$documents = array_map(function (Document $document) use ($collectionId, $databaseId) {
$document->setAttribute('$collectionId', $collectionId);
$document->setAttribute('$databaseId', $databaseId);
return $document;
}, $documents);
$response->dynamic(new Document([
'total' => $total,
@ -2110,7 +2115,8 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents/:documen
/**
* Reset $collection attribute to remove prefix.
*/
$document->setAttribute('$collection', $collectionId);
$document->setAttribute('$collectionId', $collectionId);
$document->setAttribute('$databaseId', $databaseId);
$response->dynamic($document, Response::MODEL_DOCUMENT);
});
@ -2329,7 +2335,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum
/**
* Reset $collection attribute to remove prefix.
*/
$document->setAttribute('$collection', $collectionId);
$document->setAttribute('$collectionId', $collectionId);
$document->setAttribute('$databaseId', $databaseId);
} catch (AuthorizationException) {
throw new Exception(Exception::USER_UNAUTHORIZED);
} catch (DuplicateException) {
@ -2421,7 +2428,8 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/documents/:docu
/**
* Reset $collection attribute to remove prefix.
*/
$document->setAttribute('$collection', $collectionId);
$document->setAttribute('$collectionId', $collectionId);
$document->setAttribute('$databaseId', $databaseId);
$deletes
->setType(DELETE_TYPE_AUDIT)

View file

@ -73,8 +73,8 @@ App::get('/v1/locale/countries')
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getCountries')
->label('sdk.description', '/docs/references/locale/get-countries.md')
->label('sdk.method', 'listCountries')
->label('sdk.description', '/docs/references/locale/list-countries.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_COUNTRY_LIST)
@ -104,8 +104,8 @@ App::get('/v1/locale/countries/eu')
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getCountriesEU')
->label('sdk.description', '/docs/references/locale/get-countries-eu.md')
->label('sdk.method', 'listCountriesEU')
->label('sdk.description', '/docs/references/locale/list-countries-eu.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_COUNTRY_LIST)
@ -137,8 +137,8 @@ App::get('/v1/locale/countries/phones')
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getCountriesPhones')
->label('sdk.description', '/docs/references/locale/get-countries-phones.md')
->label('sdk.method', 'listCountriesPhones')
->label('sdk.description', '/docs/references/locale/list-countries-phones.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PHONE_LIST)
@ -169,8 +169,8 @@ App::get('/v1/locale/continents')
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getContinents')
->label('sdk.description', '/docs/references/locale/get-continents.md')
->label('sdk.method', 'listContinents')
->label('sdk.description', '/docs/references/locale/list-continents.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_CONTINENT_LIST)
@ -199,8 +199,8 @@ App::get('/v1/locale/currencies')
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getCurrencies')
->label('sdk.description', '/docs/references/locale/get-currencies.md')
->label('sdk.method', 'listCurrencies')
->label('sdk.description', '/docs/references/locale/list-currencies.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_CURRENCY_LIST)
@ -220,8 +220,8 @@ App::get('/v1/locale/languages')
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getLanguages')
->label('sdk.description', '/docs/references/locale/get-languages.md')
->label('sdk.method', 'listLanguages')
->label('sdk.description', '/docs/references/locale/list-languages.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_LANGUAGE_LIST)

View file

@ -463,13 +463,13 @@ App::post('/v1/teams/:teamId/memberships')
});
App::get('/v1/teams/:teamId/memberships')
->desc('Get Team Memberships')
->desc('List Team Memberships')
->groups(['api', 'teams'])
->label('scope', 'teams.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'teams')
->label('sdk.method', 'getMemberships')
->label('sdk.description', '/docs/references/teams/get-team-members.md')
->label('sdk.method', 'listMemberships')
->label('sdk.description', '/docs/references/teams/list-team-members.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MEMBERSHIP_LIST)

View file

@ -449,14 +449,14 @@ App::get('/v1/users/:userId/prefs')
});
App::get('/v1/users/:userId/sessions')
->desc('Get User Sessions')
->desc('List User Sessions')
->groups(['api', 'users'])
->label('scope', 'users.read')
->label('usage.metric', 'users.{scope}.requests.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'users')
->label('sdk.method', 'getSessions')
->label('sdk.description', '/docs/references/users/get-user-sessions.md')
->label('sdk.method', 'listSessions')
->label('sdk.description', '/docs/references/users/list-user-sessions.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_SESSION_LIST)
@ -491,14 +491,14 @@ App::get('/v1/users/:userId/sessions')
});
App::get('/v1/users/:userId/memberships')
->desc('Get User Memberships')
->desc('List User Memberships')
->groups(['api', 'users'])
->label('scope', 'users.read')
->label('usage.metric', 'users.{scope}.requests.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'users')
->label('sdk.method', 'getMemberships')
->label('sdk.description', '/docs/references/users/get-user-memberships.md')
->label('sdk.method', 'listMemberships')
->label('sdk.description', '/docs/references/users/list-user-memberships.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MEMBERSHIP_LIST)
@ -531,14 +531,14 @@ App::get('/v1/users/:userId/memberships')
});
App::get('/v1/users/:userId/logs')
->desc('Get User Logs')
->desc('List User Logs')
->groups(['api', 'users'])
->label('scope', 'users.read')
->label('usage.metric', 'users.{scope}.requests.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'users')
->label('sdk.method', 'getLogs')
->label('sdk.description', '/docs/references/users/get-user-logs.md')
->label('sdk.method', 'listLogs')
->label('sdk.description', '/docs/references/users/list-user-logs.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_LOG_LIST)

View file

@ -325,9 +325,9 @@ App::get('/console/databases/document')
->label('permission', 'public')
->label('scope', 'console')
->param('databaseId', '', new UID(), 'Database unique ID.')
->param('collection', '', new UID(), 'Collection unique ID.')
->param('collectionId', '', new UID(), 'Collection unique ID.')
->inject('layout')
->action(function (string $databaseId, string $collection, View $layout) {
->action(function (string $databaseId, string $collectionId, View $layout) {
$logs = new View(__DIR__ . '/../../views/console/comps/logs.phtml');
$logs
@ -335,7 +335,7 @@ App::get('/console/databases/document')
->setParam('method', 'databases.listDocumentLogs')
->setParam('params', [
'database-id' => '{{router.params.databaseId}}',
'collection-id' => '{{router.params.collection}}',
'collection-id' => '{{router.params.collectionId}}',
'document-id' => '{{router.params.id}}',
])
;
@ -352,7 +352,7 @@ App::get('/console/databases/document')
Database::PERMISSION_DELETE,
])
->setParam('params', [
'collection-id' => '{{router.params.collection}}',
'collection-id' => '{{router.params.collectionId}}',
'database-id' => '{{router.params.databaseId}}',
'document-id' => '{{router.params.id}}',
]);
@ -362,7 +362,7 @@ App::get('/console/databases/document')
$page
->setParam('new', false)
->setParam('database', $databaseId)
->setParam('collection', $collection)
->setParam('collection', $collectionId)
->setParam('permissions', $permissions)
->setParam('logs', $logs)
;
@ -377,9 +377,9 @@ App::get('/console/databases/document/new')
->label('permission', 'public')
->label('scope', 'console')
->param('databaseId', '', new UID(), 'Database unique ID.')
->param('collection', '', new UID(), 'Collection unique ID.')
->param('collectionId', '', new UID(), 'Collection unique ID.')
->inject('layout')
->action(function (string $databaseId, string $collection, View $layout) {
->action(function (string $databaseId, string $collectionId, View $layout) {
$permissions = new View(__DIR__ . '/../../views/console/comps/permissions-matrix.phtml');
@ -392,7 +392,7 @@ App::get('/console/databases/document/new')
Database::PERMISSION_DELETE,
])
->setParam('params', [
'collection-id' => '{{router.params.collection}}',
'collection-id' => '{{router.params.collectionId}}',
'database-id' => '{{router.params.databaseId}}',
'document-id' => '{{router.params.id}}',
]);
@ -402,7 +402,7 @@ App::get('/console/databases/document/new')
$page
->setParam('new', true)
->setParam('database', $databaseId)
->setParam('collection', $collection)
->setParam('collection', $collectionId)
->setParam('permissions', $permissions)
->setParam('logs', new View())
;

View file

@ -30,7 +30,7 @@ $cli
$production = ($git) ? (Console::confirm('Type "Appwrite" to push code to production git repos') == 'Appwrite') : false;
$message = ($git) ? Console::confirm('Please enter your commit message:') : '';
if (!in_array($version, ['0.6.x', '0.7.x', '0.8.x', '0.9.x', '0.10.x', '0.11.x', '0.12.x', '0.13.x', '0.14.x', '0.15.x', '1.0.0-RC1', 'latest'])) {
if (!in_array($version, ['0.6.x', '0.7.x', '0.8.x', '0.9.x', '0.10.x', '0.11.x', '0.12.x', '0.13.x', '0.14.x', '0.15.x', '1.0.0', 'latest'])) {
throw new Exception('Unknown version given');
}
@ -197,7 +197,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
->setTwitter(APP_SOCIAL_TWITTER_HANDLE)
->setDiscord(APP_SOCIAL_DISCORD_CHANNEL, APP_SOCIAL_DISCORD)
->setDefaultHeaders([
'X-Appwrite-Response-Format' => '1.0.0-RC1',
'X-Appwrite-Response-Format' => '1.0.0',
]);
try {

View file

@ -197,7 +197,7 @@
<h2>Sessions</h2>
<div class="box margin-bottom"
data-service="account.getSessions"
data-service="account.listSessions"
data-scope="console"
data-name="sessions"
data-event="load,account.deleteRemoteSession">
@ -298,7 +298,7 @@
<h2>Activity</h2>
<div
data-service="account.getLogs"
data-service="account.listLogs"
data-scope="console"
data-param-queries="limit(<?php echo APP_PAGING_LIMIT; ?>),offset({{router.params.offset|orZero}})"
data-param-queries-cast-to="array"
@ -340,7 +340,7 @@
</div>
<div class="pull-end text-align-center paging">
<form
data-service="account.getLogs"
data-service="account.listLogs"
data-event="submit"
data-scope="console"
data-name="securityLogs"
@ -353,7 +353,7 @@
<span data-ls-bind="{{router.params.offset|pageCurrent}} / {{securityLogs.total|pageTotal}}"></span>
<form
data-service="account.getLogs"
data-service="account.listLogs"
data-event="submit"
data-scope="console"
data-name="securityLogs"

View file

@ -89,11 +89,11 @@ $permissions = $this->getParam('permissions', null);
<template x-for="doc in documents">
<tr>
<td data-title="$id: ">
<a :href="`/console/databases/document?id=${doc.$id}&collection=${doc.$collection}&databaseId=${databaseId}&project=${project}`" x-text="doc.$id"></a>
<a :href="`/console/databases/document?id=${doc.$id}&collectionId=${doc.$collectionId}&databaseId=${databaseId}&project=${project}`" x-text="doc.$id"></a>
</td>
<template x-for="attr in attributes">
<td x-show="attr.status === 'available'" :data-title="attr.key + ':'">
<a :href="`/console/databases/document?id=${doc.$id}&collection=${doc.$collection}&databaseId=${databaseId}&project=${project}`">
<a :href="`/console/databases/document?id=${doc.$id}&collectionId=${doc.$collectionId}&databaseId=${databaseId}&project=${project}`">
<span x-text="doc[attr.key] ?? 'n/a'"></span>
</a>
</td>
@ -136,7 +136,7 @@ $permissions = $this->getParam('permissions', null);
</form>
</div>
<a data-ls-if="0 < {{project-collection.attributes.length}}" data-ls-attrs="href=/console/databases/document/new?collection={{router.params.id}}&databaseId={{router.params.databaseId}}&project={{router.params.project}}" class="button">
<a data-ls-if="0 < {{project-collection.attributes.length}}" data-ls-attrs="href=/console/databases/document/new?collectionId={{router.params.id}}&databaseId={{router.params.databaseId}}&project={{router.params.project}}" class="button">
Add Document
</a>
<a data-ls-if="!{{project-collection.attributes.length}}" data-ls-attrs="href=/console/databases/collection/attributes?id={{router.params.id}}&databaseId={{router.params.databaseId}}&project={{router.params.project}}" class="button">

View file

@ -7,7 +7,7 @@ $permissions = $this->getParam('permissions', null);
?>
<div
data-service="databases.getCollection"
data-param-collection-id="{{router.params.collection}}"
data-param-collection-id="{{router.params.collectionId}}"
data-param-database-id="{{router.params.databaseId}}"
data-scope="sdk"
data-event="load,databases.updateDocument"
@ -15,7 +15,7 @@ $permissions = $this->getParam('permissions', null);
<div
data-service="databases.getDocument"
data-param-collection-id="{{router.params.collection}}"
data-param-collection-id="{{router.params.collectionId}}"
data-param-database-id="{{router.params.databaseId}}"
data-param-document-id="{{router.params.id}}"
data-scope="sdk"
@ -25,7 +25,7 @@ $permissions = $this->getParam('permissions', null);
<div class="cover">
<h1 class="zone xl margin-bottom-large">
<a data-ls-attrs="href=/console/databases/collection?id={{router.params.collection}}&databaseId={{router.params.databaseId}}&project={{router.params.project}}" class="back text-size-small link-return-animation--start"><i class="icon-left-open"></i> <span data-ls-bind="{{project-collection.name}}"></span></a>
<a data-ls-attrs="href=/console/databases/collection?id={{router.params.collectionId}}&databaseId={{router.params.databaseId}}&project={{router.params.project}}" class="back text-size-small link-return-animation--start"><i class="icon-left-open"></i> <span data-ls-bind="{{project-collection.name}}"></span></a>
<br />
@ -48,7 +48,7 @@ $permissions = $this->getParam('permissions', null);
<div class="zone xl margin-bottom-no">
<ul class="phases clear" data-ui-phases data-selected="{{router.params.tab}}">
<li data-state="/console/databases/document?id={{router.params.id}}&collection={{router.params.collection}}&databaseId={{router.params.databaseId}}&project={{router.params.project}}">
<li data-state="/console/databases/document?id={{router.params.id}}&collectionId={{router.params.collectionId}}&databaseId={{router.params.databaseId}}&project={{router.params.project}}">
<h2 class="margin-bottom">Overview</h2>
<div class="row responsive">
@ -362,7 +362,7 @@ $permissions = $this->getParam('permissions', null);
<label>Collection ID</label>
<div class="input-copy margin-bottom">
<input type="text" autocomplete="off" placeholder="" data-ls-bind="{{router.params.collection}}" disabled data-forms-copy class="margin-bottom-no" />
<input type="text" autocomplete="off" placeholder="" data-ls-bind="{{router.params.collectionId}}" disabled data-forms-copy class="margin-bottom-no" />
</div>
<label>Database ID</label>
@ -395,13 +395,13 @@ $permissions = $this->getParam('permissions', null);
data-service="databases.deleteDocument"
data-event="submit"
data-param-database-id="{{router.params.databaseId}}"
data-param-collection-id="{{router.params.collection}}"
data-param-collection-id="{{router.params.collectionId}}"
data-param-document-id="{{project-document.$id}}"
data-confirm="Are you sure you want to delete this document?"
data-success="alert,trigger,redirect"
data-success-param-alert-text="Document deleted successfully"
data-success-param-trigger-events="databases.deleteDocument"
data-success-param-redirect-url="/console/databases/collection?id={{router.params.collection}}&project={{router.params.project}}&databaseId={{router.params.databaseId}}"
data-success-param-redirect-url="/console/databases/collection?id={{router.params.collectionId}}&project={{router.params.project}}&databaseId={{router.params.databaseId}}"
data-failure="alert"
data-failure-param-alert-text="Failed to delete collection"
data-failure-param-alert-classname="error">
@ -413,7 +413,7 @@ $permissions = $this->getParam('permissions', null);
</div>
</li>
<?php if(!$new): ?>
<li data-state="/console/databases/document/activity?id={{router.params.id}}&collection={{router.params.collection}}&project={{router.params.project}}&databaseId={{router.params.databaseId}}">
<li data-state="/console/databases/document/activity?id={{router.params.id}}&collectionId={{router.params.collectionId}}&project={{router.params.project}}&databaseId={{router.params.databaseId}}">
<h2>Activity</h2>
<?php echo $logs->render(); ?>

View file

@ -15,7 +15,7 @@ $array = $this->getParam('array', false);
<?php if($parent): ?>
<input name="documentId" type="hidden" data-ls-bind="{{router.params.id}}" />
<input name="collectionId" type="hidden" data-ls-bind="{{router.params.collection}}" />
<input name="collectionId" type="hidden" data-ls-bind="{{router.params.collectionId}}" />
<?php else: ?>
<?php /*<div class="margin-bottom-small text-size-small" data-ls-if="({{<?php echo $this->escape($namespace); ?>.$id}})">
<span data-ls-bind="Document #{{<?php echo $this->escape($namespace); ?>.$id}}"></span> &nbsp;

View file

@ -378,13 +378,13 @@ $smtpEnabled = $this->getParam('smtpEnabled', false);
<h2>Members</h2>
<div class="zone xl"
data-service="teams.getMemberships"
data-service="teams.listMemberships"
data-scope="console"
data-event="load,teams.createMembership,teams.deleteMembership,teams.createMembership.resent"
data-name="members"
data-param-team-id="{{console-project.teamId}}"
data-success="trigger"
data-success-param-trigger-events="teams.getMemberships">
data-success-param-trigger-events="teams.listMemberships">
<div class="box margin-bottom">
<ul data-ls-loop="members.memberships" data-ls-as="member" class="list">

View file

@ -68,7 +68,7 @@
<h3 class="margin-bottom">Members</h3>
<div
data-service="teams.getMemberships"
data-service="teams.listMemberships"
data-event="load,teams.create,teams.update,teams.delete,teams.deleteMembership,teams.createMembership"
data-param-team-id="{{router.params.id}}"
data-param-queries="limit(<?php echo APP_PAGING_LIMIT; ?>),offset({{router.params.offset|orZero}}),orderDesc('')"
@ -168,7 +168,7 @@
<div class="clear text-align-center paging pull-end">
<form
data-service="teams.getMemberships"
data-service="teams.listMemberships"
data-event="submit"
data-param-team-id="{{router.params.id}}"
data-param-search="{{router.params.search}}"
@ -183,7 +183,7 @@
<span data-ls-bind="{{router.params.offset|pageCurrent}} / {{project-members.total|pageTotal}}"></span>
<form
data-service="teams.getMemberships"
data-service="teams.listMemberships"
data-event="submit"
data-param-team-id="{{router.params.id}}"
data-param-search="{{router.params.search}}"

View file

@ -438,7 +438,7 @@
<h2>Memberships</h2>
<div
data-service="users.getMemberships"
data-service="users.listMemberships"
data-name="memberships"
data-param-user-id="{{router.params.id}}"
data-event="load,users.update,teams.deleteMembership">
@ -493,7 +493,7 @@
<h2>Sessions</h2>
<div
data-service="users.getSessions"
data-service="users.listSessions"
data-name="sessions"
data-param-user-id="{{router.params.id}}"
data-event="load,users.update">
@ -570,7 +570,7 @@
<h2>Activity</h2>
<div
data-service="users.getLogs"
data-service="users.listLogs"
data-name="logs"
data-param-user-id="{{router.params.id}}"
data-event="load,logs-load">

View file

@ -12,7 +12,7 @@ Service.CHUNK_SIZE=5*1024*1024;class Query{}
Query.equal=(attribute,value)=>Query.addQuery(attribute,"equal",value);Query.notEqual=(attribute,value)=>Query.addQuery(attribute,"notEqual",value);Query.lessThan=(attribute,value)=>Query.addQuery(attribute,"lessThan",value);Query.lessThanEqual=(attribute,value)=>Query.addQuery(attribute,"lessThanEqual",value);Query.greaterThan=(attribute,value)=>Query.addQuery(attribute,"greaterThan",value);Query.greaterThanEqual=(attribute,value)=>Query.addQuery(attribute,"greaterThanEqual",value);Query.search=(attribute,value)=>Query.addQuery(attribute,"search",value);Query.orderDesc=(attribute)=>`orderDesc("${attribute}")`;Query.orderAsc=(attribute)=>`orderAsc("${attribute}")`;Query.cursorAfter=(documentId)=>`cursorAfter("${documentId}")`;Query.cursorBefore=(documentId)=>`cursorBefore("${documentId}")`;Query.limit=(limit)=>`limit(${limit})`;Query.offset=(offset)=>`offset(${offset})`;Query.addQuery=(attribute,method,value)=>value instanceof Array?`${method}("${attribute}", [${value
.map((v) => Query.parseValues(v))
.join(",")}])`:`${method}("${attribute}", [${Query.parseValues(value)}])`;Query.parseValues=(value)=>typeof value==="string"||value instanceof String?`"${value}"`:`${value}`;class AppwriteException extends Error{constructor(message,code=0,type='',response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.type=type;this.response=response;}}
class Client{constructor(){this.config={endpoint:'https://HOSTNAME/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-name':'Console','x-sdk-platform':'console','x-sdk-language':'web','x-sdk-version':'6.1.0-RC1','X-Appwrite-Response-Format':'1.0.0-RC1',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1)
class Client{constructor(){this.config={endpoint:'https://HOSTNAME/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-name':'Console','x-sdk-platform':'console','x-sdk-language':'web','x-sdk-version':'7.0.0','X-Appwrite-Response-Format':'1.0.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1)
return;const channels=new URLSearchParams();channels.set('project',this.config.project);this.realtime.channels.forEach(channel=>{channels.append('channels[]',channel);});const url=this.config.endpointRealtime+'/realtime?'+channels.toString();if(url!==this.realtime.url||!this.realtime.socket||((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)>WebSocket.OPEN){if(this.realtime.socket&&((_b=this.realtime.socket)===null||_b===void 0?void 0:_b.readyState)<WebSocket.CLOSING){this.realtime.reconnect=false;this.realtime.socket.close();}
this.realtime.url=url;this.realtime.socket=new WebSocket(url);this.realtime.socket.addEventListener('message',this.realtime.onMessage);this.realtime.socket.addEventListener('open',_event=>{this.realtime.reconnectAttempts=0;});this.realtime.socket.addEventListener('close',event=>{var _a,_b,_c;if(!this.realtime.reconnect||(((_b=(_a=this.realtime)===null||_a===void 0?void 0:_a.lastMessage)===null||_b===void 0?void 0:_b.type)==='error'&&((_c=this.realtime)===null||_c===void 0?void 0:_c.lastMessage.data).code===1008)){this.realtime.reconnect=true;return;}
const timeout=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${timeout / 1000} seconds.`,event.reason);setTimeout(()=>{this.realtime.reconnectAttempts++;this.realtime.createSocket();},timeout);});}},onMessage:(event)=>{var _a,_b;try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;switch(message.type){case'connected':const cookie=JSON.parse((_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'{}');const session=cookie===null||cookie===void 0?void 0:cookie[`a_session_${this.config.project}`];const messageData=message.data;if(session&&!messageData.user){(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.send(JSON.stringify({type:'authentication',data:{session}}));}
@ -56,7 +56,7 @@ let path='/account/email';let payload={};if(typeof email!=='undefined'){payload[
if(typeof password!=='undefined'){payload['password']=password;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}
createJWT(){return __awaiter(this,void 0,void 0,function*(){let path='/account/jwt';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});}
getLogs(queries){return __awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
listLogs(queries){return __awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
updateName(name){return __awaiter(this,void 0,void 0,function*(){if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
let path='/account/name';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
@ -88,7 +88,7 @@ if(typeof secret!=='undefined'){payload['secret']=secret;}
if(typeof password!=='undefined'){payload['password']=password;}
if(typeof passwordAgain!=='undefined'){payload['passwordAgain']=passwordAgain;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});}
getSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
deleteSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});}
createAnonymousSession(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});}
createEmailSession(email,password){return __awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
@ -174,10 +174,9 @@ if(typeof width!=='undefined'){payload['width']=width;}
if(typeof height!=='undefined'){payload['height']=height;}
const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);}
return uri;}
getInitials(name,width,height,color,background){let path='/avatars/initials';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
getInitials(name,width,height,background){let path='/avatars/initials';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(typeof width!=='undefined'){payload['width']=width;}
if(typeof height!=='undefined'){payload['height']=height;}
if(typeof color!=='undefined'){payload['color']=color;}
if(typeof background!=='undefined'){payload['background']=background;}
const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);}
return uri;}
@ -214,8 +213,6 @@ const uri=new URL(this.client.config.endpoint+path);return yield this.client.cal
createCollection(databaseId,collectionId,name,permissions,documentSecurity){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');}
if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof permissions==='undefined'){throw new AppwriteException('Missing required parameter: "permissions"');}
if(typeof documentSecurity==='undefined'){throw new AppwriteException('Missing required parameter: "documentSecurity"');}
let path='/databases/{databaseId}/collections'.replace('{databaseId}',databaseId);let payload={};if(typeof collectionId!=='undefined'){payload['collectionId']=collectionId;}
if(typeof name!=='undefined'){payload['name']=name;}
if(typeof permissions!=='undefined'){payload['permissions']=permissions;}
@ -224,10 +221,9 @@ const uri=new URL(this.client.config.endpoint+path);return yield this.client.cal
getCollection(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');}
if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
updateCollection(databaseId,collectionId,name,documentSecurity,permissions,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');}
updateCollection(databaseId,collectionId,name,permissions,documentSecurity,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');}
if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof documentSecurity==='undefined'){throw new AppwriteException('Missing required parameter: "documentSecurity"');}
let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(typeof permissions!=='undefined'){payload['permissions']=permissions;}
if(typeof documentSecurity!=='undefined'){payload['documentSecurity']=documentSecurity;}
@ -406,7 +402,7 @@ class Functions extends Service{constructor(client){super(client);}
list(queries,search){return __awaiter(this,void 0,void 0,function*(){let path='/functions';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
create(functionId,name,execute,runtime,events,schedule,timeout){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
create(functionId,name,execute,runtime,events,schedule,timeout,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof execute==='undefined'){throw new AppwriteException('Missing required parameter: "execute"');}
if(typeof runtime==='undefined'){throw new AppwriteException('Missing required parameter: "runtime"');}
@ -417,13 +413,14 @@ if(typeof runtime!=='undefined'){payload['runtime']=runtime;}
if(typeof events!=='undefined'){payload['events']=events;}
if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
if(typeof timeout!=='undefined'){payload['timeout']=timeout;}
if(typeof enabled!=='undefined'){payload['enabled']=enabled;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});}
listRuntimes(){return __awaiter(this,void 0,void 0,function*(){let path='/functions/runtimes';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getUsage(range){return __awaiter(this,void 0,void 0,function*(){let path='/functions/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
get(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
update(functionId,name,execute,events,schedule,timeout){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
update(functionId,name,execute,events,schedule,timeout,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof execute==='undefined'){throw new AppwriteException('Missing required parameter: "execute"');}
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
@ -431,6 +428,7 @@ if(typeof execute!=='undefined'){payload['execute']=execute;}
if(typeof events!=='undefined'){payload['events']=events;}
if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
if(typeof timeout!=='undefined'){payload['timeout']=timeout;}
if(typeof enabled!=='undefined'){payload['enabled']=enabled;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});}
delete(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});}
@ -478,10 +476,8 @@ let path='/functions/{functionId}/executions/{executionId}'.replace('{functionId
getFunctionUsage(functionId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/usage'.replace('{functionId}',functionId);let payload={};if(typeof range!=='undefined'){payload['range']=range;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listVariables(functionId,queries,search){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/variables'.replace('{functionId}',functionId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listVariables(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/variables'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
createVariable(functionId,key,value){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');}
if(typeof value==='undefined'){throw new AppwriteException('Missing required parameter: "value"');}
@ -513,12 +509,12 @@ getStorageLocal(){return __awaiter(this,void 0,void 0,function*(){let path='/hea
getTime(){return __awaiter(this,void 0,void 0,function*(){let path='/health/time';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}}
class Locale extends Service{constructor(client){super(client);}
get(){return __awaiter(this,void 0,void 0,function*(){let path='/locale';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getContinents(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getCountries(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getCountriesEU(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getCountriesPhones(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getCurrencies(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getLanguages(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}}
listContinents(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listCountries(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listCountriesEU(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listCountriesPhones(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listCurrencies(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listLanguages(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}}
class Projects extends Service{constructor(client){super(client);}
list(queries,search){return __awaiter(this,void 0,void 0,function*(){let path='/projects';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
@ -685,9 +681,8 @@ class Storage extends Service{constructor(client){super(client);}
listBuckets(queries,search){return __awaiter(this,void 0,void 0,function*(){let path='/storage/buckets';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
createBucket(bucketId,name,fileSecurity,permissions,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
createBucket(bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof fileSecurity==='undefined'){throw new AppwriteException('Missing required parameter: "fileSecurity"');}
let path='/storage/buckets';let payload={};if(typeof bucketId!=='undefined'){payload['bucketId']=bucketId;}
if(typeof name!=='undefined'){payload['name']=name;}
if(typeof permissions!=='undefined'){payload['permissions']=permissions;}
@ -701,9 +696,8 @@ if(typeof antivirus!=='undefined'){payload['antivirus']=antivirus;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});}
getBucket(bucketId){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
updateBucket(bucketId,name,fileSecurity,permissions,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
updateBucket(bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof fileSecurity==='undefined'){throw new AppwriteException('Missing required parameter: "fileSecurity"');}
let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(typeof permissions!=='undefined'){payload['permissions']=permissions;}
if(typeof fileSecurity!=='undefined'){payload['fileSecurity']=fileSecurity;}
@ -793,7 +787,7 @@ let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=n
listLogs(teamId,queries){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
let path='/teams/{teamId}/logs'.replace('{teamId}',teamId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getMemberships(teamId,queries,search){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
listMemberships(teamId,queries,search){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
@ -919,10 +913,10 @@ updateEmail(userId,email){return __awaiter(this,void 0,void 0,function*(){if(typ
if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
let path='/users/{userId}/email'.replace('{userId}',userId);let payload={};if(typeof email!=='undefined'){payload['email']=email;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}
getLogs(userId,queries){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
listLogs(userId,queries){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/logs'.replace('{userId}',userId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getMemberships(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
listMemberships(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/memberships'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
updateName(userId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
@ -942,7 +936,7 @@ updatePrefs(userId,prefs){return __awaiter(this,void 0,void 0,function*(){if(typ
if(typeof prefs==='undefined'){throw new AppwriteException('Missing required parameter: "prefs"');}
let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};if(typeof prefs!=='undefined'){payload['prefs']=prefs;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}
getSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
listSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
deleteSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});}

View file

@ -12,7 +12,7 @@ Service.CHUNK_SIZE=5*1024*1024;class Query{}
Query.equal=(attribute,value)=>Query.addQuery(attribute,"equal",value);Query.notEqual=(attribute,value)=>Query.addQuery(attribute,"notEqual",value);Query.lessThan=(attribute,value)=>Query.addQuery(attribute,"lessThan",value);Query.lessThanEqual=(attribute,value)=>Query.addQuery(attribute,"lessThanEqual",value);Query.greaterThan=(attribute,value)=>Query.addQuery(attribute,"greaterThan",value);Query.greaterThanEqual=(attribute,value)=>Query.addQuery(attribute,"greaterThanEqual",value);Query.search=(attribute,value)=>Query.addQuery(attribute,"search",value);Query.orderDesc=(attribute)=>`orderDesc("${attribute}")`;Query.orderAsc=(attribute)=>`orderAsc("${attribute}")`;Query.cursorAfter=(documentId)=>`cursorAfter("${documentId}")`;Query.cursorBefore=(documentId)=>`cursorBefore("${documentId}")`;Query.limit=(limit)=>`limit(${limit})`;Query.offset=(offset)=>`offset(${offset})`;Query.addQuery=(attribute,method,value)=>value instanceof Array?`${method}("${attribute}", [${value
.map((v) => Query.parseValues(v))
.join(",")}])`:`${method}("${attribute}", [${Query.parseValues(value)}])`;Query.parseValues=(value)=>typeof value==="string"||value instanceof String?`"${value}"`:`${value}`;class AppwriteException extends Error{constructor(message,code=0,type='',response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.type=type;this.response=response;}}
class Client{constructor(){this.config={endpoint:'https://HOSTNAME/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-name':'Console','x-sdk-platform':'console','x-sdk-language':'web','x-sdk-version':'6.1.0-RC1','X-Appwrite-Response-Format':'1.0.0-RC1',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1)
class Client{constructor(){this.config={endpoint:'https://HOSTNAME/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-name':'Console','x-sdk-platform':'console','x-sdk-language':'web','x-sdk-version':'7.0.0','X-Appwrite-Response-Format':'1.0.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1)
return;const channels=new URLSearchParams();channels.set('project',this.config.project);this.realtime.channels.forEach(channel=>{channels.append('channels[]',channel);});const url=this.config.endpointRealtime+'/realtime?'+channels.toString();if(url!==this.realtime.url||!this.realtime.socket||((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)>WebSocket.OPEN){if(this.realtime.socket&&((_b=this.realtime.socket)===null||_b===void 0?void 0:_b.readyState)<WebSocket.CLOSING){this.realtime.reconnect=false;this.realtime.socket.close();}
this.realtime.url=url;this.realtime.socket=new WebSocket(url);this.realtime.socket.addEventListener('message',this.realtime.onMessage);this.realtime.socket.addEventListener('open',_event=>{this.realtime.reconnectAttempts=0;});this.realtime.socket.addEventListener('close',event=>{var _a,_b,_c;if(!this.realtime.reconnect||(((_b=(_a=this.realtime)===null||_a===void 0?void 0:_a.lastMessage)===null||_b===void 0?void 0:_b.type)==='error'&&((_c=this.realtime)===null||_c===void 0?void 0:_c.lastMessage.data).code===1008)){this.realtime.reconnect=true;return;}
const timeout=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${timeout / 1000} seconds.`,event.reason);setTimeout(()=>{this.realtime.reconnectAttempts++;this.realtime.createSocket();},timeout);});}},onMessage:(event)=>{var _a,_b;try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;switch(message.type){case'connected':const cookie=JSON.parse((_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'{}');const session=cookie===null||cookie===void 0?void 0:cookie[`a_session_${this.config.project}`];const messageData=message.data;if(session&&!messageData.user){(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.send(JSON.stringify({type:'authentication',data:{session}}));}
@ -56,7 +56,7 @@ let path='/account/email';let payload={};if(typeof email!=='undefined'){payload[
if(typeof password!=='undefined'){payload['password']=password;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}
createJWT(){return __awaiter(this,void 0,void 0,function*(){let path='/account/jwt';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});}
getLogs(queries){return __awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
listLogs(queries){return __awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
updateName(name){return __awaiter(this,void 0,void 0,function*(){if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
let path='/account/name';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
@ -88,7 +88,7 @@ if(typeof secret!=='undefined'){payload['secret']=secret;}
if(typeof password!=='undefined'){payload['password']=password;}
if(typeof passwordAgain!=='undefined'){payload['passwordAgain']=passwordAgain;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});}
getSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
deleteSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});}
createAnonymousSession(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});}
createEmailSession(email,password){return __awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
@ -174,10 +174,9 @@ if(typeof width!=='undefined'){payload['width']=width;}
if(typeof height!=='undefined'){payload['height']=height;}
const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);}
return uri;}
getInitials(name,width,height,color,background){let path='/avatars/initials';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
getInitials(name,width,height,background){let path='/avatars/initials';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(typeof width!=='undefined'){payload['width']=width;}
if(typeof height!=='undefined'){payload['height']=height;}
if(typeof color!=='undefined'){payload['color']=color;}
if(typeof background!=='undefined'){payload['background']=background;}
const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);}
return uri;}
@ -214,8 +213,6 @@ const uri=new URL(this.client.config.endpoint+path);return yield this.client.cal
createCollection(databaseId,collectionId,name,permissions,documentSecurity){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');}
if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof permissions==='undefined'){throw new AppwriteException('Missing required parameter: "permissions"');}
if(typeof documentSecurity==='undefined'){throw new AppwriteException('Missing required parameter: "documentSecurity"');}
let path='/databases/{databaseId}/collections'.replace('{databaseId}',databaseId);let payload={};if(typeof collectionId!=='undefined'){payload['collectionId']=collectionId;}
if(typeof name!=='undefined'){payload['name']=name;}
if(typeof permissions!=='undefined'){payload['permissions']=permissions;}
@ -224,10 +221,9 @@ const uri=new URL(this.client.config.endpoint+path);return yield this.client.cal
getCollection(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');}
if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
updateCollection(databaseId,collectionId,name,documentSecurity,permissions,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');}
updateCollection(databaseId,collectionId,name,permissions,documentSecurity,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');}
if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof documentSecurity==='undefined'){throw new AppwriteException('Missing required parameter: "documentSecurity"');}
let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(typeof permissions!=='undefined'){payload['permissions']=permissions;}
if(typeof documentSecurity!=='undefined'){payload['documentSecurity']=documentSecurity;}
@ -406,7 +402,7 @@ class Functions extends Service{constructor(client){super(client);}
list(queries,search){return __awaiter(this,void 0,void 0,function*(){let path='/functions';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
create(functionId,name,execute,runtime,events,schedule,timeout){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
create(functionId,name,execute,runtime,events,schedule,timeout,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof execute==='undefined'){throw new AppwriteException('Missing required parameter: "execute"');}
if(typeof runtime==='undefined'){throw new AppwriteException('Missing required parameter: "runtime"');}
@ -417,13 +413,14 @@ if(typeof runtime!=='undefined'){payload['runtime']=runtime;}
if(typeof events!=='undefined'){payload['events']=events;}
if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
if(typeof timeout!=='undefined'){payload['timeout']=timeout;}
if(typeof enabled!=='undefined'){payload['enabled']=enabled;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});}
listRuntimes(){return __awaiter(this,void 0,void 0,function*(){let path='/functions/runtimes';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getUsage(range){return __awaiter(this,void 0,void 0,function*(){let path='/functions/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
get(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
update(functionId,name,execute,events,schedule,timeout){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
update(functionId,name,execute,events,schedule,timeout,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof execute==='undefined'){throw new AppwriteException('Missing required parameter: "execute"');}
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
@ -431,6 +428,7 @@ if(typeof execute!=='undefined'){payload['execute']=execute;}
if(typeof events!=='undefined'){payload['events']=events;}
if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
if(typeof timeout!=='undefined'){payload['timeout']=timeout;}
if(typeof enabled!=='undefined'){payload['enabled']=enabled;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});}
delete(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});}
@ -478,10 +476,8 @@ let path='/functions/{functionId}/executions/{executionId}'.replace('{functionId
getFunctionUsage(functionId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/usage'.replace('{functionId}',functionId);let payload={};if(typeof range!=='undefined'){payload['range']=range;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listVariables(functionId,queries,search){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/variables'.replace('{functionId}',functionId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listVariables(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/variables'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
createVariable(functionId,key,value){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');}
if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');}
if(typeof value==='undefined'){throw new AppwriteException('Missing required parameter: "value"');}
@ -513,12 +509,12 @@ getStorageLocal(){return __awaiter(this,void 0,void 0,function*(){let path='/hea
getTime(){return __awaiter(this,void 0,void 0,function*(){let path='/health/time';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}}
class Locale extends Service{constructor(client){super(client);}
get(){return __awaiter(this,void 0,void 0,function*(){let path='/locale';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getContinents(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getCountries(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getCountriesEU(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getCountriesPhones(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getCurrencies(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getLanguages(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}}
listContinents(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listCountries(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listCountriesEU(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listCountriesPhones(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listCurrencies(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
listLanguages(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}}
class Projects extends Service{constructor(client){super(client);}
list(queries,search){return __awaiter(this,void 0,void 0,function*(){let path='/projects';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
@ -685,9 +681,8 @@ class Storage extends Service{constructor(client){super(client);}
listBuckets(queries,search){return __awaiter(this,void 0,void 0,function*(){let path='/storage/buckets';let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
createBucket(bucketId,name,fileSecurity,permissions,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
createBucket(bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof fileSecurity==='undefined'){throw new AppwriteException('Missing required parameter: "fileSecurity"');}
let path='/storage/buckets';let payload={};if(typeof bucketId!=='undefined'){payload['bucketId']=bucketId;}
if(typeof name!=='undefined'){payload['name']=name;}
if(typeof permissions!=='undefined'){payload['permissions']=permissions;}
@ -701,9 +696,8 @@ if(typeof antivirus!=='undefined'){payload['antivirus']=antivirus;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});}
getBucket(bucketId){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
updateBucket(bucketId,name,fileSecurity,permissions,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
updateBucket(bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
if(typeof fileSecurity==='undefined'){throw new AppwriteException('Missing required parameter: "fileSecurity"');}
let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(typeof permissions!=='undefined'){payload['permissions']=permissions;}
if(typeof fileSecurity!=='undefined'){payload['fileSecurity']=fileSecurity;}
@ -793,7 +787,7 @@ let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=n
listLogs(teamId,queries){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
let path='/teams/{teamId}/logs'.replace('{teamId}',teamId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getMemberships(teamId,queries,search){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
listMemberships(teamId,queries,search){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');}
let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
if(typeof search!=='undefined'){payload['search']=search;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
@ -919,10 +913,10 @@ updateEmail(userId,email){return __awaiter(this,void 0,void 0,function*(){if(typ
if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');}
let path='/users/{userId}/email'.replace('{userId}',userId);let payload={};if(typeof email!=='undefined'){payload['email']=email;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}
getLogs(userId,queries){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
listLogs(userId,queries){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/logs'.replace('{userId}',userId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
getMemberships(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
listMemberships(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/memberships'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
updateName(userId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');}
@ -942,7 +936,7 @@ updatePrefs(userId,prefs){return __awaiter(this,void 0,void 0,function*(){if(typ
if(typeof prefs==='undefined'){throw new AppwriteException('Missing required parameter: "prefs"');}
let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};if(typeof prefs!=='undefined'){payload['prefs']=prefs;}
const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}
getSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
listSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}
deleteSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});}

View file

@ -96,8 +96,8 @@
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
'x-sdk-version': '6.1.0-RC1',
'X-Appwrite-Response-Format': '1.0.0-RC1',
'x-sdk-version': '7.0.0',
'X-Appwrite-Response-Format': '1.0.0',
};
this.realtime = {
socket: undefined,
@ -561,7 +561,7 @@
});
}
/**
* Get Account Logs
* List Account Logs
*
* Get currently logged in user list of latest security activity logs. Each
* log returns user IP address, location and date and time of log.
@ -570,7 +570,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getLogs(queries) {
listLogs(queries) {
return __awaiter(this, void 0, void 0, function* () {
let path = '/account/logs';
let payload = {};
@ -814,7 +814,7 @@
});
}
/**
* Get Account Sessions
* List Account Sessions
*
* Get currently logged in user list of active sessions across different
* devices.
@ -822,7 +822,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getSessions() {
listSessions() {
return __awaiter(this, void 0, void 0, function* () {
let path = '/account/sessions';
let payload = {};
@ -1567,12 +1567,11 @@
* @param {string} name
* @param {number} width
* @param {number} height
* @param {string} color
* @param {string} background
* @throws {AppwriteException}
* @returns {URL}
*/
getInitials(name, width, height, color, background) {
getInitials(name, width, height, background) {
let path = '/avatars/initials';
let payload = {};
if (typeof name !== 'undefined') {
@ -1584,9 +1583,6 @@
if (typeof height !== 'undefined') {
payload['height'] = height;
}
if (typeof color !== 'undefined') {
payload['color'] = color;
}
if (typeof background !== 'undefined') {
payload['background'] = background;
}
@ -1856,12 +1852,6 @@
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof permissions === 'undefined') {
throw new AppwriteException('Missing required parameter: "permissions"');
}
if (typeof documentSecurity === 'undefined') {
throw new AppwriteException('Missing required parameter: "documentSecurity"');
}
let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
let payload = {};
if (typeof collectionId !== 'undefined') {
@ -1917,13 +1907,13 @@
* @param {string} databaseId
* @param {string} collectionId
* @param {string} name
* @param {boolean} documentSecurity
* @param {string[]} permissions
* @param {boolean} documentSecurity
* @param {boolean} enabled
* @throws {AppwriteException}
* @returns {Promise}
*/
updateCollection(databaseId, collectionId, name, documentSecurity, permissions, enabled) {
updateCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof databaseId === 'undefined') {
throw new AppwriteException('Missing required parameter: "databaseId"');
@ -1934,9 +1924,6 @@
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof documentSecurity === 'undefined') {
throw new AppwriteException('Missing required parameter: "documentSecurity"');
}
let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
let payload = {};
if (typeof name !== 'undefined') {
@ -3040,10 +3027,11 @@
* @param {string[]} events
* @param {string} schedule
* @param {number} timeout
* @param {boolean} enabled
* @throws {AppwriteException}
* @returns {Promise}
*/
create(functionId, name, execute, runtime, events, schedule, timeout) {
create(functionId, name, execute, runtime, events, schedule, timeout, enabled) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
@ -3080,6 +3068,9 @@
if (typeof timeout !== 'undefined') {
payload['timeout'] = timeout;
}
if (typeof enabled !== 'undefined') {
payload['enabled'] = enabled;
}
const uri = new URL(this.client.config.endpoint + path);
return yield this.client.call('post', uri, {
'content-type': 'application/json',
@ -3158,10 +3149,11 @@
* @param {string[]} events
* @param {string} schedule
* @param {number} timeout
* @param {boolean} enabled
* @throws {AppwriteException}
* @returns {Promise}
*/
update(functionId, name, execute, events, schedule, timeout) {
update(functionId, name, execute, events, schedule, timeout, enabled) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
@ -3189,6 +3181,9 @@
if (typeof timeout !== 'undefined') {
payload['timeout'] = timeout;
}
if (typeof enabled !== 'undefined') {
payload['enabled'] = enabled;
}
const uri = new URL(this.client.config.endpoint + path);
return yield this.client.call('put', uri, {
'content-type': 'application/json',
@ -3569,24 +3564,16 @@
* Get a list of all variables of a specific function.
*
* @param {string} functionId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise}
*/
listVariables(functionId, queries, search) {
listVariables(functionId) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
let payload = {};
if (typeof queries !== 'undefined') {
payload['queries'] = queries;
}
if (typeof search !== 'undefined') {
payload['search'] = search;
}
const uri = new URL(this.client.config.endpoint + path);
return yield this.client.call('get', uri, {
'content-type': 'application/json',
@ -3953,7 +3940,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getContinents() {
listContinents() {
return __awaiter(this, void 0, void 0, function* () {
let path = '/locale/continents';
let payload = {};
@ -3972,7 +3959,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getCountries() {
listCountries() {
return __awaiter(this, void 0, void 0, function* () {
let path = '/locale/countries';
let payload = {};
@ -3991,7 +3978,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getCountriesEU() {
listCountriesEU() {
return __awaiter(this, void 0, void 0, function* () {
let path = '/locale/countries/eu';
let payload = {};
@ -4010,7 +3997,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getCountriesPhones() {
listCountriesPhones() {
return __awaiter(this, void 0, void 0, function* () {
let path = '/locale/countries/phones';
let payload = {};
@ -4030,7 +4017,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getCurrencies() {
listCurrencies() {
return __awaiter(this, void 0, void 0, function* () {
let path = '/locale/currencies';
let payload = {};
@ -4049,7 +4036,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getLanguages() {
listLanguages() {
return __awaiter(this, void 0, void 0, function* () {
let path = '/locale/languages';
let payload = {};
@ -5126,8 +5113,8 @@
*
* @param {string} bucketId
* @param {string} name
* @param {boolean} fileSecurity
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
@ -5137,7 +5124,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
createBucket(bucketId, name, fileSecurity, permissions, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
createBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof bucketId === 'undefined') {
throw new AppwriteException('Missing required parameter: "bucketId"');
@ -5145,9 +5132,6 @@
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof fileSecurity === 'undefined') {
throw new AppwriteException('Missing required parameter: "fileSecurity"');
}
let path = '/storage/buckets';
let payload = {};
if (typeof bucketId !== 'undefined') {
@ -5216,8 +5200,8 @@
*
* @param {string} bucketId
* @param {string} name
* @param {boolean} fileSecurity
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
@ -5227,7 +5211,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
updateBucket(bucketId, name, fileSecurity, permissions, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
updateBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof bucketId === 'undefined') {
throw new AppwriteException('Missing required parameter: "bucketId"');
@ -5235,9 +5219,6 @@
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof fileSecurity === 'undefined') {
throw new AppwriteException('Missing required parameter: "fileSecurity"');
}
let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
let payload = {};
if (typeof name !== 'undefined') {
@ -5866,7 +5847,7 @@
});
}
/**
* Get Team Memberships
* List Team Memberships
*
* Use this endpoint to list a team's members using the team's ID. All team
* members have read access to this endpoint.
@ -5877,7 +5858,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getMemberships(teamId, queries, search) {
listMemberships(teamId, queries, search) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
@ -6652,7 +6633,7 @@
});
}
/**
* Get User Logs
* List User Logs
*
* Get the user activity logs list by its unique ID.
*
@ -6661,7 +6642,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getLogs(userId, queries) {
listLogs(userId, queries) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
@ -6678,7 +6659,7 @@
});
}
/**
* Get User Memberships
* List User Memberships
*
* Get the user membership list by its unique ID.
*
@ -6686,7 +6667,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getMemberships(userId) {
listMemberships(userId) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
@ -6840,7 +6821,7 @@
});
}
/**
* Get User Sessions
* List User Sessions
*
* Get the user sessions list by its unique ID.
*
@ -6848,7 +6829,7 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
getSessions(userId) {
listSessions(userId) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');

View file

@ -286,8 +286,8 @@ class Realtime extends Adapter
}
$channels[] = 'documents';
$channels[] = 'databases.' . $database->getId() . '.collections.' . $payload->getCollection() . '.documents';
$channels[] = 'databases.' . $database->getId() . '.collections.' . $payload->getCollection() . '.documents.' . $payload->getId();
$channels[] = 'databases.' . $database->getId() . '.collections.' . $payload->getAttribute('$collectionId') . '.documents';
$channels[] = 'databases.' . $database->getId() . '.collections.' . $payload->getAttribute('$collectionId') . '.documents.' . $payload->getId();
$roles = $collection->getAttribute('documentSecurity', false)
? \array_merge($collection->getRead(), $payload->getRead())

View file

@ -36,12 +36,18 @@ class Document extends Any
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('$collection', [
->addRule('$collectionId', [
'type' => self::TYPE_STRING,
'description' => 'Collection ID.',
'default' => '',
'example' => '5e5ea5c15117e',
])
->addRule('$databaseId', [
'type' => self::TYPE_STRING,
'description' => 'Database ID.',
'default' => '',
'example' => '5e5ea5c15117e',
])
->addRule('$createdAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Document creation date in ISO 8601 format.',
@ -60,13 +66,13 @@ class Document extends Any
'default' => '',
'example' => ['read("any")'],
'array' => true,
])
;
]);
}
public function filter(DatabaseDocument $document): DatabaseDocument
{
$document->removeAttribute('$internalId');
$document->removeAttribute('$collection'); // $collection is the internal collection ID
return $document;
}

View file

@ -938,6 +938,9 @@ trait DatabasesBase
]);
$this->assertEquals(201, $document1['headers']['status-code']);
$this->assertEquals($data['moviesId'], $document1['body']['$collectionId']);
$this->assertArrayNotHasKey('$collection', $document1['body']);
$this->assertEquals($databaseId, $document1['body']['$databaseId']);
$this->assertEquals($document1['body']['title'], 'Captain America');
$this->assertEquals($document1['body']['releaseYear'], 1944);
$this->assertIsArray($document1['body']['$permissions']);
@ -948,6 +951,9 @@ trait DatabasesBase
$this->assertEquals($document1['body']['birthDay'], '1975-06-12T12:12:55.000+00:00');
$this->assertEquals(201, $document2['headers']['status-code']);
$this->assertEquals($data['moviesId'], $document2['body']['$collectionId']);
$this->assertArrayNotHasKey('$collection', $document2['body']);
$this->assertEquals($databaseId, $document2['body']['$databaseId']);
$this->assertEquals($document2['body']['title'], 'Spider-Man: Far From Home');
$this->assertEquals($document2['body']['releaseYear'], 2019);
$this->assertEquals($document2['body']['duration'], null);
@ -960,6 +966,9 @@ trait DatabasesBase
$this->assertEquals($document2['body']['birthDay'], null);
$this->assertEquals(201, $document3['headers']['status-code']);
$this->assertEquals($data['moviesId'], $document3['body']['$collectionId']);
$this->assertArrayNotHasKey('$collection', $document3['body']);
$this->assertEquals($databaseId, $document3['body']['$databaseId']);
$this->assertEquals($document3['body']['title'], 'Spider-Man: Homecoming');
$this->assertEquals($document3['body']['releaseYear'], 2017);
$this->assertEquals($document3['body']['duration'], 0);
@ -968,7 +977,7 @@ trait DatabasesBase
$this->assertCount(2, $document3['body']['actors']);
$this->assertEquals($document3['body']['actors'][0], 'Tom Holland');
$this->assertEquals($document3['body']['actors'][1], 'Zendaya Maree Stoermer');
$this->assertEquals($document3['body']['birthDay'], '1975-06-12T18:12:55.000+00:00');// UTC for NY
$this->assertEquals($document3['body']['birthDay'], '1975-06-12T18:12:55.000+00:00'); // UTC for NY
$this->assertEquals(400, $document4['headers']['status-code']);
@ -985,7 +994,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'orderAsc("releaseYear")' ],
'queries' => ['orderAsc("releaseYear")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -998,14 +1007,16 @@ trait DatabasesBase
$this->assertCount(3, $documents['body']['documents']);
foreach ($documents['body']['documents'] as $document) {
$this->assertEquals($data['moviesId'], $document['$collection']);
$this->assertEquals($data['moviesId'], $document['$collectionId']);
$this->assertArrayNotHasKey('$collection', $document);
$this->assertEquals($databaseId, $document['$databaseId']);
}
$documents = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'orderDesc("releaseYear")' ],
'queries' => ['orderDesc("releaseYear")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1080,14 +1091,16 @@ trait DatabasesBase
{
$databaseId = $data['databaseId'];
foreach ($data['documents'] as $document) {
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $document['$collection'] . '/documents/' . $document['$id'], array_merge([
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $document['$collectionId'] . '/documents/' . $document['$id'], array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals($response['body']['$id'], $document['$id']);
$this->assertEquals($response['body']['$collection'], $document['$collection']);
$this->assertEquals($document['$collectionId'], $response['body']['$collectionId']);
$this->assertArrayNotHasKey('$collection', $response['body']);
$this->assertEquals($document['$databaseId'], $response['body']['$databaseId']);
$this->assertEquals($response['body']['title'], $document['title']);
$this->assertEquals($response['body']['releaseYear'], $document['releaseYear']);
$this->assertEquals($response['body']['$permissions'], $document['$permissions']);
@ -1120,7 +1133,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorAfter("' . $base['body']['documents'][0]['$id'] . '")' ],
'queries' => ['cursorAfter("' . $base['body']['documents'][0]['$id'] . '")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1132,7 +1145,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorAfter("' . $base['body']['documents'][2]['$id'] . '")' ],
'queries' => ['cursorAfter("' . $base['body']['documents'][2]['$id'] . '")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1145,7 +1158,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'orderAsc("releaseYear")' ],
'queries' => ['orderAsc("releaseYear")'],
]);
$this->assertEquals(200, $base['headers']['status-code']);
@ -1158,7 +1171,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorAfter("' . $base['body']['documents'][1]['$id'] . '")', 'orderAsc("releaseYear")' ],
'queries' => ['cursorAfter("' . $base['body']['documents'][1]['$id'] . '")', 'orderAsc("releaseYear")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1172,7 +1185,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'orderDesc("releaseYear")' ],
'queries' => ['orderDesc("releaseYear")'],
]);
$this->assertEquals(200, $base['headers']['status-code']);
@ -1185,7 +1198,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorAfter("' . $base['body']['documents'][1]['$id'] . '")', 'orderDesc("releaseYear")' ],
'queries' => ['cursorAfter("' . $base['body']['documents'][1]['$id'] . '")', 'orderDesc("releaseYear")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1199,7 +1212,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorAfter("unknown")' ],
'queries' => ['cursorAfter("unknown")'],
]);
$this->assertEquals(400, $documents['headers']['status-code']);
@ -1231,7 +1244,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorBefore("' . $base['body']['documents'][2]['$id'] . '")' ],
'queries' => ['cursorBefore("' . $base['body']['documents'][2]['$id'] . '")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1243,7 +1256,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorBefore("' . $base['body']['documents'][0]['$id'] . '")' ],
'queries' => ['cursorBefore("' . $base['body']['documents'][0]['$id'] . '")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1256,7 +1269,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'orderAsc("releaseYear")' ],
'queries' => ['orderAsc("releaseYear")'],
]);
$this->assertEquals(200, $base['headers']['status-code']);
@ -1269,7 +1282,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorBefore("' . $base['body']['documents'][1]['$id'] . '")', 'orderAsc("releaseYear")' ],
'queries' => ['cursorBefore("' . $base['body']['documents'][1]['$id'] . '")', 'orderAsc("releaseYear")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1283,7 +1296,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'orderDesc("releaseYear")' ],
'queries' => ['orderDesc("releaseYear")'],
]);
$this->assertEquals(200, $base['headers']['status-code']);
@ -1296,7 +1309,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'cursorBefore("' . $base['body']['documents'][1]['$id'] . '")', 'orderDesc("releaseYear")' ],
'queries' => ['cursorBefore("' . $base['body']['documents'][1]['$id'] . '")', 'orderDesc("releaseYear")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1316,7 +1329,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'limit(1)', 'orderAsc("releaseYear")' ],
'queries' => ['limit(1)', 'orderAsc("releaseYear")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1327,7 +1340,7 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'limit(2)', 'offset(1)', 'orderAsc("releaseYear")' ],
'queries' => ['limit(2)', 'offset(1)', 'orderAsc("releaseYear")'],
]);
$this->assertEquals(200, $documents['headers']['status-code']);
@ -1514,6 +1527,9 @@ trait DatabasesBase
$id = $document['body']['$id'];
$this->assertEquals(201, $document['headers']['status-code']);
$this->assertEquals($data['moviesId'], $document['body']['$collectionId']);
$this->assertArrayNotHasKey('$collection', $document['body']);
$this->assertEquals($databaseId, $document['body']['$databaseId']);
$this->assertEquals($document['body']['title'], 'Thor: Ragnaroc');
$this->assertEquals($document['body']['releaseYear'], 2017);
$this->assertEquals(true, DateTime::isValid($document['body']['$createdAt']));
@ -1538,7 +1554,9 @@ trait DatabasesBase
$this->assertEquals(200, $document['headers']['status-code']);
$this->assertEquals($document['body']['$id'], $id);
$this->assertEquals($document['body']['$collection'], $data['moviesId']);
$this->assertEquals($data['moviesId'], $document['body']['$collectionId']);
$this->assertArrayNotHasKey('$collection', $document['body']);
$this->assertEquals($databaseId, $document['body']['$databaseId']);
$this->assertEquals($document['body']['title'], 'Thor: Ragnarok');
$this->assertEquals($document['body']['releaseYear'], 2017);
$this->assertContains(Permission::read(Role::users()), $document['body']['$permissions']);
@ -1553,6 +1571,9 @@ trait DatabasesBase
$id = $document['body']['$id'];
$this->assertEquals(200, $document['headers']['status-code']);
$this->assertEquals($data['moviesId'], $document['body']['$collectionId']);
$this->assertArrayNotHasKey('$collection', $document['body']);
$this->assertEquals($databaseId, $document['body']['$databaseId']);
$this->assertEquals($document['body']['title'], 'Thor: Ragnarok');
$this->assertEquals($document['body']['releaseYear'], 2017);