Merge branch 'main' into codex/fix-staged-transaction-timestamps

This commit is contained in:
Jake Barnby authored and GitHub committed 2026-06-30 20:13:12 +12:00
commit 476e25e966
232 files changed
+2887 -2264

No files matched your search

+1 -1
View File
@@ -41,7 +41,7 @@ Build and run the target release with the local Docker Compose stack, then test
docker compose down -v
docker compose up -d --force-recreate --build --wait
docker compose exec -T appwrite vars
curl -fsS http://localhost/v1/health/version
curl -fsS http://localhost:9520/v1/health/version
```
2. Inspect runtime health before running tests:
+1
View File
@@ -107,6 +107,7 @@ _APP_COMPUTE_MEMORY=8192
_APP_COMPUTE_INACTIVE_THRESHOLD=600
_APP_COMPUTE_MAINTENANCE_INTERVAL=600
_APP_COMPUTE_RUNTIMES_NETWORK=runtimes
_APP_OPEN_RUNTIMES_NFT=enabled
_APP_FUNCTIONS_RUNTIMES=node-22
_APP_FUNCTIONS_TIMEOUT=900
_APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000
+71 -40
View File
@@ -51,42 +51,37 @@ function buildComment(core) {
const baseRef = markdownText(process.env.BENCHMARK_BASE_REF || 'base');
const headRef = markdownText(process.env.BENCHMARK_HEAD_REF || 'head');
const rows = benchmarkRows(before, after, beforeSamples, afterSamples);
const topWaits = topSamples(afterSamples, 'appwrite_api_waiting', 3);
const total = rows[0];
const topWaits = topSamples(afterSamples, 'appwrite_api_waiting', 5);
const lines = [
marker,
'## :sparkles: Benchmark results',
'',
`Comparing ${baseRef} (before) to ${headRef} (after).`,
`Comparing \`${baseRef}\` (before) → \`${headRef}\` (after).`,
'',
];
if (before === null) {
lines.push('> Before benchmark did not complete; showing current branch metrics only.', '');
lines.push('> :warning: Before benchmark did not complete — change column unavailable.', '');
}
if (after === null) {
lines.push('> Current branch benchmark did not complete; showing available metrics only.', '');
lines.push('> :warning: Current branch benchmark did not complete — showing available metrics only.', '');
}
lines.push(
'**Before**',
'',
metricTable(rows, 'before'),
'',
'**After**',
'',
metricTable(rows, 'after'),
'',
'**Delta**',
'',
'| Scenario | P95 delta (ms) |',
'| --- | ---: |',
...rows.map(deltaRow),
...headlineTable(total),
'',
'<details>',
'<summary><strong>Top API waits</strong></summary>',
'<summary><strong>Per-scenario breakdown & investigation details</strong></summary>',
'',
'<br>',
'',
'_Metrics below reflect the current branch (after). Δ P95 compares against the base._',
'',
detailTable(rows),
'',
'**Top API waits (after)**',
'',
'| API request | Max wait (ms) |',
'| --- | ---: |',
...topWaitRows(topWaits),
@@ -97,6 +92,46 @@ function buildComment(core) {
return `${lines.join('\n')}\n`;
}
function headlineTable(total) {
const { before, after } = total;
return [
'| Metric | Before | After | Change |',
'| --- | ---: | ---: | :--- |',
`| :rocket: Requests/sec | ${formatRate(before?.rps)} | ${formatRate(after?.rps)} | ${changeCell(before?.rps, after?.rps, false)} |`,
`| :stopwatch: Latency P50 | ${formatMsUnit(before?.p50)} | ${formatMsUnit(after?.p50)} | ${changeCell(before?.p50, after?.p50, true)} |`,
`| :stopwatch: Latency P95 | ${formatMsUnit(before?.p95)} | ${formatMsUnit(after?.p95)} | ${changeCell(before?.p95, after?.p95, true)} |`,
];
}
function changeCell(before, after, lowerIsBetter) {
if (before === null || before === undefined || after === null || after === undefined || Number.isNaN(before) || Number.isNaN(after) || before === 0) {
return 'n/a';
}
const percent = Number((((after - before) / before) * 100).toFixed(1));
const label = code(`${percent > 0 ? '+' : ''}${trimNumber(percent)}%`);
if (Math.abs(percent) <= 5) {
return `:white_circle: ${label}`;
}
const improved = lowerIsBetter ? percent < 0 : percent > 0;
return `${improved ? ':green_circle:' : ':red_circle:'} ${label}`;
}
function detailTable(rows) {
return [
'| Scenario | P50 (ms) | P95 (ms) | Requests | RPS | Δ P95 (ms) |',
'| --- | ---: | ---: | ---: | ---: | ---: |',
...rows.map(detailRow),
].join('\n');
}
function detailRow(row) {
const values = row.after;
return `| ${row.label} | ${formatMs(values?.p50)} | ${formatMs(values?.p95)} | ${formatCount(values?.iterations)} | ${formatRate(values?.rps)} | ${formatDelta(row.before?.p95, row.after?.p95)} |`;
}
function readSummary(path, core) {
if (!fs.existsSync(path)) {
return null;
@@ -256,23 +291,6 @@ function metricValue(data, metric, stat) {
return metricValues(data, metric)?.[stat] ?? null;
}
function metricTable(rows, side) {
return [
'| Scenario | P50 (ms) | P95 (ms) | Requests | RPS |',
'| --- | ---: | ---: | ---: | ---: |',
...rows.map((row) => metricRow(row, side)),
].join('\n');
}
function metricRow(row, side) {
const values = row[side];
return `| ${row.label} | ${formatMs(values?.p50)} | ${formatMs(values?.p95)} | ${formatCount(values?.iterations)} | ${formatRate(values?.rps)} |`;
}
function deltaRow(row) {
return `| ${row.label} | ${formatDelta(row.before?.p95, row.after?.p95)} |`;
}
function topSamples(samples, metric, limit) {
const byName = samples.reduce((result, sample) => {
if (sample.metric !== metric || typeof sample.data?.value !== 'number') {
@@ -310,11 +328,16 @@ function markdownText(value) {
}
function formatMs(value) {
return formatNumber(value, 2);
return code(formatNumber(value, 2));
}
function formatMsUnit(value) {
const formatted = formatNumber(value, 2);
return formatted === 'n/a' ? formatted : code(`${formatted} ms`);
}
function formatRate(value) {
return formatNumber(value, 2);
return code(formatNumber(value, 2));
}
function formatCount(value) {
@@ -322,7 +345,7 @@ function formatCount(value) {
return 'n/a';
}
return `${Math.round(value)}`;
return code(Math.round(value).toLocaleString('en-US'));
}
function formatDelta(before, after) {
@@ -331,7 +354,8 @@ function formatDelta(before, after) {
}
const difference = Number((after - before).toFixed(2));
return `${difference > 0 ? '+' : ''}${trimNumber(difference)}`;
const sign = difference > 0 ? '+' : difference < 0 ? '-' : '';
return code(`${sign}${formatNumber(Math.abs(difference), 2)}`);
}
function formatNumber(value, decimals) {
@@ -339,7 +363,14 @@ function formatNumber(value, decimals) {
return 'n/a';
}
return trimNumber(Number(value).toFixed(decimals));
return trimNumber(Number(value).toLocaleString('en-US', {
minimumFractionDigits: decimals,
maximumFractionDigits: decimals,
}));
}
function code(text) {
return text === 'n/a' ? text : `\`${text}\``;
}
function trimNumber(value) {
+24 -10
View File
@@ -5,7 +5,7 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
COMPOSE_FILE: docker-compose.yml
COMPOSE_FILE: docker-compose.yml:docker-compose.override.yml
IMAGE: appwrite-dev
K6_VERSION: '0.53.0'
@@ -13,6 +13,7 @@ on:
pull_request:
push:
branches:
- main
- 1.9.x
workflow_dispatch:
inputs:
@@ -106,6 +107,11 @@ jobs:
tools: composer:v2
coverage: none
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24'
- name: Validate composer.json
run: composer validate
@@ -113,6 +119,10 @@ jobs:
id: install
run: composer install --prefer-dist --no-progress --ignore-platform-reqs
- name: Install Node dependencies
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: npm ci
- name: Cache PHPStan result cache
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -132,6 +142,10 @@ jobs:
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: composer lint
- name: Check Docker Compose formatting
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: npm run lint:compose
- name: Run Rector
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: composer refactor:check
@@ -667,7 +681,7 @@ jobs:
docker tag ${{ env.IMAGE }}:before ${{ env.IMAGE }}
docker compose up -d --wait --no-build
for attempt in $(seq 1 10); do
if curl -fsS http://localhost/v1/health/version; then
if curl -fsS http://localhost:9520/v1/health/version; then
break
fi
if [ "$attempt" -eq 10 ]; then
@@ -684,9 +698,9 @@ jobs:
continue-on-error: true
uses: grafana/run-k6-action@de51a7390bdf0ac85a3bef493691bd71d4c7c158 # v1.4.0
env:
APPWRITE_ENDPOINT: 'http://localhost/v1'
APPWRITE_BENCHMARK_ITERATIONS: '5'
APPWRITE_BENCHMARK_VUS: '1'
APPWRITE_ENDPOINT: 'http://localhost:9520/v1'
APPWRITE_BENCHMARK_DURATION: '1m'
APPWRITE_BENCHMARK_VUS: '20'
APPWRITE_WORKER_TIMEOUT_MS: '120000'
APPWRITE_BENCHMARK_SUMMARY_PATH: 'benchmark-before-summary.json'
with:
@@ -706,7 +720,7 @@ jobs:
- name: Wait for benchmark ports
if: always()
run: |
for port in 80 443 8080 9503; do
for port in 9520 9521 9522 9503; do
for attempt in $(seq 1 30); do
if ! ss -ltn | awk '{print $4}' | grep -Eq "[:.]${port}$"; then
break
@@ -731,7 +745,7 @@ jobs:
docker tag ${{ env.IMAGE }}:after ${{ env.IMAGE }}
docker compose up -d --wait --no-build
for attempt in $(seq 1 10); do
if curl -fsS http://localhost/v1/health/version; then
if curl -fsS http://localhost:9520/v1/health/version; then
break
fi
if [ "$attempt" -eq 10 ]; then
@@ -745,9 +759,9 @@ jobs:
continue-on-error: true
uses: grafana/run-k6-action@de51a7390bdf0ac85a3bef493691bd71d4c7c158 # v1.4.0
env:
APPWRITE_ENDPOINT: 'http://localhost/v1'
APPWRITE_BENCHMARK_ITERATIONS: '5'
APPWRITE_BENCHMARK_VUS: '1'
APPWRITE_ENDPOINT: 'http://localhost:9520/v1'
APPWRITE_BENCHMARK_DURATION: '1m'
APPWRITE_BENCHMARK_VUS: '20'
APPWRITE_WORKER_TIMEOUT_MS: '120000'
APPWRITE_BENCHMARK_PREVIOUS_SUMMARY_PATH: '../../benchmark-before-summary.json'
APPWRITE_BENCHMARK_SUMMARY_PATH: 'benchmark-after-summary.json'
+1 -1
View File
@@ -1,7 +1,7 @@
name: "SDK Preview"
env:
COMPOSE_FILE: docker-compose.yml
COMPOSE_FILE: docker-compose.yml:docker-compose.override.yml
on:
workflow_dispatch:
+1 -1
View File
@@ -1,7 +1,7 @@
name: "Generate Specs"
env:
COMPOSE_FILE: docker-compose.yml
COMPOSE_FILE: docker-compose.yml:docker-compose.override.yml
on:
workflow_dispatch:
+1 -1
View File
@@ -17,7 +17,7 @@ tasks:
--prefer-dist
ports:
- port: 8080
- port: 9520
visibility: public
vscode:
+25 -2
View File
@@ -281,11 +281,34 @@ Although the Appwrite API is a monolithic app, it has a very clear separation of
Each container in Appwrite is a microservice on its own. Each service is an independent process that can scale without regard to any of the other services.
Currently, all the Appwrite microservices are intended to communicate using the TCP protocol over a private network. With the exception of the public-facing port 80 and 443, which by default are used to expose the Appwrite HTTP API, you should **avoid exposing any other services' ports**.
Currently, all the Appwrite microservices are intended to communicate using the TCP protocol over a private network. You should **avoid exposing services' ports** beyond what is needed for local development and debugging.
## Ports
Appwrite dev version uses ports 80 and 443 as an entry point to the Appwrite API and console. We also expose multiple ports in the range of 9500-9504 for debugging some of the Appwrite containers on dev mode. If you have any conflicts with the ports running on your system, you can easily replace them by editing Appwrite's docker-compose.yml file and executing `docker compose up -d` command.
Appwrite server dev publishes all host ports in the **9500–9522** range so the stack can run alongside other local services (including Appwrite Cloud on **9600–9699**). Access the API and console at `http://localhost:9520` (or `https://localhost:9521`).
| Host port | Service |
|-----------|---------|
| 9520 | Traefik HTTP (API, console, dev hostnames) |
| 9521 | Traefik HTTPS |
| 9522 | Traefik HTTP (alt) |
| 9500 | Traefik dashboard |
| 9501 | Appwrite API only (direct; no console) |
| 9502 | Realtime only (direct; no console) |
| 9503 | Mail catcher |
| 9504 | Request catcher (webhook) |
| 9505 | Embedding |
| 9506 | Adminer |
| 9507 | Request catcher (SMS) |
| 9508 | Mongo Express |
| 9509 | GraphQL explorer |
| 9510 | MariaDB |
| 9511 | MongoDB |
| 9512 | PostgreSQL |
| 9513 | Redis |
| 9514 | Redis Insight |
Containers still talk to each other on the internal Docker network using standard service ports (for example, `mariadb:3306`). The table above is only for connections from your host machine. If you still have a conflict, change the host side in `docker-compose.yml` or `docker-compose.override.yml` and run `docker compose up -d`.
## Technology Stack
+11
View File
@@ -342,6 +342,17 @@ $platformCollections = [
'array' => true,
'filters' => [],
],
[
'$id' => ID::custom('onboarding'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 65536,
'signed' => true,
'required' => false,
'default' => [],
'array' => false,
'filters' => ['json'],
],
[
'$id' => 'status',
'type' => Database::VAR_STRING,
+76
View File
@@ -0,0 +1,76 @@
<?php
/**
* Project onboarding stages keyed by SDK method (namespace + method name, same as Appwrite\SDK\Method).
* Values are `true` for O(1) isset() lookup in the API shutdown hook. Each key is persisted under
* project.onboarding when the matching API call succeeds.
*/
return [
// Connect — register platform
'project.createWebPlatform' => true,
'project.createAndroidPlatform' => true,
'project.createApplePlatform' => true,
'project.createWindowsPlatform' => true,
'project.createLinuxPlatform' => true,
// Connect — API key
'project.createKey' => true,
// Auth
'users.create' => true,
'account.create' => true,
'account.createAnonymousSession' => true,
'teams.create' => true,
// Databases — tablesDB
'tablesDB.create' => true,
'tablesDB.createTable' => true,
'tablesDB.createRow' => true,
// Databases — documentsDB
'documentsDB.create' => true,
'documentsDB.createCollection' => true,
'documentsDB.createDocument' => true,
// Databases — legacy
'databases.create' => true,
'databases.createCollection' => true,
'databases.createDocument' => true,
// Storage
'storage.createBucket' => true,
'storage.createFile' => true,
// Functions
'functions.create' => true,
// Deployment-creation SDK methods; OR them in the UI for a single
// "created a deployment" milestone.
'functions.createDeployment' => true,
'functions.createTemplateDeployment' => true,
'functions.createVcsDeployment' => true,
'functions.updateFunctionDeployment' => true,
// Messaging
'messaging.createTopic' => true,
'messaging.createMailgunProvider' => true,
'messaging.createSendgridProvider' => true,
'messaging.createSesProvider' => true,
'messaging.createResendProvider' => true,
'messaging.createSmtpProvider' => true,
'messaging.createSMTPProvider' => true,
'messaging.createMsg91Provider' => true,
'messaging.createTelesignProvider' => true,
'messaging.createTextmagicProvider' => true,
'messaging.createTwilioProvider' => true,
'messaging.createVonageProvider' => true,
'messaging.createFcmProvider' => true,
'messaging.createFCMProvider' => true,
'messaging.createApnsProvider' => true,
'messaging.createAPNSProvider' => true,
// Sites
'sites.create' => true,
// Deployment-creation SDK methods; OR them in the UI for a single
// "created a deployment" milestone.
'sites.createDeployment' => true,
'sites.createTemplateDeployment' => true,
'sites.createVcsDeployment' => true,
'sites.updateSiteDeployment' => true,
];
+2
View File
@@ -107,6 +107,8 @@ $admins = [
'tokens.write',
'schedules.read',
'schedules.write',
'stages.read',
'stages.write',
'insights.read',
'insights.write',
'reports.read',
+10
View File
@@ -75,6 +75,16 @@ return [
"Access to create, update, and delete project\'s templates",
"category" => "Project",
],
"stages.read" => [
"description" =>
"Access to read project\'s stages",
"category" => "Project",
],
"stages.write" => [
"description" =>
"Access to update project\'s stages",
"category" => "Project",
],
"oauth2.read" => [
"description" =>
"Access to read project\'s OAuth2 configuration",
-18
View File
@@ -95,24 +95,6 @@ return [
'gitBranch' => 'dev',
'changelog' => \realpath(__DIR__ . '/../../docs/sdks/apple/CHANGELOG.md'),
],
[
'key' => 'objective-c',
'name' => 'Objective C',
'url' => '',
'package' => '',
'enabled' => false,
'beta' => false,
'dev' => false,
'hidden' => false,
'family' => APP_SDK_PLATFORM_CLIENT,
'prism' => '',
'source' => false,
'gitUrl' => 'git@github.com:appwrite/sdk-for-objective-c.git',
'gitRepoName' => 'sdk-for-objective-c',
'gitUserName' => 'appwrite',
'gitBranch' => 'dev',
'changelog' => \realpath(__DIR__ . '/../../docs/sdks/objective-c/CHANGELOG.md'),
],
[
'key' => 'android',
'name' => 'Android',
+9
View File
@@ -1070,6 +1070,15 @@ return [
'question' => '',
'filter' => ''
],
[
'name' => '_APP_OPEN_RUNTIMES_NFT',
'description' => 'Enables dependency tracing for Open Runtimes build artifacts. When enabled, supported SSR site builds prune unused node_modules files before packaging the build output.',
'introduction' => '1.9.0',
'default' => 'enabled',
'required' => false,
'question' => '',
'filter' => ''
],
[
'name' => '_APP_DOCKER_HUB_USERNAME',
'description' => 'The username for hub.docker.com. This variable is used to pull images from hub.docker.com.',
+2
View File
@@ -64,6 +64,8 @@ Http::patch('/v1/projects/:projectId/oauth2')
]));
});
$dbForPlatform->purgeCachedDocument('projects', $project->getId());
$response->dynamic($project, Response::MODEL_PROJECT);
});
+1 -1
View File
@@ -988,7 +988,7 @@ Http::init()
* @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers
*/
Http::init()
->groups(['api', 'web'])
->groups(['api', 'web', 'graphql'])
->inject('request')
->inject('response')
->inject('cors')
+116 -46
View File
@@ -18,11 +18,13 @@ use Appwrite\Extend\Exception as AppwriteException;
use Appwrite\Functions\EventProcessor;
use Appwrite\Platform\Modules\Storage\Config\CacheControl;
use Appwrite\Platform\Modules\Storage\Config\StorageCacheControl;
use Appwrite\Reference\Renderer;
use Appwrite\SDK\Method;
use Appwrite\Usage\Context;
use Appwrite\Utopia\Database\Documents\User;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use Throwable;
use Utopia\Abuse\Abuse;
use Utopia\Bus\Bus;
use Utopia\Cache\Adapter\Filesystem;
@@ -43,47 +45,6 @@ use Utopia\System\System;
use Utopia\Telemetry\Adapter as Telemetry;
use Utopia\Validator\WhiteList;
$parseLabel = function (string $label, array $responsePayload, array $requestParams, User $user, Document $project) {
preg_match_all('/{(.*?)}/', $label, $matches);
foreach ($matches[1] as $pos => $match) {
$find = $matches[0][$pos];
$parts = explode('.', $match);
if (count($parts) !== 2) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, "The server encountered an error while parsing the label: $label. Please create an issue on GitHub to allow us to investigate further https://github.com/appwrite/appwrite/issues/new/choose");
}
$namespace = $parts[0];
$replace = $parts[1];
$params = match ($namespace) {
'user' => (array) $user,
'project' => $project->getArrayCopy(),
'request' => $requestParams,
default => $responsePayload,
};
if (array_key_exists($replace, $params)) {
$replacement = $params[$replace];
// Convert to string if it's not already a string
if (! is_string($replacement)) {
if (is_array($replacement)) {
$replacement = json_encode($replacement);
} elseif (is_object($replacement) && method_exists($replacement, '__toString')) {
$replacement = (string) $replacement;
} elseif (is_scalar($replacement)) {
$replacement = (string) $replacement;
} else {
throw new Exception(Exception::GENERAL_SERVER_ERROR, "The server encountered an error while parsing the label: $label. Please create an issue on GitHub to allow us to investigate further https://github.com/appwrite/appwrite/issues/new/choose");
}
}
$label = \str_replace($find, $replacement, $label);
}
}
return $label;
};
Http::init()
->groups(['api'])
->inject('route')
@@ -264,6 +225,13 @@ Http::init()
API_KEY_ACCOUNT => ACTOR_TYPE_KEY_ACCOUNT,
default => ACTOR_TYPE_KEY_ORGANIZATION,
});
if ($apiKey->getType() === API_KEY_STANDARD || $apiKey->getType() === API_KEY_ORGANIZATION) {
$userClone
->setAttribute('$id', $dbKey->getId())
->setAttribute('$sequence', $dbKey->getSequence());
}
$auditContext->user = $userClone;
}
@@ -934,12 +902,18 @@ Http::shutdown()
->inject('auditContext')
->inject('publisherForAudits')
->inject('mode')
->action(function (Route $route, array $params, Request $request, Response $response, Document $project, User $user, User $targetUser, AuditContext $auditContext, Audit $publisherForAudits, string $mode) use ($parseLabel) {
->action(function (Route $route, array $params, Request $request, Response $response, Document $project, User $user, User $targetUser, AuditContext $auditContext, Audit $publisherForAudits, string $mode) {
$responsePayload = $response->getPayload();
$pattern = $route->getLabel('audits.resource', null);
if (! empty($pattern)) {
$resource = $parseLabel($pattern, $responsePayload, $params, $targetUser, $project);
$renderer = new Renderer(new Document([
'user' => (array) $targetUser,
'project' => $project,
'request' => $params,
'response' => $responsePayload,
]));
$resource = $renderer->render($pattern);
if (! empty($resource) && $resource !== $pattern) {
$auditContext->resource = $resource;
}
@@ -998,7 +972,7 @@ Http::shutdown()
->inject('user')
->inject('dbForProject')
->inject('authorization')
->action(function (Route $route, array $params, Request $request, Response $response, Document $project, User $user, Database $dbForProject, Authorization $authorization) use ($parseLabel) {
->action(function (Route $route, array $params, Request $request, Response $response, Document $project, User $user, Database $dbForProject, Authorization $authorization) {
if (! $route->getLabel('cache', false)) {
return;
}
@@ -1028,11 +1002,18 @@ Http::shutdown()
$resourcePattern = $route->getLabel('cache.resource', null);
$resourceTypePattern = $route->getLabel('cache.resourceType', null);
$renderer = new Renderer(new Document([
'user' => (array) $user,
'project' => $project,
'request' => $requestParams,
'response' => $data,
]));
try {
$authorization->skip(fn () => $dbForProject->createDocument('cache', new Document([
'$id' => $key,
'resource' => empty($resourcePattern) ? null : $parseLabel($resourcePattern, $data, $requestParams, $user, $project),
'resourceType' => empty($resourceTypePattern) ? null : $parseLabel($resourceTypePattern, $data, $requestParams, $user, $project),
'resource' => empty($resourcePattern) ? null : $renderer->render($resourcePattern),
'resourceType' => empty($resourceTypePattern) ? null : $renderer->render($resourceTypePattern),
'mimeType' => $response->getContentType(),
'accessedAt' => $now,
'signature' => $signature,
@@ -1112,6 +1093,95 @@ Http::shutdown()
}
});
Http::shutdown()
->groups(['api'])
->inject('route')
->inject('response')
->inject('project')
->inject('user')
->inject('dbForPlatform')
->inject('authorization')
->inject('apiKey')
->inject('mode')
->action(function (Route $route, Response $response, Document $project, User $user, Database $dbForPlatform, Authorization $authorization, ?Key $apiKey, string $mode) {
/**
* Persist completed onboarding stage after usage shutdown so a schema/write failure here
* cannot suppress RequestCompleted or usage metrics on the same request.
*/
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode >= 300 || $project->getId() === 'console') {
return;
}
$sdkLabel = $route->getLabel('sdk', false);
if ($sdkLabel === false || $sdkLabel === null) {
return;
}
/** @var array<string, true> $onboarding */
$onboarding = Config::getParam('onboarding', []);
if ($onboarding === []) {
return;
}
$method = null;
if ($sdkLabel instanceof Method) {
$key = $sdkLabel->getNamespace() . '.' . $sdkLabel->getMethodName();
if (isset($onboarding[$key])) {
$method = $key;
}
} elseif (\is_array($sdkLabel)) {
foreach ($sdkLabel as $sdkMethod) {
if (! $sdkMethod instanceof Method) {
continue;
}
$key = $sdkMethod->getNamespace() . '.' . $sdkMethod->getMethodName();
if (isset($onboarding[$key])) {
$method = $key;
break;
}
}
}
if ($method === null) {
return;
}
$byMethod = $project->getAttribute('onboarding', []);
$status = \is_array($byMethod) ? ($byMethod[$method]['status'] ?? null) : null;
if ($status === ONBOARDING_STATUS_COMPLETED || $status === ONBOARDING_STATUS_SKIPPED) {
return;
}
if (! \is_array($byMethod)) {
$byMethod = [];
}
$actorType = ($apiKey !== null && $apiKey->getRole() === User::ROLE_KEYS)
? match ($apiKey->getType()) {
API_KEY_ACCOUNT => ACTOR_TYPE_KEY_ACCOUNT,
API_KEY_ORGANIZATION => ACTOR_TYPE_KEY_ORGANIZATION,
API_KEY_STANDARD, API_KEY_EPHEMERAL => ACTOR_TYPE_KEY_PROJECT,
default => ACTOR_TYPE_KEY_PROJECT,
}
: (! $user->isEmpty()
? ($mode === APP_MODE_ADMIN ? ACTOR_TYPE_ADMIN : ACTOR_TYPE_USER)
: ACTOR_TYPE_GUEST);
$byMethod[$method] = [
'status' => ONBOARDING_STATUS_COMPLETED,
'at' => DateTime::now(),
'actorType' => $actorType,
];
try {
$authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([
'onboarding' => $byMethod,
])));
} catch (Throwable) {
// Missing `onboarding` attribute on upgraded installs must not break the request lifecycle.
}
});
Http::init()
->groups(['usage'])
->action(function () {
+1
View File
@@ -26,6 +26,7 @@ Config::load('projectScopes', __DIR__ . '/../config/scopes/project.php', $config
Config::load('organizationScopes', __DIR__ . '/../config/scopes/organization.php', $configAdapter);
Config::load('accountScopes', __DIR__ . '/../config/scopes/account.php', $configAdapter);
Config::load('services', __DIR__ . '/../config/services.php', $configAdapter); // List of services
Config::load('onboarding', __DIR__ . '/../config/onboarding.php', $configAdapter); // Project onboarding stages → routes
Config::load('variables', __DIR__ . '/../config/variables.php', $configAdapter); // List of env variables
Config::load('regions', __DIR__ . '/../config/regions.php', $configAdapter); // List of available regions
Config::load('avatar-browsers', __DIR__ . '/../config/avatars/browsers.php', $configAdapter);
+6
View File
@@ -172,6 +172,12 @@ const ACTOR_TYPE_KEY_PROJECT = 'keyProject';
const ACTOR_TYPE_KEY_ACCOUNT = 'keyAccount';
const ACTOR_TYPE_KEY_ORGANIZATION = 'keyOrganization';
/**
* Project onboarding stage status (stored per SDK method key under project.onboarding JSON).
*/
const ONBOARDING_STATUS_COMPLETED = 'completed';
const ONBOARDING_STATUS_SKIPPED = 'skipped';
/**
* MFA
*/
+3
View File
@@ -195,6 +195,7 @@ use Appwrite\Utopia\Response\Model\Schedule;
use Appwrite\Utopia\Response\Model\Session;
use Appwrite\Utopia\Response\Model\Site;
use Appwrite\Utopia\Response\Model\Specification;
use Appwrite\Utopia\Response\Model\Stage;
use Appwrite\Utopia\Response\Model\Subscriber;
use Appwrite\Utopia\Response\Model\Table;
use Appwrite\Utopia\Response\Model\Target;
@@ -285,6 +286,7 @@ Response::setModel(new BaseList('Email Templates List', Response::MODEL_EMAIL_TE
Response::setModel(new BaseList('Status List', Response::MODEL_HEALTH_STATUS_LIST, 'statuses', Response::MODEL_HEALTH_STATUS));
Response::setModel(new BaseList('Rule List', Response::MODEL_PROXY_RULE_LIST, 'rules', Response::MODEL_PROXY_RULE));
Response::setModel(new BaseList('Schedules List', Response::MODEL_SCHEDULE_LIST, 'schedules', Response::MODEL_SCHEDULE));
Response::setModel(new BaseList('Stages List', Response::MODEL_STAGE_LIST, 'stages', Response::MODEL_STAGE, false, false));
Response::setModel(new BaseList('Locale codes list', Response::MODEL_LOCALE_CODE_LIST, 'localeCodes', Response::MODEL_LOCALE_CODE));
Response::setModel(new BaseList('Provider list', Response::MODEL_PROVIDER_LIST, 'providers', Response::MODEL_PROVIDER));
Response::setModel(new BaseList('Message list', Response::MODEL_MESSAGE_LIST, 'messages', Response::MODEL_MESSAGE));
@@ -507,6 +509,7 @@ Response::setModel(new Headers());
Response::setModel(new Specification());
Response::setModel(new Rule());
Response::setModel(new Schedule());
Response::setModel(new Stage());
Response::setModel(new TemplateEmail());
Response::setModel(new ConsoleVariables());
Response::setModel(new ConsoleOAuth2ProviderParameter());
File diff suppressed because it is too large. Load diff
Generated
+6 -6
View File
@@ -5124,16 +5124,16 @@
},
{
"name": "utopia-php/vcs",
"version": "4.2.3",
"version": "4.2.4",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/vcs.git",
"reference": "598cbd2793a5a6394493f1046743e75ec6544a57"
"reference": "f19c61daa1e9594734d85ae25b3e90ba2b350d33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/vcs/zipball/598cbd2793a5a6394493f1046743e75ec6544a57",
"reference": "598cbd2793a5a6394493f1046743e75ec6544a57",
"url": "https://api.github.com/repos/utopia-php/vcs/zipball/f19c61daa1e9594734d85ae25b3e90ba2b350d33",
"reference": "f19c61daa1e9594734d85ae25b3e90ba2b350d33",
"shasum": ""
},
"require": {
@@ -5167,9 +5167,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/vcs/issues",
"source": "https://github.com/utopia-php/vcs/tree/4.2.3"
"source": "https://github.com/utopia-php/vcs/tree/4.2.4"
},
"time": "2026-06-16T12:14:08+00:00"
"time": "2026-06-25T13:27:19+00:00"
},
{
"name": "utopia-php/websocket",
+458 -39
View File
@@ -1,24 +1,400 @@
# Dev tools for local development only.
# This file is automatically loaded by `docker compose` alongside docker-compose.yml.
# CI sets COMPOSE_FILE=docker-compose.yml explicitly, so these services are excluded from test runs.
services:
appwrite:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./docker-compose.yml:/usr/src/code/docker-compose.yml
- ./.env:/usr/src/code/.env
- ./phpunit.xml:/usr/src/code/phpunit.xml
- ./tests:/usr/src/code/tests
- ./app:/usr/src/code/app
- ./docs:/usr/src/code/docs
- ./public:/usr/src/code/public
- ./src:/usr/src/code/src
- ./dev:/usr/src/code/dev
depends_on:
- coredns
ports:
- 9501:80
dns:
- 127.0.0.11
- 172.16.238.100
entrypoint:
- php
- -e
- app/http.php
environment:
- _APP_MESSAGE_SMS_TEST_DSN
- _APP_MESSAGE_EMAIL_TEST_DSN
- _APP_MESSAGE_PUSH_TEST_DSN
- _TESTS_OAUTH2_GITHUB_CLIENT_ID
- _TESTS_OAUTH2_GITHUB_CLIENT_SECRET
appwrite-realtime:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
ports:
- 9502:80
appwrite-worker-audits:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-webhooks:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
depends_on:
- request-catcher-sms
- request-catcher-webhook
appwrite-worker-deletes:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-databases:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-builds:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-screenshots:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-certificates:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-executions:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-functions:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-mails:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
depends_on:
- maildev
appwrite-worker-notifications:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
depends_on:
- maildev
appwrite-worker-messaging:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-migrations:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
- ./tests:/usr/src/code/tests
appwrite-task-maintenance:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-task-interval:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-task-stats-resources:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-stats-resources:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-worker-stats-usage:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-task-scheduler-functions:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-task-scheduler-executions:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
appwrite-task-scheduler-messages:
build:
context: .
target: development
args:
DEBUG: false
TESTING: true
VERSION: dev
image: appwrite-dev
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
coredns:
image: coredns/coredns:1.12.4
container_name: appwrite-coredns
restart: unless-stopped
logging:
driver: json-file
options:
max-file: "5"
max-size: 10m
command:
- -conf
- /mnt/resources/Corefile
networks:
appwrite:
ipv4_address: 172.16.238.100
volumes:
- ./tests/resources/coredns:/mnt/resources:ro
maildev:
image: appwrite/mailcatcher:1.1.1
container_name: appwrite-mailcatcher
logging:
driver: json-file
options:
max-file: "5"
max-size: 10m
ports:
- 9503:1080
networks:
- appwrite
- gateway
labels:
- traefik.enable=true
- traefik.constraint-label-stack=appwrite
- traefik.docker.network=gateway
- traefik.http.services.appwrite_maildev.loadbalancer.server.port=1080
- traefik.http.routers.appwrite_maildev_http.entrypoints=appwrite_web
- traefik.http.routers.appwrite_maildev_http.rule=Host(`mail.localhost`)
- traefik.http.routers.appwrite_maildev_http.service=appwrite_maildev
- traefik.http.routers.appwrite_maildev_https.entrypoints=appwrite_websecure
- traefik.http.routers.appwrite_maildev_https.rule=Host(`mail.localhost`)
- traefik.http.routers.appwrite_maildev_https.service=appwrite_maildev
- traefik.http.routers.appwrite_maildev_https.tls=true
environment:
- MAILDEV_INCOMING_USER=${_APP_SMTP_USERNAME}
- MAILDEV_INCOMING_PASS=${_APP_SMTP_PASSWORD}
request-catcher-webhook:
image: appwrite/requestcatcher:1.1.0
container_name: appwrite-requestcatcher-webhook
logging:
driver: json-file
options:
max-file: "5"
max-size: 10m
ports:
- 9504:5000
networks:
- appwrite
request-catcher-sms:
image: appwrite/requestcatcher:1.1.0
container_name: appwrite-requestcatcher-sms
logging:
driver: json-file
options:
max-file: "5"
max-size: 10m
ports:
- 9507:5000
networks:
- appwrite
appwrite-mongo-express:
profiles: ["mongodb"]
profiles:
- mongodb
image: mongo-express
container_name: appwrite-mongo-express
networks:
- appwrite
ports:
- "8082:8081"
- "9508:8081"
environment:
ME_CONFIG_MONGODB_URL: "mongodb://root:${_APP_DB_ROOT_PASS}@appwrite-mongodb:27017/?replicaSet=rs0&directConnection=true"
ME_CONFIG_MONGODB_URL: mongodb://root:${_APP_DB_ROOT_PASS}@appwrite-mongodb:27017/?replicaSet=rs0&directConnection=true
ME_CONFIG_BASICAUTH_USERNAME: ${_APP_DB_USER}
ME_CONFIG_BASICAUTH_PASSWORD: ${_APP_DB_PASS}
depends_on:
mongodb:
condition: service_healthy
adminer:
image: adminer
container_name: appwrite-adminer
@@ -37,20 +413,19 @@ services:
configs:
- source: adminer-index.php
target: /var/www/html/index.php
mode: 0755
mode: 493
labels:
- "traefik.enable=true"
- "traefik.constraint-label-stack=appwrite"
- "traefik.docker.network=gateway"
- "traefik.http.services.appwrite_adminer.loadbalancer.server.port=8080"
- "traefik.http.routers.appwrite_adminer_http.entrypoints=appwrite_web"
- "traefik.http.routers.appwrite_adminer_http.rule=Host(`mysql.localhost`)"
- "traefik.http.routers.appwrite_adminer_http.service=appwrite_adminer"
- "traefik.http.routers.appwrite_adminer_https.entrypoints=appwrite_websecure"
- "traefik.http.routers.appwrite_adminer_https.rule=Host(`mysql.localhost`)"
- "traefik.http.routers.appwrite_adminer_https.service=appwrite_adminer"
- "traefik.http.routers.appwrite_adminer_https.tls=true"
- traefik.enable=true
- traefik.constraint-label-stack=appwrite
- traefik.docker.network=gateway
- traefik.http.services.appwrite_adminer.loadbalancer.server.port=8080
- traefik.http.routers.appwrite_adminer_http.entrypoints=appwrite_web
- traefik.http.routers.appwrite_adminer_http.rule=Host(`mysql.localhost`)
- traefik.http.routers.appwrite_adminer_http.service=appwrite_adminer
- traefik.http.routers.appwrite_adminer_https.entrypoints=appwrite_websecure
- traefik.http.routers.appwrite_adminer_https.rule=Host(`mysql.localhost`)
- traefik.http.routers.appwrite_adminer_https.service=appwrite_adminer
- traefik.http.routers.appwrite_adminer_https.tls=true
redis-insight:
image: redis/redisinsight:latest
restart: unless-stopped
@@ -62,22 +437,21 @@ services:
configs:
- source: redisinsight-connections.json
target: /mnt/connections.json
mode: 0755
mode: 493
labels:
- "traefik.enable=true"
- "traefik.constraint-label-stack=appwrite"
- "traefik.docker.network=gateway"
- "traefik.http.services.appwrite_redisinsight.loadbalancer.server.port=5540"
- "traefik.http.routers.appwrite_redisinsight_http.entrypoints=appwrite_web"
- "traefik.http.routers.appwrite_redisinsight_http.rule=Host(`redis.localhost`)"
- "traefik.http.routers.appwrite_redisinsight_http.service=appwrite_redisinsight"
- "traefik.http.routers.appwrite_redisinsight_https.entrypoints=appwrite_websecure"
- "traefik.http.routers.appwrite_redisinsight_https.rule=Host(`redis.localhost`)"
- "traefik.http.routers.appwrite_redisinsight_https.service=appwrite_redisinsight"
- "traefik.http.routers.appwrite_redisinsight_https.tls=true"
- traefik.enable=true
- traefik.constraint-label-stack=appwrite
- traefik.docker.network=gateway
- traefik.http.services.appwrite_redisinsight.loadbalancer.server.port=5540
- traefik.http.routers.appwrite_redisinsight_http.entrypoints=appwrite_web
- traefik.http.routers.appwrite_redisinsight_http.rule=Host(`redis.localhost`)
- traefik.http.routers.appwrite_redisinsight_http.service=appwrite_redisinsight
- traefik.http.routers.appwrite_redisinsight_https.entrypoints=appwrite_websecure
- traefik.http.routers.appwrite_redisinsight_https.rule=Host(`redis.localhost`)
- traefik.http.routers.appwrite_redisinsight_https.service=appwrite_redisinsight
- traefik.http.routers.appwrite_redisinsight_https.tls=true
ports:
- "8081:5540"
- "9514:5540"
graphql-explorer:
container_name: appwrite-graphql-explorer
image: appwrite/altair:0.3.0
@@ -85,10 +459,51 @@ services:
networks:
- appwrite
ports:
- "9509:3000"
- 9509:3000
environment:
- SERVER_URL=http://localhost/v1/graphql
- SERVER_URL=http://localhost:9520/v1/graphql
traefik:
command:
- --providers.file.directory=/storage/config
- --providers.file.watch=true
- --providers.docker=true
- --providers.docker.exposedByDefault=false
- --providers.docker.constraints=Label(`traefik.constraint-label-stack`,`appwrite`)
- --entrypoints.appwrite_web.address=:80
- --entrypoints.appwrite_websecure.address=:443
- --log.level=DEBUG
- --api.insecure=true
- --accesslog=true
ports:
- 9520:80
- 9522:80
- 9521:443
- 9500:8080
networks:
appwrite:
aliases:
- appwrite.test
gateway:
aliases:
- appwrite.test
runtimes:
aliases:
- appwrite.test
mariadb:
ports:
- "9510:3306"
mongodb:
ports:
- "9511:27017"
postgresql:
ports:
- "9512:5432"
redis:
ports:
- "9513:6379"
appwrite-embedding:
ports:
- "9505:3000"
configs:
redisinsight-connections.json:
content: |
@@ -129,7 +544,6 @@ configs:
"tags": []
}
]
adminer-index.php:
content: |
<?php
@@ -143,3 +557,8 @@ configs:
];
}
include './adminer.php';
networks:
appwrite:
ipam:
config:
- subnet: 172.16.238.0/24
+251 -366
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
Get the onboarding stages for the current project, including each stage’s SDK method key and status (for example pending, completed, or skipped).
+1
View File
@@ -0,0 +1 @@
Update an onboarding stage for the current project. Use this endpoint to skip a stage or leave it unchanged without performing the related API action.
+2 -2
View File
@@ -9,7 +9,7 @@ $ appwrite login
? Enter your password ********
✓ Success
```
This will also prompt you to enter your Appwrite endpoint ( default: http://localhost/v1 )
This will also prompt you to enter your Appwrite endpoint ( default: http://localhost:9520/v1 )
* ### Initialising your project
Once logged in, the CLI needs to be initialised before you can use it with your Appwrite project. You can do this with the `appwrite init project` command.
@@ -139,5 +139,5 @@ $ appwrite client --reset
The Appwrite CLI can also work in a CI environment. The initialisation of the CLI works a bit differently in CI. In CI, you set your `endpoint`, `projectId` and `API Key` using
```sh
appwrite client --endpoint http://localhost/v1 --projectId <PROJECT_ID> --key <API KEY>
appwrite client --endpoint http://localhost:9520/v1 --projectId <PROJECT_ID> --key <API KEY>
```
-29
View File
@@ -1,29 +0,0 @@
# Change Log
## 16.0.0
* Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`).
* Breaking change: `Output` enum has been removed; use `ImageFormat` instead.
* Add `getQueueAudits` support to `Health` service.
* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services.
## 15.1.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `gif` support to `ImageFormat` enum
* Add `dart38` and `flutter332` support to runtime models
* Add `encrypt` support to `StringAttribute` model
* Add `sequence` support to `Document` model
* Add `upsertDocument` support to `Databases` service
## 15.0.0
* Add `<REGION>` to doc examples due to the new multi region endpoints
* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc.
* Add doc examples, class and methods for new `Sites` service
* Add doc examples, class and methods for new `Tokens` service
* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType`
* Updates enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329
* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage
* Add `queries` and `search` params to `listMemberships` method
* Removes `search` param from `listExecutions` method
-68
View File
@@ -1,68 +0,0 @@
## Getting Started
### Init your SDK
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
```typescript
let client = new sdk.Client();
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
;
```
### Make your first request
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
```typescript
let users = new sdk.Users(client);
let user = await users.create(ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien");
console.log(user);
```
### Full Example
```typescript
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
let client = new sdk.Client();
let users = new sdk.Users(client);
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
;
let user = await users.create(ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien");
console.log(user);
```
### Error Handling
The Appwrite Deno SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
```typescript
let users = new sdk.Users(client);
try {
let user = await users.create(ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien");
} catch(e) {
console.log(e.message);
}
```
### Learn more
You can use the following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
- 📜 [Appwrite Docs](https://appwrite.io/docs)
- 💬 [Discord Community](https://appwrite.io/discord)
- 🚂 [Appwrite Deno Playground](https://github.com/appwrite/playground-for-deno)
-66
View File
@@ -1,66 +0,0 @@
## 0.3.2
- Fixed package namespaces
- Breaking change: `Output` enum has been removed; use `ImageFormat` instead.
- Add `Channel` helpers for Realtime.
## 0.3.1
- Downgraded meta package version to 1.1.8
## 0.3.0
- Updated package dependencies (@lohanidamodar)
- Added Flutter for Web compatibility (@lohanidamodar)
## 0.2.3
- Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie
## 0.2.2
- Fixed an error that happened when the OAuth session creation request was sent before any other API call
- Fixed a bug in the Avatars service where location URL generation had syntax error
## 0.2.1
- Fixed callback scheme
## 0.2.0
- Updated flutter_web_auth plugin to version 0.2.4
- Added per project unique callback for OAuth2 redirects to avoid conflicts between multiple Appwrite projects
## 0.1.1
- Updated flutter_web_auth version
## 0.1.0
- Added examples file
- Some minor style fixes
## 0.0.14
- Using MultipartFile for file uploads
## 0.0.13
- Fix for file upload method
## 0.0.12
- Added file upload support for storage service
## 0.0.11
- Added integration with web auth plugin to support Appwrite OAuth API
## 0.0.9
- Updated default params
## 0.0.8
- Fixed compilation error in Client class
- Shorter description for package
-63
View File
@@ -1,63 +0,0 @@
# Examples
Init your Appwrite client:
```dart
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
```
Create a new user and session:
```dart
Account account = Account(client);
final user = await account.create(userId: ID.unique(), email: "email@example.com", password: "password", name: "Walter O'Brien");
final session = await account.createEmailSession(email: 'me@appwrite.io', password: 'password');
```
Fetch user profile:
```dart
Account account = Account(client);
final profile = await account.get();
```
Upload File:
```dart
Storage storage = Storage(client);
late InputFile file;
if(kIsWeb) {
file = InputFile(bytes: pickedFile.bytes, filename: 'image.jpg');
} else {
file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg');
}
storage.createFile(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID
file: file,
permissions: [
Permission.read(Role.any()),
],
)
.then((response) {
print(response); // File uploaded!
})
.catchError((error) {
print(error.response);
});
```
All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs)
+1 -1
View File
@@ -6,7 +6,7 @@ Init your Appwrite client:
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setEndpoint('https://localhost:9521/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
-1
View File
@@ -1 +0,0 @@
# Change Log
+2 -2
View File
@@ -34,7 +34,7 @@ import { Client } from 'react-native-appwrite';
const client = new Client();
client
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
.setEndpoint('http://localhost:9520/v1') // Your Appwrite Endpoint
.setProject('455x34dfkj') // Your project ID
.setPlatform('com.example.myappwriteapp') // Your application ID or bundle ID.
;
@@ -65,7 +65,7 @@ import { Client, Account } from 'react-native-appwrite';
const client = new Client();
client
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
.setEndpoint('http://localhost:9520/v1') // Your Appwrite Endpoint
.setProject('455x34dfkj')
.setPlatform('com.example.myappwriteapp') // YOUR application ID
;
+2 -2
View File
@@ -15,7 +15,7 @@ Initialize your SDK with your Appwrite server API endpoint and project ID which
const client = new Client();
client
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
.setEndpoint('http://localhost:9520/v1') // Your Appwrite Endpoint
.setProject('455x34dfkj') // Your project ID
;
```
@@ -44,7 +44,7 @@ account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien")
const client = new Client();
client
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
.setEndpoint('http://localhost:9520/v1') // Your Appwrite Endpoint
.setProject('455x34dfkj')
;
+3 -3
View File
@@ -24,11 +24,11 @@ This information is also used to generate the website documentation at https://a
If the newly introduced environment variable has a default value, add it to the `.env` and `Dockerfile` along with other environment variables. `.env` file uses settings for Appwrite development environment.
### Add to Docker Compose file and template
### Add to Docker Compose file
Add the new environment variables to the `docker-compose.yml` and `app/views/install/compose.phtml` for each docker service that requires access to those environment variables.
Add the new environment variables to `docker-compose.yml` for each Docker service that requires access to those environment variables.
The `docker-compose.yml` file is used by the Appwrite maintainers during development, whereas the `app/views/install/compose.phtml` file is used by the Appwrite setup script.
The setup script generates the install compose file from `docker-compose.yml`, so changes should be made in the base compose file instead of a separate template. Run `npm run format:compose` after editing compose files.
With these steps, your environment variable is properly added and can be accessed inside Appwrite code and any other containers where it is passed. You can access and use those variables to implement the features you are trying to achieve.
+2 -2
View File
@@ -149,13 +149,13 @@ First of all, we need to start a local instance of Appwrite. Thanks to Docker, t
docker compose up -d
```
If this is your first time running Appwrite, it may take up to a few minutes to download all images and start all containers. Once everything is started, you should see Appwrite running on `http://localhost:80`. When you visit this URL, it will ask you to sign up. After that, it will show you your empty dashboard where you need to create a new project - give it any name you want. Then you need to go to `Settings` of the project and copy `Project-ID`.
If this is your first time running Appwrite, it may take up to a few minutes to download all images and start all containers. Once everything is started, you should see Appwrite running on `http://localhost:9520`. When you visit this URL, it will ask you to sign up. After that, it will show you your empty dashboard where you need to create a new project - give it any name you want. Then you need to go to `Settings` of the project and copy `Project-ID`.
If you are lost in the Appwrite dashboard, check out our [Article about Appwrite's dashboard](https://dev.to/appwrite/30daysofappwrite-appwrite-dashboard-15cc).
Now, let's send the request. We will be editing headers of the request, so you will need a tool to do that, such as Postman or Insomnia.
First, let's see English translations. Let's set request type to `GET`, URL to `https://localhost/v1/locale/countries/eu` and add `X-Appwrite-Project` header.
First, let's see English translations. Let's set request type to `GET`, URL to `https://localhost:9521/v1/locale/countries/eu` and add `X-Appwrite-Project` header.
![English test](images/test-en.png)
+20 -1
View File
@@ -4,7 +4,26 @@
"requires": true,
"packages": {
"": {
"name": "@appwrite.io/repo"
"name": "@appwrite.io/repo",
"devDependencies": {
"prettier": "^3.9.0"
}
},
"node_modules/prettier": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.0.tgz",
"integrity": "sha512-LjIqSIC5VYLzs9WedVmJ2ljNAGnU+DteIClbahu4L/DBeWjZ6iT/k1lAYyu9JUh+1xINxWadaPw/Pl63y/agAw==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
}
}
}
+8 -1
View File
@@ -5,8 +5,15 @@
"type": "git",
"url": "git+https://github.com/appwrite/appwrite.git"
},
"scripts": {
"format:compose": "prettier --write docker-compose.yml docker-compose.override.yml",
"lint:compose": "prettier --check docker-compose.yml docker-compose.override.yml"
},
"files": [
"docs/examples",
"app/config/specs"
]
],
"devDependencies": {
"prettier": "^3.9.0"
}
}
+290
View File
@@ -0,0 +1,290 @@
<?php
namespace Appwrite\Docker\Compose;
use Exception;
class Generator
{
private const array SELECTABLE_SERVICE_GROUPS = [
'database' => [
'default' => 'mongodb',
'services' => [
'mariadb',
'mongodb',
'postgresql',
],
],
];
private const array SELECTABLE_VOLUME_GROUPS = [
'database' => [
'mariadb' => ['appwrite-mariadb'],
'mongodb' => ['appwrite-mongodb', 'appwrite-mongodb-keyfile'],
'postgresql' => ['appwrite-postgresql'],
],
];
private const array OPTIONAL_SERVICES = [
'enableAssistant' => 'appwrite-assistant',
];
private const array LOCAL_VOLUME_PREPENDS = [
'appwrite' => [
'param' => 'hostPath',
'volume' => '{hostPath}:/usr/src/code:rw',
],
];
private const array PARAM_DEFAULTS = [
'version' => 'latest',
'database' => 'mongodb',
'hostPath' => '',
'enableAssistant' => false,
];
private const array DEPENDENCY_SELECTORS = [
'database' => [
'param' => 'database',
'condition' => [
'condition' => 'service_healthy',
],
'placeholders' => [
'${_APP_DB_HOST:-mongodb}',
'${_APP_DB_HOST:-mariadb}',
],
],
];
private const array YAML_DOCUMENT_MARKER_PATTERNS = [
'/^---\R/',
'/\R\\.\\.\\.\R?$/',
];
/**
* @var array<string, mixed>
*/
private array $compose;
/**
* @var array<string, mixed>
*/
private array $params = [];
private array $selectableServices = [
'mariadb',
'mongodb',
'postgresql',
];
public function __construct(string $compose)
{
$parsed = \yaml_parse($compose);
if (!\is_array($parsed)) {
throw new Exception('Failed to parse Docker Compose file');
}
$this->compose = $parsed;
}
/**
* @param array<string, mixed> $params
*/
public function render(array $params): string
{
$compose = $this->compose;
$this->params = $this->normalizeParams($params);
$this->selectableServices = $this->getSelectableServices();
$compose['services'] = $this->filterServices($compose['services'] ?? []);
$compose['volumes'] = $this->filterVolumes($compose['volumes'] ?? []);
foreach ($compose['services'] as $name => &$service) {
if (!\is_array($service)) {
continue;
}
$this->rewriteDependencies($service);
$this->rewriteLocalVolumes($name, $service);
}
unset($service);
return $this->emit($compose);
}
/**
* @param array<string, mixed> $params
* @return array<string, mixed>
*/
private function normalizeParams(array $params): array
{
$params = \array_merge(self::PARAM_DEFAULTS, $params);
foreach (self::SELECTABLE_SERVICE_GROUPS as $param => $config) {
if (!\in_array($params[$param], $config['services'], true)) {
$params[$param] = $config['default'];
}
}
$params['hostPath'] = \rtrim((string)$params['hostPath'], '/');
return $params;
}
/**
* @return string[]
*/
private function getSelectableServices(): array
{
$services = [];
foreach (self::SELECTABLE_SERVICE_GROUPS as $config) {
$services = \array_merge($services, $config['services']);
}
return \array_values(\array_unique($services));
}
/**
* @param array<string, mixed> $services
* @return array<string, mixed>
*/
private function filterServices(array $services): array
{
foreach (self::SELECTABLE_SERVICE_GROUPS as $param => $config) {
foreach ($config['services'] as $service) {
if ($service !== $this->params[$param]) {
unset($services[$service]);
}
}
}
foreach (self::OPTIONAL_SERVICES as $param => $service) {
if (empty($this->params[$param])) {
unset($services[$service]);
}
}
return $services;
}
/**
* @param array<string, mixed> $volumes
* @return array<string, mixed>
*/
private function filterVolumes(array $volumes): array
{
foreach (self::SELECTABLE_VOLUME_GROUPS as $param => $groups) {
foreach ($groups as $service => $names) {
if ($service === $this->params[$param]) {
continue;
}
foreach ($names as $name) {
unset($volumes[$name]);
}
}
}
return $volumes;
}
/**
* @param array<string, mixed> $service
*/
private function rewriteDependencies(array &$service): void
{
if (!isset($service['depends_on'])) {
return;
}
foreach (self::DEPENDENCY_SELECTORS as $selector) {
$selected = $this->params[$selector['param']];
$removable = [
...$this->selectableServices,
...$selector['placeholders'],
];
if (\array_is_list($service['depends_on'])) {
$hasSelectedDependency = false;
$dependsOn = \array_values(\array_filter(
$service['depends_on'],
function (mixed $dependency) use ($removable, &$hasSelectedDependency): bool {
if (!\in_array($dependency, $removable, true)) {
return true;
}
$hasSelectedDependency = true;
return false;
}
));
if ($hasSelectedDependency && !\in_array($selected, $dependsOn, true)) {
$dependsOn[] = $selected;
}
$service['depends_on'] = $dependsOn;
continue;
}
$hasSelectedDependency = false;
foreach ($removable as $dependency) {
if (\array_key_exists($dependency, $service['depends_on'])) {
$hasSelectedDependency = true;
}
unset($service['depends_on'][$dependency]);
}
if ($hasSelectedDependency) {
$service['depends_on'][$selected] = $selector['condition'];
}
}
}
/**
* @param array<string, mixed> $service
*/
private function rewriteLocalVolumes(string $name, array &$service): void
{
if ($this->params['version'] !== 'local' || !isset(self::LOCAL_VOLUME_PREPENDS[$name])) {
return;
}
$config = self::LOCAL_VOLUME_PREPENDS[$name];
if (empty($this->params[$config['param']])) {
return;
}
$service['volumes'] ??= [];
\array_unshift($service['volumes'], $this->replacePlaceholders($config['volume']));
}
/**
* @param array<string, mixed> $compose
*/
private function emit(array $compose): string
{
$yaml = \yaml_emit($compose, YAML_UTF8_ENCODING, YAML_LN_BREAK);
foreach (self::YAML_DOCUMENT_MARKER_PATTERNS as $pattern) {
$yaml = \preg_replace($pattern, '', $yaml) ?? $yaml;
}
return $yaml;
}
private function replacePlaceholders(string $value): string
{
foreach ($this->params as $param => $replacement) {
if (\is_scalar($replacement)) {
$value = \str_replace('{' . $param . '}', (string)$replacement, $value);
}
}
return $value;
}
}
+7 -3
View File
@@ -50,13 +50,17 @@ class Headers extends Validator
$size = 0;
foreach ($value as $key => $val) {
$length = \strlen($key);
// Reject non-string keys
if (!\is_string($key) || $length === 0) {
if (!\is_string($key)) {
return false;
}
$size += $length + \strlen($val);
$length = \strlen($key);
if ($length === 0) {
return false;
}
$size += $length + \strlen($val ?? '');
if ($size >= $this->maxSize) {
return false;
}
+45
View File
@@ -115,6 +115,12 @@ class V24 extends Migration
} catch (Throwable $th) {
Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}");
}
try {
$this->createIndexFromCollection($this->dbForProject, $id, '_key_teamInternalId');
} catch (Throwable $th) {
Console::warning("Failed to create index \"_key_teamInternalId\" from {$id}: {$th->getMessage()}");
}
}
$this->dbForProject->purgeCachedCollection($id);
break;
@@ -213,6 +219,15 @@ class V24 extends Migration
$this->dbForProject->purgeCachedCollection($id);
break;
case 'memberships':
try {
$this->createIndexFromCollection($this->dbForProject, $id, '_key_team_confirm');
} catch (Throwable $th) {
Console::warning("Failed to create index \"_key_team_confirm\" from {$id}: {$th->getMessage()}");
}
$this->dbForProject->purgeCachedCollection($id);
break;
case 'tokens':
try {
$this->createIndexFromCollection($this->dbForProject, $id, '_key_type_expire');
@@ -239,6 +254,8 @@ class V24 extends Migration
'startCommand',
'buildSpecification',
'runtimeSpecification',
'providerBranches',
'providerPaths',
];
try {
$this->createAttributesFromCollection($this->dbForProject, $id, $attributes);
@@ -254,6 +271,8 @@ class V24 extends Migration
'deploymentRetention',
'buildSpecification',
'runtimeSpecification',
'providerBranches',
'providerPaths',
];
try {
$this->createAttributesFromCollection($this->dbForProject, $id, $attributes);
@@ -295,6 +314,32 @@ class V24 extends Migration
$this->dbForProject->purgeCachedCollection($id);
break;
case 'platforms':
case 'webhooks':
if ($collectionType === 'console') {
try {
$this->createIndexFromCollection($this->dbForProject, $id, '_key_project_id');
} catch (Throwable $th) {
Console::warning("Failed to create index \"_key_project_id\" from {$id}: {$th->getMessage()}");
}
}
$this->dbForProject->purgeCachedCollection($id);
break;
case 'reports':
case 'insights':
if ($collectionType === 'console') {
try {
$this->createCollection($id);
} catch (Throwable $th) {
Console::warning("Failed to create collection \"{$id}\": {$th->getMessage()}");
throw $th;
}
}
$this->dbForProject->purgeCachedCollection($id);
break;
case 'providers':
try {
$this->dbForProject->deleteIndex($id, '_key_name');
+11 -2
View File
@@ -52,6 +52,10 @@ class Server
private const string DEFAULT_IMAGE = 'appwrite-dev';
public const string DEFAULT_CONTAINER = 'appwrite-installer';
private const string COMPOSE_FILE = 'docker-compose.yml';
private const string ENV_FILE = '.env';
private const string LOCAL_COMPOSE_FILE = 'docker-compose.web-installer.yml';
private const string LOCAL_ENV_FILE = '.env.web-installer';
private State $state;
private array $paths = [];
@@ -208,8 +212,13 @@ class Server
}
$basePath = $config->isLocal() ? '/usr/src/code' : (getcwd() ?: '.');
$composePath = $basePath . '/docker-compose.yml';
$envPath = $basePath . '/.env';
if ($config->isLocal()) {
$composePath = $basePath . '/' . self::LOCAL_COMPOSE_FILE;
$envPath = $basePath . '/' . self::LOCAL_ENV_FILE;
} else {
$composePath = $basePath . '/' . self::COMPOSE_FILE;
$envPath = $basePath . '/' . self::ENV_FILE;
}
if (!file_exists($composePath) && !file_exists($envPath)) {
return;
@@ -42,7 +42,6 @@ class Create extends Action
->label('scope', 'account')
->label('audits.event', 'user.update')
->label('audits.resource', 'user/{response.$id}')
->label('usage.resource', 'user/{response.$id}')
->label('audits.userId', '{response.$id}')
->label('sdk', [
new Method(
@@ -39,7 +39,6 @@ class Delete extends Action
->label('scope', 'account')
->label('audits.event', 'user.update')
->label('audits.resource', 'user/{user.$id}')
->label('usage.resource', 'user/{user.$id}')
->label('audits.userId', '{user.$id}')
->label('sdk', [
new Method(
@@ -41,7 +41,6 @@ class Update extends Action
->label('scope', 'account')
->label('audits.event', 'user.update')
->label('audits.resource', 'user/{response.$id}')
->label('usage.resource', 'user/{response.$id}')
->label('audits.userId', '{response.$id}')
->label('sdk', [
new Method(
@@ -57,7 +57,6 @@ class Create extends Action
->label('event', 'users.[userId].challenges.[challengeId].create')
->label('audits.event', 'challenge.create')
->label('audits.resource', 'user/{response.userId}')
->label('usage.resource', 'user/{response.userId}')
->label('audits.userId', '{response.userId}')
->label('sdk', [
new Method(
@@ -40,7 +40,6 @@ class Update extends Action
->label('event', 'users.[userId].sessions.[sessionId].create')
->label('audits.event', 'challenges.update')
->label('audits.resource', 'user/{response.userId}')
->label('usage.resource', 'user/{response.userId}')
->label('audits.userId', '{response.userId}')
->label('sdk', [
new Method(
@@ -36,7 +36,6 @@ class Create extends Action
->label('scope', 'account')
->label('audits.event', 'user.update')
->label('audits.resource', 'user/{response.$id}')
->label('usage.resource', 'user/{response.$id}')
->label('audits.userId', '{response.$id}')
->label('sdk', [
new Method(
@@ -36,7 +36,6 @@ class Update extends Action
->label('scope', 'account')
->label('audits.event', 'user.update')
->label('audits.resource', 'user/{response.$id}')
->label('usage.resource', 'user/{response.$id}')
->label('audits.userId', '{response.$id}')
->label('sdk', [
new Method(
@@ -36,7 +36,6 @@ class Update extends Action
->label('scope', 'account')
->label('audits.event', 'user.update')
->label('audits.resource', 'user/{response.$id}')
->label('usage.resource', 'user/{response.$id}')
->label('audits.userId', '{response.$id}')
->label('sdk', new Method(
namespace: 'account',
@@ -38,7 +38,6 @@ class Delete extends Action
->label('resourceType', RESOURCE_TYPE_REPORTS)
->label('audits.event', 'report.delete')
->label('audits.resource', 'report/{request.reportId}')
->label('usage.resource', 'report/{request.reportId}')
->label('abuse-key', 'projectId:{projectId},userId:{userId}')
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
@@ -45,6 +45,7 @@ class Get extends Action
->desc('Get attribute')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -40,6 +40,7 @@ class XList extends Action
->desc('List attributes')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -34,6 +34,7 @@ class Get extends Action
->desc('Get collection')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'databases',
@@ -35,6 +35,7 @@ class Get extends Action
->desc('Get index')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -41,6 +41,7 @@ class XList extends Action
->desc('List indexes')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -42,6 +42,7 @@ class XList extends Action
->desc('List collections')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'databases',
@@ -28,6 +28,7 @@ class Get extends Action
->desc('Get database')
->groups(['api', 'database'])
->label('scope', 'databases.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', [
new Method(
@@ -33,6 +33,7 @@ class Get extends Action
->desc('Get transaction')
->groups(['api', 'database', 'transactions'])
->label('scope', 'rows.read')
->label('usage.resource', 'transaction/{request.transactionId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'databases',
@@ -33,6 +33,7 @@ class Get extends DocumentGet
->desc('Get document')
->groups(['api', 'database'])
->label('scope', 'documents.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'documentsDB',
@@ -35,6 +35,7 @@ class XList extends DocumentXList
->desc('List documents')
->groups(['api', 'database'])
->label('scope', 'documents.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'documentsDB',
@@ -31,6 +31,7 @@ class Get extends CollectionGet
->desc('Get collection')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'documentsDB',
@@ -32,6 +32,7 @@ class Get extends IndexGet
->desc('Get index')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'documentsDB',
@@ -33,6 +33,7 @@ class XList extends IndexXList
->desc('List indexes')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'documentsDB',
@@ -34,6 +34,7 @@ class XList extends CollectionXList
->desc('List collections')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'documentsDB',
@@ -27,6 +27,7 @@ class Get extends DatabaseGet
->desc('Get database')
->groups(['api', 'database'])
->label('scope', 'databases.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'documentsDB',
@@ -31,6 +31,7 @@ class Get extends TransactionsGet
->desc('Get transaction')
->groups(['api', 'database', 'transactions'])
->label('scope', 'documents.read')
->label('usage.resource', 'transaction/{request.transactionId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'documentsDB',
@@ -27,6 +27,7 @@ class Get extends DatabaseGet
->desc('Get database')
->groups(['api', 'database'])
->label('scope', 'databases.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'tablesDB',
@@ -43,6 +43,7 @@ class Get extends AttributesGet
->desc('Get column')
->groups(['api', 'database'])
->label('scope', ['tables.read', 'collections.read', 'columns.read', 'attributes.read'])
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -34,6 +34,7 @@ class XList extends AttributesXList
->desc('List columns')
->groups(['api', 'database'])
->label('scope', ['tables.read', 'collections.read', 'columns.read', 'attributes.read'])
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -32,6 +32,7 @@ class Get extends CollectionGet
->desc('Get table')
->groups(['api', 'database'])
->label('scope', ['tables.read', 'collections.read'])
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -33,6 +33,7 @@ class Get extends IndexGet
->desc('Get index')
->groups(['api', 'database'])
->label('scope', ['tables.read', 'collections.read', 'indexes.read'])
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -34,6 +34,7 @@ class XList extends IndexXList
->desc('List indexes')
->groups(['api', 'database'])
->label('scope', ['tables.read', 'collections.read', 'indexes.read'])
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -35,6 +35,7 @@ class Get extends DocumentGet
->desc('Get row')
->groups(['api', 'database'])
->label('scope', ['rows.read', 'documents.read'])
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -37,6 +37,7 @@ class XList extends DocumentXList
->desc('List rows')
->groups(['api', 'database'])
->label('scope', ['rows.read', 'documents.read'])
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -35,6 +35,7 @@ class XList extends CollectionXList
->desc('List tables')
->groups(['api', 'database'])
->label('scope', ['tables.read', 'collections.read'])
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: $this->getSDKNamespace(),
@@ -32,6 +32,7 @@ class Get extends TransactionsGet
->desc('Get transaction')
->groups(['api', 'database', 'transactions'])
->label('scope', ['documents.read', 'rows.read'])
->label('usage.resource', 'transaction/{request.transactionId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'tablesDB',
@@ -33,6 +33,7 @@ class Get extends DocumentGet
->desc('Get document')
->groups(['api', 'database'])
->label('scope', 'documents.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorsDB',
@@ -35,6 +35,7 @@ class XList extends DocumentXList
->desc('List documents')
->groups(['api', 'database'])
->label('scope', 'documents.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorsDB',
@@ -31,6 +31,7 @@ class Get extends CollectionGet
->desc('Get collection')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorsDB',
@@ -32,6 +32,7 @@ class Get extends IndexGet
->desc('Get index')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorsDB',
@@ -33,6 +33,7 @@ class XList extends IndexXList
->desc('List indexes')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorsDB',
@@ -34,6 +34,7 @@ class XList extends CollectionXList
->desc('List collections')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorsDB',
@@ -50,7 +50,7 @@ class Create extends CreateDocumentAction
->label('resourceType', RESOURCE_TYPE_EMBEDDINGS_TEXT)
->label('audits.event', 'embedding.create')
->label('audits.resource', 'vectorsdb/embeddings/text')
->label('usage.resource', 'vectorsdb/embeddings/text')
->label('usage.resource', 'database/embeddings/text')
->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}')
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
@@ -26,6 +26,7 @@ class Get extends DatabaseGet
->desc('Get database')
->groups(['api', 'database'])
->label('scope', 'databases.read')
->label('usage.resource', 'database/{request.databaseId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorsDB',
@@ -31,6 +31,7 @@ class Get extends TransactionsGet
->desc('Get transaction')
->groups(['api', 'database', 'transactions'])
->label('scope', 'documents.read')
->label('usage.resource', 'transaction/{request.transactionId}')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorsDB',
@@ -36,6 +36,7 @@ class Get extends Action
->groups(['api', 'functions'])
->desc('Get deployment download')
->label('scope', 'functions.read')
->label('usage.resource', 'function/{request.functionId}')
->label('resourceType', RESOURCE_TYPE_FUNCTIONS)
->label('sdk', new Method(
namespace: 'functions',
@@ -29,6 +29,7 @@ class Get extends Action
->desc('Get deployment')
->groups(['api', 'functions'])
->label('scope', 'functions.read')
->label('usage.resource', 'function/{request.functionId}')
->label('resourceType', RESOURCE_TYPE_FUNCTIONS)
->label('sdk', new Method(
namespace: 'functions',
@@ -40,6 +40,7 @@ class XList extends Base
->desc('List deployments')
->groups(['api', 'functions'])
->label('scope', 'functions.read')
->label('usage.resource', 'function/{request.functionId}')
->label('resourceType', RESOURCE_TYPE_FUNCTIONS)
->label('sdk', new Method(
namespace: 'functions',
@@ -32,6 +32,7 @@ class Get extends Base
->desc('Get execution')
->groups(['api', 'functions'])
->label('scope', ['executions.read', 'execution.read'])
->label('usage.resource', 'function/{request.functionId}')
->label('resourceType', RESOURCE_TYPE_FUNCTIONS)
->label('sdk', new Method(
namespace: 'functions',
@@ -40,6 +40,7 @@ class XList extends Base
->desc('List executions')
->groups(['api', 'functions'])
->label('scope', ['executions.read', 'execution.read'])
->label('usage.resource', 'function/{request.functionId}')
->label('resourceType', RESOURCE_TYPE_FUNCTIONS)
->label('sdk', new Method(
namespace: 'functions',
@@ -30,6 +30,7 @@ class Get extends Base
->desc('Get function')
->groups(['api', 'functions'])
->label('scope', 'functions.read')
->label('usage.resource', 'function/{request.functionId}')
->label('resourceType', RESOURCE_TYPE_FUNCTIONS)
->label('sdk', new Method(
namespace: 'functions',
@@ -30,6 +30,7 @@ class Get extends Base
->desc('Get variable')
->groups(['api', 'functions'])
->label('scope', 'functions.read')
->label('usage.resource', 'function/{request.functionId}')
->label('resourceType', RESOURCE_TYPE_FUNCTIONS)
->label(
'sdk',
@@ -37,6 +37,7 @@ class XList extends Base
->desc('List variables')
->groups(['api', 'functions'])
->label('scope', 'functions.read')
->label('usage.resource', 'function/{request.functionId}')
->label('resourceType', RESOURCE_TYPE_FUNCTIONS)
->label(
'sdk',
@@ -295,7 +295,15 @@ class Builds extends Action
$privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
try {
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
} catch (\Exception $e) {
if ($e->getCode() === 404
&& $resource->getAttribute('installationId', '') === $installationId) {
$this->disconnectVcs($resource, $dbForProject, $dbForPlatform);
}
throw $e;
}
}
Span::add('timings.setup', \round(\microtime(true) - $phaseStart, 3));
@@ -669,6 +677,7 @@ class Builds extends Action
'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'] ?? '',
'APPWRITE_FUNCTION_CPUS' => $cpus,
'APPWRITE_FUNCTION_MEMORY' => $memory,
'OPEN_RUNTIMES_NFT' => System::getEnv('_APP_OPEN_RUNTIMES_NFT', 'enabled'),
];
break;
case 'sites':
@@ -684,6 +693,7 @@ class Builds extends Action
'APPWRITE_SITE_RUNTIME_VERSION' => $runtime['version'] ?? '',
'APPWRITE_SITE_CPUS' => $cpus,
'APPWRITE_SITE_MEMORY' => $memory,
'OPEN_RUNTIMES_NFT' => System::getEnv('_APP_OPEN_RUNTIMES_NFT', 'enabled'),
];
break;
}
@@ -1555,6 +1565,24 @@ class Builds extends Action
}
}
protected function disconnectVcs(Document $resource, Database $dbForProject, Database $dbForPlatform): void
{
$repositoryId = $resource->getAttribute('repositoryId', '');
if (!empty($repositoryId)) {
$dbForPlatform->deleteDocument('repositories', $repositoryId);
}
$dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document([
'installationId' => '',
'installationInternalId' => '',
'providerRepositoryId' => '',
'providerBranch' => '',
'providerSilentMode' => false,
'providerRootDirectory' => '',
'repositoryId' => '',
'repositoryInternalId' => '',
]));
}
private function updateLatestDeployment(Database $dbForProject, Document $resource): Document
{
$latestDeployment = $dbForProject->findOne('deployments', [
@@ -34,7 +34,6 @@ class Delete extends Action
->label('event', 'migrations.[migrationId].delete')
->label('audits.event', 'migrationId.delete')
->label('audits.resource', 'migrations/{request.migrationId}')
->label('usage.resource', 'migrations/{request.migrationId}')
->label('sdk', new Method(
namespace: 'migrations',
group: null,
@@ -35,7 +35,6 @@ class Update extends Action
->label('event', 'migrations.[migrationId].retry')
->label('audits.event', 'migration.retry')
->label('audits.resource', 'migrations/{request.migrationId}')
->label('usage.resource', 'migrations/{request.migrationId}')
->label('sdk', new Method(
namespace: 'migrations',
group: null,
@@ -46,7 +46,6 @@ class Create extends Action
->groups(['api', 'organization'])
->label('audits.event', 'projects.create')
->label('audits.resource', 'project/{response.$id}')
->label('usage.resource', 'project/{response.$id}')
->label('scope', 'projects.write')
->label('sdk', new Method(
namespace: 'organization',
@@ -35,7 +35,6 @@ class Delete extends Action
->label('scope', 'projects.write')
->label('audits.event', 'projects.delete')
->label('audits.resource', 'project/{request.projectId}')
->label('usage.resource', 'project/{request.projectId}')
->label('sdk', new Method(
namespace: 'organization',
group: 'projects',
Loaded 100 of 232 files, more files were not shown because too many files have changed in this diff. Show more