@_nazmiforreal/flutter-ota 0.1.11 → 0.1.13
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 +1 -1
- package/bin/flutter-ota-linux-x64 +0 -0
- package/dart-src/packages/cli-tools/.dart_tool/package_config.json +46 -76
- package/dart-src/packages/cli-tools/.dart_tool/package_graph.json +140 -166
- package/dart-src/packages/cli-tools/README.md +1 -1
- package/dart-src/packages/cli-tools/lib/flutter_ota_kit_cli.dart +30 -17
- package/dart-src/packages/cli-tools/lib/src/backend.dart +30 -31
- package/dart-src/packages/cli-tools/lib/src/cli_base.dart +3 -1
- package/dart-src/packages/cli-tools/lib/src/commands/build.dart +44 -43
- package/dart-src/packages/cli-tools/lib/src/commands/bundle.dart +265 -239
- package/dart-src/packages/cli-tools/lib/src/commands/channel.dart +75 -66
- package/dart-src/packages/cli-tools/lib/src/commands/config_command.dart +39 -35
- package/dart-src/packages/cli-tools/lib/src/commands/console.dart +30 -27
- package/dart-src/packages/cli-tools/lib/src/commands/deploy.dart +88 -72
- package/dart-src/packages/cli-tools/lib/src/commands/doctor.dart +66 -29
- package/dart-src/packages/cli-tools/lib/src/commands/fingerprint.dart +10 -6
- package/dart-src/packages/cli-tools/lib/src/commands/init.dart +299 -190
- package/dart-src/packages/cli-tools/lib/src/commands/keys.dart +24 -23
- package/dart-src/packages/cli-tools/lib/src/commands/migrate.dart +111 -97
- package/dart-src/packages/cli-tools/lib/src/commands/pocketbase.dart +237 -0
- package/dart-src/packages/cli-tools/lib/src/commands/rollback.dart +43 -34
- package/dart-src/packages/cli-tools/lib/src/commands/storage.dart +57 -53
- package/dart-src/packages/cli-tools/lib/src/config.dart +227 -93
- package/dart-src/packages/cli-tools/lib/src/operations.dart +9 -8
- package/dart-src/packages/cli-tools/lib/src/pack.dart +26 -25
- package/dart-src/packages/cli-tools/lib/src/pocketbase/data_bootstrap.dart +39 -0
- package/dart-src/packages/cli-tools/lib/src/pocketbase/hooks/bundles.pb.js +56 -0
- package/dart-src/packages/cli-tools/lib/src/pocketbase/installer.dart +189 -0
- package/dart-src/packages/cli-tools/lib/src/pocketbase/process_manager.dart +123 -0
- package/dart-src/packages/cli-tools/lib/src/pocketbase/schema_installer.dart +237 -0
- package/dart-src/packages/cli-tools/lib/src/runner.dart +36 -15
- package/dart-src/packages/cli-tools/lib/src/sign.dart +13 -5
- package/dart-src/packages/cli-tools/lib/src/ui/ui.dart +10 -13
- package/dart-src/packages/cli-tools/lib/src/util.dart +3 -1
- package/dart-src/packages/cli-tools/pubspec.lock +69 -116
- package/dart-src/packages/cli-tools/pubspec.yaml +25 -7
- package/dart-src/packages/cli-tools/test/backends_test.dart +62 -32
- package/dart-src/packages/cli-tools/test/build_pack_test.dart +4 -4
- package/dart-src/packages/cli-tools/test/cli_test.dart +89 -42
- package/dart-src/packages/cli-tools/test/mocks/mock_aws_s3_client.dart +8 -13
- package/dart-src/packages/cli-tools/test/mocks/mock_d1_client.dart +23 -18
- package/dart-src/packages/cli-tools/test/mocks/mock_pocketbase_client.dart +197 -0
- package/dart-src/packages/cli-tools/test/mocks/mock_postgres_client.dart +70 -46
- package/dart-src/packages/cli-tools/test/pocketbase_installer_test.dart +72 -0
- package/dart-src/packages/cli-tools/test/pocketbase_schema_test.dart +107 -0
- package/dart-src/packages/cli-tools/test/pocketbase_smoke_test.dart +59 -0
- package/dart-src/packages/core/README.md +2 -2
- package/dart-src/packages/core/example/lib/main.dart +69 -0
- package/dart-src/packages/core/lib/flutter_ota_kit_core.dart +1 -1
- package/dart-src/packages/core/lib/src/app_update_info.dart +17 -15
- package/dart-src/packages/core/lib/src/bundle.dart +102 -94
- package/dart-src/packages/core/lib/src/bundle_artifacts.dart +1 -2
- package/dart-src/packages/core/lib/src/bundle_patch_artifact.dart +15 -16
- package/dart-src/packages/core/lib/src/changed_asset.dart +24 -22
- package/dart-src/packages/core/lib/src/get_bundles_args.dart +13 -13
- package/dart-src/packages/core/lib/src/metadata.dart +9 -7
- package/dart-src/packages/core/lib/src/patch_info.dart +8 -7
- package/dart-src/packages/core/lib/src/platform.dart +4 -3
- package/dart-src/packages/core/lib/src/rollout.dart +14 -11
- package/dart-src/packages/core/lib/src/semver_range.dart +49 -39
- package/dart-src/packages/core/lib/src/semver_version.dart +8 -7
- package/dart-src/packages/core/lib/src/status.dart +4 -3
- package/dart-src/packages/core/lib/src/update_bundle_params.dart +7 -7
- package/dart-src/packages/core/lib/src/uuid.dart +1 -2
- package/dart-src/packages/core/pubspec.yaml +6 -7
- package/dart-src/packages/core/test/rollout_test.dart +15 -8
- package/dart-src/packages/core/test/semver_test.dart +5 -2
- package/dart-src/packages/core/test/types_test.dart +26 -24
- package/dart-src/packages/core/test/uuid_test.dart +3 -1
- package/dart-src/packages/core/tool/dbg.dart +1 -0
- package/dart-src/plugins/aws/CHANGELOG.md +6 -0
- package/dart-src/plugins/aws/example/lib/main.dart +60 -0
- package/dart-src/plugins/aws/lib/flutter_ota_kit_aws.dart +5 -1
- package/dart-src/plugins/aws/lib/src/aws_cloudfront_client.dart +11 -16
- package/dart-src/plugins/aws/lib/src/aws_cloudfront_signer.dart +7 -2
- package/dart-src/plugins/aws/lib/src/aws_database.dart +14 -18
- package/dart-src/plugins/aws/lib/src/aws_s3_client.dart +23 -18
- package/dart-src/plugins/aws/lib/src/aws_ssm_client.dart +5 -4
- package/dart-src/plugins/aws/lib/src/aws_storage.dart +2 -3
- package/dart-src/plugins/aws/lib/src/aws_storage_profile.dart +10 -16
- package/dart-src/plugins/aws/lib/src/with_cloudfront_signed_url.dart +6 -9
- package/dart-src/plugins/aws/pubspec.yaml +15 -10
- package/dart-src/plugins/aws/test/aws_database_test.dart +51 -57
- package/dart-src/plugins/aws/test/mock_aws_s3_client.dart +8 -13
- package/dart-src/plugins/cloudflare/CHANGELOG.md +7 -0
- package/dart-src/plugins/cloudflare/example/lib/main.dart +62 -0
- package/dart-src/plugins/cloudflare/lib/flutter_ota_kit_cloudflare.dart +4 -2
- package/dart-src/plugins/cloudflare/lib/src/cloudflare_worker_database.dart +3 -3
- package/dart-src/plugins/cloudflare/lib/src/d1_build_where.dart +3 -2
- package/dart-src/plugins/cloudflare/lib/src/d1_bundle_mapper.dart +24 -27
- package/dart-src/plugins/cloudflare/lib/src/d1_database_plugin.dart +22 -30
- package/dart-src/plugins/cloudflare/lib/src/r2_config.dart +1 -1
- package/dart-src/plugins/cloudflare/lib/src/r2_s3_client.dart +21 -29
- package/dart-src/plugins/cloudflare/lib/src/r2_storage.dart +7 -7
- package/dart-src/plugins/cloudflare/lib/src/r2_storage_profile.dart +7 -15
- package/dart-src/plugins/cloudflare/pubspec.yaml +14 -9
- package/dart-src/plugins/cloudflare/test/cloudflare_worker_database_test.dart +46 -42
- package/dart-src/plugins/cloudflare/test/d1_database_test.dart +100 -90
- package/dart-src/plugins/cloudflare/test/mock_d1_client.dart +23 -18
- package/dart-src/plugins/cloudflare/test/mock_r2_client.dart +8 -13
- package/dart-src/plugins/cloudflare/test/r2_storage_test.dart +1 -4
- package/dart-src/plugins/plugin-core/CHANGELOG.md +16 -0
- package/dart-src/plugins/plugin-core/example/lib/main.dart +61 -0
- package/dart-src/plugins/plugin-core/lib/flutter_ota_kit_plugin_core.dart +3 -7
- package/dart-src/plugins/plugin-core/lib/src/asset_storage_layout.dart +5 -5
- package/dart-src/plugins/plugin-core/lib/src/bundle_helpers.dart +23 -0
- package/dart-src/plugins/plugin-core/lib/src/bundle_storage_layout.dart +16 -10
- package/dart-src/plugins/plugin-core/lib/src/bundle_unit_of_work.dart +31 -26
- package/dart-src/plugins/plugin-core/lib/src/calculate_pagination.dart +5 -1
- package/dart-src/plugins/plugin-core/lib/src/content_addressed_assets.dart +1 -1
- package/dart-src/plugins/plugin-core/lib/src/create_blob_database_plugin.dart +78 -71
- package/dart-src/plugins/plugin-core/lib/src/create_database_plugin.dart +56 -35
- package/dart-src/plugins/plugin-core/lib/src/create_storage_plugin.dart +10 -13
- package/dart-src/plugins/plugin-core/lib/src/paginate_bundles.dart +30 -17
- package/dart-src/plugins/plugin-core/lib/src/parse_storage_uri.dart +3 -1
- package/dart-src/plugins/plugin-core/lib/src/query_bundles.dart +5 -3
- package/dart-src/plugins/plugin-core/lib/src/request_update_bundle_state.dart +2 -4
- package/dart-src/plugins/plugin-core/lib/src/storage_helpers.dart +18 -0
- package/dart-src/plugins/plugin-core/lib/src/types.dart +7 -6
- package/dart-src/plugins/plugin-core/pubspec.yaml +12 -9
- package/dart-src/plugins/plugin-core/test/asset_storage_layout_test.dart +13 -9
- package/dart-src/plugins/plugin-core/test/bundle_unit_of_work_test.dart +28 -15
- package/dart-src/plugins/plugin-core/test/create_blob_database_plugin_test.dart +254 -122
- package/dart-src/plugins/plugin-core/test/create_database_plugin_test.dart +36 -32
- package/dart-src/plugins/plugin-core/test/create_storage_plugin_test.dart +18 -15
- package/dart-src/plugins/plugin-core/test/generate_min_bundle_id_test.dart +8 -3
- package/dart-src/plugins/plugin-core/test/get_update_info_test.dart +682 -693
- package/dart-src/plugins/plugin-core/test/helpers_test.dart +45 -21
- package/dart-src/plugins/plugin-core/test/query_bundles_test.dart +76 -13
- package/dart-src/plugins/plugin-core/test/uuidv7_test.dart +20 -9
- package/dart-src/plugins/pocketbase/CHANGELOG.md +8 -0
- package/dart-src/plugins/pocketbase/LICENSE +21 -0
- package/dart-src/plugins/pocketbase/README.md +54 -0
- package/dart-src/plugins/pocketbase/example/lib/main.dart +62 -0
- package/dart-src/plugins/pocketbase/lib/flutter_ota_kit_pocketbase.dart +28 -0
- package/dart-src/plugins/pocketbase/lib/src/pocketbase_bundle_mapper.dart +121 -0
- package/dart-src/plugins/pocketbase/lib/src/pocketbase_client.dart +349 -0
- package/dart-src/plugins/pocketbase/lib/src/pocketbase_config.dart +61 -0
- package/dart-src/plugins/pocketbase/lib/src/pocketbase_database.dart +278 -0
- package/dart-src/plugins/pocketbase/lib/src/pocketbase_storage.dart +255 -0
- package/dart-src/plugins/pocketbase/pubspec.yaml +26 -0
- package/dart-src/plugins/pocketbase/test/pb_uri_test.dart +12 -0
- package/dart-src/plugins/postgres/CHANGELOG.md +6 -0
- package/dart-src/plugins/postgres/example/lib/main.dart +67 -0
- package/dart-src/plugins/postgres/lib/flutter_ota_kit_postgres.dart +3 -6
- package/dart-src/plugins/postgres/lib/src/postgres_bundle_mapper.dart +32 -52
- package/dart-src/plugins/postgres/lib/src/postgres_config.dart +3 -1
- package/dart-src/plugins/postgres/lib/src/postgres_database.dart +28 -38
- package/dart-src/plugins/postgres/lib/src/postgres_get_update_info.dart +16 -14
- package/dart-src/plugins/postgres/lib/src/postgres_storage.dart +26 -14
- package/dart-src/plugins/postgres/lib/src/postgres_types.dart +27 -28
- package/dart-src/plugins/postgres/pubspec.yaml +14 -9
- package/dart-src/plugins/postgres/test/mock_postgres_client.dart +62 -39
- package/dart-src/plugins/postgres/test/postgres_bundle_mapper_test.dart +3 -4
- package/dart-src/plugins/postgres/test/postgres_database_test.dart +102 -73
- package/dart-src/plugins/postgres/test/postgres_storage_runtime_test.dart +60 -0
- package/dart-src/plugins/supabase/CHANGELOG.md +17 -0
- package/dart-src/plugins/supabase/README.md +2 -2
- package/dart-src/plugins/supabase/example/lib/main.dart +63 -0
- package/dart-src/plugins/supabase/lib/flutter_ota_kit_supabase.dart +2 -0
- package/dart-src/plugins/supabase/lib/src/error_message.dart +11 -0
- package/dart-src/plugins/supabase/lib/src/supabase_bundle_mapper.dart +34 -58
- package/dart-src/plugins/supabase/lib/src/supabase_client_adapter.dart +3 -13
- package/dart-src/plugins/supabase/lib/src/supabase_client_http.dart +34 -52
- package/dart-src/plugins/supabase/lib/src/supabase_database.dart +38 -30
- package/dart-src/plugins/supabase/lib/src/supabase_edge_function_storage.dart +21 -29
- package/dart-src/plugins/supabase/lib/src/supabase_signed_url_batcher.dart +7 -19
- package/dart-src/plugins/supabase/lib/src/supabase_storage.dart +18 -29
- package/dart-src/plugins/supabase/lib/src/types.dart +26 -26
- package/dart-src/plugins/supabase/pubspec.yaml +14 -9
- package/dart-src/plugins/supabase/test/mock_supabase_client.dart +57 -57
- package/dart-src/plugins/supabase/test/supabase_bundle_mapper_test.dart +30 -27
- package/dart-src/plugins/supabase/test/supabase_database_test.dart +26 -35
- package/dart-src/plugins/supabase/test/supabase_storage_test.dart +27 -34
- package/package.json +2 -2
- package/scripts/vendor.sh +1 -1
|
@@ -72,12 +72,7 @@ int _compareValues(Object? left, Object? right) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
class _MockFilterBuilder implements SupabaseFilterBuilderLike {
|
|
75
|
-
_MockFilterBuilder(
|
|
76
|
-
this._store,
|
|
77
|
-
this._table,
|
|
78
|
-
this._mode, {
|
|
79
|
-
this.head = false,
|
|
80
|
-
});
|
|
75
|
+
_MockFilterBuilder(this._store, this._table, this._mode, {this.head = false});
|
|
81
76
|
|
|
82
77
|
final Store _store;
|
|
83
78
|
final String _table;
|
|
@@ -165,8 +160,8 @@ class _MockFilterBuilder implements SupabaseFilterBuilderLike {
|
|
|
165
160
|
return this;
|
|
166
161
|
}
|
|
167
162
|
|
|
168
|
-
List<Map<String, dynamic>> _rowsForTable() =>
|
|
169
|
-
|
|
163
|
+
List<Map<String, dynamic>> _rowsForTable() => _table == 'bundles'
|
|
164
|
+
? _store.bundleRows.values.toList()
|
|
170
165
|
: _store.bundlePatchRows.values.toList();
|
|
171
166
|
|
|
172
167
|
List<Map<String, dynamic>> _getFilteredRows() {
|
|
@@ -183,8 +178,9 @@ class _MockFilterBuilder implements SupabaseFilterBuilderLike {
|
|
|
183
178
|
'lte' => _compareValues(row[column], value) <= 0,
|
|
184
179
|
_ => false,
|
|
185
180
|
},
|
|
186
|
-
_InFilter(:final column, :final values) =>
|
|
187
|
-
|
|
181
|
+
_InFilter(:final column, :final values) => values.contains(
|
|
182
|
+
row[column],
|
|
183
|
+
),
|
|
188
184
|
_IsFilter(:final column, :final value) => row[column] == value,
|
|
189
185
|
_NotFilter(:final column, :final operator, :final value) =>
|
|
190
186
|
operator == 'is' ? row[column] != value : false,
|
|
@@ -210,8 +206,10 @@ class _MockFilterBuilder implements SupabaseFilterBuilderLike {
|
|
|
210
206
|
|
|
211
207
|
var filtered = _getFilteredRows();
|
|
212
208
|
filtered = filtered.toList()
|
|
213
|
-
..sort(
|
|
214
|
-
|
|
209
|
+
..sort(
|
|
210
|
+
(a, b) =>
|
|
211
|
+
ascending ? a['id'].compareTo(b['id']) : b['id'].compareTo(a['id']),
|
|
212
|
+
);
|
|
215
213
|
final total = filtered.length;
|
|
216
214
|
|
|
217
215
|
if (singleRow) {
|
|
@@ -355,9 +353,7 @@ class FakeStorageBucket implements SupabaseStorageBucketLike {
|
|
|
355
353
|
if (existsThrows != null) {
|
|
356
354
|
return Future.error(existsThrows!);
|
|
357
355
|
}
|
|
358
|
-
return Future.value(
|
|
359
|
-
_ExistsResult(data: existsData, error: existsError),
|
|
360
|
-
);
|
|
356
|
+
return Future.value(_ExistsResult(data: existsData, error: existsError));
|
|
361
357
|
}
|
|
362
358
|
|
|
363
359
|
@override
|
|
@@ -380,10 +376,12 @@ class FakeStorageBucket implements SupabaseStorageBucketLike {
|
|
|
380
376
|
return Future.value(
|
|
381
377
|
_SignedUrlListResult(
|
|
382
378
|
data: paths
|
|
383
|
-
.map(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
379
|
+
.map(
|
|
380
|
+
(p) => _SignedUrlResult(
|
|
381
|
+
signedUrl: '$createSignedUrlBase/$expiresIn/$p',
|
|
382
|
+
error: signedUrlError,
|
|
383
|
+
),
|
|
384
|
+
)
|
|
387
385
|
.toList(),
|
|
388
386
|
error: signedUrlError,
|
|
389
387
|
),
|
|
@@ -399,10 +397,7 @@ class FakeStorageBucket implements SupabaseStorageBucketLike {
|
|
|
399
397
|
}) {
|
|
400
398
|
uploadCalls.add(path);
|
|
401
399
|
return Future.value(
|
|
402
|
-
_UploadResult(
|
|
403
|
-
data: uploadData ?? {'fullPath': path},
|
|
404
|
-
error: uploadError,
|
|
405
|
-
),
|
|
400
|
+
_UploadResult(data: uploadData ?? {'fullPath': path}, error: uploadError),
|
|
406
401
|
);
|
|
407
402
|
}
|
|
408
403
|
|
|
@@ -451,11 +446,7 @@ class _MockQueryBuilder implements SupabaseQueryBuilderLike {
|
|
|
451
446
|
final String _table;
|
|
452
447
|
|
|
453
448
|
@override
|
|
454
|
-
SupabaseFilterBuilderLike select(
|
|
455
|
-
String columns, {
|
|
456
|
-
bool? count,
|
|
457
|
-
bool? head,
|
|
458
|
-
}) =>
|
|
449
|
+
SupabaseFilterBuilderLike select(String columns, {bool? count, bool? head}) =>
|
|
459
450
|
_MockFilterBuilder(_store, _table, 'select', head: head ?? false);
|
|
460
451
|
|
|
461
452
|
@override
|
|
@@ -512,9 +503,8 @@ SupabaseClientLike createMockSupabaseClient({
|
|
|
512
503
|
Platform platformFrom(String value) =>
|
|
513
504
|
value == 'ios' ? Platform.ios : Platform.android;
|
|
514
505
|
|
|
515
|
-
Bundle rowToBundle(Map<String, dynamic> row) =>
|
|
516
|
-
|
|
517
|
-
);
|
|
506
|
+
Bundle rowToBundle(Map<String, dynamic> row) =>
|
|
507
|
+
mapRowToBundle(SupabaseBundleRow.fromJson(row));
|
|
518
508
|
|
|
519
509
|
return _MockClient(store, storageClient, platformFrom, rowToBundle);
|
|
520
510
|
}
|
|
@@ -557,10 +547,12 @@ class _MockClient implements SupabaseClientLike {
|
|
|
557
547
|
final platform = params!['app_platform'] as String;
|
|
558
548
|
final minBundleId = params['min_bundle_id'] as String;
|
|
559
549
|
final list = _store.bundleRows.values
|
|
560
|
-
.where(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
550
|
+
.where(
|
|
551
|
+
(r) =>
|
|
552
|
+
r['platform'] == platform &&
|
|
553
|
+
(r['id'] as String).compareTo(minBundleId) >= 0 &&
|
|
554
|
+
r['target_app_version'] != null,
|
|
555
|
+
)
|
|
564
556
|
.map((r) => r['target_app_version'] as String)
|
|
565
557
|
.toSet()
|
|
566
558
|
.map((v) => {'target_app_version': v})
|
|
@@ -574,17 +566,20 @@ class _MockClient implements SupabaseClientLike {
|
|
|
574
566
|
final bundleId = params['bundle_id'] as String;
|
|
575
567
|
final minBundleId = params['min_bundle_id'] as String;
|
|
576
568
|
final channel = params['target_channel'] as String;
|
|
577
|
-
final targetAppVersionList =
|
|
578
|
-
|
|
569
|
+
final targetAppVersionList = List<String>.from(
|
|
570
|
+
params['target_app_version_list'] as List? ?? [],
|
|
571
|
+
);
|
|
579
572
|
final cohort = params['cohort'] as String?;
|
|
580
573
|
|
|
581
574
|
final bundles = _store.bundleRows.values
|
|
582
|
-
.where(
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
575
|
+
.where(
|
|
576
|
+
(r) =>
|
|
577
|
+
r['enabled'] == true &&
|
|
578
|
+
r['platform'] == platform &&
|
|
579
|
+
r['channel'] == channel &&
|
|
580
|
+
(r['id'] as String).compareTo(minBundleId) >= 0 &&
|
|
581
|
+
(targetAppVersionList.contains(r['target_app_version'])),
|
|
582
|
+
)
|
|
588
583
|
.map(_rowToBundle)
|
|
589
584
|
.toList();
|
|
590
585
|
|
|
@@ -614,12 +609,14 @@ class _MockClient implements SupabaseClientLike {
|
|
|
614
609
|
final cohort = params['cohort'] as String?;
|
|
615
610
|
|
|
616
611
|
final bundles = _store.bundleRows.values
|
|
617
|
-
.where(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
612
|
+
.where(
|
|
613
|
+
(r) =>
|
|
614
|
+
r['enabled'] == true &&
|
|
615
|
+
r['platform'] == platform &&
|
|
616
|
+
r['channel'] == channel &&
|
|
617
|
+
(r['id'] as String).compareTo(minBundleId) >= 0 &&
|
|
618
|
+
r['fingerprint_hash'] == fingerprintHash,
|
|
619
|
+
)
|
|
623
620
|
.map(_rowToBundle)
|
|
624
621
|
.toList();
|
|
625
622
|
|
|
@@ -640,15 +637,18 @@ class _MockClient implements SupabaseClientLike {
|
|
|
640
637
|
);
|
|
641
638
|
}
|
|
642
639
|
|
|
643
|
-
return _MockRpcResponse(
|
|
640
|
+
return _MockRpcResponse(
|
|
641
|
+
data: null,
|
|
642
|
+
error: 'Unsupported RPC: $functionName',
|
|
643
|
+
);
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
|
|
647
647
|
Map<String, dynamic> _toUpdateInfoRow(UpdateInfo info) => {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
648
|
+
'id': info.id,
|
|
649
|
+
'should_force_update': info.shouldForceUpdate,
|
|
650
|
+
'message': info.message,
|
|
651
|
+
'status': info.status == UpdateStatus.rollback ? 'ROLLBACK' : 'UPDATE',
|
|
652
|
+
'storage_uri': info.storageUri,
|
|
653
|
+
'file_hash': info.fileHash,
|
|
654
|
+
};
|
|
@@ -4,31 +4,29 @@ import 'package:flutter_ota_kit_supabase/src/types.dart';
|
|
|
4
4
|
import 'package:test/test.dart';
|
|
5
5
|
|
|
6
6
|
Bundle _makeBundle({List<BundlePatchArtifact> patches = const []}) => Bundle(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
patches.isNotEmpty ? patches.first.patchStorageUri : null,
|
|
31
|
-
);
|
|
7
|
+
id: '018f0000-0000-7000-8000-000000000001',
|
|
8
|
+
platform: Platform.android,
|
|
9
|
+
shouldForceUpdate: false,
|
|
10
|
+
enabled: true,
|
|
11
|
+
fileHash: 'file-hash-1',
|
|
12
|
+
gitCommitHash: 'git-1',
|
|
13
|
+
message: 'hello',
|
|
14
|
+
channel: 'production',
|
|
15
|
+
storageUri: 'supabase-storage://updates/bundles/b1.zip',
|
|
16
|
+
targetAppVersion: '1.0.0',
|
|
17
|
+
fingerprintHash: 'fp-1',
|
|
18
|
+
metadata: const BundleMetadata(appVersion: '1.2.3'),
|
|
19
|
+
manifestStorageUri: 'supabase-storage://updates/manifests/m1.json',
|
|
20
|
+
manifestFileHash: 'mf-1',
|
|
21
|
+
assetBaseStorageUri: 'supabase-storage://updates/assets',
|
|
22
|
+
rolloutCohortCount: 500,
|
|
23
|
+
targetCohorts: ['team-a'],
|
|
24
|
+
patches: patches,
|
|
25
|
+
patchBaseBundleId: patches.isNotEmpty ? patches.first.baseBundleId : null,
|
|
26
|
+
patchBaseFileHash: patches.isNotEmpty ? patches.first.baseFileHash : null,
|
|
27
|
+
patchFileHash: patches.isNotEmpty ? patches.first.patchFileHash : null,
|
|
28
|
+
patchStorageUri: patches.isNotEmpty ? patches.first.patchStorageUri : null,
|
|
29
|
+
);
|
|
32
30
|
|
|
33
31
|
void main() {
|
|
34
32
|
group('bundleToRow / mapRowToBundle round-trip', () {
|
|
@@ -78,7 +76,9 @@ void main() {
|
|
|
78
76
|
|
|
79
77
|
final back = mapRowToBundle(
|
|
80
78
|
SupabaseBundleRow.fromJson(row.toJson()),
|
|
81
|
-
patchRows
|
|
79
|
+
patchRows
|
|
80
|
+
.map((p) => SupabaseBundlePatchRow.fromJson(p.toJson()))
|
|
81
|
+
.toList(),
|
|
82
82
|
);
|
|
83
83
|
|
|
84
84
|
expect(back.id, bundle.id);
|
|
@@ -86,7 +86,10 @@ void main() {
|
|
|
86
86
|
expect(back.patchBaseBundleId, baseBundleId);
|
|
87
87
|
expect(back.patchBaseFileHash, 'base-hash');
|
|
88
88
|
expect(back.patches!.first.patchFileHash, 'patch-hash');
|
|
89
|
-
expect(
|
|
89
|
+
expect(
|
|
90
|
+
back.patchStorageUri,
|
|
91
|
+
'supabase-storage://updates/patches/p1.patch',
|
|
92
|
+
);
|
|
90
93
|
expect(back.metadata?.appVersion, '1.2.3');
|
|
91
94
|
});
|
|
92
95
|
|
|
@@ -10,12 +10,12 @@ late FakeStorageBucket bucket;
|
|
|
10
10
|
late SupabaseClientLike client;
|
|
11
11
|
|
|
12
12
|
DatabasePlugin newPlugin() => supabaseDatabase(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
SupabaseServiceRoleConfig(
|
|
14
|
+
supabaseUrl: 'https://test.supabase.invalid',
|
|
15
|
+
supabaseAnonKey: 'test-anon-key',
|
|
16
|
+
clientFactory: (_, __) => client,
|
|
17
|
+
),
|
|
18
|
+
)();
|
|
19
19
|
|
|
20
20
|
Bundle _bundle(
|
|
21
21
|
String id, {
|
|
@@ -23,24 +23,23 @@ Bundle _bundle(
|
|
|
23
23
|
String? fp,
|
|
24
24
|
String? message,
|
|
25
25
|
String channel = 'production',
|
|
26
|
-
}) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
26
|
+
}) => Bundle(
|
|
27
|
+
id: id,
|
|
28
|
+
platform: Platform.android,
|
|
29
|
+
shouldForceUpdate: false,
|
|
30
|
+
enabled: enabled,
|
|
31
|
+
fileHash: 'file-$id',
|
|
32
|
+
gitCommitHash: 'git-$id',
|
|
33
|
+
message: message ?? 'msg-$id',
|
|
34
|
+
channel: channel,
|
|
35
|
+
storageUri: 'supabase-storage://updates/bundles/$id.zip',
|
|
36
|
+
targetAppVersion: '1.0.0',
|
|
37
|
+
fingerprintHash: fp,
|
|
38
|
+
metadata: const BundleMetadata(),
|
|
39
|
+
manifestStorageUri: 'supabase-storage://updates/manifests/$id.json',
|
|
40
|
+
manifestFileHash: 'mf-$id',
|
|
41
|
+
assetBaseStorageUri: 'supabase-storage://updates/assets',
|
|
42
|
+
);
|
|
44
43
|
|
|
45
44
|
void main() {
|
|
46
45
|
setUp(() {
|
|
@@ -85,9 +84,7 @@ void main() {
|
|
|
85
84
|
test('getChannels returns distinct channels', () async {
|
|
86
85
|
final plugin = newPlugin();
|
|
87
86
|
await plugin.appendBundle(_bundle('b1'));
|
|
88
|
-
await plugin.appendBundle(
|
|
89
|
-
_bundle('b2', channel: 'staging'),
|
|
90
|
-
);
|
|
87
|
+
await plugin.appendBundle(_bundle('b2', channel: 'staging'));
|
|
91
88
|
await plugin.commitBundle();
|
|
92
89
|
final channels = await plugin.getChannels();
|
|
93
90
|
expect(channels, containsAll(['production', 'staging']));
|
|
@@ -144,16 +141,10 @@ void main() {
|
|
|
144
141
|
test('fingerprint strategy returns matching bundle', () async {
|
|
145
142
|
final plugin = newPlugin();
|
|
146
143
|
await plugin.appendBundle(
|
|
147
|
-
_bundle(
|
|
148
|
-
'018f0000-0000-7000-8000-000000000001',
|
|
149
|
-
fp: 'fp-current',
|
|
150
|
-
),
|
|
144
|
+
_bundle('018f0000-0000-7000-8000-000000000001', fp: 'fp-current'),
|
|
151
145
|
);
|
|
152
146
|
await plugin.appendBundle(
|
|
153
|
-
_bundle(
|
|
154
|
-
'018f0000-0000-7000-8000-000000000002',
|
|
155
|
-
fp: 'fp-target',
|
|
156
|
-
),
|
|
147
|
+
_bundle('018f0000-0000-7000-8000-000000000002', fp: 'fp-target'),
|
|
157
148
|
);
|
|
158
149
|
await plugin.commitBundle();
|
|
159
150
|
|
|
@@ -75,9 +75,7 @@ void main() {
|
|
|
75
75
|
|
|
76
76
|
test('rejects a different bucket', () async {
|
|
77
77
|
await expectLater(
|
|
78
|
-
node.exists(
|
|
79
|
-
'supabase-storage://other/assets/sha256/fi/file-hash.png',
|
|
80
|
-
),
|
|
78
|
+
node.exists('supabase-storage://other/assets/sha256/fi/file-hash.png'),
|
|
81
79
|
throwsA(
|
|
82
80
|
isA<StateError>().having(
|
|
83
81
|
(e) => e.message,
|
|
@@ -92,12 +90,11 @@ void main() {
|
|
|
92
90
|
|
|
93
91
|
group('supabaseStorage runtime.getDownloadUrl', () {
|
|
94
92
|
test('batches concurrent signed URL requests', () async {
|
|
95
|
-
final paths = List.generate(
|
|
96
|
-
20,
|
|
97
|
-
(i) => 'assets/sha256/file-$i.png',
|
|
98
|
-
);
|
|
93
|
+
final paths = List.generate(20, (i) => 'assets/sha256/file-$i.png');
|
|
99
94
|
final results = await Future.wait(
|
|
100
|
-
paths.map(
|
|
95
|
+
paths.map(
|
|
96
|
+
(p) => runtime.getDownloadUrl('supabase-storage://updates/$p'),
|
|
97
|
+
),
|
|
101
98
|
);
|
|
102
99
|
expect(
|
|
103
100
|
results,
|
|
@@ -129,29 +126,26 @@ void main() {
|
|
|
129
126
|
expect(bucket.createSignedUrlsCalls, hasLength(1));
|
|
130
127
|
});
|
|
131
128
|
|
|
132
|
-
test(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
url
|
|
139
|
-
{
|
|
140
|
-
'fileUrl':
|
|
141
|
-
'
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
);
|
|
129
|
+
test(
|
|
130
|
+
'decodes percent-encoded object keys before signing and removing',
|
|
131
|
+
() async {
|
|
132
|
+
const uri =
|
|
133
|
+
'supabase-storage://updates/'
|
|
134
|
+
'assets/bootsplash/logo-ios%402x.png';
|
|
135
|
+
final url = await runtime.getDownloadUrl(uri);
|
|
136
|
+
expect(url, {
|
|
137
|
+
'fileUrl':
|
|
138
|
+
'https://example.supabase.co/3600/'
|
|
139
|
+
'assets/bootsplash/logo-ios@2x.png',
|
|
140
|
+
});
|
|
141
|
+
expect(bucket.createSignedUrlsCalls.first, [
|
|
142
|
+
'assets/bootsplash/logo-ios@2x.png',
|
|
143
|
+
]);
|
|
148
144
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
);
|
|
154
|
-
});
|
|
145
|
+
await node.delete(uri);
|
|
146
|
+
expect(bucket.removeCalls.first, ['assets/bootsplash/logo-ios@2x.png']);
|
|
147
|
+
},
|
|
148
|
+
);
|
|
155
149
|
});
|
|
156
150
|
|
|
157
151
|
group('supabaseStorage node.upload', () {
|
|
@@ -162,10 +156,9 @@ void main() {
|
|
|
162
156
|
bucket.uploadData = {'fullPath': 'updates/bundles/bundle.zip'};
|
|
163
157
|
|
|
164
158
|
final result = await node.upload('bundles', uploadPath);
|
|
165
|
-
expect(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
);
|
|
159
|
+
expect(result, {
|
|
160
|
+
'storageUri': 'supabase-storage://updates/bundles/bundle.zip',
|
|
161
|
+
});
|
|
169
162
|
expect(bucket.uploadCalls, ['bundles/bundle.zip']);
|
|
170
163
|
expect(bucket.createSignedUrlCalls, ['bundles/bundle.zip']);
|
|
171
164
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@_nazmiforreal/flutter-ota",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Command-line interface for flutter_ota_kit — an OTA code-push tool for Flutter, hot-updater compatible.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"flutter-ota": "./bin/flutter-ota.js"
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/HYPER12755/
|
|
24
|
+
"url": "https://github.com/HYPER12755/flutter-ota-kit"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/scripts/vendor.sh
CHANGED
|
@@ -15,7 +15,7 @@ mkdir -p "$DST/packages" "$DST/plugins"
|
|
|
15
15
|
for p in packages/core packages/cli-tools; do
|
|
16
16
|
cp -R "$SRC/$p" "$DST/$p"
|
|
17
17
|
done
|
|
18
|
-
for p in plugins/cloudflare plugins/plugin-core plugins/postgres plugins/aws plugins/supabase; do
|
|
18
|
+
for p in plugins/cloudflare plugins/plugin-core plugins/postgres plugins/aws plugins/supabase plugins/pocketbase; do
|
|
19
19
|
cp -R "$SRC/$p" "$DST/$p"
|
|
20
20
|
done
|
|
21
21
|
|