@_nazmiforreal/flutter-ota 0.1.26 → 0.1.28
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/README.md +112 -18
- package/bin/flutter-ota-linux-x64 +0 -0
- package/bin/flutter-ota.js +12 -11
- package/dart-src/packages/cli-tools/README.md +146 -2
- 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/init.dart +36 -8
- 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 +334 -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 +1186 -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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
2
|
+
show PatchInfo, AppUpdateStatus;
|
|
3
|
+
|
|
4
|
+
/// Rich result of an update check. Returned by every backend source
|
|
5
|
+
/// (`SupabaseUpdateSource`, `PostgresUpdateSource`, `CloudflareUpdateSource`,
|
|
6
|
+
/// `AwsUpdateSource`) so callers can treat all backends uniformly.
|
|
7
|
+
class ServerUpdateResult {
|
|
8
|
+
const ServerUpdateResult({
|
|
9
|
+
required this.isUpToDate,
|
|
10
|
+
this.patch,
|
|
11
|
+
this.status = AppUpdateStatus.upToDate,
|
|
12
|
+
this.shouldForceUpdate = false,
|
|
13
|
+
this.id,
|
|
14
|
+
this.message,
|
|
15
|
+
this.gitCommitHash,
|
|
16
|
+
this.raw = const {},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
/// No update available (or an explicit up-to-date response).
|
|
20
|
+
factory ServerUpdateResult.upToDate() =>
|
|
21
|
+
const ServerUpdateResult(isUpToDate: true);
|
|
22
|
+
|
|
23
|
+
final bool isUpToDate;
|
|
24
|
+
|
|
25
|
+
/// Installable payload, when an update (or forced rollback) is available.
|
|
26
|
+
final PatchInfo? patch;
|
|
27
|
+
|
|
28
|
+
/// `update` | `rollback` | `upToDate`.
|
|
29
|
+
final AppUpdateStatus status;
|
|
30
|
+
|
|
31
|
+
/// The server wants this applied even if the device would normally skip it.
|
|
32
|
+
final bool shouldForceUpdate;
|
|
33
|
+
|
|
34
|
+
final String? id;
|
|
35
|
+
final String? message;
|
|
36
|
+
final String? gitCommitHash;
|
|
37
|
+
|
|
38
|
+
/// Backend-specific raw response data not mapped to named fields.
|
|
39
|
+
///
|
|
40
|
+
/// Contains any additional fields returned by the backend that are not
|
|
41
|
+
/// part of the standard update protocol. Useful for debugging or accessing
|
|
42
|
+
/// backend-specific metadata.
|
|
43
|
+
final Map<String, dynamic> raw;
|
|
44
|
+
|
|
45
|
+
bool get hasUpdate => !isUpToDate && patch != null;
|
|
46
|
+
}
|
package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_build_where.dart
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'dart:convert' show jsonEncode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
4
4
|
show DatabaseBundleQueryWhere;
|
|
5
5
|
|
|
6
6
|
/// Result of building a WHERE clause: SQL fragment plus positional params.
|
package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_bundle_mapper.dart
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'dart:convert' show jsonDecode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
4
4
|
show
|
|
5
5
|
Bundle,
|
|
6
6
|
BundleMetadata,
|
|
@@ -8,12 +8,12 @@ import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
|
8
8
|
Platform,
|
|
9
9
|
getBundlePatches;
|
|
10
10
|
|
|
11
|
-
import 'package:
|
|
11
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
12
12
|
show buildBundlePatchId, normalizeMetadata;
|
|
13
13
|
// Re-export the shared `buildBundlePatchId` so the cloudflare package's public
|
|
14
14
|
// API still exposes it; `parseMetadata` remains a backward-compatible alias of
|
|
15
15
|
// the shared `normalizeMetadata`.
|
|
16
|
-
export 'package:
|
|
16
|
+
export 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
17
17
|
show buildBundlePatchId;
|
|
18
18
|
|
|
19
19
|
/// Default rollout cohort count — full rollout in the Dart port's per-mille
|
package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/d1_database_plugin.dart
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'dart:convert' show jsonEncode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
4
4
|
show
|
|
5
5
|
AppVersionGetBundlesArgs,
|
|
6
6
|
Bundle,
|
|
@@ -8,7 +8,7 @@ import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
|
8
8
|
GetBundlesArgs,
|
|
9
9
|
UpdateInfo,
|
|
10
10
|
UpdateStrategy;
|
|
11
|
-
import 'package:
|
|
11
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
12
12
|
show
|
|
13
13
|
AbstractDatabasePlugin,
|
|
14
14
|
BundleChange,
|
package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/r2_s3_client.dart
RENAMED
|
@@ -3,7 +3,7 @@ import 'dart:io' show File;
|
|
|
3
3
|
import 'dart:typed_data' show Uint8List;
|
|
4
4
|
|
|
5
5
|
import 'package:crypto/crypto.dart' show Hmac, sha256;
|
|
6
|
-
import 'package:
|
|
6
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
7
7
|
show StorageObject;
|
|
8
8
|
import 'package:http/http.dart' show Client, Request, Response;
|
|
9
9
|
|
package/dart-src/{plugins/cloudflare/lib → root/lib/src/pkg/cloudflare}/src/r2_storage_profile.dart
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'package:path/path.dart' show basename;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
4
4
|
show
|
|
5
5
|
NodeStorageProfile,
|
|
6
6
|
RuntimeStorageProfile,
|
|
@@ -31,7 +31,7 @@ enum AppUpdateStatus {
|
|
|
31
31
|
/// Device is already on the latest bundle for its channel/platform.
|
|
32
32
|
upToDate('UP_TO_DATE'),
|
|
33
33
|
|
|
34
|
-
/// Device should roll back to a previous bundle.
|
|
34
|
+
/// Device should roll back to a previous bundle (server signaled rollback).
|
|
35
35
|
rollback('ROLLBACK'),
|
|
36
36
|
|
|
37
37
|
/// Device should download and install a new bundle.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
library;
|
|
2
2
|
|
|
3
3
|
// Re-export core types for convenience.
|
|
4
|
-
export 'package:
|
|
4
|
+
export 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
5
5
|
show Bundle, GetBundlesArgs, Platform, UpdateInfo, semverSatisfies;
|
|
6
6
|
|
|
7
7
|
// Plugin-core types.
|
package/dart-src/{plugins/plugin-core/lib → root/lib/src/pkg/plugin_core}/src/get_update_info.dart
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'package:
|
|
1
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart';
|
|
2
2
|
|
|
3
3
|
/// Build an [UpdateInfo] response from a [Bundle] and an [UpdateStatus].
|
|
4
4
|
UpdateInfo _makeResponse(Bundle bundle, UpdateStatus status) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import 'package:
|
|
2
|
-
export 'package:
|
|
1
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart';
|
|
2
|
+
export 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
3
3
|
show Bundle, GetBundlesArgs, Platform, UpdateInfo;
|
|
4
4
|
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// Maps PocketBase bundle records to [Bundle] and back.
|
|
2
2
|
library;
|
|
3
3
|
|
|
4
|
-
import 'package:
|
|
5
|
-
import 'package:
|
|
4
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart';
|
|
5
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
6
6
|
show normalizeMetadata;
|
|
7
7
|
|
|
8
8
|
/// Row shape of a `bundles` record as stored in PocketBase.
|
package/dart-src/{plugins/pocketbase/lib → root/lib/src/pkg/pocketbase}/src/pocketbase_database.dart
RENAMED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/// support, and comprehensive filter operators.
|
|
6
6
|
library;
|
|
7
7
|
|
|
8
|
-
import 'package:
|
|
9
|
-
import 'package:
|
|
8
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart';
|
|
9
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
10
10
|
|
|
11
11
|
import 'pocketbase_bundle_mapper.dart';
|
|
12
12
|
import 'pocketbase_client.dart';
|
|
@@ -75,6 +75,14 @@ class _PocketBaseDatabase implements AbstractDatabasePlugin {
|
|
|
75
75
|
|
|
76
76
|
@override
|
|
77
77
|
Future<List<String>> getChannels() async {
|
|
78
|
+
// Try the dedicated `channels` collection first. It exists (the schema
|
|
79
|
+
// installer creates it) but is NOT populated by deploy/promote — those only
|
|
80
|
+
// touch `bundles`. So an empty result here does NOT mean "no channels"; it
|
|
81
|
+
// means the collection is unused. Fall through to deriving channels from the
|
|
82
|
+
// bundles themselves (matching Supabase's `get_channels`, which is
|
|
83
|
+
// bundle-derived). Previously this returned the empty list on success and
|
|
84
|
+
// never reached the fallback, so `channel list` always showed "(no
|
|
85
|
+
// channels)" even with live bundles.
|
|
78
86
|
try {
|
|
79
87
|
final res = await client.listRecords<dynamic>(
|
|
80
88
|
config.channelsCollection,
|
|
@@ -82,24 +90,27 @@ class _PocketBaseDatabase implements AbstractDatabasePlugin {
|
|
|
82
90
|
perPage: 200,
|
|
83
91
|
sort: 'name',
|
|
84
92
|
);
|
|
85
|
-
|
|
93
|
+
final named = res.items
|
|
86
94
|
.map((j) => (j as Map)['name'] as String? ?? '')
|
|
87
95
|
.where((s) => s.isNotEmpty)
|
|
88
96
|
.toList();
|
|
97
|
+
if (named.isNotEmpty) return named;
|
|
89
98
|
} catch (_) {
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
// channels collection may not exist; fall through to bundle-derived.
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Fallback: distinct channels from the bundles collection.
|
|
103
|
+
final res = await client.listRecords<PocketBaseBundleRow>(
|
|
104
|
+
config.bundlesCollection,
|
|
105
|
+
PocketBaseBundleRow.fromJson,
|
|
106
|
+
perPage: 500,
|
|
107
|
+
sort: '-created',
|
|
108
|
+
);
|
|
109
|
+
final channels = <String>{};
|
|
110
|
+
for (final b in res.items) {
|
|
111
|
+
if (b.channel.isNotEmpty) channels.add(b.channel);
|
|
102
112
|
}
|
|
113
|
+
return channels.toList()..sort();
|
|
103
114
|
}
|
|
104
115
|
|
|
105
116
|
// ----- Single bundle -----
|
package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_bundle_mapper.dart
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// (the `mapRowToBundle` / `bundleToRowValues` / `bundleToPatchRows` helpers).
|
|
3
3
|
library;
|
|
4
4
|
|
|
5
|
-
import 'package:
|
|
5
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
6
6
|
show
|
|
7
7
|
Bundle,
|
|
8
8
|
BundleMetadata,
|
|
@@ -14,7 +14,7 @@ import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
|
14
14
|
getManifestStorageUri,
|
|
15
15
|
stripBundleArtifactMetadata;
|
|
16
16
|
|
|
17
|
-
import 'package:
|
|
17
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
18
18
|
show buildBundlePatchId, normalizeMetadata;
|
|
19
19
|
|
|
20
20
|
import 'postgres_types.dart';
|
package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_database.dart
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// Faithful port of hot-updater `plugins/postgres/src/postgres.ts`.
|
|
2
2
|
library;
|
|
3
3
|
|
|
4
|
-
import 'package:
|
|
4
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
5
5
|
show Bundle, UpdateInfo;
|
|
6
|
-
import 'package:
|
|
6
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
7
7
|
show
|
|
8
8
|
AbstractDatabasePlugin,
|
|
9
9
|
BundleChange,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/// installed (see `supabase/migrations` parity work / Phase 5).
|
|
7
7
|
library;
|
|
8
8
|
|
|
9
|
-
import 'package:
|
|
9
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
10
10
|
show
|
|
11
11
|
FingerprintGetBundlesArgs,
|
|
12
12
|
GetBundlesArgs,
|
|
@@ -14,7 +14,7 @@ import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
|
14
14
|
UpdateInfo,
|
|
15
15
|
UpdateStatus,
|
|
16
16
|
UpdateStrategy;
|
|
17
|
-
import 'package:
|
|
17
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
18
18
|
show filterCompatibleAppVersions;
|
|
19
19
|
|
|
20
20
|
import 'postgres_client.dart';
|
package/dart-src/{plugins/postgres/lib → root/lib/src/pkg/postgres}/src/postgres_storage.dart
RENAMED
|
@@ -2,7 +2,7 @@ import 'dart:convert';
|
|
|
2
2
|
import 'dart:io';
|
|
3
3
|
import 'dart:typed_data';
|
|
4
4
|
|
|
5
|
-
import 'package:
|
|
5
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
6
6
|
|
|
7
7
|
import 'postgres_client.dart';
|
|
8
8
|
import 'postgres_config.dart';
|
package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_bundle_mapper.dart
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// Faithful port of hot-updater `plugins/supabase/src/supabaseBundleMapper.ts`.
|
|
2
2
|
library;
|
|
3
3
|
|
|
4
|
-
import 'package:
|
|
4
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart';
|
|
5
5
|
|
|
6
|
-
import 'package:
|
|
6
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
7
7
|
show buildBundlePatchId, normalizeMetadata;
|
|
8
8
|
|
|
9
9
|
import 'types.dart';
|
package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_database.dart
RENAMED
|
@@ -3,8 +3,8 @@ library;
|
|
|
3
3
|
|
|
4
4
|
import 'dart:convert';
|
|
5
5
|
|
|
6
|
-
import 'package:
|
|
7
|
-
import 'package:
|
|
6
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart';
|
|
7
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
8
8
|
|
|
9
9
|
import 'supabase_bundle_mapper.dart';
|
|
10
10
|
import 'supabase_client_adapter.dart';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// Faithful port of hot-updater `plugins/supabase/src/supabaseEdgeFunctionDatabase.ts`.
|
|
2
2
|
library;
|
|
3
3
|
|
|
4
|
-
import 'package:
|
|
4
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
5
5
|
|
|
6
6
|
import 'supabase_database.dart';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// Faithful port of hot-updater `plugins/supabase/src/supabaseEdgeFunctionStorage.ts`.
|
|
2
2
|
library;
|
|
3
3
|
|
|
4
|
-
import 'package:
|
|
4
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
5
5
|
|
|
6
6
|
import 'supabase_client_adapter.dart';
|
|
7
7
|
import 'supabase_client_http.dart';
|
package/dart-src/{plugins/supabase/lib → root/lib/src/pkg/supabase}/src/supabase_storage.dart
RENAMED
|
@@ -3,7 +3,7 @@ library;
|
|
|
3
3
|
|
|
4
4
|
import 'dart:io' as io;
|
|
5
5
|
|
|
6
|
-
import 'package:
|
|
6
|
+
import 'package:flutter_ota_kit/src/pkg/plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
7
7
|
|
|
8
8
|
import 'supabase_client_adapter.dart';
|
|
9
9
|
import 'supabase_client_http.dart';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
2
|
+
show nilUuid, Platform, UpdateStrategy;
|
|
3
|
+
import 'package:flutter_ota_kit/src/pkg/client/flutter_ota_kit_client.dart'
|
|
4
|
+
show ServerUpdateResult;
|
|
5
|
+
import 'package:flutter_ota_kit/src/pkg/pocketbase/flutter_ota_kit_pocketbase.dart'
|
|
6
|
+
show
|
|
7
|
+
pocketbaseDatabase,
|
|
8
|
+
pocketbaseStorage,
|
|
9
|
+
PocketBaseConfig,
|
|
10
|
+
PocketBaseStorageConfig;
|
|
11
|
+
|
|
12
|
+
import 'shared_update_check.dart';
|
|
13
|
+
|
|
14
|
+
/// Configuration for a **PocketBase** update source (self-hosted, single binary).
|
|
15
|
+
///
|
|
16
|
+
/// Talks to a PocketBase instance directly over its REST API. The schema must
|
|
17
|
+
/// be installed via `flutter_ota_kit pocketbase serve` (or the equivalent
|
|
18
|
+
/// admin script) before the first device check.
|
|
19
|
+
///
|
|
20
|
+
/// PocketBase is a single-binary Go backend (SQLite + auth + file storage +
|
|
21
|
+
/// realtime + admin UI in ~15MB). It's the recommended option for small teams
|
|
22
|
+
/// that want a Supabase-like experience without a cloud account.
|
|
23
|
+
class PocketBaseUpdateConfig {
|
|
24
|
+
const PocketBaseUpdateConfig({
|
|
25
|
+
required this.url,
|
|
26
|
+
required this.adminEmail,
|
|
27
|
+
required this.adminPassword,
|
|
28
|
+
required this.bundlesCollection,
|
|
29
|
+
required this.bundlesBucket,
|
|
30
|
+
required this.channel,
|
|
31
|
+
required this.platform,
|
|
32
|
+
required this.updateStrategy,
|
|
33
|
+
this.appVersion,
|
|
34
|
+
this.fingerprintHash,
|
|
35
|
+
this.sdkVersion = '1.0.0',
|
|
36
|
+
this.cohort,
|
|
37
|
+
this.minBundleId = nilUuid,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/// Base URL of the PocketBase instance, e.g. `https://pb.example.com`.
|
|
41
|
+
final String url;
|
|
42
|
+
|
|
43
|
+
/// Admin email (used to mint short-lived file tokens for downloads).
|
|
44
|
+
final String adminEmail;
|
|
45
|
+
|
|
46
|
+
/// Admin password.
|
|
47
|
+
final String adminPassword;
|
|
48
|
+
|
|
49
|
+
/// Name of the PB collection that stores bundle records.
|
|
50
|
+
final String bundlesCollection;
|
|
51
|
+
|
|
52
|
+
/// Name of the PB file storage bucket for bundle artifacts.
|
|
53
|
+
final String bundlesBucket;
|
|
54
|
+
|
|
55
|
+
final String channel;
|
|
56
|
+
final Platform platform;
|
|
57
|
+
final UpdateStrategy updateStrategy;
|
|
58
|
+
final String? appVersion;
|
|
59
|
+
final String? fingerprintHash;
|
|
60
|
+
final String sdkVersion;
|
|
61
|
+
final String? cohort;
|
|
62
|
+
|
|
63
|
+
/// Build-time scan floor (mirrors hot-updater's `getMinBundleId()`). Bundles
|
|
64
|
+
/// with an id older than this are never served.
|
|
65
|
+
final String minBundleId;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// Device-side update source backed by a self-hosted PocketBase instance.
|
|
69
|
+
class PocketBaseUpdateSource {
|
|
70
|
+
const PocketBaseUpdateSource();
|
|
71
|
+
|
|
72
|
+
Future<ServerUpdateResult> check(
|
|
73
|
+
PocketBaseUpdateConfig config, {
|
|
74
|
+
String? currentBundleId,
|
|
75
|
+
Duration timeout = const Duration(seconds: 10),
|
|
76
|
+
}) async {
|
|
77
|
+
final dbConfig = PocketBaseConfig(
|
|
78
|
+
url: config.url,
|
|
79
|
+
adminEmail: config.adminEmail,
|
|
80
|
+
adminPassword: config.adminPassword,
|
|
81
|
+
bundlesCollection: config.bundlesCollection,
|
|
82
|
+
);
|
|
83
|
+
final storageConfig = PocketBaseStorageConfig(
|
|
84
|
+
url: config.url,
|
|
85
|
+
adminEmail: config.adminEmail,
|
|
86
|
+
adminPassword: config.adminPassword,
|
|
87
|
+
bundlesCollection: config.bundlesCollection,
|
|
88
|
+
bundlesBucket: config.bundlesBucket,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
final db = pocketbaseDatabase(dbConfig)();
|
|
92
|
+
final storage = pocketbaseStorage(storageConfig);
|
|
93
|
+
|
|
94
|
+
return performSharedUpdateCheck(
|
|
95
|
+
db: db,
|
|
96
|
+
storage: storage,
|
|
97
|
+
channel: config.channel,
|
|
98
|
+
platform: config.platform,
|
|
99
|
+
updateStrategy: config.updateStrategy,
|
|
100
|
+
appVersion: config.appVersion,
|
|
101
|
+
fingerprintHash: config.fingerprintHash,
|
|
102
|
+
minBundleId: config.minBundleId,
|
|
103
|
+
currentBundleId: currentBundleId,
|
|
104
|
+
timeout: timeout,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import 'package:flutter_ota_kit/src/pkg/core/flutter_ota_kit_core.dart'
|
|
2
|
+
show nilUuid, Platform, UpdateStrategy;
|
|
3
|
+
import 'package:flutter_ota_kit/src/pkg/client/flutter_ota_kit_client.dart'
|
|
4
|
+
show ServerUpdateResult;
|
|
5
|
+
import 'package:flutter_ota_kit/src/pkg/postgres/flutter_ota_kit_postgres.dart'
|
|
6
|
+
show
|
|
7
|
+
postgresDatabase,
|
|
8
|
+
postgresStorage,
|
|
9
|
+
PostgresConfig,
|
|
10
|
+
PostgresStorageConfig;
|
|
11
|
+
|
|
12
|
+
import 'shared_update_check.dart';
|
|
13
|
+
|
|
14
|
+
/// Configuration for a **Postgres** update source.
|
|
15
|
+
///
|
|
16
|
+
/// Like [SupabaseUpdateConfig], this talks to the backend directly — no separate
|
|
17
|
+
/// server process. The database plugin resolves the bundle metadata and the
|
|
18
|
+
/// storage plugin resolves the download URL. Because Postgres cannot serve bytes
|
|
19
|
+
/// over HTTP itself, [servingBaseUrl] must point at a proxy that reads from the
|
|
20
|
+
/// `flutter_ota_kit_storage` table (or leave it null and let the device read
|
|
21
|
+
/// directly if a PostgREST/HTTP layer is in front of the database).
|
|
22
|
+
class PostgresUpdateConfig {
|
|
23
|
+
const PostgresUpdateConfig({
|
|
24
|
+
required this.host,
|
|
25
|
+
this.port = 5432,
|
|
26
|
+
required this.database,
|
|
27
|
+
this.username,
|
|
28
|
+
this.password,
|
|
29
|
+
this.sslMode,
|
|
30
|
+
this.servingBaseUrl,
|
|
31
|
+
required this.channel,
|
|
32
|
+
required this.platform,
|
|
33
|
+
required this.updateStrategy,
|
|
34
|
+
this.appVersion,
|
|
35
|
+
this.fingerprintHash,
|
|
36
|
+
this.sdkVersion = '1.0.0',
|
|
37
|
+
this.cohort,
|
|
38
|
+
this.minBundleId = nilUuid,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
final String host;
|
|
42
|
+
final int port;
|
|
43
|
+
final String database;
|
|
44
|
+
final String? username;
|
|
45
|
+
final String? password;
|
|
46
|
+
final Object? sslMode;
|
|
47
|
+
final String? servingBaseUrl;
|
|
48
|
+
final String channel;
|
|
49
|
+
final Platform platform;
|
|
50
|
+
final UpdateStrategy updateStrategy;
|
|
51
|
+
final String? appVersion;
|
|
52
|
+
final String? fingerprintHash;
|
|
53
|
+
final String sdkVersion;
|
|
54
|
+
final String? cohort;
|
|
55
|
+
final String minBundleId;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class PostgresUpdateSource {
|
|
59
|
+
const PostgresUpdateSource();
|
|
60
|
+
|
|
61
|
+
Future<ServerUpdateResult> check(
|
|
62
|
+
PostgresUpdateConfig config, {
|
|
63
|
+
String? currentBundleId,
|
|
64
|
+
Duration timeout = const Duration(seconds: 10),
|
|
65
|
+
}) async {
|
|
66
|
+
final dbConfig = PostgresConfig(
|
|
67
|
+
host: config.host,
|
|
68
|
+
port: config.port,
|
|
69
|
+
database: config.database,
|
|
70
|
+
username: config.username,
|
|
71
|
+
password: config.password,
|
|
72
|
+
sslMode: config.sslMode as dynamic,
|
|
73
|
+
);
|
|
74
|
+
final storageConfig = PostgresStorageConfig(
|
|
75
|
+
db: dbConfig,
|
|
76
|
+
servingBaseUrl: config.servingBaseUrl,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
final db = postgresDatabase(dbConfig)();
|
|
80
|
+
final storage = postgresStorage(storageConfig);
|
|
81
|
+
|
|
82
|
+
return performSharedUpdateCheck(
|
|
83
|
+
db: db,
|
|
84
|
+
storage: storage,
|
|
85
|
+
channel: config.channel,
|
|
86
|
+
platform: config.platform,
|
|
87
|
+
updateStrategy: config.updateStrategy,
|
|
88
|
+
appVersion: config.appVersion,
|
|
89
|
+
fingerprintHash: config.fingerprintHash,
|
|
90
|
+
minBundleId: config.minBundleId,
|
|
91
|
+
currentBundleId: currentBundleId,
|
|
92
|
+
timeout: timeout,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|