mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Implement Reports
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ ENV VITE_APPWRITE_GROWTH_ENDPOINT=$VITE_APPWRITE_GROWTH_ENDPOINT
|
||||
RUN npm ci
|
||||
RUN npm run build
|
||||
|
||||
FROM ionic/base as final
|
||||
FROM appwrite/base:0.3.1 as final
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
|
||||
@@ -3653,7 +3653,7 @@ $collections = [
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('errorData'),
|
||||
'$id' => ID::custom('reason'),
|
||||
'type' => Database::VAR_STRING,
|
||||
'format' => '',
|
||||
'size' => 65535,
|
||||
@@ -3661,7 +3661,7 @@ $collections = [
|
||||
'required' => true,
|
||||
'default' => null,
|
||||
'array' => false,
|
||||
'filters' => ['json'],
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('search'),
|
||||
|
||||
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
@@ -188,7 +188,7 @@ App::post('/v1/migrations/appwrite')
|
||||
->label('audits.event', 'migration.create')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'migrations')
|
||||
->label('sdk.method', 'migrationAppwrite')
|
||||
->label('sdk.method', 'migrateAppwrite')
|
||||
->label('sdk.description', '/docs/references/migrations/migration-appwrite.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
@@ -216,7 +216,7 @@ App::post('/v1/migrations/appwrite')
|
||||
'resources' => $resources,
|
||||
'statusCounters' => '{}',
|
||||
'resourceData' => "{}",
|
||||
'errorData' => ""
|
||||
'reason' => ''
|
||||
]));
|
||||
|
||||
$eventsInstance->setParam('migrationId', $migration->getId());
|
||||
@@ -234,6 +234,35 @@ App::post('/v1/migrations/appwrite')
|
||||
->dynamic($migration, Response::MODEL_MIGRATION);
|
||||
});
|
||||
|
||||
App::post('/v1/migrations/appwrite/report')
|
||||
->groups(['api', 'migrations'])
|
||||
->desc('Generate a report on Appwrite Data')
|
||||
->label('scope', 'migrations.write')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'migrations')
|
||||
->label('sdk.method', 'generateAppwriteReport')
|
||||
->label('sdk.description', '/docs/references/migrations/migration-appwrite-report.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
|
||||
->param('resources', [], new ArrayList(new WhiteList(Appwrite::getSupportedResources())), 'List of resources to migrate')
|
||||
->param('endpoint', '', new URL(), "Source's Appwrite Endpoint")
|
||||
->param('projectID', '', new Text(512), "Source's Project ID")
|
||||
->param('key', '', new Text(512), "Source's API Key")
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->inject('project')
|
||||
->inject('user')
|
||||
->action(function (array $resources, string $endpoint, string $projectID, string $key, Response $response) {
|
||||
|
||||
$appwrite = new Appwrite($projectID, $endpoint, $key);
|
||||
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
->dynamic(new Document($appwrite->report($resources)), Response::MODEL_MIGRATION_REPORT);
|
||||
});
|
||||
|
||||
|
||||
App::post('/v1/migrations/firebase')
|
||||
->groups(['api', 'migrations'])
|
||||
->desc('Migrate Firebase Data')
|
||||
@@ -242,7 +271,7 @@ App::post('/v1/migrations/firebase')
|
||||
->label('audits.event', 'migration.create')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'migrations')
|
||||
->label('sdk.method', 'migrationFirebase')
|
||||
->label('sdk.method', 'migrateFirebase')
|
||||
->label('sdk.description', '/docs/references/migrations/migration-firebase.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
@@ -266,7 +295,7 @@ App::post('/v1/migrations/firebase')
|
||||
'resources' => $resources,
|
||||
'statusCounters' => '{}',
|
||||
'resourceData' => "{}",
|
||||
'errorData' => ""
|
||||
'reason' => ''
|
||||
]));
|
||||
|
||||
$eventsInstance->setParam('migrationId', $migration->getId());
|
||||
@@ -284,6 +313,36 @@ App::post('/v1/migrations/firebase')
|
||||
->dynamic($migration, Response::MODEL_MIGRATION);
|
||||
});
|
||||
|
||||
App::post('/v1/migrations/firebase/report')
|
||||
->groups(['api', 'migrations'])
|
||||
->desc('Generate a report on Firebase Data')
|
||||
->label('scope', 'migrations.write')
|
||||
->label('event', 'migrations.report')
|
||||
->label('audits.event', 'migration.report')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'migrations')
|
||||
->label('sdk.method', 'generateFirebaseReport')
|
||||
->label('sdk.description', '/docs/references/migrations/migration-firebase-report.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
|
||||
->param('resources', [], new ArrayList(new WhiteList(Firebase::getSupportedResources())), 'List of resources to migrate')
|
||||
->param('serviceAccount', '', new Text(512), "Source's Service Account")
|
||||
->param('databaseURL', '', new URL(), "Source's Database URL")
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->inject('project')
|
||||
->inject('user')
|
||||
->inject('events')
|
||||
->action(function (array $resources, string $serviceAccount, string $databaseURL, Response $response, Database $dbForProject, Document $project, Document $user, Event $eventsInstance) {
|
||||
|
||||
$firebase = new Firebase(json_decode($serviceAccount, true), $databaseURL);
|
||||
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
->dynamic(new Document($firebase->report($resources)), Response::MODEL_MIGRATION_REPORT);
|
||||
});
|
||||
|
||||
App::post('/v1/migrations/supabase')
|
||||
->groups(['api', 'migrations'])
|
||||
->desc('Migrate Supabase Data')
|
||||
@@ -292,7 +351,7 @@ App::post('/v1/migrations/supabase')
|
||||
->label('audits.event', 'migration.create')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'migrations')
|
||||
->label('sdk.method', 'migrationSupabase')
|
||||
->label('sdk.method', 'migrateSupabase')
|
||||
->label('sdk.description', '/docs/references/migrations/migration-supabase.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
@@ -326,7 +385,7 @@ App::post('/v1/migrations/supabase')
|
||||
'resources' => $resources,
|
||||
'statusCounters' => '{}',
|
||||
'resourceData' => "{}",
|
||||
'errorData' => ""
|
||||
'reason' => ''
|
||||
]));
|
||||
|
||||
$eventsInstance->setParam('migrationId', $migration->getId());
|
||||
@@ -344,6 +403,40 @@ App::post('/v1/migrations/supabase')
|
||||
->dynamic($migration, Response::MODEL_MIGRATION);
|
||||
});
|
||||
|
||||
App::post('/v1/migrations/supabase/report')
|
||||
->groups(['api', 'migrations'])
|
||||
->desc('Generate a report on Supabase Data')
|
||||
->label('scope', 'migrations.write')
|
||||
->label('event', 'migrations.report')
|
||||
->label('audits.event', 'migration.report')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'migrations')
|
||||
->label('sdk.method', 'generateSupabaseReport')
|
||||
->label('sdk.description', '/docs/references/migrations/migration-supabase-report.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
|
||||
->param('resources', [], new ArrayList(new WhiteList(Supabase::getSupportedResources(), true)), 'List of resources to migrate')
|
||||
->param('endpoint', '', new URL(), "Source's Supabase Endpoint")
|
||||
->param('apiKey', '', new Text(512), "Source's API Key")
|
||||
->param('databaseHost', '', new Text(512), "Source's Database Host")
|
||||
->param('username', '', new Text(512), "Source's Database Username")
|
||||
->param('password', '', new Text(512), "Source's Database Password")
|
||||
->param('port', 5432, new Integer(), "Source's Database Port", true)
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->inject('project')
|
||||
->inject('user')
|
||||
->inject('events')
|
||||
->action(function (array $resources, string $endpoint, string $apiKey, string $databaseHost, string $username, string $password, int $port, Response $response, Database $dbForProject, Document $project, Document $user, Event $eventsInstance) {
|
||||
|
||||
$supabase = new Supabase($endpoint, $apiKey, $databaseHost, $username, $password, $port);
|
||||
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
->dynamic(new Document($supabase->report($resources)), Response::MODEL_MIGRATION_REPORT);
|
||||
});
|
||||
|
||||
App::post('/v1/migrations/nhost')
|
||||
->groups(['api', 'migrations'])
|
||||
->desc('Migrate NHost Data')
|
||||
@@ -352,7 +445,7 @@ App::post('/v1/migrations/nhost')
|
||||
->label('audits.event', 'migration.create')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'migrations')
|
||||
->label('sdk.method', 'migrationNhost')
|
||||
->label('sdk.method', 'migrateNHost')
|
||||
->label('sdk.description', '/docs/references/migrations/migration-nhost.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
@@ -388,7 +481,7 @@ App::post('/v1/migrations/nhost')
|
||||
'resources' => $resources,
|
||||
'statusCounters' => '{}',
|
||||
'resourceData' => "{}",
|
||||
'errorData' => ""
|
||||
'reason' => ''
|
||||
]));
|
||||
|
||||
$eventsInstance->setParam('migrationId', $migration->getId());
|
||||
@@ -405,3 +498,38 @@ App::post('/v1/migrations/nhost')
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
->dynamic($migration, Response::MODEL_MIGRATION);
|
||||
});
|
||||
|
||||
App::post('/v1/migrations/nhost/report')
|
||||
->groups(['api', 'migrations'])
|
||||
->desc('Generate a report on NHost Data')
|
||||
->label('scope', 'migrations.write')
|
||||
->label('event', 'migrations.report')
|
||||
->label('audits.event', 'migration.report')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'migrations')
|
||||
->label('sdk.method', 'generateNHostReport')
|
||||
->label('sdk.description', '/docs/references/migrations/migration-nhost-report.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_MIGRATION_REPORT)
|
||||
->param('resources', [], new ArrayList(new WhiteList(NHost::getSupportedResources())), 'List of resources to migrate')
|
||||
->param('subdomain', '', new URL(), "Source's Subdomain")
|
||||
->param('region', '', new Text(512), "Source's Region")
|
||||
->param('adminSecret', '', new Text(512), "Source's Admin Secret")
|
||||
->param('database', '', new Text(512), "Source's Database Name")
|
||||
->param('username', '', new Text(512), "Source's Database Username")
|
||||
->param('password', '', new Text(512), "Source's Database Password")
|
||||
->param('port', 5432, new Integer(), "Source's Database Port", true)
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->inject('project')
|
||||
->inject('user')
|
||||
->inject('events')
|
||||
->action(function (array $resources, string $subdomain, string $region, string $adminSecret, string $database, string $username, string $password, int $port, Response $response, Database $dbForProject, Document $project, Document $user, Event $eventsInstance) {
|
||||
|
||||
$nhost = new NHost($subdomain, $region, $adminSecret, $database, $username, $password, $port);
|
||||
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
->dynamic(new Document($nhost->report($resources)), Response::MODEL_MIGRATION_REPORT);
|
||||
});
|
||||
|
||||
@@ -66,7 +66,6 @@ class MigrationsV1 extends Worker
|
||||
|
||||
$this->dbForProject = $this->getProjectDB($this->args['project']['$id']);
|
||||
|
||||
// Process
|
||||
$this->processMigration();
|
||||
}
|
||||
|
||||
@@ -221,7 +220,7 @@ class MigrationsV1 extends Worker
|
||||
|
||||
try {
|
||||
$migrationDocument = $this->dbForProject->getDocument('migrations', $this->args['migration']['$id']);
|
||||
$migrationDocument->setAttribute('status', 'processing');
|
||||
$migrationDocument->setAttribute('stage', 'processing');
|
||||
$this->updateMigrationDocument($migrationDocument, $projectDocument);
|
||||
|
||||
$source = $this->processSource(json_decode($migrationDocument->getAttribute('source'), true));
|
||||
@@ -237,14 +236,14 @@ class MigrationsV1 extends Worker
|
||||
$destination
|
||||
);
|
||||
|
||||
$migrationDocument->setAttribute('status', 'source-check');
|
||||
$migrationDocument->setAttribute('stage', 'source-check');
|
||||
$this->updateMigrationDocument($migrationDocument, $projectDocument);
|
||||
|
||||
$migrationDocument->setAttribute('status', 'destination-check');
|
||||
$migrationDocument->setAttribute('stage', 'destination-check');
|
||||
$this->updateMigrationDocument($migrationDocument, $projectDocument);
|
||||
|
||||
/** Start Transfer */
|
||||
$migrationDocument->setAttribute('status', 'migrating');
|
||||
$migrationDocument->setAttribute('stage', 'migrating');
|
||||
$this->updateMigrationDocument($migrationDocument, $projectDocument);
|
||||
$transfer->run($migrationDocument->getAttribute('resources'), function () use ($migrationDocument, $transfer, $projectDocument) {
|
||||
$migrationDocument->setAttribute('resourceData', json_encode($transfer->getCache()));
|
||||
@@ -257,7 +256,8 @@ class MigrationsV1 extends Worker
|
||||
|
||||
if (count($errors) > 0) {
|
||||
$migrationDocument->setAttribute('status', 'failed');
|
||||
$migrationDocument->setAttribute('errorData', $errors);
|
||||
$migrationDocument->setAttribute('stage', 'finished');
|
||||
$migrationDocument->setAttribute('reason', $errors[0]['message']);
|
||||
$this->updateMigrationDocument($migrationDocument, $projectDocument);
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +271,8 @@ class MigrationsV1 extends Worker
|
||||
Console::error($th->getMessage());
|
||||
Console::error($th->getTraceAsString());
|
||||
$migrationDocument->setAttribute('status', 'failed');
|
||||
$migrationDocument->setAttribute('errorData', $th->getMessage());
|
||||
$migrationDocument->setAttribute('stage', 'finished');
|
||||
$migrationDocument->setAttribute('reason', $th->getMessage());
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@
|
||||
"utopia-php/storage": "0.14.*",
|
||||
"utopia-php/swoole": "0.5.*",
|
||||
"utopia-php/websocket": "0.1.*",
|
||||
"utopia-php/transfer": "dev-feat-initial-push",
|
||||
"utopia-php/transfer": "dev-fix-incorrect-imports",
|
||||
"resque/php-resque": "1.3.6",
|
||||
"matomo/device-detector": "6.0.*",
|
||||
"dragonmantank/cron-expression": "3.3.1",
|
||||
|
||||
Generated
+26
-28
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "772c42c6e08002543ddec1c7af0c44e2",
|
||||
"content-hash": "e1333033ea575e83037bd5b14cf98e98",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/jwt",
|
||||
@@ -2938,16 +2938,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/transfer",
|
||||
"version": "dev-feat-initial-push",
|
||||
"version": "dev-fix-incorrect-imports",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/transfer.git",
|
||||
"reference": "6116d8d9308b5066ad5bb9b93d0e22c7527b5922"
|
||||
"reference": "3c12302c2bd2ba474183b132f86d31a63762ff01"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/transfer/zipball/6116d8d9308b5066ad5bb9b93d0e22c7527b5922",
|
||||
"reference": "6116d8d9308b5066ad5bb9b93d0e22c7527b5922",
|
||||
"url": "https://api.github.com/repos/utopia-php/transfer/zipball/3c12302c2bd2ba474183b132f86d31a63762ff01",
|
||||
"reference": "3c12302c2bd2ba474183b132f86d31a63762ff01",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2958,7 +2958,6 @@
|
||||
"require-dev": {
|
||||
"laravel/pint": "^1.10",
|
||||
"phpunit/phpunit": "^9.3",
|
||||
"vimeo/psalm": "^5.6",
|
||||
"vlucas/phpdotenv": "^5.5"
|
||||
},
|
||||
"type": "library",
|
||||
@@ -2994,10 +2993,10 @@
|
||||
"utopia"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/utopia-php/transfer/tree/feat-initial-push",
|
||||
"source": "https://github.com/utopia-php/transfer/tree/fix-incorrect-imports",
|
||||
"issues": "https://github.com/utopia-php/transfer/issues"
|
||||
},
|
||||
"time": "2023-06-17T16:02:15+00:00"
|
||||
"time": "2023-07-10T12:29:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/websocket",
|
||||
@@ -3117,16 +3116,16 @@
|
||||
},
|
||||
{
|
||||
"name": "webonyx/graphql-php",
|
||||
"version": "v14.11.9",
|
||||
"version": "v14.11.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webonyx/graphql-php.git",
|
||||
"reference": "ff91c9f3cf241db702e30b2c42bcc0920e70ac70"
|
||||
"reference": "d9c2fdebc6aa01d831bc2969da00e8588cffef19"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/webonyx/graphql-php/zipball/ff91c9f3cf241db702e30b2c42bcc0920e70ac70",
|
||||
"reference": "ff91c9f3cf241db702e30b2c42bcc0920e70ac70",
|
||||
"url": "https://api.github.com/repos/webonyx/graphql-php/zipball/d9c2fdebc6aa01d831bc2969da00e8588cffef19",
|
||||
"reference": "d9c2fdebc6aa01d831bc2969da00e8588cffef19",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3146,8 +3145,7 @@
|
||||
"phpunit/phpunit": "^7.2 || ^8.5",
|
||||
"psr/http-message": "^1.0",
|
||||
"react/promise": "2.*",
|
||||
"simpod/php-coveralls-mirror": "^3.0",
|
||||
"squizlabs/php_codesniffer": "3.5.4"
|
||||
"simpod/php-coveralls-mirror": "^3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/http-message": "To use standard GraphQL server",
|
||||
@@ -3171,7 +3169,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/webonyx/graphql-php/issues",
|
||||
"source": "https://github.com/webonyx/graphql-php/tree/v14.11.9"
|
||||
"source": "https://github.com/webonyx/graphql-php/tree/v14.11.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3179,7 +3177,7 @@
|
||||
"type": "open_collective"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-06T12:12:50+00:00"
|
||||
"time": "2023-07-05T14:23:37+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@@ -3536,16 +3534,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v4.15.5",
|
||||
"version": "v4.16.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e"
|
||||
"reference": "19526a33fb561ef417e822e85f08a00db4059c17"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e",
|
||||
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17",
|
||||
"reference": "19526a33fb561ef417e822e85f08a00db4059c17",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3586,9 +3584,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0"
|
||||
},
|
||||
"time": "2023-05-19T20:20:00+00:00"
|
||||
"time": "2023-06-25T14:52:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
@@ -3939,16 +3937,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "1.22.0",
|
||||
"version": "1.22.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c"
|
||||
"reference": "65c39594fbd8c67abfc68bb323f86447bab79cc0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ec58baf7b3c7f1c81b3b00617c953249fb8cf30c",
|
||||
"reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/65c39594fbd8c67abfc68bb323f86447bab79cc0",
|
||||
"reference": "65c39594fbd8c67abfc68bb323f86447bab79cc0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3980,9 +3978,9 @@
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.22.0"
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.22.1"
|
||||
},
|
||||
"time": "2023-06-01T12:35:21+00:00"
|
||||
"time": "2023-06-29T20:46:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
|
||||
@@ -11,7 +11,7 @@ class Migrations extends Base
|
||||
'resources',
|
||||
'statusCounters',
|
||||
'resourceData',
|
||||
'errorData'
|
||||
'reason'
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -85,8 +85,8 @@ use Appwrite\Utopia\Response\Model\UsageProject;
|
||||
use Appwrite\Utopia\Response\Model\UsageStorage;
|
||||
use Appwrite\Utopia\Response\Model\UsageUsers;
|
||||
use Appwrite\Utopia\Response\Model\Variable;
|
||||
use Appwrite\Utopia\Response\Model\ImportValidationError;
|
||||
use Appwrite\Utopia\Response\Model\Migration;
|
||||
use Appwrite\Utopia\Response\Model\MigrationReport;
|
||||
|
||||
/**
|
||||
* @method int getStatusCode()
|
||||
@@ -224,7 +224,7 @@ class Response extends SwooleResponse
|
||||
// Migrations
|
||||
public const MODEL_MIGRATION = 'migration';
|
||||
public const MODEL_MIGRATION_LIST = 'migrationList';
|
||||
public const MODEL_IMPORT_VALIDATION_ERROR = 'importValidationError';
|
||||
public const MODEL_MIGRATION_REPORT = 'migrationReport';
|
||||
|
||||
// Deprecated
|
||||
public const MODEL_PERMISSIONS = 'permissions';
|
||||
@@ -358,7 +358,7 @@ class Response extends SwooleResponse
|
||||
->setModel(new UsageProject())
|
||||
->setModel(new ConsoleVariables())
|
||||
->setModel(new Migration())
|
||||
->setModel(new ImportValidationError())
|
||||
->setModel(new MigrationReport())
|
||||
// Verification
|
||||
// Recovery
|
||||
// Tests (keep last)
|
||||
|
||||
@@ -65,11 +65,11 @@ class Migration extends Model
|
||||
'default' => [],
|
||||
'example' => '[{"resource":"Database","id":"public","status":"SUCCESS","message":""}]',
|
||||
])
|
||||
->addRule('errorData', [
|
||||
'type' => self::TYPE_JSON,
|
||||
'description' => 'Error data.',
|
||||
'default' => [],
|
||||
'example' => '{"source":[], "destination": []}',
|
||||
->addRule('reason', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'The reason for a migration failure if any.',
|
||||
'default' => '',
|
||||
'example' => '',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
use Utopia\Transfer\Resource;
|
||||
|
||||
class MigrationReport extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule(Resource::TYPE_USER, [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Number of users to be migrated.',
|
||||
'default' => 0,
|
||||
'example' => 20,
|
||||
])
|
||||
->addRule(Resource::TYPE_TEAM, [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Number of teams to be migrated.',
|
||||
'default' => 0,
|
||||
'example' => 20,
|
||||
])
|
||||
->addRule(Resource::TYPE_DATABASE, [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Number of databases to be migrated.',
|
||||
'default' => 0,
|
||||
'example' => 20,
|
||||
])
|
||||
->addRule(Resource::TYPE_DOCUMENT, [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Number of documents to be migrated.',
|
||||
'default' => 0,
|
||||
'example' => 20,
|
||||
])
|
||||
->addRule(Resource::TYPE_FILE, [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Number of files to be migrated.',
|
||||
'default' => 0,
|
||||
'example' => 20,
|
||||
])
|
||||
->addRule(Resource::TYPE_BUCKET, [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Number of buckets to be migrated.',
|
||||
'default' => 0,
|
||||
'example' => 20,
|
||||
])
|
||||
->addRule(Resource::TYPE_FUNCTION, [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Number of functions to be migrated.',
|
||||
'default' => 0,
|
||||
'example' => 20,
|
||||
])
|
||||
->addRule('size', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Size of files to be migrated in mb.',
|
||||
'default' => 0,
|
||||
'example' => 30000,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'Migration Report';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return Response::MODEL_MIGRATION_REPORT;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user