@hot-updater/plugin-core 0.17.0 → 0.18.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.
@@ -0,0 +1,329 @@
1
+ import { Bundle, Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/core";
2
+
3
+ //#region src/log.d.ts
4
+ declare const log: {
5
+ normal: (message: string | number | null | undefined) => void;
6
+ success: (message: string | number | null | undefined) => void;
7
+ info: (message: string | number | null | undefined) => void;
8
+ error: (message: string | number | null | undefined) => void;
9
+ warn: (message: string | number | null | undefined) => void;
10
+ debug: (message: string | number | null | undefined) => void;
11
+ }; //#endregion
12
+ //#region src/cwd.d.ts
13
+ declare const getCwd: () => string;
14
+
15
+ //#endregion
16
+ //#region src/types/index.d.ts
17
+ interface BasePluginArgs {
18
+ cwd: string;
19
+ }
20
+ interface BuildPluginConfig {
21
+ outDir?: string;
22
+ }
23
+ interface DatabasePlugin {
24
+ getChannels: () => Promise<string[]>;
25
+ getBundleById: (bundleId: string) => Promise<Bundle$1 | null>;
26
+ getBundles: (options?: {
27
+ where?: {
28
+ channel?: string;
29
+ platform?: Platform$1;
30
+ };
31
+ limit?: number;
32
+ offset?: number;
33
+ }) => Promise<Bundle$1[]>;
34
+ updateBundle: (targetBundleId: string, newBundle: Partial<Bundle$1>) => Promise<void>;
35
+ appendBundle: (bundles: Bundle$1) => Promise<void>;
36
+ commitBundle: () => Promise<void>;
37
+ onUnmount?: () => Promise<void>;
38
+ name: string;
39
+ }
40
+ interface DatabasePluginHooks {
41
+ onDatabaseUpdated?: () => Promise<void>;
42
+ }
43
+ interface BuildPlugin {
44
+ build: (args: {
45
+ platform: Platform$1;
46
+ channel: string;
47
+ }) => Promise<{
48
+ buildPath: string;
49
+ bundleId: string;
50
+ channel: string;
51
+ stdout: string | null;
52
+ }>;
53
+ name: string;
54
+ }
55
+ interface StoragePlugin {
56
+ uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
57
+ storageUri: string;
58
+ }>;
59
+ deleteBundle: (bundleId: string) => Promise<string>;
60
+ name: string;
61
+ }
62
+ interface StoragePluginHooks {
63
+ onStorageUploaded?: () => Promise<void>;
64
+ }
65
+ type ConfigInput = {
66
+ /**
67
+ * The channel used when building the native app.
68
+ * Used to replace __HOT_UPDATER_CHANNEL at build time.
69
+ *
70
+ * @deprecated Use the `hot-updater channel create` command to create a channel.
71
+ */
72
+ releaseChannel?: string;
73
+ /**
74
+ * The strategy used to update the app.
75
+ *
76
+ * If `fingerprint`, the bundle will be updated if the fingerprint of the app is changed.
77
+ * If `app-version`, the bundle will be updated if the target app version is valid.
78
+ *
79
+ * @default "fingerprint"
80
+ */
81
+ updateStrategy?: "fingerprint" | "appVersion";
82
+ /**
83
+ * The fingerprint configuration.
84
+ */
85
+ fingerprint?: {
86
+ extraSources?: string[];
87
+ ignorePaths?: string[];
88
+ };
89
+ console?: {
90
+ /**
91
+ * Git repository URL
92
+ * If git commit hash exists in console, it allows viewing commit history from the git repository
93
+ */
94
+ gitUrl?: string;
95
+ /**
96
+ * Console port
97
+ * @default 1422
98
+ */
99
+ port?: number;
100
+ };
101
+ build: (args: BasePluginArgs) => Promise<BuildPlugin> | BuildPlugin;
102
+ storage: (args: BasePluginArgs) => Promise<StoragePlugin> | StoragePlugin;
103
+ database: (args: BasePluginArgs) => Promise<DatabasePlugin> | DatabasePlugin;
104
+ }; //#endregion
105
+ //#region src/types/utils.d.ts
106
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
107
+ type BuiltIns = Primitive | void | Date | RegExp;
108
+ type ExcludeUndefined<T> = Exclude<T, undefined>;
109
+ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
110
+ (...arguments_: infer A): unknown;
111
+ (...arguments_: infer B): unknown;
112
+ } ? B extends A ? A extends B ? false : true : true : false;
113
+ type RequiredDeep<T, E extends ExcludeUndefined<T> = ExcludeUndefined<T>> = E extends BuiltIns ? E : E extends Map<infer KeyType, infer ValueType> ? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends Set<infer ItemType> ? Set<RequiredDeep<ItemType>> : E extends ReadonlyMap<infer KeyType, infer ValueType> ? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends ReadonlySet<infer ItemType> ? ReadonlySet<RequiredDeep<ItemType>> : E extends WeakMap<infer KeyType, infer ValueType> ? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends WeakSet<infer ItemType> ? WeakSet<RequiredDeep<ItemType>> : E extends Promise<infer ValueType> ? Promise<RequiredDeep<ValueType>> : E extends ((...arguments_: any[]) => unknown) ? {} extends RequiredObjectDeep<E> ? E : HasMultipleCallSignatures<E> extends true ? E : ((...arguments_: Parameters<E>) => ReturnType<E>) & RequiredObjectDeep<E> : E extends object ? E extends Array<infer ItemType> ? ItemType[] extends E ? Array<RequiredDeep<ItemType>> : RequiredObjectDeep<E> : RequiredObjectDeep<E> : unknown;
114
+ type RequiredObjectDeep<ObjectType extends object> = { [KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]> };
115
+
116
+ //#endregion
117
+ //#region src/loadConfig.d.ts
118
+ type HotUpdaterConfigOptions = {
119
+ platform: Platform;
120
+ channel: string;
121
+ } | null;
122
+ type ConfigResponse = RequiredDeep<ConfigInput>;
123
+ declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
124
+ declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
125
+
126
+ //#endregion
127
+ //#region src/copyDirToTmp.d.ts
128
+ declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
129
+ tmpDir: string;
130
+ removeTmpDir: () => Promise<void>;
131
+ }>;
132
+
133
+ //#endregion
134
+ //#region src/createDatabasePlugin.d.ts
135
+ interface BaseDatabaseUtils {
136
+ cwd: string;
137
+ }
138
+ interface AbstractDatabasePlugin<TContext = object> {
139
+ getContext?: () => TContext;
140
+ getBundleById: (context: TContext, bundleId: string) => Promise<Bundle$1 | null>;
141
+ getBundles: (context: TContext, options?: {
142
+ where?: {
143
+ channel?: string;
144
+ platform?: string;
145
+ };
146
+ limit?: number;
147
+ offset?: number;
148
+ }) => Promise<Bundle$1[]>;
149
+ getChannels: (context: TContext) => Promise<string[]>;
150
+ onUnmount?: (context: TContext) => void;
151
+ commitBundle: (context: TContext, {
152
+ changedSets
153
+ }: {
154
+ changedSets: {
155
+ operation: "insert" | "update" | "delete";
156
+ data: Bundle$1;
157
+ }[];
158
+ }) => Promise<void>;
159
+ }
160
+ /**
161
+ * Creates a database plugin with the given implementation.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * const myDatabasePlugin = createDatabasePlugin("myDatabase", {
166
+ * getContext: () => ({
167
+ * // Your database client or connection
168
+ * dbClient: createDbClient()
169
+ * }),
170
+ * async getBundleById(context, bundleId) {
171
+ * // Implementation to get a bundle by ID using context.dbClient
172
+ * return bundle;
173
+ * },
174
+ * async getBundles(context, options) {
175
+ * // Implementation to get bundles with options using context.dbClient
176
+ * return bundles;
177
+ * },
178
+ * async getChannels(context) {
179
+ * // Implementation to get available channels using context.dbClient
180
+ * return channels;
181
+ * },
182
+ * async commitBundle(context, { changedSets }) {
183
+ * // Implementation to commit changed bundles using context.dbClient
184
+ * }
185
+ * });
186
+ * ```
187
+ *
188
+ * @param name - The name of the database plugin
189
+ * @param abstractPlugin - A plugin implementation with context support
190
+ * @param hooks - Optional hooks for plugin lifecycle events
191
+ * @returns A function that creates a database plugin instance
192
+ */
193
+ declare function createDatabasePlugin<TContext = object>(name: string, abstractPlugin: AbstractDatabasePlugin<TContext>, hooks?: DatabasePluginHooks): (options: BasePluginArgs) => DatabasePlugin;
194
+
195
+ //#endregion
196
+ //#region src/banner.d.ts
197
+ declare const link: (url: string) => string;
198
+ declare const banner: (version?: string) => string;
199
+ declare const printBanner: (version?: string) => void;
200
+
201
+ //#endregion
202
+ //#region src/transformTemplate.d.ts
203
+ type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
204
+ type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
205
+ /**
206
+ * Replaces placeholders in the format %%key%% in a template string with values from the values object.
207
+ * Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
208
+ *
209
+ * @example
210
+ * const str = "Hello %%name%%, you are %%age%% years old."
211
+ * const result = transformTemplate(str, { name: "John", age: "20" })
212
+ * // Result: "Hello John, you are 20 years old."
213
+ */
214
+ declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
215
+
216
+ //#endregion
217
+ //#region src/transformEnv.d.ts
218
+ declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
219
+
220
+ //#endregion
221
+ //#region src/makeEnv.d.ts
222
+ type EnvVarValue = string | {
223
+ comment: string;
224
+ value: string;
225
+ };
226
+ declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
227
+
228
+ //#endregion
229
+ //#region src/createZip.d.ts
230
+ declare const createZipTargetFiles: ({
231
+ outfile,
232
+ targetFiles
233
+ }: {
234
+ targetFiles: {
235
+ path: string;
236
+ name: string;
237
+ }[];
238
+ outfile: string;
239
+ }) => Promise<string>;
240
+ declare const createZip: ({
241
+ outfile,
242
+ targetDir,
243
+ excludeExts
244
+ }: {
245
+ targetDir: string;
246
+ outfile: string;
247
+ excludeExts?: string[];
248
+ }) => Promise<string>;
249
+
250
+ //#endregion
251
+ //#region src/createBlobDatabasePlugin.d.ts
252
+ /**
253
+ *
254
+ * @param name - The name of the database plugin
255
+ * @param listObjects - Function to list objects in the storage
256
+ * @param loadObject - Function to load an JSON object from the storage
257
+ * @param uploadObject - Function to upload an JSON object to the storage
258
+ * @param deleteObject - Function to delete an object from the storage
259
+ * @param invalidatePaths - Function to invalidate paths in the CDN
260
+ * @param hooks - Optional hooks for additional functionality - see createDatabasePlugin
261
+ * @returns
262
+ */
263
+ declare const createBlobDatabasePlugin: <TContext = object>({
264
+ name,
265
+ getContext,
266
+ listObjects,
267
+ loadObject,
268
+ uploadObject,
269
+ deleteObject,
270
+ invalidatePaths,
271
+ hooks,
272
+ apiBasePath
273
+ }: {
274
+ name: string;
275
+ getContext: () => TContext;
276
+ listObjects: (context: TContext, prefix: string) => Promise<string[]>;
277
+ loadObject: <T>(context: TContext, key: string) => Promise<T | null>;
278
+ uploadObject: <T>(context: TContext, key: string, data: T) => Promise<void>;
279
+ deleteObject: (context: TContext, key: string) => Promise<void>;
280
+ invalidatePaths: (context: TContext, paths: string[]) => Promise<void>;
281
+ hooks?: DatabasePluginHooks;
282
+ apiBasePath: string;
283
+ }) => (options: BasePluginArgs) => DatabasePlugin;
284
+
285
+ //#endregion
286
+ //#region src/ConfigBuilder.d.ts
287
+ type BuildType = "bare" | "rnef" | "expo";
288
+ type ImportInfo = {
289
+ pkg: string;
290
+ named?: string[];
291
+ defaultOrNamespace?: string;
292
+ sideEffect?: boolean;
293
+ };
294
+ type ProviderConfig = {
295
+ imports: ImportInfo[];
296
+ configString: string;
297
+ };
298
+ interface IConfigBuilder {
299
+ /** Sets the build type ('bare' or 'rnef' or 'expo') and adds necessary build imports. */
300
+ setBuildType(buildType: BuildType): this;
301
+ /** Sets the storage configuration and adds its required imports. */
302
+ setStorage(storageConfig: ProviderConfig): this;
303
+ /** Sets the database configuration and adds its required imports. */
304
+ setDatabase(databaseConfig: ProviderConfig): this;
305
+ /** Sets the intermediate code block to be placed between imports and defineConfig. */
306
+ setIntermediateCode(code: string): this;
307
+ /** Assembles and returns the final configuration string. */
308
+ getResult(): string;
309
+ }
310
+ declare class ConfigBuilder implements IConfigBuilder {
311
+ private buildType;
312
+ private storageInfo;
313
+ private databaseInfo;
314
+ private intermediateCode;
315
+ private collectedImports;
316
+ constructor();
317
+ addImport(info: ImportInfo): this;
318
+ private addImports;
319
+ private generateImportStatements;
320
+ private generateBuildConfigString;
321
+ setBuildType(buildType: BuildType): this;
322
+ setStorage(storageConfig: ProviderConfig): this;
323
+ setDatabase(databaseConfig: ProviderConfig): this;
324
+ setIntermediateCode(code: string): this;
325
+ getResult(): string;
326
+ }
327
+
328
+ //#endregion
329
+ export { AbstractDatabasePlugin, BaseDatabaseUtils, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuildType, Bundle, ConfigBuilder, ConfigInput, ConfigResponse, DatabasePlugin, DatabasePluginHooks, HotUpdaterConfigOptions, IConfigBuilder, ImportInfo, Platform, ProviderConfig, StoragePlugin, StoragePluginHooks, banner, copyDirToTmp, createBlobDatabasePlugin, createDatabasePlugin, createZip, createZipTargetFiles, getCwd, link, loadConfig, loadConfigSync, log, makeEnv, printBanner, transformEnv, transformTemplate };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,329 @@
1
- export * from "./log";
2
- export * from "./cwd";
3
- export * from "./loadConfig";
4
- export * from "./types";
5
- export * from "./copyDirToTmp";
6
- export * from "./createDatabasePlugin";
7
- export * from "./banner";
8
- export * from "./transformTemplate";
9
- export * from "./transformEnv";
10
- export * from "./transformTsEnv";
11
- export * from "./makeEnv";
12
- export * from "./createZip";
13
- export * from "./createBlobDatabasePlugin";
14
- export * from "./ConfigBuilder";
1
+ import { Bundle, Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/core";
2
+
3
+ //#region src/log.d.ts
4
+ declare const log: {
5
+ normal: (message: string | number | null | undefined) => void;
6
+ success: (message: string | number | null | undefined) => void;
7
+ info: (message: string | number | null | undefined) => void;
8
+ error: (message: string | number | null | undefined) => void;
9
+ warn: (message: string | number | null | undefined) => void;
10
+ debug: (message: string | number | null | undefined) => void;
11
+ }; //#endregion
12
+ //#region src/cwd.d.ts
13
+ declare const getCwd: () => string;
14
+
15
+ //#endregion
16
+ //#region src/types/index.d.ts
17
+ interface BasePluginArgs {
18
+ cwd: string;
19
+ }
20
+ interface BuildPluginConfig {
21
+ outDir?: string;
22
+ }
23
+ interface DatabasePlugin {
24
+ getChannels: () => Promise<string[]>;
25
+ getBundleById: (bundleId: string) => Promise<Bundle$1 | null>;
26
+ getBundles: (options?: {
27
+ where?: {
28
+ channel?: string;
29
+ platform?: Platform$1;
30
+ };
31
+ limit?: number;
32
+ offset?: number;
33
+ }) => Promise<Bundle$1[]>;
34
+ updateBundle: (targetBundleId: string, newBundle: Partial<Bundle$1>) => Promise<void>;
35
+ appendBundle: (bundles: Bundle$1) => Promise<void>;
36
+ commitBundle: () => Promise<void>;
37
+ onUnmount?: () => Promise<void>;
38
+ name: string;
39
+ }
40
+ interface DatabasePluginHooks {
41
+ onDatabaseUpdated?: () => Promise<void>;
42
+ }
43
+ interface BuildPlugin {
44
+ build: (args: {
45
+ platform: Platform$1;
46
+ channel: string;
47
+ }) => Promise<{
48
+ buildPath: string;
49
+ bundleId: string;
50
+ channel: string;
51
+ stdout: string | null;
52
+ }>;
53
+ name: string;
54
+ }
55
+ interface StoragePlugin {
56
+ uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
57
+ storageUri: string;
58
+ }>;
59
+ deleteBundle: (bundleId: string) => Promise<string>;
60
+ name: string;
61
+ }
62
+ interface StoragePluginHooks {
63
+ onStorageUploaded?: () => Promise<void>;
64
+ }
65
+ type ConfigInput = {
66
+ /**
67
+ * The channel used when building the native app.
68
+ * Used to replace __HOT_UPDATER_CHANNEL at build time.
69
+ *
70
+ * @deprecated Use the `hot-updater channel create` command to create a channel.
71
+ */
72
+ releaseChannel?: string;
73
+ /**
74
+ * The strategy used to update the app.
75
+ *
76
+ * If `fingerprint`, the bundle will be updated if the fingerprint of the app is changed.
77
+ * If `app-version`, the bundle will be updated if the target app version is valid.
78
+ *
79
+ * @default "fingerprint"
80
+ */
81
+ updateStrategy?: "fingerprint" | "appVersion";
82
+ /**
83
+ * The fingerprint configuration.
84
+ */
85
+ fingerprint?: {
86
+ extraSources?: string[];
87
+ ignorePaths?: string[];
88
+ };
89
+ console?: {
90
+ /**
91
+ * Git repository URL
92
+ * If git commit hash exists in console, it allows viewing commit history from the git repository
93
+ */
94
+ gitUrl?: string;
95
+ /**
96
+ * Console port
97
+ * @default 1422
98
+ */
99
+ port?: number;
100
+ };
101
+ build: (args: BasePluginArgs) => Promise<BuildPlugin> | BuildPlugin;
102
+ storage: (args: BasePluginArgs) => Promise<StoragePlugin> | StoragePlugin;
103
+ database: (args: BasePluginArgs) => Promise<DatabasePlugin> | DatabasePlugin;
104
+ }; //#endregion
105
+ //#region src/types/utils.d.ts
106
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
107
+ type BuiltIns = Primitive | void | Date | RegExp;
108
+ type ExcludeUndefined<T> = Exclude<T, undefined>;
109
+ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
110
+ (...arguments_: infer A): unknown;
111
+ (...arguments_: infer B): unknown;
112
+ } ? B extends A ? A extends B ? false : true : true : false;
113
+ type RequiredDeep<T, E extends ExcludeUndefined<T> = ExcludeUndefined<T>> = E extends BuiltIns ? E : E extends Map<infer KeyType, infer ValueType> ? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends Set<infer ItemType> ? Set<RequiredDeep<ItemType>> : E extends ReadonlyMap<infer KeyType, infer ValueType> ? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends ReadonlySet<infer ItemType> ? ReadonlySet<RequiredDeep<ItemType>> : E extends WeakMap<infer KeyType, infer ValueType> ? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends WeakSet<infer ItemType> ? WeakSet<RequiredDeep<ItemType>> : E extends Promise<infer ValueType> ? Promise<RequiredDeep<ValueType>> : E extends ((...arguments_: any[]) => unknown) ? {} extends RequiredObjectDeep<E> ? E : HasMultipleCallSignatures<E> extends true ? E : ((...arguments_: Parameters<E>) => ReturnType<E>) & RequiredObjectDeep<E> : E extends object ? E extends Array<infer ItemType> ? ItemType[] extends E ? Array<RequiredDeep<ItemType>> : RequiredObjectDeep<E> : RequiredObjectDeep<E> : unknown;
114
+ type RequiredObjectDeep<ObjectType extends object> = { [KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]> };
115
+
116
+ //#endregion
117
+ //#region src/loadConfig.d.ts
118
+ type HotUpdaterConfigOptions = {
119
+ platform: Platform;
120
+ channel: string;
121
+ } | null;
122
+ type ConfigResponse = RequiredDeep<ConfigInput>;
123
+ declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
124
+ declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
125
+
126
+ //#endregion
127
+ //#region src/copyDirToTmp.d.ts
128
+ declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
129
+ tmpDir: string;
130
+ removeTmpDir: () => Promise<void>;
131
+ }>;
132
+
133
+ //#endregion
134
+ //#region src/createDatabasePlugin.d.ts
135
+ interface BaseDatabaseUtils {
136
+ cwd: string;
137
+ }
138
+ interface AbstractDatabasePlugin<TContext = object> {
139
+ getContext?: () => TContext;
140
+ getBundleById: (context: TContext, bundleId: string) => Promise<Bundle$1 | null>;
141
+ getBundles: (context: TContext, options?: {
142
+ where?: {
143
+ channel?: string;
144
+ platform?: string;
145
+ };
146
+ limit?: number;
147
+ offset?: number;
148
+ }) => Promise<Bundle$1[]>;
149
+ getChannels: (context: TContext) => Promise<string[]>;
150
+ onUnmount?: (context: TContext) => void;
151
+ commitBundle: (context: TContext, {
152
+ changedSets
153
+ }: {
154
+ changedSets: {
155
+ operation: "insert" | "update" | "delete";
156
+ data: Bundle$1;
157
+ }[];
158
+ }) => Promise<void>;
159
+ }
160
+ /**
161
+ * Creates a database plugin with the given implementation.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * const myDatabasePlugin = createDatabasePlugin("myDatabase", {
166
+ * getContext: () => ({
167
+ * // Your database client or connection
168
+ * dbClient: createDbClient()
169
+ * }),
170
+ * async getBundleById(context, bundleId) {
171
+ * // Implementation to get a bundle by ID using context.dbClient
172
+ * return bundle;
173
+ * },
174
+ * async getBundles(context, options) {
175
+ * // Implementation to get bundles with options using context.dbClient
176
+ * return bundles;
177
+ * },
178
+ * async getChannels(context) {
179
+ * // Implementation to get available channels using context.dbClient
180
+ * return channels;
181
+ * },
182
+ * async commitBundle(context, { changedSets }) {
183
+ * // Implementation to commit changed bundles using context.dbClient
184
+ * }
185
+ * });
186
+ * ```
187
+ *
188
+ * @param name - The name of the database plugin
189
+ * @param abstractPlugin - A plugin implementation with context support
190
+ * @param hooks - Optional hooks for plugin lifecycle events
191
+ * @returns A function that creates a database plugin instance
192
+ */
193
+ declare function createDatabasePlugin<TContext = object>(name: string, abstractPlugin: AbstractDatabasePlugin<TContext>, hooks?: DatabasePluginHooks): (options: BasePluginArgs) => DatabasePlugin;
194
+
195
+ //#endregion
196
+ //#region src/banner.d.ts
197
+ declare const link: (url: string) => string;
198
+ declare const banner: (version?: string) => string;
199
+ declare const printBanner: (version?: string) => void;
200
+
201
+ //#endregion
202
+ //#region src/transformTemplate.d.ts
203
+ type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
204
+ type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
205
+ /**
206
+ * Replaces placeholders in the format %%key%% in a template string with values from the values object.
207
+ * Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
208
+ *
209
+ * @example
210
+ * const str = "Hello %%name%%, you are %%age%% years old."
211
+ * const result = transformTemplate(str, { name: "John", age: "20" })
212
+ * // Result: "Hello John, you are 20 years old."
213
+ */
214
+ declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
215
+
216
+ //#endregion
217
+ //#region src/transformEnv.d.ts
218
+ declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
219
+
220
+ //#endregion
221
+ //#region src/makeEnv.d.ts
222
+ type EnvVarValue = string | {
223
+ comment: string;
224
+ value: string;
225
+ };
226
+ declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
227
+
228
+ //#endregion
229
+ //#region src/createZip.d.ts
230
+ declare const createZipTargetFiles: ({
231
+ outfile,
232
+ targetFiles
233
+ }: {
234
+ targetFiles: {
235
+ path: string;
236
+ name: string;
237
+ }[];
238
+ outfile: string;
239
+ }) => Promise<string>;
240
+ declare const createZip: ({
241
+ outfile,
242
+ targetDir,
243
+ excludeExts
244
+ }: {
245
+ targetDir: string;
246
+ outfile: string;
247
+ excludeExts?: string[];
248
+ }) => Promise<string>;
249
+
250
+ //#endregion
251
+ //#region src/createBlobDatabasePlugin.d.ts
252
+ /**
253
+ *
254
+ * @param name - The name of the database plugin
255
+ * @param listObjects - Function to list objects in the storage
256
+ * @param loadObject - Function to load an JSON object from the storage
257
+ * @param uploadObject - Function to upload an JSON object to the storage
258
+ * @param deleteObject - Function to delete an object from the storage
259
+ * @param invalidatePaths - Function to invalidate paths in the CDN
260
+ * @param hooks - Optional hooks for additional functionality - see createDatabasePlugin
261
+ * @returns
262
+ */
263
+ declare const createBlobDatabasePlugin: <TContext = object>({
264
+ name,
265
+ getContext,
266
+ listObjects,
267
+ loadObject,
268
+ uploadObject,
269
+ deleteObject,
270
+ invalidatePaths,
271
+ hooks,
272
+ apiBasePath
273
+ }: {
274
+ name: string;
275
+ getContext: () => TContext;
276
+ listObjects: (context: TContext, prefix: string) => Promise<string[]>;
277
+ loadObject: <T>(context: TContext, key: string) => Promise<T | null>;
278
+ uploadObject: <T>(context: TContext, key: string, data: T) => Promise<void>;
279
+ deleteObject: (context: TContext, key: string) => Promise<void>;
280
+ invalidatePaths: (context: TContext, paths: string[]) => Promise<void>;
281
+ hooks?: DatabasePluginHooks;
282
+ apiBasePath: string;
283
+ }) => (options: BasePluginArgs) => DatabasePlugin;
284
+
285
+ //#endregion
286
+ //#region src/ConfigBuilder.d.ts
287
+ type BuildType = "bare" | "rnef" | "expo";
288
+ type ImportInfo = {
289
+ pkg: string;
290
+ named?: string[];
291
+ defaultOrNamespace?: string;
292
+ sideEffect?: boolean;
293
+ };
294
+ type ProviderConfig = {
295
+ imports: ImportInfo[];
296
+ configString: string;
297
+ };
298
+ interface IConfigBuilder {
299
+ /** Sets the build type ('bare' or 'rnef' or 'expo') and adds necessary build imports. */
300
+ setBuildType(buildType: BuildType): this;
301
+ /** Sets the storage configuration and adds its required imports. */
302
+ setStorage(storageConfig: ProviderConfig): this;
303
+ /** Sets the database configuration and adds its required imports. */
304
+ setDatabase(databaseConfig: ProviderConfig): this;
305
+ /** Sets the intermediate code block to be placed between imports and defineConfig. */
306
+ setIntermediateCode(code: string): this;
307
+ /** Assembles and returns the final configuration string. */
308
+ getResult(): string;
309
+ }
310
+ declare class ConfigBuilder implements IConfigBuilder {
311
+ private buildType;
312
+ private storageInfo;
313
+ private databaseInfo;
314
+ private intermediateCode;
315
+ private collectedImports;
316
+ constructor();
317
+ addImport(info: ImportInfo): this;
318
+ private addImports;
319
+ private generateImportStatements;
320
+ private generateBuildConfigString;
321
+ setBuildType(buildType: BuildType): this;
322
+ setStorage(storageConfig: ProviderConfig): this;
323
+ setDatabase(databaseConfig: ProviderConfig): this;
324
+ setIntermediateCode(code: string): this;
325
+ getResult(): string;
326
+ }
327
+
328
+ //#endregion
329
+ export { AbstractDatabasePlugin, BaseDatabaseUtils, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuildType, Bundle, ConfigBuilder, ConfigInput, ConfigResponse, DatabasePlugin, DatabasePluginHooks, HotUpdaterConfigOptions, IConfigBuilder, ImportInfo, Platform, ProviderConfig, StoragePlugin, StoragePluginHooks, banner, copyDirToTmp, createBlobDatabasePlugin, createDatabasePlugin, createZip, createZipTargetFiles, getCwd, link, loadConfig, loadConfigSync, log, makeEnv, printBanner, transformEnv, transformTemplate };