@_nazmiforreal/flutter-ota 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/flutter-ota-linux-x64 +0 -0
- package/bin/flutter-ota.js +12 -11
- package/dart-src/packages/cli-tools/lib/flutter_ota_kit_cli.dart +46 -13
- package/dart-src/packages/cli-tools/lib/src/backend.dart +6 -6
- package/dart-src/packages/cli-tools/lib/src/commands/build.dart +2 -0
- package/dart-src/packages/cli-tools/lib/src/commands/bundle.dart +7 -7
- package/dart-src/packages/cli-tools/lib/src/commands/deploy.dart +4 -1
- package/dart-src/packages/cli-tools/lib/src/commands/pocketbase.dart +1 -1
- package/dart-src/packages/cli-tools/lib/src/commands/rollback.dart +1 -1
- package/dart-src/packages/cli-tools/lib/src/config.dart +5 -5
- package/dart-src/packages/cli-tools/lib/src/operations.dart +2 -2
- package/dart-src/packages/cli-tools/pubspec.yaml +8 -21
- package/dart-src/packages/cli-tools/test/backends_test.dart +3 -3
- package/dart-src/packages/cli-tools/test/cli_test.dart +1 -1
- package/dart-src/packages/cli-tools/test/mocks/mock_aws_s3_client.dart +2 -2
- package/dart-src/packages/cli-tools/test/mocks/mock_d1_client.dart +2 -2
- package/dart-src/packages/cli-tools/test/mocks/mock_pocketbase_client.dart +4 -1
- package/dart-src/packages/cli-tools/test/mocks/mock_postgres_client.dart +2 -2
- package/dart-src/packages/cli-tools/test/pocketbase_smoke_test.dart +1 -1
- package/dart-src/root/README.md +394 -0
- package/dart-src/root/analysis_options.yaml +21 -0
- package/dart-src/root/android/build.gradle +116 -0
- package/dart-src/root/android/consumer-rules.pro +23 -0
- package/dart-src/root/android/settings.gradle +1 -0
- package/dart-src/root/android/src/main/AndroidManifest.xml +21 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/ApplyResult.kt +52 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/BlacklistStore.kt +154 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/BootDiagnosticStore.kt +150 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/CrashGuard.kt +271 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/FlutterPatcherApplication.kt +201 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/FlutterPatcherAutoInitProvider.kt +93 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/FlutterPatcherPlugin.kt +245 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/LoaderHook.kt +298 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/PatchManager.kt +1579 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/PatcherConfig.kt +173 -0
- package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/SignatureVerifier.kt +177 -0
- package/dart-src/root/android/src/test/kotlin/com/flutter_patcher/flutter_patcher/CrashGuardTest.kt +61 -0
- package/dart-src/root/android/src/test/kotlin/com/flutter_patcher/flutter_patcher/LoaderHookTest.kt +25 -0
- package/dart-src/root/android/src/test/kotlin/com/flutter_patcher/flutter_patcher/PatchManagerTest.kt +401 -0
- package/dart-src/root/android/src/test/kotlin/com/flutter_patcher/flutter_patcher/PatcherConfigTest.kt +30 -0
- package/dart-src/root/bin/pack.dart +182 -0
- package/dart-src/root/lib/flutter_ota_kit.dart +1170 -0
- package/dart-src/root/lib/src/app_version_resolver.dart +36 -0
- package/dart-src/root/lib/src/aws_update_source.dart +97 -0
- package/dart-src/root/lib/src/blacklist.dart +54 -0
- package/dart-src/root/lib/src/boot_diagnostic.dart +138 -0
- package/dart-src/root/lib/src/cloudflare_update_source.dart +97 -0
- package/dart-src/root/lib/src/flutter_ota_app.dart +69 -0
- package/dart-src/root/lib/src/io.dart +48 -0
- package/dart-src/root/lib/src/io_stub.dart +19 -0
- package/dart-src/root/lib/src/ota_progress_overlay.dart +987 -0
- package/dart-src/root/lib/src/pack/pack.dart +434 -0
- package/dart-src/root/lib/src/patch_info.dart +12 -0
- package/dart-src/root/lib/src/patcher_channel.dart +160 -0
- package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/aws_database.dart +1 -1
- package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/aws_s3_client.dart +1 -1
- package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/aws_storage.dart +1 -1
- package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/aws_storage_profile.dart +1 -1
- package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/with_cloudfront_signed_url.dart +1 -1
- package/dart-src/root/lib/src/pkg/client/flutter_ota_kit_client.dart +1 -0
- package/dart-src/root/lib/src/pkg/client/src/server_update_source.dart +46 -0
- package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/cloudflare_worker_database.dart +1 -1
- package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_build_where.dart +1 -1
- package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_bundle_mapper.dart +3 -3
- package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_database.dart +1 -1
- package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_database_plugin.dart +2 -2
- package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/r2_s3_client.dart +1 -1
- package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/r2_storage.dart +1 -1
- package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/r2_storage_profile.dart +1 -1
- package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/status.dart +1 -1
- package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/flutter_ota_kit_plugin_core.dart +1 -1
- package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/create_blob_database_plugin.dart +1 -1
- package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/filter_compatible_app_versions.dart +1 -1
- package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/get_update_info.dart +1 -1
- package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/request_update_bundle_state.dart +1 -1
- package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/resolve_update_info_from_bundles.dart +1 -1
- package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/types.dart +2 -2
- package/dart-src/{plugins/pocketbase/lib → root/lib/src/pkg/pocketbase}/src/pocketbase_bundle_mapper.dart +2 -2
- package/dart-src/{plugins/pocketbase/lib → root/lib/src/pkg/pocketbase}/src/pocketbase_database.dart +26 -15
- package/dart-src/{plugins/pocketbase/lib → root/lib/src/pkg/pocketbase}/src/pocketbase_storage.dart +1 -1
- package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_bundle_mapper.dart +2 -2
- package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_database.dart +2 -2
- package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_get_update_info.dart +2 -2
- package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_storage.dart +1 -1
- package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_types.dart +1 -1
- package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_bundle_mapper.dart +2 -2
- package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_database.dart +2 -2
- package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_edge_function_database.dart +1 -1
- package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_edge_function_storage.dart +1 -1
- package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_storage.dart +1 -1
- package/dart-src/root/lib/src/pocketbase_update_source.dart +107 -0
- package/dart-src/root/lib/src/postgres_update_source.dart +95 -0
- package/dart-src/root/lib/src/shared_update_check.dart +131 -0
- package/dart-src/root/lib/src/supabase_update_source.dart +93 -0
- package/dart-src/root/pubspec.yaml +54 -0
- package/package.json +1 -1
- package/scripts/postinstall.js +17 -13
- package/scripts/vendor.sh +22 -7
- package/dart-src/packages/core/CHANGELOG.md +0 -21
- package/dart-src/packages/core/README.md +0 -23
- package/dart-src/packages/core/example/lib/main.dart +0 -69
- package/dart-src/packages/core/pubspec.yaml +0 -13
- package/dart-src/packages/core/test/rollout_test.dart +0 -135
- package/dart-src/packages/core/test/semver_test.dart +0 -55
- package/dart-src/packages/core/test/semver_vectors.json +0 -1
- package/dart-src/packages/core/test/types_test.dart +0 -131
- package/dart-src/packages/core/test/uuid_test.dart +0 -40
- package/dart-src/packages/core/tool/dbg.dart +0 -7
- package/dart-src/plugins/aws/.gitkeep +0 -0
- package/dart-src/plugins/aws/CHANGELOG.md +0 -23
- package/dart-src/plugins/aws/LICENSE +0 -21
- package/dart-src/plugins/aws/README.md +0 -28
- package/dart-src/plugins/aws/example/lib/main.dart +0 -60
- package/dart-src/plugins/aws/pubspec.yaml +0 -30
- package/dart-src/plugins/aws/test/aws_database_test.dart +0 -161
- package/dart-src/plugins/aws/test/aws_storage_test.dart +0 -73
- package/dart-src/plugins/aws/test/mock_aws_s3_client.dart +0 -78
- package/dart-src/plugins/cloudflare/.gitkeep +0 -0
- package/dart-src/plugins/cloudflare/CHANGELOG.md +0 -23
- package/dart-src/plugins/cloudflare/LICENSE +0 -21
- package/dart-src/plugins/cloudflare/README.md +0 -25
- package/dart-src/plugins/cloudflare/example/lib/main.dart +0 -62
- package/dart-src/plugins/cloudflare/migrations/0001_hot-updater_init.sql +0 -16
- package/dart-src/plugins/cloudflare/migrations/0002_hot-updater_0.13.0.sql +0 -8
- package/dart-src/plugins/cloudflare/migrations/0003_hot-updater_0.18.0.sql +0 -38
- package/dart-src/plugins/cloudflare/migrations/0004_hot-updater_0.29.0.sql +0 -11
- package/dart-src/plugins/cloudflare/migrations/0005_hot-updater_0.31.0.sql +0 -24
- package/dart-src/plugins/cloudflare/pubspec.yaml +0 -28
- package/dart-src/plugins/cloudflare/sql/bundles.sql +0 -42
- package/dart-src/plugins/cloudflare/test/cloudflare_worker_database_test.dart +0 -126
- package/dart-src/plugins/cloudflare/test/d1_bundle_mapper_test.dart +0 -106
- package/dart-src/plugins/cloudflare/test/d1_database_test.dart +0 -200
- package/dart-src/plugins/cloudflare/test/mock_d1_client.dart +0 -261
- package/dart-src/plugins/cloudflare/test/mock_r2_client.dart +0 -78
- package/dart-src/plugins/cloudflare/test/r2_storage_test.dart +0 -74
- package/dart-src/plugins/plugin-core/CHANGELOG.md +0 -20
- package/dart-src/plugins/plugin-core/LICENSE +0 -21
- package/dart-src/plugins/plugin-core/README.md +0 -21
- package/dart-src/plugins/plugin-core/example/lib/main.dart +0 -61
- package/dart-src/plugins/plugin-core/pubspec.yaml +0 -23
- package/dart-src/plugins/plugin-core/test/asset_storage_layout_test.dart +0 -170
- package/dart-src/plugins/plugin-core/test/bundle_unit_of_work_store_test.dart +0 -74
- package/dart-src/plugins/plugin-core/test/bundle_unit_of_work_test.dart +0 -345
- package/dart-src/plugins/plugin-core/test/create_blob_database_plugin_test.dart +0 -843
- package/dart-src/plugins/plugin-core/test/create_database_plugin_test.dart +0 -298
- package/dart-src/plugins/plugin-core/test/create_storage_plugin_test.dart +0 -195
- package/dart-src/plugins/plugin-core/test/generate_min_bundle_id_test.dart +0 -56
- package/dart-src/plugins/plugin-core/test/get_update_info_test.dart +0 -1589
- package/dart-src/plugins/plugin-core/test/helpers_test.dart +0 -283
- package/dart-src/plugins/plugin-core/test/query_bundles_test.dart +0 -202
- package/dart-src/plugins/plugin-core/test/request_update_bundle_state_test.dart +0 -86
- package/dart-src/plugins/plugin-core/test/uuidv7_test.dart +0 -88
- package/dart-src/plugins/pocketbase/CHANGELOG.md +0 -23
- package/dart-src/plugins/pocketbase/LICENSE +0 -21
- package/dart-src/plugins/pocketbase/README.md +0 -54
- package/dart-src/plugins/pocketbase/example/lib/main.dart +0 -62
- package/dart-src/plugins/pocketbase/pubspec.yaml +0 -26
- package/dart-src/plugins/pocketbase/test/pb_uri_test.dart +0 -12
- package/dart-src/plugins/postgres/.gitkeep +0 -0
- package/dart-src/plugins/postgres/CHANGELOG.md +0 -23
- package/dart-src/plugins/postgres/LICENSE +0 -21
- package/dart-src/plugins/postgres/README.md +0 -29
- package/dart-src/plugins/postgres/example/lib/main.dart +0 -67
- package/dart-src/plugins/postgres/pubspec.yaml +0 -26
- package/dart-src/plugins/postgres/sql/bundles.sql +0 -45
- package/dart-src/plugins/postgres/sql/get_target_app_version_list.sql +0 -21
- package/dart-src/plugins/postgres/sql/get_update_info.spec.ts +0 -171
- package/dart-src/plugins/postgres/sql/get_update_info_by_app_version.sql +0 -126
- package/dart-src/plugins/postgres/sql/get_update_info_by_fingerprint_hash.sql +0 -125
- package/dart-src/plugins/postgres/sql/hash_user_id.sql +0 -30
- package/dart-src/plugins/postgres/sql/is_device_eligible.sql +0 -237
- package/dart-src/plugins/postgres/sql/prepareSql.ts +0 -11
- package/dart-src/plugins/postgres/test/mock_postgres_client.dart +0 -320
- package/dart-src/plugins/postgres/test/postgres_bundle_mapper_test.dart +0 -139
- package/dart-src/plugins/postgres/test/postgres_database_test.dart +0 -210
- package/dart-src/plugins/postgres/test/postgres_storage_runtime_test.dart +0 -60
- package/dart-src/plugins/supabase/CHANGELOG.md +0 -24
- package/dart-src/plugins/supabase/LICENSE +0 -21
- package/dart-src/plugins/supabase/README.md +0 -53
- package/dart-src/plugins/supabase/example/lib/main.dart +0 -63
- package/dart-src/plugins/supabase/pubspec.yaml +0 -27
- package/dart-src/plugins/supabase/supabase/edge-functions/index.ts +0 -44
- package/dart-src/plugins/supabase/supabase/edge-functions/runtime.docker.integration.spec.ts +0 -968
- package/dart-src/plugins/supabase/supabase/migrations/20250103114225_init.sql +0 -232
- package/dart-src/plugins/supabase/supabase/migrations/20250314000000_hot-updater_0.13.0.sql +0 -137
- package/dart-src/plugins/supabase/supabase/migrations/20250516000000_hot-updater_0.18.0.sql +0 -206
- package/dart-src/plugins/supabase/supabase/migrations/20251014000000_hot-updater_0.21.0.sql +0 -186
- package/dart-src/plugins/supabase/supabase/migrations/20260401000000_hot-updater_0.29.0.sql +0 -505
- package/dart-src/plugins/supabase/supabase/migrations/20260414000000_hot-updater_0.30.0.sql +0 -50
- package/dart-src/plugins/supabase/supabase/migrations/20260422000000_hot-updater_0.31.0.sql +0 -20
- package/dart-src/plugins/supabase/supabase/migrations/20260520014100_hot-updater_rls.sql +0 -75
- package/dart-src/plugins/supabase/test/mock_supabase_client.dart +0 -654
- package/dart-src/plugins/supabase/test/supabase_bundle_mapper_test.dart +0 -115
- package/dart-src/plugins/supabase/test/supabase_database_test.dart +0 -198
- package/dart-src/plugins/supabase/test/supabase_storage_test.dart +0 -168
- /package/dart-src/{packages/core → root}/LICENSE +0 -0
- /package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/flutter_ota_kit_aws.dart +0 -0
- /package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/aws_cloudfront_client.dart +0 -0
- /package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/aws_cloudfront_signer.dart +0 -0
- /package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/aws_config.dart +0 -0
- /package/dart-src/{plugins/aws/lib → root/lib/src/pkg/aws}/src/aws_ssm_client.dart +0 -0
- /package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/flutter_ota_kit_cloudflare.dart +0 -0
- /package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_client.dart +0 -0
- /package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_config.dart +0 -0
- /package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/r2_config.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/flutter_ota_kit_core.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/app_update_info.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/bundle.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/bundle_artifacts.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/bundle_patch_artifact.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/changed_asset.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/get_bundles_args.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/metadata.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/patch_info.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/platform.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/rollout.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/semver.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/semver_range.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/semver_version.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/strategy.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/update_bundle_params.dart +0 -0
- /package/dart-src/{packages/core/lib → root/lib/src/pkg/core}/src/uuid.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/asset_storage_layout.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/bundle_helpers.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/bundle_storage_layout.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/bundle_unit_of_work.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/bundle_unit_of_work_store.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/calculate_pagination.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/compression_format.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/content_addressed_assets.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/create_database_plugin.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/create_storage_key_builder.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/create_storage_plugin.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/generate_min_bundle_id.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/is_object.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/legacy_asset_storage_layout.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/paginate_bundles.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/parse_storage_uri.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/query_bundles.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/storage_helpers.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/storage_profile.dart +0 -0
- /package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/uuidv7.dart +0 -0
- /package/dart-src/{plugins/pocketbase/lib → root/lib/src/pkg/pocketbase}/flutter_ota_kit_pocketbase.dart +0 -0
- /package/dart-src/{plugins/pocketbase/lib → root/lib/src/pkg/pocketbase}/src/pocketbase_client.dart +0 -0
- /package/dart-src/{plugins/pocketbase/lib → root/lib/src/pkg/pocketbase}/src/pocketbase_config.dart +0 -0
- /package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/flutter_ota_kit_postgres.dart +0 -0
- /package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_client.dart +0 -0
- /package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_config.dart +0 -0
- /package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/edge.dart +0 -0
- /package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/flutter_ota_kit_supabase.dart +0 -0
- /package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/error_message.dart +0 -0
- /package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_client_adapter.dart +0 -0
- /package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_client_http.dart +0 -0
- /package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_config.dart +0 -0
- /package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_signed_url_batcher.dart +0 -0
- /package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/types.dart +0 -0
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart';
|
|
2
|
-
import 'package:flutter_ota_kit_plugin_core/src/bundle_unit_of_work.dart';
|
|
3
|
-
import 'package:flutter_ota_kit_plugin_core/src/bundle_unit_of_work_store.dart';
|
|
4
|
-
import 'package:flutter_ota_kit_plugin_core/src/create_database_plugin.dart';
|
|
5
|
-
import 'package:flutter_ota_kit_plugin_core/src/types.dart';
|
|
6
|
-
import 'package:test/test.dart';
|
|
7
|
-
|
|
8
|
-
class _MockDatabasePlugin extends AbstractDatabasePlugin {
|
|
9
|
-
_MockDatabasePlugin({required this.id, required this.bundles});
|
|
10
|
-
|
|
11
|
-
final String id;
|
|
12
|
-
final List<Bundle> bundles;
|
|
13
|
-
|
|
14
|
-
final List<BundleChange> committedChanges = [];
|
|
15
|
-
|
|
16
|
-
String get name => 'mock-$id';
|
|
17
|
-
|
|
18
|
-
@override
|
|
19
|
-
Future<Bundle?> getBundleById(String bundleId) async {
|
|
20
|
-
return bundles.where((b) => b.id == bundleId).firstOrNull;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@override
|
|
24
|
-
Future<Paginated<List<Bundle>>> getBundles(
|
|
25
|
-
DatabaseBundleQueryOptions options,
|
|
26
|
-
) async {
|
|
27
|
-
final where = options.where;
|
|
28
|
-
var filtered = bundles;
|
|
29
|
-
if (where?.channel != null) {
|
|
30
|
-
filtered = filtered.where((b) => b.channel == where!.channel).toList();
|
|
31
|
-
}
|
|
32
|
-
return Paginated(
|
|
33
|
-
data: filtered,
|
|
34
|
-
pagination: PaginationInfo(
|
|
35
|
-
total: filtered.length,
|
|
36
|
-
hasNextPage: false,
|
|
37
|
-
hasPreviousPage: false,
|
|
38
|
-
currentPage: 1,
|
|
39
|
-
totalPages: 1,
|
|
40
|
-
),
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@override
|
|
45
|
-
Future<List<String>> getChannels() async => ['production'];
|
|
46
|
-
|
|
47
|
-
@override
|
|
48
|
-
Future<void> commitBundle({required List<BundleChange> changedSets}) async {
|
|
49
|
-
committedChanges.addAll(changedSets);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@override
|
|
53
|
-
Future<UpdateInfo?> getUpdateInfo(GetBundlesArgs args) async => null;
|
|
54
|
-
|
|
55
|
-
@override
|
|
56
|
-
Future<void> onUnmount() async {}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
Bundle _bundle(String id, {String channel = 'production'}) => Bundle(
|
|
60
|
-
id: id,
|
|
61
|
-
platform: Platform.android,
|
|
62
|
-
shouldForceUpdate: false,
|
|
63
|
-
enabled: true,
|
|
64
|
-
fileHash: 'hash_$id',
|
|
65
|
-
storageUri: 's3://bucket/$id.zip',
|
|
66
|
-
channel: channel,
|
|
67
|
-
targetAppVersion: '1.0.0',
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
void main() {
|
|
71
|
-
setUp(() {
|
|
72
|
-
clearUnitOfWorkStore();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
group('createDatabasePlugin', () {
|
|
76
|
-
late _MockDatabasePlugin mockImpl;
|
|
77
|
-
|
|
78
|
-
setUp(() {
|
|
79
|
-
mockImpl = _MockDatabasePlugin(
|
|
80
|
-
id: 'test',
|
|
81
|
-
bundles: [_bundle('b1'), _bundle('b2')],
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test('returns a factory function', () {
|
|
86
|
-
final factory = createDatabasePlugin<String>(
|
|
87
|
-
name: 'testDb',
|
|
88
|
-
factory: (config) =>
|
|
89
|
-
_MockDatabasePlugin(id: config, bundles: [_bundle('b1')]),
|
|
90
|
-
);
|
|
91
|
-
final createDb = factory('test');
|
|
92
|
-
expect(createDb, isA<Function>());
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test('factory creates a DatabasePlugin', () {
|
|
96
|
-
final factory = createDatabasePlugin<String>(
|
|
97
|
-
name: 'testDb',
|
|
98
|
-
factory: (config) =>
|
|
99
|
-
_MockDatabasePlugin(id: config, bundles: [_bundle('b1')]),
|
|
100
|
-
);
|
|
101
|
-
final db = factory('test')();
|
|
102
|
-
expect(db, isA<DatabasePlugin>());
|
|
103
|
-
expect(db.name, 'testDb');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
test('getBundleById delegates to underlying impl', () async {
|
|
107
|
-
final factory = createDatabasePlugin<String>(
|
|
108
|
-
name: 'testDb',
|
|
109
|
-
factory: (config) => _MockDatabasePlugin(
|
|
110
|
-
id: config,
|
|
111
|
-
bundles: [_bundle('b1'), _bundle('b2')],
|
|
112
|
-
),
|
|
113
|
-
);
|
|
114
|
-
final db = factory('test')();
|
|
115
|
-
final result = await db.getBundleById('b1');
|
|
116
|
-
expect(result, isNotNull);
|
|
117
|
-
expect(result!.id, 'b1');
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test('getBundleById returns null for missing', () async {
|
|
121
|
-
final factory = createDatabasePlugin<String>(
|
|
122
|
-
name: 'testDb',
|
|
123
|
-
factory: (config) =>
|
|
124
|
-
_MockDatabasePlugin(id: config, bundles: [_bundle('b1')]),
|
|
125
|
-
);
|
|
126
|
-
final db = factory('test')();
|
|
127
|
-
final result = await db.getBundleById('missing');
|
|
128
|
-
expect(result, isNull);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test('getBundles returns paginated results', () async {
|
|
132
|
-
final factory = createDatabasePlugin<String>(
|
|
133
|
-
name: 'testDb',
|
|
134
|
-
factory: (config) => _MockDatabasePlugin(
|
|
135
|
-
id: config,
|
|
136
|
-
bundles: [_bundle('b1'), _bundle('b2')],
|
|
137
|
-
),
|
|
138
|
-
);
|
|
139
|
-
final db = factory('test')();
|
|
140
|
-
final result = await db.getBundles(const DatabaseBundleQueryOptions());
|
|
141
|
-
expect(result.data.length, 2);
|
|
142
|
-
expect(result.pagination.total, 2);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
test('getChannels delegates correctly', () async {
|
|
146
|
-
final factory = createDatabasePlugin<String>(
|
|
147
|
-
name: 'testDb',
|
|
148
|
-
factory: (config) =>
|
|
149
|
-
_MockDatabasePlugin(id: config, bundles: [_bundle('b1')]),
|
|
150
|
-
);
|
|
151
|
-
final db = factory('test')();
|
|
152
|
-
final channels = await db.getChannels();
|
|
153
|
-
expect(channels, ['production']);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
test('appendBundle + commitBundle sends insert', () async {
|
|
157
|
-
final factory = createDatabasePlugin<String>(
|
|
158
|
-
name: 'testDb',
|
|
159
|
-
factory: (config) => mockImpl,
|
|
160
|
-
);
|
|
161
|
-
final db = factory('test')();
|
|
162
|
-
|
|
163
|
-
await db.appendBundle(_bundle('new'));
|
|
164
|
-
await db.commitBundle();
|
|
165
|
-
|
|
166
|
-
expect(mockImpl.committedChanges.length, 1);
|
|
167
|
-
expect(
|
|
168
|
-
mockImpl.committedChanges.first.operation,
|
|
169
|
-
BundleChangeOperation.insert,
|
|
170
|
-
);
|
|
171
|
-
expect(mockImpl.committedChanges.first.data.id, 'new');
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
test('updateBundle + commitBundle sends update', () async {
|
|
175
|
-
final factory = createDatabasePlugin<String>(
|
|
176
|
-
name: 'testDb',
|
|
177
|
-
factory: (config) => mockImpl,
|
|
178
|
-
);
|
|
179
|
-
final db = factory('test')();
|
|
180
|
-
|
|
181
|
-
await db.updateBundle('b1', {'enabled': false});
|
|
182
|
-
await db.commitBundle();
|
|
183
|
-
|
|
184
|
-
expect(mockImpl.committedChanges.length, 1);
|
|
185
|
-
expect(
|
|
186
|
-
mockImpl.committedChanges.first.operation,
|
|
187
|
-
BundleChangeOperation.update,
|
|
188
|
-
);
|
|
189
|
-
expect(mockImpl.committedChanges.first.data.enabled, false);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
test('deleteBundle + commitBundle sends delete', () async {
|
|
193
|
-
final factory = createDatabasePlugin<String>(
|
|
194
|
-
name: 'testDb',
|
|
195
|
-
factory: (config) => mockImpl,
|
|
196
|
-
);
|
|
197
|
-
final db = factory('test')();
|
|
198
|
-
|
|
199
|
-
await db.deleteBundle(_bundle('b1'));
|
|
200
|
-
await db.commitBundle();
|
|
201
|
-
|
|
202
|
-
expect(mockImpl.committedChanges.length, 1);
|
|
203
|
-
expect(
|
|
204
|
-
mockImpl.committedChanges.first.operation,
|
|
205
|
-
BundleChangeOperation.delete,
|
|
206
|
-
);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('commitBundle with no changes sends empty', () async {
|
|
210
|
-
final factory = createDatabasePlugin<String>(
|
|
211
|
-
name: 'testDb',
|
|
212
|
-
factory: (config) => mockImpl,
|
|
213
|
-
);
|
|
214
|
-
final db = factory('test')();
|
|
215
|
-
|
|
216
|
-
await db.commitBundle();
|
|
217
|
-
expect(mockImpl.committedChanges, isEmpty);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
test('each factory call creates isolated UoW', () async {
|
|
221
|
-
final factory = createDatabasePlugin<String>(
|
|
222
|
-
name: 'testDb',
|
|
223
|
-
factory: (config) => mockImpl,
|
|
224
|
-
);
|
|
225
|
-
final db1 = factory('test')();
|
|
226
|
-
final db2 = factory('test')();
|
|
227
|
-
|
|
228
|
-
await db1.appendBundle(_bundle('only1'));
|
|
229
|
-
// db2 should not have db1's changes
|
|
230
|
-
await db2.commitBundle();
|
|
231
|
-
expect(mockImpl.committedChanges, isEmpty);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
test('hook onDatabaseUpdated fires after commit', () async {
|
|
235
|
-
var hookCalled = false;
|
|
236
|
-
final factory = createDatabasePlugin<String>(
|
|
237
|
-
name: 'testDb',
|
|
238
|
-
factory: (config) => mockImpl,
|
|
239
|
-
);
|
|
240
|
-
final db = factory(
|
|
241
|
-
'test',
|
|
242
|
-
DatabasePluginHooks(
|
|
243
|
-
onDatabaseUpdated: () async {
|
|
244
|
-
hookCalled = true;
|
|
245
|
-
},
|
|
246
|
-
),
|
|
247
|
-
)();
|
|
248
|
-
|
|
249
|
-
await db.appendBundle(_bundle('x'));
|
|
250
|
-
await db.commitBundle();
|
|
251
|
-
expect(hookCalled, isTrue);
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
test('getUpdateInfo delegates to underlying impl', () async {
|
|
255
|
-
final factory = createDatabasePlugin<String>(
|
|
256
|
-
name: 'testDb',
|
|
257
|
-
factory: (config) => mockImpl,
|
|
258
|
-
);
|
|
259
|
-
final db = factory('test')();
|
|
260
|
-
final result = await db.getUpdateInfo(
|
|
261
|
-
FingerprintGetBundlesArgs(
|
|
262
|
-
platform: Platform.android,
|
|
263
|
-
bundleId: 'b1',
|
|
264
|
-
fingerprintHash: 'abc',
|
|
265
|
-
),
|
|
266
|
-
);
|
|
267
|
-
expect(result, isNull);
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
group('mergeBundleUpdate', () {
|
|
272
|
-
test('replaces targetCohorts', () {
|
|
273
|
-
final base = _bundle('a');
|
|
274
|
-
final updated = mergeBundleUpdate(base, {
|
|
275
|
-
'targetCohorts': ['cohort1'],
|
|
276
|
-
});
|
|
277
|
-
expect(updated.targetCohorts, ['cohort1']);
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
test('replaces patches', () {
|
|
281
|
-
final base = _bundle('a');
|
|
282
|
-
final updated = mergeBundleUpdate(base, {'patches': []});
|
|
283
|
-
expect(updated.patches, isEmpty);
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
test('updates scalar fields', () {
|
|
287
|
-
final base = _bundle('a');
|
|
288
|
-
final updated = mergeBundleUpdate(base, {'enabled': false});
|
|
289
|
-
expect(updated.enabled, false);
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
test('preserves existing fields not in patch', () {
|
|
293
|
-
final base = _bundle('a');
|
|
294
|
-
final updated = mergeBundleUpdate(base, {'enabled': false});
|
|
295
|
-
expect(updated.fileHash, 'hash_a');
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import 'package:flutter_ota_kit_plugin_core/src/create_storage_plugin.dart';
|
|
2
|
-
import 'package:flutter_ota_kit_plugin_core/src/types.dart';
|
|
3
|
-
import 'package:test/test.dart';
|
|
4
|
-
|
|
5
|
-
class _MockNodeProfile implements NodeStorageProfile {
|
|
6
|
-
@override
|
|
7
|
-
Future<Map<String, String>> upload(String key, String filePath) async => {
|
|
8
|
-
'storageUri': 'mock://$key',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
@override
|
|
12
|
-
Future<bool> exists(String storageUri) async => true;
|
|
13
|
-
|
|
14
|
-
@override
|
|
15
|
-
Future<void> delete(String storageUri) async {}
|
|
16
|
-
|
|
17
|
-
@override
|
|
18
|
-
Future<void> downloadFile(String storageUri, String filePath) async {}
|
|
19
|
-
|
|
20
|
-
@override
|
|
21
|
-
Future<List<StorageObject>> listObjects([String? prefix]) async => [];
|
|
22
|
-
|
|
23
|
-
@override
|
|
24
|
-
Future<void> deleteObjects(List<String> keys) async {}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
class _MockRuntimeProfile implements RuntimeStorageProfile {
|
|
28
|
-
@override
|
|
29
|
-
Future<Map<String, String>> getDownloadUrl(String storageUri) async => {
|
|
30
|
-
'url': 'https://example.com/$storageUri',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
@override
|
|
34
|
-
Future<String?> readText(String storageUri) async => 'content';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
void main() {
|
|
38
|
-
group('createNodeStoragePlugin', () {
|
|
39
|
-
test('creates a storage plugin with node profile', () {
|
|
40
|
-
final factory = createNodeStoragePlugin<String>(
|
|
41
|
-
name: 'testStorage',
|
|
42
|
-
supportedProtocol: 'mock://',
|
|
43
|
-
factory: (config) => _MockNodeProfile(),
|
|
44
|
-
);
|
|
45
|
-
final plugin = factory('cfg');
|
|
46
|
-
expect(plugin.name, 'testStorage');
|
|
47
|
-
expect(plugin.supportedProtocol, 'mock://');
|
|
48
|
-
expect(plugin.profiles.hasNode, isTrue);
|
|
49
|
-
expect(plugin.profiles.hasRuntime, isFalse);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('factory is lazy — not called until profile method invoked', () async {
|
|
53
|
-
var called = false;
|
|
54
|
-
final factory = createNodeStoragePlugin<String>(
|
|
55
|
-
name: 'testStorage',
|
|
56
|
-
supportedProtocol: 'mock://',
|
|
57
|
-
factory: (config) {
|
|
58
|
-
called = true;
|
|
59
|
-
return _MockNodeProfile();
|
|
60
|
-
},
|
|
61
|
-
);
|
|
62
|
-
final plugin = factory('cfg');
|
|
63
|
-
expect(called, isFalse);
|
|
64
|
-
// Calling a method on the profile triggers the factory
|
|
65
|
-
await plugin.profiles.node!.exists('uri');
|
|
66
|
-
expect(called, isTrue);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('upload calls hook after completion', () async {
|
|
70
|
-
var hookCalled = false;
|
|
71
|
-
final factory = createNodeStoragePlugin<String>(
|
|
72
|
-
name: 'testStorage',
|
|
73
|
-
supportedProtocol: 'mock://',
|
|
74
|
-
factory: (config) => _MockNodeProfile(),
|
|
75
|
-
);
|
|
76
|
-
final plugin = factory(
|
|
77
|
-
'cfg',
|
|
78
|
-
StoragePluginHooks(
|
|
79
|
-
onStorageUploaded: () async {
|
|
80
|
-
hookCalled = true;
|
|
81
|
-
},
|
|
82
|
-
),
|
|
83
|
-
);
|
|
84
|
-
await plugin.profiles.node!.upload('key', '/path');
|
|
85
|
-
expect(hookCalled, isTrue);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test('without hook, upload works fine', () async {
|
|
89
|
-
final factory = createNodeStoragePlugin<String>(
|
|
90
|
-
name: 'testStorage',
|
|
91
|
-
supportedProtocol: 'mock://',
|
|
92
|
-
factory: (config) => _MockNodeProfile(),
|
|
93
|
-
);
|
|
94
|
-
final plugin = factory('cfg');
|
|
95
|
-
final result = await plugin.profiles.node!.upload('key', '/path');
|
|
96
|
-
expect(result['storageUri'], 'mock://key');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
test('multiple method calls use same cached underlying profile', () async {
|
|
100
|
-
var callCount = 0;
|
|
101
|
-
final factory = createNodeStoragePlugin<String>(
|
|
102
|
-
name: 'testStorage',
|
|
103
|
-
supportedProtocol: 'mock://',
|
|
104
|
-
factory: (config) {
|
|
105
|
-
callCount++;
|
|
106
|
-
return _MockNodeProfile();
|
|
107
|
-
},
|
|
108
|
-
);
|
|
109
|
-
final plugin = factory('cfg');
|
|
110
|
-
// First method call triggers factory
|
|
111
|
-
await plugin.profiles.node!.exists('uri');
|
|
112
|
-
expect(callCount, 1);
|
|
113
|
-
// Second method call reuses the same cached profile
|
|
114
|
-
await plugin.profiles.node!.exists('uri2');
|
|
115
|
-
expect(callCount, 1);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
group('createRuntimeStoragePlugin', () {
|
|
120
|
-
test('creates a storage plugin with runtime profile', () {
|
|
121
|
-
final factory = createRuntimeStoragePlugin<String>(
|
|
122
|
-
name: 'testRuntime',
|
|
123
|
-
supportedProtocol: 'mock://',
|
|
124
|
-
factory: (config) => _MockRuntimeProfile(),
|
|
125
|
-
);
|
|
126
|
-
final plugin = factory('cfg');
|
|
127
|
-
expect(plugin.name, 'testRuntime');
|
|
128
|
-
expect(plugin.profiles.hasNode, isFalse);
|
|
129
|
-
expect(plugin.profiles.hasRuntime, isTrue);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
test('runtime profile delegates correctly', () async {
|
|
133
|
-
final factory = createRuntimeStoragePlugin<String>(
|
|
134
|
-
name: 'testRuntime',
|
|
135
|
-
supportedProtocol: 'mock://',
|
|
136
|
-
factory: (config) => _MockRuntimeProfile(),
|
|
137
|
-
);
|
|
138
|
-
final plugin = factory('cfg');
|
|
139
|
-
final url = await plugin.profiles.runtime!.getDownloadUrl(
|
|
140
|
-
'mock://file.zip',
|
|
141
|
-
);
|
|
142
|
-
expect(url['url'], contains('file.zip'));
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
group('createUniversalStoragePlugin', () {
|
|
147
|
-
test('creates a storage plugin with both profiles', () {
|
|
148
|
-
final factory = createUniversalStoragePlugin<String>(
|
|
149
|
-
name: 'testUniversal',
|
|
150
|
-
supportedProtocol: 'mock://',
|
|
151
|
-
factory: (config) =>
|
|
152
|
-
(node: _MockNodeProfile(), runtime: _MockRuntimeProfile()),
|
|
153
|
-
);
|
|
154
|
-
final plugin = factory('cfg');
|
|
155
|
-
expect(plugin.name, 'testUniversal');
|
|
156
|
-
expect(plugin.profiles.hasNode, isTrue);
|
|
157
|
-
expect(plugin.profiles.hasRuntime, isTrue);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
test('both profiles work independently', () async {
|
|
161
|
-
final factory = createUniversalStoragePlugin<String>(
|
|
162
|
-
name: 'testUniversal',
|
|
163
|
-
supportedProtocol: 'mock://',
|
|
164
|
-
factory: (config) =>
|
|
165
|
-
(node: _MockNodeProfile(), runtime: _MockRuntimeProfile()),
|
|
166
|
-
);
|
|
167
|
-
final plugin = factory('cfg');
|
|
168
|
-
|
|
169
|
-
final nodeResult = await plugin.profiles.node!.upload('k', '/p');
|
|
170
|
-
expect(nodeResult, isNotEmpty);
|
|
171
|
-
|
|
172
|
-
final runtimeUrl = await plugin.profiles.runtime!.getDownloadUrl(
|
|
173
|
-
'mock://file',
|
|
174
|
-
);
|
|
175
|
-
expect(runtimeUrl, isNotEmpty);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
test('factory is lazy', () async {
|
|
179
|
-
var called = false;
|
|
180
|
-
final factory = createUniversalStoragePlugin<String>(
|
|
181
|
-
name: 'testUniversal',
|
|
182
|
-
supportedProtocol: 'mock://',
|
|
183
|
-
factory: (config) {
|
|
184
|
-
called = true;
|
|
185
|
-
return (node: _MockNodeProfile(), runtime: _MockRuntimeProfile());
|
|
186
|
-
},
|
|
187
|
-
);
|
|
188
|
-
final plugin = factory('cfg');
|
|
189
|
-
expect(called, isFalse);
|
|
190
|
-
// Calling a method on the node profile triggers the factory
|
|
191
|
-
await plugin.profiles.node!.exists('uri');
|
|
192
|
-
expect(called, isTrue);
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import 'package:flutter_ota_kit_plugin_core/src/generate_min_bundle_id.dart';
|
|
2
|
-
import 'package:flutter_ota_kit_plugin_core/src/uuidv7.dart';
|
|
3
|
-
import 'package:test/test.dart';
|
|
4
|
-
|
|
5
|
-
void main() {
|
|
6
|
-
group('generateMinBundleId', () {
|
|
7
|
-
test('produces valid UUID v7 format', () {
|
|
8
|
-
final id = generateMinBundleId();
|
|
9
|
-
expect(
|
|
10
|
-
id,
|
|
11
|
-
matches(
|
|
12
|
-
RegExp(
|
|
13
|
-
r'^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$',
|
|
14
|
-
),
|
|
15
|
-
),
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('has zeroed random bits', () {
|
|
20
|
-
final id = generateMinBundleId();
|
|
21
|
-
final parts = id.split('-');
|
|
22
|
-
// version+rand_a should be 7000 (version 7, rand_a=0)
|
|
23
|
-
expect(parts[2], '7000');
|
|
24
|
-
// variant+rand_b starts with 8, rest is 0
|
|
25
|
-
expect(parts[3], '8000');
|
|
26
|
-
// node is all zeros
|
|
27
|
-
expect(parts[4], '000000000000');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('timestamp is close to current time', () {
|
|
31
|
-
final before = DateTime.now().millisecondsSinceEpoch;
|
|
32
|
-
final id = generateMinBundleId();
|
|
33
|
-
final after = DateTime.now().millisecondsSinceEpoch;
|
|
34
|
-
final ts = extractTimestampFromUUIDv7(id);
|
|
35
|
-
expect(ts, greaterThanOrEqualTo(before));
|
|
36
|
-
expect(ts, lessThanOrEqualTo(after));
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test('sorts before a normal UUIDv7 at the same millisecond', () {
|
|
40
|
-
// Create a min bundle ID
|
|
41
|
-
final minId = generateMinBundleId();
|
|
42
|
-
// Create a normal UUIDv7 (with random bits)
|
|
43
|
-
final normalId = createUUIDv7();
|
|
44
|
-
// Both are at approximately the same time, but min should be <= normal
|
|
45
|
-
// when timestamps are close
|
|
46
|
-
final minTs = extractTimestampFromUUIDv7(minId);
|
|
47
|
-
final normalTs = extractTimestampFromUUIDv7(normalId);
|
|
48
|
-
// If timestamps are the same, min should sort first
|
|
49
|
-
if (minTs == normalTs) {
|
|
50
|
-
expect(minId.compareTo(normalId), lessThan(0));
|
|
51
|
-
}
|
|
52
|
-
// Otherwise just verify the format is valid
|
|
53
|
-
expect(minId.length, 36);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|