@@ -1,3 +1,5 @@
|
|||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Map as JsonMap, Value as JsonValue};
|
use serde_json::{Map as JsonMap, Value as JsonValue};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
@@ -8,8 +10,8 @@ use super::{
|
|||||||
DocContext, collect_child_ids, get_block_id, get_flavour, get_list_depth, get_string, nearest_by_flavour,
|
DocContext, collect_child_ids, get_block_id, get_flavour, get_list_depth, get_string, nearest_by_flavour,
|
||||||
},
|
},
|
||||||
delta_markdown::{
|
delta_markdown::{
|
||||||
DeltaToMdOptions, delta_value_to_inline_markdown, extract_inline_references, text_to_inline_markdown,
|
DeltaToMdOptions, InlineReferencePayload, delta_value_to_inline_markdown, extract_inline_references,
|
||||||
text_to_markdown,
|
extract_inline_references_from_value, text_to_inline_markdown, text_to_markdown,
|
||||||
},
|
},
|
||||||
value::{any_as_string, any_truthy, build_reference_payload, params_value_to_json, value_to_string},
|
value::{any_as_string, any_truthy, build_reference_payload, params_value_to_json, value_to_string},
|
||||||
};
|
};
|
||||||
@@ -500,6 +502,11 @@ pub fn parse_doc_from_binary(doc_bin: Vec<u8>, doc_id: String) -> Result<CrawlRe
|
|||||||
compose_additional(&display_mode, note_block_id.as_ref(), database_name.as_ref()),
|
compose_additional(&display_mode, note_block_id.as_ref(), database_name.as_ref()),
|
||||||
);
|
);
|
||||||
info.content = Some(texts);
|
info.content = Some(texts);
|
||||||
|
let refs = collect_database_cell_references(block);
|
||||||
|
if !refs.is_empty() {
|
||||||
|
info.ref_doc_id = Some(refs.iter().map(|r| r.doc_id.clone()).collect());
|
||||||
|
info.ref_info = Some(refs.into_iter().map(|r| r.payload).collect());
|
||||||
|
}
|
||||||
blocks.push(info);
|
blocks.push(info);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -750,6 +757,38 @@ fn gather_database_texts(block: &Map) -> (Vec<String>, Option<String>) {
|
|||||||
(texts, database_title)
|
(texts, database_title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn collect_database_cell_references(block: &Map) -> Vec<InlineReferencePayload> {
|
||||||
|
let cells_map = match block.get("prop:cells").and_then(|value| value.to_map()) {
|
||||||
|
Some(map) => map,
|
||||||
|
None => return Vec::new(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut refs = Vec::new();
|
||||||
|
let mut seen: HashSet<(String, String)> = HashSet::new();
|
||||||
|
|
||||||
|
for row in cells_map.values() {
|
||||||
|
let Some(row_map) = row.to_map() else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
for cell in row_map.values() {
|
||||||
|
let Some(cell_map) = cell.to_map() else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Some(value) = cell_map.get("value") else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
for reference in extract_inline_references_from_value(&value) {
|
||||||
|
let key = (reference.doc_id.clone(), reference.payload.clone());
|
||||||
|
if seen.insert(key) {
|
||||||
|
refs.push(reference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
refs
|
||||||
|
}
|
||||||
|
|
||||||
fn gather_table_contents(block: &Map) -> Vec<String> {
|
fn gather_table_contents(block: &Map) -> Vec<String> {
|
||||||
let mut contents = Vec::new();
|
let mut contents = Vec::new();
|
||||||
for key in block.keys() {
|
for key in block.keys() {
|
||||||
@@ -983,6 +1022,9 @@ fn append_summary(summary: &mut String, remaining: &mut isize, text_len: usize,
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use serde_json::json;
|
||||||
|
use y_octo::{AHashMap, Any, TextAttributes, TextDeltaOp, TextInsert, Value};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1001,6 +1043,97 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_database_cell_references() {
|
||||||
|
let doc_id = "doc-with-db".to_string();
|
||||||
|
let doc = DocOptions::new().with_guid(doc_id.clone()).build();
|
||||||
|
let mut blocks = doc.get_or_create_map("blocks").unwrap();
|
||||||
|
|
||||||
|
let mut page = doc.create_map().unwrap();
|
||||||
|
page.insert("sys:id".into(), "page").unwrap();
|
||||||
|
page.insert("sys:flavour".into(), "affine:page").unwrap();
|
||||||
|
let mut page_children = doc.create_array().unwrap();
|
||||||
|
page_children.push("note").unwrap();
|
||||||
|
page.insert("sys:children".into(), Value::Array(page_children)).unwrap();
|
||||||
|
let mut page_title = doc.create_text().unwrap();
|
||||||
|
page_title.insert(0, "Page").unwrap();
|
||||||
|
page.insert("prop:title".into(), Value::Text(page_title)).unwrap();
|
||||||
|
blocks.insert("page".into(), Value::Map(page)).unwrap();
|
||||||
|
|
||||||
|
let mut note = doc.create_map().unwrap();
|
||||||
|
note.insert("sys:id".into(), "note").unwrap();
|
||||||
|
note.insert("sys:flavour".into(), "affine:note").unwrap();
|
||||||
|
let mut note_children = doc.create_array().unwrap();
|
||||||
|
note_children.push("db").unwrap();
|
||||||
|
note.insert("sys:children".into(), Value::Array(note_children)).unwrap();
|
||||||
|
note.insert("prop:displayMode".into(), "page").unwrap();
|
||||||
|
blocks.insert("note".into(), Value::Map(note)).unwrap();
|
||||||
|
|
||||||
|
let mut db = doc.create_map().unwrap();
|
||||||
|
db.insert("sys:id".into(), "db").unwrap();
|
||||||
|
db.insert("sys:flavour".into(), "affine:database").unwrap();
|
||||||
|
db.insert("sys:children".into(), Value::Array(doc.create_array().unwrap()))
|
||||||
|
.unwrap();
|
||||||
|
let mut db_title = doc.create_text().unwrap();
|
||||||
|
db_title.insert(0, "Database").unwrap();
|
||||||
|
db.insert("prop:title".into(), Value::Text(db_title)).unwrap();
|
||||||
|
|
||||||
|
let mut columns = doc.create_array().unwrap();
|
||||||
|
let mut column = doc.create_map().unwrap();
|
||||||
|
column.insert("id".into(), "col1").unwrap();
|
||||||
|
column.insert("name".into(), "Text").unwrap();
|
||||||
|
column.insert("type".into(), "rich-text").unwrap();
|
||||||
|
column
|
||||||
|
.insert("data".into(), Value::Map(doc.create_map().unwrap()))
|
||||||
|
.unwrap();
|
||||||
|
columns.push(Value::Map(column)).unwrap();
|
||||||
|
db.insert("prop:columns".into(), Value::Array(columns)).unwrap();
|
||||||
|
|
||||||
|
let mut cell_text = doc.create_text().unwrap();
|
||||||
|
let mut reference = AHashMap::default();
|
||||||
|
reference.insert("pageId".into(), Any::String("target-doc".into()));
|
||||||
|
let mut params = AHashMap::default();
|
||||||
|
params.insert("mode".into(), Any::String("page".into()));
|
||||||
|
reference.insert("params".into(), Any::Object(params));
|
||||||
|
let mut attrs = TextAttributes::new();
|
||||||
|
attrs.insert("reference".into(), Any::Object(reference));
|
||||||
|
cell_text
|
||||||
|
.apply_delta(&[
|
||||||
|
TextDeltaOp::Insert {
|
||||||
|
insert: TextInsert::Text("See ".into()),
|
||||||
|
format: None,
|
||||||
|
},
|
||||||
|
TextDeltaOp::Insert {
|
||||||
|
insert: TextInsert::Text("Target".into()),
|
||||||
|
format: Some(attrs),
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let mut cell = doc.create_map().unwrap();
|
||||||
|
cell.insert("columnId".into(), "col1").unwrap();
|
||||||
|
cell.insert("value".into(), Value::Text(cell_text)).unwrap();
|
||||||
|
let mut row = doc.create_map().unwrap();
|
||||||
|
row.insert("col1".into(), Value::Map(cell)).unwrap();
|
||||||
|
let mut cells = doc.create_map().unwrap();
|
||||||
|
cells.insert("row1".into(), Value::Map(row)).unwrap();
|
||||||
|
db.insert("prop:cells".into(), Value::Map(cells)).unwrap();
|
||||||
|
|
||||||
|
blocks.insert("db".into(), Value::Map(db)).unwrap();
|
||||||
|
|
||||||
|
let doc_bin = doc.encode_update_v1().unwrap();
|
||||||
|
let result = parse_doc_from_binary(doc_bin, doc_id).unwrap();
|
||||||
|
let db_block = result.blocks.iter().find(|block| block.block_id == "db").unwrap();
|
||||||
|
assert_eq!(db_block.ref_doc_id, Some(vec!["target-doc".to_string()]));
|
||||||
|
assert_eq!(
|
||||||
|
db_block.ref_info,
|
||||||
|
Some(vec![build_reference_payload(
|
||||||
|
"target-doc",
|
||||||
|
Some(json!({"mode": "page"}))
|
||||||
|
)])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_paragraph_newlines() {
|
fn test_paragraph_newlines() {
|
||||||
let mut markdown = String::new();
|
let mut markdown = String::new();
|
||||||
|
|||||||
@@ -102,6 +102,49 @@ pub(super) fn extract_inline_references(delta: &[TextDeltaOp]) -> Vec<InlineRefe
|
|||||||
refs
|
refs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) fn extract_inline_references_from_value(value: &Value) -> Vec<InlineReferencePayload> {
|
||||||
|
if let Some(text) = value.to_text() {
|
||||||
|
return extract_inline_references(&text.to_delta());
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(any) = value_to_any(value) else {
|
||||||
|
return Vec::new();
|
||||||
|
};
|
||||||
|
|
||||||
|
extract_inline_references_from_any(&any)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extract_inline_references_from_any(value: &Any) -> Vec<InlineReferencePayload> {
|
||||||
|
let Some(ops) = delta_ops_from_any(value) else {
|
||||||
|
return Vec::new();
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut refs = Vec::new();
|
||||||
|
let mut seen: HashSet<(String, String)> = HashSet::new();
|
||||||
|
|
||||||
|
for op in ops {
|
||||||
|
let reference = match op.attributes.get("reference").and_then(parse_inline_reference) {
|
||||||
|
Some(reference) => reference,
|
||||||
|
None => continue,
|
||||||
|
};
|
||||||
|
|
||||||
|
let payload = match inline_reference_payload(&reference) {
|
||||||
|
Some(payload) => payload,
|
||||||
|
None => continue,
|
||||||
|
};
|
||||||
|
|
||||||
|
let key = (reference.page_id.clone(), payload.clone());
|
||||||
|
if seen.insert(key.clone()) {
|
||||||
|
refs.push(InlineReferencePayload {
|
||||||
|
doc_id: key.0,
|
||||||
|
payload: key.1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
refs
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_inline_reference(value: &Any) -> Option<InlineReference> {
|
fn parse_inline_reference(value: &Any) -> Option<InlineReference> {
|
||||||
let map = match value {
|
let map = match value {
|
||||||
Any::Object(map) => map,
|
Any::Object(map) => map,
|
||||||
|
|||||||
@@ -2,7 +2,13 @@ import { readFileSync } from 'node:fs';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { expect, test } from 'vitest';
|
import { expect, test } from 'vitest';
|
||||||
import { applyUpdate, Array as YArray, Doc as YDoc, Map as YMap } from 'yjs';
|
import {
|
||||||
|
applyUpdate,
|
||||||
|
Array as YArray,
|
||||||
|
Doc as YDoc,
|
||||||
|
Map as YMap,
|
||||||
|
Text as YText,
|
||||||
|
} from 'yjs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
parsePageDoc,
|
parsePageDoc,
|
||||||
@@ -160,3 +166,79 @@ test('should parse page full doc work with ai editable', () => {
|
|||||||
|
|
||||||
expect(result.md).toMatchSnapshot();
|
expect(result.md).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should index references from database rich-text cells', async () => {
|
||||||
|
const doc = new YDoc({
|
||||||
|
guid: 'db-doc',
|
||||||
|
});
|
||||||
|
const blocks = doc.getMap('blocks');
|
||||||
|
|
||||||
|
const pageTitle = new YText();
|
||||||
|
pageTitle.insert(0, 'Page');
|
||||||
|
const page = new YMap();
|
||||||
|
page.set('sys:id', 'page');
|
||||||
|
page.set('sys:flavour', 'affine:page');
|
||||||
|
page.set('sys:children', YArray.from(['note']));
|
||||||
|
page.set('prop:title', pageTitle);
|
||||||
|
blocks.set('page', page);
|
||||||
|
|
||||||
|
const note = new YMap();
|
||||||
|
note.set('sys:id', 'note');
|
||||||
|
note.set('sys:flavour', 'affine:note');
|
||||||
|
note.set('sys:children', YArray.from(['db']));
|
||||||
|
note.set('prop:displayMode', 'page');
|
||||||
|
blocks.set('note', note);
|
||||||
|
|
||||||
|
const dbTitle = new YText();
|
||||||
|
dbTitle.insert(0, 'Database');
|
||||||
|
const db = new YMap();
|
||||||
|
db.set('sys:id', 'db');
|
||||||
|
db.set('sys:flavour', 'affine:database');
|
||||||
|
db.set('sys:children', new YArray());
|
||||||
|
db.set('prop:title', dbTitle);
|
||||||
|
|
||||||
|
const columns = new YArray();
|
||||||
|
const column = new YMap();
|
||||||
|
column.set('id', 'col1');
|
||||||
|
column.set('name', 'Text');
|
||||||
|
column.set('type', 'rich-text');
|
||||||
|
column.set('data', new YMap());
|
||||||
|
columns.push([column]);
|
||||||
|
db.set('prop:columns', columns);
|
||||||
|
|
||||||
|
const cellText = new YText();
|
||||||
|
cellText.applyDelta([
|
||||||
|
{ insert: 'See ' },
|
||||||
|
{
|
||||||
|
insert: 'Target',
|
||||||
|
attributes: {
|
||||||
|
reference: {
|
||||||
|
pageId: 'target-doc',
|
||||||
|
params: { mode: 'page' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const cell = new YMap();
|
||||||
|
cell.set('columnId', 'col1');
|
||||||
|
cell.set('value', cellText);
|
||||||
|
const row = new YMap();
|
||||||
|
row.set('col1', cell);
|
||||||
|
const cells = new YMap();
|
||||||
|
cells.set('row1', row);
|
||||||
|
db.set('prop:cells', cells);
|
||||||
|
|
||||||
|
blocks.set('db', db);
|
||||||
|
|
||||||
|
const result = await readAllBlocksFromDoc({
|
||||||
|
ydoc: doc,
|
||||||
|
spaceId: 'test-space',
|
||||||
|
});
|
||||||
|
|
||||||
|
const dbBlock = result?.blocks.find(block => block.blockId === 'db');
|
||||||
|
expect(dbBlock?.refDocId).toEqual(['target-doc']);
|
||||||
|
expect(dbBlock?.ref).toEqual([
|
||||||
|
JSON.stringify({ docId: 'target-doc', mode: 'page' }),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
type TransformerMiddleware,
|
type TransformerMiddleware,
|
||||||
type YBlock,
|
type YBlock,
|
||||||
} from '@blocksuite/affine/store';
|
} from '@blocksuite/affine/store';
|
||||||
import { uniq } from 'lodash-es';
|
import { uniqBy } from 'lodash-es';
|
||||||
import {
|
import {
|
||||||
Array as YArray,
|
Array as YArray,
|
||||||
type Doc as YDoc,
|
type Doc as YDoc,
|
||||||
@@ -58,6 +58,81 @@ const bookmarkFlavours = new Set([
|
|||||||
'affine:embed-loom',
|
'affine:embed-loom',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const collectInlineReferences = (
|
||||||
|
deltas: DeltaInsert<AffineTextAttributes>[]
|
||||||
|
): { refDocId: string; ref: string }[] =>
|
||||||
|
uniqBy(
|
||||||
|
deltas
|
||||||
|
.flatMap(delta => {
|
||||||
|
if (
|
||||||
|
delta.attributes &&
|
||||||
|
delta.attributes.reference &&
|
||||||
|
delta.attributes.reference.pageId
|
||||||
|
) {
|
||||||
|
const { pageId: refDocId, params = {} } = delta.attributes.reference;
|
||||||
|
return {
|
||||||
|
refDocId,
|
||||||
|
ref: JSON.stringify({ docId: refDocId, ...params }),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.filter((ref): ref is { refDocId: string; ref: string } => ref !== null),
|
||||||
|
item => item.ref
|
||||||
|
);
|
||||||
|
|
||||||
|
const getTextDeltasFromCellValue = (
|
||||||
|
value: unknown
|
||||||
|
): DeltaInsert<AffineTextAttributes>[] | null => {
|
||||||
|
if (!value) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value instanceof YText) {
|
||||||
|
return value.toDelta() as DeltaInsert<AffineTextAttributes>[];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === 'object' && value !== null) {
|
||||||
|
const maybeText = value as { yText?: unknown };
|
||||||
|
if (maybeText.yText instanceof YText) {
|
||||||
|
return maybeText.yText.toDelta() as DeltaInsert<AffineTextAttributes>[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value instanceof YMap) {
|
||||||
|
const marker = value.get('$blocksuite:internal:text$');
|
||||||
|
const delta = value.get('delta');
|
||||||
|
if (marker) {
|
||||||
|
if (delta instanceof YArray) {
|
||||||
|
return delta
|
||||||
|
.toArray()
|
||||||
|
.map(entry => (entry instanceof YMap ? entry.toJSON() : entry)) as
|
||||||
|
| DeltaInsert<AffineTextAttributes>[]
|
||||||
|
| null;
|
||||||
|
}
|
||||||
|
if (Array.isArray(delta)) {
|
||||||
|
return delta as DeltaInsert<AffineTextAttributes>[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof value === 'object' &&
|
||||||
|
value !== null &&
|
||||||
|
'$blocksuite:internal:text$' in value
|
||||||
|
) {
|
||||||
|
const delta = (value as { delta?: unknown }).delta;
|
||||||
|
if (delta instanceof YArray) {
|
||||||
|
return delta.toArray() as DeltaInsert<AffineTextAttributes>[];
|
||||||
|
}
|
||||||
|
if (Array.isArray(delta)) {
|
||||||
|
return delta as DeltaInsert<AffineTextAttributes>[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
function generateMarkdownPreviewBuilder(
|
function generateMarkdownPreviewBuilder(
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
blocks: BlockDocumentInfo[],
|
blocks: BlockDocumentInfo[],
|
||||||
@@ -587,25 +662,7 @@ export async function readAllBlocksFromDoc({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const deltas: DeltaInsert<AffineTextAttributes>[] = text.toDelta();
|
const deltas: DeltaInsert<AffineTextAttributes>[] = text.toDelta();
|
||||||
const refs = uniq(
|
const refs = collectInlineReferences(deltas);
|
||||||
deltas
|
|
||||||
.flatMap(delta => {
|
|
||||||
if (
|
|
||||||
delta.attributes &&
|
|
||||||
delta.attributes.reference &&
|
|
||||||
delta.attributes.reference.pageId
|
|
||||||
) {
|
|
||||||
const { pageId: refDocId, params = {} } =
|
|
||||||
delta.attributes.reference;
|
|
||||||
return {
|
|
||||||
refDocId,
|
|
||||||
ref: JSON.stringify({ docId: refDocId, ...params }),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
.filter(ref => !!ref)
|
|
||||||
);
|
|
||||||
|
|
||||||
const databaseName =
|
const databaseName =
|
||||||
flavour === 'affine:paragraph' && parentFlavour === 'affine:database' // if block is a database row
|
flavour === 'affine:paragraph' && parentFlavour === 'affine:database' // if block is a database row
|
||||||
@@ -741,6 +798,29 @@ export async function readAllBlocksFromDoc({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const databaseRefs: { refDocId: string; ref: string }[] = [];
|
||||||
|
const cellsObj = block.get('prop:cells');
|
||||||
|
if (cellsObj instanceof YMap) {
|
||||||
|
for (const row of cellsObj.values()) {
|
||||||
|
if (!(row instanceof YMap)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const cell of row.values()) {
|
||||||
|
if (!(cell instanceof YMap)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const deltas = getTextDeltasFromCellValue(cell.get('value'));
|
||||||
|
if (!deltas?.length) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const refs = collectInlineReferences(deltas);
|
||||||
|
if (refs.length) {
|
||||||
|
databaseRefs.push(...refs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
blockDocuments.push({
|
blockDocuments.push({
|
||||||
...commonBlockProps,
|
...commonBlockProps,
|
||||||
content: texts,
|
content: texts,
|
||||||
@@ -748,6 +828,16 @@ export async function readAllBlocksFromDoc({
|
|||||||
...commonBlockProps.additional,
|
...commonBlockProps.additional,
|
||||||
databaseName: databaseTitle?.toString(),
|
databaseName: databaseTitle?.toString(),
|
||||||
},
|
},
|
||||||
|
...(databaseRefs.length
|
||||||
|
? databaseRefs.reduce<{ refDocId: string[]; ref: string[] }>(
|
||||||
|
(prev, curr) => {
|
||||||
|
prev.refDocId.push(curr.refDocId);
|
||||||
|
prev.ref.push(curr.ref);
|
||||||
|
return prev;
|
||||||
|
},
|
||||||
|
{ refDocId: [], ref: [] }
|
||||||
|
)
|
||||||
|
: {}),
|
||||||
});
|
});
|
||||||
} else if (flavour === 'affine:latex') {
|
} else if (flavour === 'affine:latex') {
|
||||||
blockDocuments.push({
|
blockDocuments.push({
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export class DocBacklinks extends Entity {
|
|||||||
'markdownPreview',
|
'markdownPreview',
|
||||||
],
|
],
|
||||||
pagination: {
|
pagination: {
|
||||||
limit: 5, // the max number of backlinks to show for each doc
|
limit: BUILD_CONFIG.isElectron ? 100 : 5, // the max number of backlinks to show for each doc
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
pagination: {
|
pagination: {
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-android-arm64')
|
const binding = require('@affine/native-android-arm64')
|
||||||
const bindingPackageVersion = require('@affine/native-android-arm64/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -93,8 +93,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -114,8 +114,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-win32-x64-gnu')
|
const binding = require('@affine/native-win32-x64-gnu')
|
||||||
const bindingPackageVersion = require('@affine/native-win32-x64-gnu/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -130,8 +130,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -147,8 +147,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -163,8 +163,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -182,8 +182,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-darwin-universal')
|
const binding = require('@affine/native-darwin-universal')
|
||||||
const bindingPackageVersion = require('@affine/native-darwin-universal/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -198,8 +198,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-darwin-x64')
|
const binding = require('@affine/native-darwin-x64')
|
||||||
const bindingPackageVersion = require('@affine/native-darwin-x64/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -214,8 +214,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-darwin-arm64')
|
const binding = require('@affine/native-darwin-arm64')
|
||||||
const bindingPackageVersion = require('@affine/native-darwin-arm64/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -234,8 +234,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-freebsd-x64')
|
const binding = require('@affine/native-freebsd-x64')
|
||||||
const bindingPackageVersion = require('@affine/native-freebsd-x64/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -250,8 +250,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-freebsd-arm64')
|
const binding = require('@affine/native-freebsd-arm64')
|
||||||
const bindingPackageVersion = require('@affine/native-freebsd-arm64/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -271,8 +271,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -287,8 +287,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -305,8 +305,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -321,8 +321,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -339,8 +339,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -355,8 +355,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -373,8 +373,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-linux-loong64-musl')
|
const binding = require('@affine/native-linux-loong64-musl')
|
||||||
const bindingPackageVersion = require('@affine/native-linux-loong64-musl/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -389,8 +389,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-linux-loong64-gnu')
|
const binding = require('@affine/native-linux-loong64-gnu')
|
||||||
const bindingPackageVersion = require('@affine/native-linux-loong64-gnu/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -407,8 +407,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -423,8 +423,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -440,8 +440,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -456,8 +456,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = 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
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -476,8 +476,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-openharmony-arm64')
|
const binding = require('@affine/native-openharmony-arm64')
|
||||||
const bindingPackageVersion = require('@affine/native-openharmony-arm64/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -492,8 +492,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-openharmony-x64')
|
const binding = require('@affine/native-openharmony-x64')
|
||||||
const bindingPackageVersion = require('@affine/native-openharmony-x64/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -508,8 +508,8 @@ function requireNative() {
|
|||||||
try {
|
try {
|
||||||
const binding = require('@affine/native-openharmony-arm')
|
const binding = require('@affine/native-openharmony-arm')
|
||||||
const bindingPackageVersion = require('@affine/native-openharmony-arm/package.json').version
|
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') {
|
if (bindingPackageVersion !== '0.26.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.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
throw new Error(`Native binding package version mismatch, expected 0.26.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
}
|
}
|
||||||
return binding
|
return binding
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user