@hot-updater/plugin-core 0.28.0 → 0.29.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/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +2 -4
- package/dist/calculatePagination.cjs +1 -3
- package/dist/{calculatePagination.d.ts → calculatePagination.d.mts} +1 -1
- package/dist/{calculatePagination.js → calculatePagination.mjs} +1 -2
- package/dist/compressionFormat.cjs +6 -8
- package/dist/{compressionFormat.js → compressionFormat.mjs} +2 -4
- package/dist/createBlobDatabasePlugin.cjs +31 -34
- package/dist/createBlobDatabasePlugin.d.cts +1 -1
- package/dist/{createBlobDatabasePlugin.d.ts → createBlobDatabasePlugin.d.mts} +2 -2
- package/dist/{createBlobDatabasePlugin.js → createBlobDatabasePlugin.mjs} +29 -31
- package/dist/createDatabasePlugin.cjs +26 -17
- package/dist/createDatabasePlugin.d.cts +11 -18
- package/dist/{createDatabasePlugin.d.ts → createDatabasePlugin.d.mts} +11 -18
- package/dist/{createDatabasePlugin.js → createDatabasePlugin.mjs} +26 -16
- package/dist/createStorageKeyBuilder.cjs +1 -3
- package/dist/{createStorageKeyBuilder.js → createStorageKeyBuilder.mjs} +1 -2
- package/dist/createStoragePlugin.cjs +4 -6
- package/dist/createStoragePlugin.d.cts +6 -7
- package/dist/{createStoragePlugin.d.ts → createStoragePlugin.d.mts} +7 -8
- package/dist/{createStoragePlugin.js → createStoragePlugin.mjs} +4 -5
- package/dist/filterCompatibleAppVersions.cjs +2 -4
- package/dist/{filterCompatibleAppVersions.js → filterCompatibleAppVersions.mjs} +2 -4
- package/dist/generateMinBundleId.cjs +1 -3
- package/dist/{generateMinBundleId.js → generateMinBundleId.mjs} +1 -2
- package/dist/index.cjs +17 -13
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +13 -0
- package/dist/parseStorageUri.cjs +1 -3
- package/dist/{parseStorageUri.js → parseStorageUri.mjs} +1 -2
- package/dist/queryBundles.cjs +40 -0
- package/dist/queryBundles.d.cts +8 -0
- package/dist/queryBundles.d.mts +8 -0
- package/dist/queryBundles.mjs +38 -0
- package/dist/semverSatisfies.cjs +3 -5
- package/dist/{semverSatisfies.js → semverSatisfies.mjs} +1 -3
- package/dist/types/index.cjs +1 -3
- package/dist/types/index.d.cts +45 -18
- package/dist/types/{index.d.ts → index.d.mts} +46 -19
- package/dist/types/{index.js → index.mjs} +1 -2
- package/package.json +6 -5
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -13
- /package/dist/{compressionFormat.d.ts → compressionFormat.d.mts} +0 -0
- /package/dist/{createStorageKeyBuilder.d.ts → createStorageKeyBuilder.d.mts} +0 -0
- /package/dist/{filterCompatibleAppVersions.d.ts → filterCompatibleAppVersions.d.mts} +0 -0
- /package/dist/{generateMinBundleId.d.ts → generateMinBundleId.d.mts} +0 -0
- /package/dist/{parseStorageUri.d.ts → parseStorageUri.d.mts} +0 -0
- /package/dist/{semverSatisfies.d.ts → semverSatisfies.d.mts} +0 -0
- /package/dist/types/{utils.d.ts → utils.d.mts} +0 -0
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { mergeWith } from "es-toolkit";
|
|
3
2
|
//#region src/createDatabasePlugin.ts
|
|
3
|
+
const REPLACE_ON_UPDATE_KEYS = ["targetCohorts"];
|
|
4
|
+
function mergeBundleUpdate(baseBundle, patch) {
|
|
5
|
+
return mergeWith(baseBundle, patch, (_targetValue, sourceValue, key) => {
|
|
6
|
+
if (REPLACE_ON_UPDATE_KEYS.includes(key)) return sourceValue;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
4
9
|
/**
|
|
5
10
|
* Creates a database plugin with lazy initialization and automatic hook execution.
|
|
6
11
|
*
|
|
@@ -44,37 +49,43 @@ function createDatabasePlugin(options) {
|
|
|
44
49
|
};
|
|
45
50
|
return {
|
|
46
51
|
name: options.name,
|
|
47
|
-
async getBundleById(bundleId) {
|
|
48
|
-
return getMethods().getBundleById(bundleId);
|
|
52
|
+
async getBundleById(bundleId, context) {
|
|
53
|
+
if (context === void 0) return getMethods().getBundleById(bundleId);
|
|
54
|
+
return getMethods().getBundleById(bundleId, context);
|
|
49
55
|
},
|
|
50
|
-
async getBundles(options
|
|
51
|
-
return getMethods().getBundles(options
|
|
56
|
+
async getBundles(options, context) {
|
|
57
|
+
if (context === void 0) return getMethods().getBundles(options);
|
|
58
|
+
return getMethods().getBundles(options, context);
|
|
52
59
|
},
|
|
53
|
-
async getChannels() {
|
|
54
|
-
return getMethods().getChannels();
|
|
60
|
+
async getChannels(context) {
|
|
61
|
+
if (context === void 0) return getMethods().getChannels();
|
|
62
|
+
return getMethods().getChannels(context);
|
|
55
63
|
},
|
|
56
64
|
async onUnmount() {
|
|
57
65
|
const methods = getMethods();
|
|
58
66
|
if (methods.onUnmount) return methods.onUnmount();
|
|
59
67
|
},
|
|
60
|
-
async commitBundle() {
|
|
61
|
-
|
|
68
|
+
async commitBundle(context) {
|
|
69
|
+
const methods = getMethods();
|
|
70
|
+
const params = { changedSets: Array.from(changedMap.values()) };
|
|
71
|
+
if (context === void 0) await methods.commitBundle(params);
|
|
72
|
+
else await methods.commitBundle(params, context);
|
|
62
73
|
await hooks?.onDatabaseUpdated?.();
|
|
63
74
|
changedMap.clear();
|
|
64
75
|
},
|
|
65
|
-
async updateBundle(targetBundleId, newBundle) {
|
|
76
|
+
async updateBundle(targetBundleId, newBundle, context) {
|
|
66
77
|
const pendingChange = changedMap.get(targetBundleId);
|
|
67
78
|
if (pendingChange) {
|
|
68
|
-
const updatedData =
|
|
79
|
+
const updatedData = mergeBundleUpdate(pendingChange.data, newBundle);
|
|
69
80
|
changedMap.set(targetBundleId, {
|
|
70
81
|
operation: pendingChange.operation,
|
|
71
82
|
data: updatedData
|
|
72
83
|
});
|
|
73
84
|
return;
|
|
74
85
|
}
|
|
75
|
-
const currentBundle = await getMethods().getBundleById(targetBundleId);
|
|
86
|
+
const currentBundle = context === void 0 ? await getMethods().getBundleById(targetBundleId) : await getMethods().getBundleById(targetBundleId, context);
|
|
76
87
|
if (!currentBundle) throw new Error("targetBundleId not found");
|
|
77
|
-
markChanged("update",
|
|
88
|
+
markChanged("update", mergeBundleUpdate(currentBundle, newBundle));
|
|
78
89
|
},
|
|
79
90
|
async appendBundle(inputBundle) {
|
|
80
91
|
markChanged("insert", inputBundle);
|
|
@@ -86,6 +97,5 @@ function createDatabasePlugin(options) {
|
|
|
86
97
|
};
|
|
87
98
|
};
|
|
88
99
|
}
|
|
89
|
-
|
|
90
100
|
//#endregion
|
|
91
|
-
export { createDatabasePlugin };
|
|
101
|
+
export { createDatabasePlugin };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/createStorageKeyBuilder.ts
|
|
3
2
|
const createStorageKeyBuilder = (basePath) => (...args) => {
|
|
4
3
|
return [basePath || "", ...args].filter(Boolean).join("/");
|
|
5
4
|
};
|
|
6
|
-
|
|
7
5
|
//#endregion
|
|
8
|
-
exports.createStorageKeyBuilder = createStorageKeyBuilder;
|
|
6
|
+
exports.createStorageKeyBuilder = createStorageKeyBuilder;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/createStoragePlugin.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a storage plugin with lazy initialization and automatic hook execution.
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
* return {
|
|
21
20
|
* async upload(key, filePath) { ... },
|
|
22
21
|
* async delete(storageUri) { ... },
|
|
23
|
-
* async getDownloadUrl(storageUri) { ... }
|
|
22
|
+
* async getDownloadUrl(storageUri, context) { ... }
|
|
24
23
|
* };
|
|
25
24
|
* }
|
|
26
25
|
* });
|
|
@@ -45,13 +44,12 @@ const createStoragePlugin = (options) => {
|
|
|
45
44
|
async delete(storageUri) {
|
|
46
45
|
return getMethods().delete(storageUri);
|
|
47
46
|
},
|
|
48
|
-
async getDownloadUrl(storageUri) {
|
|
49
|
-
return getMethods().getDownloadUrl(storageUri);
|
|
47
|
+
async getDownloadUrl(storageUri, context) {
|
|
48
|
+
return getMethods().getDownloadUrl(storageUri, context);
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
51
|
};
|
|
53
52
|
};
|
|
54
53
|
};
|
|
55
|
-
|
|
56
54
|
//#endregion
|
|
57
|
-
exports.createStoragePlugin = createStoragePlugin;
|
|
55
|
+
exports.createStoragePlugin = createStoragePlugin;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { StoragePlugin, StoragePluginHooks } from "./types/index.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/createStoragePlugin.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Storage plugin methods without name and supportedProtocol
|
|
7
6
|
*/
|
|
8
|
-
type StoragePluginMethods = Omit<StoragePlugin
|
|
7
|
+
type StoragePluginMethods<TContext = unknown> = Omit<StoragePlugin<TContext>, "name" | "supportedProtocol">;
|
|
9
8
|
/**
|
|
10
9
|
* Factory function that creates storage plugin methods
|
|
11
10
|
*/
|
|
12
|
-
type StoragePluginFactory<TConfig> = (config: TConfig) => StoragePluginMethods
|
|
11
|
+
type StoragePluginFactory<TConfig, TContext = unknown> = (config: TConfig) => StoragePluginMethods<TContext>;
|
|
13
12
|
/**
|
|
14
13
|
* Configuration options for creating a storage plugin
|
|
15
14
|
*/
|
|
16
|
-
interface CreateStoragePluginOptions<TConfig> {
|
|
15
|
+
interface CreateStoragePluginOptions<TConfig, TContext = unknown> {
|
|
17
16
|
/**
|
|
18
17
|
* The name of the storage plugin (e.g., "s3Storage", "r2Storage")
|
|
19
18
|
*/
|
|
@@ -30,7 +29,7 @@ interface CreateStoragePluginOptions<TConfig> {
|
|
|
30
29
|
/**
|
|
31
30
|
* Function that creates the storage plugin methods (upload, delete, getDownloadUrl)
|
|
32
31
|
*/
|
|
33
|
-
factory: StoragePluginFactory<TConfig>;
|
|
32
|
+
factory: StoragePluginFactory<TConfig, TContext>;
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* Creates a storage plugin with lazy initialization and automatic hook execution.
|
|
@@ -52,12 +51,12 @@ interface CreateStoragePluginOptions<TConfig> {
|
|
|
52
51
|
* return {
|
|
53
52
|
* async upload(key, filePath) { ... },
|
|
54
53
|
* async delete(storageUri) { ... },
|
|
55
|
-
* async getDownloadUrl(storageUri) { ... }
|
|
54
|
+
* async getDownloadUrl(storageUri, context) { ... }
|
|
56
55
|
* };
|
|
57
56
|
* }
|
|
58
57
|
* });
|
|
59
58
|
* ```
|
|
60
59
|
*/
|
|
61
|
-
declare const createStoragePlugin: <TConfig>(options: CreateStoragePluginOptions<TConfig>) => (config: TConfig, hooks?: StoragePluginHooks) => () => StoragePlugin
|
|
60
|
+
declare const createStoragePlugin: <TConfig, TContext = unknown>(options: CreateStoragePluginOptions<TConfig, TContext>) => (config: TConfig, hooks?: StoragePluginHooks) => () => StoragePlugin<TContext>;
|
|
62
61
|
//#endregion
|
|
63
62
|
export { CreateStoragePluginOptions, createStoragePlugin };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { StoragePlugin, StoragePluginHooks } from "./types/index.
|
|
1
|
+
import { StoragePlugin, StoragePluginHooks } from "./types/index.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/createStoragePlugin.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Storage plugin methods without name and supportedProtocol
|
|
7
6
|
*/
|
|
8
|
-
type StoragePluginMethods = Omit<StoragePlugin
|
|
7
|
+
type StoragePluginMethods<TContext = unknown> = Omit<StoragePlugin<TContext>, "name" | "supportedProtocol">;
|
|
9
8
|
/**
|
|
10
9
|
* Factory function that creates storage plugin methods
|
|
11
10
|
*/
|
|
12
|
-
type StoragePluginFactory<TConfig> = (config: TConfig) => StoragePluginMethods
|
|
11
|
+
type StoragePluginFactory<TConfig, TContext = unknown> = (config: TConfig) => StoragePluginMethods<TContext>;
|
|
13
12
|
/**
|
|
14
13
|
* Configuration options for creating a storage plugin
|
|
15
14
|
*/
|
|
16
|
-
interface CreateStoragePluginOptions<TConfig> {
|
|
15
|
+
interface CreateStoragePluginOptions<TConfig, TContext = unknown> {
|
|
17
16
|
/**
|
|
18
17
|
* The name of the storage plugin (e.g., "s3Storage", "r2Storage")
|
|
19
18
|
*/
|
|
@@ -30,7 +29,7 @@ interface CreateStoragePluginOptions<TConfig> {
|
|
|
30
29
|
/**
|
|
31
30
|
* Function that creates the storage plugin methods (upload, delete, getDownloadUrl)
|
|
32
31
|
*/
|
|
33
|
-
factory: StoragePluginFactory<TConfig>;
|
|
32
|
+
factory: StoragePluginFactory<TConfig, TContext>;
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* Creates a storage plugin with lazy initialization and automatic hook execution.
|
|
@@ -52,12 +51,12 @@ interface CreateStoragePluginOptions<TConfig> {
|
|
|
52
51
|
* return {
|
|
53
52
|
* async upload(key, filePath) { ... },
|
|
54
53
|
* async delete(storageUri) { ... },
|
|
55
|
-
* async getDownloadUrl(storageUri) { ... }
|
|
54
|
+
* async getDownloadUrl(storageUri, context) { ... }
|
|
56
55
|
* };
|
|
57
56
|
* }
|
|
58
57
|
* });
|
|
59
58
|
* ```
|
|
60
59
|
*/
|
|
61
|
-
declare const createStoragePlugin: <TConfig>(options: CreateStoragePluginOptions<TConfig>) => (config: TConfig, hooks?: StoragePluginHooks) => () => StoragePlugin
|
|
60
|
+
declare const createStoragePlugin: <TConfig, TContext = unknown>(options: CreateStoragePluginOptions<TConfig, TContext>) => (config: TConfig, hooks?: StoragePluginHooks) => () => StoragePlugin<TContext>;
|
|
62
61
|
//#endregion
|
|
63
62
|
export { CreateStoragePluginOptions, createStoragePlugin };
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* return {
|
|
20
20
|
* async upload(key, filePath) { ... },
|
|
21
21
|
* async delete(storageUri) { ... },
|
|
22
|
-
* async getDownloadUrl(storageUri) { ... }
|
|
22
|
+
* async getDownloadUrl(storageUri, context) { ... }
|
|
23
23
|
* };
|
|
24
24
|
* }
|
|
25
25
|
* });
|
|
@@ -44,13 +44,12 @@ const createStoragePlugin = (options) => {
|
|
|
44
44
|
async delete(storageUri) {
|
|
45
45
|
return getMethods().delete(storageUri);
|
|
46
46
|
},
|
|
47
|
-
async getDownloadUrl(storageUri) {
|
|
48
|
-
return getMethods().getDownloadUrl(storageUri);
|
|
47
|
+
async getDownloadUrl(storageUri, context) {
|
|
48
|
+
return getMethods().getDownloadUrl(storageUri, context);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
|
-
|
|
55
54
|
//#endregion
|
|
56
|
-
export { createStoragePlugin };
|
|
55
|
+
export { createStoragePlugin };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const require_semverSatisfies = require(
|
|
2
|
-
|
|
1
|
+
const require_semverSatisfies = require("./semverSatisfies.cjs");
|
|
3
2
|
//#region src/filterCompatibleAppVersions.ts
|
|
4
3
|
/**
|
|
5
4
|
* Filters target app versions that are compatible with the current app version.
|
|
@@ -12,6 +11,5 @@ const require_semverSatisfies = require('./semverSatisfies.cjs');
|
|
|
12
11
|
const filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
|
|
13
12
|
return targetAppVersionList.filter((version) => require_semverSatisfies.semverSatisfies(version, currentVersion)).sort((a, b) => b.localeCompare(a));
|
|
14
13
|
};
|
|
15
|
-
|
|
16
14
|
//#endregion
|
|
17
|
-
exports.filterCompatibleAppVersions = filterCompatibleAppVersions;
|
|
15
|
+
exports.filterCompatibleAppVersions = filterCompatibleAppVersions;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { semverSatisfies } from "./semverSatisfies.
|
|
2
|
-
|
|
1
|
+
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
3
2
|
//#region src/filterCompatibleAppVersions.ts
|
|
4
3
|
/**
|
|
5
4
|
* Filters target app versions that are compatible with the current app version.
|
|
@@ -12,6 +11,5 @@ import { semverSatisfies } from "./semverSatisfies.js";
|
|
|
12
11
|
const filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
|
|
13
12
|
return targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion)).sort((a, b) => b.localeCompare(a));
|
|
14
13
|
};
|
|
15
|
-
|
|
16
14
|
//#endregion
|
|
17
|
-
export { filterCompatibleAppVersions };
|
|
15
|
+
export { filterCompatibleAppVersions };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/generateMinBundleId.ts
|
|
3
2
|
const generateMinBundleId = () => {
|
|
4
3
|
const timestamp = BigInt(Date.now());
|
|
@@ -6,6 +5,5 @@ const generateMinBundleId = () => {
|
|
|
6
5
|
const timeLow = Number(timestamp & 65535n);
|
|
7
6
|
return `${timeHigh.toString(16).padStart(8, "0")}-${timeLow.toString(16).padStart(4, "0")}-${28672 .toString(16).padStart(4, "0")}-${32768 .toString(16).padStart(4, "0")}-000000000000`;
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
//#endregion
|
|
11
|
-
exports.generateMinBundleId = generateMinBundleId;
|
|
9
|
+
exports.generateMinBundleId = generateMinBundleId;
|
|
@@ -5,6 +5,5 @@ const generateMinBundleId = () => {
|
|
|
5
5
|
const timeLow = Number(timestamp & 65535n);
|
|
6
6
|
return `${timeHigh.toString(16).padStart(8, "0")}-${timeLow.toString(16).padStart(4, "0")}-${28672 .toString(16).padStart(4, "0")}-${32768 .toString(16).padStart(4, "0")}-000000000000`;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
8
|
//#endregion
|
|
10
|
-
export { generateMinBundleId };
|
|
9
|
+
export { generateMinBundleId };
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_calculatePagination = require("./calculatePagination.cjs");
|
|
3
|
+
const require_compressionFormat = require("./compressionFormat.cjs");
|
|
4
|
+
const require_createDatabasePlugin = require("./createDatabasePlugin.cjs");
|
|
5
|
+
const require_queryBundles = require("./queryBundles.cjs");
|
|
6
|
+
const require_createBlobDatabasePlugin = require("./createBlobDatabasePlugin.cjs");
|
|
7
|
+
const require_createStorageKeyBuilder = require("./createStorageKeyBuilder.cjs");
|
|
8
|
+
const require_createStoragePlugin = require("./createStoragePlugin.cjs");
|
|
9
|
+
const require_semverSatisfies = require("./semverSatisfies.cjs");
|
|
10
|
+
const require_filterCompatibleAppVersions = require("./filterCompatibleAppVersions.cjs");
|
|
11
|
+
const require_generateMinBundleId = require("./generateMinBundleId.cjs");
|
|
12
|
+
const require_parseStorageUri = require("./parseStorageUri.cjs");
|
|
13
|
+
const require_index = require("./types/index.cjs");
|
|
14
|
+
exports.bundleIdMatchesFilter = require_queryBundles.bundleIdMatchesFilter;
|
|
15
|
+
exports.bundleMatchesQueryWhere = require_queryBundles.bundleMatchesQueryWhere;
|
|
13
16
|
exports.calculatePagination = require_calculatePagination.calculatePagination;
|
|
14
17
|
exports.createBlobDatabasePlugin = require_createBlobDatabasePlugin.createBlobDatabasePlugin;
|
|
15
18
|
exports.createDatabasePlugin = require_createDatabasePlugin.createDatabasePlugin;
|
|
@@ -22,4 +25,5 @@ exports.getCompressionMimeType = require_compressionFormat.getCompressionMimeTyp
|
|
|
22
25
|
exports.getContentType = require_compressionFormat.getContentType;
|
|
23
26
|
exports.parseStorageUri = require_parseStorageUri.parseStorageUri;
|
|
24
27
|
exports.semverSatisfies = require_semverSatisfies.semverSatisfies;
|
|
25
|
-
exports.
|
|
28
|
+
exports.sortBundles = require_queryBundles.sortBundles;
|
|
29
|
+
exports.supportedIosPlatforms = require_index.supportedIosPlatforms;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.cjs";
|
|
2
|
-
import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, PaginationInfo, Platform, PlatformConfig, SigningConfig, StoragePlugin, StoragePluginHooks, supportedIosPlatforms } from "./types/index.cjs";
|
|
2
|
+
import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms } 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";
|
|
@@ -9,5 +9,6 @@ import { CreateStoragePluginOptions, createStoragePlugin } from "./createStorage
|
|
|
9
9
|
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.cjs";
|
|
10
10
|
import { generateMinBundleId } from "./generateMinBundleId.cjs";
|
|
11
11
|
import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.cjs";
|
|
12
|
+
import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.cjs";
|
|
12
13
|
import { semverSatisfies } from "./semverSatisfies.cjs";
|
|
13
|
-
export { AbstractDatabasePlugin, ApplePlatform, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies, supportedIosPlatforms };
|
|
14
|
+
export { AbstractDatabasePlugin, ApplePlatform, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.mjs";
|
|
2
|
+
import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms } from "./types/index.mjs";
|
|
3
|
+
import { PaginatedResult, PaginationOptions, calculatePagination } from "./calculatePagination.mjs";
|
|
4
|
+
import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
|
|
5
|
+
import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.mjs";
|
|
6
|
+
import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.mjs";
|
|
7
|
+
import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
|
|
8
|
+
import { CreateStoragePluginOptions, createStoragePlugin } from "./createStoragePlugin.mjs";
|
|
9
|
+
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
|
|
10
|
+
import { generateMinBundleId } from "./generateMinBundleId.mjs";
|
|
11
|
+
import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
|
|
12
|
+
import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
|
|
13
|
+
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
14
|
+
export { AbstractDatabasePlugin, ApplePlatform, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { calculatePagination } from "./calculatePagination.mjs";
|
|
2
|
+
import { detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
|
|
3
|
+
import { createDatabasePlugin } from "./createDatabasePlugin.mjs";
|
|
4
|
+
import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
|
|
5
|
+
import { createBlobDatabasePlugin } from "./createBlobDatabasePlugin.mjs";
|
|
6
|
+
import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
|
|
7
|
+
import { createStoragePlugin } from "./createStoragePlugin.mjs";
|
|
8
|
+
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
9
|
+
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
|
|
10
|
+
import { generateMinBundleId } from "./generateMinBundleId.mjs";
|
|
11
|
+
import { parseStorageUri } from "./parseStorageUri.mjs";
|
|
12
|
+
import { supportedIosPlatforms } from "./types/index.mjs";
|
|
13
|
+
export { bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/parseStorageUri.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/parseStorageUri.ts
|
|
3
2
|
/**
|
|
4
3
|
* Parses a storage URI and validates the protocol.
|
|
@@ -30,6 +29,5 @@ function parseStorageUri(storageUri, expectedProtocol) {
|
|
|
30
29
|
throw error;
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
//#endregion
|
|
35
|
-
exports.parseStorageUri = parseStorageUri;
|
|
33
|
+
exports.parseStorageUri = parseStorageUri;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/queryBundles.ts
|
|
2
|
+
const compareValue = (value, expected, comparator) => {
|
|
3
|
+
if (expected === void 0) return true;
|
|
4
|
+
switch (comparator) {
|
|
5
|
+
case "eq": return value === expected;
|
|
6
|
+
case "gt": return value.localeCompare(expected) > 0;
|
|
7
|
+
case "gte": return value.localeCompare(expected) >= 0;
|
|
8
|
+
case "lt": return value.localeCompare(expected) < 0;
|
|
9
|
+
case "lte": return value.localeCompare(expected) <= 0;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function bundleIdMatchesFilter(id, filter) {
|
|
13
|
+
if (!filter) return true;
|
|
14
|
+
if (filter.in && !filter.in.includes(id)) return false;
|
|
15
|
+
return compareValue(id, filter.eq, "eq") && compareValue(id, filter.gt, "gt") && compareValue(id, filter.gte, "gte") && compareValue(id, filter.lt, "lt") && compareValue(id, filter.lte, "lte");
|
|
16
|
+
}
|
|
17
|
+
function bundleMatchesQueryWhere(bundle, where) {
|
|
18
|
+
if (!where) return true;
|
|
19
|
+
if (where.channel !== void 0 && bundle.channel !== where.channel) return false;
|
|
20
|
+
if (where.platform !== void 0 && bundle.platform !== where.platform) return false;
|
|
21
|
+
if (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;
|
|
22
|
+
if (!bundleIdMatchesFilter(bundle.id, where.id)) return false;
|
|
23
|
+
if (where.targetAppVersionNotNull === true && bundle.targetAppVersion === null) return false;
|
|
24
|
+
if (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;
|
|
25
|
+
if (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? "")) return false;
|
|
26
|
+
if (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
function sortBundles(bundles, orderBy) {
|
|
30
|
+
const direction = orderBy?.direction ?? "desc";
|
|
31
|
+
if (orderBy && orderBy.field !== "id") return bundles;
|
|
32
|
+
return bundles.slice().sort((a, b) => {
|
|
33
|
+
const result = a.id.localeCompare(b.id);
|
|
34
|
+
return direction === "asc" ? result : -result;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.bundleIdMatchesFilter = bundleIdMatchesFilter;
|
|
39
|
+
exports.bundleMatchesQueryWhere = bundleMatchesQueryWhere;
|
|
40
|
+
exports.sortBundles = sortBundles;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Bundle, DatabaseBundleIdFilter, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere } from "./types/index.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/queryBundles.d.ts
|
|
4
|
+
declare function bundleIdMatchesFilter(id: string, filter: DatabaseBundleIdFilter | undefined): boolean;
|
|
5
|
+
declare function bundleMatchesQueryWhere(bundle: Bundle, where: DatabaseBundleQueryWhere | undefined): boolean;
|
|
6
|
+
declare function sortBundles(bundles: Bundle[], orderBy: DatabaseBundleQueryOrder | undefined): Bundle[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Bundle, DatabaseBundleIdFilter, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere } from "./types/index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/queryBundles.d.ts
|
|
4
|
+
declare function bundleIdMatchesFilter(id: string, filter: DatabaseBundleIdFilter | undefined): boolean;
|
|
5
|
+
declare function bundleMatchesQueryWhere(bundle: Bundle, where: DatabaseBundleQueryWhere | undefined): boolean;
|
|
6
|
+
declare function sortBundles(bundles: Bundle[], orderBy: DatabaseBundleQueryOrder | undefined): Bundle[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/queryBundles.ts
|
|
2
|
+
const compareValue = (value, expected, comparator) => {
|
|
3
|
+
if (expected === void 0) return true;
|
|
4
|
+
switch (comparator) {
|
|
5
|
+
case "eq": return value === expected;
|
|
6
|
+
case "gt": return value.localeCompare(expected) > 0;
|
|
7
|
+
case "gte": return value.localeCompare(expected) >= 0;
|
|
8
|
+
case "lt": return value.localeCompare(expected) < 0;
|
|
9
|
+
case "lte": return value.localeCompare(expected) <= 0;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function bundleIdMatchesFilter(id, filter) {
|
|
13
|
+
if (!filter) return true;
|
|
14
|
+
if (filter.in && !filter.in.includes(id)) return false;
|
|
15
|
+
return compareValue(id, filter.eq, "eq") && compareValue(id, filter.gt, "gt") && compareValue(id, filter.gte, "gte") && compareValue(id, filter.lt, "lt") && compareValue(id, filter.lte, "lte");
|
|
16
|
+
}
|
|
17
|
+
function bundleMatchesQueryWhere(bundle, where) {
|
|
18
|
+
if (!where) return true;
|
|
19
|
+
if (where.channel !== void 0 && bundle.channel !== where.channel) return false;
|
|
20
|
+
if (where.platform !== void 0 && bundle.platform !== where.platform) return false;
|
|
21
|
+
if (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;
|
|
22
|
+
if (!bundleIdMatchesFilter(bundle.id, where.id)) return false;
|
|
23
|
+
if (where.targetAppVersionNotNull === true && bundle.targetAppVersion === null) return false;
|
|
24
|
+
if (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;
|
|
25
|
+
if (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? "")) return false;
|
|
26
|
+
if (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
function sortBundles(bundles, orderBy) {
|
|
30
|
+
const direction = orderBy?.direction ?? "desc";
|
|
31
|
+
if (orderBy && orderBy.field !== "id") return bundles;
|
|
32
|
+
return bundles.slice().sort((a, b) => {
|
|
33
|
+
const result = a.id.localeCompare(b.id);
|
|
34
|
+
return direction === "asc" ? result : -result;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles };
|
package/dist/semverSatisfies.cjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let semver = require("semver");
|
|
3
|
-
semver =
|
|
4
|
-
|
|
3
|
+
semver = require_runtime.__toESM(semver);
|
|
5
4
|
//#region src/semverSatisfies.ts
|
|
6
5
|
const semverSatisfies = (targetAppVersion, currentVersion) => {
|
|
7
6
|
const currentCoerce = semver.default.coerce(currentVersion);
|
|
8
7
|
if (!currentCoerce) return false;
|
|
9
8
|
return semver.default.satisfies(currentCoerce.version, targetAppVersion);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
exports.semverSatisfies = semverSatisfies;
|
|
11
|
+
exports.semverSatisfies = semverSatisfies;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import semver from "semver";
|
|
2
|
-
|
|
3
2
|
//#region src/semverSatisfies.ts
|
|
4
3
|
const semverSatisfies = (targetAppVersion, currentVersion) => {
|
|
5
4
|
const currentCoerce = semver.coerce(currentVersion);
|
|
6
5
|
if (!currentCoerce) return false;
|
|
7
6
|
return semver.satisfies(currentCoerce.version, targetAppVersion);
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
//#endregion
|
|
11
|
-
export { semverSatisfies };
|
|
9
|
+
export { semverSatisfies };
|
package/dist/types/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/types/index.ts
|
|
3
2
|
/**
|
|
4
3
|
* Supported Apple platforms for building and deployment
|
|
5
4
|
*/
|
|
6
5
|
const supportedIosPlatforms = { ios: "ios" };
|
|
7
|
-
|
|
8
6
|
//#endregion
|
|
9
|
-
exports.supportedIosPlatforms = supportedIosPlatforms;
|
|
7
|
+
exports.supportedIosPlatforms = supportedIosPlatforms;
|