mirror of
https://github.com/zadam/trilium.git
synced 2026-02-17 20:07:01 +01:00
refactor(commons): add builtin_attributes to commons
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import BUILTIN_ATTRIBUTES from "./builtin_attributes.js";
|
||||
import { AnonymizedDbResponse, BUILTIN_ATTRIBUTES, DatabaseAnonymizeResponse } from "@triliumnext/commons";
|
||||
import Database from "better-sqlite3";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import dataDir from "./data_dir.js";
|
||||
import dateUtils from "./date_utils.js";
|
||||
import Database from "better-sqlite3";
|
||||
import sql from "./sql.js";
|
||||
import path from "path";
|
||||
import { AnonymizedDbResponse, DatabaseAnonymizeResponse } from "@triliumnext/commons";
|
||||
|
||||
function getFullAnonymizationScript() {
|
||||
// we want to delete all non-builtin attributes because they can contain sensitive names and values
|
||||
@@ -86,7 +86,7 @@ function getExistingAnonymizedDatabases() {
|
||||
.readdirSync(dataDir.ANONYMIZED_DB_DIR)
|
||||
.filter((fileName) => fileName.includes("anonymized"))
|
||||
.map((fileName) => ({
|
||||
fileName: fileName,
|
||||
fileName,
|
||||
filePath: path.resolve(dataDir.ANONYMIZED_DB_DIR, fileName)
|
||||
})) satisfies AnonymizedDbResponse[];
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
"use strict";
|
||||
import { type AttributeRow, BUILTIN_ATTRIBUTES } from "@triliumnext/commons";
|
||||
|
||||
import searchService from "./search/services/search.js";
|
||||
import sql from "./sql.js";
|
||||
import becca from "../becca/becca.js";
|
||||
import BAttribute from "../becca/entities/battribute.js";
|
||||
import attributeFormatter from "./attribute_formatter.js";
|
||||
import BUILTIN_ATTRIBUTES from "./builtin_attributes.js";
|
||||
import type BNote from "../becca/entities/bnote.js";
|
||||
import type { AttributeRow } from "@triliumnext/commons";
|
||||
import attributeFormatter from "./attribute_formatter.js";
|
||||
import searchService from "./search/services/search.js";
|
||||
import sql from "./sql.js";
|
||||
|
||||
const ATTRIBUTE_TYPES = new Set(["label", "relation"]);
|
||||
|
||||
@@ -41,18 +39,18 @@ function getNoteWithLabel(name: string, value?: string): BNote | null {
|
||||
|
||||
function createLabel(noteId: string, name: string, value: string = "") {
|
||||
return createAttribute({
|
||||
noteId: noteId,
|
||||
noteId,
|
||||
type: "label",
|
||||
name: name,
|
||||
value: value
|
||||
name,
|
||||
value
|
||||
});
|
||||
}
|
||||
|
||||
function createRelation(noteId: string, name: string, targetNoteId: string) {
|
||||
return createAttribute({
|
||||
noteId: noteId,
|
||||
noteId,
|
||||
type: "relation",
|
||||
name: name,
|
||||
name,
|
||||
value: targetNoteId
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,3 +13,4 @@ export * from "./lib/attribute_names.js";
|
||||
export * from "./lib/utils.js";
|
||||
export * from "./lib/dayjs.js";
|
||||
export * from "./lib/notes.js";
|
||||
export { default as BUILTIN_ATTRIBUTES } from "./lib/builtin_attributes.js";
|
||||
|
||||
Reference in New Issue
Block a user