miqro 7.0.10 → 7.1.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/build/esm/src/inflate/inflate-sea.js +15 -15
- package/build/lib.cjs +100 -40
- package/package.json +3 -3
- package/sea/install-esbuild.sh +1 -1
- package/sea/install-nodejs.sh +1 -1
- package/sea/node.version.tag +1 -1
- package/src/inflate/inflate-sea.ts +15 -15
|
@@ -38,13 +38,13 @@ export async function inflateAppForSea(logger, inflateDir, services, port) {
|
|
|
38
38
|
inflateSeaAssets(logger, inflateDir);
|
|
39
39
|
writeFile(logger, resolve(inflateDir, "sea", "lib.cjs"), Buffer.from(getAsset("lib.cjs")));
|
|
40
40
|
const WSLIST = services.filter(service => getWSConfigPath(resolve(cwd(), service))).map(service => {
|
|
41
|
-
return `(await require("
|
|
41
|
+
return `(await require("./../${service}/ws.cjs")).default`;
|
|
42
42
|
}).join(",");
|
|
43
43
|
const LOGCONFIGLIST = services.filter(service => getLogConfigPath(resolve(cwd(), service))).map(service => {
|
|
44
|
-
return `{config: (await require("
|
|
44
|
+
return `{config: (await require("./../${service}/log.cjs")).default, service: "${service}" }`;
|
|
45
45
|
}).join(",");
|
|
46
46
|
const SERVERCONFIGLIST = services.filter(service => getServerConfigPath(resolve(cwd(), service))).map(service => {
|
|
47
|
-
return `(await require("
|
|
47
|
+
return `(await require("./../${service}/server.cjs")).default`;
|
|
48
48
|
}).join(",\n");
|
|
49
49
|
const DBCONFIGLIST = services.filter(service => getDBConfigPath(resolve(cwd(), service))).map(service => {
|
|
50
50
|
return `new Promise(async (resolve, reject) => {
|
|
@@ -141,20 +141,20 @@ main().catch(e=>console.error(e));
|
|
|
141
141
|
export async function inflateServiceForSea(logger, inflateDir, service, servicePath /*, serviceMigrations: string[]*/, serviceRouteFileMap, serviceStaticFileMap) {
|
|
142
142
|
const migrationsFolderPath = getMigrationsPath(servicePath);
|
|
143
143
|
const serviceMigrations = migrationsFolderPath ? migration.getSortedMigrations(migrationsFolderPath) : [];
|
|
144
|
-
writeFile(logger, join(inflateDir, "sea", service, "router.cjs"), `const { appendAPIModule, Router, middleware } = require("
|
|
144
|
+
writeFile(logger, join(inflateDir, "sea", service, "router.cjs"), `const { appendAPIModule, Router, middleware } = require("./${relative(service, "")}/lib.cjs");\n
|
|
145
145
|
async function setupRouter() {
|
|
146
146
|
const router = new Router();
|
|
147
147
|
${getErrorConfigPath(servicePath) ? `
|
|
148
|
-
const errorConfig = (await require("
|
|
148
|
+
const errorConfig = (await require("../${relative(service, "")}/${service}/catch.cjs")).default;
|
|
149
149
|
if(errorConfig && errorConfig.catch) {
|
|
150
150
|
for(const m of errorConfig.catch) {
|
|
151
151
|
router.catch(m);
|
|
152
152
|
}
|
|
153
153
|
}` : ""}
|
|
154
|
-
${getCORSConfigPath(servicePath) ? ` router.use(middleware.cors((await require("
|
|
155
|
-
${getAuthConfigPath(servicePath) ? ` router.use(middleware.session((await require("
|
|
154
|
+
${getCORSConfigPath(servicePath) ? ` router.use(middleware.cors((await require("../${relative(service, "")}/${service}/cors.cjs")).default));` : ""}
|
|
155
|
+
${getAuthConfigPath(servicePath) ? ` router.use(middleware.session((await require("../${relative(service, "")}/${service}/auth.cjs")).default));` : ""}
|
|
156
156
|
${getMiddlewareConfigPath(servicePath) ? `
|
|
157
|
-
const middlewareConfig = (await require("
|
|
157
|
+
const middlewareConfig = (await require("../${relative(service, "")}/${service}/middleware.cjs")).default;
|
|
158
158
|
if(middlewareConfig && middlewareConfig.middleware) {
|
|
159
159
|
for(const m of middlewareConfig.middleware) {
|
|
160
160
|
router.use(m);
|
|
@@ -167,8 +167,8 @@ ${Object.keys(serviceRouteFileMap)
|
|
|
167
167
|
const rPath = join(relative(cwd(), dirname(data.filePath)), basename(data.filePath));
|
|
168
168
|
if (rPath) {
|
|
169
169
|
const rPathExt = extname(rPath);
|
|
170
|
-
const apiInflatedPath = join("..", "
|
|
171
|
-
return ` await appendAPIModule(router, "
|
|
170
|
+
const apiInflatedPath = join("..", relative(service, ""), rPath.substring(0, rPath.length - rPathExt.length) + ".cjs");
|
|
171
|
+
return ` await appendAPIModule(router, "../${relative(service, "")}/${service}/http", "./${apiInflatedPath}", (await require("./${apiInflatedPath}")).default);`;
|
|
172
172
|
}
|
|
173
173
|
else {
|
|
174
174
|
return "";
|
|
@@ -189,23 +189,23 @@ ${getMiddlewareConfigPath(servicePath) ? `
|
|
|
189
189
|
module.exports = {
|
|
190
190
|
setupRouter
|
|
191
191
|
}`);
|
|
192
|
-
writeFile(logger, join(inflateDir, "sea", service, "migration-up.cjs"), `const { migration } = require("
|
|
192
|
+
writeFile(logger, join(inflateDir, "sea", service, "migration-up.cjs"), `const { migration } = require("./${relative(service, "")}/lib.cjs");\n
|
|
193
193
|
async function runMigrations(db) {
|
|
194
194
|
await migration.init(db);
|
|
195
195
|
${serviceMigrations.map(file => {
|
|
196
196
|
const name = `${file.substring(0, file.length - extname(file).length)}`;
|
|
197
|
-
return ` await migration.up.module(db, "${file}", (await require("
|
|
197
|
+
return ` await migration.up.module(db, "${file}", (await require("../${relative(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
198
198
|
}).join("\n")}
|
|
199
199
|
}
|
|
200
200
|
module.exports = {
|
|
201
201
|
runMigrations
|
|
202
202
|
}`);
|
|
203
|
-
writeFile(logger, join(inflateDir, "sea", service, "migration-down.cjs"), `const { migration } = require("
|
|
203
|
+
writeFile(logger, join(inflateDir, "sea", service, "migration-down.cjs"), `const { migration } = require("./${relative(service, "")}/lib.cjs");\n
|
|
204
204
|
async function runMigrations(db) {
|
|
205
205
|
await migration.init(db);
|
|
206
206
|
${serviceMigrations.reverse().map(file => {
|
|
207
207
|
const name = `${file.substring(0, file.length - extname(file).length)}`;
|
|
208
|
-
return ` await migration.down.module(db, "${file}", (await require("
|
|
208
|
+
return ` await migration.down.module(db, "${file}", (await require("../${relative(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
209
209
|
}).join("\n")}
|
|
210
210
|
}
|
|
211
211
|
module.exports = {
|
|
@@ -215,7 +215,7 @@ module.exports = {
|
|
|
215
215
|
/*if (staticFiles.length !== 0) {
|
|
216
216
|
writeFile(logger, join(inflateDir, "sea", service, "static.base64.json"), JSON.stringify(serviceStaticFileMap));
|
|
217
217
|
}*/
|
|
218
|
-
writeFile(logger, join(inflateDir, "sea", service, "static-router.cjs"), `const { appendAPIModule, Router } = require("
|
|
218
|
+
writeFile(logger, join(inflateDir, "sea", service, "static-router.cjs"), `const { appendAPIModule, Router } = require("./${relative(service, "")}/lib.cjs");\n
|
|
219
219
|
async function setupRouter() {
|
|
220
220
|
const router = new Router();
|
|
221
221
|
${staticFiles.length === 0 ? "" : `
|
package/build/lib.cjs
CHANGED
|
@@ -13052,13 +13052,13 @@ async function inflateAppForSea(logger, inflateDir, services, port) {
|
|
|
13052
13052
|
inflateSeaAssets(logger, inflateDir);
|
|
13053
13053
|
writeFile2(logger, (0, import_node_path14.resolve)(inflateDir, "sea", "lib.cjs"), Buffer.from(getAsset("lib.cjs")));
|
|
13054
13054
|
const WSLIST = services.filter((service) => getWSConfigPath((0, import_node_path14.resolve)((0, import_node_process10.cwd)(), service))).map((service) => {
|
|
13055
|
-
return `(await require("
|
|
13055
|
+
return `(await require("./../${service}/ws.cjs")).default`;
|
|
13056
13056
|
}).join(",");
|
|
13057
13057
|
const LOGCONFIGLIST = services.filter((service) => getLogConfigPath((0, import_node_path14.resolve)((0, import_node_process10.cwd)(), service))).map((service) => {
|
|
13058
|
-
return `{config: (await require("
|
|
13058
|
+
return `{config: (await require("./../${service}/log.cjs")).default, service: "${service}" }`;
|
|
13059
13059
|
}).join(",");
|
|
13060
13060
|
const SERVERCONFIGLIST = services.filter((service) => getServerConfigPath((0, import_node_path14.resolve)((0, import_node_process10.cwd)(), service))).map((service) => {
|
|
13061
|
-
return `(await require("
|
|
13061
|
+
return `(await require("./../${service}/server.cjs")).default`;
|
|
13062
13062
|
}).join(",\n");
|
|
13063
13063
|
const DBCONFIGLIST = services.filter((service) => getDBConfigPath((0, import_node_path14.resolve)((0, import_node_process10.cwd)(), service))).map((service) => {
|
|
13064
13064
|
return `new Promise(async (resolve, reject) => {
|
|
@@ -13165,21 +13165,21 @@ main().catch(e=>console.error(e));
|
|
|
13165
13165
|
async function inflateServiceForSea(logger, inflateDir, service, servicePath, serviceRouteFileMap, serviceStaticFileMap) {
|
|
13166
13166
|
const migrationsFolderPath = getMigrationsPath(servicePath);
|
|
13167
13167
|
const serviceMigrations = migrationsFolderPath ? lib_exports2.getSortedMigrations(migrationsFolderPath) : [];
|
|
13168
|
-
writeFile2(logger, (0, import_node_path14.join)(inflateDir, "sea", service, "router.cjs"), `const { appendAPIModule, Router, middleware } = require("
|
|
13168
|
+
writeFile2(logger, (0, import_node_path14.join)(inflateDir, "sea", service, "router.cjs"), `const { appendAPIModule, Router, middleware } = require("./${(0, import_node_path14.relative)(service, "")}/lib.cjs");
|
|
13169
13169
|
|
|
13170
13170
|
async function setupRouter() {
|
|
13171
13171
|
const router = new Router();
|
|
13172
13172
|
${getErrorConfigPath(servicePath) ? `
|
|
13173
|
-
const errorConfig = (await require("
|
|
13173
|
+
const errorConfig = (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/catch.cjs")).default;
|
|
13174
13174
|
if(errorConfig && errorConfig.catch) {
|
|
13175
13175
|
for(const m of errorConfig.catch) {
|
|
13176
13176
|
router.catch(m);
|
|
13177
13177
|
}
|
|
13178
13178
|
}` : ""}
|
|
13179
|
-
${getCORSConfigPath(servicePath) ? ` router.use(middleware.cors((await require("
|
|
13180
|
-
${getAuthConfigPath(servicePath) ? ` router.use(middleware.session((await require("
|
|
13179
|
+
${getCORSConfigPath(servicePath) ? ` router.use(middleware.cors((await require("../${(0, import_node_path14.relative)(service, "")}/${service}/cors.cjs")).default));` : ""}
|
|
13180
|
+
${getAuthConfigPath(servicePath) ? ` router.use(middleware.session((await require("../${(0, import_node_path14.relative)(service, "")}/${service}/auth.cjs")).default));` : ""}
|
|
13181
13181
|
${getMiddlewareConfigPath(servicePath) ? `
|
|
13182
|
-
const middlewareConfig = (await require("
|
|
13182
|
+
const middlewareConfig = (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/middleware.cjs")).default;
|
|
13183
13183
|
if(middlewareConfig && middlewareConfig.middleware) {
|
|
13184
13184
|
for(const m of middlewareConfig.middleware) {
|
|
13185
13185
|
router.use(m);
|
|
@@ -13189,8 +13189,8 @@ ${Object.keys(serviceRouteFileMap).map((filePath) => serviceRouteFileMap[filePat
|
|
|
13189
13189
|
const rPath = (0, import_node_path14.join)((0, import_node_path14.relative)((0, import_node_process10.cwd)(), (0, import_node_path14.dirname)(data.filePath)), (0, import_node_path14.basename)(data.filePath));
|
|
13190
13190
|
if (rPath) {
|
|
13191
13191
|
const rPathExt = (0, import_node_path14.extname)(rPath);
|
|
13192
|
-
const apiInflatedPath = (0, import_node_path14.join)("..", "
|
|
13193
|
-
return ` await appendAPIModule(router, "
|
|
13192
|
+
const apiInflatedPath = (0, import_node_path14.join)("..", (0, import_node_path14.relative)(service, ""), rPath.substring(0, rPath.length - rPathExt.length) + ".cjs");
|
|
13193
|
+
return ` await appendAPIModule(router, "../${(0, import_node_path14.relative)(service, "")}/${service}/http", "./${apiInflatedPath}", (await require("./${apiInflatedPath}")).default);`;
|
|
13194
13194
|
} else {
|
|
13195
13195
|
return "";
|
|
13196
13196
|
}
|
|
@@ -13209,32 +13209,32 @@ ${getMiddlewareConfigPath(servicePath) ? `
|
|
|
13209
13209
|
module.exports = {
|
|
13210
13210
|
setupRouter
|
|
13211
13211
|
}`);
|
|
13212
|
-
writeFile2(logger, (0, import_node_path14.join)(inflateDir, "sea", service, "migration-up.cjs"), `const { migration } = require("
|
|
13212
|
+
writeFile2(logger, (0, import_node_path14.join)(inflateDir, "sea", service, "migration-up.cjs"), `const { migration } = require("./${(0, import_node_path14.relative)(service, "")}/lib.cjs");
|
|
13213
13213
|
|
|
13214
13214
|
async function runMigrations(db) {
|
|
13215
13215
|
await migration.init(db);
|
|
13216
13216
|
${serviceMigrations.map((file) => {
|
|
13217
13217
|
const name = `${file.substring(0, file.length - (0, import_node_path14.extname)(file).length)}`;
|
|
13218
|
-
return ` await migration.up.module(db, "${file}", (await require("
|
|
13218
|
+
return ` await migration.up.module(db, "${file}", (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
13219
13219
|
}).join("\n")}
|
|
13220
13220
|
}
|
|
13221
13221
|
module.exports = {
|
|
13222
13222
|
runMigrations
|
|
13223
13223
|
}`);
|
|
13224
|
-
writeFile2(logger, (0, import_node_path14.join)(inflateDir, "sea", service, "migration-down.cjs"), `const { migration } = require("
|
|
13224
|
+
writeFile2(logger, (0, import_node_path14.join)(inflateDir, "sea", service, "migration-down.cjs"), `const { migration } = require("./${(0, import_node_path14.relative)(service, "")}/lib.cjs");
|
|
13225
13225
|
|
|
13226
13226
|
async function runMigrations(db) {
|
|
13227
13227
|
await migration.init(db);
|
|
13228
13228
|
${serviceMigrations.reverse().map((file) => {
|
|
13229
13229
|
const name = `${file.substring(0, file.length - (0, import_node_path14.extname)(file).length)}`;
|
|
13230
|
-
return ` await migration.down.module(db, "${file}", (await require("
|
|
13230
|
+
return ` await migration.down.module(db, "${file}", (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
13231
13231
|
}).join("\n")}
|
|
13232
13232
|
}
|
|
13233
13233
|
module.exports = {
|
|
13234
13234
|
runMigrations
|
|
13235
13235
|
}`);
|
|
13236
13236
|
const staticFiles = Object.keys(serviceStaticFileMap);
|
|
13237
|
-
writeFile2(logger, (0, import_node_path14.join)(inflateDir, "sea", service, "static-router.cjs"), `const { appendAPIModule, Router } = require("
|
|
13237
|
+
writeFile2(logger, (0, import_node_path14.join)(inflateDir, "sea", service, "static-router.cjs"), `const { appendAPIModule, Router } = require("./${(0, import_node_path14.relative)(service, "")}/lib.cjs");
|
|
13238
13238
|
|
|
13239
13239
|
async function setupRouter() {
|
|
13240
13240
|
const router = new Router();
|
|
@@ -14388,6 +14388,13 @@ function checkSigCryptoKey(key, alg, usage2) {
|
|
|
14388
14388
|
throw unusable("Ed25519");
|
|
14389
14389
|
break;
|
|
14390
14390
|
}
|
|
14391
|
+
case "ML-DSA-44":
|
|
14392
|
+
case "ML-DSA-65":
|
|
14393
|
+
case "ML-DSA-87": {
|
|
14394
|
+
if (!isAlgorithm(key.algorithm, alg))
|
|
14395
|
+
throw unusable(alg);
|
|
14396
|
+
break;
|
|
14397
|
+
}
|
|
14391
14398
|
case "ES256":
|
|
14392
14399
|
case "ES384":
|
|
14393
14400
|
case "ES512": {
|
|
@@ -14681,33 +14688,41 @@ var digest_default = async (algorithm, data) => {
|
|
|
14681
14688
|
function lengthAndInput(input) {
|
|
14682
14689
|
return concat(uint32be(input.length), input);
|
|
14683
14690
|
}
|
|
14684
|
-
async function concatKdf(
|
|
14685
|
-
const
|
|
14686
|
-
const
|
|
14687
|
-
|
|
14688
|
-
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14691
|
+
async function concatKdf(Z, L, OtherInfo) {
|
|
14692
|
+
const dkLen = L >> 3;
|
|
14693
|
+
const hashLen = 32;
|
|
14694
|
+
const reps = Math.ceil(dkLen / hashLen);
|
|
14695
|
+
const dk = new Uint8Array(reps * hashLen);
|
|
14696
|
+
for (let i = 1; i <= reps; i++) {
|
|
14697
|
+
const hashInput = new Uint8Array(4 + Z.length + OtherInfo.length);
|
|
14698
|
+
hashInput.set(uint32be(i), 0);
|
|
14699
|
+
hashInput.set(Z, 4);
|
|
14700
|
+
hashInput.set(OtherInfo, 4 + Z.length);
|
|
14701
|
+
const hashResult = await digest_default("sha256", hashInput);
|
|
14702
|
+
dk.set(hashResult, (i - 1) * hashLen);
|
|
14703
|
+
}
|
|
14704
|
+
return dk.slice(0, dkLen);
|
|
14695
14705
|
}
|
|
14696
14706
|
async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu = new Uint8Array(0), apv = new Uint8Array(0)) {
|
|
14697
14707
|
checkEncCryptoKey(publicKey, "ECDH");
|
|
14698
14708
|
checkEncCryptoKey(privateKey, "ECDH", "deriveBits");
|
|
14699
|
-
const
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
14706
|
-
const sharedSecret = new Uint8Array(await crypto.subtle.deriveBits({
|
|
14709
|
+
const algorithmID = lengthAndInput(encoder.encode(algorithm));
|
|
14710
|
+
const partyUInfo = lengthAndInput(apu);
|
|
14711
|
+
const partyVInfo = lengthAndInput(apv);
|
|
14712
|
+
const suppPubInfo = uint32be(keyLength);
|
|
14713
|
+
const suppPrivInfo = new Uint8Array(0);
|
|
14714
|
+
const otherInfo = concat(algorithmID, partyUInfo, partyVInfo, suppPubInfo, suppPrivInfo);
|
|
14715
|
+
const Z = new Uint8Array(await crypto.subtle.deriveBits({
|
|
14707
14716
|
name: publicKey.algorithm.name,
|
|
14708
14717
|
public: publicKey
|
|
14709
|
-
}, privateKey,
|
|
14710
|
-
return concatKdf(
|
|
14718
|
+
}, privateKey, getEcdhBitLength(publicKey)));
|
|
14719
|
+
return concatKdf(Z, keyLength, otherInfo);
|
|
14720
|
+
}
|
|
14721
|
+
function getEcdhBitLength(publicKey) {
|
|
14722
|
+
if (publicKey.algorithm.name === "X25519") {
|
|
14723
|
+
return 256;
|
|
14724
|
+
}
|
|
14725
|
+
return Math.ceil(parseInt(publicKey.algorithm.namedCurve.slice(-3), 10) / 8) << 3;
|
|
14711
14726
|
}
|
|
14712
14727
|
function allowed(key) {
|
|
14713
14728
|
switch (key.algorithm.namedCurve) {
|
|
@@ -14812,6 +14827,19 @@ function subtleMapping(jwk) {
|
|
|
14812
14827
|
let algorithm;
|
|
14813
14828
|
let keyUsages;
|
|
14814
14829
|
switch (jwk.kty) {
|
|
14830
|
+
case "AKP": {
|
|
14831
|
+
switch (jwk.alg) {
|
|
14832
|
+
case "ML-DSA-44":
|
|
14833
|
+
case "ML-DSA-65":
|
|
14834
|
+
case "ML-DSA-87":
|
|
14835
|
+
algorithm = { name: jwk.alg };
|
|
14836
|
+
keyUsages = jwk.priv ? ["sign"] : ["verify"];
|
|
14837
|
+
break;
|
|
14838
|
+
default:
|
|
14839
|
+
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
14840
|
+
}
|
|
14841
|
+
break;
|
|
14842
|
+
}
|
|
14815
14843
|
case "RSA": {
|
|
14816
14844
|
switch (jwk.alg) {
|
|
14817
14845
|
case "PS256":
|
|
@@ -14897,9 +14925,11 @@ var jwk_to_key_default = async (jwk) => {
|
|
|
14897
14925
|
}
|
|
14898
14926
|
const { algorithm, keyUsages } = subtleMapping(jwk);
|
|
14899
14927
|
const keyData = { ...jwk };
|
|
14900
|
-
|
|
14928
|
+
if (keyData.kty !== "AKP") {
|
|
14929
|
+
delete keyData.alg;
|
|
14930
|
+
}
|
|
14901
14931
|
delete keyData.use;
|
|
14902
|
-
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d ? false : true), jwk.key_ops ?? keyUsages);
|
|
14932
|
+
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
14903
14933
|
};
|
|
14904
14934
|
|
|
14905
14935
|
// node_modules/jose/dist/webapi/key/import.js
|
|
@@ -14920,6 +14950,16 @@ async function importJWK(jwk, alg, options) {
|
|
|
14920
14950
|
if ("oth" in jwk && jwk.oth !== void 0) {
|
|
14921
14951
|
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
14922
14952
|
}
|
|
14953
|
+
return jwk_to_key_default({ ...jwk, alg, ext });
|
|
14954
|
+
case "AKP": {
|
|
14955
|
+
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
14956
|
+
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
14957
|
+
}
|
|
14958
|
+
if (alg !== void 0 && alg !== jwk.alg) {
|
|
14959
|
+
throw new TypeError("JWK alg and alg option value mismatch");
|
|
14960
|
+
}
|
|
14961
|
+
return jwk_to_key_default({ ...jwk, ext });
|
|
14962
|
+
}
|
|
14923
14963
|
case "EC":
|
|
14924
14964
|
case "OKP":
|
|
14925
14965
|
return jwk_to_key_default({ ...jwk, alg, ext });
|
|
@@ -15169,10 +15209,10 @@ function isJWK(key) {
|
|
|
15169
15209
|
return is_object_default(key) && typeof key.kty === "string";
|
|
15170
15210
|
}
|
|
15171
15211
|
function isPrivateJWK(key) {
|
|
15172
|
-
return key.kty !== "oct" && typeof key.d === "string";
|
|
15212
|
+
return key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
15173
15213
|
}
|
|
15174
15214
|
function isPublicJWK(key) {
|
|
15175
|
-
return key.kty !== "oct" && typeof key.d === "undefined";
|
|
15215
|
+
return key.kty !== "oct" && typeof key.d === "undefined" && typeof key.priv === "undefined";
|
|
15176
15216
|
}
|
|
15177
15217
|
function isSecretJWK(key) {
|
|
15178
15218
|
return key.kty === "oct" && typeof key.k === "string";
|
|
@@ -15225,6 +15265,18 @@ var handleKeyObject = (keyObject, alg) => {
|
|
|
15225
15265
|
isPublic ? "verify" : "sign"
|
|
15226
15266
|
]);
|
|
15227
15267
|
}
|
|
15268
|
+
switch (keyObject.asymmetricKeyType) {
|
|
15269
|
+
case "ml-dsa-44":
|
|
15270
|
+
case "ml-dsa-65":
|
|
15271
|
+
case "ml-dsa-87": {
|
|
15272
|
+
if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
|
|
15273
|
+
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
15274
|
+
}
|
|
15275
|
+
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
15276
|
+
isPublic ? "verify" : "sign"
|
|
15277
|
+
]);
|
|
15278
|
+
}
|
|
15279
|
+
}
|
|
15228
15280
|
if (keyObject.asymmetricKeyType === "rsa") {
|
|
15229
15281
|
let hash;
|
|
15230
15282
|
switch (alg) {
|
|
@@ -15652,6 +15704,10 @@ async function keyToJWK(key) {
|
|
|
15652
15704
|
throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");
|
|
15653
15705
|
}
|
|
15654
15706
|
const { ext, key_ops, alg, use, ...jwk } = await crypto.subtle.exportKey("jwk", key);
|
|
15707
|
+
if (jwk.kty === "AKP") {
|
|
15708
|
+
;
|
|
15709
|
+
jwk.alg = alg;
|
|
15710
|
+
}
|
|
15655
15711
|
return jwk;
|
|
15656
15712
|
}
|
|
15657
15713
|
|
|
@@ -15917,6 +15973,10 @@ var subtle_dsa_default = (alg, algorithm) => {
|
|
|
15917
15973
|
case "Ed25519":
|
|
15918
15974
|
case "EdDSA":
|
|
15919
15975
|
return { name: "Ed25519" };
|
|
15976
|
+
case "ML-DSA-44":
|
|
15977
|
+
case "ML-DSA-65":
|
|
15978
|
+
case "ML-DSA-87":
|
|
15979
|
+
return { name: alg };
|
|
15920
15980
|
default:
|
|
15921
15981
|
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
15922
15982
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miqro",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/esm/src/lib.js",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@miqro/runner": "^2.0.1",
|
|
51
51
|
"@miqro/test": "^0.2.9",
|
|
52
52
|
"@miqro/test-http": "^0.1.2",
|
|
53
|
-
"esbuild": "0.25.
|
|
54
|
-
"jose": "6.0
|
|
53
|
+
"esbuild": "0.25.9 ",
|
|
54
|
+
"jose": "6.1.0",
|
|
55
55
|
"showdown": "2.1.0"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/sea/install-esbuild.sh
CHANGED
package/sea/install-nodejs.sh
CHANGED
package/sea/node.version.tag
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
24.
|
|
1
|
+
24.7.0
|
|
@@ -47,15 +47,15 @@ export async function inflateAppForSea(logger: Logger, inflateDir: string, servi
|
|
|
47
47
|
writeFile(logger, resolve(inflateDir, "sea", "lib.cjs"), Buffer.from(getAsset("lib.cjs")));
|
|
48
48
|
|
|
49
49
|
const WSLIST = services.filter(service => getWSConfigPath(resolve(cwd(), service))).map(service => {
|
|
50
|
-
return `(await require("
|
|
50
|
+
return `(await require("./../${service}/ws.cjs")).default`;
|
|
51
51
|
}).join(",");
|
|
52
52
|
|
|
53
53
|
const LOGCONFIGLIST = services.filter(service => getLogConfigPath(resolve(cwd(), service))).map(service => {
|
|
54
|
-
return `{config: (await require("
|
|
54
|
+
return `{config: (await require("./../${service}/log.cjs")).default, service: "${service}" }`;
|
|
55
55
|
}).join(",");
|
|
56
56
|
|
|
57
57
|
const SERVERCONFIGLIST = services.filter(service => getServerConfigPath(resolve(cwd(), service))).map(service => {
|
|
58
|
-
return `(await require("
|
|
58
|
+
return `(await require("./../${service}/server.cjs")).default`;
|
|
59
59
|
}).join(",\n");
|
|
60
60
|
|
|
61
61
|
const DBCONFIGLIST = services.filter(service => getDBConfigPath(resolve(cwd(), service))).map(service => {
|
|
@@ -159,20 +159,20 @@ export async function inflateServiceForSea(logger: Logger, inflateDir: string, s
|
|
|
159
159
|
const migrationsFolderPath = getMigrationsPath(servicePath);
|
|
160
160
|
|
|
161
161
|
const serviceMigrations: string[] = migrationsFolderPath ? migration.getSortedMigrations(migrationsFolderPath) : [];
|
|
162
|
-
writeFile(logger, join(inflateDir, "sea", service, "router.cjs"), `const { appendAPIModule, Router, middleware } = require("
|
|
162
|
+
writeFile(logger, join(inflateDir, "sea", service, "router.cjs"), `const { appendAPIModule, Router, middleware } = require("./${relative(service, "")}/lib.cjs");\n
|
|
163
163
|
async function setupRouter() {
|
|
164
164
|
const router = new Router();
|
|
165
165
|
${getErrorConfigPath(servicePath) ? `
|
|
166
|
-
const errorConfig = (await require("
|
|
166
|
+
const errorConfig = (await require("../${relative(service, "")}/${service}/catch.cjs")).default;
|
|
167
167
|
if(errorConfig && errorConfig.catch) {
|
|
168
168
|
for(const m of errorConfig.catch) {
|
|
169
169
|
router.catch(m);
|
|
170
170
|
}
|
|
171
171
|
}` : ""}
|
|
172
|
-
${getCORSConfigPath(servicePath) ? ` router.use(middleware.cors((await require("
|
|
173
|
-
${getAuthConfigPath(servicePath) ? ` router.use(middleware.session((await require("
|
|
172
|
+
${getCORSConfigPath(servicePath) ? ` router.use(middleware.cors((await require("../${relative(service, "")}/${service}/cors.cjs")).default));` : ""}
|
|
173
|
+
${getAuthConfigPath(servicePath) ? ` router.use(middleware.session((await require("../${relative(service, "")}/${service}/auth.cjs")).default));` : ""}
|
|
174
174
|
${getMiddlewareConfigPath(servicePath) ? `
|
|
175
|
-
const middlewareConfig = (await require("
|
|
175
|
+
const middlewareConfig = (await require("../${relative(service, "")}/${service}/middleware.cjs")).default;
|
|
176
176
|
if(middlewareConfig && middlewareConfig.middleware) {
|
|
177
177
|
for(const m of middlewareConfig.middleware) {
|
|
178
178
|
router.use(m);
|
|
@@ -185,8 +185,8 @@ ${Object.keys(serviceRouteFileMap)
|
|
|
185
185
|
const rPath = join(relative(cwd(), dirname(data.filePath)), basename(data.filePath));
|
|
186
186
|
if (rPath) {
|
|
187
187
|
const rPathExt = extname(rPath);
|
|
188
|
-
const apiInflatedPath = join("..", "
|
|
189
|
-
return ` await appendAPIModule(router, "
|
|
188
|
+
const apiInflatedPath = join("..", relative(service, ""), rPath.substring(0, rPath.length - rPathExt.length) + ".cjs");
|
|
189
|
+
return ` await appendAPIModule(router, "../${relative(service, "")}/${service}/http", "./${apiInflatedPath}", (await require("./${apiInflatedPath}")).default);`;
|
|
190
190
|
} else {
|
|
191
191
|
return "";
|
|
192
192
|
}
|
|
@@ -207,24 +207,24 @@ module.exports = {
|
|
|
207
207
|
setupRouter
|
|
208
208
|
}`);
|
|
209
209
|
|
|
210
|
-
writeFile(logger, join(inflateDir, "sea", service, "migration-up.cjs"), `const { migration } = require("
|
|
210
|
+
writeFile(logger, join(inflateDir, "sea", service, "migration-up.cjs"), `const { migration } = require("./${relative(service, "")}/lib.cjs");\n
|
|
211
211
|
async function runMigrations(db) {
|
|
212
212
|
await migration.init(db);
|
|
213
213
|
${serviceMigrations.map(file => {
|
|
214
214
|
const name = `${file.substring(0, file.length - extname(file).length)}`;
|
|
215
|
-
return ` await migration.up.module(db, "${file}", (await require("
|
|
215
|
+
return ` await migration.up.module(db, "${file}", (await require("../${relative(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
216
216
|
}).join("\n")}
|
|
217
217
|
}
|
|
218
218
|
module.exports = {
|
|
219
219
|
runMigrations
|
|
220
220
|
}`);
|
|
221
221
|
|
|
222
|
-
writeFile(logger, join(inflateDir, "sea", service, "migration-down.cjs"), `const { migration } = require("
|
|
222
|
+
writeFile(logger, join(inflateDir, "sea", service, "migration-down.cjs"), `const { migration } = require("./${relative(service, "")}/lib.cjs");\n
|
|
223
223
|
async function runMigrations(db) {
|
|
224
224
|
await migration.init(db);
|
|
225
225
|
${serviceMigrations.reverse().map(file => {
|
|
226
226
|
const name = `${file.substring(0, file.length - extname(file).length)}`;
|
|
227
|
-
return ` await migration.down.module(db, "${file}", (await require("
|
|
227
|
+
return ` await migration.down.module(db, "${file}", (await require("../${relative(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
228
228
|
}).join("\n")}
|
|
229
229
|
}
|
|
230
230
|
module.exports = {
|
|
@@ -235,7 +235,7 @@ module.exports = {
|
|
|
235
235
|
/*if (staticFiles.length !== 0) {
|
|
236
236
|
writeFile(logger, join(inflateDir, "sea", service, "static.base64.json"), JSON.stringify(serviceStaticFileMap));
|
|
237
237
|
}*/
|
|
238
|
-
writeFile(logger, join(inflateDir, "sea", service, "static-router.cjs"), `const { appendAPIModule, Router } = require("
|
|
238
|
+
writeFile(logger, join(inflateDir, "sea", service, "static-router.cjs"), `const { appendAPIModule, Router } = require("./${relative(service, "")}/lib.cjs");\n
|
|
239
239
|
async function setupRouter() {
|
|
240
240
|
const router = new Router();
|
|
241
241
|
${staticFiles.length === 0 ? "" : `
|