From 93ec139171d023f210f0b7464266b6fc42b4d838 Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 13 Nov 2024 23:17:29 +0000 Subject: [PATCH] Rename and a set of reworks. - Aiwass -> RPCii - Swapped the meaning of "Procedure" and "Action" - IRpcActionHandler is now RpcHandler, abstract class no longer exists like Index - Anything suffixed by Trait is now suffixed by Common - All I prefixes on interfaces are gone - A PHP StreamWrapper implementation of HttpRequest added as a fallback for when cURL isnt installed - HttpRpcServer now hosts on /_rpcii instead of /_aiwass - Packagist package is now flashii/rpcii instead of flashwave/aiwass That's probably all of it but I probably forgor. --- README.md | 18 +-- VERSION | 2 +- composer.json | 12 +- composer.lock | 144 +++++++++--------- phpdoc.xml | 6 +- phpstan.neon | 2 + phpunit.xml | 2 +- src/Client/CurlHttpRequest.php | 13 +- .../{IHttpRequest.php => HttpRequest.php} | 9 +- src/Client/HttpRpcClient.php | 73 +++++++++ src/Client/IRpcClient.php | 37 ----- src/Client/RpcClient.php | 85 ++++------- src/Client/RpcClientScoped.php | 32 ---- src/Client/ScopedRpcClient.php | 32 ++++ src/Client/StreamHttpRequest.php | 75 +++++++++ src/HmacVerificationProvider.php | 26 ++-- src/{Aiwass.php => RPCii.php} | 14 +- src/{AiwassMsgPack.php => RpciiMsgPack.php} | 10 +- src/Server/HttpRpcServer.php | 45 ++++++ src/Server/IRpcActionHandler.php | 18 --- src/Server/IRpcServer.php | 68 --------- src/Server/RpcAction.php | 60 +------- src/Server/RpcActionHandler.php | 14 -- src/Server/RpcActionHandlerTrait.php | 16 -- src/Server/RpcHandler.php | 18 +++ src/Server/RpcHandlerCommon.php | 16 ++ src/Server/RpcProcedure.php | 58 ++++++- ...RpcActionInfo.php => RpcProcedureInfo.php} | 34 ++--- src/Server/RpcQuery.php | 10 +- src/Server/RpcRouteHandler.php | 56 +++---- src/Server/RpcServer.php | 79 ++++++---- src/Server/RpcServerCommon.php | 23 +++ src/Server/RpcServerScoped.php | 34 ----- src/Server/RpcServerTrait.php | 23 --- src/Server/ScopedRpcServer.php | 34 +++++ ...nProvider.php => VerificationProvider.php} | 16 +- tests/AttributesTest.php | 78 +++++----- tests/CurlHttpTest.php | 26 +++- tests/HmacVerificationTest.php | 20 +-- tests/ScopedServerTest.php | 26 ++-- tests/StreamHttpTest.php | 59 +++++++ 41 files changed, 782 insertions(+), 641 deletions(-) rename src/Client/{IHttpRequest.php => HttpRequest.php} (88%) create mode 100644 src/Client/HttpRpcClient.php delete mode 100644 src/Client/IRpcClient.php delete mode 100644 src/Client/RpcClientScoped.php create mode 100644 src/Client/ScopedRpcClient.php create mode 100644 src/Client/StreamHttpRequest.php rename src/{Aiwass.php => RPCii.php} (72%) rename src/{AiwassMsgPack.php => RpciiMsgPack.php} (84%) create mode 100644 src/Server/HttpRpcServer.php delete mode 100644 src/Server/IRpcActionHandler.php delete mode 100644 src/Server/IRpcServer.php delete mode 100644 src/Server/RpcActionHandler.php delete mode 100644 src/Server/RpcActionHandlerTrait.php create mode 100644 src/Server/RpcHandler.php create mode 100644 src/Server/RpcHandlerCommon.php rename src/Server/{RpcActionInfo.php => RpcProcedureInfo.php} (71%) create mode 100644 src/Server/RpcServerCommon.php delete mode 100644 src/Server/RpcServerScoped.php delete mode 100644 src/Server/RpcServerTrait.php create mode 100644 src/Server/ScopedRpcServer.php rename src/{IVerificationProvider.php => VerificationProvider.php} (70%) create mode 100644 tests/StreamHttpTest.php diff --git a/README.md b/README.md index 11e1e38..f9b6b19 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ -# Aiwass +# RPCii (ć—§Aiwass) -Aiwass is an RPC client and server library. +RPCii is an RPC client and server library. An Index compatible route handler is provided to make it really low effort to get a server going. ## Requirements and Dependencies -Aiwass currently targets **PHP 8.3** with the `msgpack` extension installed. +RPCii currently targets **PHP 8.3** with the `msgpack` extension installed. ## Versioning -Aiwass versioning will follows the [Semantic Versioning specification v2.0.0](https://semver.org/spec/v2.0.0.html). +RPCii versioning will follows the [Semantic Versioning specification v2.0.0](https://semver.org/spec/v2.0.0.html). -Changes to minimum required PHP version other major overhauls to Aiwass itself that break compatibility will be reasons for incrementing the major version. +Changes to minimum required PHP version other major overhauls to RPCii itself that break compatibility will be reasons for incrementing the major version. -Aiwass depends on Index, but its versioning depends on the minimum PHP version and should thus be fairly inconsequential. +RPCii depends on Index, but its versioning depends on the minimum PHP version and should thus be fairly inconsequential. Previous major versions may be supported for a time with backports depending on what projects of mine still target older versions of PHP. -The version is stored in the root of the repository in a file called `VERSION` and can be read out within Aiwass using `Aiwass\Aiwass::version()`. +The version is stored in the root of the repository in a file called `VERSION` and can be read out within RPCii using `RPCii\RPCii::version()`. ## Contribution -By submitting code for inclusion in the main Aiwass source tree you agree to transfer ownership of the code to the project owner. +By submitting code for inclusion in the main RPCii source tree you agree to transfer ownership of the code to the project owner. The contributor will still be attributed for the contributed code, unless they ask for this attribution to be removed. This is to avoid intellectual property rights traps and drama that could lead to blackmail situations. If you do not agree with these terms, you are free to fork off. @@ -31,4 +31,4 @@ If you do not agree with these terms, you are free to fork off. ## Licencing -Aiwass is available under the BSD 3-Clause Clear License, a full version of which is enclosed in the LICENCE file. +RPCii is available under the BSD 3-Clause Clear License, a full version of which is enclosed in the LICENCE file. diff --git a/VERSION b/VERSION index 9084fa2..227cea2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.0 +2.0.0 diff --git a/composer.json b/composer.json index 15dde6f..73b4c9a 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { - "name": "flashwave/aiwass", - "description": "Shared HTTP RPC client/server library.", + "name": "flashii/rpcii", + "description": "HTTP RPC client/server library.", "type": "library", - "homepage": "https://railgun.sh/aiwass", + "homepage": "https://railgun.sh/rpcii", "license": "bsd-3-clause-clear", "require": { "php": ">=8.3", @@ -10,8 +10,8 @@ "flashwave/index": "^0.2410" }, "require-dev": { - "phpunit/phpunit": "^11.2", - "phpstan/phpstan": "^1.11" + "phpunit/phpunit": "^11.4", + "phpstan/phpstan": "^2.0" }, "authors": [ { @@ -23,7 +23,7 @@ ], "autoload": { "psr-4": { - "Aiwass\\": "src" + "RPCii\\": "src" } } } diff --git a/composer.lock b/composer.lock index a32f3f5..11f9b07 100644 --- a/composer.lock +++ b/composer.lock @@ -4,15 +4,15 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8d01741caad2805272e619b4aa3c3c5e", + "content-hash": "f82764057cc610971b1823a40f95da29", "packages": [ { "name": "flashwave/index", - "version": "v0.2410.42339", + "version": "v0.2410.191603", "source": { "type": "git", "url": "https://patchii.net/flash/index.git", - "reference": "d3e4d0985a1189d15fb8ed9eb105830c9dc38c4d" + "reference": "17cdb4d1c239241200d7e30968122a8cd8b26509" }, "require": { "ext-mbstring": "*", @@ -33,6 +33,14 @@ }, "type": "library", "autoload": { + "files": [ + "src/Cache/ArrayCache/_ndx.php", + "src/Cache/Memcached/_ndx.php", + "src/Cache/Valkey/_ndx.php", + "src/Db/MariaDb/_ndx.php", + "src/Db/NullDb/_ndx.php", + "src/Db/Sqlite/_ndx.php" + ], "psr-4": { "Index\\": "src" } @@ -51,7 +59,7 @@ ], "description": "Composer package for the common library for my projects.", "homepage": "https://railgun.sh/index", - "time": "2024-10-04T23:39:32+00:00" + "time": "2024-10-19T16:04:17+00:00" }, { "name": "symfony/deprecation-contracts", @@ -122,16 +130,16 @@ }, { "name": "symfony/mime", - "version": "v7.1.5", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff" + "reference": "caa1e521edb2650b8470918dfe51708c237f0598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/711d2e167e8ce65b05aea6b258c449671cdd38ff", - "reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff", + "url": "https://api.github.com/repos/symfony/mime/zipball/caa1e521edb2650b8470918dfe51708c237f0598", + "reference": "caa1e521edb2650b8470918dfe51708c237f0598", "shasum": "" }, "require": { @@ -186,7 +194,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.1.5" + "source": "https://github.com/symfony/mime/tree/v7.1.6" }, "funding": [ { @@ -202,7 +210,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:28:38+00:00" + "time": "2024-10-25T15:11:02+00:00" }, { "name": "symfony/polyfill-ctype", @@ -673,16 +681,16 @@ }, { "name": "twig/twig", - "version": "v3.14.0", + "version": "v3.14.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72" + "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72", - "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", + "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", "shasum": "" }, "require": { @@ -736,7 +744,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.14.0" + "source": "https://github.com/twigphp/Twig/tree/v3.14.2" }, "funding": [ { @@ -748,22 +756,22 @@ "type": "tidelift" } ], - "time": "2024-09-09T17:55:12+00:00" + "time": "2024-11-07T12:36:22+00:00" } ], "packages-dev": [ { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { @@ -802,7 +810,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" }, "funding": [ { @@ -810,20 +818,20 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { "name": "nikic/php-parser", - "version": "v5.3.0", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a", - "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { @@ -866,9 +874,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2024-09-29T13:56:26+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "phar-io/manifest", @@ -990,20 +998,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.5", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17" + "reference": "ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d", + "reference": "ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -1044,39 +1052,39 @@ "type": "github" } ], - "time": "2024-09-26T12:45:22+00:00" + "time": "2024-11-11T15:43:04+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "11.0.6", + "version": "11.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ebdffc9e09585dafa71b9bffcdb0a229d4704c45" + "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ebdffc9e09585dafa71b9bffcdb0a229d4704c45", - "reference": "ebdffc9e09585dafa71b9bffcdb0a229d4704c45", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7f08030e8811582cc459871d28d6f5a1a4d35ca", + "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^5.1.0", + "nikic/php-parser": "^5.3.1", "php": ">=8.2", - "phpunit/php-file-iterator": "^5.0.1", + "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-text-template": "^4.0.1", "sebastian/code-unit-reverse-lookup": "^4.0.1", "sebastian/complexity": "^4.0.1", "sebastian/environment": "^7.2.0", "sebastian/lines-of-code": "^3.0.1", - "sebastian/version": "^5.0.1", + "sebastian/version": "^5.0.2", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^11.4.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1114,7 +1122,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.7" }, "funding": [ { @@ -1122,7 +1130,7 @@ "type": "github" } ], - "time": "2024-08-22T04:37:56+00:00" + "time": "2024-10-09T06:21:38+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1371,16 +1379,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.3.6", + "version": "11.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d62c45a19c665bb872c2a47023a0baf41a98bb2b" + "reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d62c45a19c665bb872c2a47023a0baf41a98bb2b", - "reference": "d62c45a19c665bb872c2a47023a0baf41a98bb2b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e8e8ed1854de5d36c088ec1833beae40d2dedd76", + "reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76", "shasum": "" }, "require": { @@ -1394,21 +1402,21 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0.6", + "phpunit/php-code-coverage": "^11.0.7", "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-invoker": "^5.0.1", "phpunit/php-text-template": "^4.0.1", "phpunit/php-timer": "^7.0.1", "sebastian/cli-parser": "^3.0.2", "sebastian/code-unit": "^3.0.1", - "sebastian/comparator": "^6.1.0", + "sebastian/comparator": "^6.1.1", "sebastian/diff": "^6.0.2", "sebastian/environment": "^7.2.0", "sebastian/exporter": "^6.1.3", "sebastian/global-state": "^7.0.2", "sebastian/object-enumerator": "^6.0.1", "sebastian/type": "^5.1.0", - "sebastian/version": "^5.0.1" + "sebastian/version": "^5.0.2" }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files" @@ -1419,7 +1427,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.3-dev" + "dev-main": "11.4-dev" } }, "autoload": { @@ -1451,7 +1459,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.6" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.3" }, "funding": [ { @@ -1467,7 +1475,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T10:54:28+00:00" + "time": "2024-10-28T13:07:50+00:00" }, { "name": "sebastian/cli-parser", @@ -1641,16 +1649,16 @@ }, { "name": "sebastian/comparator", - "version": "6.1.0", + "version": "6.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa37b9e2ca618cb051d71b60120952ee8ca8b03d" + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa37b9e2ca618cb051d71b60120952ee8ca8b03d", - "reference": "fa37b9e2ca618cb051d71b60120952ee8ca8b03d", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", "shasum": "" }, "require": { @@ -1661,12 +1669,12 @@ "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^11.3" + "phpunit/phpunit": "^11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.1-dev" + "dev-main": "6.2-dev" } }, "autoload": { @@ -1706,7 +1714,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.1.0" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1" }, "funding": [ { @@ -1714,7 +1722,7 @@ "type": "github" } ], - "time": "2024-09-11T15:42:56+00:00" + "time": "2024-10-31T05:30:08+00:00" }, { "name": "sebastian/complexity", @@ -2340,16 +2348,16 @@ }, { "name": "sebastian/version", - "version": "5.0.1", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/45c9debb7d039ce9b97de2f749c2cf5832a06ac4", - "reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { @@ -2382,7 +2390,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -2390,7 +2398,7 @@ "type": "github" } ], - "time": "2024-07-03T05:13:08+00:00" + "time": "2024-10-09T05:16:32+00:00" }, { "name": "theseer/tokenizer", diff --git a/phpdoc.xml b/phpdoc.xml index c06412c..6b86daa 100644 --- a/phpdoc.xml +++ b/phpdoc.xml @@ -3,17 +3,17 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.phpdoc.org" xsi:noNamespaceSchemaLocation="data/xsd/phpdoc.xsd"> - Aiwass Documentation + RPCii Documentation