@hot-updater/js 0.18.1 → 0.18.3
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 +12 -12
- package/dist/index.d.cts +0 -5
- package/dist/index.d.ts +0 -5
- package/dist/index.js +12 -12
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -642,7 +642,7 @@ var require_lrucache = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_
|
|
|
642
642
|
var LRUCache = class {
|
|
643
643
|
constructor() {
|
|
644
644
|
this.max = 1e3;
|
|
645
|
-
this.map = new Map();
|
|
645
|
+
this.map = /* @__PURE__ */ new Map();
|
|
646
646
|
}
|
|
647
647
|
get(key) {
|
|
648
648
|
const value = this.map.get(key);
|
|
@@ -746,7 +746,7 @@ var require_range = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mod
|
|
|
746
746
|
return !!comp.match(re$1[t$1.COMPARATORLOOSE]);
|
|
747
747
|
});
|
|
748
748
|
debug$1("range list", rangeList);
|
|
749
|
-
const rangeMap = new Map();
|
|
749
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
750
750
|
const comparators = rangeList.map((comp) => new Comparator$4(comp, this.options));
|
|
751
751
|
for (const comp of comparators) {
|
|
752
752
|
if (isNullSet(comp)) return [comp];
|
|
@@ -1297,7 +1297,7 @@ var require_subset = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mo
|
|
|
1297
1297
|
else sub = minimumVersion;
|
|
1298
1298
|
if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
|
|
1299
1299
|
else dom = minimumVersion;
|
|
1300
|
-
const eqSet = new Set();
|
|
1300
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1301
1301
|
let gt$5, lt$4;
|
|
1302
1302
|
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt$5 = higherGT(gt$5, c, options);
|
|
1303
1303
|
else if (c.operator === "<" || c.operator === "<=") lt$4 = lowerLT(lt$4, c, options);
|
|
@@ -1456,7 +1456,7 @@ var require_semver = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mo
|
|
|
1456
1456
|
|
|
1457
1457
|
//#endregion
|
|
1458
1458
|
//#region src/semverSatisfies.ts
|
|
1459
|
-
var import_semver = __toESM(require_semver()
|
|
1459
|
+
var import_semver = __toESM(require_semver());
|
|
1460
1460
|
const semverSatisfies = (targetAppVersion, currentVersion) => {
|
|
1461
1461
|
const currentCoerce = import_semver.default.coerce(currentVersion);
|
|
1462
1462
|
if (!currentCoerce) return false;
|
|
@@ -1973,7 +1973,7 @@ var jwk_to_key_default = async (jwk) => {
|
|
|
1973
1973
|
//#region ../../node_modules/.pnpm/jose@6.0.10/node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
1974
1974
|
var validate_crit_default = (Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) => {
|
|
1975
1975
|
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) throw new Err("\"crit\" (Critical) Header Parameter MUST be integrity protected");
|
|
1976
|
-
if (!protectedHeader || protectedHeader.crit === void 0) return new Set();
|
|
1976
|
+
if (!protectedHeader || protectedHeader.crit === void 0) return /* @__PURE__ */ new Set();
|
|
1977
1977
|
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) throw new Err("\"crit\" (Critical) Header Parameter MUST be an array of non-empty strings when present");
|
|
1978
1978
|
let recognized;
|
|
1979
1979
|
if (recognizedOption !== void 0) recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
@@ -2013,7 +2013,7 @@ function isSecretJWK(key) {
|
|
|
2013
2013
|
//#region ../../node_modules/.pnpm/jose@6.0.10/node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
2014
2014
|
let cache;
|
|
2015
2015
|
const handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
2016
|
-
cache ||= new WeakMap();
|
|
2016
|
+
cache ||= /* @__PURE__ */ new WeakMap();
|
|
2017
2017
|
let cached = cache.get(key);
|
|
2018
2018
|
if (cached?.[alg]) return cached[alg];
|
|
2019
2019
|
const cryptoKey = await jwk_to_key_default({
|
|
@@ -2026,7 +2026,7 @@ const handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
2026
2026
|
return cryptoKey;
|
|
2027
2027
|
};
|
|
2028
2028
|
const handleKeyObject = (keyObject, alg) => {
|
|
2029
|
-
cache ||= new WeakMap();
|
|
2029
|
+
cache ||= /* @__PURE__ */ new WeakMap();
|
|
2030
2030
|
let cached = cache.get(keyObject);
|
|
2031
2031
|
if (cached?.[alg]) return cached[alg];
|
|
2032
2032
|
const isPublic = keyObject.type === "public";
|
|
@@ -2469,7 +2469,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
2469
2469
|
default: throw new TypeError("Invalid clockTolerance option type");
|
|
2470
2470
|
}
|
|
2471
2471
|
const { currentDate } = options;
|
|
2472
|
-
const now = epoch_default(currentDate || new Date());
|
|
2472
|
+
const now = epoch_default(currentDate || /* @__PURE__ */ new Date());
|
|
2473
2473
|
if ((payload.iat !== void 0 || maxTokenAge) && typeof payload.iat !== "number") throw new JWTClaimValidationFailed("\"iat\" claim must be a number", payload, "iat", "invalid");
|
|
2474
2474
|
if (payload.nbf !== void 0) {
|
|
2475
2475
|
if (typeof payload.nbf !== "number") throw new JWTClaimValidationFailed("\"nbf\" claim must be a number", payload, "nbf", "invalid");
|
|
@@ -2520,17 +2520,17 @@ var JWTClaimsBuilder = class {
|
|
|
2520
2520
|
set nbf(value) {
|
|
2521
2521
|
if (typeof value === "number") this.#payload.nbf = validateInput("setNotBefore", value);
|
|
2522
2522
|
else if (value instanceof Date) this.#payload.nbf = validateInput("setNotBefore", epoch_default(value));
|
|
2523
|
-
else this.#payload.nbf = epoch_default(new Date()) + secs_default(value);
|
|
2523
|
+
else this.#payload.nbf = epoch_default(/* @__PURE__ */ new Date()) + secs_default(value);
|
|
2524
2524
|
}
|
|
2525
2525
|
set exp(value) {
|
|
2526
2526
|
if (typeof value === "number") this.#payload.exp = validateInput("setExpirationTime", value);
|
|
2527
2527
|
else if (value instanceof Date) this.#payload.exp = validateInput("setExpirationTime", epoch_default(value));
|
|
2528
|
-
else this.#payload.exp = epoch_default(new Date()) + secs_default(value);
|
|
2528
|
+
else this.#payload.exp = epoch_default(/* @__PURE__ */ new Date()) + secs_default(value);
|
|
2529
2529
|
}
|
|
2530
2530
|
set iat(value) {
|
|
2531
|
-
if (typeof value === "undefined") this.#payload.iat = epoch_default(new Date());
|
|
2531
|
+
if (typeof value === "undefined") this.#payload.iat = epoch_default(/* @__PURE__ */ new Date());
|
|
2532
2532
|
else if (value instanceof Date) this.#payload.iat = validateInput("setIssuedAt", epoch_default(value));
|
|
2533
|
-
else if (typeof value === "string") this.#payload.iat = validateInput("setIssuedAt", epoch_default(new Date()) + secs_default(value));
|
|
2533
|
+
else if (typeof value === "string") this.#payload.iat = validateInput("setIssuedAt", epoch_default(/* @__PURE__ */ new Date()) + secs_default(value));
|
|
2534
2534
|
else this.#payload.iat = validateInput("setIssuedAt", value);
|
|
2535
2535
|
}
|
|
2536
2536
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -2,11 +2,9 @@ import { Bundle, GetBundlesArgs, UpdateInfo } from "@hot-updater/core";
|
|
|
2
2
|
|
|
3
3
|
//#region src/getUpdateInfo.d.ts
|
|
4
4
|
declare const getUpdateInfo: (bundles: Bundle[], args: GetBundlesArgs) => Promise<UpdateInfo | null>;
|
|
5
|
-
|
|
6
5
|
//#endregion
|
|
7
6
|
//#region src/semverSatisfies.d.ts
|
|
8
7
|
declare const semverSatisfies: (targetAppVersion: string, currentVersion: string) => boolean;
|
|
9
|
-
|
|
10
8
|
//#endregion
|
|
11
9
|
//#region src/filterCompatibleAppVersions.d.ts
|
|
12
10
|
/**
|
|
@@ -18,7 +16,6 @@ declare const semverSatisfies: (targetAppVersion: string, currentVersion: string
|
|
|
18
16
|
* @returns Array of target app versions compatible with the current version
|
|
19
17
|
*/
|
|
20
18
|
declare const filterCompatibleAppVersions: (targetAppVersionList: string[], currentVersion: string) => string[];
|
|
21
|
-
|
|
22
19
|
//#endregion
|
|
23
20
|
//#region src/withJwtSignedUrl.d.ts
|
|
24
21
|
/**
|
|
@@ -45,7 +42,6 @@ declare const withJwtSignedUrl: <T extends {
|
|
|
45
42
|
fileUrl: string | null;
|
|
46
43
|
}) | null>;
|
|
47
44
|
declare const signToken: (key: string, jwtSecret: string) => Promise<string>;
|
|
48
|
-
|
|
49
45
|
//#endregion
|
|
50
46
|
//#region src/verifyJwtSignedUrl.d.ts
|
|
51
47
|
type SuccessResponse = {
|
|
@@ -93,6 +89,5 @@ declare const verifyJwtSignedUrl: ({
|
|
|
93
89
|
contentType?: string;
|
|
94
90
|
} | null>;
|
|
95
91
|
}) => Promise<VerifyJwtSignedUrlResponse>;
|
|
96
|
-
|
|
97
92
|
//#endregion
|
|
98
93
|
export { ErrorResponse, SuccessResponse, VerifyJwtSignedUrlResponse, filterCompatibleAppVersions, getUpdateInfo, semverSatisfies, signToken, verifyJwtSignedUrl, verifyJwtToken, withJwtSignedUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,9 @@ import { Bundle, GetBundlesArgs, UpdateInfo } from "@hot-updater/core";
|
|
|
2
2
|
|
|
3
3
|
//#region src/getUpdateInfo.d.ts
|
|
4
4
|
declare const getUpdateInfo: (bundles: Bundle[], args: GetBundlesArgs) => Promise<UpdateInfo | null>;
|
|
5
|
-
|
|
6
5
|
//#endregion
|
|
7
6
|
//#region src/semverSatisfies.d.ts
|
|
8
7
|
declare const semverSatisfies: (targetAppVersion: string, currentVersion: string) => boolean;
|
|
9
|
-
|
|
10
8
|
//#endregion
|
|
11
9
|
//#region src/filterCompatibleAppVersions.d.ts
|
|
12
10
|
/**
|
|
@@ -18,7 +16,6 @@ declare const semverSatisfies: (targetAppVersion: string, currentVersion: string
|
|
|
18
16
|
* @returns Array of target app versions compatible with the current version
|
|
19
17
|
*/
|
|
20
18
|
declare const filterCompatibleAppVersions: (targetAppVersionList: string[], currentVersion: string) => string[];
|
|
21
|
-
|
|
22
19
|
//#endregion
|
|
23
20
|
//#region src/withJwtSignedUrl.d.ts
|
|
24
21
|
/**
|
|
@@ -45,7 +42,6 @@ declare const withJwtSignedUrl: <T extends {
|
|
|
45
42
|
fileUrl: string | null;
|
|
46
43
|
}) | null>;
|
|
47
44
|
declare const signToken: (key: string, jwtSecret: string) => Promise<string>;
|
|
48
|
-
|
|
49
45
|
//#endregion
|
|
50
46
|
//#region src/verifyJwtSignedUrl.d.ts
|
|
51
47
|
type SuccessResponse = {
|
|
@@ -93,6 +89,5 @@ declare const verifyJwtSignedUrl: ({
|
|
|
93
89
|
contentType?: string;
|
|
94
90
|
} | null>;
|
|
95
91
|
}) => Promise<VerifyJwtSignedUrlResponse>;
|
|
96
|
-
|
|
97
92
|
//#endregion
|
|
98
93
|
export { ErrorResponse, SuccessResponse, VerifyJwtSignedUrlResponse, filterCompatibleAppVersions, getUpdateInfo, semverSatisfies, signToken, verifyJwtSignedUrl, verifyJwtToken, withJwtSignedUrl };
|
package/dist/index.js
CHANGED
|
@@ -642,7 +642,7 @@ var require_lrucache = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_
|
|
|
642
642
|
var LRUCache = class {
|
|
643
643
|
constructor() {
|
|
644
644
|
this.max = 1e3;
|
|
645
|
-
this.map = new Map();
|
|
645
|
+
this.map = /* @__PURE__ */ new Map();
|
|
646
646
|
}
|
|
647
647
|
get(key) {
|
|
648
648
|
const value = this.map.get(key);
|
|
@@ -746,7 +746,7 @@ var require_range = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mod
|
|
|
746
746
|
return !!comp.match(re$1[t$1.COMPARATORLOOSE]);
|
|
747
747
|
});
|
|
748
748
|
debug$1("range list", rangeList);
|
|
749
|
-
const rangeMap = new Map();
|
|
749
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
750
750
|
const comparators = rangeList.map((comp) => new Comparator$4(comp, this.options));
|
|
751
751
|
for (const comp of comparators) {
|
|
752
752
|
if (isNullSet(comp)) return [comp];
|
|
@@ -1297,7 +1297,7 @@ var require_subset = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mo
|
|
|
1297
1297
|
else sub = minimumVersion;
|
|
1298
1298
|
if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
|
|
1299
1299
|
else dom = minimumVersion;
|
|
1300
|
-
const eqSet = new Set();
|
|
1300
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1301
1301
|
let gt$5, lt$4;
|
|
1302
1302
|
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt$5 = higherGT(gt$5, c, options);
|
|
1303
1303
|
else if (c.operator === "<" || c.operator === "<=") lt$4 = lowerLT(lt$4, c, options);
|
|
@@ -1456,7 +1456,7 @@ var require_semver = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mo
|
|
|
1456
1456
|
|
|
1457
1457
|
//#endregion
|
|
1458
1458
|
//#region src/semverSatisfies.ts
|
|
1459
|
-
var import_semver = __toESM(require_semver()
|
|
1459
|
+
var import_semver = __toESM(require_semver());
|
|
1460
1460
|
const semverSatisfies = (targetAppVersion, currentVersion) => {
|
|
1461
1461
|
const currentCoerce = import_semver.default.coerce(currentVersion);
|
|
1462
1462
|
if (!currentCoerce) return false;
|
|
@@ -1973,7 +1973,7 @@ var jwk_to_key_default = async (jwk) => {
|
|
|
1973
1973
|
//#region ../../node_modules/.pnpm/jose@6.0.10/node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
1974
1974
|
var validate_crit_default = (Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) => {
|
|
1975
1975
|
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) throw new Err("\"crit\" (Critical) Header Parameter MUST be integrity protected");
|
|
1976
|
-
if (!protectedHeader || protectedHeader.crit === void 0) return new Set();
|
|
1976
|
+
if (!protectedHeader || protectedHeader.crit === void 0) return /* @__PURE__ */ new Set();
|
|
1977
1977
|
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) throw new Err("\"crit\" (Critical) Header Parameter MUST be an array of non-empty strings when present");
|
|
1978
1978
|
let recognized;
|
|
1979
1979
|
if (recognizedOption !== void 0) recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
@@ -2013,7 +2013,7 @@ function isSecretJWK(key) {
|
|
|
2013
2013
|
//#region ../../node_modules/.pnpm/jose@6.0.10/node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
2014
2014
|
let cache;
|
|
2015
2015
|
const handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
2016
|
-
cache ||= new WeakMap();
|
|
2016
|
+
cache ||= /* @__PURE__ */ new WeakMap();
|
|
2017
2017
|
let cached = cache.get(key);
|
|
2018
2018
|
if (cached?.[alg]) return cached[alg];
|
|
2019
2019
|
const cryptoKey = await jwk_to_key_default({
|
|
@@ -2026,7 +2026,7 @@ const handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
2026
2026
|
return cryptoKey;
|
|
2027
2027
|
};
|
|
2028
2028
|
const handleKeyObject = (keyObject, alg) => {
|
|
2029
|
-
cache ||= new WeakMap();
|
|
2029
|
+
cache ||= /* @__PURE__ */ new WeakMap();
|
|
2030
2030
|
let cached = cache.get(keyObject);
|
|
2031
2031
|
if (cached?.[alg]) return cached[alg];
|
|
2032
2032
|
const isPublic = keyObject.type === "public";
|
|
@@ -2469,7 +2469,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
2469
2469
|
default: throw new TypeError("Invalid clockTolerance option type");
|
|
2470
2470
|
}
|
|
2471
2471
|
const { currentDate } = options;
|
|
2472
|
-
const now = epoch_default(currentDate || new Date());
|
|
2472
|
+
const now = epoch_default(currentDate || /* @__PURE__ */ new Date());
|
|
2473
2473
|
if ((payload.iat !== void 0 || maxTokenAge) && typeof payload.iat !== "number") throw new JWTClaimValidationFailed("\"iat\" claim must be a number", payload, "iat", "invalid");
|
|
2474
2474
|
if (payload.nbf !== void 0) {
|
|
2475
2475
|
if (typeof payload.nbf !== "number") throw new JWTClaimValidationFailed("\"nbf\" claim must be a number", payload, "nbf", "invalid");
|
|
@@ -2520,17 +2520,17 @@ var JWTClaimsBuilder = class {
|
|
|
2520
2520
|
set nbf(value) {
|
|
2521
2521
|
if (typeof value === "number") this.#payload.nbf = validateInput("setNotBefore", value);
|
|
2522
2522
|
else if (value instanceof Date) this.#payload.nbf = validateInput("setNotBefore", epoch_default(value));
|
|
2523
|
-
else this.#payload.nbf = epoch_default(new Date()) + secs_default(value);
|
|
2523
|
+
else this.#payload.nbf = epoch_default(/* @__PURE__ */ new Date()) + secs_default(value);
|
|
2524
2524
|
}
|
|
2525
2525
|
set exp(value) {
|
|
2526
2526
|
if (typeof value === "number") this.#payload.exp = validateInput("setExpirationTime", value);
|
|
2527
2527
|
else if (value instanceof Date) this.#payload.exp = validateInput("setExpirationTime", epoch_default(value));
|
|
2528
|
-
else this.#payload.exp = epoch_default(new Date()) + secs_default(value);
|
|
2528
|
+
else this.#payload.exp = epoch_default(/* @__PURE__ */ new Date()) + secs_default(value);
|
|
2529
2529
|
}
|
|
2530
2530
|
set iat(value) {
|
|
2531
|
-
if (typeof value === "undefined") this.#payload.iat = epoch_default(new Date());
|
|
2531
|
+
if (typeof value === "undefined") this.#payload.iat = epoch_default(/* @__PURE__ */ new Date());
|
|
2532
2532
|
else if (value instanceof Date) this.#payload.iat = validateInput("setIssuedAt", epoch_default(value));
|
|
2533
|
-
else if (typeof value === "string") this.#payload.iat = validateInput("setIssuedAt", epoch_default(new Date()) + secs_default(value));
|
|
2533
|
+
else if (typeof value === "string") this.#payload.iat = validateInput("setIssuedAt", epoch_default(/* @__PURE__ */ new Date()) + secs_default(value));
|
|
2534
2534
|
else this.#payload.iat = validateInput("setIssuedAt", value);
|
|
2535
2535
|
}
|
|
2536
2536
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/js",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@hot-updater/core": "0.18.
|
|
41
|
+
"@hot-updater/core": "0.18.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.9.4",
|