@hot-updater/supabase 0.29.8 → 0.30.1
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/supabase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.30.1",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@supabase/supabase-js": "^2.76.1",
|
|
48
48
|
"hono": "4.12.9",
|
|
49
49
|
"uuidv7": "^1.0.2",
|
|
50
|
-
"@hot-updater/core": "0.
|
|
51
|
-
"@hot-updater/
|
|
52
|
-
"@hot-updater/
|
|
53
|
-
"@hot-updater/
|
|
50
|
+
"@hot-updater/plugin-core": "0.30.1",
|
|
51
|
+
"@hot-updater/cli-tools": "0.30.1",
|
|
52
|
+
"@hot-updater/server": "0.30.1",
|
|
53
|
+
"@hot-updater/core": "0.30.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@electric-sql/pglite": "^0.2.15",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"execa": "9.5.2",
|
|
61
61
|
"@types/node": "^20",
|
|
62
62
|
"mime": "^4.0.4",
|
|
63
|
-
"@hot-updater/
|
|
64
|
-
"@hot-updater/
|
|
65
|
-
"@hot-updater/
|
|
66
|
-
"@hot-updater/
|
|
63
|
+
"@hot-updater/js": "0.30.1",
|
|
64
|
+
"@hot-updater/mock": "0.30.1",
|
|
65
|
+
"@hot-updater/test-utils": "0.30.1",
|
|
66
|
+
"@hot-updater/postgres": "0.30.1"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "tsdown",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
-- HotUpdater.is_cohort_eligible
|
|
2
|
+
CREATE OR REPLACE FUNCTION is_cohort_eligible(
|
|
3
|
+
bundle_id UUID,
|
|
4
|
+
cohort TEXT,
|
|
5
|
+
rollout_cohort_count INTEGER,
|
|
6
|
+
target_cohorts TEXT[]
|
|
7
|
+
)
|
|
8
|
+
RETURNS BOOLEAN
|
|
9
|
+
LANGUAGE plpgsql
|
|
10
|
+
IMMUTABLE
|
|
11
|
+
AS $$
|
|
12
|
+
DECLARE
|
|
13
|
+
normalized_cohort TEXT := normalize_cohort_value(cohort);
|
|
14
|
+
normalized_rollout_count INTEGER := COALESCE(rollout_cohort_count, 1000);
|
|
15
|
+
normalized_target_cohorts TEXT[];
|
|
16
|
+
BEGIN
|
|
17
|
+
IF target_cohorts IS NOT NULL THEN
|
|
18
|
+
normalized_target_cohorts := ARRAY(
|
|
19
|
+
SELECT normalize_cohort_value(value)
|
|
20
|
+
FROM unnest(target_cohorts) AS value
|
|
21
|
+
);
|
|
22
|
+
END IF;
|
|
23
|
+
|
|
24
|
+
IF normalized_target_cohorts IS NOT NULL
|
|
25
|
+
AND array_length(normalized_target_cohorts, 1) > 0
|
|
26
|
+
AND normalized_cohort IS NOT NULL
|
|
27
|
+
AND normalized_cohort = ANY(normalized_target_cohorts) THEN
|
|
28
|
+
RETURN TRUE;
|
|
29
|
+
END IF;
|
|
30
|
+
|
|
31
|
+
IF normalized_rollout_count <= 0 THEN
|
|
32
|
+
RETURN FALSE;
|
|
33
|
+
END IF;
|
|
34
|
+
|
|
35
|
+
IF normalized_cohort IS NULL THEN
|
|
36
|
+
RETURN normalized_rollout_count >= 1000;
|
|
37
|
+
END IF;
|
|
38
|
+
|
|
39
|
+
IF NOT is_numeric_cohort(normalized_cohort) THEN
|
|
40
|
+
RETURN FALSE;
|
|
41
|
+
END IF;
|
|
42
|
+
|
|
43
|
+
IF normalized_rollout_count >= 1000 THEN
|
|
44
|
+
RETURN TRUE;
|
|
45
|
+
END IF;
|
|
46
|
+
|
|
47
|
+
RETURN get_numeric_cohort_rollout_position(bundle_id, normalized_cohort)
|
|
48
|
+
< normalized_rollout_count;
|
|
49
|
+
END;
|
|
50
|
+
$$;
|