@hot-updater/plugin-core 0.30.7 → 0.30.9
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 +4 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/uuidv7.cjs +29 -0
- package/dist/uuidv7.d.cts +6 -0
- package/dist/uuidv7.d.mts +6 -0
- package/dist/uuidv7.mjs +27 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -13,6 +13,7 @@ const require_createStoragePlugin = require("./createStoragePlugin.cjs");
|
|
|
13
13
|
const require_generateMinBundleId = require("./generateMinBundleId.cjs");
|
|
14
14
|
const require_parseStorageUri = require("./parseStorageUri.cjs");
|
|
15
15
|
const require_index = require("./types/index.cjs");
|
|
16
|
+
const require_uuidv7 = require("./uuidv7.cjs");
|
|
16
17
|
exports.bundleIdMatchesFilter = require_queryBundles.bundleIdMatchesFilter;
|
|
17
18
|
exports.bundleMatchesQueryWhere = require_queryBundles.bundleMatchesQueryWhere;
|
|
18
19
|
exports.calculatePagination = require_calculatePagination.calculatePagination;
|
|
@@ -21,7 +22,10 @@ exports.createDatabasePlugin = require_createDatabasePlugin.createDatabasePlugin
|
|
|
21
22
|
exports.createDatabasePluginGetUpdateInfo = require_createDatabasePluginGetUpdateInfo.createDatabasePluginGetUpdateInfo;
|
|
22
23
|
exports.createStorageKeyBuilder = require_createStorageKeyBuilder.createStorageKeyBuilder;
|
|
23
24
|
exports.createStoragePlugin = require_createStoragePlugin.createStoragePlugin;
|
|
25
|
+
exports.createUUIDv7 = require_uuidv7.createUUIDv7;
|
|
26
|
+
exports.createUUIDv7WithSameTimestamp = require_uuidv7.createUUIDv7WithSameTimestamp;
|
|
24
27
|
exports.detectCompressionFormat = require_compressionFormat.detectCompressionFormat;
|
|
28
|
+
exports.extractTimestampFromUUIDv7 = require_uuidv7.extractTimestampFromUUIDv7;
|
|
25
29
|
exports.filterCompatibleAppVersions = require_filterCompatibleAppVersions.filterCompatibleAppVersions;
|
|
26
30
|
exports.generateMinBundleId = require_generateMinBundleId.generateMinBundleId;
|
|
27
31
|
exports.getCompressionMimeType = require_compressionFormat.getCompressionMimeType;
|
package/dist/index.d.cts
CHANGED
|
@@ -13,4 +13,5 @@ import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.cjs";
|
|
|
13
13
|
import { paginateBundles } from "./paginateBundles.cjs";
|
|
14
14
|
import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.cjs";
|
|
15
15
|
import { semverSatisfies } from "./semverSatisfies.cjs";
|
|
16
|
-
|
|
16
|
+
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.cjs";
|
|
17
|
+
export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BlobDatabasePluginConfig, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginGetUpdateInfoOptions, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, UpdateInfo, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createDatabasePluginGetUpdateInfo, createStorageKeyBuilder, createStoragePlugin, createUUIDv7, createUUIDv7WithSameTimestamp, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, paginateBundles, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/index.d.mts
CHANGED
|
@@ -13,4 +13,5 @@ import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
|
|
|
13
13
|
import { paginateBundles } from "./paginateBundles.mjs";
|
|
14
14
|
import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
|
|
15
15
|
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
16
|
-
|
|
16
|
+
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.mjs";
|
|
17
|
+
export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BlobDatabasePluginConfig, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginGetUpdateInfoOptions, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, UpdateInfo, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createDatabasePluginGetUpdateInfo, createStorageKeyBuilder, createStoragePlugin, createUUIDv7, createUUIDv7WithSameTimestamp, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, paginateBundles, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/index.mjs
CHANGED
|
@@ -12,4 +12,5 @@ import { createStoragePlugin } from "./createStoragePlugin.mjs";
|
|
|
12
12
|
import { generateMinBundleId } from "./generateMinBundleId.mjs";
|
|
13
13
|
import { parseStorageUri } from "./parseStorageUri.mjs";
|
|
14
14
|
import { supportedIosPlatforms } from "./types/index.mjs";
|
|
15
|
-
|
|
15
|
+
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.mjs";
|
|
16
|
+
export { bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createDatabasePluginGetUpdateInfo, createStorageKeyBuilder, createStoragePlugin, createUUIDv7, createUUIDv7WithSameTimestamp, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, paginateBundles, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/uuidv7.cjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/uuidv7.ts
|
|
2
|
+
const extractTimestampFromUUIDv7 = (uuid) => {
|
|
3
|
+
const timestampHex = uuid.split("-").join("").slice(0, 12);
|
|
4
|
+
return Number.parseInt(timestampHex, 16);
|
|
5
|
+
};
|
|
6
|
+
function createUUIDv7FromTimestampHex(timestampHex) {
|
|
7
|
+
const randomBytes = new Uint8Array(10);
|
|
8
|
+
crypto.getRandomValues(randomBytes);
|
|
9
|
+
const randomHex = Array.from(randomBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
10
|
+
const randA = randomHex.slice(0, 3);
|
|
11
|
+
const randBHex = randomHex.slice(3, 19);
|
|
12
|
+
const versionAndRandA = `7${randA}`;
|
|
13
|
+
const variantAndFirstRandB = (128 | parseInt(randBHex.slice(0, 2), 16) & 63).toString(16).padStart(2, "0");
|
|
14
|
+
return [
|
|
15
|
+
timestampHex.slice(0, 8),
|
|
16
|
+
timestampHex.slice(8, 12),
|
|
17
|
+
versionAndRandA,
|
|
18
|
+
variantAndFirstRandB + randBHex.slice(2, 4),
|
|
19
|
+
randBHex.slice(4, 16)
|
|
20
|
+
].join("-");
|
|
21
|
+
}
|
|
22
|
+
const createUUIDv7 = () => createUUIDv7FromTimestampHex(Date.now().toString(16).padStart(12, "0"));
|
|
23
|
+
const createUUIDv7WithSameTimestamp = (originalUuid) => {
|
|
24
|
+
return createUUIDv7FromTimestampHex(originalUuid.split("-").join("").slice(0, 12));
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.createUUIDv7 = createUUIDv7;
|
|
28
|
+
exports.createUUIDv7WithSameTimestamp = createUUIDv7WithSameTimestamp;
|
|
29
|
+
exports.extractTimestampFromUUIDv7 = extractTimestampFromUUIDv7;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/uuidv7.d.ts
|
|
2
|
+
declare const extractTimestampFromUUIDv7: (uuid: string) => number;
|
|
3
|
+
declare const createUUIDv7: () => string;
|
|
4
|
+
declare const createUUIDv7WithSameTimestamp: (originalUuid: string) => string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/uuidv7.d.ts
|
|
2
|
+
declare const extractTimestampFromUUIDv7: (uuid: string) => number;
|
|
3
|
+
declare const createUUIDv7: () => string;
|
|
4
|
+
declare const createUUIDv7WithSameTimestamp: (originalUuid: string) => string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 };
|
package/dist/uuidv7.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/uuidv7.ts
|
|
2
|
+
const extractTimestampFromUUIDv7 = (uuid) => {
|
|
3
|
+
const timestampHex = uuid.split("-").join("").slice(0, 12);
|
|
4
|
+
return Number.parseInt(timestampHex, 16);
|
|
5
|
+
};
|
|
6
|
+
function createUUIDv7FromTimestampHex(timestampHex) {
|
|
7
|
+
const randomBytes = new Uint8Array(10);
|
|
8
|
+
crypto.getRandomValues(randomBytes);
|
|
9
|
+
const randomHex = Array.from(randomBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
10
|
+
const randA = randomHex.slice(0, 3);
|
|
11
|
+
const randBHex = randomHex.slice(3, 19);
|
|
12
|
+
const versionAndRandA = `7${randA}`;
|
|
13
|
+
const variantAndFirstRandB = (128 | parseInt(randBHex.slice(0, 2), 16) & 63).toString(16).padStart(2, "0");
|
|
14
|
+
return [
|
|
15
|
+
timestampHex.slice(0, 8),
|
|
16
|
+
timestampHex.slice(8, 12),
|
|
17
|
+
versionAndRandA,
|
|
18
|
+
variantAndFirstRandB + randBHex.slice(2, 4),
|
|
19
|
+
randBHex.slice(4, 16)
|
|
20
|
+
].join("-");
|
|
21
|
+
}
|
|
22
|
+
const createUUIDv7 = () => createUUIDv7FromTimestampHex(Date.now().toString(16).padStart(12, "0"));
|
|
23
|
+
const createUUIDv7WithSameTimestamp = (originalUuid) => {
|
|
24
|
+
return createUUIDv7FromTimestampHex(originalUuid.split("-").join("").slice(0, 12));
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"es-toolkit": "^1.32.0",
|
|
43
43
|
"mime": "^4.0.4",
|
|
44
44
|
"semver": "^7.7.2",
|
|
45
|
-
"@hot-updater/core": "0.30.
|
|
46
|
-
"@hot-updater/js": "0.30.
|
|
45
|
+
"@hot-updater/core": "0.30.9",
|
|
46
|
+
"@hot-updater/js": "0.30.9"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^20",
|
|
50
50
|
"@types/semver": "^7.5.8",
|
|
51
51
|
"typescript": "6.0.2",
|
|
52
|
-
"@hot-updater/test-utils": "0.30.
|
|
52
|
+
"@hot-updater/test-utils": "0.30.9"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsdown",
|