diff --git a/Dockerfile b/Dockerfile index de60b78772..7b7939eb6a 100755 --- a/Dockerfile +++ b/Dockerfile @@ -29,145 +29,7 @@ ENV VITE_APPWRITE_GROWTH_ENDPOINT=$VITE_APPWRITE_GROWTH_ENDPOINT RUN npm ci RUN npm run build -FROM php:8.0.18-cli-alpine3.15 as compile - -ARG DEBUG=false -ENV DEBUG=$DEBUG - -ENV PHP_REDIS_VERSION=5.3.7 \ - PHP_MONGODB_VERSION=1.13.0 \ - PHP_SWOOLE_VERSION=v4.8.10 \ - PHP_IMAGICK_VERSION=3.7.0 \ - PHP_YAML_VERSION=2.2.2 \ - PHP_MAXMINDDB_VERSION=v1.11.0 \ - PHP_ZSTD_VERSION="4504e4186e79b197cfcb75d4d09aa47ef7d92fe9" - -RUN \ - apk add --no-cache --virtual .deps \ - make \ - automake \ - autoconf \ - gcc \ - g++ \ - git \ - zlib-dev \ - brotli-dev \ - openssl-dev \ - yaml-dev \ - imagemagick \ - imagemagick-dev \ - libmaxminddb-dev \ - zstd-dev - -RUN docker-php-ext-install sockets - -FROM compile AS redis -RUN \ - # Redis Extension - git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git && \ - cd phpredis && \ - phpize && \ - ./configure && \ - make && make install - -## Swoole Extension -FROM compile AS swoole -RUN \ - git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git && \ - cd swoole-src && \ - phpize && \ - ./configure --enable-sockets --enable-http2 --enable-openssl && \ - make && make install && \ - cd .. - -## Swoole Debugger setup -RUN if [ "$DEBUG" == "true" ]; then \ - cd /tmp && \ - apk add boost-dev && \ - git clone --depth 1 https://github.com/swoole/yasd && \ - cd yasd && \ - phpize && \ - ./configure && \ - make && make install && \ - cd ..;\ - fi - -## Imagick Extension -FROM compile AS imagick -RUN \ - git clone --depth 1 --branch $PHP_IMAGICK_VERSION https://github.com/imagick/imagick && \ - cd imagick && \ - phpize && \ - ./configure && \ - make && make install - -## YAML Extension -FROM compile AS yaml -RUN \ - git clone --depth 1 --branch $PHP_YAML_VERSION https://github.com/php/pecl-file_formats-yaml && \ - cd pecl-file_formats-yaml && \ - phpize && \ - ./configure && \ - make && make install - -## Maxminddb extension -FROM compile AS maxmind -RUN \ - git clone --depth 1 --branch $PHP_MAXMINDDB_VERSION https://github.com/maxmind/MaxMind-DB-Reader-php.git && \ - cd MaxMind-DB-Reader-php && \ - cd ext && \ - phpize && \ - ./configure && \ - make && make install - -# Mongodb Extension -FROM compile as mongodb -RUN \ - git clone --depth 1 --branch $PHP_MONGODB_VERSION https://github.com/mongodb/mongo-php-driver.git && \ - cd mongo-php-driver && \ - git submodule update --init && \ - phpize && \ - ./configure && \ - make && make install - -# Zstd Compression -FROM compile as zstd -RUN git clone --recursive -n https://github.com/kjdev/php-ext-zstd.git \ - && cd php-ext-zstd \ - && git checkout $PHP_ZSTD_VERSION \ - && phpize \ - && ./configure --with-libzstd \ - && make && make install - - -# Rust Extensions Compile Image -FROM php:8.0.18-cli as rust_compile - -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - -ENV PATH=/root/.cargo/bin:$PATH - -RUN apt-get update && apt-get install musl-tools build-essential clang-11 git -y -RUN rustup target add $(uname -m)-unknown-linux-musl - -# Install ZigBuild for easier cross-compilation -RUN curl https://ziglang.org/builds/zig-linux-$(uname -m)-0.10.0-dev.2674+d980c6a38.tar.xz --output /tmp/zig.tar.xz -RUN tar -xf /tmp/zig.tar.xz -C /tmp/ && cp -r /tmp/zig-linux-$(uname -m)-0.10.0-dev.2674+d980c6a38 /tmp/zig/ -ENV PATH=/tmp/zig:$PATH -RUN cargo install cargo-zigbuild -ENV RUSTFLAGS="-C target-feature=-crt-static" - -FROM rust_compile as scrypt - -WORKDIR /usr/local/lib/php/extensions/ - -RUN \ - git clone --depth 1 https://github.com/appwrite/php-scrypt.git && \ - cd php-scrypt && \ - cargo zigbuild --workspace --all-targets --target $(uname -m)-unknown-linux-musl --release && \ - mv target/$(uname -m)-unknown-linux-musl/release/libphp_scrypt.so target/libphp_scrypt.so - -FROM php:8.0.18-cli-alpine3.15 as final +FROM appwrite/base:0.1.0 as final LABEL maintainer="team@appwrite.io" @@ -262,38 +124,6 @@ ENV _APP_SERVER=swoole \ _APP_LOGGING_PROVIDER= \ _APP_LOGGING_CONFIG= -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN \ - apk update \ - && apk add --no-cache --virtual .deps \ - make \ - automake \ - autoconf \ - gcc \ - g++ \ - curl-dev \ - && apk add --no-cache \ - libstdc++ \ - certbot \ - brotli-dev \ - yaml-dev \ - imagemagick \ - imagemagick-dev \ - libmaxminddb-dev \ - certbot \ - docker-cli \ - libgomp \ - && docker-php-ext-install sockets opcache pdo_mysql \ - && apk del .deps \ - && rm -rf /var/cache/apk/* - -RUN \ - mkdir -p $DOCKER_CONFIG/cli-plugins \ - && ARCH=$(uname -m) && if [ $ARCH == "armv7l" ]; then ARCH="armv7"; fi \ - && curl -SL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-linux-$ARCH -o $DOCKER_CONFIG/cli-plugins/docker-compose \ - && chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose - RUN \ if [ "$DEBUG" == "true" ]; then \ apk add boost boost-dev; \ @@ -303,14 +133,6 @@ WORKDIR /usr/src/code COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor COPY --from=node /usr/local/src/console/build /usr/src/code/console -COPY --from=swoole /usr/local/lib/php/extensions/no-debug-non-zts-20200930/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/yasd.so* /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ -COPY --from=redis /usr/local/lib/php/extensions/no-debug-non-zts-20200930/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ -COPY --from=imagick /usr/local/lib/php/extensions/no-debug-non-zts-20200930/imagick.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ -COPY --from=yaml /usr/local/lib/php/extensions/no-debug-non-zts-20200930/yaml.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ -COPY --from=maxmind /usr/local/lib/php/extensions/no-debug-non-zts-20200930/maxminddb.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ -COPY --from=mongodb /usr/local/lib/php/extensions/no-debug-non-zts-20200930/mongodb.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ -COPY --from=scrypt /usr/local/lib/php/extensions/php-scrypt/target/libphp_scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ -COPY --from=zstd /usr/local/lib/php/extensions/no-debug-non-zts-20200930/zstd.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ # Add Source Code COPY ./app /usr/src/code/app @@ -360,13 +182,6 @@ RUN chmod +x /usr/local/bin/doctor && \ RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/ # Enable Extensions -RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini -RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini -RUN echo extension=imagick.so >> /usr/local/etc/php/conf.d/imagick.ini -RUN echo extension=yaml.so >> /usr/local/etc/php/conf.d/yaml.ini -RUN echo extension=maxminddb.so >> /usr/local/etc/php/conf.d/maxminddb.ini -RUN echo extension=libphp_scrypt.so >> /usr/local/etc/php/conf.d/libphp_scrypt.ini -RUN echo extension=zstd.so >> /usr/local/etc/php/conf.d/zstd.ini RUN if [ "$DEBUG" == "true" ]; then printf "zend_extension=yasd \nyasd.debug_mode=remote \nyasd.init_file=/usr/local/dev/yasd_init.php \nyasd.remote_port=9005 \nyasd.log_level=-1" >> /usr/local/etc/php/conf.d/yasd.ini; fi RUN if [ "$DEBUG" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi diff --git a/app/config/collections.php b/app/config/collections.php index e872953568..ab6d665296 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -3,7 +3,7 @@ use Appwrite\Auth\Auth; use Utopia\Config\Config; use Utopia\Database\Database; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; $providers = Config::getParam('providers', []); $auth = Config::getParam('auth', []); diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index fe189741a1..0e24dcd431 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -29,10 +29,10 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\DateTime; use Utopia\Database\Exception\Duplicate; -use Utopia\Database\ID; -use Utopia\Database\Permission; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; use Utopia\Database\Query; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; use Utopia\Locale\Locale; diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 113fcea576..88242482a1 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -4,10 +4,10 @@ use Utopia\App; use Appwrite\Event\Delete; use Appwrite\Extend\Exception; use Utopia\Audit\Audit; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\DatetimeValidator; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; use Utopia\Validator\Boolean; use Utopia\Validator\FloatValidator; use Utopia\Validator\Integer; diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index b4ae0c8232..049d2cb850 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -9,9 +9,9 @@ use Appwrite\Event\Func; use Appwrite\Event\Validator\Event as ValidatorEvent; use Appwrite\Extend\Exception; use Appwrite\Utopia\Database\Validator\CustomId; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\UID; use Appwrite\Usage\Stats; use Utopia\Storage\Device; diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index a445f81cae..29a193748d 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -17,11 +17,11 @@ use Utopia\Audit\Audit; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; use Utopia\Database\DateTime; -use Utopia\Database\Permission; +use Utopia\Database\Helpers\Permission; use Utopia\Database\Query; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\DatetimeValidator; use Utopia\Database\Validator\UID; @@ -32,7 +32,6 @@ use Appwrite\Utopia\Database\Validator\Queries\Projects; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Hostname; -use Utopia\Validator\Integer; use Utopia\Validator\Range; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 5d616bd550..271f2af6b3 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -16,10 +16,10 @@ use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Authorization as AuthorizationException; use Utopia\Database\Exception\Duplicate as DuplicateException; use Utopia\Database\Exception\Structure as StructureException; -use Utopia\Database\ID; -use Utopia\Database\Permission; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; use Utopia\Database\Query; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 5a956112ae..f7ebae6381 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -26,11 +26,11 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Authorization as AuthorizationException; use Utopia\Database\Exception\Duplicate; -use Utopia\Database\ID; -use Utopia\Database\Permission; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; use Utopia\Database\Query; use Utopia\Database\DateTime; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index ad229881cd..2a84c06675 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -16,9 +16,9 @@ use Appwrite\Utopia\Response; use Utopia\App; use Utopia\Audit\Audit; use Utopia\Config\Config; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use Utopia\Locale\Locale; use Appwrite\Extend\Exception; use Utopia\Database\Document; diff --git a/app/controllers/general.php b/app/controllers/general.php index d3009991d3..99af4681b8 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -3,7 +3,7 @@ require_once __DIR__ . '/../init.php'; use Utopia\App; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; use Utopia\Locale\Locale; use Utopia\Logger\Logger; use Utopia\Logger\Log; diff --git a/app/controllers/mock.php b/app/controllers/mock.php index b8691dfa1a..2f97915501 100644 --- a/app/controllers/mock.php +++ b/app/controllers/mock.php @@ -14,7 +14,7 @@ use Utopia\Validator\Integer; use Utopia\Validator\Text; use Utopia\Storage\Validator\File; use Utopia\Validator\WhiteList; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; App::get('/v1/mock/tests/foo') ->desc('Get Foo') diff --git a/app/http.php b/app/http.php index c161e39b54..b9b4d19333 100644 --- a/app/http.php +++ b/app/http.php @@ -10,9 +10,9 @@ use Swoole\Http\Response as SwooleResponse; use Utopia\App; use Utopia\CLI\Console; use Utopia\Config\Config; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Audit\Audit; use Utopia\Abuse\Adapters\TimeLimit; diff --git a/app/init.php b/app/init.php index 350f418a91..44cda7a688 100644 --- a/app/init.php +++ b/app/init.php @@ -43,19 +43,19 @@ use Swoole\Database\PDOPool; use Swoole\Database\RedisConfig; use Swoole\Database\RedisPool; use Utopia\App; +use Utopia\Database\Helpers\ID; +use Utopia\Logger\Logger; use Utopia\Cache\Adapter\Redis as RedisCache; use Utopia\Cache\Cache; use Utopia\Config\Config; use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Database; use Utopia\Database\Document; -use Utopia\Database\ID; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\DatetimeValidator; use Utopia\Database\Validator\Structure; use Utopia\Locale\Locale; -use Utopia\Logger\Logger; use Utopia\Messaging\Adapters\SMS\Mock; use Utopia\Messaging\Adapters\SMS\Msg91; use Utopia\Messaging\Adapters\SMS\Telesign; diff --git a/app/realtime.php b/app/realtime.php index c957a64c4c..5ff642aea4 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -13,8 +13,8 @@ use Utopia\Abuse\Abuse; use Utopia\Abuse\Adapters\TimeLimit; use Utopia\App; use Utopia\CLI\Console; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; use Utopia\Logger\Log; use Utopia\Database\Database; use Utopia\Database\DateTime; diff --git a/app/workers/audits.php b/app/workers/audits.php index b86649543b..b25430ec41 100644 --- a/app/workers/audits.php +++ b/app/workers/audits.php @@ -40,6 +40,7 @@ class AuditsV1 extends Worker $dbForProject = $this->getProjectDB($project->getId()); $audit = new Audit($dbForProject); $audit->log( + userInternalId: $user->getInternalId(), userId: $user->getId(), // Pass first, most verbose event pattern event: $event, diff --git a/app/workers/builds.php b/app/workers/builds.php index fdd633f84a..93a77d5347 100644 --- a/app/workers/builds.php +++ b/app/workers/builds.php @@ -11,7 +11,7 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\App; use Utopia\CLI\Console; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; use Utopia\Storage\Storage; use Utopia\Database\Document; use Utopia\Config\Config; diff --git a/app/workers/certificates.php b/app/workers/certificates.php index 11f3439408..33752215b8 100644 --- a/app/workers/certificates.php +++ b/app/workers/certificates.php @@ -10,7 +10,7 @@ use Utopia\CLI\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\DateTime; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\Domains\Domain; use Utopia\Locale\Locale; diff --git a/app/workers/functions.php b/app/workers/functions.php index efd6ebb41f..d7cb8c7ff3 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -14,10 +14,10 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; -use Utopia\Database\ID; -use Utopia\Database\Permission; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; use Utopia\Database\Query; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; require_once __DIR__ . '/../init.php'; diff --git a/composer.json b/composer.json index 37b3e1bb17..1711407ece 100644 --- a/composer.json +++ b/composer.json @@ -43,13 +43,14 @@ "ext-sockets": "*", "appwrite/php-clamav": "1.1.*", "appwrite/php-runtimes": "0.11.*", - "utopia-php/abuse": "0.16.*", + "utopia-php/abuse": "0.18.*", "utopia-php/analytics": "0.2.*", - "utopia-php/audit": "0.17.*", + "utopia-php/audit": "0.20.*", "utopia-php/cache": "0.8.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.28.*", + "utopia-php/database": "0.30.*", + "utopia-php/preloader": "0.2.*", "utopia-php/domains": "1.1.*", "utopia-php/framework": "0.26.*", "utopia-php/image": "0.5.*", @@ -57,7 +58,6 @@ "utopia-php/logger": "0.3.*", "utopia-php/messaging": "0.1.*", "utopia-php/orchestration": "0.6.*", - "utopia-php/preloader": "0.2.*", "utopia-php/registry": "0.5.*", "utopia-php/storage": "0.13.*", "utopia-php/swoole": "0.5.*", @@ -94,4 +94,4 @@ "php": "8.0" } } -} +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 434a34dae8..82a9de301f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "60bbe8610441d8b6e119bd322e0f5a13", + "content-hash": "ac80cafdd8c2c6deaec3dfe628084655", "packages": [ { "name": "adhocore/jwt", @@ -345,6 +345,79 @@ }, "time": "2022-11-09T01:18:39+00:00" }, + { + "name": "composer/package-versions-deprecated", + "version": "1.11.99.5", + "source": { + "type": "git", + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-17T14:14:24+00:00" + }, { "name": "dragonmantank/cron-expression", "version": "v3.3.1", @@ -804,6 +877,61 @@ "abandoned": true, "time": "2020-12-26T17:45:17+00:00" }, + { + "name": "jean85/pretty-package-versions", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "1e0104b46f045868f11942aea058cd7186d6c303" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/1e0104b46f045868f11942aea058cd7186d6c303", + "reference": "1e0104b46f045868f11942aea058cd7186d6c303", + "shasum": "" + }, + "require": { + "composer/package-versions-deprecated": "^1.8.0", + "php": "^7.0|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0|^8.5|^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A wrapper for ocramius/package-versions to get pretty versions strings", + "keywords": [ + "composer", + "package", + "release", + "versions" + ], + "support": { + "issues": "https://github.com/Jean85/pretty-package-versions/issues", + "source": "https://github.com/Jean85/pretty-package-versions/tree/1.6.0" + }, + "time": "2021-02-04T16:20:16+00:00" + }, { "name": "laravel/pint", "version": "v1.2.1", @@ -939,6 +1067,74 @@ }, "time": "2022-04-11T09:58:17+00:00" }, + { + "name": "mongodb/mongodb", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/mongodb/mongo-php-library.git", + "reference": "953dbc19443aa9314c44b7217a16873347e6840d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/953dbc19443aa9314c44b7217a16873347e6840d", + "reference": "953dbc19443aa9314c44b7217a16873347e6840d", + "shasum": "" + }, + "require": { + "ext-hash": "*", + "ext-json": "*", + "ext-mongodb": "^1.8.1", + "jean85/pretty-package-versions": "^1.2", + "php": "^7.0 || ^8.0", + "symfony/polyfill-php80": "^1.19" + }, + "require-dev": { + "squizlabs/php_codesniffer": "^3.5, <3.5.5", + "symfony/phpunit-bridge": "5.x-dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "MongoDB\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Andreas Braun", + "email": "andreas.braun@mongodb.com" + }, + { + "name": "Jeremy Mikola", + "email": "jmikola@gmail.com" + } + ], + "description": "MongoDB driver library", + "homepage": "https://jira.mongodb.org/browse/PHPLIB", + "keywords": [ + "database", + "driver", + "mongodb", + "persistence" + ], + "support": { + "issues": "https://github.com/mongodb/mongo-php-library/issues", + "source": "https://github.com/mongodb/mongo-php-library/tree/1.8.0" + }, + "time": "2020-11-25T12:26:02+00:00" + }, { "name": "mustangostang/spyc", "version": "0.6.3", @@ -1528,26 +1724,111 @@ "time": "2022-11-25T10:21:52+00:00" }, { - "name": "utopia-php/abuse", - "version": "0.16.0", + "name": "symfony/polyfill-php80", + "version": "v1.27.0", "source": { "type": "git", - "url": "https://github.com/utopia-php/abuse.git", - "reference": "6370d9150425460416583feba0990504ac789e98" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/6370d9150425460416583feba0990504ac789e98", - "reference": "6370d9150425460416583feba0990504ac789e98", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "utopia-php/abuse", + "version": "0.18.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/abuse.git", + "reference": "8496401234f73a49f8c4259d3e89ab4a7c1f9ecf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/8496401234f73a49f8c4259d3e89ab4a7c1f9ecf", + "reference": "8496401234f73a49f8c4259d3e89ab4a7c1f9ecf", "shasum": "" }, "require": { "ext-curl": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.28.*" + "utopia-php/database": "0.30.*" }, "require-dev": { + "laravel/pint": "1.2.*", + "phpstan/phpstan": "1.9.x-dev", "phpunit/phpunit": "^9.4", "vimeo/psalm": "4.0.1" }, @@ -1561,12 +1842,6 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - } - ], "description": "A simple abuse library to manage application usage limits", "keywords": [ "Abuse", @@ -1577,9 +1852,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.16.0" + "source": "https://github.com/utopia-php/abuse/tree/0.18.0" }, - "time": "2022-10-31T14:46:41+00:00" + "time": "2023-02-14T09:56:04+00:00" }, { "name": "utopia-php/analytics", @@ -1638,24 +1913,26 @@ }, { "name": "utopia-php/audit", - "version": "0.17.0", + "version": "0.20.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "455471bd4de8d74026809e843f8c9740eb32922c" + "reference": "3fce3f4ad3ea9dfcb39b79668abd76331412a5ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/455471bd4de8d74026809e843f8c9740eb32922c", - "reference": "455471bd4de8d74026809e843f8c9740eb32922c", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/3fce3f4ad3ea9dfcb39b79668abd76331412a5ed", + "reference": "3fce3f4ad3ea9dfcb39b79668abd76331412a5ed", "shasum": "" }, "require": { "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.28.*" + "utopia-php/database": "0.30.*" }, "require-dev": { + "laravel/pint": "1.2.*", + "phpstan/phpstan": "^1.8", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.0.1" }, @@ -1679,9 +1956,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.17.0" + "source": "https://github.com/utopia-php/audit/tree/0.20.0" }, - "time": "2022-10-31T14:44:52+00:00" + "time": "2023-02-14T09:46:54+00:00" }, { "name": "utopia-php/cache", @@ -1838,32 +2115,32 @@ }, { "name": "utopia-php/database", - "version": "0.28.0", + "version": "0.30.1", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "ef6506af1c09c22f5dc1e7859159d323f7fafa94" + "reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/ef6506af1c09c22f5dc1e7859159d323f7fafa94", - "reference": "ef6506af1c09c22f5dc1e7859159d323f7fafa94", + "url": "https://api.github.com/repos/utopia-php/database/zipball/1cea72c1217357bf0747ae4f28ebef57e9dc0e65", + "reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65", "shasum": "" }, "require": { "php": ">=8.0", "utopia-php/cache": "0.8.*", - "utopia-php/framework": "0.*.*" + "utopia-php/framework": "0.*.*", + "utopia-php/mongo": "0.0.2" }, "require-dev": { "ext-mongodb": "*", - "ext-pdo": "*", "ext-redis": "*", "fakerphp/faker": "^1.14", "mongodb/mongodb": "1.8.0", "phpunit/phpunit": "^9.4", "swoole/ide-helper": "4.8.0", - "utopia-php/cli": "^0.11.0", + "utopia-php/cli": "^0.14.0", "vimeo/psalm": "4.0.1" }, "type": "library", @@ -1886,9 +2163,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.28.0" + "source": "https://github.com/utopia-php/database/tree/0.30.1" }, - "time": "2022-10-31T09:58:46+00:00" + "time": "2023-02-14T06:25:03+00:00" }, { "name": "utopia-php/domains", @@ -2093,22 +2370,23 @@ }, { "name": "utopia-php/logger", - "version": "0.3.0", + "version": "0.3.1", "source": { "type": "git", "url": "https://github.com/utopia-php/logger.git", - "reference": "079656cb5169ca9600861eda0b6819199e3d4a57" + "reference": "de623f1ec1c672c795d113dd25c5bf212f7ef4fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/logger/zipball/079656cb5169ca9600861eda0b6819199e3d4a57", - "reference": "079656cb5169ca9600861eda0b6819199e3d4a57", + "url": "https://api.github.com/repos/utopia-php/logger/zipball/de623f1ec1c672c795d113dd25c5bf212f7ef4fc", + "reference": "de623f1ec1c672c795d113dd25c5bf212f7ef4fc", "shasum": "" }, "require": { "php": ">=8.0" }, "require-dev": { + "phpstan/phpstan": "1.9.x-dev", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.0.1" }, @@ -2122,20 +2400,6 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - }, - { - "name": "Matej Bačo", - "email": "matej@appwrite.io" - }, - { - "name": "Christy Jacob", - "email": "christy@appwrite.io" - } - ], "description": "Utopia Logger library is simple and lite library for logging information, such as errors or warnings. This library is aiming to be as simple and easy to learn and use.", "keywords": [ "appsignal", @@ -2153,9 +2417,9 @@ ], "support": { "issues": "https://github.com/utopia-php/logger/issues", - "source": "https://github.com/utopia-php/logger/tree/0.3.0" + "source": "https://github.com/utopia-php/logger/tree/0.3.1" }, - "time": "2022-03-18T10:56:57+00:00" + "time": "2023-02-10T15:52:50+00:00" }, { "name": "utopia-php/messaging", @@ -2205,6 +2469,66 @@ }, "time": "2023-02-07T05:42:46+00:00" }, + { + "name": "utopia-php/mongo", + "version": "0.0.2", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/mongo.git", + "reference": "62f9a9c0201af91b6d0dd4f0aa8a335ec9b56a1e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/mongo/zipball/62f9a9c0201af91b6d0dd4f0aa8a335ec9b56a1e", + "reference": "62f9a9c0201af91b6d0dd4f0aa8a335ec9b56a1e", + "shasum": "" + }, + "require": { + "ext-mongodb": "*", + "mongodb/mongodb": "1.8.0", + "php": ">=8.0" + }, + "require-dev": { + "fakerphp/faker": "^1.14", + "laravel/pint": "1.2.*", + "phpstan/phpstan": "1.8.*", + "phpunit/phpunit": "^9.4", + "swoole/ide-helper": "4.8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Mongo\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eldad Fux", + "email": "eldad@appwrite.io" + }, + { + "name": "Wess", + "email": "wess@appwrite.io" + } + ], + "description": "A simple library to manage Mongo database", + "keywords": [ + "database", + "mongo", + "php", + "upf", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/mongo/issues", + "source": "https://github.com/utopia-php/mongo/tree/0.0.2" + }, + "time": "2022-11-08T11:58:46+00:00" + }, { "name": "utopia-php/orchestration", "version": "0.6.0", @@ -3018,16 +3342,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -3068,9 +3392,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "time": "2022-11-12T15:38:23+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "phar-io/manifest", @@ -3350,20 +3674,20 @@ }, { "name": "phpspec/prophecy", - "version": "v1.16.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be8cac52a0827776ff9ccda8c381ac5b71aeb359" + "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be8cac52a0827776ff9ccda8c381ac5b71aeb359", - "reference": "be8cac52a0827776ff9ccda8c381ac5b71aeb359", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/15873c65b207b07765dbc3c95d20fdf4a320cbe2", + "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", + "doctrine/instantiator": "^1.2 || ^2.0", "php": "^7.2 || 8.0.* || 8.1.* || 8.2.*", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", @@ -3371,6 +3695,7 @@ }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", @@ -3411,22 +3736,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.16.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.17.0" }, - "time": "2022-11-29T15:06:56+00:00" + "time": "2023-02-02T15:41:36+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.23", + "version": "9.2.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", "shasum": "" }, "require": { @@ -3482,7 +3807,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" }, "funding": [ { @@ -3490,7 +3815,7 @@ "type": "github" } ], - "time": "2022-12-28T12:41:10+00:00" + "time": "2023-01-26T08:26:55+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4202,16 +4527,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -4253,7 +4578,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -4261,7 +4586,7 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", @@ -4575,16 +4900,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -4623,10 +4948,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -4634,7 +4959,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -4693,16 +5018,16 @@ }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -4737,7 +5062,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -4745,7 +5070,7 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", @@ -5164,16 +5489,16 @@ }, { "name": "twig/twig", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3ffcf4b7d890770466da3b2666f82ac054e7ec72" + "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3ffcf4b7d890770466da3b2666f82ac054e7ec72", - "reference": "3ffcf4b7d890770466da3b2666f82ac054e7ec72", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/a6e0510cc793912b451fd40ab983a1d28f611c15", + "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15", "shasum": "" }, "require": { @@ -5224,7 +5549,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.5.0" + "source": "https://github.com/twigphp/Twig/tree/v3.5.1" }, "funding": [ { @@ -5236,7 +5561,7 @@ "type": "tidelift" } ], - "time": "2022-12-27T12:28:18+00:00" + "time": "2023-02-08T07:49:20+00:00" } ], "aliases": [], @@ -5265,5 +5590,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/src/Appwrite/Auth/Auth.php b/src/Appwrite/Auth/Auth.php index a67b10150d..7217a87680 100644 --- a/src/Appwrite/Auth/Auth.php +++ b/src/Appwrite/Auth/Auth.php @@ -12,7 +12,7 @@ use Appwrite\Auth\Hash\Sha; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\DateTime; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Roles; diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index e37d9ace77..33fe484c13 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -6,8 +6,8 @@ use Utopia\Database\DateTime; use Utopia\Database\Document; use Appwrite\Messaging\Adapter; use Utopia\App; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; class Realtime extends Adapter { diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index d704281007..ab394f101f 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -10,7 +10,7 @@ use Utopia\CLI\Console; use Utopia\Config\Config; use Exception; use Utopia\App; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\Authorization; Runtime::enableCoroutine(SWOOLE_HOOK_ALL); diff --git a/src/Appwrite/Migration/Version/V15.php b/src/Appwrite/Migration/Version/V15.php index f549c7fbdf..ac948d01d2 100644 --- a/src/Appwrite/Migration/Version/V15.php +++ b/src/Appwrite/Migration/Version/V15.php @@ -11,9 +11,9 @@ use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class V15 extends Migration { diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php index 0e54977d60..4676849a74 100644 --- a/src/Appwrite/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/Specification/Format/OpenAPI3.php @@ -5,8 +5,8 @@ namespace Appwrite\Specification\Format; use Appwrite\Specification\Format; use Appwrite\Template\Template; use Appwrite\Utopia\Response\Model; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use Utopia\Validator; class OpenAPI3 extends Format diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index ea48d671f2..6f7c923aa9 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -5,8 +5,8 @@ namespace Appwrite\Specification\Format; use Appwrite\Specification\Format; use Appwrite\Template\Template; use Appwrite\Utopia\Response\Model; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use Utopia\Validator; class Swagger2 extends Format diff --git a/src/Appwrite/Utopia/Request/Filters/V15.php b/src/Appwrite/Utopia/Request/Filters/V15.php index 65b09e1f24..50e5ec0db7 100644 --- a/src/Appwrite/Utopia/Request/Filters/V15.php +++ b/src/Appwrite/Utopia/Request/Filters/V15.php @@ -4,9 +4,9 @@ namespace Appwrite\Utopia\Request\Filters; use Appwrite\Utopia\Request\Filter; use Utopia\Database\Database; -use Utopia\Database\Permission; +use Utopia\Database\Helpers\Permission; use Utopia\Database\Query; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; class V15 extends Filter { diff --git a/src/Appwrite/Utopia/Response/Filters/V15.php b/src/Appwrite/Utopia/Response/Filters/V15.php index a74f0f32ad..232feec201 100644 --- a/src/Appwrite/Utopia/Response/Filters/V15.php +++ b/src/Appwrite/Utopia/Response/Filters/V15.php @@ -5,8 +5,8 @@ namespace Appwrite\Utopia\Response\Filters; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Filter; use Utopia\Database\Database; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class V15 extends Filter { diff --git a/src/Appwrite/Utopia/Response/Model/Execution.php b/src/Appwrite/Utopia/Response/Model/Execution.php index 13011a24b7..8672a91598 100644 --- a/src/Appwrite/Utopia/Response/Model/Execution.php +++ b/src/Appwrite/Utopia/Response/Model/Execution.php @@ -4,7 +4,7 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Model; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Role; class Execution extends Model { diff --git a/tests/e2e/General/AbuseTest.php b/tests/e2e/General/AbuseTest.php index 90a4b33800..f5a2829974 100644 --- a/tests/e2e/General/AbuseTest.php +++ b/tests/e2e/General/AbuseTest.php @@ -8,9 +8,9 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideNone; use Utopia\App; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class AbuseTest extends Scope { diff --git a/tests/e2e/General/UsageTest.php b/tests/e2e/General/UsageTest.php index cbe90c91fb..afa8433cbb 100644 --- a/tests/e2e/General/UsageTest.php +++ b/tests/e2e/General/UsageTest.php @@ -9,9 +9,9 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; use CURLFile; use Tests\E2E\Services\Functions\FunctionsBase; -use Utopia\Database\DateTime; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\DatetimeValidator; class UsageTest extends Scope { @@ -601,6 +601,7 @@ class UsageTest extends Scope /** @depends testDatabaseStats */ public function testPrepareFunctionsStats(array $data): array { + $dateValidator = new DatetimeValidator(); $headers = $data['headers']; $functionId = ''; $executionTime = 0; @@ -642,7 +643,7 @@ class UsageTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); $this->assertNotEmpty($deployment['body']['$id']); - $this->assertEquals(true, DateTime::isValid($deployment['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($deployment['body']['$createdAt'])); $this->assertEquals('index.php', $deployment['body']['entrypoint']); // Wait for deployment to build. @@ -652,8 +653,8 @@ class UsageTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['$createdAt'])); - $this->assertEquals(true, DateTime::isValid($response['body']['$updatedAt'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$updatedAt'])); $this->assertEquals($deploymentId, $response['body']['deployment']); $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', $headers, [ diff --git a/tests/e2e/Scopes/ProjectConsole.php b/tests/e2e/Scopes/ProjectConsole.php index bc8ce4c0cf..dcc4aa7c33 100644 --- a/tests/e2e/Scopes/ProjectConsole.php +++ b/tests/e2e/Scopes/ProjectConsole.php @@ -2,7 +2,7 @@ namespace Tests\E2E\Scopes; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; trait ProjectConsole { diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index f2e4e84685..4d780d04c6 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -3,7 +3,7 @@ namespace Tests\E2E\Scopes; use Tests\E2E\Client; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; trait ProjectCustom { diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 23bdcdcaaa..42057e8e94 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -5,21 +5,14 @@ namespace Tests\E2E\Scopes; use Appwrite\Tests\Retryable; use Tests\E2E\Client; use PHPUnit\Framework\TestCase; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; abstract class Scope extends TestCase { use Retryable; - /** - * @var Client - */ - protected $client = null; - - /** - * @var string - */ - protected $endpoint = 'http://localhost/v1'; + protected ?Client $client = null; + protected string $endpoint = 'http://localhost/v1'; protected function setUp(): void { diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index e8bf146316..5b5c1ccc12 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -4,8 +4,9 @@ namespace Tests\E2E\Services\Account; use Appwrite\Tests\Retry; use Tests\E2E\Client; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; use Utopia\Database\DateTime; +use Utopia\Database\Validator\DatetimeValidator; trait AccountBase { @@ -34,7 +35,8 @@ trait AccountBase $this->assertEquals($response['headers']['status-code'], 201); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $this->assertEquals($response['body']['name'], $name); @@ -198,7 +200,8 @@ trait AccountBase $this->assertEquals($response['headers']['status-code'], 200); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $this->assertEquals($response['body']['name'], $name); @@ -343,7 +346,8 @@ trait AccountBase $this->assertIsNumeric($response['body']['total']); $this->assertContains($response['body']['logs'][1]['event'], ["session.create"]); $this->assertEquals($response['body']['logs'][1]['ip'], filter_var($response['body']['logs'][1]['ip'], FILTER_VALIDATE_IP)); - $this->assertEquals(true, DateTime::isValid($response['body']['logs'][1]['time'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['logs'][1]['time'])); $this->assertEquals('Windows', $response['body']['logs'][1]['osName']); $this->assertEquals('WIN', $response['body']['logs'][1]['osCode']); @@ -365,7 +369,7 @@ trait AccountBase $this->assertContains($response['body']['logs'][2]['event'], ["user.create"]); $this->assertEquals($response['body']['logs'][2]['ip'], filter_var($response['body']['logs'][2]['ip'], FILTER_VALIDATE_IP)); - $this->assertEquals(true, DateTime::isValid($response['body']['logs'][2]['time'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['logs'][2]['time'])); $this->assertEquals('Windows', $response['body']['logs'][2]['osName']); $this->assertEquals('WIN', $response['body']['logs'][2]['osCode']); @@ -476,7 +480,8 @@ trait AccountBase $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $this->assertEquals($response['body']['name'], $newName); @@ -543,7 +548,8 @@ trait AccountBase $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ @@ -633,7 +639,8 @@ trait AccountBase $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $newEmail); /** @@ -675,7 +682,7 @@ trait AccountBase $this->assertEquals($response['headers']['status-code'], 201); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $data['email']); $this->assertEquals($response['body']['name'], $data['name']); @@ -817,7 +824,8 @@ trait AccountBase $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertEmpty($response['body']['secret']); - $this->assertEquals(true, DateTime::isValid($response['body']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['expire'])); $lastEmail = $this->getLastEmail(); @@ -1119,7 +1127,8 @@ trait AccountBase $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertEmpty($response['body']['secret']); - $this->assertEquals(true, DateTime::isValid($response['body']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['expire'])); $lastEmail = $this->getLastEmail(); @@ -1273,7 +1282,8 @@ trait AccountBase $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertEmpty($response['body']['secret']); - $this->assertEquals(true, DateTime::isValid($response['body']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['expire'])); $userId = $response['body']['userId']; @@ -1379,7 +1389,8 @@ trait AccountBase $this->assertEquals($response['headers']['status-code'], 200); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $this->assertTrue($response['body']['emailVerification']); @@ -1439,7 +1450,8 @@ trait AccountBase $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index 9971b1bca3..47ed22be70 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -9,7 +9,8 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideClient; use Utopia\Database\DateTime; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\DatetimeValidator; use function sleep; @@ -449,7 +450,8 @@ class AccountCustomClientTest extends Scope $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ @@ -700,7 +702,8 @@ class AccountCustomClientTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertEmpty($response['body']['secret']); - $this->assertEquals(true, DateTime::isValid($response['body']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['expire'])); $userId = $response['body']['userId']; @@ -800,7 +803,8 @@ class AccountCustomClientTest extends Scope $this->assertEquals($response['headers']['status-code'], 200); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['phone'], $number); $this->assertTrue($response['body']['phoneVerification']); @@ -851,7 +855,8 @@ class AccountCustomClientTest extends Scope $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ @@ -893,7 +898,8 @@ class AccountCustomClientTest extends Scope $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['phone'], $newPhone); /** @@ -943,7 +949,8 @@ class AccountCustomClientTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertEmpty($response['body']['secret']); - $this->assertEquals(true, DateTime::isValid($response['body']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['expire'])); \sleep(2); diff --git a/tests/e2e/Services/Account/AccountCustomServerTest.php b/tests/e2e/Services/Account/AccountCustomServerTest.php index 85d140c829..143277608d 100644 --- a/tests/e2e/Services/Account/AccountCustomServerTest.php +++ b/tests/e2e/Services/Account/AccountCustomServerTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class AccountCustomServerTest extends Scope { diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index a183325039..13a95c9f09 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -3,11 +3,10 @@ namespace Tests\E2E\Services\Databases; use Tests\E2E\Client; -use Utopia\Database\Database; -use Utopia\Database\ID; -use Utopia\Database\DateTime; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\DatetimeValidator; trait DatabasesBase { @@ -1532,8 +1531,9 @@ trait DatabasesBase $this->assertEquals($databaseId, $document['body']['$databaseId']); $this->assertEquals($document['body']['title'], 'Thor: Ragnaroc'); $this->assertEquals($document['body']['releaseYear'], 2017); - $this->assertEquals(true, DateTime::isValid($document['body']['$createdAt'])); - $this->assertEquals(true, DateTime::isValid($document['body']['birthDay'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($document['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($document['body']['birthDay'])); $this->assertContains(Permission::read(Role::user($this->getUser()['$id'])), $document['body']['$permissions']); $this->assertContains(Permission::update(Role::user($this->getUser()['$id'])), $document['body']['$permissions']); $this->assertContains(Permission::delete(Role::user($this->getUser()['$id'])), $document['body']['$permissions']); diff --git a/tests/e2e/Services/Databases/DatabasesConsoleClientTest.php b/tests/e2e/Services/Databases/DatabasesConsoleClientTest.php index 71fa7a590f..ad97a2bb3e 100644 --- a/tests/e2e/Services/Databases/DatabasesConsoleClientTest.php +++ b/tests/e2e/Services/Databases/DatabasesConsoleClientTest.php @@ -6,9 +6,9 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Client; use Tests\E2E\Scopes\SideConsole; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class DatabasesConsoleClientTest extends Scope { diff --git a/tests/e2e/Services/Databases/DatabasesCustomClientTest.php b/tests/e2e/Services/Databases/DatabasesCustomClientTest.php index 9f86bb66c0..748070161d 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomClientTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomClientTest.php @@ -6,9 +6,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class DatabasesCustomClientTest extends Scope { diff --git a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php index bd4e8aa77b..19a56941eb 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php @@ -6,10 +6,9 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; use Tests\E2E\Client; -use Utopia\Database\Database; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class DatabasesCustomServerTest extends Scope { diff --git a/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php b/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php index 1c15a363a8..b1d197f010 100644 --- a/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php +++ b/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php @@ -6,9 +6,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; class DatabasesPermissionsGuestTest extends Scope diff --git a/tests/e2e/Services/Databases/DatabasesPermissionsMemberTest.php b/tests/e2e/Services/Databases/DatabasesPermissionsMemberTest.php index 59091956b0..860fb7fb12 100644 --- a/tests/e2e/Services/Databases/DatabasesPermissionsMemberTest.php +++ b/tests/e2e/Services/Databases/DatabasesPermissionsMemberTest.php @@ -6,9 +6,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class DatabasesPermissionsMemberTest extends Scope { diff --git a/tests/e2e/Services/Databases/DatabasesPermissionsTeamTest.php b/tests/e2e/Services/Databases/DatabasesPermissionsTeamTest.php index 07275c7524..8377b9c803 100644 --- a/tests/e2e/Services/Databases/DatabasesPermissionsTeamTest.php +++ b/tests/e2e/Services/Databases/DatabasesPermissionsTeamTest.php @@ -6,9 +6,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class DatabasesPermissionsTeamTest extends Scope { diff --git a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php index 68b9ac46ea..cd01b257a1 100644 --- a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php @@ -6,8 +6,8 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Client; use Tests\E2E\Scopes\SideConsole; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; class FunctionsConsoleClientTest extends Scope { diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 56b72e4468..57d237b9af 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -9,8 +9,8 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; use Utopia\CLI\Console; use Utopia\Database\Database; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; class FunctionsCustomClientTest extends Scope { diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 29ceb1254f..3fb8ee9171 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -8,10 +8,8 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\CLI\Console; -use Utopia\Database\Database; -use Utopia\Database\DateTime; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\DatetimeValidator; class FunctionsCustomServerTest extends Scope { @@ -45,8 +43,9 @@ class FunctionsCustomServerTest extends Scope $this->assertNotEmpty($response1['body']['$id']); $this->assertEquals('Test', $response1['body']['name']); $this->assertEquals('php-8.0', $response1['body']['runtime']); - $this->assertEquals(true, DateTime::isValid($response1['body']['$createdAt'])); - $this->assertEquals(true, DateTime::isValid($response1['body']['$updatedAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response1['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response1['body']['$updatedAt'])); $this->assertEquals('', $response1['body']['deployment']); $this->assertEquals([ 'users.*.create', @@ -328,8 +327,9 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(200, $response1['headers']['status-code']); $this->assertNotEmpty($response1['body']['$id']); $this->assertEquals('Test1', $response1['body']['name']); - $this->assertEquals(true, DateTime::isValid($response1['body']['$createdAt'])); - $this->assertEquals(true, DateTime::isValid($response1['body']['$updatedAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response1['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response1['body']['$updatedAt'])); $this->assertEquals('', $response1['body']['deployment']); $this->assertEquals([ 'users.*.update.name', @@ -369,7 +369,8 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); $this->assertNotEmpty($deployment['body']['$id']); - $this->assertEquals(true, DateTime::isValid($deployment['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($deployment['body']['$createdAt'])); $this->assertEquals('index.php', $deployment['body']['entrypoint']); // Wait for deployment to build. @@ -418,7 +419,8 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $largeTag['headers']['status-code']); $this->assertNotEmpty($largeTag['body']['$id']); - $this->assertEquals(true, DateTime::isValid($largeTag['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($largeTag['body']['$createdAt'])); $this->assertEquals('index.php', $largeTag['body']['entrypoint']); $this->assertGreaterThan(10000, $largeTag['body']['size']); @@ -440,8 +442,9 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['$createdAt'])); - $this->assertEquals(true, DateTime::isValid($response['body']['$updatedAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$updatedAt'])); $this->assertEquals($data['deploymentId'], $response['body']['deployment']); /** @@ -606,7 +609,8 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $execution['headers']['status-code']); $this->assertNotEmpty($execution['body']['$id']); $this->assertNotEmpty($execution['body']['functionId']); - $this->assertEquals(true, DateTime::isValid($execution['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($execution['body']['$createdAt'])); $this->assertEquals($data['functionId'], $execution['body']['functionId']); $this->assertEquals('waiting', $execution['body']['status']); $this->assertEquals(0, $execution['body']['statusCode']); @@ -623,7 +627,7 @@ class FunctionsCustomServerTest extends Scope $this->assertNotEmpty($execution['body']['$id']); $this->assertNotEmpty($execution['body']['functionId']); - $this->assertEquals(true, DateTime::isValid($execution['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($execution['body']['$createdAt'])); $this->assertEquals($data['functionId'], $execution['body']['functionId']); $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals(200, $execution['body']['statusCode']); diff --git a/tests/e2e/Services/GraphQL/AbuseTest.php b/tests/e2e/Services/GraphQL/AbuseTest.php index 7009ded82e..48ee64d141 100644 --- a/tests/e2e/Services/GraphQL/AbuseTest.php +++ b/tests/e2e/Services/GraphQL/AbuseTest.php @@ -7,9 +7,9 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; use Utopia\App; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class AbuseTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/AccountTest.php b/tests/e2e/Services/GraphQL/AccountTest.php index 0d2ccf62cc..7fd70b5015 100644 --- a/tests/e2e/Services/GraphQL/AccountTest.php +++ b/tests/e2e/Services/GraphQL/AccountTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class AccountTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/AuthTest.php b/tests/e2e/Services/GraphQL/AuthTest.php index 8eb0937d80..c331fb8437 100644 --- a/tests/e2e/Services/GraphQL/AuthTest.php +++ b/tests/e2e/Services/GraphQL/AuthTest.php @@ -6,9 +6,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; -use Utopia\Database\Role; -use Utopia\Database\Permission; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Helpers\Permission; class AuthTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/BatchTest.php b/tests/e2e/Services/GraphQL/BatchTest.php index dcb19e171a..7082d23677 100644 --- a/tests/e2e/Services/GraphQL/BatchTest.php +++ b/tests/e2e/Services/GraphQL/BatchTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class BatchTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/ContentTypeTest.php b/tests/e2e/Services/GraphQL/ContentTypeTest.php index 4a086feb2e..da885a2a83 100644 --- a/tests/e2e/Services/GraphQL/ContentTypeTest.php +++ b/tests/e2e/Services/GraphQL/ContentTypeTest.php @@ -7,9 +7,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class ContentTypeTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/DatabaseClientTest.php b/tests/e2e/Services/GraphQL/DatabaseClientTest.php index 9353e681b2..3853a3fc17 100644 --- a/tests/e2e/Services/GraphQL/DatabaseClientTest.php +++ b/tests/e2e/Services/GraphQL/DatabaseClientTest.php @@ -6,9 +6,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class DatabaseClientTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/DatabaseServerTest.php b/tests/e2e/Services/GraphQL/DatabaseServerTest.php index fd5545e6cd..bc5bca60ca 100644 --- a/tests/e2e/Services/GraphQL/DatabaseServerTest.php +++ b/tests/e2e/Services/GraphQL/DatabaseServerTest.php @@ -7,9 +7,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class DatabaseServerTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/FunctionsClientTest.php b/tests/e2e/Services/GraphQL/FunctionsClientTest.php index 7bfcd66d4d..d5b50250d4 100644 --- a/tests/e2e/Services/GraphQL/FunctionsClientTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsClientTest.php @@ -7,8 +7,8 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; class FunctionsClientTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/FunctionsServerTest.php b/tests/e2e/Services/GraphQL/FunctionsServerTest.php index a51072bb92..75aa0d5d04 100644 --- a/tests/e2e/Services/GraphQL/FunctionsServerTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsServerTest.php @@ -7,8 +7,8 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; class FunctionsServerTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/ScopeTest.php b/tests/e2e/Services/GraphQL/ScopeTest.php index 03be6e3f70..a8b5b7cea4 100644 --- a/tests/e2e/Services/GraphQL/ScopeTest.php +++ b/tests/e2e/Services/GraphQL/ScopeTest.php @@ -7,7 +7,7 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class ScopeTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/StorageClientTest.php b/tests/e2e/Services/GraphQL/StorageClientTest.php index 55fc10b064..9896598c2d 100644 --- a/tests/e2e/Services/GraphQL/StorageClientTest.php +++ b/tests/e2e/Services/GraphQL/StorageClientTest.php @@ -7,9 +7,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class StorageClientTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/StorageServerTest.php b/tests/e2e/Services/GraphQL/StorageServerTest.php index fc6c23f12d..afaef08321 100644 --- a/tests/e2e/Services/GraphQL/StorageServerTest.php +++ b/tests/e2e/Services/GraphQL/StorageServerTest.php @@ -7,9 +7,9 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class StorageServerTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/TeamsClientTest.php b/tests/e2e/Services/GraphQL/TeamsClientTest.php index 6fb2ba87e6..87dbfcca00 100644 --- a/tests/e2e/Services/GraphQL/TeamsClientTest.php +++ b/tests/e2e/Services/GraphQL/TeamsClientTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class TeamsClientTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/TeamsServerTest.php b/tests/e2e/Services/GraphQL/TeamsServerTest.php index 118086834a..41577e6f42 100644 --- a/tests/e2e/Services/GraphQL/TeamsServerTest.php +++ b/tests/e2e/Services/GraphQL/TeamsServerTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class TeamsServerTest extends Scope { diff --git a/tests/e2e/Services/GraphQL/UsersTest.php b/tests/e2e/Services/GraphQL/UsersTest.php index 99229b46d7..9bd503df0f 100644 --- a/tests/e2e/Services/GraphQL/UsersTest.php +++ b/tests/e2e/Services/GraphQL/UsersTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; use Utopia\Database\Query; class UsersTest extends Scope diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 0766da77d9..29282fbc2b 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -10,7 +10,7 @@ use Tests\E2E\Services\Projects\ProjectsBase; use Tests\E2E\Client; use Utopia\Database\Database; use Utopia\Database\DateTime; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class ProjectsConsoleClientTest extends Scope { diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index 500b3d48be..cd2fb6f13b 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -8,9 +8,9 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideConsole; use Tests\E2E\Services\Functions\FunctionsBase; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class RealtimeConsoleClientTest extends Scope { diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php index 71c37678ed..5910c9975a 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php @@ -8,9 +8,9 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideClient; use Utopia\CLI\Console; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use WebSocket\ConnectionException; class RealtimeCustomClientTest extends Scope diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index b4c28b0fa2..72d3a99537 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -4,10 +4,10 @@ namespace Tests\E2E\Services\Storage; use CURLFile; use Tests\E2E\Client; -use Utopia\Database\DateTime; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\DatetimeValidator; trait StorageBase { @@ -52,7 +52,8 @@ trait StorageBase ]); $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($file['body']['$id']); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('logo.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); @@ -120,7 +121,7 @@ trait StorageBase $this->assertEquals(201, $largeFile['headers']['status-code']); $this->assertNotEmpty($largeFile['body']['$id']); - $this->assertEquals(true, DateTime::isValid($largeFile['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($largeFile['body']['$createdAt'])); $this->assertEquals('large-file.mp4', $largeFile['body']['name']); $this->assertEquals('video/mp4', $largeFile['body']['mimeType']); $this->assertEquals($totalSize, $largeFile['body']['sizeOriginal']); @@ -283,7 +284,8 @@ trait StorageBase ]); $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($file['body']['$id']); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('logo.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); @@ -373,7 +375,8 @@ trait StorageBase $this->assertEquals(200, $file1['headers']['status-code']); $this->assertNotEmpty($file1['body']['$id']); - $this->assertEquals(true, DateTime::isValid($file1['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file1['body']['$createdAt'])); $this->assertEquals('logo.png', $file1['body']['name']); $this->assertEquals('image/png', $file1['body']['mimeType']); $this->assertEquals(47218, $file1['body']['sizeOriginal']); @@ -712,7 +715,8 @@ trait StorageBase $this->assertEquals(200, $file['headers']['status-code']); $this->assertNotEmpty($file['body']['$id']); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('logo.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index 8b4aaa1fca..8fda8e0464 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideConsole; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class StorageConsoleClientTest extends Scope { diff --git a/tests/e2e/Services/Storage/StorageCustomClientTest.php b/tests/e2e/Services/Storage/StorageCustomClientTest.php index fdb158ae5b..46ef1d6986 100644 --- a/tests/e2e/Services/Storage/StorageCustomClientTest.php +++ b/tests/e2e/Services/Storage/StorageCustomClientTest.php @@ -2,21 +2,15 @@ namespace Tests\E2E\Services\Storage; -use Appwrite\Auth\Auth; use CURLFile; -use Exception; -use PharIo\Manifest\Author; -use SebastianBergmann\RecursionContext\InvalidArgumentException; -use PHPUnit\Framework\ExpectationFailedException; use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\DateTime; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; -use Utopia\Database\Validator\Authorization; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\DatetimeValidator; class StorageCustomClientTest extends Scope { @@ -63,7 +57,8 @@ class StorageCustomClientTest extends Scope $fileId = $file['body']['$id']; $this->assertEquals($file['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); @@ -159,7 +154,8 @@ class StorageCustomClientTest extends Scope $fileId = $file['body']['$id']; $this->assertEquals($file['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); @@ -245,7 +241,8 @@ class StorageCustomClientTest extends Scope $fileId = $file['body']['$id']; $this->assertEquals($file['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); @@ -370,7 +367,8 @@ class StorageCustomClientTest extends Scope $fileId = $file['body']['$id']; $this->assertEquals($file['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); @@ -548,7 +546,8 @@ class StorageCustomClientTest extends Scope $fileId = $file['body']['$id']; $this->assertEquals($file['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); @@ -710,7 +709,8 @@ class StorageCustomClientTest extends Scope $fileId = $file1['body']['$id']; $this->assertEquals($file1['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file1['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file1['body']['$createdAt'])); $this->assertEquals('permissions.png', $file1['body']['name']); $this->assertEquals('image/png', $file1['body']['mimeType']); $this->assertEquals(47218, $file1['body']['sizeOriginal']); @@ -799,7 +799,8 @@ class StorageCustomClientTest extends Scope $fileId = $file1['body']['$id']; $this->assertEquals($file1['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file1['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file1['body']['$createdAt'])); $this->assertEquals('permissions.png', $file1['body']['name']); $this->assertEquals('image/png', $file1['body']['mimeType']); $this->assertEquals(47218, $file1['body']['sizeOriginal']); @@ -888,7 +889,8 @@ class StorageCustomClientTest extends Scope $fileId = $file1['body']['$id']; $this->assertEquals($file1['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file1['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file1['body']['$createdAt'])); $this->assertEquals('permissions.png', $file1['body']['name']); $this->assertEquals('image/png', $file1['body']['mimeType']); $this->assertEquals(47218, $file1['body']['sizeOriginal']); @@ -1027,7 +1029,8 @@ class StorageCustomClientTest extends Scope $fileId = $file['body']['$id']; $this->assertEquals($file['headers']['status-code'], 201); $this->assertNotEmpty($fileId); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); @@ -1262,7 +1265,8 @@ class StorageCustomClientTest extends Scope $this->assertContains(Permission::read(Role::user($this->getUser()['$id'])), $file['body']['$permissions']); $this->assertContains(Permission::update(Role::user($this->getUser()['$id'])), $file['body']['$permissions']); $this->assertContains(Permission::delete(Role::user($this->getUser()['$id'])), $file['body']['$permissions']); - $this->assertEquals(true, DateTime::isValid($file['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); diff --git a/tests/e2e/Services/Storage/StorageCustomServerTest.php b/tests/e2e/Services/Storage/StorageCustomServerTest.php index ac03f2b83c..86c9c54302 100644 --- a/tests/e2e/Services/Storage/StorageCustomServerTest.php +++ b/tests/e2e/Services/Storage/StorageCustomServerTest.php @@ -6,8 +6,8 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\Database\DateTime; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\DatetimeValidator; class StorageCustomServerTest extends Scope { @@ -30,7 +30,8 @@ class StorageCustomServerTest extends Scope ]); $this->assertEquals(201, $bucket['headers']['status-code']); $this->assertNotEmpty($bucket['body']['$id']); - $this->assertEquals(true, DateTime::isValid($bucket['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($bucket['body']['$createdAt'])); $this->assertIsArray($bucket['body']['$permissions']); $this->assertIsArray($bucket['body']['allowedFileExtensions']); $this->assertEquals('Test Bucket', $bucket['body']['name']); @@ -228,7 +229,8 @@ class StorageCustomServerTest extends Scope ]); $this->assertEquals(200, $bucket['headers']['status-code']); $this->assertNotEmpty($bucket['body']['$id']); - $this->assertEquals(true, DateTime::isValid($bucket['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($bucket['body']['$createdAt'])); $this->assertIsArray($bucket['body']['$permissions']); $this->assertIsArray($bucket['body']['allowedFileExtensions']); $this->assertEquals('Test Bucket Updated', $bucket['body']['name']); diff --git a/tests/e2e/Services/Teams/TeamsBase.php b/tests/e2e/Services/Teams/TeamsBase.php index 854a041503..daaf65494d 100644 --- a/tests/e2e/Services/Teams/TeamsBase.php +++ b/tests/e2e/Services/Teams/TeamsBase.php @@ -3,9 +3,8 @@ namespace Tests\E2E\Services\Teams; use Tests\E2E\Client; -use Utopia\Database\Database; -use Utopia\Database\DateTime; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\DatetimeValidator; trait TeamsBase { @@ -28,7 +27,8 @@ trait TeamsBase $this->assertEquals('Arsenal', $response1['body']['name']); $this->assertGreaterThan(-1, $response1['body']['total']); $this->assertIsInt($response1['body']['total']); - $this->assertEquals(true, DateTime::isValid($response1['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response1['body']['$createdAt'])); $teamUid = $response1['body']['$id']; $teamName = $response1['body']['name']; @@ -48,7 +48,7 @@ trait TeamsBase $this->assertEquals('Manchester United', $response2['body']['name']); $this->assertGreaterThan(-1, $response2['body']['total']); $this->assertIsInt($response2['body']['total']); - $this->assertEquals(true, DateTime::isValid($response2['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response2['body']['$createdAt'])); $response3 = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ 'content-type' => 'application/json', @@ -63,7 +63,7 @@ trait TeamsBase $this->assertEquals('Newcastle', $response3['body']['name']); $this->assertGreaterThan(-1, $response3['body']['total']); $this->assertIsInt($response3['body']['total']); - $this->assertEquals(true, DateTime::isValid($response3['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response3['body']['$createdAt'])); /** * Test for FAILURE */ @@ -98,7 +98,8 @@ trait TeamsBase $this->assertEquals('Arsenal', $response['body']['name']); $this->assertGreaterThan(-1, $response['body']['total']); $this->assertIsInt($response['body']['total']); - $this->assertEquals(true, DateTime::isValid($response['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); /** * Test for FAILURE @@ -275,7 +276,8 @@ trait TeamsBase $this->assertEquals('Demo', $response['body']['name']); $this->assertGreaterThan(-1, $response['body']['total']); $this->assertIsInt($response['body']['total']); - $this->assertEquals(true, DateTime::isValid($response['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); $response = $this->client->call(Client::METHOD_PUT, '/teams/' . $response['body']['$id'], array_merge([ 'content-type' => 'application/json', @@ -290,7 +292,7 @@ trait TeamsBase $this->assertEquals('Demo New', $response['body']['name']); $this->assertGreaterThan(-1, $response['body']['total']); $this->assertIsInt($response['body']['total']); - $this->assertEquals(true, DateTime::isValid($response['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); /** * Test for FAILURE @@ -326,7 +328,8 @@ trait TeamsBase $this->assertEquals('Demo', $response['body']['name']); $this->assertGreaterThan(-1, $response['body']['total']); $this->assertIsInt($response['body']['total']); - $this->assertEquals(true, DateTime::isValid($response['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); $response = $this->client->call(Client::METHOD_DELETE, '/teams/' . $teamUid, array_merge([ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Teams/TeamsBaseClient.php b/tests/e2e/Services/Teams/TeamsBaseClient.php index 788626b102..4e6cf85a10 100644 --- a/tests/e2e/Services/Teams/TeamsBaseClient.php +++ b/tests/e2e/Services/Teams/TeamsBaseClient.php @@ -3,8 +3,8 @@ namespace Tests\E2E\Services\Teams; use Tests\E2E\Client; -use Utopia\Database\DateTime; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\DatetimeValidator; trait TeamsBaseClient { @@ -150,7 +150,8 @@ trait TeamsBaseClient $this->assertNotEmpty($response['body']['teamId']); $this->assertNotEmpty($response['body']['teamName']); $this->assertCount(2, $response['body']['roles']); - $this->assertEquals(false, DateTime::isValid($response['body']['joined'])); // is null in DB + $dateValidator = new DatetimeValidator(); + $this->assertEquals(false, $dateValidator->isValid($response['body']['joined'])); // is null in DB $this->assertEquals(false, $response['body']['confirm']); /** @@ -203,7 +204,8 @@ trait TeamsBaseClient $this->assertNotEmpty($response['body']['teamId']); $this->assertNotEmpty($response['body']['teamName']); $this->assertCount(2, $response['body']['roles']); - $this->assertEquals(false, DateTime::isValid($response['body']['joined'])); // is null in DB + $dateValidator = new DatetimeValidator(); + $this->assertEquals(false, $dateValidator->isValid($response['body']['joined'])); // is null in DB $this->assertEquals(false, $response['body']['confirm']); $lastEmail = $this->getLastEmail(); @@ -337,7 +339,8 @@ trait TeamsBaseClient $this->assertNotEmpty($response['body']['userId']); $this->assertNotEmpty($response['body']['teamId']); $this->assertCount(2, $response['body']['roles']); - $this->assertEquals(true, DateTime::isValid($response['body']['joined'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['joined'])); $this->assertEquals(true, $response['body']['confirm']); $session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']]; $data['session'] = $session; @@ -369,7 +372,7 @@ trait TeamsBaseClient $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $this->assertEquals($response['body']['name'], $name); @@ -403,7 +406,7 @@ trait TeamsBaseClient $this->assertIsArray($response['body']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, DateTime::isValid($response['body']['registration'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['registration'])); $this->assertEquals($response['body']['email'], $email); $this->assertEquals($response['body']['name'], $name); diff --git a/tests/e2e/Services/Teams/TeamsBaseServer.php b/tests/e2e/Services/Teams/TeamsBaseServer.php index df508e5e37..0714192bdf 100644 --- a/tests/e2e/Services/Teams/TeamsBaseServer.php +++ b/tests/e2e/Services/Teams/TeamsBaseServer.php @@ -3,8 +3,7 @@ namespace Tests\E2E\Services\Teams; use Tests\E2E\Client; -use Utopia\Database\Database; -use Utopia\Database\DateTime; +use Utopia\Database\Validator\DatetimeValidator; trait TeamsBaseServer { @@ -57,7 +56,8 @@ trait TeamsBaseServer $this->assertNotEmpty($response['body']['teamId']); $this->assertNotEmpty($response['body']['teamName']); $this->assertCount(2, $response['body']['roles']); - $this->assertEquals(true, DateTime::isValid($response['body']['joined'])); // is null in DB + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['joined'])); // is null in DB $this->assertEquals(true, $response['body']['confirm']); /** @@ -108,7 +108,8 @@ trait TeamsBaseServer $this->assertEquals($email, $response['body']['userEmail']); $this->assertNotEmpty($response['body']['teamId']); $this->assertCount(2, $response['body']['roles']); - $this->assertEquals(true, DateTime::isValid($response['body']['joined'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['joined'])); $this->assertEquals(true, $response['body']['confirm']); $userUid = $response['body']['userId']; @@ -252,7 +253,8 @@ trait TeamsBaseServer $this->assertEquals('Arsenal', $response['body']['name']); $this->assertEquals(1, $response['body']['total']); $this->assertIsInt($response['body']['total']); - $this->assertEquals(true, DateTime::isValid($response['body']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); /** Delete User */ $user = $this->client->call(Client::METHOD_DELETE, '/users/' . $userUid, array_merge([ @@ -277,6 +279,6 @@ trait TeamsBaseServer $this->assertEquals('Arsenal', $response['body']['name']); $this->assertEquals(0, $response['body']['total']); $this->assertIsInt($response['body']['total']); - $this->assertEquals(true, DateTime::isValid($response['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); } } diff --git a/tests/e2e/Services/Teams/TeamsConsoleClientTest.php b/tests/e2e/Services/Teams/TeamsConsoleClientTest.php index 0f32425c92..e86c18a8e2 100644 --- a/tests/e2e/Services/Teams/TeamsConsoleClientTest.php +++ b/tests/e2e/Services/Teams/TeamsConsoleClientTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectConsole; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class TeamsConsoleClientTest extends Scope { diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index 4cdeff936a..fde65e94ec 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -4,7 +4,7 @@ namespace Tests\E2E\Services\Users; use Appwrite\Tests\Retry; use Tests\E2E\Client; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; trait UsersBase { diff --git a/tests/e2e/Services/Webhooks/WebhooksBase.php b/tests/e2e/Services/Webhooks/WebhooksBase.php index bb7edfdb46..1afa9cdb52 100644 --- a/tests/e2e/Services/Webhooks/WebhooksBase.php +++ b/tests/e2e/Services/Webhooks/WebhooksBase.php @@ -5,10 +5,10 @@ namespace Tests\E2E\Services\Webhooks; use Appwrite\Tests\Retry; use CURLFile; use Tests\E2E\Client; -use Utopia\Database\DateTime; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\DatetimeValidator; trait WebhooksBase { @@ -529,7 +529,8 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['$id']); $this->assertIsArray($webhook['data']['$permissions']); $this->assertEquals($webhook['data']['name'], 'logo.png'); - $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['$createdAt'])); $this->assertNotEmpty($webhook['data']['signature']); $this->assertEquals($webhook['data']['mimeType'], 'image/png'); $this->assertEquals($webhook['data']['sizeOriginal'], 47218); @@ -587,7 +588,8 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['$id']); $this->assertIsArray($webhook['data']['$permissions']); $this->assertEquals($webhook['data']['name'], 'logo.png'); - $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['$createdAt'])); $this->assertNotEmpty($webhook['data']['signature']); $this->assertEquals($webhook['data']['mimeType'], 'image/png'); $this->assertEquals($webhook['data']['sizeOriginal'], 47218); @@ -637,7 +639,8 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['$id']); $this->assertIsArray($webhook['data']['$permissions']); $this->assertEquals($webhook['data']['name'], 'logo.png'); - $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['$createdAt'])); $this->assertNotEmpty($webhook['data']['signature']); $this->assertEquals($webhook['data']['mimeType'], 'image/png'); $this->assertEquals($webhook['data']['sizeOriginal'], 47218); @@ -719,7 +722,8 @@ trait WebhooksBase $this->assertEquals('Arsenal', $webhook['data']['name']); $this->assertGreaterThan(-1, $webhook['data']['total']); $this->assertIsInt($webhook['data']['total']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['$createdAt'])); /** * Test for FAILURE @@ -764,7 +768,8 @@ trait WebhooksBase $this->assertEquals('Demo New', $webhook['data']['name']); $this->assertGreaterThan(-1, $webhook['data']['total']); $this->assertIsInt($webhook['data']['total']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['$createdAt'])); /** * Test for FAILURE @@ -813,7 +818,8 @@ trait WebhooksBase $this->assertEquals('Chelsea', $webhook['data']['name']); $this->assertGreaterThan(-1, $webhook['data']['total']); $this->assertIsInt($webhook['data']['total']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['$createdAt'])); /** * Test for FAILURE @@ -874,7 +880,8 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['teamId']); $this->assertCount(2, $webhook['data']['roles']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['invited'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['invited'])); $this->assertEquals(('server' === $this->getSide()), $webhook['data']['confirm']); /** @@ -946,7 +953,8 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['teamId']); $this->assertCount(2, $webhook['data']['roles']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['invited'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['invited'])); $this->assertEquals(('server' === $this->getSide()), $webhook['data']['confirm']); } } diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php index 9e26322931..aaf7901e19 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php @@ -7,8 +7,8 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\SideClient; -use Utopia\Database\DateTime; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\DatetimeValidator; class WebhooksCustomClientTest extends Scope { @@ -60,7 +60,8 @@ class WebhooksCustomClientTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id']), true); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $name); - $this->assertEquals(true, DateTime::isValid($webhook['data']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['registration'])); $this->assertEquals($webhook['data']['status'], true); $this->assertEquals($webhook['data']['email'], $email); $this->assertEquals($webhook['data']['emailVerification'], false); @@ -136,7 +137,8 @@ class WebhooksCustomClientTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $name); - $this->assertEquals(true, DateTime::isValid($webhook['data']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['registration'])); $this->assertEquals($webhook['data']['status'], false); $this->assertEquals($webhook['data']['email'], $email); $this->assertEquals($webhook['data']['emailVerification'], false); @@ -196,7 +198,8 @@ class WebhooksCustomClientTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id']), true); $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['expire'])); $this->assertEquals($webhook['data']['ip'], '127.0.0.1'); $this->assertNotEmpty($webhook['data']['osCode']); $this->assertIsString($webhook['data']['osCode']); @@ -371,7 +374,8 @@ class WebhooksCustomClientTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['expire'])); $this->assertEquals($webhook['data']['ip'], '127.0.0.1'); $this->assertNotEmpty($webhook['data']['osCode']); $this->assertIsString($webhook['data']['osCode']); @@ -683,7 +687,8 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['expire'])); $data['secret'] = $webhook['data']['secret']; @@ -743,7 +748,8 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['expire'])); $data['secret'] = $webhook['data']['secret']; @@ -799,7 +805,8 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['expire'])); $data['secret'] = $webhook['data']['secret']; @@ -857,7 +864,8 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['expire'])); $data['secret'] = $webhook['data']['secret']; @@ -920,7 +928,8 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['teamId']); $this->assertCount(2, $webhook['data']['roles']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['joined'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['joined'])); $this->assertEquals(true, $webhook['data']['confirm']); /** diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index f2f4b27260..0ccb138d44 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -8,10 +8,10 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; use Utopia\CLI\Console; -use Utopia\Database\DateTime; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\DatetimeValidator; class WebhooksCustomServerTest extends Scope { @@ -245,7 +245,8 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $name); - $this->assertEquals(true, DateTime::isValid($webhook['data']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['registration'])); $this->assertEquals($webhook['data']['status'], true); $this->assertEquals($webhook['data']['email'], $email); $this->assertEquals($webhook['data']['emailVerification'], false); @@ -336,7 +337,8 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $data['name']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['registration'])); $this->assertEquals($webhook['data']['status'], false); $this->assertEquals($webhook['data']['email'], $data['email']); $this->assertEquals($webhook['data']['emailVerification'], false); @@ -378,7 +380,8 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $data['name']); - $this->assertEquals(true, DateTime::isValid($webhook['data']['registration'])); + $dateValidator = new DatetimeValidator(); + $this->assertEquals(true, $dateValidator->isValid($webhook['data']['registration'])); $this->assertEquals($webhook['data']['status'], false); $this->assertEquals($webhook['data']['email'], $data['email']); $this->assertEquals($webhook['data']['emailVerification'], false); diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php index c23f258a00..67c1215c4c 100644 --- a/tests/extensions/TestHook.php +++ b/tests/extensions/TestHook.php @@ -3,9 +3,11 @@ namespace Appwrite\Tests; use PHPUnit\Runner\AfterTestHook; +use Exception; class TestHook implements AfterTestHook { + protected const MAX_SECONDS_ALLOWED = 15; public function executeAfterTest(string $test, float $time): void { printf( @@ -13,5 +15,9 @@ class TestHook implements AfterTestHook $test, $time * 1000 ); + + if ($time > self::MAX_SECONDS_ALLOWED) { + fwrite(STDOUT, sprintf("\e[31mThe %s test is slow, it took %s seconds!\n\e[0m", $test, $time)); + } } } diff --git a/tests/unit/Auth/AuthTest.php b/tests/unit/Auth/AuthTest.php index a4ed5740cb..e64ef37dfe 100644 --- a/tests/unit/Auth/AuthTest.php +++ b/tests/unit/Auth/AuthTest.php @@ -5,8 +5,8 @@ namespace Tests\Unit\Auth; use Appwrite\Auth\Auth; use Utopia\Database\DateTime; use Utopia\Database\Document; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use PHPUnit\Framework\TestCase; use Utopia\Database\Database; diff --git a/tests/unit/Messaging/MessagingChannelsTest.php b/tests/unit/Messaging/MessagingChannelsTest.php index 392f6d56fe..6fe7dda71f 100644 --- a/tests/unit/Messaging/MessagingChannelsTest.php +++ b/tests/unit/Messaging/MessagingChannelsTest.php @@ -6,8 +6,8 @@ use Appwrite\Auth\Auth; use Utopia\Database\Document; use Appwrite\Messaging\Adapter\Realtime; use PHPUnit\Framework\TestCase; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; class MessagingChannelsTest extends TestCase { diff --git a/tests/unit/Messaging/MessagingGuestTest.php b/tests/unit/Messaging/MessagingGuestTest.php index d8ed58ad40..1aaa1febca 100644 --- a/tests/unit/Messaging/MessagingGuestTest.php +++ b/tests/unit/Messaging/MessagingGuestTest.php @@ -4,8 +4,8 @@ namespace Tests\Unit\Messaging; use Appwrite\Messaging\Adapter\Realtime; use PHPUnit\Framework\TestCase; -use Utopia\Database\ID; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Role; class MessagingGuestTest extends TestCase { diff --git a/tests/unit/Messaging/MessagingTest.php b/tests/unit/Messaging/MessagingTest.php index 0b7baf2631..c2e3971945 100644 --- a/tests/unit/Messaging/MessagingTest.php +++ b/tests/unit/Messaging/MessagingTest.php @@ -5,9 +5,9 @@ namespace Tests\Unit\Messaging; use Utopia\Database\Document; use Appwrite\Messaging\Adapter\Realtime; use PHPUnit\Framework\TestCase; -use Utopia\Database\ID; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; class MessagingTest extends TestCase { diff --git a/tests/unit/Network/Validators/OriginTest.php b/tests/unit/Network/Validators/OriginTest.php index cfbccfafdf..d9bc77c19f 100644 --- a/tests/unit/Network/Validators/OriginTest.php +++ b/tests/unit/Network/Validators/OriginTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Network\Validators; use Appwrite\Network\Validator\Origin; use PHPUnit\Framework\TestCase; -use Utopia\Database\ID; +use Utopia\Database\Helpers\ID; class OriginTest extends TestCase { diff --git a/tests/unit/Utopia/Response/Filters/V15Test.php b/tests/unit/Utopia/Response/Filters/V15Test.php index ce7870483c..ab3a0b06ed 100644 --- a/tests/unit/Utopia/Response/Filters/V15Test.php +++ b/tests/unit/Utopia/Response/Filters/V15Test.php @@ -4,8 +4,8 @@ namespace Tests\Unit\Utopia\Response\Filters; use Appwrite\Utopia\Response\Filters\V15; use Appwrite\Utopia\Response; -use Utopia\Database\Permission; -use Utopia\Database\Role; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; use PHPUnit\Framework\TestCase; use stdClass;