mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 08:38:34 +00:00
feat: bump deps (#14076)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Updated core dependencies, developer tooling and Rust toolchain to
newer stable versions across the repo
* Upgraded Storybook to v10 and improved ESM path resolution for
storybook tooling
* Broadened native binding platform/architecture support and
strengthened native module version validation, loading and WASI handling
* **New Features**
* Exposed an additional native text export for consumers (enhanced
JS/native surface)
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
4
.github/actions/build-rust/action.yml
vendored
4
.github/actions/build-rust/action.yml
vendored
@@ -75,7 +75,11 @@ runs:
|
||||
shell: bash
|
||||
if: ${{ runner.os != 'Windows' && inputs.no-build != 'true' }}
|
||||
run: |
|
||||
if [[ "${{ inputs.target }}" == "x86_64-unknown-linux-gnu" ]]; then
|
||||
yarn workspace ${{ inputs.package }} build --target ${{ inputs.target }}
|
||||
else
|
||||
yarn workspace ${{ inputs.package }} build --target ${{ inputs.target }} --use-napi-cross
|
||||
fi
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
|
||||
109
Cargo.lock
generated
109
Cargo.lock
generated
@@ -835,7 +835,7 @@ dependencies = [
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-link",
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -883,7 +883,7 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"libc",
|
||||
"libloading",
|
||||
"libloading 0.8.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -966,9 +966,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.8.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f"
|
||||
checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
@@ -1278,9 +1278,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.4.2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4735f265ba6a1188052ca32d461028a7d1125868be18e287e756019da7607b5"
|
||||
checksum = "424e0138278faeb2b401f174ad17e715c829512d74f3d1e81eb43365c2e0590e"
|
||||
dependencies = [
|
||||
"ctor-proc-macro",
|
||||
"dtor",
|
||||
@@ -1288,9 +1288,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ctor-proc-macro"
|
||||
version = "0.0.5"
|
||||
version = "0.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f211af61d8efdd104f96e57adf5e426ba1bc3ed7a4ead616e15e5881fd79c4d"
|
||||
checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1"
|
||||
|
||||
[[package]]
|
||||
name = "dary_heap"
|
||||
@@ -1438,18 +1438,18 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
||||
|
||||
[[package]]
|
||||
name = "dtor"
|
||||
version = "0.0.6"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97cbdf2ad6846025e8e25df05171abfb30e3ababa12ee0a0e44b9bbe570633a8"
|
||||
checksum = "404d02eeb088a82cfd873006cb713fe411306c7d182c344905e101fb1167d301"
|
||||
dependencies = [
|
||||
"dtor-proc-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtor-proc-macro"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7454e41ff9012c00d53cf7f475c5e3afa3b91b7c90568495495e8d9bf47a1055"
|
||||
checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5"
|
||||
|
||||
[[package]]
|
||||
name = "ecb"
|
||||
@@ -1677,6 +1677,21 @@ dependencies = [
|
||||
"new_debug_unreachable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-executor",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.31"
|
||||
@@ -1721,6 +1736,17 @@ version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.31"
|
||||
@@ -1739,8 +1765,10 @@ version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
@@ -2433,6 +2461,16 @@ dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.15"
|
||||
@@ -2664,14 +2702,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "napi"
|
||||
version = "3.0.0-beta.8"
|
||||
version = "3.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c502f122fc89e92c6222810b3144411c6f945da5aa3b713ddfad3bdcae7c9bb4"
|
||||
checksum = "f27a163b545fd2184d2efdccf3d3df56acdb63465f2fcfebcaee0463c1e91783"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags 2.9.1",
|
||||
"chrono",
|
||||
"ctor",
|
||||
"futures",
|
||||
"napi-build",
|
||||
"napi-sys",
|
||||
"nohash-hasher",
|
||||
@@ -2682,17 +2721,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "napi-build"
|
||||
version = "2.2.1"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44e0e3177307063d3e7e55b7dd7b648cca9d7f46daa35422c0d98cc2bf48c2c1"
|
||||
checksum = "d376940fd5b723c6893cd1ee3f33abbfd86acb1cd1ec079f3ab04a2a3bc4d3b1"
|
||||
|
||||
[[package]]
|
||||
name = "napi-derive"
|
||||
version = "3.0.0-beta.8"
|
||||
version = "3.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcf1e732a67e934b069d6d527251d6288753a36840572abe132a7aed9e77f0bc"
|
||||
checksum = "47cffa09ea668c4cc5d7b1198780882e28780ed1804a903b80680725426223d9"
|
||||
dependencies = [
|
||||
"convert_case 0.8.0",
|
||||
"convert_case 0.10.0",
|
||||
"ctor",
|
||||
"napi-derive-backend",
|
||||
"proc-macro2",
|
||||
@@ -2702,11 +2741,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "napi-derive-backend"
|
||||
version = "2.0.0-beta.8"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "462b775ba74791c98989fadc46c4bb2ec53016427be4d420d31c4bbaab34b308"
|
||||
checksum = "5e186227ec22f4675267a176d98dffecb27e6cc88926cbb7efb5427268565c0f"
|
||||
dependencies = [
|
||||
"convert_case 0.8.0",
|
||||
"convert_case 0.10.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"semver",
|
||||
@@ -2715,11 +2754,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "napi-sys"
|
||||
version = "3.0.0-alpha.3"
|
||||
version = "3.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4401c63f866b42d673a8b213d5662c84a0701b0f6c3acff7e2b9fc439f1675d"
|
||||
checksum = "8eb602b84d7c1edae45e50bbf1374696548f36ae179dfa667f577e384bb90c2b"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
"libloading 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5560,7 +5599,7 @@ dependencies = [
|
||||
"windows-collections",
|
||||
"windows-core 0.61.2",
|
||||
"windows-future",
|
||||
"windows-link",
|
||||
"windows-link 0.1.3",
|
||||
"windows-numerics",
|
||||
]
|
||||
|
||||
@@ -5603,7 +5642,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
|
||||
dependencies = [
|
||||
"windows-implement 0.60.0",
|
||||
"windows-interface 0.59.1",
|
||||
"windows-link",
|
||||
"windows-link 0.1.3",
|
||||
"windows-result 0.3.4",
|
||||
"windows-strings",
|
||||
]
|
||||
@@ -5615,7 +5654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
|
||||
dependencies = [
|
||||
"windows-core 0.61.2",
|
||||
"windows-link",
|
||||
"windows-link 0.1.3",
|
||||
"windows-threading",
|
||||
]
|
||||
|
||||
@@ -5669,6 +5708,12 @@ version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-numerics"
|
||||
version = "0.2.0"
|
||||
@@ -5676,7 +5721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
|
||||
dependencies = [
|
||||
"windows-core 0.61.2",
|
||||
"windows-link",
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5694,7 +5739,7 @@ version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5703,7 +5748,7 @@ version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5794,7 +5839,7 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -50,7 +50,7 @@ resolver = "3"
|
||||
mimalloc = "0.1"
|
||||
mp4parse = "0.17"
|
||||
nanoid = "0.4"
|
||||
napi = { version = "3.0.0-beta.3", features = [
|
||||
napi = { version = "3.7.0", features = [
|
||||
"async",
|
||||
"chrono_date",
|
||||
"error_anyhow",
|
||||
@@ -58,7 +58,7 @@ resolver = "3"
|
||||
"serde",
|
||||
] }
|
||||
napi-build = { version = "2" }
|
||||
napi-derive = { version = "3.0.0-beta.3" }
|
||||
napi-derive = { version = "3.4" }
|
||||
nom = "8"
|
||||
notify = { version = "8", features = ["serde"] }
|
||||
objc2 = "0.6"
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"@affine-tools/cli": "workspace:*",
|
||||
"@capacitor/cli": "^7.0.0",
|
||||
"@eslint/js": "^9.16.0",
|
||||
"@faker-js/faker": "^10.0.0",
|
||||
"@faker-js/faker": "^10.1.0",
|
||||
"@istanbuljs/schema": "^0.1.3",
|
||||
"@magic-works/i18n-codegen": "^0.6.1",
|
||||
"@playwright/test": "=1.52.0",
|
||||
|
||||
@@ -32,10 +32,7 @@
|
||||
"build:debug": "napi build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "3.0.0-alpha.89",
|
||||
"lib0": "^0.2.99",
|
||||
"tiktoken": "^1.0.17",
|
||||
"tinybench": "^4.0.0",
|
||||
"yjs": "^13.6.21"
|
||||
"@napi-rs/cli": "3.5.0",
|
||||
"tiktoken": "^1.0.17"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,18 +28,18 @@
|
||||
"dependencies": {
|
||||
"@affine/reader": "workspace:*",
|
||||
"@affine/server-native": "workspace:*",
|
||||
"@ai-sdk/anthropic": "^2.0.38",
|
||||
"@ai-sdk/google": "^2.0.24",
|
||||
"@ai-sdk/google-vertex": "^3.0.54",
|
||||
"@ai-sdk/openai": "^2.0.56",
|
||||
"@ai-sdk/openai-compatible": "^1.0.23",
|
||||
"@ai-sdk/perplexity": "^2.0.14",
|
||||
"@apollo/server": "^4.11.3",
|
||||
"@aws-sdk/client-s3": "^3.779.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.779.0",
|
||||
"@ai-sdk/anthropic": "^2.0.53",
|
||||
"@ai-sdk/google": "^2.0.45",
|
||||
"@ai-sdk/google-vertex": "^3.0.87",
|
||||
"@ai-sdk/openai": "^2.0.80",
|
||||
"@ai-sdk/openai-compatible": "^1.0.28",
|
||||
"@ai-sdk/perplexity": "^2.0.21",
|
||||
"@apollo/server": "^4.12.2",
|
||||
"@aws-sdk/client-s3": "^3.947.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.947.0",
|
||||
"@fal-ai/serverless-client": "^0.15.0",
|
||||
"@google-cloud/opentelemetry-cloud-trace-exporter": "^2.4.1",
|
||||
"@google-cloud/opentelemetry-resource-util": "^2.4.0",
|
||||
"@google-cloud/opentelemetry-cloud-trace-exporter": "^3.0.0",
|
||||
"@google-cloud/opentelemetry-resource-util": "^3.0.0",
|
||||
"@modelcontextprotocol/sdk": "^1.24.3",
|
||||
"@nestjs-cls/transactional": "^2.6.1",
|
||||
"@nestjs-cls/transactional-adapter-prisma": "^1.2.19",
|
||||
@@ -56,26 +56,26 @@
|
||||
"@node-rs/argon2": "^2.0.2",
|
||||
"@node-rs/crc32": "^1.10.6",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/core": "^1.30.1",
|
||||
"@opentelemetry/exporter-prometheus": "^0.57.2",
|
||||
"@opentelemetry/exporter-zipkin": "^1.30.1",
|
||||
"@opentelemetry/host-metrics": "^0.36.0",
|
||||
"@opentelemetry/instrumentation": "^0.57.2",
|
||||
"@opentelemetry/instrumentation-graphql": "^0.55.0",
|
||||
"@opentelemetry/instrumentation-http": "^0.57.2",
|
||||
"@opentelemetry/instrumentation-ioredis": "^0.55.0",
|
||||
"@opentelemetry/instrumentation-nestjs-core": "^0.54.0",
|
||||
"@opentelemetry/instrumentation-socket.io": "^0.54.0",
|
||||
"@opentelemetry/resources": "^1.30.1",
|
||||
"@opentelemetry/sdk-metrics": "^1.30.1",
|
||||
"@opentelemetry/sdk-node": "^0.57.2",
|
||||
"@opentelemetry/sdk-trace-node": "^1.30.1",
|
||||
"@opentelemetry/semantic-conventions": "^1.28.0",
|
||||
"@opentelemetry/core": "^2.2.0",
|
||||
"@opentelemetry/exporter-prometheus": "^0.208.0",
|
||||
"@opentelemetry/exporter-zipkin": "^2.2.0",
|
||||
"@opentelemetry/host-metrics": "^0.37.0",
|
||||
"@opentelemetry/instrumentation": "^0.208.0",
|
||||
"@opentelemetry/instrumentation-graphql": "^0.56.0",
|
||||
"@opentelemetry/instrumentation-http": "^0.208.0",
|
||||
"@opentelemetry/instrumentation-ioredis": "^0.56.0",
|
||||
"@opentelemetry/instrumentation-nestjs-core": "^0.55.0",
|
||||
"@opentelemetry/instrumentation-socket.io": "^0.55.0",
|
||||
"@opentelemetry/resources": "^2.2.0",
|
||||
"@opentelemetry/sdk-metrics": "^2.2.0",
|
||||
"@opentelemetry/sdk-node": "^0.208.0",
|
||||
"@opentelemetry/sdk-trace-node": "^2.2.0",
|
||||
"@opentelemetry/semantic-conventions": "^1.38.0",
|
||||
"@prisma/client": "^6.6.0",
|
||||
"@prisma/instrumentation": "^6.7.0",
|
||||
"@react-email/components": "0.0.38",
|
||||
"@socket.io/redis-adapter": "^8.3.0",
|
||||
"ai": "^5.0.81",
|
||||
"ai": "^5.0.108",
|
||||
"bullmq": "^5.40.2",
|
||||
"cookie-parser": "^1.4.7",
|
||||
"cross-env": "^7.0.3",
|
||||
@@ -128,7 +128,7 @@
|
||||
"@affine-tools/cli": "workspace:*",
|
||||
"@affine-tools/utils": "workspace:*",
|
||||
"@affine/graphql": "workspace:*",
|
||||
"@faker-js/faker": "^10.0.0",
|
||||
"@faker-js/faker": "^10.1.0",
|
||||
"@nestjs/swagger": "^11.2.0",
|
||||
"@nestjs/testing": "patch:@nestjs/testing@npm%3A10.4.15#~/.yarn/patches/@nestjs-testing-npm-10.4.15-d591a1705a.patch",
|
||||
"@types/cookie-parser": "^1.4.8",
|
||||
@@ -148,7 +148,7 @@
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@types/supertest": "^6.0.2",
|
||||
"ava": "^6.2.0",
|
||||
"ava": "^6.4.0",
|
||||
"c8": "^10.1.3",
|
||||
"nodemon": "^3.1.7",
|
||||
"react-email": "4.0.11",
|
||||
|
||||
@@ -13,8 +13,8 @@ import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
|
||||
import { IORedisInstrumentation } from '@opentelemetry/instrumentation-ioredis';
|
||||
import { NestInstrumentation } from '@opentelemetry/instrumentation-nestjs-core';
|
||||
import { SocketIoInstrumentation } from '@opentelemetry/instrumentation-socket.io';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import { MetricProducer, MetricReader } from '@opentelemetry/sdk-metrics';
|
||||
import { resourceFromAttributes } from '@opentelemetry/resources';
|
||||
import { IMetricReader, MetricProducer } from '@opentelemetry/sdk-metrics';
|
||||
import { NodeSDK, NodeSDKConfiguration } from '@opentelemetry/sdk-node';
|
||||
import {
|
||||
BatchSpanProcessor,
|
||||
@@ -34,7 +34,7 @@ import { registerCustomMetrics } from './metrics';
|
||||
import { PrismaMetricProducer } from './prisma';
|
||||
|
||||
export abstract class BaseOpentelemetryOptionsFactory {
|
||||
abstract getMetricReader(): MetricReader;
|
||||
abstract getMetricReader(): IMetricReader;
|
||||
abstract getSpanExporter(): SpanExporter;
|
||||
|
||||
getInstractions(): Instrumentation[] {
|
||||
@@ -53,7 +53,7 @@ export abstract class BaseOpentelemetryOptionsFactory {
|
||||
}
|
||||
|
||||
getResource() {
|
||||
return new Resource({
|
||||
return resourceFromAttributes({
|
||||
[ATTR_K8S_NAMESPACE_NAME]: env.NAMESPACE,
|
||||
[ATTR_SERVICE_NAME]: env.FLAVOR,
|
||||
[ATTR_SERVICE_VERSION]: env.version,
|
||||
@@ -82,7 +82,7 @@ export abstract class BaseOpentelemetryOptionsFactory {
|
||||
|
||||
@Injectable()
|
||||
export class OpentelemetryOptionsFactory extends BaseOpentelemetryOptionsFactory {
|
||||
override getMetricReader(): MetricReader {
|
||||
override getMetricReader(): IMetricReader {
|
||||
return new PrometheusExporter({
|
||||
metricProducers: this.getMetricsProducers(),
|
||||
});
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { HrTime, ValueType } from '@opentelemetry/api';
|
||||
import { hrTime } from '@opentelemetry/core';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import { emptyResource } from '@opentelemetry/resources';
|
||||
import {
|
||||
AggregationTemporality,
|
||||
CollectionResult,
|
||||
DataPointType,
|
||||
InstrumentType,
|
||||
MetricProducer,
|
||||
ScopeMetrics,
|
||||
} from '@opentelemetry/sdk-metrics';
|
||||
@@ -24,7 +23,7 @@ export class PrismaMetricProducer implements MetricProducer {
|
||||
async collect(): Promise<CollectionResult> {
|
||||
const result: CollectionResult = {
|
||||
resourceMetrics: {
|
||||
resource: Resource.EMPTY,
|
||||
resource: emptyResource(),
|
||||
scopeMetrics: [],
|
||||
},
|
||||
errors: [],
|
||||
@@ -51,7 +50,6 @@ export class PrismaMetricProducer implements MetricProducer {
|
||||
name: transformPrismaKey(counter.key),
|
||||
description: counter.description,
|
||||
unit: '1',
|
||||
type: InstrumentType.COUNTER,
|
||||
valueType: ValueType.INT,
|
||||
},
|
||||
dataPointType: DataPointType.SUM,
|
||||
@@ -74,7 +72,6 @@ export class PrismaMetricProducer implements MetricProducer {
|
||||
name: transformPrismaKey(gauge.key),
|
||||
description: gauge.description,
|
||||
unit: '1',
|
||||
type: InstrumentType.UP_DOWN_COUNTER,
|
||||
valueType: ValueType.INT,
|
||||
},
|
||||
dataPointType: DataPointType.GAUGE,
|
||||
@@ -102,7 +99,6 @@ export class PrismaMetricProducer implements MetricProducer {
|
||||
name: transformPrismaKey(histogram.key),
|
||||
description: histogram.description,
|
||||
unit: 'ms',
|
||||
type: InstrumentType.HISTOGRAM,
|
||||
valueType: ValueType.DOUBLE,
|
||||
},
|
||||
dataPointType: DataPointType.HISTOGRAM,
|
||||
|
||||
@@ -1,29 +1,35 @@
|
||||
import { TraceExporter } from '@google-cloud/opentelemetry-cloud-trace-exporter';
|
||||
import { GcpDetectorSync } from '@google-cloud/opentelemetry-resource-util';
|
||||
import { Global, Injectable, Module, Provider } from '@nestjs/common';
|
||||
import { getEnv } from '@opentelemetry/core';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import {
|
||||
type Resource,
|
||||
resourceFromAttributes,
|
||||
} from '@opentelemetry/resources';
|
||||
import { SpanExporter } from '@opentelemetry/sdk-trace-node';
|
||||
import {
|
||||
SEMRESATTRS_CONTAINER_NAME,
|
||||
SEMRESATTRS_K8S_POD_NAME,
|
||||
} from '@opentelemetry/semantic-conventions';
|
||||
ATTR_CONTAINER_NAME,
|
||||
ATTR_K8S_POD_NAME,
|
||||
} from '@opentelemetry/semantic-conventions/incubating';
|
||||
|
||||
import { OpentelemetryOptionsFactory } from '../../base/metrics';
|
||||
|
||||
@Injectable()
|
||||
export class GCloudOpentelemetryOptionsFactory extends OpentelemetryOptionsFactory {
|
||||
override getResource(): Resource {
|
||||
const env = getEnv();
|
||||
const envAttrs: Record<string, string> = {};
|
||||
if (process.env.HOSTNAME) {
|
||||
envAttrs[ATTR_K8S_POD_NAME] = process.env.HOSTNAME;
|
||||
}
|
||||
if (process.env.CONTAINER_NAME) {
|
||||
envAttrs[ATTR_CONTAINER_NAME] = process.env.CONTAINER_NAME;
|
||||
}
|
||||
|
||||
const detected = new GcpDetectorSync().detect();
|
||||
|
||||
return super
|
||||
.getResource()
|
||||
.merge(
|
||||
new Resource({
|
||||
[SEMRESATTRS_K8S_POD_NAME]: env.HOSTNAME,
|
||||
[SEMRESATTRS_CONTAINER_NAME]: env.CONTAINER_NAME,
|
||||
})
|
||||
)
|
||||
.merge(new GcpDetectorSync().detect());
|
||||
.merge(resourceFromAttributes(envAttrs))
|
||||
.merge(resourceFromAttributes(detected.attributes ?? {}));
|
||||
}
|
||||
|
||||
override getSpanExporter(): SpanExporter {
|
||||
|
||||
@@ -99,11 +99,11 @@ impl Update {
|
||||
Ok(encoder.into_inner())
|
||||
}
|
||||
|
||||
pub(crate) fn iter(&mut self, state: StateVector) -> UpdateIterator {
|
||||
pub(crate) fn iter(&mut self, state: StateVector) -> UpdateIterator<'_> {
|
||||
UpdateIterator::new(self, state)
|
||||
}
|
||||
|
||||
pub fn delete_set_iter(&mut self, state: StateVector) -> DeleteSetIterator {
|
||||
pub fn delete_set_iter(&mut self, state: StateVector) -> DeleteSetIterator<'_> {
|
||||
DeleteSetIterator::new(self, state)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ impl<T> SomrInner<T> {
|
||||
self.data.as_ref().map(|x| unsafe { &*x.get() })
|
||||
}
|
||||
|
||||
fn data_mut(&self) -> Option<InnerRefMut<T>> {
|
||||
fn data_mut(&self) -> Option<InnerRefMut<'_, T>> {
|
||||
self.data.as_ref().map(|x| InnerRefMut {
|
||||
inner: unsafe { NonNull::new_unchecked(x.get()) },
|
||||
_marker: PhantomData,
|
||||
@@ -145,7 +145,7 @@ impl<T> Somr<T> {
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub unsafe fn get_mut_from_ref(&self) -> Option<InnerRefMut<T>> {
|
||||
pub unsafe fn get_mut_from_ref(&self) -> Option<InnerRefMut<'_, T>> {
|
||||
if !self.is_owned() || self.dangling() {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ impl Array {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> ArrayIter {
|
||||
pub fn iter(&self) -> ArrayIter<'_> {
|
||||
ArrayIter(self.iter_item())
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ pub(crate) trait ListType: AsInner<Inner = YTypeRef> {
|
||||
self.as_inner().ty().unwrap().len
|
||||
}
|
||||
|
||||
fn iter_item(&self) -> ListIterator {
|
||||
fn iter_item(&self) -> ListIterator<'_> {
|
||||
let inner = self.as_inner().ty().unwrap();
|
||||
ListIterator {
|
||||
cur: inner.start.clone(),
|
||||
|
||||
@@ -67,7 +67,7 @@ pub(crate) trait MapType: AsInner<Inner = YTypeRef> {
|
||||
self._keys().count() as u64
|
||||
}
|
||||
|
||||
fn _iter(&self) -> EntriesInnerIterator {
|
||||
fn _iter(&self) -> EntriesInnerIterator<'_> {
|
||||
let ty = self.as_inner().ty();
|
||||
|
||||
if let Some(ty) = ty {
|
||||
@@ -85,15 +85,15 @@ pub(crate) trait MapType: AsInner<Inner = YTypeRef> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _keys(&self) -> KeysIterator {
|
||||
fn _keys(&self) -> KeysIterator<'_> {
|
||||
KeysIterator(self._iter())
|
||||
}
|
||||
|
||||
fn _values(&self) -> ValuesIterator {
|
||||
fn _values(&self) -> ValuesIterator<'_> {
|
||||
ValuesIterator(self._iter())
|
||||
}
|
||||
|
||||
fn _entries(&self) -> EntriesIterator {
|
||||
fn _entries(&self) -> EntriesIterator<'_> {
|
||||
EntriesIterator(self._iter())
|
||||
}
|
||||
}
|
||||
@@ -185,22 +185,22 @@ impl Map {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn iter(&self) -> EntriesIterator {
|
||||
pub fn iter(&self) -> EntriesIterator<'_> {
|
||||
self._entries()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn entries(&self) -> EntriesIterator {
|
||||
pub fn entries(&self) -> EntriesIterator<'_> {
|
||||
self._entries()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn keys(&self) -> KeysIterator {
|
||||
pub fn keys(&self) -> KeysIterator<'_> {
|
||||
self._keys()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn values(&self) -> ValuesIterator {
|
||||
pub fn values(&self) -> ValuesIterator<'_> {
|
||||
self._values()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ impl YTypeRef {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ty(&self) -> Option<RwLockReadGuard<YType>> {
|
||||
pub fn ty(&self) -> Option<RwLockReadGuard<'_, YType>> {
|
||||
self.inner.get().and_then(|ty| ty.read().ok())
|
||||
}
|
||||
|
||||
pub fn ty_mut(&self) -> Option<RwLockWriteGuard<YType>> {
|
||||
pub fn ty_mut(&self) -> Option<RwLockWriteGuard<'_, YType>> {
|
||||
self.inner.get().and_then(|ty| ty.write().ok())
|
||||
}
|
||||
|
||||
@@ -128,13 +128,13 @@ impl YTypeRef {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn read(&self) -> Option<(RwLockReadGuard<DocStore>, RwLockReadGuard<YType>)> {
|
||||
pub fn read(&self) -> Option<(RwLockReadGuard<'_, DocStore>, RwLockReadGuard<'_, YType>)> {
|
||||
self
|
||||
.store()
|
||||
.and_then(|store| self.ty().map(|ty| (store, ty)))
|
||||
}
|
||||
|
||||
pub fn write(&self) -> Option<(RwLockWriteGuard<DocStore>, RwLockWriteGuard<YType>)> {
|
||||
pub fn write(&self) -> Option<(RwLockWriteGuard<'_, DocStore>, RwLockWriteGuard<'_, YType>)> {
|
||||
self
|
||||
.store_mut()
|
||||
.and_then(|store| self.ty_mut().map(|ty| (store, ty)))
|
||||
|
||||
@@ -5,7 +5,7 @@ pub struct SyncMessageScanner<'a> {
|
||||
}
|
||||
|
||||
impl SyncMessageScanner<'_> {
|
||||
pub fn new(buffer: &[u8]) -> SyncMessageScanner {
|
||||
pub fn new(buffer: &[u8]) -> SyncMessageScanner<'_> {
|
||||
SyncMessageScanner { buffer }
|
||||
}
|
||||
}
|
||||
|
||||
1
packages/common/y-octo/node/index.d.ts
vendored
1
packages/common/y-octo/node/index.d.ts
vendored
@@ -28,7 +28,6 @@ export declare class YArray {
|
||||
}
|
||||
|
||||
export declare class YMap {
|
||||
constructor()
|
||||
get length(): number
|
||||
get isEmpty(): boolean
|
||||
get<T = unknown>(key: string): T
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
// @ts-nocheck
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
const { createRequire } = require('node:module')
|
||||
require = createRequire(__filename);
|
||||
|
||||
const { readFileSync } = require('node:fs');
|
||||
const { readFileSync } = require('node:fs')
|
||||
let nativeBinding = null;
|
||||
const loadErrors = [];
|
||||
|
||||
@@ -68,7 +65,7 @@ const isMuslFromChildProcess = () => {
|
||||
function requireNative() {
|
||||
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
||||
try {
|
||||
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
} catch (err) {
|
||||
loadErrors.push(err);
|
||||
}
|
||||
@@ -80,7 +77,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-android-arm64');
|
||||
const binding = require('@y-octo/node-android-arm64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-android-arm64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -91,7 +100,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-android-arm-eabi');
|
||||
const binding = require('@y-octo/node-android-arm-eabi');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-android-arm-eabi/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -102,16 +123,56 @@ function requireNative() {
|
||||
}
|
||||
} else if (process.platform === 'win32') {
|
||||
if (process.arch === 'x64') {
|
||||
if (
|
||||
process.config?.variables?.shlib_suffix === 'dll.a' ||
|
||||
process.config?.variables?.node_target_type === 'shared_library'
|
||||
) {
|
||||
try {
|
||||
return require('./y-octo.win32-x64-gnu.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-win32-x64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-win32-x64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./y-octo.win32-x64-msvc.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-win32-x64-msvc');
|
||||
const binding = require('@y-octo/node-win32-x64-msvc');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-win32-x64-msvc/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 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('./y-octo.win32-ia32-msvc.node');
|
||||
@@ -119,7 +180,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-win32-ia32-msvc');
|
||||
const binding = require('@y-octo/node-win32-ia32-msvc');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-win32-ia32-msvc/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -130,7 +203,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-win32-arm64-msvc');
|
||||
const binding = require('@y-octo/node-win32-arm64-msvc');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-win32-arm64-msvc/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -146,11 +231,22 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-darwin-universal');
|
||||
const binding = require('@y-octo/node-darwin-universal');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-darwin-universal/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 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('./y-octo.darwin-x64.node');
|
||||
@@ -158,7 +254,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-darwin-x64');
|
||||
const binding = require('@y-octo/node-darwin-x64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-darwin-x64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -169,7 +277,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-darwin-arm64');
|
||||
const binding = require('@y-octo/node-darwin-arm64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-darwin-arm64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -186,7 +306,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-freebsd-x64');
|
||||
const binding = require('@y-octo/node-freebsd-x64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-freebsd-x64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -197,7 +329,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-freebsd-arm64');
|
||||
const binding = require('@y-octo/node-freebsd-arm64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-freebsd-arm64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -215,7 +359,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-x64-musl');
|
||||
const binding = require('@y-octo/node-linux-x64-musl');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-x64-musl/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -226,7 +382,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-x64-gnu');
|
||||
const binding = require('@y-octo/node-linux-x64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-x64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -239,7 +407,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-arm64-musl');
|
||||
const binding = require('@y-octo/node-linux-arm64-musl');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-arm64-musl/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -250,7 +430,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-arm64-gnu');
|
||||
const binding = require('@y-octo/node-linux-arm64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-arm64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -263,7 +455,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-arm-musleabihf');
|
||||
const binding = require('@y-octo/node-linux-arm-musleabihf');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-arm-musleabihf/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -274,7 +478,67 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-arm-gnueabihf');
|
||||
const binding = require('@y-octo/node-linux-arm-gnueabihf');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-arm-gnueabihf/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'loong64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./y-octo.linux-loong64-musl.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-linux-loong64-musl');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-loong64-musl/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./y-octo.linux-loong64-gnu.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-linux-loong64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-loong64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -287,7 +551,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-riscv64-musl');
|
||||
const binding = require('@y-octo/node-linux-riscv64-musl');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-riscv64-musl/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -298,7 +574,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-riscv64-gnu');
|
||||
const binding = require('@y-octo/node-linux-riscv64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-riscv64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -310,7 +598,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-ppc64-gnu');
|
||||
const binding = require('@y-octo/node-linux-ppc64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-ppc64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -321,7 +621,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-s390x-gnu');
|
||||
const binding = require('@y-octo/node-linux-s390x-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-s390x-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -330,6 +642,81 @@ function requireNative() {
|
||||
new Error(`Unsupported architecture on Linux: ${process.arch}`)
|
||||
);
|
||||
}
|
||||
} else if (process.platform === 'openharmony') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./y-octo.openharmony-arm64.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-openharmony-arm64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-openharmony-arm64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 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('./y-octo.openharmony-x64.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-openharmony-x64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-openharmony-x64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 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('./y-octo.openharmony-arm.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-openharmony-arm');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-openharmony-arm/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
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.25.7 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(
|
||||
@@ -342,35 +729,54 @@ function requireNative() {
|
||||
nativeBinding = requireNative();
|
||||
|
||||
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||
let wasiBinding = null;
|
||||
let wasiBindingError = null;
|
||||
try {
|
||||
nativeBinding = require('./y-octo.wasi.cjs');
|
||||
wasiBinding = require('./y-octo.wasi.cjs');
|
||||
nativeBinding = wasiBinding;
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
loadErrors.push(err);
|
||||
wasiBindingError = err;
|
||||
}
|
||||
}
|
||||
if (!nativeBinding) {
|
||||
try {
|
||||
nativeBinding = require('@y-octo/node-wasm32-wasi');
|
||||
wasiBinding = require('@y-octo/node-wasm32-wasi');
|
||||
nativeBinding = wasiBinding;
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
wasiBindingError.cause = err;
|
||||
loadErrors.push(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
||||
const error = new Error(
|
||||
'WASI binding not found and NAPI_RS_FORCE_WASI is set to error'
|
||||
);
|
||||
error.cause = wasiBindingError;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nativeBinding) {
|
||||
if (loadErrors.length > 0) {
|
||||
// TODO Link to documentation with potential fixes
|
||||
// - The package owner could build/publish bindings for this arch
|
||||
// - The user may need to bundle the correct files
|
||||
// - The user may need to re-install node_modules to get new packages
|
||||
throw new Error('Failed to load native binding', { cause: loadErrors });
|
||||
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.reduce((err, cur) => {
|
||||
cur.cause = err;
|
||||
return cur;
|
||||
}),
|
||||
}
|
||||
);
|
||||
}
|
||||
throw new Error(`Failed to load native binding`);
|
||||
}
|
||||
|
||||
module.exports = nativeBinding;
|
||||
module.exports.Doc = nativeBinding.Doc;
|
||||
module.exports.YArray = nativeBinding.YArray;
|
||||
module.exports.YMap = nativeBinding.YMap;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "3.0.0-alpha.89",
|
||||
"@napi-rs/cli": "3.0.0",
|
||||
"@types/node": "^22.14.1",
|
||||
"@types/prompts": "^2.4.9",
|
||||
"c8": "^10.1.3",
|
||||
|
||||
@@ -105,7 +105,7 @@ impl YMap {
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub fn to_json(&self, env: Env) -> Result<Object> {
|
||||
pub fn to_json(&self, env: Env) -> Result<Object<'_>> {
|
||||
let mut js_object = Object::new(&env)?;
|
||||
for (key, value) in self.map.iter() {
|
||||
js_object.set(key, get_js_unknown_from_value(&env, value))?;
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::*;
|
||||
pub type MixedYType<'a> = Either4<YArray, YMap, YText, Unknown<'a>>;
|
||||
pub type MixedRefYType<'a> = Either4<&'a YArray, &'a YMap, &'a YText, Unknown<'a>>;
|
||||
|
||||
pub fn get_js_unknown_from_any(env: &Env, any: Any) -> Result<Unknown> {
|
||||
pub fn get_js_unknown_from_any(env: &Env, any: Any) -> Result<Unknown<'_>> {
|
||||
match any {
|
||||
Any::Null | Any::Undefined => Null.into_unknown(env),
|
||||
Any::True => true.into_unknown(env),
|
||||
@@ -33,7 +33,7 @@ pub fn get_js_unknown_from_any(env: &Env, any: Any) -> Result<Unknown> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_js_unknown_from_value(env: &Env, value: Value) -> Result<Unknown> {
|
||||
pub fn get_js_unknown_from_value(env: &Env, value: Value) -> Result<Unknown<'_>> {
|
||||
match value {
|
||||
Value::Any(any) => get_js_unknown_from_any(env, any),
|
||||
Value::Array(array) => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { dirname, join } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { StorybookConfig } from '@storybook/react-vite';
|
||||
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
||||
import swc from 'unplugin-swc';
|
||||
@@ -68,5 +69,6 @@ export default {
|
||||
} satisfies StorybookConfig;
|
||||
|
||||
function getAbsolutePath(value: string): any {
|
||||
return dirname(require.resolve(join(value, 'package.json')));
|
||||
return dirname(fileURLToPath(import.meta.resolve(join(value, 'package.json'))));
|
||||
}
|
||||
|
||||
|
||||
@@ -73,16 +73,16 @@
|
||||
"devDependencies": {
|
||||
"@affine-tools/utils": "workspace:*",
|
||||
"@blocksuite/affine": "workspace:*",
|
||||
"@chromatic-com/storybook": "^4.0.0",
|
||||
"@storybook/react": "^9.0.0",
|
||||
"@storybook/react-vite": "^9.0.0",
|
||||
"@chromatic-com/storybook": "^4.1.3",
|
||||
"@storybook/react": "^10.0.0",
|
||||
"@storybook/react-vite": "^10.0.0",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/react": "^16.1.0",
|
||||
"@types/bytes": "^3.1.5",
|
||||
"@types/react": "^19.0.1",
|
||||
"@types/react-dom": "^19.0.2",
|
||||
"@vanilla-extract/css": "^1.17.0",
|
||||
"storybook": "^9.0.0",
|
||||
"storybook": "^10.0.0",
|
||||
"typescript": "^5.7.2",
|
||||
"unplugin-swc": "^1.5.1",
|
||||
"vite": "^7.0.0",
|
||||
|
||||
3
packages/frontend/native/index.d.ts
vendored
3
packages/frontend/native/index.d.ts
vendored
@@ -186,8 +186,7 @@ export declare class SqliteConnection {
|
||||
get isClose(): boolean
|
||||
static validate(path: string): Promise<ValidationResult>
|
||||
migrateAddDocId(): Promise<void>
|
||||
/**
|
||||
* Flush the WAL file to the database file.
|
||||
/** * Flush the WAL file to the database file.
|
||||
* See https://www.sqlite.org/pragma.html#pragma_wal_checkpoint:~:text=PRAGMA%20schema.wal_checkpoint%3B
|
||||
*/
|
||||
checkpoint(): Promise<void>
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
// @ts-nocheck
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
const { createRequire } = require('node:module')
|
||||
require = createRequire(__filename)
|
||||
|
||||
const { readFileSync } = require('node:fs')
|
||||
let nativeBinding = null
|
||||
const loadErrors = []
|
||||
@@ -66,7 +63,7 @@ const isMuslFromChildProcess = () => {
|
||||
function requireNative() {
|
||||
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
||||
try {
|
||||
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
} catch (err) {
|
||||
loadErrors.push(err)
|
||||
}
|
||||
@@ -78,11 +75,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-android-arm64')
|
||||
const binding = require('@affine/native-android-arm64')
|
||||
const bindingPackageVersion = require('@affine/native-android-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.android-arm-eabi.node')
|
||||
@@ -90,27 +91,53 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-android-arm-eabi')
|
||||
const binding = require('@affine/native-android-arm-eabi')
|
||||
const bindingPackageVersion = require('@affine/native-android-arm-eabi/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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') {
|
||||
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
|
||||
try {
|
||||
return require('./affine.win32-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-win32-x64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-win32-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.win32-x64-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-win32-x64-msvc')
|
||||
const binding = require('@affine/native-win32-x64-msvc')
|
||||
const bindingPackageVersion = require('@affine/native-win32-x64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.win32-ia32-msvc.node')
|
||||
@@ -118,11 +145,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-win32-ia32-msvc')
|
||||
const binding = require('@affine/native-win32-ia32-msvc')
|
||||
const bindingPackageVersion = require('@affine/native-win32-ia32-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.win32-arm64-msvc.node')
|
||||
@@ -130,11 +161,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-win32-arm64-msvc')
|
||||
const binding = require('@affine/native-win32-arm64-msvc')
|
||||
const bindingPackageVersion = require('@affine/native-win32-arm64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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}`))
|
||||
}
|
||||
@@ -145,11 +180,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-darwin-universal')
|
||||
const binding = require('@affine/native-darwin-universal')
|
||||
const bindingPackageVersion = require('@affine/native-darwin-universal/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.darwin-x64.node')
|
||||
@@ -157,11 +196,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-darwin-x64')
|
||||
const binding = require('@affine/native-darwin-x64')
|
||||
const bindingPackageVersion = require('@affine/native-darwin-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.darwin-arm64.node')
|
||||
@@ -169,11 +212,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-darwin-arm64')
|
||||
const binding = require('@affine/native-darwin-arm64')
|
||||
const bindingPackageVersion = require('@affine/native-darwin-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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}`))
|
||||
}
|
||||
@@ -185,11 +232,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-freebsd-x64')
|
||||
const binding = require('@affine/native-freebsd-x64')
|
||||
const bindingPackageVersion = require('@affine/native-freebsd-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.freebsd-arm64.node')
|
||||
@@ -197,11 +248,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-freebsd-arm64')
|
||||
const binding = require('@affine/native-freebsd-arm64')
|
||||
const bindingPackageVersion = require('@affine/native-freebsd-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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}`))
|
||||
}
|
||||
@@ -214,11 +269,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-x64-musl')
|
||||
const binding = require('@affine/native-linux-x64-musl')
|
||||
const bindingPackageVersion = require('@affine/native-linux-x64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-x64-gnu.node')
|
||||
@@ -226,11 +285,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-x64-gnu')
|
||||
const binding = require('@affine/native-linux-x64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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()) {
|
||||
@@ -240,11 +303,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-arm64-musl')
|
||||
const binding = require('@affine/native-linux-arm64-musl')
|
||||
const bindingPackageVersion = require('@affine/native-linux-arm64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-arm64-gnu.node')
|
||||
@@ -252,11 +319,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-arm64-gnu')
|
||||
const binding = require('@affine/native-linux-arm64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-arm64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
if (isMusl()) {
|
||||
@@ -266,11 +337,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-arm-musleabihf')
|
||||
const binding = require('@affine/native-linux-arm-musleabihf')
|
||||
const bindingPackageVersion = require('@affine/native-linux-arm-musleabihf/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-arm-gnueabihf.node')
|
||||
@@ -278,11 +353,49 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-arm-gnueabihf')
|
||||
const binding = require('@affine/native-linux-arm-gnueabihf')
|
||||
const bindingPackageVersion = require('@affine/native-linux-arm-gnueabihf/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'loong64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./affine.linux-loong64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-loong64-musl')
|
||||
const bindingPackageVersion = require('@affine/native-linux-loong64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-loong64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-loong64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-loong64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
}
|
||||
} else if (process.arch === 'riscv64') {
|
||||
if (isMusl()) {
|
||||
@@ -292,11 +405,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-riscv64-musl')
|
||||
const binding = require('@affine/native-linux-riscv64-musl')
|
||||
const bindingPackageVersion = require('@affine/native-linux-riscv64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-riscv64-gnu.node')
|
||||
@@ -304,11 +421,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-riscv64-gnu')
|
||||
const binding = require('@affine/native-linux-riscv64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-riscv64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
}
|
||||
} else if (process.arch === 'ppc64') {
|
||||
try {
|
||||
@@ -317,11 +438,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-ppc64-gnu')
|
||||
const binding = require('@affine/native-linux-ppc64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-ppc64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.linux-s390x-gnu.node')
|
||||
@@ -329,14 +454,70 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-s390x-gnu')
|
||||
const binding = require('@affine/native-linux-s390x-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-s390x-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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}`))
|
||||
}
|
||||
} else if (process.platform === 'openharmony') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./affine.openharmony-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-openharmony-arm64')
|
||||
const bindingPackageVersion = require('@affine/native-openharmony-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.openharmony-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-openharmony-x64')
|
||||
const bindingPackageVersion = require('@affine/native-openharmony-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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('./affine.openharmony-arm.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-openharmony-arm')
|
||||
const bindingPackageVersion = require('@affine/native-openharmony-arm/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && 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.25.7 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}`))
|
||||
}
|
||||
@@ -345,22 +526,32 @@ function requireNative() {
|
||||
nativeBinding = requireNative()
|
||||
|
||||
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||
let wasiBinding = null
|
||||
let wasiBindingError = null
|
||||
try {
|
||||
nativeBinding = require('./affine.wasi.cjs')
|
||||
wasiBinding = require('./affine.wasi.cjs')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
loadErrors.push(err)
|
||||
wasiBindingError = err
|
||||
}
|
||||
}
|
||||
if (!nativeBinding) {
|
||||
try {
|
||||
nativeBinding = require('@affine/native-wasm32-wasi')
|
||||
wasiBinding = require('@affine/native-wasm32-wasi')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
wasiBindingError.cause = err
|
||||
loadErrors.push(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
||||
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
||||
error.cause = wasiBindingError
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
if (!nativeBinding) {
|
||||
@@ -369,7 +560,12 @@ if (!nativeBinding) {
|
||||
`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 }
|
||||
{
|
||||
cause: loadErrors.reduce((err, cur) => {
|
||||
cur.cause = err
|
||||
return cur
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
throw new Error(`Failed to load native binding`)
|
||||
|
||||
@@ -66,7 +66,7 @@ impl CATapDescription {
|
||||
Ok(Self { inner: obj })
|
||||
}
|
||||
|
||||
pub fn get_uuid(&self) -> std::result::Result<ItemRef<CFString>, CoreAudioError> {
|
||||
pub fn get_uuid(&self) -> std::result::Result<ItemRef<'_, CFString>, CoreAudioError> {
|
||||
let uuid: *mut NSUUID = unsafe { msg_send![self.inner, UUID] };
|
||||
if uuid.is_null() {
|
||||
return Err(CoreAudioError::GetCATapDescriptionUUIDFailed);
|
||||
|
||||
@@ -95,7 +95,7 @@ impl DocStoragePool {
|
||||
})
|
||||
}
|
||||
|
||||
async fn get(&self, universal_id: String) -> Result<Ref<SqliteDocStorage>> {
|
||||
async fn get(&self, universal_id: String) -> Result<Ref<'_, SqliteDocStorage>> {
|
||||
Ok(self.pool.get(universal_id).await?)
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ impl SqliteDocStoragePool {
|
||||
RefMut { _guard: lock }
|
||||
}
|
||||
|
||||
pub async fn get(&self, universal_id: String) -> Result<Ref<SqliteDocStorage>> {
|
||||
pub async fn get(&self, universal_id: String) -> Result<Ref<'_, SqliteDocStorage>> {
|
||||
let lock = RwLockReadGuard::try_map(self.inner.read().await, |lock| {
|
||||
if let Some(storage) = lock.get(&universal_id) {
|
||||
Some(storage)
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "3.0.0-alpha.89",
|
||||
"@napi-rs/cli": "3.5.0",
|
||||
"@napi-rs/whisper": "^0.0.4",
|
||||
"@types/node": "^22.0.0",
|
||||
"ava": "^6.2.0",
|
||||
"ava": "^6.4.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.7.2"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "1.87.0"
|
||||
channel = "1.91.0"
|
||||
profile = "default"
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine-tools/utils": "workspace:*",
|
||||
"@aws-sdk/client-s3": "^3.709.0",
|
||||
"@clack/core": "^0.4.0",
|
||||
"@clack/prompts": "^0.10.0",
|
||||
"@aws-sdk/client-s3": "^3.947.0",
|
||||
"@napi-rs/simple-git": "^0.1.22",
|
||||
"@perfsee/webpack": "^1.13.0",
|
||||
"@sentry/webpack-plugin": "^3.0.0",
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"version": "0.25.7",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.6.0",
|
||||
"@commitlint/config-conventional": "^19.6.0",
|
||||
"@commitlint/cli": "^19.8.1",
|
||||
"@commitlint/config-conventional": "^19.8.1",
|
||||
"commitlint": "^19.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user