@hot-updater/core 0.17.0 → 0.18.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/dist/index.cjs CHANGED
@@ -1,36 +1,6 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- NIL_UUID: ()=>NIL_UUID
28
- });
1
+
2
+ //#region src/uuid.ts
29
3
  const NIL_UUID = "00000000-0000-0000-0000-000000000000";
30
- exports.NIL_UUID = __webpack_exports__.NIL_UUID;
31
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
32
- "NIL_UUID"
33
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
34
- Object.defineProperty(exports, '__esModule', {
35
- value: true
36
- });
4
+
5
+ //#endregion
6
+ exports.NIL_UUID = NIL_UUID;
@@ -0,0 +1,158 @@
1
+ //#region src/types.d.ts
2
+ type Platform = "ios" | "android";
3
+ type BundleMetadata = {
4
+ app_version?: string;
5
+ };
6
+ interface Bundle {
7
+ /**
8
+ * The unique identifier for the bundle. uuidv7
9
+ */
10
+ id: string;
11
+ /**
12
+ * The platform the bundle is for.
13
+ */
14
+ platform: Platform;
15
+ /**
16
+ * Whether the bundle should force an update.
17
+ */
18
+ shouldForceUpdate: boolean;
19
+ /**
20
+ * Whether the bundle is enabled.
21
+ */
22
+ enabled: boolean;
23
+ /**
24
+ * The hash of the bundle.
25
+ */
26
+ fileHash: string;
27
+ /**
28
+ * The storage key of the bundle.
29
+ * @example "s3://my-bucket/my-app/00000000-0000-0000-0000-000000000000/bundle.zip"
30
+ * @example "r2://my-bucket/my-app/00000000-0000-0000-0000-000000000000/bundle.zip"
31
+ * @example "firebase-storage://my-bucket/my-app/00000000-0000-0000-0000-000000000000/bundle.zip"
32
+ * @example "storage://my-app/00000000-0000-0000-0000-000000000000/bundle.zip"
33
+ */
34
+ storageUri: string;
35
+ /**
36
+ * The git commit hash of the bundle.
37
+ */
38
+ gitCommitHash: string | null;
39
+ /**
40
+ * The message of the bundle.
41
+ */
42
+ message: string | null;
43
+ /**
44
+ * The name of the channel where the bundle is deployed.
45
+ *
46
+ * Examples:
47
+ * - production: Production channel for end users
48
+ * - development: Development channel for testing
49
+ * - staging: Staging channel for quality assurance before production
50
+ * - app-name: Channel for specific app instances (e.g., my-app, app-test)
51
+ *
52
+ * Different channel values can be used based on each app's requirements.
53
+ */
54
+ channel: string;
55
+ /**
56
+ * The target app version of the bundle.
57
+ */
58
+ targetAppVersion: string | null;
59
+ /**
60
+ * The fingerprint hash of the bundle.
61
+ */
62
+ fingerprintHash: string | null;
63
+ /**
64
+ * The metadata of the bundle.
65
+ */
66
+ metadata?: BundleMetadata;
67
+ }
68
+ type SnakeCase<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Capitalize<T> ? "_" : ""}${Lowercase<T>}${SnakeCase<U>}` : S;
69
+ type SnakeKeyObject<T> = T extends Record<string, any> ? { [K in keyof T as SnakeCase<Extract<K, string>>]: T[K] extends object ? SnakeKeyObject<T[K]> : T[K] } : T;
70
+ type SnakeCaseBundle = SnakeKeyObject<Bundle>;
71
+ type UpdateStatus = "ROLLBACK" | "UPDATE";
72
+ /**
73
+ * The update info for the database layer.
74
+ * This is the update info that is used by the database.
75
+ */
76
+ interface UpdateInfo {
77
+ id: string;
78
+ shouldForceUpdate: boolean;
79
+ message: string | null;
80
+ status: UpdateStatus;
81
+ storageUri: string | null;
82
+ }
83
+ /**
84
+ * The update info for the app layer.
85
+ * This is the update info that is used by the app.
86
+ */
87
+ interface AppUpdateInfo extends UpdateInfo {
88
+ fileUrl: string | null;
89
+ }
90
+ type UpdateStrategy = "fingerprint" | "appVersion";
91
+ type FingerprintGetBundlesArgs = {
92
+ _updateStrategy: "fingerprint";
93
+ platform: Platform;
94
+ /**
95
+ * The current bundle id of the app.
96
+ */
97
+ bundleId: string;
98
+ /**
99
+ * Minimum bundle id that should be used.
100
+ * This value is generated at build time via getMinBundleId().
101
+ *
102
+ * @default "00000000-0000-0000-0000-000000000000"
103
+ */
104
+ minBundleId?: string;
105
+ /**
106
+ * The name of the channel where the bundle is deployed.
107
+ *
108
+ * @default "production"
109
+ *
110
+ * Examples:
111
+ * - production: Production channel for end users
112
+ * - development: Development channel for testing
113
+ * - staging: Staging channel for quality assurance before production
114
+ * - app-name: Channel for specific app instances (e.g., my-app, app-test)
115
+ */
116
+ channel?: string;
117
+ /**
118
+ * The fingerprint hash of the bundle.
119
+ */
120
+ fingerprintHash: string;
121
+ };
122
+ type AppVersionGetBundlesArgs = {
123
+ _updateStrategy: "appVersion";
124
+ platform: Platform;
125
+ /**
126
+ * The current bundle id of the app.
127
+ */
128
+ bundleId: string;
129
+ /**
130
+ * Minimum bundle id that should be used.
131
+ * This value is generated at build time via getMinBundleId().
132
+ *
133
+ * @default "00000000-0000-0000-0000-000000000000"
134
+ */
135
+ minBundleId?: string;
136
+ /**
137
+ * The name of the channel where the bundle is deployed.
138
+ *
139
+ * @default "production"
140
+ *
141
+ * Examples:
142
+ * - production: Production channel for end users
143
+ * - development: Development channel for testing
144
+ * - staging: Staging channel for quality assurance before production
145
+ * - app-name: Channel for specific app instances (e.g., my-app, app-test)
146
+ */
147
+ channel?: string;
148
+ /**
149
+ * The current app version.
150
+ */
151
+ appVersion: string;
152
+ };
153
+ type GetBundlesArgs = FingerprintGetBundlesArgs | AppVersionGetBundlesArgs; //#endregion
154
+ //#region src/uuid.d.ts
155
+ declare const NIL_UUID = "00000000-0000-0000-0000-000000000000";
156
+
157
+ //#endregion
158
+ export { AppUpdateInfo, AppVersionGetBundlesArgs, Bundle, BundleMetadata, FingerprintGetBundlesArgs, GetBundlesArgs, NIL_UUID, Platform, SnakeCaseBundle, UpdateInfo, UpdateStatus, UpdateStrategy };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,158 @@
1
- export * from "./types";
2
- export * from "./uuid";
1
+ //#region src/types.d.ts
2
+ type Platform = "ios" | "android";
3
+ type BundleMetadata = {
4
+ app_version?: string;
5
+ };
6
+ interface Bundle {
7
+ /**
8
+ * The unique identifier for the bundle. uuidv7
9
+ */
10
+ id: string;
11
+ /**
12
+ * The platform the bundle is for.
13
+ */
14
+ platform: Platform;
15
+ /**
16
+ * Whether the bundle should force an update.
17
+ */
18
+ shouldForceUpdate: boolean;
19
+ /**
20
+ * Whether the bundle is enabled.
21
+ */
22
+ enabled: boolean;
23
+ /**
24
+ * The hash of the bundle.
25
+ */
26
+ fileHash: string;
27
+ /**
28
+ * The storage key of the bundle.
29
+ * @example "s3://my-bucket/my-app/00000000-0000-0000-0000-000000000000/bundle.zip"
30
+ * @example "r2://my-bucket/my-app/00000000-0000-0000-0000-000000000000/bundle.zip"
31
+ * @example "firebase-storage://my-bucket/my-app/00000000-0000-0000-0000-000000000000/bundle.zip"
32
+ * @example "storage://my-app/00000000-0000-0000-0000-000000000000/bundle.zip"
33
+ */
34
+ storageUri: string;
35
+ /**
36
+ * The git commit hash of the bundle.
37
+ */
38
+ gitCommitHash: string | null;
39
+ /**
40
+ * The message of the bundle.
41
+ */
42
+ message: string | null;
43
+ /**
44
+ * The name of the channel where the bundle is deployed.
45
+ *
46
+ * Examples:
47
+ * - production: Production channel for end users
48
+ * - development: Development channel for testing
49
+ * - staging: Staging channel for quality assurance before production
50
+ * - app-name: Channel for specific app instances (e.g., my-app, app-test)
51
+ *
52
+ * Different channel values can be used based on each app's requirements.
53
+ */
54
+ channel: string;
55
+ /**
56
+ * The target app version of the bundle.
57
+ */
58
+ targetAppVersion: string | null;
59
+ /**
60
+ * The fingerprint hash of the bundle.
61
+ */
62
+ fingerprintHash: string | null;
63
+ /**
64
+ * The metadata of the bundle.
65
+ */
66
+ metadata?: BundleMetadata;
67
+ }
68
+ type SnakeCase<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Capitalize<T> ? "_" : ""}${Lowercase<T>}${SnakeCase<U>}` : S;
69
+ type SnakeKeyObject<T> = T extends Record<string, any> ? { [K in keyof T as SnakeCase<Extract<K, string>>]: T[K] extends object ? SnakeKeyObject<T[K]> : T[K] } : T;
70
+ type SnakeCaseBundle = SnakeKeyObject<Bundle>;
71
+ type UpdateStatus = "ROLLBACK" | "UPDATE";
72
+ /**
73
+ * The update info for the database layer.
74
+ * This is the update info that is used by the database.
75
+ */
76
+ interface UpdateInfo {
77
+ id: string;
78
+ shouldForceUpdate: boolean;
79
+ message: string | null;
80
+ status: UpdateStatus;
81
+ storageUri: string | null;
82
+ }
83
+ /**
84
+ * The update info for the app layer.
85
+ * This is the update info that is used by the app.
86
+ */
87
+ interface AppUpdateInfo extends UpdateInfo {
88
+ fileUrl: string | null;
89
+ }
90
+ type UpdateStrategy = "fingerprint" | "appVersion";
91
+ type FingerprintGetBundlesArgs = {
92
+ _updateStrategy: "fingerprint";
93
+ platform: Platform;
94
+ /**
95
+ * The current bundle id of the app.
96
+ */
97
+ bundleId: string;
98
+ /**
99
+ * Minimum bundle id that should be used.
100
+ * This value is generated at build time via getMinBundleId().
101
+ *
102
+ * @default "00000000-0000-0000-0000-000000000000"
103
+ */
104
+ minBundleId?: string;
105
+ /**
106
+ * The name of the channel where the bundle is deployed.
107
+ *
108
+ * @default "production"
109
+ *
110
+ * Examples:
111
+ * - production: Production channel for end users
112
+ * - development: Development channel for testing
113
+ * - staging: Staging channel for quality assurance before production
114
+ * - app-name: Channel for specific app instances (e.g., my-app, app-test)
115
+ */
116
+ channel?: string;
117
+ /**
118
+ * The fingerprint hash of the bundle.
119
+ */
120
+ fingerprintHash: string;
121
+ };
122
+ type AppVersionGetBundlesArgs = {
123
+ _updateStrategy: "appVersion";
124
+ platform: Platform;
125
+ /**
126
+ * The current bundle id of the app.
127
+ */
128
+ bundleId: string;
129
+ /**
130
+ * Minimum bundle id that should be used.
131
+ * This value is generated at build time via getMinBundleId().
132
+ *
133
+ * @default "00000000-0000-0000-0000-000000000000"
134
+ */
135
+ minBundleId?: string;
136
+ /**
137
+ * The name of the channel where the bundle is deployed.
138
+ *
139
+ * @default "production"
140
+ *
141
+ * Examples:
142
+ * - production: Production channel for end users
143
+ * - development: Development channel for testing
144
+ * - staging: Staging channel for quality assurance before production
145
+ * - app-name: Channel for specific app instances (e.g., my-app, app-test)
146
+ */
147
+ channel?: string;
148
+ /**
149
+ * The current app version.
150
+ */
151
+ appVersion: string;
152
+ };
153
+ type GetBundlesArgs = FingerprintGetBundlesArgs | AppVersionGetBundlesArgs; //#endregion
154
+ //#region src/uuid.d.ts
155
+ declare const NIL_UUID = "00000000-0000-0000-0000-000000000000";
156
+
157
+ //#endregion
158
+ export { AppUpdateInfo, AppVersionGetBundlesArgs, Bundle, BundleMetadata, FingerprintGetBundlesArgs, GetBundlesArgs, NIL_UUID, Platform, SnakeCaseBundle, UpdateInfo, UpdateStatus, UpdateStrategy };
package/dist/index.js CHANGED
@@ -1,2 +1,5 @@
1
+ //#region src/uuid.ts
1
2
  const NIL_UUID = "00000000-0000-0000-0000-000000000000";
