@_nazmiforreal/flutter-ota 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/flutter-ota-linux-x64 +0 -0
- package/bin/flutter-ota.js +23 -72
- package/dart-src/packages/cli-tools/.dart_tool/package_config.json +0 -2
- package/dart-src/packages/cli-tools/lib/flutter_ota_kit_cli.dart +2 -2
- package/dart-src/packages/cli-tools/lib/src/commands/build.dart +1 -1
- package/dart-src/packages/cli-tools/lib/src/commands/bundle.dart +112 -124
- package/dart-src/packages/cli-tools/lib/src/commands/channel.dart +20 -28
- package/dart-src/packages/cli-tools/lib/src/commands/config_command.dart +40 -18
- package/dart-src/packages/cli-tools/lib/src/commands/console.dart +10 -11
- package/dart-src/packages/cli-tools/lib/src/commands/deploy.dart +30 -33
- package/dart-src/packages/cli-tools/lib/src/commands/doctor.dart +43 -41
- package/dart-src/packages/cli-tools/lib/src/commands/fingerprint.dart +9 -10
- package/dart-src/packages/cli-tools/lib/src/commands/init.dart +32 -35
- package/dart-src/packages/cli-tools/lib/src/commands/keys.dart +3 -6
- package/dart-src/packages/cli-tools/lib/src/commands/migrate.dart +59 -50
- package/dart-src/packages/cli-tools/lib/src/commands/pocketbase.dart +32 -37
- package/dart-src/packages/cli-tools/lib/src/commands/rollback.dart +13 -16
- package/dart-src/packages/cli-tools/lib/src/commands/storage.dart +12 -20
- package/dart-src/packages/cli-tools/lib/src/config.dart +10 -3
- package/dart-src/packages/cli-tools/lib/src/operations.dart +5 -0
- package/dart-src/packages/cli-tools/lib/src/ui/ui.dart +225 -31
- package/dart-src/packages/cli-tools/lib/src/util.dart +7 -3
- package/dart-src/packages/cli-tools/test/cli_test.dart +6 -0
- package/dart-src/plugins/supabase/supabase/migrations/20250103114225_init.sql +7 -3
- package/dart-src/plugins/supabase/supabase/migrations/20250314000000_hot-updater_0.13.0.sql +7 -4
- package/dart-src/plugins/supabase/supabase/migrations/20250516000000_hot-updater_0.18.0.sql +18 -6
- package/dart-src/plugins/supabase/supabase/migrations/20251014000000_hot-updater_0.21.0.sql +4 -2
- package/dart-src/plugins/supabase/supabase/migrations/20260401000000_hot-updater_0.29.0.sql +4 -2
- package/dart-src/plugins/supabase/supabase/migrations/20260520014100_hot-updater_rls.sql +22 -6
- package/migrations/supabase/20250103114225_init.sql +7 -3
- package/migrations/supabase/20250314000000_hot-updater_0.13.0.sql +7 -4
- package/migrations/supabase/20250516000000_hot-updater_0.18.0.sql +18 -6
- package/migrations/supabase/20251014000000_hot-updater_0.21.0.sql +4 -2
- package/migrations/supabase/20260401000000_hot-updater_0.29.0.sql +4 -2
- package/migrations/supabase/20260520014100_hot-updater_rls.sql +22 -6
- package/package.json +1 -1
- package/scripts/vendor.sh +32 -0
- package/migrations/aws/README.md +0 -7
- package/migrations/cloudflare/bundles.sql +0 -42
|
@@ -8,14 +8,26 @@ UPDATE bundles
|
|
|
8
8
|
SET storage_uri = 'supabase-storage://%%BUCKET_NAME%%/' || id || '/bundle.zip'
|
|
9
9
|
WHERE storage_uri IS NULL;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
ALTER TABLE bundles ALTER COLUMN
|
|
11
|
+
DO $$ BEGIN
|
|
12
|
+
ALTER TABLE bundles ALTER COLUMN storage_uri SET NOT NULL;
|
|
13
|
+
EXCEPTION
|
|
14
|
+
WHEN null_value_not_allowed THEN NULL;
|
|
15
|
+
END $$;
|
|
16
|
+
DO $$ BEGIN
|
|
17
|
+
ALTER TABLE bundles ALTER COLUMN target_app_version DROP NOT NULL;
|
|
18
|
+
EXCEPTION
|
|
19
|
+
WHEN null_value_not_allowed THEN NULL;
|
|
20
|
+
END $$;
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
22
|
+
DO $$ BEGIN
|
|
23
|
+
ALTER TABLE bundles ADD CONSTRAINT check_version_or_fingerprint CHECK (
|
|
24
|
+
(target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL)
|
|
25
|
+
);
|
|
26
|
+
EXCEPTION
|
|
27
|
+
WHEN duplicate_object THEN NULL;
|
|
28
|
+
END $$;
|
|
17
29
|
|
|
18
|
-
CREATE INDEX bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
|
|
30
|
+
CREATE INDEX IF NOT EXISTS bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
|
|
19
31
|
|
|
20
32
|
DROP FUNCTION IF EXISTS get_update_info;
|
|
21
33
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash;
|
|
2
|
-
DROP FUNCTION IF EXISTS
|
|
1
|
+
DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
|
|
2
|
+
DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
|
|
3
|
+
DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[]); EXCEPTION WHEN undefined_function THEN NULL; END $$;
|
|
4
|
+
DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[], text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
|
|
3
5
|
|
|
4
6
|
-- HotUpdater.get_update_info
|
|
5
7
|
CREATE OR REPLACE FUNCTION get_update_info_by_fingerprint_hash (
|
|
@@ -251,7 +251,8 @@ $$;
|
|
|
251
251
|
|
|
252
252
|
-- HotUpdater.get_update_info_by_fingerprint_hash
|
|
253
253
|
|
|
254
|
-
DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash;
|
|
254
|
+
DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
|
|
255
|
+
DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
|
|
255
256
|
|
|
256
257
|
CREATE OR REPLACE FUNCTION get_update_info_by_fingerprint_hash (
|
|
257
258
|
app_platform platforms,
|
|
@@ -377,7 +378,8 @@ $$;
|
|
|
377
378
|
|
|
378
379
|
-- HotUpdater.get_update_info_by_app_version
|
|
379
380
|
|
|
380
|
-
DROP FUNCTION IF EXISTS get_update_info_by_app_version;
|
|
381
|
+
DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[]); EXCEPTION WHEN undefined_function THEN NULL; END $$;
|
|
382
|
+
DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[], text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
|
|
381
383
|
|
|
382
384
|
CREATE OR REPLACE FUNCTION get_update_info_by_app_version (
|
|
383
385
|
app_platform platforms,
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
-- HotUpdater.supabase_rls
|
|
2
2
|
|
|
3
3
|
ALTER TABLE public.bundles ENABLE ROW LEVEL SECURITY;
|
|
4
|
-
|
|
4
|
+
DO $$ BEGIN
|
|
5
|
+
ALTER TABLE public.bundle_patches ENABLE ROW LEVEL SECURITY;
|
|
6
|
+
EXCEPTION
|
|
7
|
+
WHEN undefined_table THEN NULL;
|
|
8
|
+
END $$;
|
|
5
9
|
|
|
6
10
|
ALTER FUNCTION public.get_target_app_version_list(public.platforms, uuid)
|
|
7
11
|
SET search_path = public, pg_catalog;
|
|
@@ -50,10 +54,22 @@ ALTER FUNCTION public.get_update_info_by_app_version(
|
|
|
50
54
|
-- OTA update checks are unauthenticated by design (the device only carries the
|
|
51
55
|
-- anon key), so bundle metadata must be publicly readable. hot-updater's hosted
|
|
52
56
|
-- Supabase flow relies on these policies existing.
|
|
53
|
-
|
|
54
|
-
CREATE POLICY "allow public read
|
|
57
|
+
DO $$ BEGIN
|
|
58
|
+
CREATE POLICY "allow public read bundles" ON public.bundles FOR SELECT USING (true);
|
|
59
|
+
EXCEPTION
|
|
60
|
+
WHEN duplicate_object THEN NULL;
|
|
61
|
+
END $$;
|
|
62
|
+
DO $$ BEGIN
|
|
63
|
+
CREATE POLICY "allow public read bundle_patches" ON public.bundle_patches FOR SELECT USING (true);
|
|
64
|
+
EXCEPTION
|
|
65
|
+
WHEN duplicate_object THEN NULL;
|
|
66
|
+
END $$;
|
|
55
67
|
|
|
56
68
|
-- Allow anon/authenticated to resolve signed download URLs for the bundles bucket.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
DO $$ BEGIN
|
|
70
|
+
CREATE POLICY "public bundles read" ON storage.objects
|
|
71
|
+
FOR SELECT TO anon, authenticated
|
|
72
|
+
USING (bucket_id = 'bundles');
|
|
73
|
+
EXCEPTION
|
|
74
|
+
WHEN duplicate_object THEN NULL;
|
|
75
|
+
END $$;
|
package/package.json
CHANGED
package/scripts/vendor.sh
CHANGED
|
@@ -26,4 +26,36 @@ find "$DST" -name build -type d -prune -exec rm -rf {} +
|
|
|
26
26
|
find "$DST" -name .git -type d -prune -exec rm -rf {} +
|
|
27
27
|
find "$DST" -name coverage -type d -prune -exec rm -rf {} +
|
|
28
28
|
|
|
29
|
+
# Sync migration SQL files so the binary can find them at ../migrations/<backend>/
|
|
30
|
+
MIG_DST="$(cd "$(dirname "$0")/.." && pwd)/migrations"
|
|
31
|
+
rm -rf "$MIG_DST"
|
|
32
|
+
|
|
33
|
+
# Supabase: migrations live in plugins/supabase/supabase/migrations/
|
|
34
|
+
if [ -d "$SRC/plugins/supabase/supabase/migrations" ]; then
|
|
35
|
+
mkdir -p "$MIG_DST/supabase"
|
|
36
|
+
cp "$SRC/plugins/supabase/supabase/migrations"/*.sql "$MIG_DST/supabase/"
|
|
37
|
+
echo " synced migrations/supabase ($(ls "$MIG_DST/supabase/"*.sql | wc -l) files)"
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# Postgres: SQL lives in plugins/postgres/sql/
|
|
41
|
+
if [ -d "$SRC/plugins/postgres/sql" ]; then
|
|
42
|
+
mkdir -p "$MIG_DST/postgres"
|
|
43
|
+
cp "$SRC/plugins/postgres/sql"/*.sql "$MIG_DST/postgres/"
|
|
44
|
+
echo " synced migrations/postgres ($(ls "$MIG_DST/postgres/"*.sql | wc -l) files)"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# Cloudflare: migrations live in plugins/cloudflare/migrations/
|
|
48
|
+
if [ -d "$SRC/plugins/cloudflare/migrations" ]; then
|
|
49
|
+
mkdir -p "$MIG_DST/cloudflare"
|
|
50
|
+
cp "$SRC/plugins/cloudflare/migrations"/*.sql "$MIG_DST/cloudflare/"
|
|
51
|
+
echo " synced migrations/cloudflare ($(ls "$MIG_DST/cloudflare/"*.sql | wc -l) files)"
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# AWS: migrations live in plugins/aws/migrations/ (if any)
|
|
55
|
+
if [ -d "$SRC/plugins/aws/migrations" ]; then
|
|
56
|
+
mkdir -p "$MIG_DST/aws"
|
|
57
|
+
cp "$SRC/plugins/aws/migrations"/*.sql "$MIG_DST/aws/"
|
|
58
|
+
echo " synced migrations/aws ($(ls "$MIG_DST/aws/"*.sql | wc -l) files)"
|
|
59
|
+
fi
|
|
60
|
+
|
|
29
61
|
echo "Done. dart-src size: $(du -sh "$DST" | cut -f1)"
|
package/migrations/aws/README.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# AWS migrations
|
|
2
|
-
|
|
3
|
-
The AWS backend stores bundle metadata as JSON in S3 (blob database), not in a
|
|
4
|
-
relational database. There are **no SQL migrations** to apply — the bucket and
|
|
5
|
-
object prefix are created on first `deploy`.
|
|
6
|
-
|
|
7
|
-
If you front downloads with CloudFront, provision the distribution separately.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
-- HotUpdater.bundles
|
|
2
|
-
|
|
3
|
-
CREATE TABLE bundles (
|
|
4
|
-
id TEXT PRIMARY KEY,
|
|
5
|
-
platform TEXT NOT NULL CHECK (platform IN ('ios', 'android')),
|
|
6
|
-
target_app_version TEXT,
|
|
7
|
-
should_force_update INTEGER NOT NULL CHECK (should_force_update IN (0, 1)),
|
|
8
|
-
enabled INTEGER NOT NULL CHECK (enabled IN (0, 1)),
|
|
9
|
-
file_hash TEXT NOT NULL,
|
|
10
|
-
git_commit_hash TEXT,
|
|
11
|
-
message TEXT,
|
|
12
|
-
channel TEXT NOT NULL DEFAULT 'production',
|
|
13
|
-
storage_uri TEXT NOT NULL,
|
|
14
|
-
fingerprint_hash TEXT,
|
|
15
|
-
metadata JSONB DEFAULT '{}',
|
|
16
|
-
manifest_storage_uri TEXT,
|
|
17
|
-
manifest_file_hash TEXT,
|
|
18
|
-
asset_base_storage_uri TEXT,
|
|
19
|
-
rollout_cohort_count INTEGER DEFAULT 1000
|
|
20
|
-
CHECK (rollout_cohort_count >= 0 AND rollout_cohort_count <= 1000),
|
|
21
|
-
target_cohorts TEXT,
|
|
22
|
-
CHECK ((target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL))
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
CREATE TABLE bundle_patches (
|
|
26
|
-
id TEXT PRIMARY KEY,
|
|
27
|
-
bundle_id TEXT NOT NULL,
|
|
28
|
-
base_bundle_id TEXT NOT NULL,
|
|
29
|
-
base_file_hash TEXT NOT NULL,
|
|
30
|
-
patch_file_hash TEXT NOT NULL,
|
|
31
|
-
patch_storage_uri TEXT NOT NULL,
|
|
32
|
-
order_index INTEGER NOT NULL DEFAULT 0,
|
|
33
|
-
FOREIGN KEY (bundle_id) REFERENCES bundles(id) ON DELETE CASCADE,
|
|
34
|
-
FOREIGN KEY (base_bundle_id) REFERENCES bundles(id) ON DELETE CASCADE
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
CREATE INDEX bundles_target_app_version_idx ON bundles(target_app_version);
|
|
38
|
-
CREATE INDEX bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
|
|
39
|
-
CREATE INDEX bundles_channel_idx ON bundles(channel);
|
|
40
|
-
CREATE INDEX bundles_rollout_idx ON bundles(rollout_cohort_count);
|
|
41
|
-
CREATE INDEX bundle_patches_bundle_id_idx ON bundle_patches(bundle_id);
|
|
42
|
-
CREATE INDEX bundle_patches_base_bundle_id_idx ON bundle_patches(base_bundle_id);
|