@hot-updater/plugin-core 0.22.1 → 0.23.0

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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.cjs";
2
- import { BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, Platform, PlatformConfig, StoragePlugin, StoragePluginHooks } from "./types/index.cjs";
2
+ import { BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, Platform, PlatformConfig, SigningConfig, StoragePlugin, StoragePluginHooks } from "./types/index.cjs";
3
3
  import { PaginatedResult, PaginationOptions, calculatePagination } from "./calculatePagination.cjs";
4
4
  import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.cjs";
5
5
  import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.cjs";
@@ -10,4 +10,4 @@ import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.cjs";
10
10
  import { generateMinBundleId } from "./generateMinBundleId.cjs";
11
11
  import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.cjs";
12
12
  import { semverSatisfies } from "./semverSatisfies.cjs";
13
- export { AbstractDatabasePlugin, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, NativeBuildArgs, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequiredDeep, StoragePlugin, StoragePluginHooks, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies };
13
+ export { AbstractDatabasePlugin, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, NativeBuildArgs, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.js";
2
- import { BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, Platform, PlatformConfig, StoragePlugin, StoragePluginHooks } from "./types/index.js";
2
+ import { BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, Platform, PlatformConfig, SigningConfig, StoragePlugin, StoragePluginHooks } from "./types/index.js";
3
3
  import { PaginatedResult, PaginationOptions, calculatePagination } from "./calculatePagination.js";
4
4
  import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.js";
5
5
  import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.js";
@@ -10,4 +10,4 @@ import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.js";
10
10
  import { generateMinBundleId } from "./generateMinBundleId.js";
11
11
  import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.js";
12
12
  import { semverSatisfies } from "./semverSatisfies.js";
13
- export { AbstractDatabasePlugin, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, NativeBuildArgs, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequiredDeep, StoragePlugin, StoragePluginHooks, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies };
13
+ export { AbstractDatabasePlugin, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, NativeBuildArgs, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies };
@@ -130,6 +130,40 @@ interface StoragePlugin {
130
130
  interface StoragePluginHooks {
131
131
  onStorageUploaded?: () => Promise<void>;
132
132
  }
133
+ /**
134
+ * Signing configuration type with conditional required fields.
135
+ * When enabled is true, privateKeyPath is required.
136
+ * When enabled is false, privateKeyPath is optional.
137
+ */
138
+ type SigningConfig = {
139
+ /**
140
+ * Enable bundle signing during deployment.
141
+ * When false, signing is disabled and privateKeyPath is optional.
142
+ */
143
+ enabled: false;
144
+ /**
145
+ * Path to RSA private key file in PEM format (PKCS#8).
146
+ * Optional when signing is disabled.
147
+ */
148
+ privateKeyPath?: string;
149
+ } | {
150
+ /**
151
+ * Enable bundle signing during deployment.
152
+ * When true, bundles will be signed with privateKeyPath.
153
+ */
154
+ enabled: true;
155
+ /**
156
+ * Path to RSA private key file in PEM format (PKCS#8).
157
+ * Generate with: npx hot-updater keys:generate
158
+ *
159
+ * Security: Never commit this key to version control!
160
+ * Use secure storage (AWS Secrets Manager, etc.) for CI/CD.
161
+ *
162
+ * @example "./keys/private-key.pem"
163
+ * @example "/secure/path/to/private-key.pem"
164
+ */
165
+ privateKeyPath: string;
166
+ };
133
167
  type ConfigInput = {
134
168
  /**
135
169
  * The channel used when building the native app.
@@ -193,9 +227,30 @@ type ConfigInput = {
193
227
  };
194
228
  platform?: PlatformConfig;
195
229
  nativeBuild?: NativeBuildArgs;
230
+ /**
231
+ * Code signing configuration for bundle verification.
232
+ * Enables RSA-SHA256 cryptographic signatures for bundle integrity.
233
+ *
234
+ * @optional Feature is opt-in for backward compatibility
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * // Signing enabled - privateKeyPath is required
239
+ * signing: {
240
+ * enabled: true,
241
+ * privateKeyPath: './keys/private-key.pem'
242
+ * }
243
+ *
244
+ * // Signing disabled - privateKeyPath is optional
245
+ * signing: {
246
+ * enabled: false
247
+ * }
248
+ * ```
249
+ */
250
+ signing?: SigningConfig;
196
251
  build: (args: BasePluginArgs) => Promise<BuildPlugin> | BuildPlugin;
197
252
  storage: () => Promise<StoragePlugin> | StoragePlugin;
198
253
  database: () => Promise<DatabasePlugin> | DatabasePlugin;
199
254
  };
200
255
  //#endregion
201
- export { BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, type Platform$1 as Platform, PlatformConfig, StoragePlugin, StoragePluginHooks };
256
+ export { BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, type Platform$1 as Platform, PlatformConfig, SigningConfig, StoragePlugin, StoragePluginHooks };
@@ -130,6 +130,40 @@ interface StoragePlugin {
130
130
  interface StoragePluginHooks {
131
131
  onStorageUploaded?: () => Promise<void>;
132
132
  }
133
+ /**
134
+ * Signing configuration type with conditional required fields.
135
+ * When enabled is true, privateKeyPath is required.
136
+ * When enabled is false, privateKeyPath is optional.
137
+ */
138
+ type SigningConfig = {
139
+ /**
140
+ * Enable bundle signing during deployment.
141
+ * When false, signing is disabled and privateKeyPath is optional.
142
+ */
143
+ enabled: false;
144
+ /**
145
+ * Path to RSA private key file in PEM format (PKCS#8).
146
+ * Optional when signing is disabled.
147
+ */
148
+ privateKeyPath?: string;
149
+ } | {
150
+ /**
151
+ * Enable bundle signing during deployment.
152
+ * When true, bundles will be signed with privateKeyPath.
153
+ */
154
+ enabled: true;
155
+ /**
156
+ * Path to RSA private key file in PEM format (PKCS#8).
157
+ * Generate with: npx hot-updater keys:generate
158
+ *
159
+ * Security: Never commit this key to version control!
160
+ * Use secure storage (AWS Secrets Manager, etc.) for CI/CD.
161
+ *
162
+ * @example "./keys/private-key.pem"
163
+ * @example "/secure/path/to/private-key.pem"
164
+ */
165
+ privateKeyPath: string;
166
+ };
133
167
  type ConfigInput = {
134
168
  /**
135
169
  * The channel used when building the native app.
@@ -193,9 +227,30 @@ type ConfigInput = {
193
227
  };
194
228
  platform?: PlatformConfig;
195
229
  nativeBuild?: NativeBuildArgs;
230
+ /**
231
+ * Code signing configuration for bundle verification.
232
+ * Enables RSA-SHA256 cryptographic signatures for bundle integrity.
233
+ *
234
+ * @optional Feature is opt-in for backward compatibility
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * // Signing enabled - privateKeyPath is required
239
+ * signing: {
240
+ * enabled: true,
241
+ * privateKeyPath: './keys/private-key.pem'
242
+ * }
243
+ *
244
+ * // Signing disabled - privateKeyPath is optional
245
+ * signing: {
246
+ * enabled: false
247
+ * }
248
+ * ```
249
+ */
250
+ signing?: SigningConfig;
196
251
  build: (args: BasePluginArgs) => Promise<BuildPlugin> | BuildPlugin;
197
252
  storage: () => Promise<StoragePlugin> | StoragePlugin;
198
253
  database: () => Promise<DatabasePlugin> | DatabasePlugin;
199
254
  };
200
255
  //#endregion
201
- export { BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, type Platform$1 as Platform, PlatformConfig, StoragePlugin, StoragePluginHooks };
256
+ export { BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, type Platform$1 as Platform, PlatformConfig, SigningConfig, StoragePlugin, StoragePluginHooks };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.22.1",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -42,12 +42,12 @@
42
42
  "es-toolkit": "^1.32.0",
43
43
  "mime": "^4.0.4",
44
44
  "semver": "^7.7.2",
45
- "@hot-updater/core": "0.22.1"
45
+ "@hot-updater/core": "0.23.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/semver": "^7.5.8",
49
49
  "typescript": "5.8.2",
50
- "@hot-updater/test-utils": "0.22.1"
50
+ "@hot-updater/test-utils": "0.23.0"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsdown",