@_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,74 +0,0 @@
|
|
|
1
|
-
import 'dart:io' show Directory, File;
|
|
2
|
-
|
|
3
|
-
import 'package:flutter_ota_kit_cloudflare/flutter_ota_kit_cloudflare.dart'
|
|
4
|
-
show r2Storage;
|
|
5
|
-
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
6
|
-
show StoragePlugin;
|
|
7
|
-
import 'package:path/path.dart' show basename;
|
|
8
|
-
import 'package:test/test.dart';
|
|
9
|
-
|
|
10
|
-
import 'mock_r2_client.dart' show Store, mockR2Config;
|
|
11
|
-
|
|
12
|
-
void main() {
|
|
13
|
-
group('cloudflare r2Storage', () {
|
|
14
|
-
late Store store;
|
|
15
|
-
late StoragePlugin plugin;
|
|
16
|
-
late String tmpFile;
|
|
17
|
-
late String outFile;
|
|
18
|
-
|
|
19
|
-
setUp(() {
|
|
20
|
-
store = Store();
|
|
21
|
-
plugin = r2Storage(mockR2Config(store));
|
|
22
|
-
final dir = Directory.systemTemp.createTempSync('fp_r2_').path;
|
|
23
|
-
tmpFile = '$dir/bundle.zip';
|
|
24
|
-
File(tmpFile).writeAsBytesSync([1, 2, 3, 4]);
|
|
25
|
-
outFile = '$dir/out.zip';
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('plugin metadata', () {
|
|
29
|
-
expect(plugin.name, 'r2Storage');
|
|
30
|
-
expect(plugin.supportedProtocol, 'r2');
|
|
31
|
-
expect(plugin.profiles.hasNode, isTrue);
|
|
32
|
-
expect(plugin.profiles.hasRuntime, isTrue);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('node upload + exists + downloadFile + delete', () async {
|
|
36
|
-
final node = plugin.profiles.node!;
|
|
37
|
-
final res = await node.upload('v1', tmpFile);
|
|
38
|
-
expect(res['storageUri'], 'r2://test-bucket/v1/${basename(tmpFile)}');
|
|
39
|
-
expect(await node.exists(res['storageUri']!), isTrue);
|
|
40
|
-
|
|
41
|
-
await node.downloadFile(res['storageUri']!, outFile);
|
|
42
|
-
expect(File(outFile).readAsBytesSync(), [1, 2, 3, 4]);
|
|
43
|
-
|
|
44
|
-
await node.delete(res['storageUri']!);
|
|
45
|
-
expect(await node.exists(res['storageUri']!), isFalse);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('runtime getDownloadUrl + readText (and missing → null)', () async {
|
|
49
|
-
final node = plugin.profiles.node!;
|
|
50
|
-
final runtime = plugin.profiles.runtime!;
|
|
51
|
-
|
|
52
|
-
final manifest = '${Directory.systemTemp.path}/fp_manifest.json';
|
|
53
|
-
File(manifest).writeAsStringSync('{"hello":1}');
|
|
54
|
-
final uploaded = await node.upload('manifests', manifest);
|
|
55
|
-
|
|
56
|
-
final url = await runtime.getDownloadUrl(uploaded['storageUri']!);
|
|
57
|
-
expect(url['fileUrl'], contains('manifests/'));
|
|
58
|
-
|
|
59
|
-
final text = await runtime.readText(uploaded['storageUri']!);
|
|
60
|
-
expect(text, '{"hello":1}');
|
|
61
|
-
|
|
62
|
-
expect(await runtime.readText('r2://test-bucket/missing'), isNull);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('listObjects filters by prefix', () async {
|
|
66
|
-
final node = plugin.profiles.node!;
|
|
67
|
-
await node.upload('a', tmpFile);
|
|
68
|
-
await node.upload('b', tmpFile);
|
|
69
|
-
|
|
70
|
-
expect(await node.listObjects(), hasLength(2));
|
|
71
|
-
expect(await node.listObjects('a/'), hasLength(1));
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
## 0.0.10
|
|
2
|
-
|
|
3
|
-
- Release 2026-09-10
|
|
4
|
-
|
|
5
|
-
## 0.0.10
|
|
6
|
-
|
|
7
|
-
- Automated release 2026-09-10
|
|
8
|
-
|
|
9
|
-
## 0.0.9
|
|
10
|
-
|
|
11
|
-
- Added comprehensive documentation for all public APIs.
|
|
12
|
-
- Documented `DatabasePlugin`, `StoragePlugin`, `BuildPlugin` interfaces.
|
|
13
|
-
- Documented `HotUpdaterContext` and `StorageResolveContext` schemas.
|
|
14
|
-
- Documented storage URI protocol schemes.
|
|
15
|
-
|
|
16
|
-
## 0.0.8
|
|
17
|
-
|
|
18
|
-
- General maintenance.
|
|
19
|
-
|
|
20
|
-
## 0.0.7
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 HYPER12755
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# flutter_ota_kit_plugin_core
|
|
2
|
-
|
|
3
|
-
Internal plugin abstractions shared by the flutter_ota_kit backend plugins
|
|
4
|
-
(`flutter_ota_kit_supabase`, `flutter_ota_kit_postgres`,
|
|
5
|
-
`flutter_ota_kit_cloudflare`, `flutter_ota_kit_aws`).
|
|
6
|
-
|
|
7
|
-
## What's inside
|
|
8
|
-
|
|
9
|
-
- The `Database`, `Storage`, and build interfaces that each backend implements.
|
|
10
|
-
- Factory helpers: `createDatabasePlugin`, `createStoragePlugin`,
|
|
11
|
-
`createBlobDatabasePlugin`.
|
|
12
|
-
- Pagination, content-addressed asset addressing, and storage/bundle layout
|
|
13
|
-
helpers used to keep all backends wire-compatible with the same bundle schema.
|
|
14
|
-
|
|
15
|
-
This package is a building block for the concrete backends and the `flutter-ota`
|
|
16
|
-
CLI; application code normally consumes the higher-level `flutter_ota_kit` API
|
|
17
|
-
instead.
|
|
18
|
-
|
|
19
|
-
## License
|
|
20
|
-
|
|
21
|
-
MIT.
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// flutter_ota_kit_plugin_core example
|
|
2
|
-
//
|
|
3
|
-
// `flutter_ota_kit_plugin_core` provides the shared abstractions that
|
|
4
|
-
// every backend plugin is built on top of: `DatabasePlugin`,
|
|
5
|
-
// `StoragePlugin`, `Bundle` filtering, storage-URI parsing, pagination,
|
|
6
|
-
// and the "blob database" factory used by the AWS, Cloudflare, and
|
|
7
|
-
// PocketBase backends.
|
|
8
|
-
//
|
|
9
|
-
// Most apps don't import this package directly; the SDK's update
|
|
10
|
-
// pipeline does. This file shows the standalone helpers so you can
|
|
11
|
-
// use them while writing a custom backend or a CLI tool.
|
|
12
|
-
//
|
|
13
|
-
// Run: `dart run example/main.dart`
|
|
14
|
-
|
|
15
|
-
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
16
|
-
|
|
17
|
-
void main() {
|
|
18
|
-
// ── 1. Storage URI parser. ───────────────────────────────────────
|
|
19
|
-
// `parseStorageUri` validates the protocol and returns the bucket +
|
|
20
|
-
// key. Throws on unknown protocols so misuse is caught early.
|
|
21
|
-
const supabaseUri =
|
|
22
|
-
'supabase-storage://flutter-ota-bundles/'
|
|
23
|
-
'01a059a6/patch.zip';
|
|
24
|
-
final parsed = parseStorageUri(supabaseUri, 'supabase-storage');
|
|
25
|
-
print('Parsed protocol: ${parsed.protocol}');
|
|
26
|
-
print('Parsed bucket: ${parsed.bucket}');
|
|
27
|
-
print('Parsed key: ${parsed.key}');
|
|
28
|
-
|
|
29
|
-
// ── 2. Bundle storage keys. ──────────────────────────────────────
|
|
30
|
-
// `createBundleStorageKey` returns a flat key for the patch blob
|
|
31
|
-
// inside a storage bucket. The default layout is `{id}/patch.zip`;
|
|
32
|
-
// for assets it's `{id}/assets/{path}`.
|
|
33
|
-
final patchKey = createBundleStorageKey('01a059a6');
|
|
34
|
-
print('Patch key: $patchKey');
|
|
35
|
-
|
|
36
|
-
final assetKey = createBundleStorageKey('01a059a6', [
|
|
37
|
-
'assets',
|
|
38
|
-
'images',
|
|
39
|
-
'logo.png',
|
|
40
|
-
]);
|
|
41
|
-
print('Asset key: $assetKey');
|
|
42
|
-
|
|
43
|
-
// ── 3. Patch ID helper. ──────────────────────────────────────────
|
|
44
|
-
// The device SDK reports the currently-installed patch id back to
|
|
45
|
-
// the server (so the server can compute diffs). For patches with a
|
|
46
|
-
// base, the id is `{currentId}-h{patchCount}`; for standalone
|
|
47
|
-
// patches, the id is the current id.
|
|
48
|
-
final patchId = buildBundlePatchId(
|
|
49
|
-
'01a059a6-7d3c-4f3e-8a2c-9c2e3a4b5d6e',
|
|
50
|
-
'00000000-0000-0000-0000-000000000000',
|
|
51
|
-
);
|
|
52
|
-
print('Patch id: $patchId');
|
|
53
|
-
|
|
54
|
-
// ── 4. Pagination math. ──────────────────────────────────────────
|
|
55
|
-
// `calculatePagination` returns total/page/hasNext/hasPrev info
|
|
56
|
-
// used by the CLI's `bundle list` command.
|
|
57
|
-
final p = calculatePagination(247, limit: 20, offset: 40);
|
|
58
|
-
print('Page ${p.currentPage} of ${p.totalPages} (${p.total} items)');
|
|
59
|
-
print(' hasNextPage: ${p.hasNextPage}');
|
|
60
|
-
print(' hasPreviousPage: ${p.hasPreviousPage}');
|
|
61
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
name: flutter_ota_kit_plugin_core
|
|
2
|
-
description: Plugin core abstractions for flutter_ota_kit — database, storage, and build interfaces.
|
|
3
|
-
version: 0.0.10
|
|
4
|
-
homepage: https://github.com/HYPER12755/flutter-ota-kit
|
|
5
|
-
repository: https://github.com/HYPER12755/flutter-ota-kit
|
|
6
|
-
issue_tracker: https://github.com/HYPER12755/flutter-ota-kit/issues
|
|
7
|
-
documentation: https://github.com/HYPER12755/flutter-ota-kit#readme
|
|
8
|
-
license: MIT
|
|
9
|
-
|
|
10
|
-
environment:
|
|
11
|
-
sdk: ">=3.13.2 <4.0.0"
|
|
12
|
-
|
|
13
|
-
dependencies:
|
|
14
|
-
flutter_ota_kit_core: ^0.1.8
|
|
15
|
-
mime: ^2.0.0
|
|
16
|
-
|
|
17
|
-
dev_dependencies:
|
|
18
|
-
test: ^1.25.0
|
|
19
|
-
lints: ^5.1.0
|
|
20
|
-
|
|
21
|
-
dependency_overrides:
|
|
22
|
-
flutter_ota_kit_core:
|
|
23
|
-
path: ../../packages/core
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import 'package:flutter_ota_kit_plugin_core/src/asset_storage_layout.dart';
|
|
2
|
-
import 'package:flutter_ota_kit_plugin_core/src/bundle_storage_layout.dart';
|
|
3
|
-
import 'package:flutter_ota_kit_plugin_core/src/legacy_asset_storage_layout.dart';
|
|
4
|
-
import 'package:test/test.dart';
|
|
5
|
-
|
|
6
|
-
void main() {
|
|
7
|
-
group('assetStorageLayout', () {
|
|
8
|
-
group('getAssetStorageLayout', () {
|
|
9
|
-
test('classifies /assets roots as content-addressed storage', () {
|
|
10
|
-
expect(
|
|
11
|
-
getAssetStorageLayout('s3://bucket/assets'),
|
|
12
|
-
'content-addressed',
|
|
13
|
-
);
|
|
14
|
-
expect(
|
|
15
|
-
getAssetStorageLayout('s3://bucket/releases/assets/'),
|
|
16
|
-
'content-addressed',
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test(
|
|
21
|
-
'classifies non-/assets roots as legacy per-bundle file storage',
|
|
22
|
-
() {
|
|
23
|
-
expect(
|
|
24
|
-
getAssetStorageLayout('s3://bucket/releases/bundle-id/files'),
|
|
25
|
-
'legacy-files',
|
|
26
|
-
);
|
|
27
|
-
},
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
group('getManifestAssetStoragePath', () {
|
|
32
|
-
test('resolves content-addressed manifest assets by file hash', () {
|
|
33
|
-
expect(
|
|
34
|
-
getManifestAssetStoragePath(
|
|
35
|
-
assetBaseStorageUri: 's3://bucket/assets',
|
|
36
|
-
assetPath: 'index.ios.bundle.br',
|
|
37
|
-
fileHash: 'abcdef',
|
|
38
|
-
),
|
|
39
|
-
'sha256/ab/abcdef.br',
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('resolves legacy manifest assets by manifest-relative path', () {
|
|
44
|
-
expect(
|
|
45
|
-
getManifestAssetStoragePath(
|
|
46
|
-
assetBaseStorageUri: 's3://bucket/releases/bundle-id/files',
|
|
47
|
-
assetPath: 'assets/logo.png',
|
|
48
|
-
fileHash: 'abcdef',
|
|
49
|
-
),
|
|
50
|
-
'assets/logo.png',
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
group('createStorageUriWithRelativePath', () {
|
|
56
|
-
test('creates escaped child storage uris', () {
|
|
57
|
-
expect(
|
|
58
|
-
createStorageUriWithRelativePath(
|
|
59
|
-
baseStorageUri: 's3://bucket/releases/assets/',
|
|
60
|
-
relativePath: 'assets/icon one.png',
|
|
61
|
-
),
|
|
62
|
-
's3://bucket/releases/assets/assets/icon%20one.png',
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
group('resolveManifestAssetStorageUri', () {
|
|
68
|
-
test('resolves manifest asset storage uris through the layout', () {
|
|
69
|
-
expect(
|
|
70
|
-
resolveManifestAssetStorageUri(
|
|
71
|
-
assetBaseStorageUri: 's3://bucket/assets',
|
|
72
|
-
assetPath: 'assets/logo.png',
|
|
73
|
-
fileHash: 'abcdef',
|
|
74
|
-
),
|
|
75
|
-
's3://bucket/assets/sha256/ab/abcdef.png',
|
|
76
|
-
);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
group('isBrotliManifestAssetPath', () {
|
|
81
|
-
test('matches index.*.bundle paths', () {
|
|
82
|
-
expect(isBrotliManifestAssetPath('index.ios.bundle'), isTrue);
|
|
83
|
-
expect(
|
|
84
|
-
isBrotliManifestAssetPath('nested/index.android.bundle'),
|
|
85
|
-
isTrue,
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('rejects non-index bundle paths', () {
|
|
90
|
-
expect(isBrotliManifestAssetPath('main.ios.bundle'), isFalse);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
group('getManifestAssetDownloadPath', () {
|
|
95
|
-
test('appends .br to index bundle paths', () {
|
|
96
|
-
expect(
|
|
97
|
-
getManifestAssetDownloadPath('index.ios.bundle'),
|
|
98
|
-
'index.ios.bundle.br',
|
|
99
|
-
);
|
|
100
|
-
expect(
|
|
101
|
-
getManifestAssetDownloadPath('nested/index.android.bundle'),
|
|
102
|
-
'nested/index.android.bundle.br',
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
test('passes through non-index bundle paths', () {
|
|
107
|
-
expect(
|
|
108
|
-
getManifestAssetDownloadPath('main.ios.bundle'),
|
|
109
|
-
'main.ios.bundle',
|
|
110
|
-
);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
group('bundleStorageLayout', () {
|
|
116
|
-
group('createBundleStorageKey', () {
|
|
117
|
-
test('stores new bundle artifacts below the bundles namespace', () {
|
|
118
|
-
expect(createBundleStorageKey('bundle-id'), 'bundles/bundle-id');
|
|
119
|
-
expect(
|
|
120
|
-
createBundleStorageKey('bundle-id', ['patches', 'base-id']),
|
|
121
|
-
'bundles/bundle-id/patches/base-id',
|
|
122
|
-
);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
group('createStorageRootUriWithPath', () {
|
|
127
|
-
test('derives the shared storage root from bundle URIs', () {
|
|
128
|
-
expect(
|
|
129
|
-
createStorageRootUriWithPath(
|
|
130
|
-
's3://bucket/releases/bundles/bundle-id/manifest.json',
|
|
131
|
-
'bundle-id',
|
|
132
|
-
'assets',
|
|
133
|
-
),
|
|
134
|
-
's3://bucket/releases/assets',
|
|
135
|
-
);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test('rejects storage URIs that do not contain the bundle id', () {
|
|
139
|
-
expect(
|
|
140
|
-
() => createStorageRootUriWithPath(
|
|
141
|
-
'https://uploads.example.com/object',
|
|
142
|
-
'bundle-id',
|
|
143
|
-
'assets',
|
|
144
|
-
),
|
|
145
|
-
throwsA(isA<StateError>()),
|
|
146
|
-
);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
test('preserves encoded storage root segments', () {
|
|
150
|
-
expect(
|
|
151
|
-
createStorageRootUriWithPath(
|
|
152
|
-
's3://bucket/release%20files/bundles/bundle-id/manifest.json',
|
|
153
|
-
'bundle-id',
|
|
154
|
-
'assets/sha256',
|
|
155
|
-
),
|
|
156
|
-
's3://bucket/release%20files/assets/sha256',
|
|
157
|
-
);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
group('legacyAssetStorageLayout', () {
|
|
163
|
-
test('getLegacyManifestAssetStoragePath returns assetPath unchanged', () {
|
|
164
|
-
expect(
|
|
165
|
-
getLegacyManifestAssetStoragePath(assetPath: 'assets/logo.png'),
|
|
166
|
-
'assets/logo.png',
|
|
167
|
-
);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import 'package:flutter_ota_kit_plugin_core/src/bundle_unit_of_work.dart';
|
|
2
|
-
import 'package:flutter_ota_kit_plugin_core/src/bundle_unit_of_work_store.dart';
|
|
3
|
-
import 'package:test/test.dart';
|
|
4
|
-
|
|
5
|
-
void main() {
|
|
6
|
-
setUp(() {
|
|
7
|
-
clearUnitOfWorkStore();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
group('isUnitOfWorkContext', () {
|
|
11
|
-
test('returns true for Map<String, Object?>', () {
|
|
12
|
-
expect(isUnitOfWorkContext(<String, Object?>{}), isTrue);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test('returns false for null', () {
|
|
16
|
-
expect(isUnitOfWorkContext(null), isFalse);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('returns false for non-map', () {
|
|
20
|
-
expect(isUnitOfWorkContext('string'), isFalse);
|
|
21
|
-
expect(isUnitOfWorkContext(42), isFalse);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('returns false for wrong map type', () {
|
|
25
|
-
// Dart generics are covariant, so Map<String, int> IS Map<String, Object?>
|
|
26
|
-
// Only key-type mismatches fail the check
|
|
27
|
-
expect(isUnitOfWorkContext(<int, Object?>{}), isFalse);
|
|
28
|
-
expect(isUnitOfWorkContext(<int, String>{}), isFalse);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
group('getRequestBundleUnitOfWork', () {
|
|
33
|
-
test('returns null for null context', () {
|
|
34
|
-
expect(getRequestBundleUnitOfWork(null), isNull);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('returns null for invalid context', () {
|
|
38
|
-
expect(getRequestBundleUnitOfWork('not a map'), isNull);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('creates new UoW for valid context', () {
|
|
42
|
-
final context = <String, Object?>{};
|
|
43
|
-
final uow1 = getRequestBundleUnitOfWork(context);
|
|
44
|
-
expect(uow1, isA<BundleUnitOfWork>());
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('returns same UoW for same context (identity)', () {
|
|
48
|
-
final context = <String, Object?>{};
|
|
49
|
-
final uow1 = getRequestBundleUnitOfWork(context);
|
|
50
|
-
final uow2 = getRequestBundleUnitOfWork(context);
|
|
51
|
-
expect(identical(uow1, uow2), isTrue);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('returns different UoW for different contexts', () {
|
|
55
|
-
final ctx1 = <String, Object?>{};
|
|
56
|
-
final ctx2 = <String, Object?>{};
|
|
57
|
-
final uow1 = getRequestBundleUnitOfWork(ctx1);
|
|
58
|
-
final uow2 = getRequestBundleUnitOfWork(ctx2);
|
|
59
|
-
expect(identical(uow1, uow2), isFalse);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
group('clearUnitOfWorkStore', () {
|
|
64
|
-
test('removes all entries', () {
|
|
65
|
-
final ctx = <String, Object?>{};
|
|
66
|
-
final uow = getRequestBundleUnitOfWork(ctx);
|
|
67
|
-
expect(uow, isNotNull);
|
|
68
|
-
clearUnitOfWorkStore();
|
|
69
|
-
// After clearing, a new UoW should be created for the same context
|
|
70
|
-
final uow2 = getRequestBundleUnitOfWork(ctx);
|
|
71
|
-
expect(identical(uow, uow2), isFalse);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|