From 3ce30cd1c20c663898a0e38f7d56a1693ff7ee26 Mon Sep 17 00:00:00 2001 From: bojancrevar Date: Tue, 9 Sep 2025 15:23:59 +0200 Subject: [PATCH 1/6] first draft --- bindings/nodejs/Cargo.toml | 4 +- bindings/nodejs/index.js | 732 ++++++++++++++++++----------- bindings/nodejs/package.json | 2 +- bindings/nodejs/src/content.rs | 25 +- bindings/nodejs/src/custom_node.rs | 79 ++-- bindings/nodejs/src/engine.rs | 160 +++---- bindings/nodejs/src/loader.rs | 16 +- bindings/nodejs/src/safe_result.rs | 10 +- bindings/nodejs/src/types.rs | 5 +- 9 files changed, 591 insertions(+), 442 deletions(-) diff --git a/bindings/nodejs/Cargo.toml b/bindings/nodejs/Cargo.toml index 40f24c8d..f66c65de 100644 --- a/bindings/nodejs/Cargo.toml +++ b/bindings/nodejs/Cargo.toml @@ -9,8 +9,8 @@ publish = false crate-type = ["cdylib"] [dependencies] -napi = { version = "2.16", features = ["serde-json", "error_anyhow", "tokio_rt"] } -napi-derive = "2.16" +napi = { version = "3.3.0", features = ["serde-json", "error_anyhow", "tokio_rt", "compat-mode"] } +napi-derive = "3.2.5" tokio-util = { workspace = true, features = ["rt"] } serde_json = { workspace = true } zen-engine = { path = "../../core/engine" } diff --git a/bindings/nodejs/index.js b/bindings/nodejs/index.js index e6182636..e387fd2e 100644 --- a/bindings/nodejs/index.js +++ b/bindings/nodejs/index.js @@ -1,325 +1,521 @@ -/* tslint:disable */ +// prettier-ignore /* eslint-disable */ -/* prettier-ignore */ - +// @ts-nocheck /* auto-generated by NAPI-RS */ -const { existsSync, readFileSync } = require('fs') -const { join } = require('path') - -const { platform, arch } = process +const { createRequire } = require('node:module') +require = createRequire(__filename) +const { readFileSync } = require('node:fs') let nativeBinding = null -let localFileExisted = false -let loadError = null +const loadErrors = [] -function isMusl() { - // For Node 10 - if (!process.report || typeof process.report.getReport !== 'function') { - try { - const lddPath = require('child_process').execSync('which ldd').toString().trim() - return readFileSync(lddPath, 'utf8').includes('musl') - } catch (e) { +const isMusl = () => { + let musl = false + if (process.platform === 'linux') { + musl = isMuslFromFilesystem() + if (musl === null) { + musl = isMuslFromReport() + } + if (musl === null) { + musl = isMuslFromChildProcess() + } + } + return musl +} + +const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-') + +const isMuslFromFilesystem = () => { + try { + return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl') + } catch { + return null + } +} + +const isMuslFromReport = () => { + let report = null + if (typeof process.report?.getReport === 'function') { + process.report.excludeNetwork = true + report = process.report.getReport() + } + if (!report) { + return null + } + if (report.header && report.header.glibcVersionRuntime) { + return false + } + if (Array.isArray(report.sharedObjects)) { + if (report.sharedObjects.some(isFileMusl)) { return true } - } else { - const { glibcVersionRuntime } = process.report.getReport().header - return !glibcVersionRuntime } + return false } -switch (platform) { - case 'android': - switch (arch) { - case 'arm64': - localFileExisted = existsSync(join(__dirname, 'zen-engine.android-arm64.node')) +const isMuslFromChildProcess = () => { + try { + return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl') + } catch (e) { + // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false + return false + } +} + +function requireNative() { + if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) { + try { + nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH); + } catch (err) { + loadErrors.push(err) + } + } else if (process.platform === 'android') { + if (process.arch === 'arm64') { + try { + return require('./zen-engine.android-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-android-arm64') + const bindingPackageVersion = require('@gorules/zen-engine-android-arm64/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm') { + try { + return require('./zen-engine.android-arm-eabi.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-android-arm-eabi') + const bindingPackageVersion = require('@gorules/zen-engine-android-arm-eabi/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`)) + } + } else if (process.platform === 'win32') { + if (process.arch === 'x64') { + try { + return require('./zen-engine.win32-x64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-win32-x64-msvc') + const bindingPackageVersion = require('@gorules/zen-engine-win32-x64-msvc/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'ia32') { + try { + return require('./zen-engine.win32-ia32-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-win32-ia32-msvc') + const bindingPackageVersion = require('@gorules/zen-engine-win32-ia32-msvc/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./zen-engine.win32-arm64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-win32-arm64-msvc') + const bindingPackageVersion = require('@gorules/zen-engine-win32-arm64-msvc/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`)) + } + } else if (process.platform === 'darwin') { + try { + return require('./zen-engine.darwin-universal.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-darwin-universal') + const bindingPackageVersion = require('@gorules/zen-engine-darwin-universal/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + if (process.arch === 'x64') { + try { + return require('./zen-engine.darwin-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-darwin-x64') + const bindingPackageVersion = require('@gorules/zen-engine-darwin-x64/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./zen-engine.darwin-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-darwin-arm64') + const bindingPackageVersion = require('@gorules/zen-engine-darwin-arm64/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`)) + } + } else if (process.platform === 'freebsd') { + if (process.arch === 'x64') { + try { + return require('./zen-engine.freebsd-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-freebsd-x64') + const bindingPackageVersion = require('@gorules/zen-engine-freebsd-x64/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./zen-engine.freebsd-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-freebsd-arm64') + const bindingPackageVersion = require('@gorules/zen-engine-freebsd-arm64/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)) + } + } else if (process.platform === 'linux') { + if (process.arch === 'x64') { + if (isMusl()) { try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.android-arm64.node') - } else { - nativeBinding = require('@gorules/zen-engine-android-arm64') - } + return require('./zen-engine.linux-x64-musl.node') } catch (e) { - loadError = e + loadErrors.push(e) } - break - case 'arm': - localFileExisted = existsSync(join(__dirname, 'zen-engine.android-arm-eabi.node')) try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.android-arm-eabi.node') - } else { - nativeBinding = require('@gorules/zen-engine-android-arm-eabi') + const binding = require('@gorules/zen-engine-linux-x64-musl') + const bindingPackageVersion = require('@gorules/zen-engine-linux-x64-musl/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) } - break - default: - throw new Error(`Unsupported architecture on Android ${arch}`) - } - break - case 'win32': - switch (arch) { - case 'x64': - localFileExisted = existsSync( - join(__dirname, 'zen-engine.win32-x64-msvc.node') - ) + } else { try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.win32-x64-msvc.node') - } else { - nativeBinding = require('@gorules/zen-engine-win32-x64-msvc') - } + return require('./zen-engine.linux-x64-gnu.node') } catch (e) { - loadError = e + loadErrors.push(e) } - break - case 'ia32': - localFileExisted = existsSync( - join(__dirname, 'zen-engine.win32-ia32-msvc.node') - ) try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.win32-ia32-msvc.node') - } else { - nativeBinding = require('@gorules/zen-engine-win32-ia32-msvc') + const binding = require('@gorules/zen-engine-linux-x64-gnu') + const bindingPackageVersion = require('@gorules/zen-engine-linux-x64-gnu/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'arm64') { + if (isMusl()) { + try { + return require('./zen-engine.linux-arm64-musl.node') } catch (e) { - loadError = e + loadErrors.push(e) } - break - case 'arm64': - localFileExisted = existsSync( - join(__dirname, 'zen-engine.win32-arm64-msvc.node') - ) try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.win32-arm64-msvc.node') - } else { - nativeBinding = require('@gorules/zen-engine-win32-arm64-msvc') + const binding = require('@gorules/zen-engine-linux-arm64-musl') + const bindingPackageVersion = require('@gorules/zen-engine-linux-arm64-musl/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) } - break - default: - throw new Error(`Unsupported architecture on Windows: ${arch}`) - } - break - case 'darwin': - localFileExisted = existsSync(join(__dirname, 'zen-engine.darwin-universal.node')) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.darwin-universal.node') } else { - nativeBinding = require('@gorules/zen-engine-darwin-universal') - } - break - } catch {} - switch (arch) { - case 'x64': - localFileExisted = existsSync(join(__dirname, 'zen-engine.darwin-x64.node')) try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.darwin-x64.node') - } else { - nativeBinding = require('@gorules/zen-engine-darwin-x64') - } + return require('./zen-engine.linux-arm64-gnu.node') } catch (e) { - loadError = e + loadErrors.push(e) } - break - case 'arm64': - localFileExisted = existsSync( - join(__dirname, 'zen-engine.darwin-arm64.node') - ) try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.darwin-arm64.node') - } else { - nativeBinding = require('@gorules/zen-engine-darwin-arm64') + const binding = require('@gorules/zen-engine-linux-arm64-gnu') + const bindingPackageVersion = require('@gorules/zen-engine-linux-arm64-gnu/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) } - break - default: - throw new Error(`Unsupported architecture on macOS: ${arch}`) - } - break - case 'freebsd': - if (arch !== 'x64') { - throw new Error(`Unsupported architecture on FreeBSD: ${arch}`) - } - localFileExisted = existsSync(join(__dirname, 'zen-engine.freebsd-x64.node')) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.freebsd-x64.node') - } else { - nativeBinding = require('@gorules/zen-engine-freebsd-x64') } - } catch (e) { - loadError = e - } - break - case 'linux': - switch (arch) { - case 'x64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-x64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-x64-musl.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-x64-musl') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-x64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-x64-gnu.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-x64-gnu') - } - } catch (e) { - loadError = e - } + } else if (process.arch === 'arm') { + if (isMusl()) { + try { + return require('./zen-engine.linux-arm-musleabihf.node') + } catch (e) { + loadErrors.push(e) } - break - case 'arm64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-arm64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-arm64-musl.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-arm64-musl') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-arm64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-arm64-gnu.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-arm64-gnu') - } - } catch (e) { - loadError = e + try { + const binding = require('@gorules/zen-engine-linux-arm-musleabihf') + const bindingPackageVersion = require('@gorules/zen-engine-linux-arm-musleabihf/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding + } catch (e) { + loadErrors.push(e) } - break - case 'arm': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-arm-musleabihf.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-arm-musleabihf.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-arm-musleabihf') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-arm-gnueabihf.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-arm-gnueabihf.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-arm-gnueabihf') - } - } catch (e) { - loadError = e - } + } else { + try { + return require('./zen-engine.linux-arm-gnueabihf.node') + } catch (e) { + loadErrors.push(e) } - break - case 'riscv64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-riscv64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-riscv64-musl.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-riscv64-musl') - } - } catch (e) { - loadError = e + try { + const binding = require('@gorules/zen-engine-linux-arm-gnueabihf') + const bindingPackageVersion = require('@gorules/zen-engine-linux-arm-gnueabihf/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } - } else { - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-riscv64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-riscv64-gnu.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-riscv64-gnu') - } - } catch (e) { - loadError = e + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'riscv64') { + if (isMusl()) { + try { + return require('./zen-engine.linux-riscv64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-linux-riscv64-musl') + const bindingPackageVersion = require('@gorules/zen-engine-linux-riscv64-musl/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding + } catch (e) { + loadErrors.push(e) } - break - case 's390x': - localFileExisted = existsSync( - join(__dirname, 'zen-engine.linux-s390x-gnu.node') - ) + } else { try { - if (localFileExisted) { - nativeBinding = require('./zen-engine.linux-s390x-gnu.node') - } else { - nativeBinding = require('@gorules/zen-engine-linux-s390x-gnu') + return require('./zen-engine.linux-riscv64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-linux-riscv64-gnu') + const bindingPackageVersion = require('@gorules/zen-engine-linux-riscv64-gnu/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } + return binding } catch (e) { - loadError = e + loadErrors.push(e) } - break - default: - throw new Error(`Unsupported architecture on Linux: ${arch}`) + } + } else if (process.arch === 'ppc64') { + try { + return require('./zen-engine.linux-ppc64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-linux-ppc64-gnu') + const bindingPackageVersion = require('@gorules/zen-engine-linux-ppc64-gnu/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 's390x') { + try { + return require('./zen-engine.linux-s390x-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-linux-s390x-gnu') + const bindingPackageVersion = require('@gorules/zen-engine-linux-s390x-gnu/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`)) } - break - default: - throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`) + } else if (process.platform === 'openharmony') { + if (process.arch === 'arm64') { + try { + return require('./zen-engine.openharmony-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-openharmony-arm64') + const bindingPackageVersion = require('@gorules/zen-engine-openharmony-arm64/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'x64') { + try { + return require('./zen-engine.openharmony-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-openharmony-x64') + const bindingPackageVersion = require('@gorules/zen-engine-openharmony-x64/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm') { + try { + return require('./zen-engine.openharmony-arm.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@gorules/zen-engine-openharmony-arm') + const bindingPackageVersion = require('@gorules/zen-engine-openharmony-arm/package.json').version + if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`)) + } + } else { + loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`)) + } +} + +nativeBinding = requireNative() + +if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { + try { + nativeBinding = require('./zen-engine.wasi.cjs') + } catch (err) { + if (process.env.NAPI_RS_FORCE_WASI) { + loadErrors.push(err) + } + } + if (!nativeBinding) { + try { + nativeBinding = require('@gorules/zen-engine-wasm32-wasi') + } catch (err) { + if (process.env.NAPI_RS_FORCE_WASI) { + loadErrors.push(err) + } + } + } } if (!nativeBinding) { - if (loadError) { - throw loadError + if (loadErrors.length > 0) { + throw new Error( + `Cannot find native binding. ` + + `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` + + 'Please try `npm i` again after removing both package-lock.json and node_modules directory.', + { cause: loadErrors } + ) } throw new Error(`Failed to load native binding`) } -const { overrideConfig, ZenDecisionContent, ZenDecision, ZenEngine, evaluateExpressionSync, evaluateUnaryExpressionSync, renderTemplateSync, evaluateExpression, evaluateUnaryExpression, renderTemplate, ZenEngineHandlerRequest } = nativeBinding - -module.exports.overrideConfig = overrideConfig -module.exports.ZenDecisionContent = ZenDecisionContent -module.exports.ZenDecision = ZenDecision -module.exports.ZenEngine = ZenEngine -module.exports.evaluateExpressionSync = evaluateExpressionSync -module.exports.evaluateUnaryExpressionSync = evaluateUnaryExpressionSync -module.exports.renderTemplateSync = renderTemplateSync -module.exports.evaluateExpression = evaluateExpression -module.exports.evaluateUnaryExpression = evaluateUnaryExpression -module.exports.renderTemplate = renderTemplate -module.exports.ZenEngineHandlerRequest = ZenEngineHandlerRequest +module.exports = nativeBinding +module.exports.ZenDecision = nativeBinding.ZenDecision +module.exports.ZenDecisionContent = nativeBinding.ZenDecisionContent +module.exports.ZenEngine = nativeBinding.ZenEngine +module.exports.ZenEngineHandlerRequest = nativeBinding.ZenEngineHandlerRequest +module.exports.evaluateExpression = nativeBinding.evaluateExpression +module.exports.evaluateExpressionSync = nativeBinding.evaluateExpressionSync +module.exports.evaluateUnaryExpression = nativeBinding.evaluateUnaryExpression +module.exports.evaluateUnaryExpressionSync = nativeBinding.evaluateUnaryExpressionSync +module.exports.overrideConfig = nativeBinding.overrideConfig +module.exports.renderTemplate = nativeBinding.renderTemplate +module.exports.renderTemplateSync = nativeBinding.renderTemplateSync diff --git a/bindings/nodejs/package.json b/bindings/nodejs/package.json index 8f831c3f..6f50470c 100644 --- a/bindings/nodejs/package.json +++ b/bindings/nodejs/package.json @@ -51,7 +51,7 @@ }, "devDependencies": { "@jest/globals": "^29.7.0", - "@napi-rs/cli": "^2.18.4", + "@napi-rs/cli": "^3.1.5", "@types/express": "^5.0.1", "@types/node": "^22.14.1", "babel-jest": "^29.7.0", diff --git a/bindings/nodejs/src/content.rs b/bindings/nodejs/src/content.rs index ad8f65c2..02c1248c 100644 --- a/bindings/nodejs/src/content.rs +++ b/bindings/nodejs/src/content.rs @@ -1,7 +1,7 @@ use std::sync::Arc; -use napi::bindgen_prelude::Buffer; -use napi::{Either, Env, JsObject}; +use napi::bindgen_prelude::{Buffer, FromNapiValue, Object, ValidateNapiValue}; +use napi::{Either, Env}; use napi_derive::napi; use serde_json::Value; @@ -15,7 +15,7 @@ pub struct ZenDecisionContent { #[napi] impl ZenDecisionContent { #[napi(constructor)] - pub fn new(env: Env, content: Either) -> napi::Result { + pub fn new(env: Env, content: Either) -> napi::Result { let decision_content: DecisionContent = match content { Either::A(buf) => serde_json::from_slice(buf.as_ref())?, Either::B(obj) => { @@ -35,3 +35,22 @@ impl ZenDecisionContent { Ok(Buffer::from(content_vec)) } } + +// impl FromNapiValue for ZenDecisionContent { +// unsafe fn from_napi_value(env: napi::sys::napi_env, napi_val: napi::sys::napi_value) -> napi::Result { +// // Convert the JS value to an Object first +// let obj = Object::from_napi_value(env, napi_val)?; +// +// // Use your existing constructor logic +// let env_wrapper = Env::from_raw(env); +// Self::new(env_wrapper, Either::B(obj)) +// } +// } +// +// impl ValidateNapiValue for ZenDecisionContent { +// unsafe fn validate(env: napi::sys::napi_env, napi_val: napi::sys::napi_value) -> napi::Result { +// // Validate that the value can be converted to an Object +// // This is the most common validation for complex types +// Object::validate(env, napi_val) +// } +// } \ No newline at end of file diff --git a/bindings/nodejs/src/custom_node.rs b/bindings/nodejs/src/custom_node.rs index cb38f8d7..c6200402 100644 --- a/bindings/nodejs/src/custom_node.rs +++ b/bindings/nodejs/src/custom_node.rs @@ -1,26 +1,21 @@ -use crate::types::{ZenEngineHandlerRequest, ZenEngineHandlerResponse}; +use napi::anyhow::anyhow; use napi::bindgen_prelude::Promise; -use napi::threadsafe_function::{ErrorStrategy, ThreadsafeFunction}; -use std::fmt::{Debug, Formatter}; -use std::future::Future; -use std::pin::Pin; -use zen_engine::nodes::custom::{CustomNodeAdapter, CustomNodeRequest}; -use zen_engine::nodes::{NodeError, NodeResponse, NodeResult}; -use zen_engine::Variable; +use napi::Status; +use napi::threadsafe_function::{ThreadsafeFunction}; + +use zen_engine::handler::custom_node_adapter::{CustomNodeAdapter, CustomNodeRequest}; +use zen_engine::handler::node::{NodeResponse, NodeResult}; + +use crate::types::{ZenEngineHandlerRequest, ZenEngineHandlerResponse}; #[derive(Default)] pub(crate) struct CustomNode { - function: Option>, -} - -impl Debug for CustomNode { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "CustomNode") - } + function: Option + , ZenEngineHandlerRequest, Status, false>>, } impl CustomNode { - pub fn new(tsf: ThreadsafeFunction) -> Self { + pub fn new(tsf: ThreadsafeFunction, ZenEngineHandlerRequest, Status, false>) -> Self { Self { function: Some(tsf), } @@ -28,41 +23,27 @@ impl CustomNode { } impl CustomNodeAdapter for CustomNode { - fn handle(&self, request: CustomNodeRequest) -> Pin + '_>> { - Box::pin(async move { - let Some(function) = &self.function else { - return Err(NodeError { - node_id: request.node.id.clone(), - trace: None, - source: "Custom function is undefined".into(), - }); - }; - - let node_data = crate::types::DecisionNode::from(request.node.clone()); - - let promise: Promise = function - .clone() - .call_async(ZenEngineHandlerRequest { - input: request.input.to_value(), - node: node_data, - }) - .await - .map_err(|err| NodeError { - node_id: request.node.id.clone(), - trace: None, - source: err.reason.into(), - })?; + async fn handle(&self, request: CustomNodeRequest) -> NodeResult { + let Some(function) = &self.function else { + return Err(anyhow!("Custom function is undefined")); + }; + + let node_data = crate::types::DecisionNode::from(request.node); + + let promise: Promise = function + .clone() + .call_async(ZenEngineHandlerRequest { + input: request.input.to_value(), + node: node_data, + }) + .await + .map_err(|err| anyhow!(err.reason.clone()))?; //BC TODO clone? - let result = promise.await.map_err(|err| NodeError { - node_id: request.node.id.clone(), - trace: None, - source: err.reason.into(), - })?; + let result = promise.await.map_err(|err| anyhow!(err.reason.clone()))?; //BC TODO clone? - Ok(NodeResponse { - output: result.output.into(), - trace_data: result.trace_data.map(Variable::from), - }) + Ok(NodeResponse { + output: result.output.into(), + trace_data: result.trace_data, }) } } diff --git a/bindings/nodejs/src/engine.rs b/bindings/nodejs/src/engine.rs index 351005b7..51e96113 100644 --- a/bindings/nodejs/src/engine.rs +++ b/bindings/nodejs/src/engine.rs @@ -1,98 +1,41 @@ -use std::str::FromStr; use std::sync::Arc; use napi::anyhow::{anyhow, Context}; -use napi::bindgen_prelude::{Buffer, Either3, FromNapiValue, ToNapiValue}; -use napi::sys::{napi_env, napi_value}; -use napi::threadsafe_function::{ErrorStrategy, ThreadSafeCallContext, ThreadsafeFunction}; -use napi::{Env, JsFunction, JsObject, JsUnknown, NapiValue, ValueType}; +use napi::bindgen_prelude::{Buffer, Either3, Function, Object, Promise}; +use napi::threadsafe_function::{ThreadSafeCallContext, ThreadsafeFunction}; +use napi::{Either, Env, JsFunction, Status}; use napi_derive::napi; use serde_json::Value; +use zen_engine::model::DecisionContent; +use zen_engine::{DecisionEngine, EvaluationOptions}; + use crate::content::ZenDecisionContent; use crate::custom_node::CustomNode; use crate::decision::ZenDecision; use crate::loader::DecisionLoader; use crate::mt::spawn_worker; use crate::safe_result::SafeResult; -use crate::types::ZenEngineHandlerRequest; -use zen_engine::model::DecisionContent; -use zen_engine::{DecisionEngine, EvaluationSerializedOptions, EvaluationTraceKind}; +use crate::types::{ZenEngineHandlerRequest, ZenEngineHandlerResponse, ZenEngineResponse}; #[napi] pub struct ZenEngine { - graph: Arc, - - loader_ref: Option>, - custom_handler_ref: Option>, -} - -#[derive(Debug, Default)] -pub struct JsEvaluationTraceKind(pub EvaluationTraceKind); - -impl FromNapiValue for JsEvaluationTraceKind { - unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> napi::Result { - let js_value = JsUnknown::from_raw(env, napi_val)?; - - match js_value.get_type()? { - ValueType::Undefined | ValueType::Null => Ok(JsEvaluationTraceKind::default()), - ValueType::Boolean => { - let enabled = js_value.coerce_to_bool()?.get_value()?; - let kind = match enabled { - true => EvaluationTraceKind::Default, - false => EvaluationTraceKind::None, - }; - - Ok(JsEvaluationTraceKind(kind)) - } - ValueType::String => { - let kind_utf8 = js_value.coerce_to_string()?.into_utf8()?; - let kind_str = kind_utf8.as_str()?; - let kind = - EvaluationTraceKind::from_str(kind_str).context("invalid evaluation mode")?; - - Ok(JsEvaluationTraceKind(kind)) - } - _ => Err(anyhow!("Invalid trace setting").into()), - } - } -} - -impl ToNapiValue for JsEvaluationTraceKind { - unsafe fn to_napi_value(env: napi_env, val: Self) -> napi::Result { - match val.0 { - EvaluationTraceKind::None => ToNapiValue::to_napi_value(env, false), - EvaluationTraceKind::Default => ToNapiValue::to_napi_value(env, true), - _ => { - let mode_str: &'static str = val.0.into(); - ToNapiValue::to_napi_value(env, mode_str) - } - } - } + graph: Arc>, + loader_ref: Option>>, String, Status, false, false, 0>>, + custom_handler_ref: Option, ZenEngineHandlerRequest, Status, false, false, 0>>, } -#[derive(Debug)] #[napi(object)] pub struct ZenEvaluateOptions { pub max_depth: Option, - #[napi(ts_type = "boolean | 'string' | 'reference' | 'referenceString'")] - pub trace: Option, + pub trace: Option, } impl Default for ZenEvaluateOptions { fn default() -> Self { Self { max_depth: Some(5), - trace: Some(JsEvaluationTraceKind::default()), - } - } -} - -impl From for EvaluationSerializedOptions { - fn from(value: ZenEvaluateOptions) -> Self { - Self { - max_depth: value.max_depth.unwrap_or(5), - trace: value.trace.unwrap_or_default().0, + trace: Some(false), } } } @@ -100,10 +43,10 @@ impl From for EvaluationSerializedOptions { #[napi(object)] pub struct ZenEngineOptions { #[napi(ts_type = "(key: string) => Promise")] - pub loader: Option, + pub loader: Option>> >>, #[napi(ts_type = "(request: ZenEngineHandlerRequest) => Promise")] - pub custom_handler: Option, + pub custom_handler: Option>>, } #[napi] @@ -113,8 +56,8 @@ impl ZenEngine { let Some(opts) = options else { return Ok(Self { graph: DecisionEngine::new( - Arc::new(DecisionLoader::default()), - Arc::new(CustomNode::default()), + DecisionLoader::default().into(), + CustomNode::default().into(), ) .into(), @@ -125,60 +68,69 @@ impl ZenEngine { let loader_ref = match opts.loader { None => None, - Some(l) => Some(l.create_threadsafe_function( - 0, - |cx: ThreadSafeCallContext| { - cx.env.create_string(cx.value.as_str()).map(|v| vec![v]) - }, - )?), + Some(l) => Some(l.build_threadsafe_function() + .max_queue_size::<0>() + .callee_handled::() + .build()), }; let loader = match &loader_ref { None => DecisionLoader::default(), - Some(loader_fn) => DecisionLoader::new(loader_fn.clone())?, + Some(loader_fn) => DecisionLoader::new(loader_ref.unwrap().unwrap())?, }; let custom_handler_ref = match opts.custom_handler { None => None, - Some(custom_handler_fn) => Some(custom_handler_fn.create_threadsafe_function( - 0, - |cx: ThreadSafeCallContext| Ok(vec![cx.value]), - )?), + Some(custom_handler_fn) => Some(custom_handler_fn.build_threadsafe_function() + .max_queue_size::<0>() + .callee_handled::() + .build()), }; let custom_handler = match &custom_handler_ref { None => CustomNode::default(), - Some(custom_fn) => CustomNode::new(custom_fn.clone()), + Some(custom_fn) => CustomNode::default(), }; + let loader_for_struct = loader_ref.as_ref().and_then(|r| r.as_ref().ok()).cloned(); Ok(Self { - graph: DecisionEngine::new(Arc::new(loader), Arc::new(custom_handler)).into(), + graph: DecisionEngine::new(loader.into(), custom_handler.into()).into(), loader_ref, custom_handler_ref, }) } - #[napi(ts_return_type = "Promise")] + #[napi] pub async fn evaluate( &self, key: String, context: Value, opts: Option, - ) -> napi::Result { + ) -> napi::Result { let graph = self.graph.clone(); let result = spawn_worker(|| { let options = opts.unwrap_or_default(); async move { graph - .evaluate_serialized(key, context.into(), options.into()) + .evaluate_with_opts( + key, + context.into(), + EvaluationOptions { + max_depth: options.max_depth, + trace: options.trace, + }, + ) .await + .map(ZenEngineResponse::from) } }) .await .map_err(|_| anyhow!("Hook timed out"))? - .map_err(|e| anyhow!(e))?; + .map_err(|e| { + anyhow!(serde_json::to_string(e.as_ref()).unwrap_or_else(|_| e.to_string())) + })?; Ok(result) } @@ -187,7 +139,7 @@ impl ZenEngine { pub fn create_decision( &self, env: Env, - content: Either3<&ZenDecisionContent, Buffer, JsObject>, + content: Either3<&ZenDecisionContent, Buffer, Object>, ) -> napi::Result { let decision_content: Arc = match content { Either3::A(c) => c.inner.clone(), @@ -219,7 +171,7 @@ impl ZenEngine { key: String, context: Value, opts: Option, - ) -> SafeResult { + ) -> SafeResult { self.evaluate(key, context, opts).await.into() } @@ -228,16 +180,16 @@ impl ZenEngine { self.get_decision(key).await.into() } - /// Function used to dispose memory allocated for loaders - /// In the future, it will likely be removed and made automatic - #[napi] - pub fn dispose(&self) { - if let Some(loader) = self.loader_ref.clone() { - let _ = loader.abort(); - } - - if let Some(loader) = self.custom_handler_ref.clone() { - let _ = loader.abort(); - } - } + // Function used to dispose memory allocated for loaders + // In the future, it will likely be removed and made automatic + // #[napi] + // pub fn dispose(&self) { + // if let Some(loader) = self.loader_ref { + // let _ = loader.abort(); + // } + // + // if let Some(loader) = self.custom_handler_ref { + // let _ = loader.abort(); + // } + // } } diff --git a/bindings/nodejs/src/loader.rs b/bindings/nodejs/src/loader.rs index dfb0320b..bf10cc78 100644 --- a/bindings/nodejs/src/loader.rs +++ b/bindings/nodejs/src/loader.rs @@ -5,8 +5,8 @@ use std::sync::Arc; use napi::anyhow::anyhow; use napi::bindgen_prelude::{Buffer, Promise}; -use napi::threadsafe_function::{ErrorStrategy, ThreadsafeFunction}; -use napi::Either; +use napi::threadsafe_function::{ThreadsafeFunction}; +use napi::{Either, Status}; use zen_engine::loader::{ DecisionLoader as DecisionLoaderTrait, LoaderError, LoaderResponse, LoaderResult, @@ -15,9 +15,10 @@ use zen_engine::model::DecisionContent; use crate::content::ZenDecisionContent; +type FatalCallback = ThreadsafeFunction>>, T, Status, false, false, 0>; #[derive(Default)] pub(crate) struct DecisionLoader { - function: Option>, + function: Option>, } impl Debug for DecisionLoader { @@ -27,7 +28,7 @@ impl Debug for DecisionLoader { } impl DecisionLoader { - pub fn new(tsf: ThreadsafeFunction) -> napi::Result { + pub fn new(tsf: FatalCallback) -> napi::Result { Ok(Self { function: Some(tsf), }) @@ -42,18 +43,18 @@ impl DecisionLoader { .into()); }; - let promise: Promise>> = function + let promise: Promise>> = function .clone() .call_async(key.to_string()) .await .map_err(|e| LoaderError::Internal { key: key.to_string(), - source: anyhow!(e.reason), + source: anyhow!(e.reason.clone()), })?; let result = promise.await.map_err(|e| LoaderError::Internal { key: key.to_string(), - source: anyhow!(e.reason), + source: anyhow!(e.reason.clone()), })?; let Some(buffer) = result else { @@ -74,6 +75,7 @@ impl DecisionLoader { } } + impl DecisionLoaderTrait for DecisionLoader { fn load<'a>( &'a self, diff --git a/bindings/nodejs/src/safe_result.rs b/bindings/nodejs/src/safe_result.rs index 09f7db1e..fc428332 100644 --- a/bindings/nodejs/src/safe_result.rs +++ b/bindings/nodejs/src/safe_result.rs @@ -1,4 +1,4 @@ -use napi::bindgen_prelude::{ToNapiValue, TypeName}; +use napi::bindgen_prelude::{Object, ToNapiValue, TypeName}; use napi::sys::{napi_env, napi_value}; use napi::ValueType; @@ -20,8 +20,8 @@ where E: ToNapiValue, { unsafe fn to_napi_value(env: napi_env, val: Self) -> napi::Result { - let env_wrapper = napi::bindgen_prelude::Env::from(env); - let mut obj = env_wrapper.create_object()?; + let env_wrapper = &napi::bindgen_prelude::Env::from(env); + let mut obj = Object::new(env_wrapper).unwrap(); match val.0 { Ok(data) => { @@ -33,8 +33,8 @@ where obj.set("error", error)?; } } - - napi::bindgen_prelude::Object::to_napi_value(env, obj) + + Object::to_napi_value(env, obj) //TODO BC ? } } diff --git a/bindings/nodejs/src/types.rs b/bindings/nodejs/src/types.rs index dd4817e7..14ee94da 100644 --- a/bindings/nodejs/src/types.rs +++ b/bindings/nodejs/src/types.rs @@ -1,10 +1,9 @@ use json_dotpath::DotPaths; use napi::anyhow::{anyhow, Context}; use napi_derive::napi; -use serde_json::Value; use std::collections::HashMap; use std::sync::Arc; - +use serde_json::Value; use zen_engine::nodes::custom::CustomDecisionNode; use zen_engine::{DecisionGraphResponse, DecisionGraphTrace}; use zen_expression::Variable; @@ -83,7 +82,7 @@ impl From for DecisionNode { } } -#[napi] +#[napi(object)] pub struct ZenEngineHandlerRequest { pub input: Value, pub node: DecisionNode, From 20ca56e998c7698e5e503fe68af43cdbc1708dbf Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 9 Sep 2025 17:04:16 +0200 Subject: [PATCH 2/6] fix impl --- bindings/nodejs/Cargo.toml | 4 +- bindings/nodejs/index.d.ts | 119 ++--- bindings/nodejs/index.js | 92 ++-- bindings/nodejs/main.ts | 11 + bindings/nodejs/src/content.rs | 21 +- bindings/nodejs/src/custom_node.rs | 87 ++-- bindings/nodejs/src/engine.rs | 158 ++++--- bindings/nodejs/src/loader.rs | 27 +- bindings/nodejs/src/types.rs | 9 +- bindings/nodejs/tsconfig.json | 22 +- bindings/nodejs/yarn.lock | 720 ++++++++++++++++++++++++++++- 11 files changed, 1035 insertions(+), 235 deletions(-) create mode 100644 bindings/nodejs/main.ts diff --git a/bindings/nodejs/Cargo.toml b/bindings/nodejs/Cargo.toml index f66c65de..19d258a0 100644 --- a/bindings/nodejs/Cargo.toml +++ b/bindings/nodejs/Cargo.toml @@ -9,8 +9,8 @@ publish = false crate-type = ["cdylib"] [dependencies] -napi = { version = "3.3.0", features = ["serde-json", "error_anyhow", "tokio_rt", "compat-mode"] } -napi-derive = "3.2.5" +napi = { version = "3", features = ["serde-json", "error_anyhow", "tokio_rt", "compat-mode"] } +napi-derive = "3" tokio-util = { workspace = true, features = ["rt"] } serde_json = { workspace = true } zen-engine = { path = "../../core/engine" } diff --git a/bindings/nodejs/index.d.ts b/bindings/nodejs/index.d.ts index 111a624e..8584093d 100644 --- a/bindings/nodejs/index.d.ts +++ b/bindings/nodejs/index.d.ts @@ -1,27 +1,74 @@ -/* tslint:disable */ +/* auto-generated by NAPI-RS */ /* eslint-disable */ +export declare class ZenDecision { + constructor() + evaluate(context: any, opts?: ZenEvaluateOptions | undefined | null): Promise + safeEvaluate(context: any, opts?: ZenEvaluateOptions | undefined | null): Promise> + validate(): void +} -/* auto-generated by NAPI-RS */ +export declare class ZenDecisionContent { + constructor(content: Buffer | object) + toBuffer(): Buffer +} + +export declare class ZenEngine { + constructor(options?: ZenEngineOptions | undefined | null) + evaluate(key: string, context: any, opts?: ZenEvaluateOptions | undefined | null): Promise + createDecision(content: ZenDecisionContent | Buffer | object): ZenDecision + getDecision(key: string): Promise + safeEvaluate(key: string, context: any, opts?: ZenEvaluateOptions | undefined | null): Promise> + safeGetDecision(key: string): Promise> +} + +export declare class ZenEngineHandlerRequest { + constructor() + getField(path: string): unknown + getFieldRaw(path: string): unknown +} + +export interface DecisionNode { + id: string + name: string + kind: string + config: any +} + +export declare function evaluateExpression(expression: string, context?: any | undefined | null): Promise + +export declare function evaluateExpressionSync(expression: string, context?: any | undefined | null): any + +export declare function evaluateUnaryExpression(expression: string, context: any): Promise + +export declare function evaluateUnaryExpressionSync(expression: string, context: any): boolean + +export declare function overrideConfig(config: ZenConfig): void + +export declare function renderTemplate(template: string, context: any): Promise + +export declare function renderTemplateSync(template: string, context: any): any export interface ZenConfig { nodesInContext?: boolean functionTimeoutMillis?: number } -export declare function overrideConfig(config: ZenConfig): void -export interface ZenEvaluateOptions { - maxDepth?: number - trace?: boolean | 'string' | 'reference' | 'referenceString' + +export interface ZenEngineHandlerResponse { + output: any + traceData?: any } + export interface ZenEngineOptions { loader?: (key: string) => Promise customHandler?: (request: ZenEngineHandlerRequest) => Promise } -export declare function evaluateExpressionSync(expression: string, context?: any | undefined | null): any -export declare function evaluateUnaryExpressionSync(expression: string, context: any): boolean -export declare function renderTemplateSync(template: string, context: any): any -export declare function evaluateExpression(expression: string, context?: any | undefined | null): Promise -export declare function evaluateUnaryExpression(expression: string, context: any): Promise -export declare function renderTemplate(template: string, context: any): Promise + +export interface ZenEngineResponse { + performance: string + result: any + trace?: Record +} + export interface ZenEngineTrace { id: string name: string @@ -31,48 +78,8 @@ export interface ZenEngineTrace { traceData?: any order: number } -export interface ZenEngineResponse { - performance: string - result: any - trace?: Record -} -export interface ZenEngineHandlerResponse { - output: any - traceData?: any -} -export interface DecisionNode { - id: string - name: string - kind: string - config: any -} -export declare class ZenDecisionContent { - constructor(content: Buffer | object) - toBuffer(): Buffer -} -export declare class ZenDecision { - constructor() - evaluate(context: any, opts?: ZenEvaluateOptions | undefined | null): Promise - safeEvaluate(context: any, opts?: ZenEvaluateOptions | undefined | null): Promise> - validate(): void -} -export declare class ZenEngine { - constructor(options?: ZenEngineOptions | undefined | null) - evaluate(key: string, context: any, opts?: ZenEvaluateOptions | undefined | null): Promise - createDecision(content: ZenDecisionContent | Buffer | object): ZenDecision - getDecision(key: string): Promise - safeEvaluate(key: string, context: any, opts?: ZenEvaluateOptions | undefined | null): Promise> - safeGetDecision(key: string): Promise> - /** - * Function used to dispose memory allocated for loaders - * In the future, it will likely be removed and made automatic - */ - dispose(): void -} -export declare class ZenEngineHandlerRequest { - input: any - node: DecisionNode - constructor() - getField(path: string): unknown - getFieldRaw(path: string): unknown + +export interface ZenEvaluateOptions { + maxDepth?: number + trace?: boolean | 'string' | 'reference' | 'referenceString' } diff --git a/bindings/nodejs/index.js b/bindings/nodejs/index.js index e387fd2e..5bd2b879 100644 --- a/bindings/nodejs/index.js +++ b/bindings/nodejs/index.js @@ -80,8 +80,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-android-arm64') const bindingPackageVersion = require('@gorules/zen-engine-android-arm64/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -96,8 +96,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-android-arm-eabi') const bindingPackageVersion = require('@gorules/zen-engine-android-arm-eabi/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -116,8 +116,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-win32-x64-msvc') const bindingPackageVersion = require('@gorules/zen-engine-win32-x64-msvc/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -132,8 +132,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-win32-ia32-msvc') const bindingPackageVersion = require('@gorules/zen-engine-win32-ia32-msvc/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -148,8 +148,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-win32-arm64-msvc') const bindingPackageVersion = require('@gorules/zen-engine-win32-arm64-msvc/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -167,8 +167,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-darwin-universal') const bindingPackageVersion = require('@gorules/zen-engine-darwin-universal/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -183,8 +183,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-darwin-x64') const bindingPackageVersion = require('@gorules/zen-engine-darwin-x64/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -199,8 +199,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-darwin-arm64') const bindingPackageVersion = require('@gorules/zen-engine-darwin-arm64/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -219,8 +219,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-freebsd-x64') const bindingPackageVersion = require('@gorules/zen-engine-freebsd-x64/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -235,8 +235,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-freebsd-arm64') const bindingPackageVersion = require('@gorules/zen-engine-freebsd-arm64/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -256,8 +256,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-x64-musl') const bindingPackageVersion = require('@gorules/zen-engine-linux-x64-musl/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -272,8 +272,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-x64-gnu') const bindingPackageVersion = require('@gorules/zen-engine-linux-x64-gnu/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -290,8 +290,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-arm64-musl') const bindingPackageVersion = require('@gorules/zen-engine-linux-arm64-musl/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -306,8 +306,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-arm64-gnu') const bindingPackageVersion = require('@gorules/zen-engine-linux-arm64-gnu/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -324,8 +324,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-arm-musleabihf') const bindingPackageVersion = require('@gorules/zen-engine-linux-arm-musleabihf/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -340,8 +340,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-arm-gnueabihf') const bindingPackageVersion = require('@gorules/zen-engine-linux-arm-gnueabihf/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -358,8 +358,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-riscv64-musl') const bindingPackageVersion = require('@gorules/zen-engine-linux-riscv64-musl/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -374,8 +374,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-riscv64-gnu') const bindingPackageVersion = require('@gorules/zen-engine-linux-riscv64-gnu/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -391,8 +391,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-ppc64-gnu') const bindingPackageVersion = require('@gorules/zen-engine-linux-ppc64-gnu/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -407,8 +407,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-linux-s390x-gnu') const bindingPackageVersion = require('@gorules/zen-engine-linux-s390x-gnu/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -427,8 +427,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-openharmony-arm64') const bindingPackageVersion = require('@gorules/zen-engine-openharmony-arm64/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -443,8 +443,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-openharmony-x64') const bindingPackageVersion = require('@gorules/zen-engine-openharmony-x64/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -459,8 +459,8 @@ function requireNative() { try { const binding = require('@gorules/zen-engine-openharmony-arm') const bindingPackageVersion = require('@gorules/zen-engine-openharmony-arm/package.json').version - if (bindingPackageVersion !== '0.48.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.48.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.49.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.49.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { diff --git a/bindings/nodejs/main.ts b/bindings/nodejs/main.ts new file mode 100644 index 00000000..487b1438 --- /dev/null +++ b/bindings/nodejs/main.ts @@ -0,0 +1,11 @@ +import { ZenEngine } from './index'; +import fs from 'fs/promises'; +import path from 'path'; + +const testDataRoot = path.join(__dirname, '../../', 'test-data'); +const loader = async (key: string) => fs.readFile(path.join(testDataRoot, key)); + + +const engine = new ZenEngine({ loader }); + +console.log('hello'); \ No newline at end of file diff --git a/bindings/nodejs/src/content.rs b/bindings/nodejs/src/content.rs index 02c1248c..5767bfb1 100644 --- a/bindings/nodejs/src/content.rs +++ b/bindings/nodejs/src/content.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use napi::bindgen_prelude::{Buffer, FromNapiValue, Object, ValidateNapiValue}; +use napi::bindgen_prelude::{Buffer, Object}; use napi::{Either, Env}; use napi_derive::napi; use serde_json::Value; @@ -35,22 +35,3 @@ impl ZenDecisionContent { Ok(Buffer::from(content_vec)) } } - -// impl FromNapiValue for ZenDecisionContent { -// unsafe fn from_napi_value(env: napi::sys::napi_env, napi_val: napi::sys::napi_value) -> napi::Result { -// // Convert the JS value to an Object first -// let obj = Object::from_napi_value(env, napi_val)?; -// -// // Use your existing constructor logic -// let env_wrapper = Env::from_raw(env); -// Self::new(env_wrapper, Either::B(obj)) -// } -// } -// -// impl ValidateNapiValue for ZenDecisionContent { -// unsafe fn validate(env: napi::sys::napi_env, napi_val: napi::sys::napi_value) -> napi::Result { -// // Validate that the value can be converted to an Object -// // This is the most common validation for complex types -// Object::validate(env, napi_val) -// } -// } \ No newline at end of file diff --git a/bindings/nodejs/src/custom_node.rs b/bindings/nodejs/src/custom_node.rs index c6200402..dcb77889 100644 --- a/bindings/nodejs/src/custom_node.rs +++ b/bindings/nodejs/src/custom_node.rs @@ -1,21 +1,38 @@ -use napi::anyhow::anyhow; +use crate::types::{ZenEngineHandlerRequest, ZenEngineHandlerResponse}; use napi::bindgen_prelude::Promise; +use napi::threadsafe_function::ThreadsafeFunction; use napi::Status; -use napi::threadsafe_function::{ThreadsafeFunction}; - -use zen_engine::handler::custom_node_adapter::{CustomNodeAdapter, CustomNodeRequest}; -use zen_engine::handler::node::{NodeResponse, NodeResult}; +use std::fmt::{Debug, Formatter}; +use std::future::Future; +use std::pin::Pin; +use std::sync::Arc; +use zen_engine::nodes::custom::{CustomNodeAdapter, CustomNodeRequest}; +use zen_engine::nodes::{NodeError, NodeResponse, NodeResult}; +use zen_engine::Variable; -use crate::types::{ZenEngineHandlerRequest, ZenEngineHandlerResponse}; +type CustomNodeTsfn = Arc< + ThreadsafeFunction< + ZenEngineHandlerRequest, + Promise, + ZenEngineHandlerRequest, + Status, + false, + >, +>; #[derive(Default)] pub(crate) struct CustomNode { - function: Option - , ZenEngineHandlerRequest, Status, false>>, + function: Option, +} + +impl Debug for CustomNode { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "CustomNode") + } } impl CustomNode { - pub fn new(tsf: ThreadsafeFunction, ZenEngineHandlerRequest, Status, false>) -> Self { + pub fn new(tsf: CustomNodeTsfn) -> Self { Self { function: Some(tsf), } @@ -23,27 +40,41 @@ impl CustomNode { } impl CustomNodeAdapter for CustomNode { - async fn handle(&self, request: CustomNodeRequest) -> NodeResult { - let Some(function) = &self.function else { - return Err(anyhow!("Custom function is undefined")); - }; - - let node_data = crate::types::DecisionNode::from(request.node); - - let promise: Promise = function - .clone() - .call_async(ZenEngineHandlerRequest { - input: request.input.to_value(), - node: node_data, - }) - .await - .map_err(|err| anyhow!(err.reason.clone()))?; //BC TODO clone? + fn handle(&self, request: CustomNodeRequest) -> Pin + '_>> { + Box::pin(async move { + let Some(function) = &self.function else { + return Err(NodeError { + node_id: request.node.id.clone(), + trace: None, + source: "Custom function is undefined".into(), + }); + }; + + let node_data = crate::types::DecisionNode::from(request.node.clone()); - let result = promise.await.map_err(|err| anyhow!(err.reason.clone()))?; //BC TODO clone? + let promise: Promise = function + .clone() + .call_async(ZenEngineHandlerRequest { + input: request.input.to_value(), + node: node_data, + }) + .await + .map_err(|err| NodeError { + node_id: request.node.id.clone(), + trace: None, + source: err.reason.to_string().into(), + })?; - Ok(NodeResponse { - output: result.output.into(), - trace_data: result.trace_data, + let result = promise.await.map_err(|err| NodeError { + node_id: request.node.id.clone(), + trace: None, + source: err.reason.to_string().into(), + })?; + + Ok(NodeResponse { + output: result.output.into(), + trace_data: result.trace_data.map(Variable::from), + }) }) } } diff --git a/bindings/nodejs/src/engine.rs b/bindings/nodejs/src/engine.rs index 51e96113..796dc340 100644 --- a/bindings/nodejs/src/engine.rs +++ b/bindings/nodejs/src/engine.rs @@ -1,14 +1,18 @@ +use std::str::FromStr; use std::sync::Arc; use napi::anyhow::{anyhow, Context}; -use napi::bindgen_prelude::{Buffer, Either3, Function, Object, Promise}; -use napi::threadsafe_function::{ThreadSafeCallContext, ThreadsafeFunction}; -use napi::{Either, Env, JsFunction, Status}; +use napi::bindgen_prelude::{ + Buffer, Either3, FromNapiValue, Function, Object, Promise, SharedReference, ToNapiValue, + WeakReference, +}; +use napi::sys::{napi_env, napi_value}; +use napi::{Either, Env, JsValue, Unknown, ValueType}; use napi_derive::napi; use serde_json::Value; use zen_engine::model::DecisionContent; -use zen_engine::{DecisionEngine, EvaluationOptions}; +use zen_engine::{DecisionEngine, EvaluationSerializedOptions, EvaluationTraceKind}; use crate::content::ZenDecisionContent; use crate::custom_node::CustomNode; @@ -16,26 +20,79 @@ use crate::decision::ZenDecision; use crate::loader::DecisionLoader; use crate::mt::spawn_worker; use crate::safe_result::SafeResult; -use crate::types::{ZenEngineHandlerRequest, ZenEngineHandlerResponse, ZenEngineResponse}; +use crate::types::{ZenEngineHandlerRequest, ZenEngineHandlerResponse}; #[napi] pub struct ZenEngine { - graph: Arc>, - loader_ref: Option>>, String, Status, false, false, 0>>, - custom_handler_ref: Option, ZenEngineHandlerRequest, Status, false, false, 0>>, + graph: Arc, } +#[derive(Debug, Default)] +pub struct JsEvaluationTraceKind(pub EvaluationTraceKind); + +impl FromNapiValue for JsEvaluationTraceKind { + unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> napi::Result { + let js_value = Unknown::from_napi_value(env, napi_val)?; + + match js_value.get_type()? { + ValueType::Undefined | ValueType::Null => Ok(JsEvaluationTraceKind::default()), + ValueType::Boolean => { + let enabled = js_value.coerce_to_bool()?; + let kind = match enabled { + true => EvaluationTraceKind::Default, + false => EvaluationTraceKind::None, + }; + + Ok(JsEvaluationTraceKind(kind)) + } + ValueType::String => { + let kind_utf8 = js_value.coerce_to_string()?.into_utf8()?; + let kind_str = kind_utf8.as_str()?; + let kind = + EvaluationTraceKind::from_str(kind_str).context("invalid evaluation mode")?; + + Ok(JsEvaluationTraceKind(kind)) + } + _ => Err(anyhow!("Invalid trace setting").into()), + } + } +} + +impl ToNapiValue for JsEvaluationTraceKind { + unsafe fn to_napi_value(env: napi_env, val: Self) -> napi::Result { + match val.0 { + EvaluationTraceKind::None => ToNapiValue::to_napi_value(env, false), + EvaluationTraceKind::Default => ToNapiValue::to_napi_value(env, true), + _ => { + let mode_str: &'static str = val.0.into(); + ToNapiValue::to_napi_value(env, mode_str) + } + } + } +} + +#[derive(Debug)] #[napi(object)] pub struct ZenEvaluateOptions { pub max_depth: Option, - pub trace: Option, + #[napi(ts_type = "boolean | 'string' | 'reference' | 'referenceString'")] + pub trace: Option, } impl Default for ZenEvaluateOptions { fn default() -> Self { Self { max_depth: Some(5), - trace: Some(false), + trace: Some(JsEvaluationTraceKind::default()), + } + } +} + +impl From for EvaluationSerializedOptions { + fn from(value: ZenEvaluateOptions) -> Self { + Self { + max_depth: value.max_depth.unwrap_or(5), + trace: value.trace.unwrap_or_default().0, } } } @@ -43,10 +100,13 @@ impl Default for ZenEvaluateOptions { #[napi(object)] pub struct ZenEngineOptions { #[napi(ts_type = "(key: string) => Promise")] - pub loader: Option>> >>, + pub loader: Option< + Function<'static, String, Promise>>>, + >, #[napi(ts_type = "(request: ZenEngineHandlerRequest) => Promise")] - pub custom_handler: Option>>, + pub custom_handler: + Option>>, } #[napi] @@ -56,81 +116,64 @@ impl ZenEngine { let Some(opts) = options else { return Ok(Self { graph: DecisionEngine::new( - DecisionLoader::default().into(), - CustomNode::default().into(), + Arc::new(DecisionLoader::default()), + Arc::new(CustomNode::default()), ) .into(), - - loader_ref: None, - custom_handler_ref: None, }); }; - let loader_ref = match opts.loader { - None => None, - Some(l) => Some(l.build_threadsafe_function() - .max_queue_size::<0>() - .callee_handled::() - .build()), - }; - - let loader = match &loader_ref { + let loader = match opts.loader { None => DecisionLoader::default(), - Some(loader_fn) => DecisionLoader::new(loader_ref.unwrap().unwrap())?, - }; - - let custom_handler_ref = match opts.custom_handler { - None => None, - Some(custom_handler_fn) => Some(custom_handler_fn.build_threadsafe_function() - .max_queue_size::<0>() - .callee_handled::() - .build()), + Some(l) => { + let loader_tsfn = l + .build_threadsafe_function() + .max_queue_size::<0>() + .callee_handled::() + .build()?; + + DecisionLoader::new(Arc::new(loader_tsfn)) + } }; - let custom_handler = match &custom_handler_ref { + let custom_node = match opts.custom_handler { None => CustomNode::default(), - Some(custom_fn) => CustomNode::default(), + Some(c) => { + let custom_tfsn = c + .build_threadsafe_function() + .max_queue_size::<0>() + .callee_handled::() + .build()?; + + CustomNode::new(Arc::new(custom_tfsn)) + } }; - let loader_for_struct = loader_ref.as_ref().and_then(|r| r.as_ref().ok()).cloned(); Ok(Self { - graph: DecisionEngine::new(loader.into(), custom_handler.into()).into(), - - loader_ref, - custom_handler_ref, + graph: DecisionEngine::new(Arc::new(loader), Arc::new(custom_node)).into(), }) } - #[napi] + #[napi(ts_return_type = "Promise")] pub async fn evaluate( &self, key: String, context: Value, opts: Option, - ) -> napi::Result { + ) -> napi::Result { let graph = self.graph.clone(); let result = spawn_worker(|| { let options = opts.unwrap_or_default(); async move { graph - .evaluate_with_opts( - key, - context.into(), - EvaluationOptions { - max_depth: options.max_depth, - trace: options.trace, - }, - ) + .evaluate_serialized(key, context.into(), options.into()) .await - .map(ZenEngineResponse::from) } }) .await .map_err(|_| anyhow!("Hook timed out"))? - .map_err(|e| { - anyhow!(serde_json::to_string(e.as_ref()).unwrap_or_else(|_| e.to_string())) - })?; + .map_err(|e| anyhow!(e))?; Ok(result) } @@ -162,6 +205,7 @@ impl ZenEngine { .await .with_context(|| format!("Failed to find decision with key = {key}"))?; + // TODO: Investigate why reference leak? Ok(ZenDecision::from(decision)) } @@ -171,7 +215,7 @@ impl ZenEngine { key: String, context: Value, opts: Option, - ) -> SafeResult { + ) -> SafeResult { self.evaluate(key, context, opts).await.into() } diff --git a/bindings/nodejs/src/loader.rs b/bindings/nodejs/src/loader.rs index bf10cc78..ad0e4686 100644 --- a/bindings/nodejs/src/loader.rs +++ b/bindings/nodejs/src/loader.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use napi::anyhow::anyhow; use napi::bindgen_prelude::{Buffer, Promise}; -use napi::threadsafe_function::{ThreadsafeFunction}; +use napi::threadsafe_function::ThreadsafeFunction; use napi::{Either, Status}; use zen_engine::loader::{ @@ -15,10 +15,21 @@ use zen_engine::model::DecisionContent; use crate::content::ZenDecisionContent; -type FatalCallback = ThreadsafeFunction>>, T, Status, false, false, 0>; +type LoaderTsfn = Arc< + ThreadsafeFunction< + String, + Promise>>, + String, + Status, + false, + false, + 0, + >, +>; + #[derive(Default)] pub(crate) struct DecisionLoader { - function: Option>, + function: Option, } impl Debug for DecisionLoader { @@ -28,10 +39,10 @@ impl Debug for DecisionLoader { } impl DecisionLoader { - pub fn new(tsf: FatalCallback) -> napi::Result { - Ok(Self { + pub fn new(tsf: LoaderTsfn) -> Self { + Self { function: Some(tsf), - }) + } } pub async fn get_key(&self, key: &str) -> LoaderResult> { @@ -43,7 +54,7 @@ impl DecisionLoader { .into()); }; - let promise: Promise>> = function + let promise: Promise>> = function .clone() .call_async(key.to_string()) .await @@ -80,7 +91,7 @@ impl DecisionLoaderTrait for DecisionLoader { fn load<'a>( &'a self, key: &'a str, - ) -> Pin + Send + 'a>> { + ) -> Pin + 'a + Send>> { Box::pin(async move { let decision_content = self.get_key(key).await?; Ok(decision_content) diff --git a/bindings/nodejs/src/types.rs b/bindings/nodejs/src/types.rs index 14ee94da..fed0071a 100644 --- a/bindings/nodejs/src/types.rs +++ b/bindings/nodejs/src/types.rs @@ -1,9 +1,10 @@ use json_dotpath::DotPaths; use napi::anyhow::{anyhow, Context}; use napi_derive::napi; +use serde_json::Value; use std::collections::HashMap; use std::sync::Arc; -use serde_json::Value; + use zen_engine::nodes::custom::CustomDecisionNode; use zen_engine::{DecisionGraphResponse, DecisionGraphTrace}; use zen_expression::Variable; @@ -82,10 +83,10 @@ impl From for DecisionNode { } } -#[napi(object)] +#[napi] pub struct ZenEngineHandlerRequest { - pub input: Value, - pub node: DecisionNode, + pub(crate) input: Value, + pub(crate) node: DecisionNode, } #[napi] diff --git a/bindings/nodejs/tsconfig.json b/bindings/nodejs/tsconfig.json index 854d1caa..4f008aa7 100644 --- a/bindings/nodejs/tsconfig.json +++ b/bindings/nodejs/tsconfig.json @@ -9,8 +9,6 @@ "moduleResolution": "node", "newLine": "LF", "noEmitHelpers": true, - "noUnusedLocals": true, - "noUnusedParameters": true, "strict": true, "skipLibCheck": true, "suppressImplicitAnyIndexErrors": true, @@ -24,8 +22,22 @@ "resolveJsonModule": true, "importsNotUsedAsValues": "remove", "outDir": "dist", - "lib": ["dom", "DOM.Iterable", "ES2019", "ES2020", "esnext"] + "lib": [ + "dom", + "DOM.Iterable", + "ES2019", + "ES2020", + "esnext" + ] }, - "include": ["."], - "exclude": ["node_modules", "bench", "cli/scripts", "scripts", "target"] + "include": [ + "." + ], + "exclude": [ + "node_modules", + "bench", + "cli/scripts", + "scripts", + "target" + ] } \ No newline at end of file diff --git a/bindings/nodejs/yarn.lock b/bindings/nodejs/yarn.lock index 8296aa14..cce49f50 100644 --- a/bindings/nodejs/yarn.lock +++ b/bindings/nodejs/yarn.lock @@ -285,6 +285,28 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" +"@emnapi/core@^1.4.5": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.5.0.tgz#85cd84537ec989cebb2343606a1ee663ce4edaf0" + integrity sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg== + dependencies: + "@emnapi/wasi-threads" "1.1.0" + tslib "^2.4.0" + +"@emnapi/runtime@^1.4.5": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.5.0.tgz#9aebfcb9b17195dce3ab53c86787a6b7d058db73" + integrity sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ== + dependencies: + tslib "^2.4.0" + +"@emnapi/wasi-threads@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz#60b2102fddc9ccb78607e4a3cf8403ea69be41bf" + integrity sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ== + dependencies: + tslib "^2.4.0" + "@epic-web/invariant@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@epic-web/invariant/-/invariant-1.0.0.tgz#1073e5dee6dd540410784990eb73e4acd25c9813" @@ -300,6 +322,146 @@ resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== +"@inquirer/checkbox@^4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@inquirer/checkbox/-/checkbox-4.2.2.tgz#eabaa7eb6adbd64bb7bb7765c67c0a283ed616eb" + integrity sha512-E+KExNurKcUJJdxmjglTl141EwxWyAHplvsYJQgSwXf8qiNWkTxTuCCqmhFEmbIXd4zLaGMfQFJ6WrZ7fSeV3g== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/figures" "^1.0.13" + "@inquirer/type" "^3.0.8" + ansi-escapes "^4.3.2" + yoctocolors-cjs "^2.1.2" + +"@inquirer/confirm@^5.1.16": + version "5.1.16" + resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-5.1.16.tgz#4f99603e5c8a1b471b819343f708c75e8abd2b88" + integrity sha512-j1a5VstaK5KQy8Mu8cHmuQvN1Zc62TbLhjJxwHvKPPKEoowSF6h/0UdOpA9DNdWZ+9Inq73+puRq1df6OJ8Sag== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/type" "^3.0.8" + +"@inquirer/core@^10.2.0": + version "10.2.0" + resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-10.2.0.tgz#19ff527dbe0956891d825e320ecbc890bd6a1550" + integrity sha512-NyDSjPqhSvpZEMZrLCYUquWNl+XC/moEcVFqS55IEYIYsY0a1cUCevSqk7ctOlnm/RaSBU5psFryNlxcmGrjaA== + dependencies: + "@inquirer/figures" "^1.0.13" + "@inquirer/type" "^3.0.8" + ansi-escapes "^4.3.2" + cli-width "^4.1.0" + mute-stream "^2.0.0" + signal-exit "^4.1.0" + wrap-ansi "^6.2.0" + yoctocolors-cjs "^2.1.2" + +"@inquirer/editor@^4.2.18": + version "4.2.18" + resolved "https://registry.yarnpkg.com/@inquirer/editor/-/editor-4.2.18.tgz#1418aef90025046ad16306451effb6fb36db9664" + integrity sha512-yeQN3AXjCm7+Hmq5L6Dm2wEDeBRdAZuyZ4I7tWSSanbxDzqM0KqzoDbKM7p4ebllAYdoQuPJS6N71/3L281i6w== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/external-editor" "^1.0.1" + "@inquirer/type" "^3.0.8" + +"@inquirer/expand@^4.0.18": + version "4.0.18" + resolved "https://registry.yarnpkg.com/@inquirer/expand/-/expand-4.0.18.tgz#8bf1bcd1ee99b8fa02e1143ed5bf69dc576bacd7" + integrity sha512-xUjteYtavH7HwDMzq4Cn2X4Qsh5NozoDHCJTdoXg9HfZ4w3R6mxV1B9tL7DGJX2eq/zqtsFjhm0/RJIMGlh3ag== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/type" "^3.0.8" + yoctocolors-cjs "^2.1.2" + +"@inquirer/external-editor@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@inquirer/external-editor/-/external-editor-1.0.1.tgz#ab0a82c5719a963fb469021cde5cd2b74fea30f8" + integrity sha512-Oau4yL24d2B5IL4ma4UpbQigkVhzPDXLoqy1ggK4gnHg/stmkffJE4oOXHXF3uz0UEpywG68KcyXsyYpA1Re/Q== + dependencies: + chardet "^2.1.0" + iconv-lite "^0.6.3" + +"@inquirer/figures@^1.0.13": + version "1.0.13" + resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.13.tgz#ad0afd62baab1c23175115a9b62f511b6a751e45" + integrity sha512-lGPVU3yO9ZNqA7vTYz26jny41lE7yoQansmqdMLBEfqaGsmdg7V3W9mK9Pvb5IL4EVZ9GnSDGMO/cJXud5dMaw== + +"@inquirer/input@^4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@inquirer/input/-/input-4.2.2.tgz#98c420a3bff94ee19124f74a641cef2b1eb01b22" + integrity sha512-hqOvBZj/MhQCpHUuD3MVq18SSoDNHy7wEnQ8mtvs71K8OPZVXJinOzcvQna33dNYLYE4LkA9BlhAhK6MJcsVbw== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/type" "^3.0.8" + +"@inquirer/number@^3.0.18": + version "3.0.18" + resolved "https://registry.yarnpkg.com/@inquirer/number/-/number-3.0.18.tgz#b5595c02061498e2753fdfe35d9abae14e9223aa" + integrity sha512-7exgBm52WXZRczsydCVftozFTrrwbG5ySE0GqUd2zLNSBXyIucs2Wnm7ZKLe/aUu6NUg9dg7Q80QIHCdZJiY4A== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/type" "^3.0.8" + +"@inquirer/password@^4.0.18": + version "4.0.18" + resolved "https://registry.yarnpkg.com/@inquirer/password/-/password-4.0.18.tgz#7500139016247163a6c115228fcafbb9cb448941" + integrity sha512-zXvzAGxPQTNk/SbT3carAD4Iqi6A2JS2qtcqQjsL22uvD+JfQzUrDEtPjLL7PLn8zlSNyPdY02IiQjzoL9TStA== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/type" "^3.0.8" + ansi-escapes "^4.3.2" + +"@inquirer/prompts@^7.4.0": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@inquirer/prompts/-/prompts-7.8.4.tgz#ed150f6d03ad019a7dcc7a0adee7c3cb3790b03f" + integrity sha512-MuxVZ1en1g5oGamXV3DWP89GEkdD54alcfhHd7InUW5BifAdKQEK9SLFa/5hlWbvuhMPlobF0WAx7Okq988Jxg== + dependencies: + "@inquirer/checkbox" "^4.2.2" + "@inquirer/confirm" "^5.1.16" + "@inquirer/editor" "^4.2.18" + "@inquirer/expand" "^4.0.18" + "@inquirer/input" "^4.2.2" + "@inquirer/number" "^3.0.18" + "@inquirer/password" "^4.0.18" + "@inquirer/rawlist" "^4.1.6" + "@inquirer/search" "^3.1.1" + "@inquirer/select" "^4.3.2" + +"@inquirer/rawlist@^4.1.6": + version "4.1.6" + resolved "https://registry.yarnpkg.com/@inquirer/rawlist/-/rawlist-4.1.6.tgz#805e1c449dde2bdfd8bc7eca56e6fe40938a7dc7" + integrity sha512-KOZqa3QNr3f0pMnufzL7K+nweFFCCBs6LCXZzXDrVGTyssjLeudn5ySktZYv1XiSqobyHRYYK0c6QsOxJEhXKA== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/type" "^3.0.8" + yoctocolors-cjs "^2.1.2" + +"@inquirer/search@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@inquirer/search/-/search-3.1.1.tgz#f67a559c66043fe4fdc639c053578d34440b3c49" + integrity sha512-TkMUY+A2p2EYVY3GCTItYGvqT6LiLzHBnqsU1rJbrpXUijFfM6zvUx0R4civofVwFCmJZcKqOVwwWAjplKkhxA== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/figures" "^1.0.13" + "@inquirer/type" "^3.0.8" + yoctocolors-cjs "^2.1.2" + +"@inquirer/select@^4.3.2": + version "4.3.2" + resolved "https://registry.yarnpkg.com/@inquirer/select/-/select-4.3.2.tgz#7ff8942fb052c9c92110c9c044c7abb9b4ba9497" + integrity sha512-nwous24r31M+WyDEHV+qckXkepvihxhnyIaod2MG7eCE6G0Zm/HUF6jgN8GXgf4U7AU6SLseKdanY195cwvU6w== + dependencies: + "@inquirer/core" "^10.2.0" + "@inquirer/figures" "^1.0.13" + "@inquirer/type" "^3.0.8" + ansi-escapes "^4.3.2" + yoctocolors-cjs "^2.1.2" + +"@inquirer/type@^3.0.8": + version "3.0.8" + resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-3.0.8.tgz#efc293ba0ed91e90e6267f1aacc1c70d20b8b4e8" + integrity sha512-lg9Whz8onIHRthWaN1Q9EGLa/0LFJjyM8mEUbL1eTi6yMGvBf8gvyDLtxSXztQsxMvhxxNpJYrwa1YHdq+w4Jw== + "@isaacs/cliui@^8.0.2": version "8.0.2" resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" @@ -655,10 +817,342 @@ write-pkg "4.0.0" yargs "16.2.0" -"@napi-rs/cli@^2.18.4": - version "2.18.4" - resolved "https://registry.yarnpkg.com/@napi-rs/cli/-/cli-2.18.4.tgz#12bebfb7995902fa7ab43cc0b155a7f5a2caa873" - integrity sha512-SgJeA4df9DE2iAEpr3M2H0OKl/yjtg1BnRI5/JyowS71tUWhrfSu2LT0V3vlHET+g1hBVlrO60PmEXwUEKp8Mg== +"@napi-rs/cli@^3.1.5": + version "3.1.5" + resolved "https://registry.yarnpkg.com/@napi-rs/cli/-/cli-3.1.5.tgz#6c3c297b3b0e7b1ad08393f124e438e8c930dae7" + integrity sha512-Wn6ZPw27qJiEWglGjkaAa70AHuLtyPya6FvjINYJ5U20uvbRhoB0Ta2+bFTAFfUb9R+wvuFvog9JQdy65OmFAQ== + dependencies: + "@inquirer/prompts" "^7.4.0" + "@napi-rs/cross-toolchain" "^1.0.0" + "@napi-rs/wasm-tools" "^1.0.0" + "@octokit/rest" "^22.0.0" + clipanion "^4.0.0-rc.4" + colorette "^2.0.20" + debug "^4.4.0" + emnapi "^1.4.0" + es-toolkit "^1.39.8" + find-up "^7.0.0" + js-yaml "^4.1.0" + semver "^7.7.1" + typanion "^3.14.0" + +"@napi-rs/cross-toolchain@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@napi-rs/cross-toolchain/-/cross-toolchain-1.0.3.tgz#8e345d0c9a8aeeaf9287e7af1d4ce83476681373" + integrity sha512-ENPfLe4937bsKVTDA6zdABx4pq9w0tHqRrJHyaGxgaPq03a2Bd1unD5XSKjXJjebsABJ+MjAv1A2OvCgK9yehg== + dependencies: + "@napi-rs/lzma" "^1.4.5" + "@napi-rs/tar" "^1.1.0" + debug "^4.4.1" + +"@napi-rs/lzma-android-arm-eabi@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-android-arm-eabi/-/lzma-android-arm-eabi-1.4.5.tgz#c6722a1d7201e269fdb6ba997d28cb41223e515c" + integrity sha512-Up4gpyw2SacmyKWWEib06GhiDdF+H+CCU0LAV8pnM4aJIDqKKd5LHSlBht83Jut6frkB0vwEPmAkv4NjQ5u//Q== + +"@napi-rs/lzma-android-arm64@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-android-arm64/-/lzma-android-arm64-1.4.5.tgz#05df61667e84419e0550200b48169057b734806f" + integrity sha512-uwa8sLlWEzkAM0MWyoZJg0JTD3BkPknvejAFG2acUA1raXM8jLrqujWCdOStisXhqQjZ2nDMp3FV6cs//zjfuQ== + +"@napi-rs/lzma-darwin-arm64@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-darwin-arm64/-/lzma-darwin-arm64-1.4.5.tgz#c37a01c53f25cb7f014870d2ea6c5576138bcaaa" + integrity sha512-0Y0TQLQ2xAjVabrMDem1NhIssOZzF/y/dqetc6OT8mD3xMTDtF8u5BqZoX3MyPc9FzpsZw4ksol+w7DsxHrpMA== + +"@napi-rs/lzma-darwin-x64@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-darwin-x64/-/lzma-darwin-x64-1.4.5.tgz#555b1dd65d7b104d28b2a12d925d7059226c7f4b" + integrity sha512-vR2IUyJY3En+V1wJkwmbGWcYiT8pHloTAWdW4pG24+51GIq+intst6Uf6D/r46citObGZrlX0QvMarOkQeHWpw== + +"@napi-rs/lzma-freebsd-x64@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-freebsd-x64/-/lzma-freebsd-x64-1.4.5.tgz#683beff15b37774ec91e1de7b4d337894bf43694" + integrity sha512-XpnYQC5SVovO35tF0xGkbHYjsS6kqyNCjuaLQ2dbEblFRr5cAZVvsJ/9h7zj/5FluJPJRDojVNxGyRhTp4z2lw== + +"@napi-rs/lzma-linux-arm-gnueabihf@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-linux-arm-gnueabihf/-/lzma-linux-arm-gnueabihf-1.4.5.tgz#505f659a9131474b7270afa4a4e9caf709c4d213" + integrity sha512-ic1ZZMoRfRMwtSwxkyw4zIlbDZGC6davC9r+2oX6x9QiF247BRqqT94qGeL5ZP4Vtz0Hyy7TEViWhx5j6Bpzvw== + +"@napi-rs/lzma-linux-arm64-gnu@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-linux-arm64-gnu/-/lzma-linux-arm64-gnu-1.4.5.tgz#ecbb944635fa004a9415d1f50f165bc0d26d3807" + integrity sha512-asEp7FPd7C1Yi6DQb45a3KPHKOFBSfGuJWXcAd4/bL2Fjetb2n/KK2z14yfW8YC/Fv6x3rBM0VAZKmJuz4tysg== + +"@napi-rs/lzma-linux-arm64-musl@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-linux-arm64-musl/-/lzma-linux-arm64-musl-1.4.5.tgz#c0d17f40ce2db0b075469a28f233fd8ce31fbb95" + integrity sha512-yWjcPDgJ2nIL3KNvi4536dlT/CcCWO0DUyEOlBs/SacG7BeD6IjGh6yYzd3/X1Y3JItCbZoDoLUH8iB1lTXo3w== + +"@napi-rs/lzma-linux-ppc64-gnu@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-linux-ppc64-gnu/-/lzma-linux-ppc64-gnu-1.4.5.tgz#2f17b9d1fc920c6c511d2086c7623752172c2f07" + integrity sha512-0XRhKuIU/9ZjT4WDIG/qnX7Xz7mSQHYZo9Gb3MP2gcvBgr6BA4zywQ9k3gmQaPn9ECE+CZg2V7DV7kT+x2pUMQ== + +"@napi-rs/lzma-linux-riscv64-gnu@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-linux-riscv64-gnu/-/lzma-linux-riscv64-gnu-1.4.5.tgz#63c2a4e1157586252186e39604370d5b29c6db85" + integrity sha512-QrqDIPEUUB23GCpyQj/QFyMlr8SGxxyExeZz9OWFnHfb70kXdTLWrHS/hEI1Ru+lSbQ/6xRqeoGyQ4Aqdg+/RA== + +"@napi-rs/lzma-linux-s390x-gnu@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-linux-s390x-gnu/-/lzma-linux-s390x-gnu-1.4.5.tgz#6f2ca44bf5c5bef1b31d7516bf15d63c35cdf59f" + integrity sha512-k8RVM5aMhW86E9H0QXdquwojew4H3SwPxbRVbl49/COJQWCUjGi79X6mYruMnMPEznZinUiT1jgKbFo2A00NdA== + +"@napi-rs/lzma-linux-x64-gnu@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.4.5.tgz#54879d88a9c370687b5463c7c1b6208b718c1ab2" + integrity sha512-6rMtBgnIq2Wcl1rQdZsnM+rtCcVCbws1nF8S2NzaUsVaZv8bjrPiAa0lwg4Eqnn1d9lgwqT+cZgm5m+//K08Kw== + +"@napi-rs/lzma-linux-x64-musl@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-linux-x64-musl/-/lzma-linux-x64-musl-1.4.5.tgz#412705f6925f10f45122bd0f3e2fb6e597bed4f8" + integrity sha512-eiadGBKi7Vd0bCArBUOO/qqRYPHt/VQVvGyYvDFt6C2ZSIjlD+HuOl+2oS1sjf4CFjK4eDIog6EdXnL0NE6iyQ== + +"@napi-rs/lzma-wasm32-wasi@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-wasm32-wasi/-/lzma-wasm32-wasi-1.4.5.tgz#4b74abfd144371123cb6f5b7bad5bae868206ecf" + integrity sha512-+VyHHlr68dvey6fXc2hehw9gHVFIW3TtGF1XkcbAu65qVXsA9D/T+uuoRVqhE+JCyFHFrO0ixRbZDRK1XJt1sA== + dependencies: + "@napi-rs/wasm-runtime" "^1.0.3" + +"@napi-rs/lzma-win32-arm64-msvc@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-win32-arm64-msvc/-/lzma-win32-arm64-msvc-1.4.5.tgz#7ed8c80d588fa244a7fd55249cb0d011d04bf984" + integrity sha512-eewnqvIyyhHi3KaZtBOJXohLvwwN27gfS2G/YDWdfHlbz1jrmfeHAmzMsP5qv8vGB+T80TMHNkro4kYjeh6Deg== + +"@napi-rs/lzma-win32-ia32-msvc@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-win32-ia32-msvc/-/lzma-win32-ia32-msvc-1.4.5.tgz#e6f70ca87bd88370102aa610ee9e44ec28911b46" + integrity sha512-OeacFVRCJOKNU/a0ephUfYZ2Yt+NvaHze/4TgOwJ0J0P4P7X1mHzN+ig9Iyd74aQDXYqc7kaCXA2dpAOcH87Cg== + +"@napi-rs/lzma-win32-x64-msvc@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma-win32-x64-msvc/-/lzma-win32-x64-msvc-1.4.5.tgz#ecfcfe364e805915608ce0ff41ed4c950fdb51b8" + integrity sha512-T4I1SamdSmtyZgDXGAGP+y5LEK5vxHUFwe8mz6D4R7Sa5/WCxTcCIgPJ9BD7RkpO17lzhlaM2vmVvMy96Lvk9Q== + +"@napi-rs/lzma@^1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@napi-rs/lzma/-/lzma-1.4.5.tgz#43e17cdfe332a3f33fa640422da348db3d8825e1" + integrity sha512-zS5LuN1OBPAyZpda2ZZgYOEDC+xecUdAGnrvbYzjnLXkrq/OBC3B9qcRvlxbDR3k5H/gVfvef1/jyUqPknqjbg== + optionalDependencies: + "@napi-rs/lzma-android-arm-eabi" "1.4.5" + "@napi-rs/lzma-android-arm64" "1.4.5" + "@napi-rs/lzma-darwin-arm64" "1.4.5" + "@napi-rs/lzma-darwin-x64" "1.4.5" + "@napi-rs/lzma-freebsd-x64" "1.4.5" + "@napi-rs/lzma-linux-arm-gnueabihf" "1.4.5" + "@napi-rs/lzma-linux-arm64-gnu" "1.4.5" + "@napi-rs/lzma-linux-arm64-musl" "1.4.5" + "@napi-rs/lzma-linux-ppc64-gnu" "1.4.5" + "@napi-rs/lzma-linux-riscv64-gnu" "1.4.5" + "@napi-rs/lzma-linux-s390x-gnu" "1.4.5" + "@napi-rs/lzma-linux-x64-gnu" "1.4.5" + "@napi-rs/lzma-linux-x64-musl" "1.4.5" + "@napi-rs/lzma-wasm32-wasi" "1.4.5" + "@napi-rs/lzma-win32-arm64-msvc" "1.4.5" + "@napi-rs/lzma-win32-ia32-msvc" "1.4.5" + "@napi-rs/lzma-win32-x64-msvc" "1.4.5" + +"@napi-rs/tar-android-arm-eabi@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-android-arm-eabi/-/tar-android-arm-eabi-1.1.0.tgz#08ae6ebbaf38d416954a28ca09bf77410d5b0c2b" + integrity sha512-h2Ryndraj/YiKgMV/r5by1cDusluYIRT0CaE0/PekQ4u+Wpy2iUVqvzVU98ZPnhXaNeYxEvVJHNGafpOfaD0TA== + +"@napi-rs/tar-android-arm64@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-android-arm64/-/tar-android-arm64-1.1.0.tgz#825a76140116f89d7e930245bda9f70b196da565" + integrity sha512-DJFyQHr1ZxNZorm/gzc1qBNLF/FcKzcH0V0Vwan5P+o0aE2keQIGEjJ09FudkF9v6uOuJjHCVDdK6S6uHtShAw== + +"@napi-rs/tar-darwin-arm64@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-darwin-arm64/-/tar-darwin-arm64-1.1.0.tgz#8821616c40ea52ec2c00a055be56bf28dee76013" + integrity sha512-Zz2sXRzjIX4e532zD6xm2SjXEym6MkvfCvL2RMpG2+UwNVDVscHNcz3d47Pf3sysP2e2af7fBB3TIoK2f6trPw== + +"@napi-rs/tar-darwin-x64@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-darwin-x64/-/tar-darwin-x64-1.1.0.tgz#4a975e41932a145c58181cb43c8f483c3858e359" + integrity sha512-EI+CptIMNweT0ms9S3mkP/q+J6FNZ1Q6pvpJOEcWglRfyfQpLqjlC0O+dptruTPE8VamKYuqdjxfqD8hifZDOA== + +"@napi-rs/tar-freebsd-x64@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-freebsd-x64/-/tar-freebsd-x64-1.1.0.tgz#5ebc0633f257b258aacc59ac1420835513ed0967" + integrity sha512-J0PIqX+pl6lBIAckL/c87gpodLbjZB1OtIK+RDscKC9NLdpVv6VGOxzUV/fYev/hctcE8EfkLbgFOfpmVQPg2g== + +"@napi-rs/tar-linux-arm-gnueabihf@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-linux-arm-gnueabihf/-/tar-linux-arm-gnueabihf-1.1.0.tgz#1d309bd4f46f0490353d9608e79d260cf6c7cd43" + integrity sha512-SLgIQo3f3EjkZ82ZwvrEgFvMdDAhsxCYjyoSuWfHCz0U16qx3SuGCp8+FYOPYCECHN3ZlGjXnoAIt9ERd0dEUg== + +"@napi-rs/tar-linux-arm64-gnu@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-linux-arm64-gnu/-/tar-linux-arm64-gnu-1.1.0.tgz#88d974821f3f8e9ee6948b4d51c78c019dee88ad" + integrity sha512-d014cdle52EGaH6GpYTQOP9Py7glMO1zz/+ynJPjjzYFSxvdYx0byrjumZk2UQdIyGZiJO2MEFpCkEEKFSgPYA== + +"@napi-rs/tar-linux-arm64-musl@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-linux-arm64-musl/-/tar-linux-arm64-musl-1.1.0.tgz#ab2baee7b288df5e68cef0b2d12fa79d2a551b58" + integrity sha512-L/y1/26q9L/uBqiW/JdOb/Dc94egFvNALUZV2WCGKQXc6UByPBMgdiEyW2dtoYxYYYYc+AKD+jr+wQPcvX2vrQ== + +"@napi-rs/tar-linux-ppc64-gnu@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-linux-ppc64-gnu/-/tar-linux-ppc64-gnu-1.1.0.tgz#7500e60d27849ba36fa4802a346249974e7ecf74" + integrity sha512-EPE1K/80RQvPbLRJDJs1QmCIcH+7WRi0F73+oTe1582y9RtfGRuzAkzeBuAGRXAQEjRQw/RjtNqr6UTJ+8UuWQ== + +"@napi-rs/tar-linux-s390x-gnu@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-linux-s390x-gnu/-/tar-linux-s390x-gnu-1.1.0.tgz#cfc0923bfad1dea8ef9da22148a8d4932aa52d08" + integrity sha512-B2jhWiB1ffw1nQBqLUP1h4+J1ovAxBOoe5N2IqDMOc63fsPZKNqF1PvO/dIem8z7LL4U4bsfmhy3gBfu547oNQ== + +"@napi-rs/tar-linux-x64-gnu@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-linux-x64-gnu/-/tar-linux-x64-gnu-1.1.0.tgz#5fdf9e1bb12b10a951c6ab03268a9f8d9788c929" + integrity sha512-tbZDHnb9617lTnsDMGo/eAMZxnsQFnaRe+MszRqHguKfMwkisc9CCJnks/r1o84u5fECI+J/HOrKXgczq/3Oww== + +"@napi-rs/tar-linux-x64-musl@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-linux-x64-musl/-/tar-linux-x64-musl-1.1.0.tgz#f001fc0a0a2996dcf99e787a15eade8dce215e91" + integrity sha512-dV6cODlzbO8u6Anmv2N/ilQHq/AWz0xyltuXoLU3yUyXbZcnWYZuB2rL8OBGPmqNcD+x9NdScBNXh7vWN0naSQ== + +"@napi-rs/tar-wasm32-wasi@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-wasm32-wasi/-/tar-wasm32-wasi-1.1.0.tgz#c1c7df7738b23f1cdbcff261d5bea6968d0a3c9a" + integrity sha512-jIa9nb2HzOrfH0F8QQ9g3WE4aMH5vSI5/1NYVNm9ysCmNjCCtMXCAhlI3WKCdm/DwHf0zLqdrrtDFXODcNaqMw== + dependencies: + "@napi-rs/wasm-runtime" "^1.0.3" + +"@napi-rs/tar-win32-arm64-msvc@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-win32-arm64-msvc/-/tar-win32-arm64-msvc-1.1.0.tgz#4c8519eab28021e1eda0847433cab949d5389833" + integrity sha512-vfpG71OB0ijtjemp3WTdmBKJm9R70KM8vsSExMsIQtV0lVzP07oM1CW6JbNRPXNLhRoue9ofYLiUDk8bE0Hckg== + +"@napi-rs/tar-win32-ia32-msvc@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-win32-ia32-msvc/-/tar-win32-ia32-msvc-1.1.0.tgz#4f61af0da2c53b23f7d58c77970eaa4449e8eb79" + integrity sha512-hGPyPW60YSpOSgzfy68DLBHgi6HxkAM+L59ZZZPMQ0TOXjQg+p2EW87+TjZfJOkSpbYiEkULwa/f4a2hcVjsqQ== + +"@napi-rs/tar-win32-x64-msvc@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar-win32-x64-msvc/-/tar-win32-x64-msvc-1.1.0.tgz#eb63fb44ecde001cce6be238f175e66a06c15035" + integrity sha512-L6Ed1DxXK9YSCMyvpR8MiNAyKNkQLjsHsHK9E0qnHa8NzLFqzDKhvs5LfnWxM2kJ+F7m/e5n9zPm24kHb3LsVw== + +"@napi-rs/tar@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/tar/-/tar-1.1.0.tgz#acecd9e29f705a3f534d5fb3d8aa36b3266727d0" + integrity sha512-7cmzIu+Vbupriudo7UudoMRH2OA3cTw67vva8MxeoAe5S7vPFI7z0vp0pMXiA25S8IUJefImQ90FeJjl8fjEaQ== + optionalDependencies: + "@napi-rs/tar-android-arm-eabi" "1.1.0" + "@napi-rs/tar-android-arm64" "1.1.0" + "@napi-rs/tar-darwin-arm64" "1.1.0" + "@napi-rs/tar-darwin-x64" "1.1.0" + "@napi-rs/tar-freebsd-x64" "1.1.0" + "@napi-rs/tar-linux-arm-gnueabihf" "1.1.0" + "@napi-rs/tar-linux-arm64-gnu" "1.1.0" + "@napi-rs/tar-linux-arm64-musl" "1.1.0" + "@napi-rs/tar-linux-ppc64-gnu" "1.1.0" + "@napi-rs/tar-linux-s390x-gnu" "1.1.0" + "@napi-rs/tar-linux-x64-gnu" "1.1.0" + "@napi-rs/tar-linux-x64-musl" "1.1.0" + "@napi-rs/tar-wasm32-wasi" "1.1.0" + "@napi-rs/tar-win32-arm64-msvc" "1.1.0" + "@napi-rs/tar-win32-ia32-msvc" "1.1.0" + "@napi-rs/tar-win32-x64-msvc" "1.1.0" + +"@napi-rs/wasm-runtime@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.0.3.tgz#24593dbd6fd1454b0b9c8b73bf7ac62d92a6bf63" + integrity sha512-rZxtMsLwjdXkMUGC3WwsPwLNVqVqnTJT6MNIB6e+5fhMcSCPP0AOsNWuMQ5mdCq6HNjs/ZeWAEchpqeprqBD2Q== + dependencies: + "@emnapi/core" "^1.4.5" + "@emnapi/runtime" "^1.4.5" + "@tybys/wasm-util" "^0.10.0" + +"@napi-rs/wasm-tools-android-arm-eabi@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-android-arm-eabi/-/wasm-tools-android-arm-eabi-1.0.1.tgz#a709f93ddd95508a4ef949b5ceff2b2e85b676f7" + integrity sha512-lr07E/l571Gft5v4aA1dI8koJEmF1F0UigBbsqg9OWNzg80H3lDPO+auv85y3T/NHE3GirDk7x/D3sLO57vayw== + +"@napi-rs/wasm-tools-android-arm64@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-android-arm64/-/wasm-tools-android-arm64-1.0.1.tgz#304b5761b4fcc871b876ebd34975c72c9d11a7fc" + integrity sha512-WDR7S+aRLV6LtBJAg5fmjKkTZIdrEnnQxgdsb7Cf8pYiMWBHLU+LC49OUVppQ2YSPY0+GeYm9yuZWW3kLjJ7Bg== + +"@napi-rs/wasm-tools-darwin-arm64@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-darwin-arm64/-/wasm-tools-darwin-arm64-1.0.1.tgz#dafb4330986a8b46e8de1603ea2f6932a19634c6" + integrity sha512-qWTI+EEkiN0oIn/N2gQo7+TVYil+AJ20jjuzD2vATS6uIjVz+Updeqmszi7zq7rdFTLp6Ea3/z4kDKIfZwmR9g== + +"@napi-rs/wasm-tools-darwin-x64@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-darwin-x64/-/wasm-tools-darwin-x64-1.0.1.tgz#0919e63714ee0a52b1120f6452bbc3a4d793ce3c" + integrity sha512-bA6hubqtHROR5UI3tToAF/c6TDmaAgF0SWgo4rADHtQ4wdn0JeogvOk50gs2TYVhKPE2ZD2+qqt7oBKB+sxW3A== + +"@napi-rs/wasm-tools-freebsd-x64@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-freebsd-x64/-/wasm-tools-freebsd-x64-1.0.1.tgz#1f50a2d5d5af041c55634f43f623ae49192bce9c" + integrity sha512-90+KLBkD9hZEjPQW1MDfwSt5J1L46EUKacpCZWyRuL6iIEO5CgWU0V/JnEgFsDOGyyYtiTvHc5bUdUTWd4I9Vg== + +"@napi-rs/wasm-tools-linux-arm64-gnu@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-linux-arm64-gnu/-/wasm-tools-linux-arm64-gnu-1.0.1.tgz#6106d5e65a25ec2ae417c2fcfebd5c8f14d80e84" + integrity sha512-rG0QlS65x9K/u3HrKafDf8cFKj5wV2JHGfl8abWgKew0GVPyp6vfsDweOwHbWAjcHtp2LHi6JHoW80/MTHm52Q== + +"@napi-rs/wasm-tools-linux-arm64-musl@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-linux-arm64-musl/-/wasm-tools-linux-arm64-musl-1.0.1.tgz#0eb3d4d1fbc1938b0edd907423840365ebc53859" + integrity sha512-jAasbIvjZXCgX0TCuEFQr+4D6Lla/3AAVx2LmDuMjgG4xoIXzjKWl7c4chuaD+TI+prWT0X6LJcdzFT+ROKGHQ== + +"@napi-rs/wasm-tools-linux-x64-gnu@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-linux-x64-gnu/-/wasm-tools-linux-x64-gnu-1.0.1.tgz#5de6a567083a83efed16d046f47b680cbe7c9b53" + integrity sha512-Plgk5rPqqK2nocBGajkMVbGm010Z7dnUgq0wtnYRZbzWWxwWcXfZMPa8EYxrK4eE8SzpI7VlZP1tdVsdjgGwMw== + +"@napi-rs/wasm-tools-linux-x64-musl@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-linux-x64-musl/-/wasm-tools-linux-x64-musl-1.0.1.tgz#04cc17ef12b4e5012f2d0e46b09cabe473566e5a" + integrity sha512-GW7AzGuWxtQkyHknHWYFdR0CHmW6is8rG2Rf4V6GNmMpmwtXt/ItWYWtBe4zqJWycMNazpfZKSw/BpT7/MVCXQ== + +"@napi-rs/wasm-tools-wasm32-wasi@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-wasm32-wasi/-/wasm-tools-wasm32-wasi-1.0.1.tgz#6ced3bd03428c854397f00509b1694c3af857a0f" + integrity sha512-/nQVSTrqSsn7YdAc2R7Ips/tnw5SPUcl3D7QrXCNGPqjbatIspnaexvaOYNyKMU6xPu+pc0BTnKVmqhlJJCPLA== + dependencies: + "@napi-rs/wasm-runtime" "^1.0.3" + +"@napi-rs/wasm-tools-win32-arm64-msvc@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-win32-arm64-msvc/-/wasm-tools-win32-arm64-msvc-1.0.1.tgz#e776f66eb637eee312b562e987c0a5871ddc6dac" + integrity sha512-PFi7oJIBu5w7Qzh3dwFea3sHRO3pojMsaEnUIy22QvsW+UJfNQwJCryVrpoUt8m4QyZXI+saEq/0r4GwdoHYFQ== + +"@napi-rs/wasm-tools-win32-ia32-msvc@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-win32-ia32-msvc/-/wasm-tools-win32-ia32-msvc-1.0.1.tgz#9167919a62d24cb3a46f01fada26fee38aeaf884" + integrity sha512-gXkuYzxQsgkj05Zaq+KQTkHIN83dFAwMcTKa2aQcpYPRImFm2AQzEyLtpXmyCWzJ0F9ZYAOmbSyrNew8/us6bw== + +"@napi-rs/wasm-tools-win32-x64-msvc@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools-win32-x64-msvc/-/wasm-tools-win32-x64-msvc-1.0.1.tgz#f896ab29a83605795bb12cf2cfc1a215bc830c65" + integrity sha512-rEAf05nol3e3eei2sRButmgXP+6ATgm0/38MKhz9Isne82T4rPIMYsCIFj0kOisaGeVwoi2fnm7O9oWp5YVnYQ== + +"@napi-rs/wasm-tools@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-tools/-/wasm-tools-1.0.1.tgz#f54caa0132322fd5275690b2aeb581d11539262f" + integrity sha512-enkZYyuCdo+9jneCPE/0fjIta4wWnvVN9hBo2HuiMpRF0q3lzv1J6b/cl7i0mxZUKhBrV3aCKDBQnCOhwKbPmQ== + optionalDependencies: + "@napi-rs/wasm-tools-android-arm-eabi" "1.0.1" + "@napi-rs/wasm-tools-android-arm64" "1.0.1" + "@napi-rs/wasm-tools-darwin-arm64" "1.0.1" + "@napi-rs/wasm-tools-darwin-x64" "1.0.1" + "@napi-rs/wasm-tools-freebsd-x64" "1.0.1" + "@napi-rs/wasm-tools-linux-arm64-gnu" "1.0.1" + "@napi-rs/wasm-tools-linux-arm64-musl" "1.0.1" + "@napi-rs/wasm-tools-linux-x64-gnu" "1.0.1" + "@napi-rs/wasm-tools-linux-x64-musl" "1.0.1" + "@napi-rs/wasm-tools-wasm32-wasi" "1.0.1" + "@napi-rs/wasm-tools-win32-arm64-msvc" "1.0.1" + "@napi-rs/wasm-tools-win32-ia32-msvc" "1.0.1" + "@napi-rs/wasm-tools-win32-x64-msvc" "1.0.1" "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -930,6 +1424,11 @@ resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-3.0.4.tgz#70e941ba742bdd2b49bdb7393e821dea8520a3db" integrity sha512-TWFX7cZF2LXoCvdmJWY7XVPi74aSY0+FfBZNSXEXFkMpjcqsQwDSYVv5FhRFaI0V1ECnwbz4j59T/G+rXNWaIQ== +"@octokit/auth-token@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-6.0.0.tgz#b02e9c08a2d8937df09a2a981f226ad219174c53" + integrity sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w== + "@octokit/core@^4.0.0": version "4.2.4" resolved "https://registry.yarnpkg.com/@octokit/core/-/core-4.2.4.tgz#d8769ec2b43ff37cc3ea89ec4681a20ba58ef907" @@ -943,6 +1442,27 @@ before-after-hook "^2.2.0" universal-user-agent "^6.0.0" +"@octokit/core@^7.0.2": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@octokit/core/-/core-7.0.3.tgz#0b5288995fed66920128d41cfeea34979d48a360" + integrity sha512-oNXsh2ywth5aowwIa7RKtawnkdH6LgU1ztfP9AIUCQCvzysB+WeU8o2kyyosDPwBZutPpjZDKPQGIzzrfTWweQ== + dependencies: + "@octokit/auth-token" "^6.0.0" + "@octokit/graphql" "^9.0.1" + "@octokit/request" "^10.0.2" + "@octokit/request-error" "^7.0.0" + "@octokit/types" "^14.0.0" + before-after-hook "^4.0.0" + universal-user-agent "^7.0.0" + +"@octokit/endpoint@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-11.0.0.tgz#189fcc022721b4c49d0307eea6be3de1cfb53026" + integrity sha512-hoYicJZaqISMAI3JfaDr1qMNi48OctWuOih1m80bkYow/ayPw6Jj52tqWJ6GEoFTk1gBqfanSoI1iY99Z5+ekQ== + dependencies: + "@octokit/types" "^14.0.0" + universal-user-agent "^7.0.2" + "@octokit/endpoint@^7.0.0": version "7.0.6" resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-7.0.6.tgz#791f65d3937555141fb6c08f91d618a7d645f1e2" @@ -961,6 +1481,15 @@ "@octokit/types" "^9.0.0" universal-user-agent "^6.0.0" +"@octokit/graphql@^9.0.1": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-9.0.1.tgz#eb258fc9981403d2d751720832652c385b6c1613" + integrity sha512-j1nQNU1ZxNFx2ZtKmL4sMrs4egy5h65OMDmSbVyuCzjOcwsHq6EaYjOTGXPQxgfiN8dJ4CriYHk6zF050WEULg== + dependencies: + "@octokit/request" "^10.0.2" + "@octokit/types" "^14.0.0" + universal-user-agent "^7.0.0" + "@octokit/openapi-types@^12.11.0": version "12.11.0" resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.11.0.tgz#da5638d64f2b919bca89ce6602d059f1b52d3ef0" @@ -976,11 +1505,23 @@ resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-18.1.1.tgz#09bdfdabfd8e16d16324326da5148010d765f009" integrity sha512-VRaeH8nCDtF5aXWnjPuEMIYf1itK/s3JYyJcWFJT8X9pSNnBtriDf7wlEWsGuhPLl4QIH4xM8fqTXDwJ3Mu6sw== +"@octokit/openapi-types@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-25.1.0.tgz#5a72a9dfaaba72b5b7db375fd05e90ca90dc9682" + integrity sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA== + "@octokit/plugin-enterprise-rest@6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-6.0.1.tgz#e07896739618dab8da7d4077c658003775f95437" integrity sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw== +"@octokit/plugin-paginate-rest@^13.0.1": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-13.1.1.tgz#ca5bb1c7b85a583691263c1f788f607e9bcb74b3" + integrity sha512-q9iQGlZlxAVNRN2jDNskJW/Cafy7/XE52wjZ5TTvyhyOD904Cvx//DNyoO3J/MXJ0ve3rPoNWKEg5iZrisQSuw== + dependencies: + "@octokit/types" "^14.1.0" + "@octokit/plugin-paginate-rest@^3.0.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-3.1.0.tgz#86f8be759ce2d6d7c879a31490fd2f7410b731f0" @@ -993,6 +1534,18 @@ resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz#5e50ed7083a613816b1e4a28aeec5fb7f1462e85" integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== +"@octokit/plugin-request-log@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-6.0.0.tgz#de1c1e557df6c08adb631bf78264fa741e01b317" + integrity sha512-UkOzeEN3W91/eBq9sPZNQ7sUBvYCqYbrrD8gTbBuGtHEuycE4/awMXcYvx6sVYo7LypPhmQwwpUe4Yyu4QZN5Q== + +"@octokit/plugin-rest-endpoint-methods@^16.0.0": + version "16.0.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-16.0.0.tgz#ba30ca387fc2ac8bd93cf9f951174736babebd97" + integrity sha512-kJVUQk6/dx/gRNLWUnAWKFs1kVPn5O5CYZyssyEoNYaFedqZxsfYs7DwI3d67hGz4qOwaJ1dpm07hOAD1BXx6g== + dependencies: + "@octokit/types" "^14.1.0" + "@octokit/plugin-rest-endpoint-methods@^6.0.0": version "6.8.1" resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.8.1.tgz#97391fda88949eb15f68dc291957ccbe1d3e8ad1" @@ -1010,6 +1563,24 @@ deprecation "^2.0.0" once "^1.4.0" +"@octokit/request-error@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-7.0.0.tgz#48ae2cd79008315605d00e83664891a10a5ddb97" + integrity sha512-KRA7VTGdVyJlh0cP5Tf94hTiYVVqmt2f3I6mnimmaVz4UG3gQV/k4mDJlJv3X67iX6rmN7gSHCF8ssqeMnmhZg== + dependencies: + "@octokit/types" "^14.0.0" + +"@octokit/request@^10.0.2": + version "10.0.3" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-10.0.3.tgz#2ffdb88105ce20d25dcab8a592a7040ea48306c7" + integrity sha512-V6jhKokg35vk098iBqp2FBKunk3kMTXlmq+PtbV9Gl3TfskWlebSofU9uunVKhUN7xl+0+i5vt0TGTG8/p/7HA== + dependencies: + "@octokit/endpoint" "^11.0.0" + "@octokit/request-error" "^7.0.0" + "@octokit/types" "^14.0.0" + fast-content-type-parse "^3.0.0" + universal-user-agent "^7.0.2" + "@octokit/request@^6.0.0": version "6.2.8" resolved "https://registry.yarnpkg.com/@octokit/request/-/request-6.2.8.tgz#aaf480b32ab2b210e9dadd8271d187c93171d8eb" @@ -1032,6 +1603,23 @@ "@octokit/plugin-request-log" "^1.0.4" "@octokit/plugin-rest-endpoint-methods" "^6.0.0" +"@octokit/rest@^22.0.0": + version "22.0.0" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-22.0.0.tgz#9026f47dacba9c605da3d43cce9432c4c532dc5a" + integrity sha512-z6tmTu9BTnw51jYGulxrlernpsQYXpui1RK21vmXn8yF5bp6iX16yfTtJYGK5Mh1qDkvDOmp2n8sRMcQmR8jiA== + dependencies: + "@octokit/core" "^7.0.2" + "@octokit/plugin-paginate-rest" "^13.0.1" + "@octokit/plugin-request-log" "^6.0.0" + "@octokit/plugin-rest-endpoint-methods" "^16.0.0" + +"@octokit/types@^14.0.0", "@octokit/types@^14.1.0": + version "14.1.0" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-14.1.0.tgz#3bf9b3a3e3b5270964a57cc9d98592ed44f840f2" + integrity sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g== + dependencies: + "@octokit/openapi-types" "^25.1.0" + "@octokit/types@^6.41.0": version "6.41.0" resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.41.0.tgz#e58ef78d78596d2fb7df9c6259802464b5f84a04" @@ -1152,6 +1740,13 @@ "@tufjs/canonical-json" "1.0.0" minimatch "^9.0.0" +"@tybys/wasm-util@^0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.10.0.tgz#2fd3cd754b94b378734ce17058d0507c45c88369" + integrity sha512-VyyPYFlOMNylG45GoAe0xDoLwWuowvf92F9kySqzYh8vmYm7D2u4iUJKa1tOUpS70Ku13ASrOkS4ScXFsTaCNQ== + dependencies: + tslib "^2.4.0" + "@types/babel__core@^7.1.14": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -1423,7 +2018,7 @@ ansi-colors@^4.1.1: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== -ansi-escapes@^4.2.1: +ansi-escapes@^4.2.1, ansi-escapes@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== @@ -1627,6 +2222,11 @@ before-after-hook@^2.2.0: resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.3.tgz#c51e809c81a4e354084422b9b26bad88249c517c" integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ== +before-after-hook@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-4.0.0.tgz#cf1447ab9160df6a40f3621da64d6ffc36050cb9" + integrity sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ== + bin-links@^4.0.1: version "4.0.4" resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-4.0.4.tgz#c3565832b8e287c85f109a02a17027d152a58a63" @@ -1855,6 +2455,11 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== +chardet@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-2.1.0.tgz#1007f441a1ae9f9199a4a67f6e978fb0aa9aa3fe" + integrity sha512-bNFETTG/pM5ryzQ9Ad0lJOTa6HWD/YsScAR3EnCPZRPlQh77JocYktSHOUHelyhm8IARL+o4c4F1bP5KVOjiRA== + chownr@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" @@ -1902,6 +2507,18 @@ cli-width@^3.0.0: resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== +cli-width@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-4.1.0.tgz#42daac41d3c254ef38ad8ac037672130173691c5" + integrity sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ== + +clipanion@^4.0.0-rc.4: + version "4.0.0-rc.4" + resolved "https://registry.yarnpkg.com/clipanion/-/clipanion-4.0.0-rc.4.tgz#7191a940e47ef197e5f18c9cbbe419278b5f5903" + integrity sha512-CXkMQxU6s9GklO/1f714dkKBMu1lopS1WFF0B8o4AxPykR1hpozxSiUZ5ZUeBjfPgCWqbcNOtZVFhB8Lkfp1+Q== + dependencies: + typanion "^3.8.0" + cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -1973,6 +2590,11 @@ color-support@^1.1.3: resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== +colorette@^2.0.20: + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== + columnify@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.6.0.tgz#6989531713c9008bb29735e61e37acf5bd553cf3" @@ -2209,7 +2831,7 @@ dateformat@^3.0.0: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5, debug@^4.4.0: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5, debug@^4.4.0, debug@^4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== @@ -2377,6 +2999,11 @@ emittery@^0.13.1: resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== +emnapi@^1.4.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/emnapi/-/emnapi-1.5.0.tgz#aeb335a958c09c18c930836b46281f46707d80e9" + integrity sha512-adAaiwTxMnHbq1u2LUf+AfDR5MYrxDVBtezGspxwk5e/Zb6KHkGNdfuMU4JBIVm6ASY06K8KalhOPUht92MsnA== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -2462,6 +3089,11 @@ es-set-tostringtag@^2.1.0: has-tostringtag "^1.0.2" hasown "^2.0.2" +es-toolkit@^1.39.8: + version "1.39.10" + resolved "https://registry.yarnpkg.com/es-toolkit/-/es-toolkit-1.39.10.tgz#513407af73e79f9940e7ec7650f2e6dceeaf1d81" + integrity sha512-E0iGnTtbDhkeczB0T+mxmoVlT4YNweEKBLq7oaU4p11mecdsZpNWOglI4895Vh4usbQ+LsJiuLuI2L0Vdmfm2w== + escalade@^3.1.1, escalade@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" @@ -2590,6 +3222,11 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" +fast-content-type-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/fast-content-type-parse/-/fast-content-type-parse-3.0.0.tgz#5590b6c807cc598be125e6740a9fde589d2b7afb" + integrity sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg== + fast-glob@3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" @@ -2692,6 +3329,15 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-7.0.0.tgz#e8dec1455f74f78d888ad65bf7ca13dd2b4e66fb" + integrity sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g== + dependencies: + locate-path "^7.2.0" + path-exists "^5.0.0" + unicorn-magic "^0.1.0" + flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" @@ -4141,6 +4787,13 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +locate-path@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-7.2.0.tgz#69cb1779bd90b35ab1e771e1f2f89a202c2a8a8a" + integrity sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA== + dependencies: + p-locate "^6.0.0" + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -4543,6 +5196,11 @@ mute-stream@0.0.8, mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +mute-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-2.0.0.tgz#a5446fc0c512b71c83c44d908d5c7b7b4c493b2b" + integrity sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -4963,6 +5621,13 @@ p-limit@^3.0.2, p-limit@^3.1.0: dependencies: yocto-queue "^0.1.0" +p-limit@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" + integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ== + dependencies: + yocto-queue "^1.0.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" @@ -4984,6 +5649,13 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" +p-locate@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-6.0.0.tgz#3da9a49d4934b901089dca3302fa65dc5a05c04f" + integrity sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw== + dependencies: + p-limit "^4.0.0" + p-map-series@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-map-series/-/p-map-series-2.1.0.tgz#7560d4c452d9da0c07e692fdbfe6e2c81a2a91f2" @@ -5154,6 +5826,11 @@ path-exists@^4.0.0: resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== +path-exists@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" + integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ== + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -5651,7 +6328,7 @@ semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4, semver@^7.7.2: +semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4, semver@^7.7.1, semver@^7.7.2: version "7.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== @@ -5757,7 +6434,7 @@ signal-exit@3.0.7, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.0.1: +signal-exit@^4.0.1, signal-exit@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== @@ -6222,6 +6899,11 @@ tuf-js@^1.1.7: debug "^4.3.4" make-fetch-happen "^11.1.1" +typanion@^3.14.0, typanion@^3.8.0: + version "3.14.0" + resolved "https://registry.yarnpkg.com/typanion/-/typanion-3.14.0.tgz#a766a91810ce8258033975733e836c43a2929b94" + integrity sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug== + type-detect@4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" @@ -6301,6 +6983,11 @@ undici-types@~7.8.0: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== +unicorn-magic@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/unicorn-magic/-/unicorn-magic-0.1.0.tgz#1bb9a51c823aaf9d73a8bfcd3d1a23dde94b0ce4" + integrity sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ== + unique-filename@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-2.0.1.tgz#e785f8675a9a7589e0ac77e0b5c34d2eaeac6da2" @@ -6341,6 +7028,11 @@ universal-user-agent@^6.0.0: resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.1.tgz#15f20f55da3c930c57bddbf1734c6654d5fd35aa" integrity sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ== +universal-user-agent@^7.0.0, universal-user-agent@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-7.0.3.tgz#c05870a58125a2dc00431f2df815a77fe69736be" + integrity sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A== + universalify@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" @@ -6492,7 +7184,7 @@ wordwrap@^1.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^6.0.1: +wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== @@ -6653,3 +7345,13 @@ yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +yocto-queue@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.2.1.tgz#36d7c4739f775b3cbc28e6136e21aa057adec418" + integrity sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg== + +yoctocolors-cjs@^2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz#7e4964ea8ec422b7a40ac917d3a344cfd2304baa" + integrity sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw== From 0eca9ff07151e5f875fa53998b3107184b552257 Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 9 Sep 2025 17:25:46 +0200 Subject: [PATCH 3/6] switch to weak tsfn references --- bindings/nodejs/main.ts | 11 ----------- bindings/nodejs/src/custom_node.rs | 1 + bindings/nodejs/src/engine.rs | 5 +++-- bindings/nodejs/src/loader.rs | 4 +--- bindings/nodejs/test/decision.spec.ts | 8 ++++---- 5 files changed, 9 insertions(+), 20 deletions(-) delete mode 100644 bindings/nodejs/main.ts diff --git a/bindings/nodejs/main.ts b/bindings/nodejs/main.ts deleted file mode 100644 index 487b1438..00000000 --- a/bindings/nodejs/main.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ZenEngine } from './index'; -import fs from 'fs/promises'; -import path from 'path'; - -const testDataRoot = path.join(__dirname, '../../', 'test-data'); -const loader = async (key: string) => fs.readFile(path.join(testDataRoot, key)); - - -const engine = new ZenEngine({ loader }); - -console.log('hello'); \ No newline at end of file diff --git a/bindings/nodejs/src/custom_node.rs b/bindings/nodejs/src/custom_node.rs index dcb77889..09509ac7 100644 --- a/bindings/nodejs/src/custom_node.rs +++ b/bindings/nodejs/src/custom_node.rs @@ -17,6 +17,7 @@ type CustomNodeTsfn = Arc< ZenEngineHandlerRequest, Status, false, + true, >, >; diff --git a/bindings/nodejs/src/engine.rs b/bindings/nodejs/src/engine.rs index 796dc340..965f6641 100644 --- a/bindings/nodejs/src/engine.rs +++ b/bindings/nodejs/src/engine.rs @@ -3,8 +3,7 @@ use std::sync::Arc; use napi::anyhow::{anyhow, Context}; use napi::bindgen_prelude::{ - Buffer, Either3, FromNapiValue, Function, Object, Promise, SharedReference, ToNapiValue, - WeakReference, + Buffer, Either3, FromNapiValue, Function, Object, Promise, ToNapiValue, }; use napi::sys::{napi_env, napi_value}; use napi::{Either, Env, JsValue, Unknown, ValueType}; @@ -130,6 +129,7 @@ impl ZenEngine { .build_threadsafe_function() .max_queue_size::<0>() .callee_handled::() + .weak() .build()?; DecisionLoader::new(Arc::new(loader_tsfn)) @@ -143,6 +143,7 @@ impl ZenEngine { .build_threadsafe_function() .max_queue_size::<0>() .callee_handled::() + .weak() .build()?; CustomNode::new(Arc::new(custom_tfsn)) diff --git a/bindings/nodejs/src/loader.rs b/bindings/nodejs/src/loader.rs index ad0e4686..1230a0dd 100644 --- a/bindings/nodejs/src/loader.rs +++ b/bindings/nodejs/src/loader.rs @@ -22,8 +22,7 @@ type LoaderTsfn = Arc< String, Status, false, - false, - 0, + true, >, >; @@ -86,7 +85,6 @@ impl DecisionLoader { } } - impl DecisionLoaderTrait for DecisionLoader { fn load<'a>( &'a self, diff --git a/bindings/nodejs/test/decision.spec.ts b/bindings/nodejs/test/decision.spec.ts index 1dccdec8..2222306c 100644 --- a/bindings/nodejs/test/decision.spec.ts +++ b/bindings/nodejs/test/decision.spec.ts @@ -31,7 +31,7 @@ describe('ZenEngine', () => { expect(r2.result.output).toEqual(0); expect(r3.result.output).toEqual(10); - engine.dispose(); + // engine.dispose(); }, 10000); it('Evaluates decisions using getDecision', async () => { @@ -50,7 +50,7 @@ describe('ZenEngine', () => { expect(r2.result.output).toEqual(0); expect(r3.result.output).toEqual(10); - engine.dispose(); + // engine.dispose(); }, 10000); it('Creates a decision from contents', async () => { @@ -86,7 +86,7 @@ describe('ZenEngine', () => { const r = await engine.evaluate('custom.json', { a: 5 }); expect(r.result.data).toEqual(25); - engine.dispose(); + // engine.dispose(); }); it('Parses ZenDecisionContent', async () => { @@ -134,7 +134,7 @@ describe('ZenEngine', () => { } } - engine.dispose(); + // engine.dispose(); }); }); From 23898b5a25d610c8baa169744b38523179dfdef4 Mon Sep 17 00:00:00 2001 From: bojancrevar Date: Thu, 11 Sep 2025 14:44:14 +0200 Subject: [PATCH 4/6] temp test fix --- bindings/nodejs/Cargo.toml | 2 +- bindings/nodejs/index.d.ts | 2 ++ bindings/nodejs/package.json | 7 ++----- bindings/nodejs/src/safe_result.rs | 2 +- bindings/nodejs/src/types.rs | 10 ++++++++++ 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/bindings/nodejs/Cargo.toml b/bindings/nodejs/Cargo.toml index 19d258a0..968afc22 100644 --- a/bindings/nodejs/Cargo.toml +++ b/bindings/nodejs/Cargo.toml @@ -9,7 +9,7 @@ publish = false crate-type = ["cdylib"] [dependencies] -napi = { version = "3", features = ["serde-json", "error_anyhow", "tokio_rt", "compat-mode"] } +napi = { version = "3", features = ["serde-json", "error_anyhow", "tokio_rt"] } napi-derive = "3" tokio-util = { workspace = true, features = ["rt"] } serde_json = { workspace = true } diff --git a/bindings/nodejs/index.d.ts b/bindings/nodejs/index.d.ts index 8584093d..0ef1ed15 100644 --- a/bindings/nodejs/index.d.ts +++ b/bindings/nodejs/index.d.ts @@ -23,6 +23,8 @@ export declare class ZenEngine { export declare class ZenEngineHandlerRequest { constructor() + get node(): DecisionNode + get input(): any getField(path: string): unknown getFieldRaw(path: string): unknown } diff --git a/bindings/nodejs/package.json b/bindings/nodejs/package.json index 6f50470c..0393e684 100644 --- a/bindings/nodejs/package.json +++ b/bindings/nodejs/package.json @@ -13,9 +13,7 @@ "packageManager": "yarn@1.22.22", "napi": { "name": "zen-engine", - "triples": { - "defaults": false, - "additional": [ + "targets": [ "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", @@ -23,8 +21,7 @@ "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "aarch64-apple-darwin" - ] - }, + ], "npmClient": "yarn" }, "keywords": [ diff --git a/bindings/nodejs/src/safe_result.rs b/bindings/nodejs/src/safe_result.rs index fc428332..9c637001 100644 --- a/bindings/nodejs/src/safe_result.rs +++ b/bindings/nodejs/src/safe_result.rs @@ -33,7 +33,7 @@ where obj.set("error", error)?; } } - + Object::to_napi_value(env, obj) //TODO BC ? } } diff --git a/bindings/nodejs/src/types.rs b/bindings/nodejs/src/types.rs index fed0071a..1c5a1c6e 100644 --- a/bindings/nodejs/src/types.rs +++ b/bindings/nodejs/src/types.rs @@ -96,6 +96,16 @@ impl ZenEngineHandlerRequest { Err(anyhow!("Private constructor").into()) } + #[napi(getter)] + pub fn node(&self) -> DecisionNode { + self.node.clone() + } + + #[napi(getter)] + pub fn input(&self) -> Value { + self.input.clone() + } + #[napi(ts_return_type = "unknown")] pub fn get_field(&self, path: String) -> napi::Result { let node_config = &self.node.config; From 740b0fd0bc514cb6de69370a97366b866e693cb2 Mon Sep 17 00:00:00 2001 From: bojancrevar Date: Fri, 12 Sep 2025 15:25:02 +0200 Subject: [PATCH 5/6] dispose references removed --- .gitignore | 1 + bindings/nodejs/README.md | 2 -- bindings/nodejs/src/engine.rs | 12 ------------ bindings/nodejs/src/safe_result.rs | 2 +- bindings/nodejs/test/decision.spec.ts | 4 ---- 5 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 5f0fbec7..71c7c0ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.temp /target /Cargo.lock diff --git a/bindings/nodejs/README.md b/bindings/nodejs/README.md index 6a2793de..a9041ef5 100644 --- a/bindings/nodejs/README.md +++ b/bindings/nodejs/README.md @@ -40,7 +40,6 @@ import fs from 'fs/promises'; const decision = engine.createDecision(content); const result = await decision.evaluate({ input: 15 }); - engine.dispose(); })(); ``` @@ -59,7 +58,6 @@ const loader = async (key: string) => fs.readFile(path.join(testDataRoot, key))( const engine = new ZenEngine({ loader }); const result = await engine.evaluate('jdm_graph1.json', { input: 5 }); - engine.dispose(); })(); ``` diff --git a/bindings/nodejs/src/engine.rs b/bindings/nodejs/src/engine.rs index 965f6641..2c208ccf 100644 --- a/bindings/nodejs/src/engine.rs +++ b/bindings/nodejs/src/engine.rs @@ -225,16 +225,4 @@ impl ZenEngine { self.get_decision(key).await.into() } - // Function used to dispose memory allocated for loaders - // In the future, it will likely be removed and made automatic - // #[napi] - // pub fn dispose(&self) { - // if let Some(loader) = self.loader_ref { - // let _ = loader.abort(); - // } - // - // if let Some(loader) = self.custom_handler_ref { - // let _ = loader.abort(); - // } - // } } diff --git a/bindings/nodejs/src/safe_result.rs b/bindings/nodejs/src/safe_result.rs index 9c637001..ece9037f 100644 --- a/bindings/nodejs/src/safe_result.rs +++ b/bindings/nodejs/src/safe_result.rs @@ -34,7 +34,7 @@ where } } - Object::to_napi_value(env, obj) //TODO BC ? + Object::to_napi_value(env, obj) } } diff --git a/bindings/nodejs/test/decision.spec.ts b/bindings/nodejs/test/decision.spec.ts index 2222306c..9648a39d 100644 --- a/bindings/nodejs/test/decision.spec.ts +++ b/bindings/nodejs/test/decision.spec.ts @@ -31,7 +31,6 @@ describe('ZenEngine', () => { expect(r2.result.output).toEqual(0); expect(r3.result.output).toEqual(10); - // engine.dispose(); }, 10000); it('Evaluates decisions using getDecision', async () => { @@ -50,7 +49,6 @@ describe('ZenEngine', () => { expect(r2.result.output).toEqual(0); expect(r3.result.output).toEqual(10); - // engine.dispose(); }, 10000); it('Creates a decision from contents', async () => { @@ -86,7 +84,6 @@ describe('ZenEngine', () => { const r = await engine.evaluate('custom.json', { a: 5 }); expect(r.result.data).toEqual(25); - // engine.dispose(); }); it('Parses ZenDecisionContent', async () => { @@ -134,7 +131,6 @@ describe('ZenEngine', () => { } } - // engine.dispose(); }); }); From 1d95a865a40a8910ffd9baf4cc740bdbef496399 Mon Sep 17 00:00:00 2001 From: bojancrevar Date: Fri, 12 Sep 2025 15:45:44 +0200 Subject: [PATCH 6/6] fmt fix --- bindings/nodejs/src/engine.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/bindings/nodejs/src/engine.rs b/bindings/nodejs/src/engine.rs index 2c208ccf..ccdaa8eb 100644 --- a/bindings/nodejs/src/engine.rs +++ b/bindings/nodejs/src/engine.rs @@ -224,5 +224,4 @@ impl ZenEngine { pub async fn safe_get_decision(&self, key: String) -> SafeResult { self.get_decision(key).await.into() } - }