2
- export { NIL_UUID };
3
+
4
+ //#endregion
5
+ export { NIL_UUID };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/core",
3
- "version": "0.17.0",
3
+ "version": "0.18.1",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  "@types/node": "^20.9.4"
48
48
  },
49
49
  "scripts": {
50
- "build": "rslib build",
50
+ "build": "tsdown",
51
51
  "test:type": "tsc --noEmit"
52
52
  }
53
53
  }
@@ -1,2 +0,0 @@
1
- export * from "./setupGetUpdateInfoTestSuite";
2
- export * from "./setupSemverSatisfiesTestSuite";
@@ -1,4 +0,0 @@
1
- import type { Bundle, GetBundlesArgs, UpdateInfo } from "../types";
2
- export declare const setupGetUpdateInfoTestSuite: ({ getUpdateInfo, }: {
3
- getUpdateInfo: (bundles: Bundle[], options: GetBundlesArgs) => Promise<UpdateInfo | null>;
4
- }) => void;
@@ -1,20 +0,0 @@
1
- /**
2
- *
3
- * Filters based on semver. And sorts by the highest bundle version.
4
- *
5
- * * Range Expression Table:
6
- *
7
- * | Range Expression | Who gets the update |
8
- * |------------------|------------------------------------------------------------------------|
9
- * | 1.2.3 | Only devices running the specific binary app store version 1.2.3 of your app |
10
- * | * | Any device configured to consume updates from your CodePush app |
11
- * | 1.2.x | Devices running major version 1, minor version 2 and any patch version of your app |
12
- * | 1.2.3 - 1.2.7 | Devices running any binary version between 1.2.3 (inclusive) and 1.2.7 (inclusive) |
13
- * | >=1.2.3 <1.2.7 | Devices running any binary version between 1.2.3 (inclusive) and 1.2.7 (exclusive) |
14
- * | 1.2 | Equivalent to >=1.2.0 <1.3.0 |
15
- * | ~1.2.3 | Equivalent to >=1.2.3 <1.3.0 |
16
- * | ^1.2.3 | Equivalent to >=1.2.3 <2.0.0 |
17
- */
18
- export declare const setupSemverSatisfiesTestSuite: ({ semverSatisfies, }: {
19
- semverSatisfies: (targetAppVersion: string, currentVersion: string) => Promise<boolean> | boolean;
20
- }) => void;
package/dist/types.d.ts DELETED
@@ -1,101 +0,0 @@
1
- export type Platform = "ios" | "android";
2
- export interface Bundle {
3
- /**
4
- * The unique identifier for the bundle. uuidv7
5
- */
6
- id: string;
7
- /**
8
- * The platform the bundle is for.
9
- */
10
- platform: Platform;
11
- /**
12
- * The target app version of the bundle.
13
- */
14
- targetAppVersion: string;
15
- /**
16
- * Whether the bundle should force an update.
17
- */
18
- shouldForceUpdate: boolean;
19
- /**
20
- * Whether the bundle is enabled.
21
- */
22
- enabled: boolean;
23
- /**
24
- * The hash of the bundle.
25
- */
26
- fileHash: string;
27
- /**
28
- * The git commit hash of the bundle.
29
- */
30
- gitCommitHash: string | null;
31
- /**
32
- * The message of the bundle.
33
- */
34
- message: string | null;
35
- /**
36
- * The name of the channel where the bundle is deployed.
37
- *
38
- * Examples:
39
- * - production: Production channel for end users
40
- * - development: Development channel for testing
41
- * - staging: Staging channel for quality assurance before production
42
- * - app-name: Channel for specific app instances (e.g., my-app, app-test)
43
- *
44
- * Different channel values can be used based on each app's requirements.
45
- */
46
- channel: string;
47
- }
48
- type SnakeCase<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Capitalize<T> ? "_" : ""}${Lowercase<T>}${SnakeCase<U>}` : S;
49
- type SnakeKeyObject<T> = T extends Record<string, any> ? {
50
- [K in keyof T as SnakeCase<Extract<K, string>>]: T[K] extends object ? SnakeKeyObject<T[K]> : T[K];
51
- } : T;
52
- export type SnakeCaseBundle = SnakeKeyObject<Bundle>;
53
- export type UpdateStatus = "ROLLBACK" | "UPDATE";
54
- /**
55
- * The update info for the database layer.
56
- * This is the update info that is used by the database.
57
- */
58
- export interface UpdateInfo {
59
- id: string;
60
- shouldForceUpdate: boolean;
61
- message: string | null;
62
- status: UpdateStatus;
63
- }
64
- /**
65
- * The update info for the app layer.
66
- * This is the update info that is used by the app.
67
- */
68
- export interface AppUpdateInfo extends UpdateInfo {
69
- fileUrl: string | null;
70
- }
71
- export interface GetBundlesArgs {
72
- platform: Platform;
73
- /**
74
- * The current bundle id of the app.
75
- */
76
- bundleId: string;
77
- /**
78
- * The current app version.
79
- */
80
- appVersion: string;
81
- /**
82
- * Minimum bundle id that should be used.
83
- * This value is generated at build time via getMinBundleId().
84
- *
85
- * @default "00000000-0000-0000-0000-000000000000"
86
- */
87
- minBundleId?: string;
88
- /**
89
- * The name of the channel where the bundle is deployed.
90
- *
91
- * @default "production"
92
- *
93
- * Examples:
94
- * - production: Production channel for end users
95
- * - development: Development channel for testing
96
- * - staging: Staging channel for quality assurance before production
97
- * - app-name: Channel for specific app instances (e.g., my-app, app-test)
98
- */
99
- channel?: string;
100
- }
101
- export {};
package/dist/uuid.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const NIL_UUID = "00000000-0000-0000-0000-000000000000";