@hot-updater/supabase 0.35.8 → 0.35.10

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.
@@ -0,0 +1,112 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region iac/init/index.ts
3
+ const SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = "HOT_UPDATER_SUPABASE_DB_PASSWORD_PROJECT_ID";
4
+ const SUPABASE_REGION_VALUES = [
5
+ "ap-east-1",
6
+ "ap-northeast-1",
7
+ "ap-northeast-2",
8
+ "ap-south-1",
9
+ "ap-southeast-1",
10
+ "ap-southeast-2",
11
+ "ca-central-1",
12
+ "eu-central-1",
13
+ "eu-central-2",
14
+ "eu-north-1",
15
+ "eu-west-1",
16
+ "eu-west-2",
17
+ "eu-west-3",
18
+ "sa-east-1",
19
+ "us-east-1",
20
+ "us-east-2",
21
+ "us-west-1",
22
+ "us-west-2"
23
+ ];
24
+ const isSupabaseRegion = (value) => value !== void 0 && SUPABASE_REGION_VALUES.some((region) => region === value);
25
+ const isSupabaseFunctionName = (value) => value !== void 0 && /^[A-Za-z][A-Za-z0-9_-]*$/.test(value);
26
+ const initProvider = {
27
+ label: "Supabase",
28
+ inputs: {
29
+ projectId: {
30
+ envKey: "HOT_UPDATER_SUPABASE_PROJECT_ID",
31
+ help: "Supabase project reference"
32
+ },
33
+ projectName: {
34
+ envKey: "HOT_UPDATER_SUPABASE_PROJECT_NAME",
35
+ help: "Project name used when creating a Supabase project",
36
+ optional: true,
37
+ prompt: {
38
+ defaultValue: "hot-updater",
39
+ message: "Enter a name for the new Supabase project",
40
+ placeholder: "hot-updater",
41
+ type: "text"
42
+ }
43
+ },
44
+ organizationSlug: {
45
+ envKey: "HOT_UPDATER_SUPABASE_ORGANIZATION_SLUG",
46
+ help: "Organization slug used when creating a Supabase project",
47
+ optional: true,
48
+ prompt: {
49
+ message: "Select a Supabase organization",
50
+ type: "select"
51
+ }
52
+ },
53
+ region: {
54
+ envKey: "HOT_UPDATER_SUPABASE_REGION",
55
+ help: "Region used when creating a Supabase project",
56
+ optional: true,
57
+ prompt: {
58
+ defaultValue: "us-east-1",
59
+ message: "Select a region for the new Supabase project",
60
+ type: "select"
61
+ },
62
+ validate: isSupabaseRegion
63
+ },
64
+ accessToken: {
65
+ envKey: "SUPABASE_ACCESS_TOKEN",
66
+ help: "Supabase personal access token",
67
+ persistence: "with-consent",
68
+ preflight: false,
69
+ prompt: {
70
+ message: "Enter your Supabase personal access token",
71
+ type: "password"
72
+ }
73
+ },
74
+ bucketName: {
75
+ envKey: "HOT_UPDATER_SUPABASE_BUCKET_NAME",
76
+ help: "Storage bucket name",
77
+ prompt: {
78
+ defaultValue: "hot-updater-storage",
79
+ message: "Enter a name for the new storage bucket",
80
+ placeholder: "hot-updater-storage",
81
+ type: "text"
82
+ }
83
+ },
84
+ functionName: {
85
+ envKey: "HOT_UPDATER_SUPABASE_FUNCTION_NAME",
86
+ help: "Edge Function name",
87
+ prompt: {
88
+ defaultValue: "update-server",
89
+ message: "Enter a name for the edge function",
90
+ placeholder: "update-server",
91
+ type: "text"
92
+ },
93
+ validate: isSupabaseFunctionName
94
+ },
95
+ databasePassword: {
96
+ envKey: "HOT_UPDATER_SUPABASE_DB_PASSWORD",
97
+ help: "Database password, when required by the linked project",
98
+ optional: true,
99
+ persistence: "with-consent",
100
+ prompt: {
101
+ message: "Enter your Supabase database password (press Enter to skip if none)",
102
+ type: "password"
103
+ }
104
+ }
105
+ }
106
+ };
107
+ //#endregion
108
+ exports.SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY;
109
+ exports.SUPABASE_REGION_VALUES = SUPABASE_REGION_VALUES;
110
+ exports.initProvider = initProvider;
111
+ exports.isSupabaseFunctionName = isSupabaseFunctionName;
112
+ exports.isSupabaseRegion = isSupabaseRegion;
@@ -0,0 +1,89 @@
1
+ //#region iac/init/index.d.ts
2
+ declare const SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = "HOT_UPDATER_SUPABASE_DB_PASSWORD_PROJECT_ID";
3
+ declare const SUPABASE_REGION_VALUES: readonly ["ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-central-2", "eu-north-1", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2"];
4
+ type SupabaseRegion = (typeof SUPABASE_REGION_VALUES)[number];
5
+ declare const isSupabaseRegion: (value: string | undefined) => value is SupabaseRegion;
6
+ declare const isSupabaseFunctionName: (value: string | undefined) => value is string;
7
+ declare const initProvider: {
8
+ readonly label: "Supabase";
9
+ readonly inputs: {
10
+ readonly projectId: {
11
+ readonly envKey: "HOT_UPDATER_SUPABASE_PROJECT_ID";
12
+ readonly help: "Supabase project reference";
13
+ };
14
+ readonly projectName: {
15
+ readonly envKey: "HOT_UPDATER_SUPABASE_PROJECT_NAME";
16
+ readonly help: "Project name used when creating a Supabase project";
17
+ readonly optional: true;
18
+ readonly prompt: {
19
+ readonly defaultValue: "hot-updater";
20
+ readonly message: "Enter a name for the new Supabase project";
21
+ readonly placeholder: "hot-updater";
22
+ readonly type: "text";
23
+ };
24
+ };
25
+ readonly organizationSlug: {
26
+ readonly envKey: "HOT_UPDATER_SUPABASE_ORGANIZATION_SLUG";
27
+ readonly help: "Organization slug used when creating a Supabase project";
28
+ readonly optional: true;
29
+ readonly prompt: {
30
+ readonly message: "Select a Supabase organization";
31
+ readonly type: "select";
32
+ };
33
+ };
34
+ readonly region: {
35
+ readonly envKey: "HOT_UPDATER_SUPABASE_REGION";
36
+ readonly help: "Region used when creating a Supabase project";
37
+ readonly optional: true;
38
+ readonly prompt: {
39
+ readonly defaultValue: "us-east-1";
40
+ readonly message: "Select a region for the new Supabase project";
41
+ readonly type: "select";
42
+ };
43
+ readonly validate: (value: string | undefined) => value is SupabaseRegion;
44
+ };
45
+ readonly accessToken: {
46
+ readonly envKey: "SUPABASE_ACCESS_TOKEN";
47
+ readonly help: "Supabase personal access token";
48
+ readonly persistence: "with-consent";
49
+ readonly preflight: false;
50
+ readonly prompt: {
51
+ readonly message: "Enter your Supabase personal access token";
52
+ readonly type: "password";
53
+ };
54
+ };
55
+ readonly bucketName: {
56
+ readonly envKey: "HOT_UPDATER_SUPABASE_BUCKET_NAME";
57
+ readonly help: "Storage bucket name";
58
+ readonly prompt: {
59
+ readonly defaultValue: "hot-updater-storage";
60
+ readonly message: "Enter a name for the new storage bucket";
61
+ readonly placeholder: "hot-updater-storage";
62
+ readonly type: "text";
63
+ };
64
+ };
65
+ readonly functionName: {
66
+ readonly envKey: "HOT_UPDATER_SUPABASE_FUNCTION_NAME";
67
+ readonly help: "Edge Function name";
68
+ readonly prompt: {
69
+ readonly defaultValue: "update-server";
70
+ readonly message: "Enter a name for the edge function";
71
+ readonly placeholder: "update-server";
72
+ readonly type: "text";
73
+ };
74
+ readonly validate: (value: string | undefined) => value is string;
75
+ };
76
+ readonly databasePassword: {
77
+ readonly envKey: "HOT_UPDATER_SUPABASE_DB_PASSWORD";
78
+ readonly help: "Database password, when required by the linked project";
79
+ readonly optional: true;
80
+ readonly persistence: "with-consent";
81
+ readonly prompt: {
82
+ readonly message: "Enter your Supabase database password (press Enter to skip if none)";
83
+ readonly type: "password";
84
+ };
85
+ };
86
+ };
87
+ };
88
+ //#endregion
89
+ export { SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY, SUPABASE_REGION_VALUES, SupabaseRegion, initProvider, isSupabaseFunctionName, isSupabaseRegion };
@@ -0,0 +1,89 @@
1
+ //#region iac/init/index.d.ts
2
+ declare const SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = "HOT_UPDATER_SUPABASE_DB_PASSWORD_PROJECT_ID";
3
+ declare const SUPABASE_REGION_VALUES: readonly ["ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-central-2", "eu-north-1", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2"];
4
+ type SupabaseRegion = (typeof SUPABASE_REGION_VALUES)[number];
5
+ declare const isSupabaseRegion: (value: string | undefined) => value is SupabaseRegion;
6
+ declare const isSupabaseFunctionName: (value: string | undefined) => value is string;
7
+ declare const initProvider: {
8
+ readonly label: "Supabase";
9
+ readonly inputs: {
10
+ readonly projectId: {
11
+ readonly envKey: "HOT_UPDATER_SUPABASE_PROJECT_ID";
12
+ readonly help: "Supabase project reference";
13
+ };
14
+ readonly projectName: {
15
+ readonly envKey: "HOT_UPDATER_SUPABASE_PROJECT_NAME";
16
+ readonly help: "Project name used when creating a Supabase project";
17
+ readonly optional: true;
18
+ readonly prompt: {
19
+ readonly defaultValue: "hot-updater";
20
+ readonly message: "Enter a name for the new Supabase project";
21
+ readonly placeholder: "hot-updater";
22
+ readonly type: "text";
23
+ };
24
+ };
25
+ readonly organizationSlug: {
26
+ readonly envKey: "HOT_UPDATER_SUPABASE_ORGANIZATION_SLUG";
27
+ readonly help: "Organization slug used when creating a Supabase project";
28
+ readonly optional: true;
29
+ readonly prompt: {
30
+ readonly message: "Select a Supabase organization";
31
+ readonly type: "select";
32
+ };
33
+ };
34
+ readonly region: {
35
+ readonly envKey: "HOT_UPDATER_SUPABASE_REGION";
36
+ readonly help: "Region used when creating a Supabase project";
37
+ readonly optional: true;
38
+ readonly prompt: {
39
+ readonly defaultValue: "us-east-1";
40
+ readonly message: "Select a region for the new Supabase project";
41
+ readonly type: "select";
42
+ };
43
+ readonly validate: (value: string | undefined) => value is SupabaseRegion;
44
+ };
45
+ readonly accessToken: {
46
+ readonly envKey: "SUPABASE_ACCESS_TOKEN";
47
+ readonly help: "Supabase personal access token";
48
+ readonly persistence: "with-consent";
49
+ readonly preflight: false;
50
+ readonly prompt: {
51
+ readonly message: "Enter your Supabase personal access token";
52
+ readonly type: "password";
53
+ };
54
+ };
55
+ readonly bucketName: {
56
+ readonly envKey: "HOT_UPDATER_SUPABASE_BUCKET_NAME";
57
+ readonly help: "Storage bucket name";
58
+ readonly prompt: {
59
+ readonly defaultValue: "hot-updater-storage";
60
+ readonly message: "Enter a name for the new storage bucket";
61
+ readonly placeholder: "hot-updater-storage";
62
+ readonly type: "text";
63
+ };
64
+ };
65
+ readonly functionName: {
66
+ readonly envKey: "HOT_UPDATER_SUPABASE_FUNCTION_NAME";
67
+ readonly help: "Edge Function name";
68
+ readonly prompt: {
69
+ readonly defaultValue: "update-server";
70
+ readonly message: "Enter a name for the edge function";
71
+ readonly placeholder: "update-server";
72
+ readonly type: "text";
73
+ };
74
+ readonly validate: (value: string | undefined) => value is string;
75
+ };
76
+ readonly databasePassword: {
77
+ readonly envKey: "HOT_UPDATER_SUPABASE_DB_PASSWORD";
78
+ readonly help: "Database password, when required by the linked project";
79
+ readonly optional: true;
80
+ readonly persistence: "with-consent";
81
+ readonly prompt: {
82
+ readonly message: "Enter your Supabase database password (press Enter to skip if none)";
83
+ readonly type: "password";
84
+ };
85
+ };
86
+ };
87
+ };
88
+ //#endregion
89
+ export { SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY, SUPABASE_REGION_VALUES, SupabaseRegion, initProvider, isSupabaseFunctionName, isSupabaseRegion };
@@ -0,0 +1,107 @@
1
+ //#region iac/init/index.ts
2
+ const SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = "HOT_UPDATER_SUPABASE_DB_PASSWORD_PROJECT_ID";
3
+ const SUPABASE_REGION_VALUES = [
4
+ "ap-east-1",
5
+ "ap-northeast-1",
6
+ "ap-northeast-2",
7
+ "ap-south-1",
8
+ "ap-southeast-1",
9
+ "ap-southeast-2",
10
+ "ca-central-1",
11
+ "eu-central-1",
12
+ "eu-central-2",
13
+ "eu-north-1",
14
+ "eu-west-1",
15
+ "eu-west-2",
16
+ "eu-west-3",
17
+ "sa-east-1",
18
+ "us-east-1",
19
+ "us-east-2",
20
+ "us-west-1",
21
+ "us-west-2"
22
+ ];
23
+ const isSupabaseRegion = (value) => value !== void 0 && SUPABASE_REGION_VALUES.some((region) => region === value);
24
+ const isSupabaseFunctionName = (value) => value !== void 0 && /^[A-Za-z][A-Za-z0-9_-]*$/.test(value);
25
+ const initProvider = {
26
+ label: "Supabase",
27
+ inputs: {
28
+ projectId: {
29
+ envKey: "HOT_UPDATER_SUPABASE_PROJECT_ID",
30
+ help: "Supabase project reference"
31
+ },
32
+ projectName: {
33
+ envKey: "HOT_UPDATER_SUPABASE_PROJECT_NAME",
34
+ help: "Project name used when creating a Supabase project",
35
+ optional: true,
36
+ prompt: {
37
+ defaultValue: "hot-updater",
38
+ message: "Enter a name for the new Supabase project",
39
+ placeholder: "hot-updater",
40
+ type: "text"
41
+ }
42
+ },
43
+ organizationSlug: {
44
+ envKey: "HOT_UPDATER_SUPABASE_ORGANIZATION_SLUG",
45
+ help: "Organization slug used when creating a Supabase project",
46
+ optional: true,
47
+ prompt: {
48
+ message: "Select a Supabase organization",
49
+ type: "select"
50
+ }
51
+ },
52
+ region: {
53
+ envKey: "HOT_UPDATER_SUPABASE_REGION",
54
+ help: "Region used when creating a Supabase project",
55
+ optional: true,
56
+ prompt: {
57
+ defaultValue: "us-east-1",
58
+ message: "Select a region for the new Supabase project",
59
+ type: "select"
60
+ },
61
+ validate: isSupabaseRegion
62
+ },
63
+ accessToken: {
64
+ envKey: "SUPABASE_ACCESS_TOKEN",
65
+ help: "Supabase personal access token",
66
+ persistence: "with-consent",
67
+ preflight: false,
68
+ prompt: {
69
+ message: "Enter your Supabase personal access token",
70
+ type: "password"
71
+ }
72
+ },
73
+ bucketName: {
74
+ envKey: "HOT_UPDATER_SUPABASE_BUCKET_NAME",
75
+ help: "Storage bucket name",
76
+ prompt: {
77
+ defaultValue: "hot-updater-storage",
78
+ message: "Enter a name for the new storage bucket",
79
+ placeholder: "hot-updater-storage",
80
+ type: "text"
81
+ }
82
+ },
83
+ functionName: {
84
+ envKey: "HOT_UPDATER_SUPABASE_FUNCTION_NAME",
85
+ help: "Edge Function name",
86
+ prompt: {
87
+ defaultValue: "update-server",
88
+ message: "Enter a name for the edge function",
89
+ placeholder: "update-server",
90
+ type: "text"
91
+ },
92
+ validate: isSupabaseFunctionName
93
+ },
94
+ databasePassword: {
95
+ envKey: "HOT_UPDATER_SUPABASE_DB_PASSWORD",
96
+ help: "Database password, when required by the linked project",
97
+ optional: true,
98
+ persistence: "with-consent",
99
+ prompt: {
100
+ message: "Enter your Supabase database password (press Enter to skip if none)",
101
+ type: "password"
102
+ }
103
+ }
104
+ }
105
+ };
106
+ //#endregion
107
+ export { SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY, SUPABASE_REGION_VALUES, initProvider, isSupabaseFunctionName, isSupabaseRegion };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/supabase",
3
3
  "type": "module",
4
- "version": "0.35.8",
4
+ "version": "0.35.10",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -11,6 +11,11 @@
11
11
  "import": "./dist/index.mjs",
12
12
  "require": "./dist/index.cjs"
13
13
  },
14
+ "./init": {
15
+ "types": "./dist/init/index.d.cts",
16
+ "import": "./dist/init/index.mjs",
17
+ "require": "./dist/init/index.cjs"
18
+ },
14
19
  "./edge": {
15
20
  "import": "./dist/edge.mjs",
16
21
  "require": "./dist/edge.cjs"
@@ -50,10 +55,10 @@
50
55
  "@supabase/supabase-js": "2.76.1",
51
56
  "hono": "4.12.9",
52
57
  "uuidv7": "^1.0.2",
53
- "@hot-updater/core": "0.35.8",
54
- "@hot-updater/cli-tools": "0.35.8",
55
- "@hot-updater/server": "0.35.8",
56
- "@hot-updater/plugin-core": "0.35.8"
58
+ "@hot-updater/core": "0.35.10",
59
+ "@hot-updater/plugin-core": "0.35.10",
60
+ "@hot-updater/server": "0.35.10",
61
+ "@hot-updater/cli-tools": "0.35.10"
57
62
  },
58
63
  "devDependencies": {
59
64
  "@electric-sql/pglite": "0.4.1",
@@ -63,10 +68,10 @@
63
68
  "execa": "9.5.2",
64
69
  "@types/node": "^20",
65
70
  "mime": "^4.0.4",
66
- "@hot-updater/js": "0.35.8",
67
- "@hot-updater/mock": "0.35.8",
68
- "@hot-updater/test-utils": "0.35.8",
69
- "@hot-updater/postgres": "0.35.8"
71
+ "@hot-updater/js": "0.35.10",
72
+ "@hot-updater/mock": "0.35.10",
73
+ "@hot-updater/test-utils": "0.35.10",
74
+ "@hot-updater/postgres": "0.35.10"
70
75
  },
71
76
  "scripts": {
72
77
  "build": "tsdown",
@@ -14,7 +14,12 @@ import path from "node:path";
14
14
  import { fileURLToPath, pathToFileURL } from "node:url";
15
15
 
16
16
  import { transformEnv } from "@hot-updater/cli-tools";
17
- import { type Bundle, type GetBundlesArgs, NIL_UUID } from "@hot-updater/core";
17
+ import {
18
+ type Bundle,
19
+ type GetBundlesArgs,
20
+ NIL_UUID,
21
+ type UpdateInfo,
22
+ } from "@hot-updater/core";
18
23
  import { createHotUpdater } from "@hot-updater/server";
19
24
  import {
20
25
  setupBsdiffManifestUpdateInfoTestSuite,
@@ -310,24 +315,20 @@ describe.sequential("supabase edge runtime acceptance", () => {
310
315
  }
311
316
 
312
317
  if (composeFilePath) {
313
- try {
314
- runCheckedCommand({
315
- command: "docker",
316
- args: [
317
- "compose",
318
- "-p",
319
- composeProjectName,
320
- "-f",
321
- composeFilePath,
322
- "down",
323
- "-v",
324
- "--remove-orphans",
325
- ],
326
- cwd: WORKSPACE_ROOT,
327
- });
328
- } catch {
329
- // ignore cleanup failures
330
- }
318
+ runCheckedCommand({
319
+ command: "docker",
320
+ args: [
321
+ "compose",
322
+ "-p",
323
+ composeProjectName,
324
+ "-f",
325
+ composeFilePath,
326
+ "down",
327
+ "-v",
328
+ "--remove-orphans",
329
+ ],
330
+ cwd: WORKSPACE_ROOT,
331
+ });
331
332
  }
332
333
 
333
334
  if (runtimeRoot) {
@@ -341,7 +342,9 @@ describe.sequential("supabase edge runtime acceptance", () => {
341
342
  }
342
343
  };
343
344
 
344
- const requestUpdateInfo = async (args: GetBundlesArgs) => {
345
+ const requestUpdateInfo = async (
346
+ args: GetBundlesArgs,
347
+ ): Promise<UpdateInfo | null> => {
345
348
  const response = await fetch(
346
349
  `http://127.0.0.1:${edgePort}${FUNCTION_BASE_PATH}${createCanonicalPath(args)}`,
347
350
  );
@@ -356,7 +359,7 @@ describe.sequential("supabase edge runtime acceptance", () => {
356
359
  );
357
360
  }
358
361
 
359
- return (await response.json()) as any;
362
+ return response.json();
360
363
  };
361
364
 
362
365
  const getUpdateInfo = async (bundles: Bundle[], args: GetBundlesArgs) => {
@@ -808,6 +811,7 @@ services:
808
811
 
809
812
  storage:
810
813
  image: ${STORAGE_IMAGE}
814
+ restart: on-failure
811
815
  depends_on:
812
816
  db:
813
817
  condition: service_healthy