@_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
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# flutter_ota_kit_pocketbase
|
|
2
|
-
|
|
3
|
-
PocketBase backend plugin for
|
|
4
|
-
[`flutter_ota_kit`](https://github.com/HYPER12755/flutter-ota-kit) — a
|
|
5
|
-
self-hostable code-push (OTA update) toolkit for Flutter Android.
|
|
6
|
-
|
|
7
|
-
PocketBase is a single-binary, Go-based backend that gives you SQLite,
|
|
8
|
-
auth, file storage, realtime, and an admin UI in one ~15 MB executable.
|
|
9
|
-
This plugin makes PocketBase a drop-in `DatabasePlugin` + `StoragePlugin`
|
|
10
|
-
for `flutter_ota_kit`.
|
|
11
|
-
|
|
12
|
-
## Install
|
|
13
|
-
|
|
14
|
-
```yaml
|
|
15
|
-
dependencies:
|
|
16
|
-
flutter_ota_kit: ^0.1.10
|
|
17
|
-
flutter_ota_kit_pocketbase: ^0.1.0
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Quick start
|
|
21
|
-
|
|
22
|
-
```dart
|
|
23
|
-
import 'package:flutter_ota_kit/flutter_ota_kit.dart';
|
|
24
|
-
import 'package:flutter_ota_kit_pocketbase/flutter_ota_kit_pocketbase.dart';
|
|
25
|
-
|
|
26
|
-
await FlutterPatcher.init(
|
|
27
|
-
pocketbaseConfig: PocketBaseUpdateConfig(
|
|
28
|
-
url: 'http://localhost:8090',
|
|
29
|
-
adminEmail: 'admin@example.com',
|
|
30
|
-
adminPassword: 'super-secret',
|
|
31
|
-
),
|
|
32
|
-
// ... other FlutterPatcher options
|
|
33
|
-
);
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Start a local PocketBase with the schema pre-installed
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
flutter-ota serve -b pocketbase
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
This downloads PocketBase (if missing), creates the `bundles` and
|
|
43
|
-
`channels` collections, installs validation hooks, and starts the
|
|
44
|
-
admin UI at `http://localhost:8090/_/`.
|
|
45
|
-
|
|
46
|
-
## Documentation
|
|
47
|
-
|
|
48
|
-
- [Backend guide → PocketBase](https://github.com/HYPER12755/flutter-ota-kit/blob/main/doc/backends.md#pocketbase)
|
|
49
|
-
- [API reference](https://github.com/HYPER12755/flutter-ota-kit/blob/main/doc/api-reference.md)
|
|
50
|
-
- [Main README](https://github.com/HYPER12755/flutter-ota-kit)
|
|
51
|
-
|
|
52
|
-
## License
|
|
53
|
-
|
|
54
|
-
MIT — see [LICENSE](LICENSE).
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// flutter_ota_kit_pocketbase example
|
|
2
|
-
//
|
|
3
|
-
// `flutter_ota_kit_pocketbase` is a PocketBase backend for
|
|
4
|
-
// `flutter_ota_kit`. PocketBase is a single-binary, self-hostable
|
|
5
|
-
// backend (similar to Supabase) that gives you SQLite, auth, file
|
|
6
|
-
// storage, realtime, and an admin UI in one ~15MB Go binary. This
|
|
7
|
-
// plugin makes it a drop-in `DatabasePlugin` + `StoragePlugin`.
|
|
8
|
-
//
|
|
9
|
-
// Pair this with `flutter_ota_kit serve` (cli-tools) to start a local
|
|
10
|
-
// PocketBase instance with the flutter_ota_kit schema pre-installed,
|
|
11
|
-
// plus an admin UI at `http://localhost:8090/_/`.
|
|
12
|
-
//
|
|
13
|
-
// Run: `dart run example/main.dart`
|
|
14
|
-
|
|
15
|
-
import 'package:flutter_ota_kit_pocketbase/flutter_ota_kit_pocketbase.dart';
|
|
16
|
-
|
|
17
|
-
void main() {
|
|
18
|
-
// ── 1. Database config (the `bundles` collection). ──────────────
|
|
19
|
-
// `url` is the base URL of your PocketBase instance. `adminEmail` /
|
|
20
|
-
// `adminPassword` are the superuser credentials — used only for
|
|
21
|
-
// server-side reads/writes against the `bundles` and `channels`
|
|
22
|
-
// collections.
|
|
23
|
-
const dbConfig = PocketBaseConfig(
|
|
24
|
-
url: 'http://localhost:8090',
|
|
25
|
-
adminEmail: 'admin@example.com',
|
|
26
|
-
adminPassword: 'super-secret',
|
|
27
|
-
);
|
|
28
|
-
print('PocketBase URL: ${dbConfig.url}');
|
|
29
|
-
print('Bundles collection: ${dbConfig.bundlesCollection}');
|
|
30
|
-
|
|
31
|
-
// ── 2. Storage config (the `bundles` file bucket). ───────────────
|
|
32
|
-
// The `bundlesCollection` is the collection whose records carry the
|
|
33
|
-
// patch file attachments. The `bundlesBucket` is the file-storage
|
|
34
|
-
// bucket name within PocketBase.
|
|
35
|
-
const storageConfig = PocketBaseStorageConfig(
|
|
36
|
-
url: 'http://localhost:8090',
|
|
37
|
-
adminEmail: 'admin@example.com',
|
|
38
|
-
adminPassword: 'super-secret',
|
|
39
|
-
bundlesCollection: 'bundles',
|
|
40
|
-
bundlesBucket: 'bundles',
|
|
41
|
-
);
|
|
42
|
-
print('Bucket: ${storageConfig.bundlesBucket}');
|
|
43
|
-
|
|
44
|
-
// ── 3. Storage URI helpers. ──────────────────────────────────────
|
|
45
|
-
// Build a `pb://<bucket>/<recordId>/<file>` URI for a given
|
|
46
|
-
// record+filename. The device SDK understands this format and
|
|
47
|
-
// downloads via the PocketBase `/api/files/{collection}/{id}/{file}`
|
|
48
|
-
// endpoint (with a short-lived token).
|
|
49
|
-
final uri = buildPocketBaseStorageUri(
|
|
50
|
-
'01a059a6-7d3c-4f3e-8a2c-9c2e3a4b5d6e',
|
|
51
|
-
'patch.zip',
|
|
52
|
-
);
|
|
53
|
-
print('Storage URI: $uri');
|
|
54
|
-
|
|
55
|
-
// Round-trip it:
|
|
56
|
-
final parsed = parsePocketBaseStorageUri(uri);
|
|
57
|
-
if (parsed != null) {
|
|
58
|
-
print('Parsed bucket: ${parsed.bucket}');
|
|
59
|
-
print('Parsed recordId: ${parsed.recordId}');
|
|
60
|
-
print('Parsed filename: ${parsed.filename}');
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: flutter_ota_kit_pocketbase
|
|
2
|
-
description: PocketBase plugin for flutter_ota_kit — local-first self-hostable backend with admin UI, auth, file storage, and realtime.
|
|
3
|
-
version: 0.1.7
|
|
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
|
-
flutter_ota_kit_plugin_core: ^0.0.10
|
|
16
|
-
http: ^1.2.0
|
|
17
|
-
|
|
18
|
-
dev_dependencies:
|
|
19
|
-
test: ^1.25.0
|
|
20
|
-
lints: ^4.0.0
|
|
21
|
-
|
|
22
|
-
dependency_overrides:
|
|
23
|
-
flutter_ota_kit_core:
|
|
24
|
-
path: ../../packages/core
|
|
25
|
-
flutter_ota_kit_plugin_core:
|
|
26
|
-
path: ../plugin-core
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import 'package:flutter_ota_kit_pocketbase/flutter_ota_kit_pocketbase.dart';
|
|
2
|
-
import 'package:test/test.dart';
|
|
3
|
-
|
|
4
|
-
void main() {
|
|
5
|
-
test('buildPocketBaseStorageUri with no bucket parses back', () {
|
|
6
|
-
final uri = buildPocketBaseStorageUri('abc', 'file.zip');
|
|
7
|
-
final parsed = parsePocketBaseStorageUri(uri);
|
|
8
|
-
expect(parsed, isNotNull);
|
|
9
|
-
expect(parsed!.recordId, 'abc');
|
|
10
|
-
expect(parsed.filename, 'file.zip');
|
|
11
|
-
});
|
|
12
|
-
}
|
|
File without changes
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
## 0.1.10
|
|
2
|
-
|
|
3
|
-
- Release 2026-09-10
|
|
4
|
-
|
|
5
|
-
## 0.1.9
|
|
6
|
-
|
|
7
|
-
- Release 2026-09-10
|
|
8
|
-
|
|
9
|
-
## 0.1.9
|
|
10
|
-
|
|
11
|
-
- Automated release 2026-09-10
|
|
12
|
-
|
|
13
|
-
## 0.1.8
|
|
14
|
-
|
|
15
|
-
- Added comprehensive documentation for all public APIs.
|
|
16
|
-
- Improved bundle mapper and database plugin documentation.
|
|
17
|
-
- General maintenance.
|
|
18
|
-
|
|
19
|
-
## 0.1.7
|
|
20
|
-
|
|
21
|
-
- General maintenance.
|
|
22
|
-
|
|
23
|
-
## 0.1.6
|
|
@@ -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,29 +0,0 @@
|
|
|
1
|
-
# flutter_ota_kit_postgres
|
|
2
|
-
|
|
3
|
-
Postgres backend for flutter_ota_kit: bundle metadata in a Postgres database and
|
|
4
|
-
artifacts in the bytea-backed storage plugin. Used by the `flutter-ota` CLI and
|
|
5
|
-
the Flutter SDK's `FlutterPatcher.configurePostgres(...)`.
|
|
6
|
-
|
|
7
|
-
## What's inside
|
|
8
|
-
|
|
9
|
-
- `postgresDatabase` / `PostgresConfig` — bundle read/write over a Postgres
|
|
10
|
-
connection.
|
|
11
|
-
- `postgresStorage` / `PostgresStorageConfig` / `resolvePostgresStorageClient` —
|
|
12
|
-
artifact storage.
|
|
13
|
-
- `getUpdateInfo` — resolve the latest applicable bundle for a device.
|
|
14
|
-
- Row mappers (`PostgresBundleRow`, `PostgresBundlePatchRow`,
|
|
15
|
-
`bundleToRowValues`, `bundleToPatchRows`) for the `bundles` / `bundle_patches`
|
|
16
|
-
tables.
|
|
17
|
-
|
|
18
|
-
## Configuration (environment)
|
|
19
|
-
|
|
20
|
-
| Variable | Purpose |
|
|
21
|
-
| --- | --- |
|
|
22
|
-
| `DATABASE_URL` | Full Postgres connection string (preferred). |
|
|
23
|
-
| `POSTGRES_HOST` / `POSTGRES_PORT` / `POSTGRES_DB` / `POSTGRES_USER` / `POSTGRES_PASSWORD` / `POSTGRES_SSLMODE` | Individual connection fields. |
|
|
24
|
-
| `POSTGRES_SERVING_BASE_URL` | HTTP proxy/base URL in front of the storage table for artifact downloads. |
|
|
25
|
-
| `POSTGRES_BASE_PATH` | Optional object-key prefix. |
|
|
26
|
-
|
|
27
|
-
## License
|
|
28
|
-
|
|
29
|
-
MIT.
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// flutter_ota_kit_postgres example
|
|
2
|
-
//
|
|
3
|
-
// `flutter_ota_kit_postgres` is a Postgres backend for `flutter_ota_kit`.
|
|
4
|
-
// It provides a `postgresDatabase` factory and a `postgresStorage`
|
|
5
|
-
// factory that talk to a vanilla Postgres database (no Supabase, no
|
|
6
|
-
// Cloudflare — just `pg`).
|
|
7
|
-
//
|
|
8
|
-
// Most apps don't import this package directly; they wire it through
|
|
9
|
-
// `flutter_ota_kit.configurePostgres(...)` in their app boot path. This
|
|
10
|
-
// file shows the low-level config types in case you're writing a custom
|
|
11
|
-
// server, a migration script, or a CLI extension.
|
|
12
|
-
//
|
|
13
|
-
// Run: `dart run example/main.dart`
|
|
14
|
-
|
|
15
|
-
import 'package:flutter_ota_kit_postgres/flutter_ota_kit_postgres.dart';
|
|
16
|
-
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart';
|
|
17
|
-
|
|
18
|
-
void main() {
|
|
19
|
-
// ── 1. Database config (vanilla Postgres connection). ─────────────
|
|
20
|
-
// `PostgresConfig` is a thin wrapper around the `postgres` package
|
|
21
|
-
// connection parameters. The `host`/`port`/`database` triple is the
|
|
22
|
-
// canonical form; username/password are required for non-trust auth.
|
|
23
|
-
const dbConfig = PostgresConfig(
|
|
24
|
-
host: 'db.example.com',
|
|
25
|
-
port: 5432,
|
|
26
|
-
database: 'ota',
|
|
27
|
-
username: 'ota',
|
|
28
|
-
password: 'secret',
|
|
29
|
-
);
|
|
30
|
-
print('Postgres: ${dbConfig.host}:${dbConfig.port}/${dbConfig.database}');
|
|
31
|
-
|
|
32
|
-
// ── 2. Storage config (for storing patch blobs). ──────────────────
|
|
33
|
-
// The `servingBaseUrl` is the public-facing URL that the device SDK
|
|
34
|
-
// can use to download patches. Omit it only if you proxy the
|
|
35
|
-
// download through your own update-check endpoint.
|
|
36
|
-
const storageConfig = PostgresStorageConfig(
|
|
37
|
-
db: dbConfig,
|
|
38
|
-
servingBaseUrl: 'https://cdn.example.com/flutter-ota',
|
|
39
|
-
);
|
|
40
|
-
print('Serving base URL: ${storageConfig.servingBaseUrl}');
|
|
41
|
-
|
|
42
|
-
// ── 3. Row-to-Bundle mapping (server-side helper). ────────────────
|
|
43
|
-
// Use this when reading bundles from a custom query and passing them
|
|
44
|
-
// to the SDK's `PatchInfo.fromJson`. The mapper handles both
|
|
45
|
-
// camelCase and snake_case column names.
|
|
46
|
-
const row = PostgresBundleRow(
|
|
47
|
-
id: '01a059a6-7d3c-4f3e-8a2c-9c2e3a4b5d6e',
|
|
48
|
-
channel: 'production',
|
|
49
|
-
enabled: true,
|
|
50
|
-
shouldForceUpdate: false,
|
|
51
|
-
fileHash: '7c4a8d09ca3762af61e59520943dc26494f8941b',
|
|
52
|
-
platform: Platform.android,
|
|
53
|
-
storageUri:
|
|
54
|
-
'postgres-blob://flutter-ota-bundles/'
|
|
55
|
-
'01a059a6/patch.zip',
|
|
56
|
-
targetAppVersion: '1.0.0',
|
|
57
|
-
rolloutCohortCount: 100,
|
|
58
|
-
);
|
|
59
|
-
final bundle = mapRowToBundle(row);
|
|
60
|
-
print('Mapped bundle: ${bundle.id} (${bundle.storageUri})');
|
|
61
|
-
|
|
62
|
-
// ── 4. Bundle → SQL values (for inserts/updates). ────────────────
|
|
63
|
-
// Returns snake_case column→value maps ready to feed to a `pg` query.
|
|
64
|
-
final values = bundleToRowValues(bundle);
|
|
65
|
-
print('SQL column count: ${values.length}');
|
|
66
|
-
print(' file_hash = ${values['file_hash']}');
|
|
67
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: flutter_ota_kit_postgres
|
|
2
|
-
description: Postgres plugin for flutter_ota_kit — database backend.
|
|
3
|
-
version: 0.1.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
|
-
flutter_ota_kit_plugin_core: ^0.0.10
|
|
16
|
-
postgres: ^3.4.0
|
|
17
|
-
|
|
18
|
-
dev_dependencies:
|
|
19
|
-
test: ^1.25.0
|
|
20
|
-
lints: ^4.0.0
|
|
21
|
-
|
|
22
|
-
dependency_overrides:
|
|
23
|
-
flutter_ota_kit_core:
|
|
24
|
-
path: ../../packages/core
|
|
25
|
-
flutter_ota_kit_plugin_core:
|
|
26
|
-
path: ../plugin-core
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
-- HotUpdater.bundles
|
|
2
|
-
|
|
3
|
-
CREATE TYPE platforms AS ENUM ('ios', 'android');
|
|
4
|
-
|
|
5
|
-
CREATE TABLE bundles (
|
|
6
|
-
id uuid PRIMARY KEY,
|
|
7
|
-
platform platforms NOT NULL,
|
|
8
|
-
should_force_update boolean NOT NULL,
|
|
9
|
-
enabled boolean NOT NULL,
|
|
10
|
-
file_hash text NOT NULL,
|
|
11
|
-
git_commit_hash text,
|
|
12
|
-
message text,
|
|
13
|
-
channel text NOT NULL DEFAULT 'production',
|
|
14
|
-
storage_uri text NOT NULL,
|
|
15
|
-
target_app_version text,
|
|
16
|
-
fingerprint_hash text,
|
|
17
|
-
CONSTRAINT check_version_or_fingerprint CHECK (
|
|
18
|
-
(target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL)
|
|
19
|
-
),
|
|
20
|
-
metadata jsonb DEFAULT '{}'::jsonb,
|
|
21
|
-
manifest_storage_uri text,
|
|
22
|
-
manifest_file_hash text,
|
|
23
|
-
asset_base_storage_uri text,
|
|
24
|
-
rollout_cohort_count INTEGER DEFAULT 1000
|
|
25
|
-
CHECK (rollout_cohort_count >= 0 AND rollout_cohort_count <= 1000),
|
|
26
|
-
target_cohorts TEXT[]
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
CREATE TABLE bundle_patches (
|
|
30
|
-
id text PRIMARY KEY,
|
|
31
|
-
bundle_id uuid NOT NULL REFERENCES bundles(id) ON DELETE CASCADE,
|
|
32
|
-
base_bundle_id uuid NOT NULL REFERENCES bundles(id) ON DELETE CASCADE,
|
|
33
|
-
base_file_hash text NOT NULL,
|
|
34
|
-
patch_file_hash text NOT NULL,
|
|
35
|
-
patch_storage_uri text NOT NULL,
|
|
36
|
-
order_index integer NOT NULL DEFAULT 0
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
CREATE INDEX bundles_target_app_version_idx ON bundles(target_app_version);
|
|
40
|
-
CREATE INDEX bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
|
|
41
|
-
CREATE INDEX bundles_channel_idx ON bundles(channel);
|
|
42
|
-
CREATE INDEX bundles_rollout_idx ON bundles(rollout_cohort_count);
|
|
43
|
-
CREATE INDEX bundles_target_cohorts_idx ON bundles USING GIN (target_cohorts);
|
|
44
|
-
CREATE INDEX bundle_patches_bundle_id_idx ON bundle_patches(bundle_id);
|
|
45
|
-
CREATE INDEX bundle_patches_base_bundle_id_idx ON bundle_patches(base_bundle_id);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
-- HotUpdater.get_target_app_version_list
|
|
2
|
-
|
|
3
|
-
CREATE OR REPLACE FUNCTION get_target_app_version_list (
|
|
4
|
-
app_platform platforms,
|
|
5
|
-
min_bundle_id uuid
|
|
6
|
-
)
|
|
7
|
-
RETURNS TABLE (
|
|
8
|
-
target_app_version text
|
|
9
|
-
)
|
|
10
|
-
LANGUAGE plpgsql
|
|
11
|
-
AS
|
|
12
|
-
$$
|
|
13
|
-
BEGIN
|
|
14
|
-
RETURN QUERY
|
|
15
|
-
SELECT b.target_app_version
|
|
16
|
-
FROM bundles b
|
|
17
|
-
WHERE b.platform = app_platform
|
|
18
|
-
AND b.id >= min_bundle_id
|
|
19
|
-
GROUP BY b.target_app_version;
|
|
20
|
-
END;
|
|
21
|
-
$$;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { PGlite } from "@electric-sql/pglite";
|
|
2
|
-
import {
|
|
3
|
-
type Bundle,
|
|
4
|
-
type GetBundlesArgs,
|
|
5
|
-
NIL_UUID,
|
|
6
|
-
type UpdateInfo,
|
|
7
|
-
} from "@hot-updater/core";
|
|
8
|
-
import { filterCompatibleAppVersions } from "@hot-updater/js";
|
|
9
|
-
import { setupGetUpdateInfoTestSuite } from "@hot-updater/test-utils";
|
|
10
|
-
import camelcaseKeys from "camelcase-keys";
|
|
11
|
-
import { afterAll, beforeEach, describe } from "vitest";
|
|
12
|
-
|
|
13
|
-
import { prepareSql } from "./prepareSql";
|
|
14
|
-
|
|
15
|
-
const createInsertBundleQuery = (bundle: Bundle) => {
|
|
16
|
-
const rolloutCohortCount = bundle.rolloutCohortCount ?? 1000;
|
|
17
|
-
const targetCohorts = bundle.targetCohorts
|
|
18
|
-
? `ARRAY[${bundle.targetCohorts.map((id) => `'${id}'`).join(",")}]::TEXT[]`
|
|
19
|
-
: "NULL";
|
|
20
|
-
|
|
21
|
-
return `
|
|
22
|
-
INSERT INTO bundles (
|
|
23
|
-
id, file_hash, platform, target_app_version,
|
|
24
|
-
should_force_update, enabled, git_commit_hash, message, channel, storage_uri, fingerprint_hash,
|
|
25
|
-
rollout_cohort_count, target_cohorts
|
|
26
|
-
) VALUES (
|
|
27
|
-
'${bundle.id}',
|
|
28
|
-
'${bundle.fileHash}',
|
|
29
|
-
'${bundle.platform}',
|
|
30
|
-
${bundle.targetAppVersion ? `'${bundle.targetAppVersion}'` : "null"},
|
|
31
|
-
${bundle.shouldForceUpdate},
|
|
32
|
-
${bundle.enabled},
|
|
33
|
-
${bundle.gitCommitHash ? `'${bundle.gitCommitHash}'` : "null"},
|
|
34
|
-
${bundle.message ? `'${bundle.message}'` : "null"},
|
|
35
|
-
'${bundle.channel}',
|
|
36
|
-
'${bundle.storageUri}',
|
|
37
|
-
${bundle.fingerprintHash ? `'${bundle.fingerprintHash}'` : "null"},
|
|
38
|
-
${rolloutCohortCount},
|
|
39
|
-
${targetCohorts}
|
|
40
|
-
) ON CONFLICT (id) DO UPDATE SET
|
|
41
|
-
file_hash = EXCLUDED.file_hash,
|
|
42
|
-
platform = EXCLUDED.platform,
|
|
43
|
-
target_app_version = EXCLUDED.target_app_version,
|
|
44
|
-
should_force_update = EXCLUDED.should_force_update,
|
|
45
|
-
enabled = EXCLUDED.enabled,
|
|
46
|
-
git_commit_hash = EXCLUDED.git_commit_hash,
|
|
47
|
-
message = EXCLUDED.message,
|
|
48
|
-
channel = EXCLUDED.channel,
|
|
49
|
-
storage_uri = EXCLUDED.storage_uri,
|
|
50
|
-
fingerprint_hash = EXCLUDED.fingerprint_hash,
|
|
51
|
-
rollout_cohort_count = EXCLUDED.rollout_cohort_count,
|
|
52
|
-
target_cohorts = EXCLUDED.target_cohorts;
|
|
53
|
-
`;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const createGetUpdateInfo =
|
|
57
|
-
(db: PGlite) =>
|
|
58
|
-
async (
|
|
59
|
-
bundles: Bundle[],
|
|
60
|
-
args: GetBundlesArgs,
|
|
61
|
-
): Promise<UpdateInfo | null> => {
|
|
62
|
-
const {
|
|
63
|
-
bundleId,
|
|
64
|
-
platform,
|
|
65
|
-
minBundleId = NIL_UUID,
|
|
66
|
-
channel = "production",
|
|
67
|
-
_updateStrategy,
|
|
68
|
-
} = args;
|
|
69
|
-
await db.exec(createInsertBundleQuerys(bundles));
|
|
70
|
-
|
|
71
|
-
if (_updateStrategy === "fingerprint") {
|
|
72
|
-
const fingerprintHash = args.fingerprintHash;
|
|
73
|
-
const cohort = args.cohort;
|
|
74
|
-
const cohortSql = cohort ? `'${cohort}'` : "NULL";
|
|
75
|
-
const result = await db.query<{
|
|
76
|
-
id: string;
|
|
77
|
-
should_force_update: boolean;
|
|
78
|
-
message: string;
|
|
79
|
-
status: string;
|
|
80
|
-
storage_uri: string | null;
|
|
81
|
-
file_hash: string | null;
|
|
82
|
-
}>(
|
|
83
|
-
`
|
|
84
|
-
SELECT * FROM get_update_info_by_fingerprint_hash(
|
|
85
|
-
'${platform}',
|
|
86
|
-
'${bundleId}',
|
|
87
|
-
'${minBundleId}',
|
|
88
|
-
'${channel}',
|
|
89
|
-
'${fingerprintHash}',
|
|
90
|
-
${cohortSql}
|
|
91
|
-
);
|
|
92
|
-
`,
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
if (!result.rows[0]) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const row = result.rows[0];
|
|
100
|
-
return camelcaseKeys(row) as UpdateInfo;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const appVersion = args.appVersion;
|
|
104
|
-
const { rows: appVersionList } = await db.query<{
|
|
105
|
-
target_app_version: string;
|
|
106
|
-
}>(
|
|
107
|
-
`
|
|
108
|
-
SELECT target_app_version FROM get_target_app_version_list('${platform}', '${minBundleId}');
|
|
109
|
-
`,
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
const targetAppVersionList = filterCompatibleAppVersions(
|
|
113
|
-
appVersionList?.map((group) => group.target_app_version) ?? [],
|
|
114
|
-
appVersion,
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
const cohort = args.cohort;
|
|
118
|
-
const cohortSql = cohort ? `'${cohort}'` : "NULL";
|
|
119
|
-
const result = await db.query<{
|
|
120
|
-
id: string;
|
|
121
|
-
should_force_update: boolean;
|
|
122
|
-
message: string;
|
|
123
|
-
status: string;
|
|
124
|
-
storage_uri: string | null;
|
|
125
|
-
file_hash: string | null;
|
|
126
|
-
}>(
|
|
127
|
-
`
|
|
128
|
-
SELECT * FROM get_update_info_by_app_version(
|
|
129
|
-
'${platform}',
|
|
130
|
-
'${appVersion}',
|
|
131
|
-
'${bundleId}',
|
|
132
|
-
'${minBundleId ?? NIL_UUID}',
|
|
133
|
-
'${channel}',
|
|
134
|
-
ARRAY[${targetAppVersionList.map((v) => `'${v}'`).join(",")}]::text[],
|
|
135
|
-
${cohortSql}
|
|
136
|
-
);
|
|
137
|
-
`,
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
if (!result.rows[0]) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const row = result.rows[0];
|
|
145
|
-
return camelcaseKeys(row) as UpdateInfo;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const createInsertBundleQuerys = (bundles: Bundle[]) => {
|
|
149
|
-
return bundles.map(createInsertBundleQuery).join("\n");
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const db = new PGlite();
|
|
153
|
-
|
|
154
|
-
const sql = await prepareSql();
|
|
155
|
-
await db.exec(sql);
|
|
156
|
-
const getUpdateInfo = createGetUpdateInfo(db);
|
|
157
|
-
|
|
158
|
-
describe("getUpdateInfo", () => {
|
|
159
|
-
beforeEach(async () => {
|
|
160
|
-
await db.exec("DELETE FROM bundle_patches");
|
|
161
|
-
await db.exec("DELETE FROM bundles");
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
afterAll(async () => {
|
|
165
|
-
await db.close();
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
setupGetUpdateInfoTestSuite({
|
|
169
|
-
getUpdateInfo: getUpdateInfo,
|
|
170
|
-
});
|
|
171
|
-
});
|