From e40fa456ac312072118a4778de14d593ce7b910e Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz <1921950+norberttech@users.noreply.github.com> Date: Sat, 11 Jan 2025 10:34:54 -0600 Subject: [PATCH] Added a manifest.json to flow monorepo (#1355) --- manifest.json | 145 ++++++++++++++++++ .../src/Flow/ETL/Row/Entry/StringEntry.php | 6 +- .../etl/tests/Flow/ETL/Tests/FlowTestCase.php | 8 + .../src/Flow/Documentation/Manifest.php | 28 ++++ .../Flow/Documentation/Manifest/Package.php | 12 ++ .../src/Flow/Documentation/Manifest/Type.php | 14 ++ .../Tests/Integration/ManifestTest.php | 21 +++ 7 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 manifest.json create mode 100644 src/tools/documentation/src/Flow/Documentation/Manifest.php create mode 100644 src/tools/documentation/src/Flow/Documentation/Manifest/Package.php create mode 100644 src/tools/documentation/src/Flow/Documentation/Manifest/Type.php create mode 100644 src/tools/documentation/tests/Flow/Documentation/Tests/Integration/ManifestTest.php diff --git a/manifest.json b/manifest.json new file mode 100644 index 000000000..4fdc92081 --- /dev/null +++ b/manifest.json @@ -0,0 +1,145 @@ +{ + "name": "Flow PHP", + "packages": [ + { + "name" : "flow-php/etl", + "path": "src/core/etl", + "type": "core" + }, + { + "name" : "flow-php/cli", + "path": "src/cli", + "type": "cli" + }, + { + "name" : "flow-php/etl-adapter-avro", + "path": "src/adapter/etl-adapter-avro", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-chartjs", + "path": "src/adapter/etl-adapter-chartjs", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-csv", + "path": "src/adapter/etl-adapter-csv", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-doctrine", + "path": "src/adapter/etl-adapter-doctrine", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-elasticsearch", + "path": "src/adapter/etl-adapter-elasticsearch", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-google-sheet", + "path": "src/adapter/etl-adapter-google-sheet", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-http", + "path": "src/adapter/etl-adapter-http", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-json", + "path": "src/adapter/etl-adapter-json", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-logger", + "path": "src/adapter/etl-adapter-logger", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-meilisearch", + "path": "src/adapter/etl-adapter-meilisearch", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-parquet", + "path": "src/adapter/etl-adapter-parquet", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-text", + "path": "src/adapter/etl-adapter-text", + "type": "adapter" + }, + { + "name" : "flow-php/etl-adapter-xml", + "path": "src/adapter/etl-adapter-xml", + "type": "adapter" + }, + { + "name" : "flow-php/filesystem-async-aws-bridge", + "path": "src/bridge/filesystem/async-aws", + "type": "bridge" + }, + { + "name" : "flow-php/filesystem-azure-bridge", + "path": "src/bridge/filesystem/azure", + "type": "bridge" + }, + { + "name" : "flow-php/monolog-http-bridge", + "path": "src/bridge/monolog/http", + "type": "bridge" + }, + { + "name" : "flow-php/symfony-http-foundation", + "path": "src/bridge/symfony/http-foundation", + "type": "bridge" + }, + { + "name" : "flow-php/array-dot", + "path": "src/lib/array-dot", + "type": "lib" + }, + { + "name" : "flow-php/azure-sdk", + "path": "src/lib/azure-sdk", + "type": "lib" + }, + { + "name" : "flow-php/doctrine-dbal-bulk", + "path": "src/lib/doctrine-dbal-bulk", + "type": "lib" + }, + { + "name" : "flow-php/dremel", + "path": "src/lib/dremel", + "type": "lib" + }, + { + "name" : "flow-php/filesystem", + "path": "src/lib/filesystem", + "type": "lib" + }, + { + "name" : "flow-php/parquet", + "path": "src/lib/parquet", + "type": "lib" + }, + { + "name" : "flow-php/parquet-viewer", + "path": "src/lib/parquet-viewer", + "type": "lib" + }, + { + "name" : "flow-php/rdsl", + "path": "src/lib/rdsl", + "type": "lib" + }, + { + "name" : "flow-php/snappy", + "path": "src/lib/snappy", + "type": "lib" + } + ] +} \ No newline at end of file diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php index d791c1f6c..9a04388ec 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php @@ -6,6 +6,7 @@ use function Flow\ETL\DSL\type_string; use Flow\ETL\Exception\InvalidArgumentException; +use Flow\ETL\PHP\Type\Native\StringType; use Flow\ETL\PHP\Type\Type; use Flow\ETL\Row\Schema\Definition; use Flow\ETL\Row\{Entry, Reference, Schema\Metadata}; @@ -19,10 +20,7 @@ final class StringEntry implements Entry private bool $fromNull = false; - /** - * @var Type - */ - private readonly Type $type; + private readonly StringType $type; /** * @throws InvalidArgumentException diff --git a/src/core/etl/tests/Flow/ETL/Tests/FlowTestCase.php b/src/core/etl/tests/Flow/ETL/Tests/FlowTestCase.php index a76868b17..09f48960a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/FlowTestCase.php +++ b/src/core/etl/tests/Flow/ETL/Tests/FlowTestCase.php @@ -95,4 +95,12 @@ final public static function assertExtractedRowsEquals( static::assertEquals($expectedRows, $extractedRows, $message); } + + /** + * Root of the project monorepo. + */ + public function repositoryRoot() : string + { + return \dirname(__DIR__, 7); + } } diff --git a/src/tools/documentation/src/Flow/Documentation/Manifest.php b/src/tools/documentation/src/Flow/Documentation/Manifest.php new file mode 100644 index 000000000..e8df4aa10 --- /dev/null +++ b/src/tools/documentation/src/Flow/Documentation/Manifest.php @@ -0,0 +1,28 @@ + + */ + public array $packages; + + public function __construct(Package ...$packages) + { + $this->packages = $packages; + } + + public static function fromJson(string $json) : self + { + return new self(...\array_map( + static fn (array $package) => new Package($package['name'], $package['path'], Type::from($package['type'])), + \json_decode($json, true, 512, \JSON_THROW_ON_ERROR)['packages'] + )); + } +} diff --git a/src/tools/documentation/src/Flow/Documentation/Manifest/Package.php b/src/tools/documentation/src/Flow/Documentation/Manifest/Package.php new file mode 100644 index 000000000..04f7c5f47 --- /dev/null +++ b/src/tools/documentation/src/Flow/Documentation/Manifest/Package.php @@ -0,0 +1,12 @@ +repositoryRoot() . '/manifest.json')); + self::assertCount(28, $manifest->packages); + + foreach ($manifest->packages as $package) { + self::assertFileExists($this->repositoryRoot() . '/' . $package->path); + } + } +}