@_nazmiforreal/flutter-ota 0.1.6 → 0.1.7
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 +13 -13
- package/bin/{flutter-patcher-linux-x64 → flutter-ota-linux-x64} +0 -0
- package/bin/{flutter-patcher.js → flutter-ota.js} +4 -4
- package/dart-src/packages/cli-tools/bin/{flutter_patcher.dart → flutter_ota_kit.dart} +2 -2
- package/dart-src/packages/cli-tools/lib/{flutter_patcher_cli.dart → flutter_ota_kit_cli.dart} +5 -3
- package/dart-src/packages/cli-tools/lib/src/backend.dart +6 -25
- package/dart-src/packages/cli-tools/lib/src/cli_base.dart +10 -4
- package/dart-src/packages/cli-tools/lib/src/commands/build.dart +5 -3
- package/dart-src/packages/cli-tools/lib/src/commands/bundle.dart +279 -10
- package/dart-src/packages/cli-tools/lib/src/commands/channel.dart +7 -7
- package/dart-src/packages/cli-tools/lib/src/commands/config_command.dart +5 -5
- package/dart-src/packages/cli-tools/lib/src/commands/console.dart +4 -4
- package/dart-src/packages/cli-tools/lib/src/commands/deploy.dart +4 -4
- package/dart-src/packages/cli-tools/lib/src/commands/doctor.dart +3 -3
- package/dart-src/packages/cli-tools/lib/src/commands/fingerprint.dart +1 -1
- package/dart-src/packages/cli-tools/lib/src/commands/init.dart +294 -45
- package/dart-src/packages/cli-tools/lib/src/commands/keys.dart +1 -1
- package/dart-src/packages/cli-tools/lib/src/commands/migrate.dart +59 -24
- package/dart-src/packages/cli-tools/lib/src/commands/rollback.dart +5 -5
- package/dart-src/packages/cli-tools/lib/src/commands/storage.dart +117 -0
- package/dart-src/packages/cli-tools/lib/src/config.dart +29 -78
- package/dart-src/packages/cli-tools/lib/src/operations.dart +4 -4
- package/dart-src/packages/cli-tools/lib/src/pack.dart +12 -6
- package/dart-src/packages/cli-tools/lib/src/runner.dart +21 -3
- package/dart-src/packages/cli-tools/lib/src/ui/ui.dart +2 -2
- package/dart-src/packages/cli-tools/lib/src/verbose.dart +3 -0
- package/dart-src/packages/cli-tools/migrations/aws/README.md +7 -0
- package/dart-src/packages/cli-tools/migrations/postgres/bundles.sql +45 -0
- package/dart-src/packages/cli-tools/migrations/postgres/get_target_app_version_list.sql +21 -0
- package/dart-src/packages/cli-tools/migrations/postgres/get_update_info_by_app_version.sql +126 -0
- package/dart-src/packages/cli-tools/migrations/postgres/get_update_info_by_fingerprint_hash.sql +125 -0
- package/dart-src/packages/cli-tools/migrations/postgres/hash_user_id.sql +30 -0
- package/dart-src/packages/cli-tools/migrations/postgres/is_device_eligible.sql +237 -0
- package/dart-src/packages/cli-tools/migrations/supabase/20260520014100_hot-updater_rls.sql +11 -0
- package/dart-src/packages/cli-tools/pubspec.yaml +8 -10
- package/dart-src/packages/cli-tools/test/backends_test.dart +4 -4
- package/dart-src/packages/cli-tools/test/build_pack_test.dart +1 -1
- package/dart-src/packages/cli-tools/test/cli_test.dart +3 -3
- 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_postgres_client.dart +7 -7
- package/dart-src/packages/core/lib/{flutter_patcher_core.dart → flutter_ota_kit_core.dart} +1 -1
- package/dart-src/packages/core/pubspec.yaml +2 -2
- package/dart-src/packages/core/test/rollout_test.dart +1 -1
- package/dart-src/packages/core/test/semver_test.dart +1 -1
- package/dart-src/packages/core/test/types_test.dart +2 -2
- package/dart-src/packages/core/test/uuid_test.dart +1 -1
- package/dart-src/packages/core/tool/dbg.dart +1 -1
- package/dart-src/plugins/aws/lib/{flutter_patcher_aws.dart → flutter_ota_kit_aws.dart} +0 -2
- package/dart-src/plugins/aws/lib/src/aws_cloudfront_client.dart +1 -1
- package/dart-src/plugins/aws/lib/src/aws_database.dart +1 -1
- package/dart-src/plugins/aws/lib/src/aws_s3_client.dart +1 -1
- package/dart-src/plugins/aws/lib/src/aws_storage.dart +1 -1
- package/dart-src/plugins/aws/lib/src/aws_storage_profile.dart +25 -3
- package/dart-src/plugins/aws/lib/src/with_cloudfront_signed_url.dart +1 -1
- package/dart-src/plugins/aws/pubspec.yaml +4 -4
- package/dart-src/plugins/aws/test/aws_database_test.dart +3 -3
- package/dart-src/plugins/aws/test/aws_storage_test.dart +2 -2
- package/dart-src/plugins/aws/test/mock_aws_s3_client.dart +2 -2
- package/dart-src/plugins/cloudflare/lib/src/cloudflare_worker_database.dart +1 -1
- package/dart-src/plugins/cloudflare/lib/src/d1_build_where.dart +1 -1
- package/dart-src/plugins/cloudflare/lib/src/d1_bundle_mapper.dart +1 -1
- package/dart-src/plugins/cloudflare/lib/src/d1_database.dart +1 -1
- package/dart-src/plugins/cloudflare/lib/src/d1_database_plugin.dart +2 -2
- package/dart-src/plugins/cloudflare/lib/src/r2_s3_client.dart +1 -1
- package/dart-src/plugins/cloudflare/lib/src/r2_storage.dart +1 -1
- package/dart-src/plugins/cloudflare/lib/src/r2_storage_profile.dart +1 -1
- package/dart-src/plugins/cloudflare/pubspec.yaml +4 -4
- package/dart-src/plugins/cloudflare/test/cloudflare_worker_database_test.dart +2 -2
- package/dart-src/plugins/cloudflare/test/d1_bundle_mapper_test.dart +2 -2
- package/dart-src/plugins/cloudflare/test/d1_database_test.dart +2 -2
- package/dart-src/plugins/cloudflare/test/mock_d1_client.dart +2 -2
- package/dart-src/plugins/cloudflare/test/mock_r2_client.dart +2 -2
- package/dart-src/plugins/cloudflare/test/r2_storage_test.dart +2 -2
- package/dart-src/plugins/plugin-core/lib/{flutter_patcher_plugin_core.dart → flutter_ota_kit_plugin_core.dart} +1 -1
- package/dart-src/plugins/plugin-core/lib/src/create_blob_database_plugin.dart +1 -1
- package/dart-src/plugins/plugin-core/lib/src/filter_compatible_app_versions.dart +1 -1
- package/dart-src/plugins/plugin-core/lib/src/get_update_info.dart +1 -1
- package/dart-src/plugins/plugin-core/lib/src/request_update_bundle_state.dart +1 -1
- package/dart-src/plugins/plugin-core/lib/src/resolve_update_info_from_bundles.dart +1 -1
- package/dart-src/plugins/plugin-core/lib/src/types.dart +2 -2
- package/dart-src/plugins/plugin-core/pubspec.yaml +3 -3
- package/dart-src/plugins/plugin-core/test/asset_storage_layout_test.dart +3 -3
- package/dart-src/plugins/plugin-core/test/bundle_unit_of_work_store_test.dart +2 -2
- package/dart-src/plugins/plugin-core/test/bundle_unit_of_work_test.dart +2 -2
- package/dart-src/plugins/plugin-core/test/create_blob_database_plugin_test.dart +2 -2
- package/dart-src/plugins/plugin-core/test/create_database_plugin_test.dart +5 -5
- package/dart-src/plugins/plugin-core/test/create_storage_plugin_test.dart +2 -2
- package/dart-src/plugins/plugin-core/test/generate_min_bundle_id_test.dart +2 -2
- package/dart-src/plugins/plugin-core/test/get_update_info_test.dart +2 -2
- package/dart-src/plugins/plugin-core/test/helpers_test.dart +2 -2
- package/dart-src/plugins/plugin-core/test/query_bundles_test.dart +2 -2
- package/dart-src/plugins/plugin-core/test/request_update_bundle_state_test.dart +3 -3
- package/dart-src/plugins/plugin-core/test/uuidv7_test.dart +1 -1
- package/dart-src/plugins/postgres/lib/{flutter_patcher_postgres.dart → flutter_ota_kit_postgres.dart} +1 -1
- package/dart-src/plugins/postgres/lib/src/postgres_bundle_mapper.dart +1 -1
- package/dart-src/plugins/postgres/lib/src/postgres_database.dart +2 -2
- package/dart-src/plugins/postgres/lib/src/postgres_get_update_info.dart +2 -2
- package/dart-src/plugins/postgres/lib/src/postgres_storage.dart +9 -9
- package/dart-src/plugins/postgres/lib/src/postgres_types.dart +1 -1
- package/dart-src/plugins/postgres/pubspec.yaml +4 -4
- package/dart-src/plugins/postgres/test/mock_postgres_client.dart +2 -2
- package/dart-src/plugins/postgres/test/postgres_bundle_mapper_test.dart +2 -2
- package/dart-src/plugins/postgres/test/postgres_database_test.dart +2 -2
- package/dart-src/plugins/supabase/lib/edge.dart +1 -1
- package/dart-src/plugins/supabase/lib/{flutter_patcher_supabase.dart → flutter_ota_kit_supabase.dart} +1 -1
- package/dart-src/plugins/supabase/lib/src/supabase_bundle_mapper.dart +1 -1
- package/dart-src/plugins/supabase/lib/src/supabase_client_http.dart +5 -1
- package/dart-src/plugins/supabase/lib/src/supabase_database.dart +2 -2
- package/dart-src/plugins/supabase/lib/src/supabase_edge_function_database.dart +1 -1
- package/dart-src/plugins/supabase/lib/src/supabase_edge_function_storage.dart +1 -1
- package/dart-src/plugins/supabase/lib/src/supabase_storage.dart +2 -5
- package/dart-src/plugins/supabase/pubspec.yaml +4 -4
- package/dart-src/plugins/supabase/test/mock_supabase_client.dart +5 -5
- package/dart-src/plugins/supabase/test/supabase_bundle_mapper_test.dart +3 -3
- package/dart-src/plugins/supabase/test/supabase_database_test.dart +3 -3
- package/dart-src/plugins/supabase/test/supabase_storage_test.dart +2 -2
- package/migrations/aws/README.md +7 -0
- package/migrations/cloudflare/0001_hot-updater_init.sql +16 -0
- package/migrations/cloudflare/0002_hot-updater_0.13.0.sql +8 -0
- package/migrations/cloudflare/0003_hot-updater_0.18.0.sql +38 -0
- package/migrations/cloudflare/0004_hot-updater_0.29.0.sql +11 -0
- package/migrations/cloudflare/0005_hot-updater_0.31.0.sql +24 -0
- package/migrations/cloudflare/bundles.sql +42 -0
- package/migrations/postgres/bundles.sql +45 -0
- package/migrations/postgres/get_target_app_version_list.sql +21 -0
- package/migrations/postgres/get_update_info_by_app_version.sql +126 -0
- package/migrations/postgres/get_update_info_by_fingerprint_hash.sql +125 -0
- package/migrations/postgres/hash_user_id.sql +30 -0
- package/migrations/postgres/is_device_eligible.sql +237 -0
- package/package.json +4 -4
- package/scripts/postinstall.js +15 -15
- package/scripts/vendor.sh +1 -1
- package/dart-src/packages/cli-tools/.dart_tool/package_config.json +0 -496
- package/dart-src/packages/cli-tools/.dart_tool/package_graph.json +0 -743
- package/dart-src/packages/cli-tools/pubspec.lock +0 -638
- package/dart-src/packages/cli-tools/test/standalone_backend_test.dart +0 -315
- package/dart-src/plugins/aws/lib/src/aws_lambda_edge_storage.dart +0 -72
- package/dart-src/plugins/aws/test/aws_lambda_edge_storage_test.dart +0 -190
- package/dart-src/plugins/standalone/.gitkeep +0 -0
- package/dart-src/plugins/standalone/lib/flutter_patcher_standalone.dart +0 -12
- package/dart-src/plugins/standalone/lib/src/standalone_config.dart +0 -107
- package/dart-src/plugins/standalone/lib/src/standalone_database.dart +0 -233
- package/dart-src/plugins/standalone/lib/src/standalone_storage.dart +0 -175
- package/dart-src/plugins/standalone/pubspec.yaml +0 -18
- package/dart-src/plugins/standalone/test/standalone_test.dart +0 -264
- /package/dart-src/plugins/cloudflare/lib/{flutter_patcher_cloudflare.dart → flutter_ota_kit_cloudflare.dart} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: flutter_ota_kit_cli
|
|
2
2
|
description: >-
|
|
3
|
-
Command-line interface for
|
|
3
|
+
Command-line interface for flutter_ota_kit (a hot-updater compatible OTA code
|
|
4
4
|
push tool for Flutter). Deploy bundles, manage channels/rollbacks, run
|
|
5
5
|
migrations, and inspect the backend — mirroring the `hot-updater` CLI UX.
|
|
6
6
|
version: 0.1.0
|
|
@@ -17,20 +17,18 @@ dependencies:
|
|
|
17
17
|
collection: ^1.18.0
|
|
18
18
|
cryptography: ^2.7.0
|
|
19
19
|
postgres: ^3.4.0
|
|
20
|
-
|
|
20
|
+
flutter_ota_kit_core:
|
|
21
21
|
path: ../core
|
|
22
|
-
|
|
22
|
+
flutter_ota_kit_plugin_core:
|
|
23
23
|
path: ../../plugins/plugin-core
|
|
24
|
-
|
|
24
|
+
flutter_ota_kit_supabase:
|
|
25
25
|
path: ../../plugins/supabase
|
|
26
|
-
|
|
26
|
+
flutter_ota_kit_postgres:
|
|
27
27
|
path: ../../plugins/postgres
|
|
28
|
-
|
|
28
|
+
flutter_ota_kit_cloudflare:
|
|
29
29
|
path: ../../plugins/cloudflare
|
|
30
|
-
|
|
30
|
+
flutter_ota_kit_aws:
|
|
31
31
|
path: ../../plugins/aws
|
|
32
|
-
flutter_patcher_standalone:
|
|
33
|
-
path: ../../plugins/standalone
|
|
34
32
|
http: ^1.2.0
|
|
35
33
|
|
|
36
34
|
dev_dependencies:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import 'dart:io';
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
4
|
-
import 'package:
|
|
5
|
-
import 'package:
|
|
6
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_aws/flutter_ota_kit_aws.dart';
|
|
4
|
+
import 'package:flutter_ota_kit_cli/flutter_ota_kit_cli.dart';
|
|
5
|
+
import 'package:flutter_ota_kit_cloudflare/flutter_ota_kit_cloudflare.dart';
|
|
6
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
7
7
|
import 'package:test/test.dart';
|
|
8
8
|
|
|
9
9
|
import 'mocks/mock_aws_s3_client.dart' as aws;
|
|
@@ -4,7 +4,7 @@ import 'dart:typed_data';
|
|
|
4
4
|
|
|
5
5
|
import 'package:archive/archive.dart';
|
|
6
6
|
import 'package:crypto/crypto.dart';
|
|
7
|
-
import 'package:
|
|
7
|
+
import 'package:flutter_ota_kit_cli/flutter_ota_kit_cli.dart';
|
|
8
8
|
import 'package:test/test.dart';
|
|
9
9
|
|
|
10
10
|
// Builds an in-memory APK containing libapp.so for every supported ABI, then
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'dart:io';
|
|
2
2
|
import 'dart:typed_data';
|
|
3
3
|
|
|
4
|
-
import 'package:
|
|
5
|
-
import 'package:
|
|
4
|
+
import 'package:flutter_ota_kit_cli/flutter_ota_kit_cli.dart';
|
|
5
|
+
import 'package:flutter_ota_kit_supabase/src/supabase_client_adapter.dart';
|
|
6
6
|
import 'package:path/path.dart' as p;
|
|
7
7
|
import 'package:test/test.dart';
|
|
8
8
|
|
|
@@ -342,7 +342,7 @@ Backend _backend(MockSupabaseClient mock) =>
|
|
|
342
342
|
resolveBackend(_config(), supabaseClientFactory: (url, key) => mock);
|
|
343
343
|
|
|
344
344
|
void main() {
|
|
345
|
-
group('
|
|
345
|
+
group('flutter_ota_kit_cli', () {
|
|
346
346
|
late MockSupabaseClient mock;
|
|
347
347
|
late Backend backend;
|
|
348
348
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import 'dart:convert' show utf8;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
4
4
|
show StorageObject;
|
|
5
5
|
|
|
6
|
-
import 'package:
|
|
6
|
+
import 'package:flutter_ota_kit_aws/flutter_ota_kit_aws.dart'
|
|
7
7
|
show AwsS3ClientLike, AwsS3StorageConfig;
|
|
8
8
|
|
|
9
9
|
/// In-memory store backing [MockAwsS3Client].
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import 'dart:convert' show jsonDecode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_cloudflare/flutter_ota_kit_cloudflare.dart'
|
|
4
4
|
show
|
|
5
5
|
CloudflareWorkerDatabaseConfig,
|
|
6
6
|
D1ClientLike,
|
|
7
7
|
D1DatabaseConfig,
|
|
8
8
|
cloudflareWorkerDatabase,
|
|
9
9
|
d1Database;
|
|
10
|
-
import 'package:
|
|
10
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
11
11
|
show DatabasePlugin;
|
|
12
12
|
|
|
13
13
|
/// In-memory store backing [MockD1Client], mirroring the D1 tables.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'dart:typed_data';
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart';
|
|
4
4
|
|
|
5
|
-
import 'package:
|
|
5
|
+
import 'package:flutter_ota_kit_postgres/flutter_ota_kit_postgres.dart';
|
|
6
6
|
|
|
7
7
|
/// In-memory store backing [MockPostgresClient]. Mirrors the `bundles` and
|
|
8
8
|
/// `bundle_patches` tables (snake_case row maps).
|
|
@@ -90,7 +90,7 @@ class MockPostgresClient implements PostgresClientLike {
|
|
|
90
90
|
if (sql.contains('SELECT * FROM bundles')) {
|
|
91
91
|
return _selectBundles(sql, params);
|
|
92
92
|
}
|
|
93
|
-
if (sql.contains('
|
|
93
|
+
if (sql.contains('flutter_ota_kit_storage')) {
|
|
94
94
|
return _handleStorage(sql, params);
|
|
95
95
|
}
|
|
96
96
|
return [];
|
|
@@ -100,7 +100,7 @@ class MockPostgresClient implements PostgresClientLike {
|
|
|
100
100
|
String sql,
|
|
101
101
|
Map<String, dynamic> params,
|
|
102
102
|
) {
|
|
103
|
-
if (sql.contains('INSERT INTO
|
|
103
|
+
if (sql.contains('INSERT INTO flutter_ota_kit_storage')) {
|
|
104
104
|
final key = params['@key'] as String;
|
|
105
105
|
final data = params['@data'];
|
|
106
106
|
store.storageObjects[key] = data is List<int>
|
|
@@ -110,16 +110,16 @@ class MockPostgresClient implements PostgresClientLike {
|
|
|
110
110
|
: <int>[];
|
|
111
111
|
return [];
|
|
112
112
|
}
|
|
113
|
-
if (sql.contains('SELECT 1 FROM
|
|
113
|
+
if (sql.contains('SELECT 1 FROM flutter_ota_kit_storage')) {
|
|
114
114
|
final key = params['@key'] as String;
|
|
115
115
|
return store.storageObjects.containsKey(key) ? [{'1': 1}] : [];
|
|
116
116
|
}
|
|
117
|
-
if (sql.contains('DELETE FROM
|
|
117
|
+
if (sql.contains('DELETE FROM flutter_ota_kit_storage')) {
|
|
118
118
|
final key = params['@key'] as String;
|
|
119
119
|
store.storageObjects.remove(key);
|
|
120
120
|
return [];
|
|
121
121
|
}
|
|
122
|
-
if (sql.contains('SELECT data FROM
|
|
122
|
+
if (sql.contains('SELECT data FROM flutter_ota_kit_storage')) {
|
|
123
123
|
final key = params['@key'] as String;
|
|
124
124
|
final data = store.storageObjects[key];
|
|
125
125
|
if (data == null) return [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
///
|
|
1
|
+
/// flutter_ota_kit core — Dart translation of hot-updater's packages/core.
|
|
2
2
|
///
|
|
3
3
|
/// Pure Dart, no Flutter dependency. Modules:
|
|
4
4
|
/// - types: bundle/update data model (platform, status, strategy)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
name:
|
|
2
|
-
description: Core data model, rollout cohorts, and shared utilities for
|
|
1
|
+
name: flutter_ota_kit_core
|
|
2
|
+
description: Core data model, rollout cohorts, and shared utilities for flutter_ota_kit — Dart translation of hot-updater's packages/core.
|
|
3
3
|
version: 0.1.0
|
|
4
4
|
publish_to: none
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'dart:convert';
|
|
2
2
|
import 'dart:io';
|
|
3
3
|
|
|
4
|
-
import 'package:
|
|
4
|
+
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart';
|
|
5
5
|
import 'package:test/test.dart';
|
|
6
6
|
|
|
7
7
|
/// Ground truth generated by executing the REAL verkit package
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'package:
|
|
1
|
+
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart';
|
|
2
2
|
import 'package:test/test.dart';
|
|
3
3
|
|
|
4
4
|
Bundle _sample() => Bundle(
|
|
@@ -7,7 +7,7 @@ Bundle _sample() => Bundle(
|
|
|
7
7
|
shouldForceUpdate: false,
|
|
8
8
|
enabled: true,
|
|
9
9
|
fileHash: 'a' * 64,
|
|
10
|
-
storageUri: 'supabase-storage://flutter-
|
|
10
|
+
storageUri: 'supabase-storage://flutter-ota-storage/bundles/x/bundle.zip',
|
|
11
11
|
gitCommitHash: 'deadbeef',
|
|
12
12
|
message: 'test bundle',
|
|
13
13
|
channel: 'production',
|
|
@@ -8,5 +8,3 @@ export 'src/aws_cloudfront_signer.dart'
|
|
|
8
8
|
show cloudfrontSignedUrl, verifyCloudfrontSignedUrl;
|
|
9
9
|
export 'src/with_cloudfront_signed_url.dart'
|
|
10
10
|
show WithCloudFrontSignedUrlOptions, withCloudFrontSignedUrl;
|
|
11
|
-
export 'src/aws_lambda_edge_storage.dart'
|
|
12
|
-
show AwsLambdaEdgeStorageConfig, awsLambdaEdgeStorage, s3LambdaEdgeStorage;
|
|
@@ -93,7 +93,7 @@ class AwsCloudFrontClient implements AwsCloudFrontClientLike {
|
|
|
93
93
|
// continue (mirrors hot-updater's s3Database behaviour).
|
|
94
94
|
// ignore: avoid_print
|
|
95
95
|
print(
|
|
96
|
-
'[
|
|
96
|
+
'[flutter_ota_kit/aws] CloudFront invalidation failed for '
|
|
97
97
|
'$distributionId; continuing without cache invalidation: $error',
|
|
98
98
|
);
|
|
99
99
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'dart:convert' show jsonDecode, jsonEncode, utf8;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
4
4
|
show BlobOperations, createBlobDatabasePlugin;
|
|
5
5
|
|
|
6
6
|
import 'aws_cloudfront_client.dart'
|
|
@@ -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_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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'package:path/path.dart' show basename;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
4
4
|
show
|
|
5
5
|
NodeStorageProfile,
|
|
6
6
|
RuntimeStorageProfile,
|
|
@@ -87,9 +87,31 @@ class _S3NodeProfile implements NodeStorageProfile {
|
|
|
87
87
|
await writeFileBytes(filePath, bytes);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
String _getRelativeKey(String key) {
|
|
91
|
+
final bp = _config.basePath;
|
|
92
|
+
if (bp != null && bp.isNotEmpty && key.startsWith(bp)) {
|
|
93
|
+
var stripped = key.substring(bp.length);
|
|
94
|
+
if (stripped.startsWith('/')) stripped = stripped.substring(1);
|
|
95
|
+
return stripped;
|
|
96
|
+
}
|
|
97
|
+
return key;
|
|
98
|
+
}
|
|
99
|
+
|
|
90
100
|
@override
|
|
91
|
-
Future<List<StorageObject>> listObjects([String? prefix])
|
|
92
|
-
|
|
101
|
+
Future<List<StorageObject>> listObjects([String? prefix]) async {
|
|
102
|
+
final list = await _client.listObjects(
|
|
103
|
+
prefix == null ? null : _getListPrefix(prefix),
|
|
104
|
+
);
|
|
105
|
+
return list.map((o) {
|
|
106
|
+
final relativeKey = _getRelativeKey(o.key);
|
|
107
|
+
return StorageObject(
|
|
108
|
+
key: relativeKey,
|
|
109
|
+
storageUri: 's3://${_config.bucketName}/$relativeKey',
|
|
110
|
+
size: o.size,
|
|
111
|
+
lastModifiedAt: o.lastModifiedAt,
|
|
112
|
+
);
|
|
113
|
+
}).toList();
|
|
114
|
+
}
|
|
93
115
|
|
|
94
116
|
@override
|
|
95
117
|
Future<void> deleteObjects(List<String> keys) =>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
name:
|
|
2
|
-
description: AWS S3 storage + S3/DynamoDB database plugins for
|
|
1
|
+
name: flutter_ota_kit_aws
|
|
2
|
+
description: AWS S3 storage + S3/DynamoDB database plugins for flutter_ota_kit (faithful port of hot-updater plugins/aws).
|
|
3
3
|
version: 0.1.0
|
|
4
4
|
publish_to: none
|
|
5
5
|
|
|
@@ -7,9 +7,9 @@ environment:
|
|
|
7
7
|
sdk: ">=3.3.0 <4.0.0"
|
|
8
8
|
|
|
9
9
|
dependencies:
|
|
10
|
-
|
|
10
|
+
flutter_ota_kit_core:
|
|
11
11
|
path: ../../packages/core
|
|
12
|
-
|
|
12
|
+
flutter_ota_kit_plugin_core:
|
|
13
13
|
path: ../../plugins/plugin-core
|
|
14
14
|
crypto: ^3.0.0
|
|
15
15
|
http: ^1.2.0
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import 'package:
|
|
1
|
+
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
2
2
|
show
|
|
3
3
|
AppVersionGetBundlesArgs,
|
|
4
4
|
Bundle,
|
|
5
5
|
Platform,
|
|
6
6
|
nilUuid;
|
|
7
|
-
import 'package:
|
|
7
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
8
8
|
show DatabaseBundleQueryOptions, DatabasePlugin;
|
|
9
|
-
import 'package:
|
|
9
|
+
import 'package:flutter_ota_kit_aws/flutter_ota_kit_aws.dart'
|
|
10
10
|
show S3DatabaseConfig, AwsS3ClientLike, AwsCloudFrontClientLike, s3Database;
|
|
11
11
|
import 'package:test/test.dart';
|
|
12
12
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'dart:io' show Directory, File;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
4
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_aws/flutter_ota_kit_aws.dart' show s3Storage;
|
|
4
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
5
5
|
show StoragePlugin;
|
|
6
6
|
import 'package:path/path.dart' show basename;
|
|
7
7
|
import 'package:test/test.dart';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import 'dart:convert' show utf8;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
4
4
|
show StorageObject;
|
|
5
5
|
|
|
6
|
-
import 'package:
|
|
6
|
+
import 'package:flutter_ota_kit_aws/flutter_ota_kit_aws.dart'
|
|
7
7
|
show AwsS3ClientLike, AwsS3StorageConfig;
|
|
8
8
|
|
|
9
9
|
/// In-memory store backing [MockAwsS3Client].
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'dart:convert' show jsonEncode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'dart:convert' show jsonDecode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
4
4
|
show Bundle, BundleMetadata, BundlePatchArtifact, Platform, getBundlePatches;
|
|
5
5
|
|
|
6
6
|
/// Default rollout cohort count — full rollout in the Dart port's per-mille
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'dart:convert' show jsonEncode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
4
4
|
show
|
|
5
5
|
AppVersionGetBundlesArgs,
|
|
6
6
|
Bundle,
|
|
@@ -8,7 +8,7 @@ import 'package:flutter_patcher_core/flutter_patcher_core.dart'
|
|
|
8
8
|
GetBundlesArgs,
|
|
9
9
|
UpdateInfo,
|
|
10
10
|
UpdateStrategy;
|
|
11
|
-
import 'package:
|
|
11
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
12
12
|
show
|
|
13
13
|
AbstractDatabasePlugin,
|
|
14
14
|
BundleChange,
|
|
@@ -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_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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
name:
|
|
2
|
-
description: Cloudflare D1 + R2 storage plugins for
|
|
1
|
+
name: flutter_ota_kit_cloudflare
|
|
2
|
+
description: Cloudflare D1 + R2 storage plugins for flutter_ota_kit (faithful port of hot-updater plugins/cloudflare).
|
|
3
3
|
version: 0.1.0
|
|
4
4
|
publish_to: none
|
|
5
5
|
|
|
@@ -7,9 +7,9 @@ environment:
|
|
|
7
7
|
sdk: ">=3.3.0 <4.0.0"
|
|
8
8
|
|
|
9
9
|
dependencies:
|
|
10
|
-
|
|
10
|
+
flutter_ota_kit_core:
|
|
11
11
|
path: ../../packages/core
|
|
12
|
-
|
|
12
|
+
flutter_ota_kit_plugin_core:
|
|
13
13
|
path: ../../plugins/plugin-core
|
|
14
14
|
crypto: ^3.0.0
|
|
15
15
|
http: ^1.2.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'package:
|
|
1
|
+
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
2
2
|
show
|
|
3
3
|
AppVersionGetBundlesArgs,
|
|
4
4
|
Bundle,
|
|
@@ -7,7 +7,7 @@ import 'package:flutter_patcher_core/flutter_patcher_core.dart'
|
|
|
7
7
|
Platform,
|
|
8
8
|
UpdateStatus,
|
|
9
9
|
nilUuid;
|
|
10
|
-
import 'package:
|
|
10
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
11
11
|
show DatabasePlugin;
|
|
12
12
|
import 'package:test/test.dart';
|
|
13
13
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'dart:convert' show jsonEncode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
4
4
|
show Bundle, BundleMetadata, BundlePatchArtifact, Platform;
|
|
5
|
-
import 'package:
|
|
5
|
+
import 'package:flutter_ota_kit_cloudflare/flutter_ota_kit_cloudflare.dart'
|
|
6
6
|
show
|
|
7
7
|
buildBundlePatchId,
|
|
8
8
|
bundleToPatchRows,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'package:
|
|
1
|
+
import 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
2
2
|
show
|
|
3
3
|
AppVersionGetBundlesArgs,
|
|
4
4
|
Bundle,
|
|
@@ -7,7 +7,7 @@ import 'package:flutter_patcher_core/flutter_patcher_core.dart'
|
|
|
7
7
|
Platform,
|
|
8
8
|
UpdateStatus,
|
|
9
9
|
nilUuid;
|
|
10
|
-
import 'package:
|
|
10
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
11
11
|
show
|
|
12
12
|
DatabaseBundleQueryOptions,
|
|
13
13
|
DatabaseBundleQueryOrder,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import 'dart:convert' show jsonDecode;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_cloudflare/flutter_ota_kit_cloudflare.dart'
|
|
4
4
|
show
|
|
5
5
|
CloudflareWorkerDatabaseConfig,
|
|
6
6
|
D1ClientLike,
|
|
7
7
|
D1DatabaseConfig,
|
|
8
8
|
cloudflareWorkerDatabase,
|
|
9
9
|
d1Database;
|
|
10
|
-
import 'package:
|
|
10
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
11
11
|
show DatabasePlugin;
|
|
12
12
|
|
|
13
13
|
/// In-memory store backing [MockD1Client], mirroring the D1 tables.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import 'dart:convert' show utf8;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
4
4
|
show StorageObject;
|
|
5
5
|
|
|
6
|
-
import 'package:
|
|
6
|
+
import 'package:flutter_ota_kit_cloudflare/flutter_ota_kit_cloudflare.dart'
|
|
7
7
|
show R2S3StorageConfig, R2S3ClientLike;
|
|
8
8
|
|
|
9
9
|
/// In-memory store backing [MockR2Client].
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'dart:io' show Directory, File;
|
|
2
2
|
|
|
3
|
-
import 'package:
|
|
3
|
+
import 'package:flutter_ota_kit_cloudflare/flutter_ota_kit_cloudflare.dart'
|
|
4
4
|
show r2Storage;
|
|
5
|
-
import 'package:
|
|
5
|
+
import 'package:flutter_ota_kit_plugin_core/flutter_ota_kit_plugin_core.dart'
|
|
6
6
|
show StoragePlugin;
|
|
7
7
|
import 'package:path/path.dart' show basename;
|
|
8
8
|
import 'package:test/test.dart';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'package:
|
|
1
|
+
import 'package:flutter_ota_kit_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_core/flutter_ota_kit_core.dart';
|
|
2
|
+
export 'package:flutter_ota_kit_core/flutter_ota_kit_core.dart'
|
|
3
3
|
show Bundle, GetBundlesArgs, Platform, UpdateInfo;
|
|
4
4
|
|
|
5
5
|
// ---------------------------------------------------------------------------
|