@hot-updater/postgres 0.5.4 → 0.5.6
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/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/package.json +3 -3
- package/sql/bundles.sql +1 -1
- package/sql/get_update_info.sql +6 -6
- package/sql/get_update_info.test.ts +3 -3
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,7 @@ const postgres = (config, hooks)=>(_)=>{
|
|
|
53
53
|
id: bundle.id,
|
|
54
54
|
enabled: bundle.enabled,
|
|
55
55
|
file_url: bundle.fileUrl,
|
|
56
|
-
|
|
56
|
+
should_force_update: bundle.shouldForceUpdate,
|
|
57
57
|
file_hash: bundle.fileHash,
|
|
58
58
|
git_commit_hash: bundle.gitCommitHash,
|
|
59
59
|
message: bundle.message,
|
|
@@ -62,7 +62,7 @@ const postgres = (config, hooks)=>(_)=>{
|
|
|
62
62
|
}).onConflict((oc)=>oc.column("id").doUpdateSet({
|
|
63
63
|
enabled: bundle.enabled,
|
|
64
64
|
file_url: bundle.fileUrl,
|
|
65
|
-
|
|
65
|
+
should_force_update: bundle.shouldForceUpdate,
|
|
66
66
|
file_hash: bundle.fileHash,
|
|
67
67
|
git_commit_hash: bundle.gitCommitHash,
|
|
68
68
|
message: bundle.message,
|
|
@@ -91,7 +91,7 @@ const postgres = (config, hooks)=>(_)=>{
|
|
|
91
91
|
return {
|
|
92
92
|
enabled: data.enabled,
|
|
93
93
|
fileUrl: data.file_url,
|
|
94
|
-
|
|
94
|
+
shouldForceUpdate: data.should_force_update,
|
|
95
95
|
fileHash: data.file_hash,
|
|
96
96
|
gitCommitHash: data.git_commit_hash,
|
|
97
97
|
id: data.id,
|
|
@@ -106,7 +106,7 @@ const postgres = (config, hooks)=>(_)=>{
|
|
|
106
106
|
return data.map((bundle)=>({
|
|
107
107
|
enabled: bundle.enabled,
|
|
108
108
|
fileUrl: bundle.file_url,
|
|
109
|
-
|
|
109
|
+
shouldForceUpdate: bundle.should_force_update,
|
|
110
110
|
fileHash: bundle.file_hash,
|
|
111
111
|
gitCommitHash: bundle.git_commit_hash,
|
|
112
112
|
id: bundle.id,
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ const postgres = (config, hooks)=>(_)=>{
|
|
|
23
23
|
id: bundle.id,
|
|
24
24
|
enabled: bundle.enabled,
|
|
25
25
|
file_url: bundle.fileUrl,
|
|
26
|
-
|
|
26
|
+
should_force_update: bundle.shouldForceUpdate,
|
|
27
27
|
file_hash: bundle.fileHash,
|
|
28
28
|
git_commit_hash: bundle.gitCommitHash,
|
|
29
29
|
message: bundle.message,
|
|
@@ -32,7 +32,7 @@ const postgres = (config, hooks)=>(_)=>{
|
|
|
32
32
|
}).onConflict((oc)=>oc.column("id").doUpdateSet({
|
|
33
33
|
enabled: bundle.enabled,
|
|
34
34
|
file_url: bundle.fileUrl,
|
|
35
|
-
|
|
35
|
+
should_force_update: bundle.shouldForceUpdate,
|
|
36
36
|
file_hash: bundle.fileHash,
|
|
37
37
|
git_commit_hash: bundle.gitCommitHash,
|
|
38
38
|
message: bundle.message,
|
|
@@ -61,7 +61,7 @@ const postgres = (config, hooks)=>(_)=>{
|
|
|
61
61
|
return {
|
|
62
62
|
enabled: data.enabled,
|
|
63
63
|
fileUrl: data.file_url,
|
|
64
|
-
|
|
64
|
+
shouldForceUpdate: data.should_force_update,
|
|
65
65
|
fileHash: data.file_hash,
|
|
66
66
|
gitCommitHash: data.git_commit_hash,
|
|
67
67
|
id: data.id,
|
|
@@ -76,7 +76,7 @@ const postgres = (config, hooks)=>(_)=>{
|
|
|
76
76
|
return data.map((bundle)=>({
|
|
77
77
|
enabled: bundle.enabled,
|
|
78
78
|
fileUrl: bundle.file_url,
|
|
79
|
-
|
|
79
|
+
shouldForceUpdate: bundle.should_force_update,
|
|
80
80
|
fileHash: bundle.file_hash,
|
|
81
81
|
gitCommitHash: bundle.git_commit_hash,
|
|
82
82
|
id: bundle.id,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/postgres",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.6",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"package.json"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@hot-updater/core": "0.5.
|
|
33
|
-
"@hot-updater/plugin-core": "0.5.
|
|
32
|
+
"@hot-updater/core": "0.5.6",
|
|
33
|
+
"@hot-updater/plugin-core": "0.5.6",
|
|
34
34
|
"kysely": "^0.27.5",
|
|
35
35
|
"pg": "^8.13.1"
|
|
36
36
|
},
|
package/sql/bundles.sql
CHANGED
|
@@ -6,7 +6,7 @@ CREATE TABLE bundles (
|
|
|
6
6
|
id uuid PRIMARY KEY,
|
|
7
7
|
platform platforms NOT NULL,
|
|
8
8
|
target_app_version text NOT NULL,
|
|
9
|
-
|
|
9
|
+
should_force_update boolean NOT NULL,
|
|
10
10
|
enabled boolean NOT NULL,
|
|
11
11
|
file_url text NOT NULL,
|
|
12
12
|
file_hash text NOT NULL,
|
package/sql/get_update_info.sql
CHANGED
|
@@ -7,7 +7,7 @@ CREATE OR REPLACE FUNCTION get_update_info (
|
|
|
7
7
|
)
|
|
8
8
|
RETURNS TABLE (
|
|
9
9
|
id uuid,
|
|
10
|
-
|
|
10
|
+
should_force_update boolean,
|
|
11
11
|
file_url text,
|
|
12
12
|
file_hash text,
|
|
13
13
|
status text
|
|
@@ -22,8 +22,8 @@ BEGIN
|
|
|
22
22
|
WITH rollback_candidate AS (
|
|
23
23
|
SELECT
|
|
24
24
|
b.id,
|
|
25
|
-
-- If status is 'ROLLBACK',
|
|
26
|
-
TRUE AS
|
|
25
|
+
-- If status is 'ROLLBACK', should_force_update is always TRUE
|
|
26
|
+
TRUE AS should_force_update,
|
|
27
27
|
b.file_url,
|
|
28
28
|
b.file_hash,
|
|
29
29
|
'ROLLBACK' AS status
|
|
@@ -37,7 +37,7 @@ BEGIN
|
|
|
37
37
|
update_candidate AS (
|
|
38
38
|
SELECT
|
|
39
39
|
b.id,
|
|
40
|
-
b.
|
|
40
|
+
b.should_force_update,
|
|
41
41
|
b.file_url,
|
|
42
42
|
b.file_hash,
|
|
43
43
|
'UPDATE' AS status
|
|
@@ -66,11 +66,11 @@ BEGIN
|
|
|
66
66
|
/*
|
|
67
67
|
When there are no final results and bundle_id != NIL_UUID,
|
|
68
68
|
add one fallback row.
|
|
69
|
-
This fallback row is also ROLLBACK so
|
|
69
|
+
This fallback row is also ROLLBACK so shouldForceUpdate = TRUE.
|
|
70
70
|
*/
|
|
71
71
|
SELECT
|
|
72
72
|
NIL_UUID AS id,
|
|
73
|
-
TRUE AS
|
|
73
|
+
TRUE AS should_force_update, -- Always TRUE
|
|
74
74
|
NULL AS file_url,
|
|
75
75
|
NULL AS file_hash,
|
|
76
76
|
'ROLLBACK' AS status
|
|
@@ -9,14 +9,14 @@ const createInsertBundleQuery = (bundle: Bundle) => {
|
|
|
9
9
|
return `
|
|
10
10
|
INSERT INTO bundles (
|
|
11
11
|
id, file_url, file_hash, platform, target_app_version,
|
|
12
|
-
|
|
12
|
+
should_force_update, enabled, git_commit_hash, message
|
|
13
13
|
) VALUES (
|
|
14
14
|
'${bundle.id}',
|
|
15
15
|
'${bundle.fileUrl}',
|
|
16
16
|
'${bundle.fileHash}',
|
|
17
17
|
'${bundle.platform}',
|
|
18
18
|
'${bundle.targetAppVersion}',
|
|
19
|
-
${bundle.
|
|
19
|
+
${bundle.shouldForceUpdate},
|
|
20
20
|
${bundle.enabled},
|
|
21
21
|
${bundle.gitCommitHash ? `'${bundle.gitCommitHash}'` : "null"},
|
|
22
22
|
${bundle.message ? `'${bundle.message}'` : "null"}
|
|
@@ -34,7 +34,7 @@ const createGetUpdateInfo =
|
|
|
34
34
|
|
|
35
35
|
const result = await db.query<{
|
|
36
36
|
id: string;
|
|
37
|
-
|
|
37
|
+
should_force_update: boolean;
|
|
38
38
|
file_url: string;
|
|
39
39
|
file_hash: string;
|
|
40
40
|
status: string;
|