From 55bee6fdc7d3337bc5a9cb9f7d8ceb3e9e12a912 Mon Sep 17 00:00:00 2001 From: GeoffreyChen777 Date: Mon, 29 Jan 2024 18:37:01 +0000 Subject: [PATCH] Bump up to 3.0.0-beta.4 (#363) --- CHANGELOG_CN.md | 7 + CHANGELOG_EN.md | 7 + package.json | 2 +- paperlib-api/dist/api.d.ts | 683 +++++++++++++++++++++++++++++------ paperlib-api/dist/model.d.ts | 18 +- paperlib-api/dist/model.mjs | 37 +- paperlib-api/dist/utils.d.ts | 13 +- paperlib-api/package.json | 2 +- release-notes.md | 7 +- 9 files changed, 628 insertions(+), 148 deletions(-) diff --git a/CHANGELOG_CN.md b/CHANGELOG_CN.md index 1f2f94cd..ab394254 100644 --- a/CHANGELOG_CN.md +++ b/CHANGELOG_CN.md @@ -1,3 +1,10 @@ +## v3.0.0-beta.4 29/01 2024 + +1. 重要特性:层级组以及层级的 Smart 过滤器! +2. 新特性:表格视图列的顺序调整以及支持更多的列。 +3. 新特性:Smart 过滤器支持了创建后编辑,并加入了更人性化的提示。 +4. 修复了一些 Bug。 + ## v3.0.0-beta.3 15/01 2024 1. 修复了一些 Bug。 diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md index 73209bf0..c82fe1e4 100644 --- a/CHANGELOG_EN.md +++ b/CHANGELOG_EN.md @@ -1,3 +1,10 @@ +## v3.0.0-beta.4 29/01 2024 + +1. Important New Feature: Hierarchy Folders and SmartFilters! +2. New Feature: Table view column order and more columns. +3. New Feature: SmartFilter can be edited after creation. Add more human-friendly labels for SmartFilter creation. +4. Fixed some bugs. + ## v3.0.0-beta.3 Jan 15 2024 1. Fixed some bugs. diff --git a/package.json b/package.json index 13ef1b61..f5c8776e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paperlib-beta", - "version": "3.0.0-beta.3", + "version": "3.0.0-beta.4", "main": "dist/main-entry.js", "description": "A simple academic paper management tool.", "author": "Future Scholars ", diff --git a/paperlib-api/dist/api.d.ts b/paperlib-api/dist/api.d.ts index 4b6de9b1..cf9b58ba 100644 --- a/paperlib-api/dist/api.d.ts +++ b/paperlib-api/dist/api.d.ts @@ -121,22 +121,23 @@ declare class Categorizer { _id: OID; _partition: string; name: string; + color: string; count: number; - color?: string; - constructor(object: ICategorizerDraft, initObjectId?: boolean); + children: Categorizer[]; + constructor(object?: ICategorizerDraft, initObjectId?: boolean); initialize(object: ICategorizerDraft): this; } declare class CategorizerRepository extends Eventable { constructor(); /** - * Transform categorizer to realm object if exists in database. Otherwise, return undefined. + * Transform categorizer to realm object if exists in database. Otherwise, return null. * @param realm - Realm instance * @param type - Categorizer type * @param categorizer - Categorizer - * @returns Realm object or undefined + * @returns Realm object or null */ - toRealmObject(realm: Realm_2, type: CategorizerType, categorizer: ICategorizerObject): ICategorizerRealmObject | undefined; + toRealmObject(realm: Realm_2, type: CategorizerType, categorizer: ICategorizerObject): ICategorizerRealmObject | null; /** * Load all categorizers. * @param realm - Realm instance @@ -153,34 +154,15 @@ declare class CategorizerRepository extends Eventable); + update(realm: Realm_2, type: CategorizerType, categorizer: ICategorizerObject, partition: string, parent?: ICategorizerObject): ICategorizerRealmObject | (Categorizer & Realm_2.Object); + /** + * Recursively update children name. + */ + private _updateChildrenName; + /** + * Check circular reference. + */ + private _checkCircularReference; updateCount(realm: Realm_2, type: CategorizerType, categorizers: ICategorizerCollection): void; } @@ -208,13 +199,20 @@ declare class CategorizerService extends Eventable { * @returns */ load(type: CategorizerType, sortBy: string, sortOrder: string): Promise; + /** + * Load categorizers by ids. + * @param type - The type of the categorizer. + * @param ids - The ids of the categorizers. + * @returns + */ + loadByIds(type: CategorizerType, ids: OID[]): Promise; /** * Update a categorizer. * @param type - The type of categorizer. * @param categorizer - The categorizer. * @returns */ - create(type: CategorizerType, categorizer: Categorizer): Promise)>; + create(type: CategorizerType, categorizer: Categorizer, parent?: Categorizer): Promise)>; /** * Delete a categorizer. * @param type - The type of categorizer. @@ -225,21 +223,28 @@ declare class CategorizerService extends Eventable { delete(type: CategorizerType, ids?: OID[], categorizers?: ICategorizerCollection): Promise; /** * Colorize a categorizer. + * @param id - The id of the categorizer. * @param color - The color. * @param type - The type of the categorizer. - * @param name - The name of the categorizer. - * @param categorizer - The categorizer. * @returns */ - colorize(color: Colors, type: CategorizerType, id?: OID, categorizer?: ICategorizerObject): Promise; + colorize(id: OID, color: Colors, type: CategorizerType): Promise; /** * Rename a categorizer. - * @param oldName - The old name. - * @param newName - The new name. + * @param id - The id of the categorizer. + * @param name - The new name of the categorizer. + * @param type - The type of the categorizer. + * @returns + */ + rename(id: OID, name: string, type: CategorizerType): Promise; + /** + * Update/Insert a categorizer. * @param type - The type of the categorizer. + * @param categorizer - The categorizer. + * @param parentCategorizer - The parent categorizer to insert. * @returns */ - rename(oldName: string, newName: string, type: CategorizerType): Promise; + update(type: CategorizerType, categorizer: Categorizer, parentCategorizer?: Categorizer): Promise)>; } declare enum CategorizerType { @@ -1109,13 +1114,13 @@ declare interface ICategorizerDraft { _id?: OID; _partition?: string; name?: string; - count?: number; color?: string; + children?: ICategorizerDraft[]; } declare type ICategorizerObject = Categorizer | ICategorizerRealmObject; -declare type ICategorizerRealmObject = Categorizer & Realm_2.Object; +declare type ICategorizerRealmObject = Categorizer & Realm_2.Object; declare interface ICategorizerRepositoryState { tagsUpdated: number; @@ -1192,6 +1197,12 @@ declare interface IDatabaseServiceState { dbInitialized: number; } +declare interface IDataViewField { + key: string; + enable: boolean; + width: number; +} + declare interface IDisposable { dispose: () => void; } @@ -1383,15 +1394,6 @@ declare interface IPaperEntityRepositoryState { updated: number; } -declare interface IPaperFilterOptions { - search?: string; - searchMode?: "general" | "fulltext" | "advanced"; - flaged?: boolean; - tag?: string; - folder?: string; - limit?: number; -} - declare interface IPaperServiceState { count: number; updated: number; @@ -1405,11 +1407,12 @@ declare interface IPaperSmartFilterDraft { name?: string; filter?: string; color?: string; + children?: IPaperSmartFilterDraft[]; } declare type IPaperSmartFilterObject = PaperSmartFilter | IPaperSmartFilterRealmObject; -declare type IPaperSmartFilterRealmObject = PaperSmartFilter & Realm_2.Object; +declare type IPaperSmartFilterRealmObject = PaperSmartFilter & Realm_2.Object; declare interface IPreferenceStore { preferenceVersion: number; @@ -1418,36 +1421,11 @@ declare interface IPreferenceStore { width: number; }; appLibFolder: string; - deleteSourceFile: boolean; sourceFileOperation: "cut" | "copy" | "link"; showSidebarCount: boolean; isSidebarCompact: boolean; - showMainYear: boolean; - showMainPublication: boolean; - showMainPubType: boolean; - showMainRating: boolean; - showMainFlag: boolean; - showMainTags: boolean; - showMainFolders: boolean; - showMainNote: boolean; - showMainAddTime: boolean; - mainTitleWidth: number; - mainAuthorsWidth: number; - mainYearWidth: number; - mainPublicationWidth: number; - mainPubTypeWidth: number; - mainRatingWidth: number; - mainFlagWidth: number; - mainTagsWidth: number; - mainFoldersWidth: number; - mainNoteWidth: number; - mainAddTimeWidth: number; - feedTitleWidth: number; - feedAuthorsWidth: number; - feedYearWidth: number; - feedPublicationWidth: number; - feedPubTypeWidth: number; - feedAddTimeWidth: number; + mainTableFields: IDataViewField[]; + feedFields: IDataViewField[]; preferedTheme: "light" | "dark" | "system"; invertColor: boolean; sidebarSortBy: "name" | "count" | "color"; @@ -1544,8 +1522,11 @@ declare interface IUIStateServiceState { selectedIds: Array; selectedPaperEntities: Array; selectedFeedEntities: Array; - selectedCategorizer: string; + selectedQuerySentenceId: string; selectedFeed: string; + editingPaperSmartFilter: PaperSmartFilter; + querySentenceSidebar: string; + querySentenceCommandbar: string; dragingIds: Array; commandBarText: string; commandBarSearchMode: "general" | "fulltext" | "advanced"; @@ -1938,19 +1919,6 @@ declare class PaperEntityRepository extends Eventable); - update(options: Partial): void; - toString(): string; -} - declare class PaperFolder extends Categorizer { static schema: { name: string; @@ -1959,8 +1927,9 @@ declare class PaperFolder extends Categorizer { _id: string; _partition: string; name: string; - count: string; color: string; + count: string; + children: string; }; }; constructor(object: ICategorizerDraft, initObjectId?: boolean); @@ -1981,12 +1950,12 @@ declare class PaperService extends Eventable { constructor(_databaseCore: DatabaseCore, _paperEntityRepository: PaperEntityRepository, _scrapeService: ScrapeService, _cacheService: CacheService, _schedulerService: SchedulerService, _fileService: FileService, _preferenceService: PreferenceService, _logService: LogService); /** * Load paper entities with filter and sort. - * @param filterOptions - filter object + * @param querySentence - Query sentence, string or PaperFilterOptions * @param sortBy - Sort by * @param sortOrder - Sort order * @returns Paper entities */ - load(filterOptions: PaperFilterOptions, sortBy: string | undefined, sortOrder: "asce" | "desc"): Promise; + load(querySentence: string, sortBy: string | undefined, sortOrder: "asce" | "desc", fulltextQuerySentence?: string): Promise; /** * Load paper entities by IDs. * @param ids - Paper entity ids @@ -2061,13 +2030,15 @@ declare class PaperSmartFilter { name: string; filter: string; color: string; + children: string; }; }; _id: OID; _partition: string; name: string; filter: string; - color?: string; + color: string; + children: PaperSmartFilter[]; constructor(object?: IPaperSmartFilterDraft, initObjectId?: boolean); initialize(object: IPaperSmartFilterDraft): this; } @@ -2080,7 +2051,7 @@ declare class PaperSmartFilterRepository extends Eventable; makeSureProperties(smartfilter: IPaperSmartFilterObject): IPaperSmartFilterObject; /** * Update smartfilter * @param realm - Realm instance - * @param smartfilter - SmartFilter * @param type - SmartFilter type + * @param smartfilter - SmartFilter * @param partition - Partition * @returns Updated smartfilter */ - insert(realm: Realm_2, smartfilter: IPaperSmartFilterObject, type: PaperSmartFilterType, partition: string): Realm_2.Object; + update(realm: Realm_2, type: PaperSmartFilterType, smartfilter: IPaperSmartFilterObject, partition: string, parent?: IPaperSmartFilterObject): (PaperSmartFilter & Realm_2.Object) | IPaperSmartFilterRealmObject; + /** + * Recursively update children name. + */ + private _updateChildrenName; + private _checkCircularReference; } -declare type PaperSmartFilterType = "PaperPaperSmartFilter"; +declare enum PaperSmartFilterType { + smartfilter = "PaperSmartFilter" +} declare class PaperTag extends Categorizer { static schema: { @@ -2139,8 +2108,9 @@ declare class PaperTag extends Categorizer { _id: string; _partition: string; name: string; - count: string; color: string; + count: string; + children: string; }; }; constructor(object: ICategorizerDraft, initObjectId?: boolean); @@ -2214,7 +2184,7 @@ declare class PreferenceService extends Eventable { get(key: keyof IPreferenceStore): string | number | boolean | { height: number; width: number; - } | { + } | IDataViewField[] | { from: string; to: string; }[]; @@ -2468,6 +2438,12 @@ declare class SmartFilterService extends Eventable { * @returns */ load(type: PaperSmartFilterType, sortBy: string, sortOrder: string): Promise; + /** + * Load smartfilters by ids. + * @param ids - The ids of the smartfilters + * @returns + */ + loadByIds(ids: OID[]): Promise; /** * Delete a smartfilter. * @param type - The type of the smartfilter @@ -2477,18 +2453,28 @@ declare class SmartFilterService extends Eventable { delete(type: PaperSmartFilterType, ids?: OID[], smartfilters?: IPaperSmartFilterCollection): Promise; /** * Colorize a smartfilter. - * @param color - The color - * @param type - The type of the smartfilter - * @param id - The id of the smartfilter - * @param smartfilter - The smartfilter + * @param id - The id of the smartfilter. + * @param color - The color. + * @param type - The type of the smartfilter. + * @returns */ - colorize(color: Colors, type: PaperSmartFilterType, id?: OID, smartfilter?: PaperSmartFilter): Promise; + colorize(id: OID, color: Colors, type: PaperSmartFilterType): Promise; /** - * Insert a smartfilter. - * @param smartfilter - The smartfilter + * Rename a smartfilter. + * @param id - The id of the smartfilter. + * @param name - The new name of the smartfilter. + * @param type - The type of the smartfilter. + * @returns + */ + rename(id: OID, name: string, type: PaperSmartFilterType): Promise; + /** + * Update/Insert a smartfilter. * @param type - The type of the smartfilter + * @param smartfilter - The smartfilter + * @param parentSmartfilter - The parent smartfilter + * @returns */ - insert(smartfilter: PaperSmartFilter, type: PaperSmartFilterType): Promise; + update(type: PaperSmartFilterType, smartfilter: PaperSmartFilter, parentSmartfilter?: PaperSmartFilter): Promise<(PaperSmartFilter & Realm.Object) | IPaperSmartFilterRealmObject>; /** * Migrate the local database to the cloud database. */ migrateLocaltoCloud(): Promise; @@ -3052,8 +3038,162 @@ declare class UIStateService extends Eventable { }; _partition: string; name: string; + color: string; count: number; - color?: string | undefined; + children: { + _id: string | { + _bsontype: "ObjectID"; + id: { + [x: number]: number; + write: { + (string: string, encoding?: BufferEncoding | undefined): number; + (string: string, offset: number, encoding?: BufferEncoding | undefined): number; + (string: string, offset: number, length: number, encoding?: BufferEncoding | undefined): number; + }; + toString: (encoding?: BufferEncoding | undefined, start?: number | undefined, end?: number | undefined) => string; + toJSON: () => { + type: "Buffer"; + data: number[]; + }; + equals: (otherBuffer: Uint8Array) => boolean; + compare: (target: Uint8Array, targetStart?: number | undefined, targetEnd?: number | undefined, sourceStart?: number | undefined, sourceEnd?: number | undefined) => 0 | 1 | -1; + copy: (target: Uint8Array, targetStart?: number | undefined, sourceStart?: number | undefined, sourceEnd?: number | undefined) => number; + slice: (start?: number | undefined, end?: number | undefined) => Buffer; + subarray: (start?: number | undefined, end?: number | undefined) => Buffer; + writeBigInt64BE: (value: bigint, offset?: number | undefined) => number; + writeBigInt64LE: (value: bigint, offset?: number | undefined) => number; + writeBigUInt64BE: (value: bigint, offset?: number | undefined) => number; + writeBigUint64BE: (value: bigint, offset?: number | undefined) => number; + writeBigUInt64LE: (value: bigint, offset?: number | undefined) => number; + writeBigUint64LE: (value: bigint, offset?: number | undefined) => number; + writeUIntLE: (value: number, offset: number, byteLength: number) => number; + writeUintLE: (value: number, offset: number, byteLength: number) => number; + writeUIntBE: (value: number, offset: number, byteLength: number) => number; + writeUintBE: (value: number, offset: number, byteLength: number) => number; + writeIntLE: (value: number, offset: number, byteLength: number) => number; + writeIntBE: (value: number, offset: number, byteLength: number) => number; + readBigUInt64BE: (offset?: number | undefined) => bigint; + readBigUint64BE: (offset?: number | undefined) => bigint; + readBigUInt64LE: (offset?: number | undefined) => bigint; + readBigUint64LE: (offset?: number | undefined) => bigint; + readBigInt64BE: (offset?: number | undefined) => bigint; + readBigInt64LE: (offset?: number | undefined) => bigint; + readUIntLE: (offset: number, byteLength: number) => number; + readUintLE: (offset: number, byteLength: number) => number; + readUIntBE: (offset: number, byteLength: number) => number; + readUintBE: (offset: number, byteLength: number) => number; + readIntLE: (offset: number, byteLength: number) => number; + readIntBE: (offset: number, byteLength: number) => number; + readUInt8: (offset?: number | undefined) => number; + readUint8: (offset?: number | undefined) => number; + readUInt16LE: (offset?: number | undefined) => number; + readUint16LE: (offset?: number | undefined) => number; + readUInt16BE: (offset?: number | undefined) => number; + readUint16BE: (offset?: number | undefined) => number; + readUInt32LE: (offset?: number | undefined) => number; + readUint32LE: (offset?: number | undefined) => number; + readUInt32BE: (offset?: number | undefined) => number; + readUint32BE: (offset?: number | undefined) => number; + readInt8: (offset?: number | undefined) => number; + readInt16LE: (offset?: number | undefined) => number; + readInt16BE: (offset?: number | undefined) => number; + readInt32LE: (offset?: number | undefined) => number; + readInt32BE: (offset?: number | undefined) => number; + readFloatLE: (offset?: number | undefined) => number; + readFloatBE: (offset?: number | undefined) => number; + readDoubleLE: (offset?: number | undefined) => number; + readDoubleBE: (offset?: number | undefined) => number; + reverse: () => Buffer; + swap16: () => Buffer; + swap32: () => Buffer; + swap64: () => Buffer; + writeUInt8: (value: number, offset?: number | undefined) => number; + writeUint8: (value: number, offset?: number | undefined) => number; + writeUInt16LE: (value: number, offset?: number | undefined) => number; + writeUint16LE: (value: number, offset?: number | undefined) => number; + writeUInt16BE: (value: number, offset?: number | undefined) => number; + writeUint16BE: (value: number, offset?: number | undefined) => number; + writeUInt32LE: (value: number, offset?: number | undefined) => number; + writeUint32LE: (value: number, offset?: number | undefined) => number; + writeUInt32BE: (value: number, offset?: number | undefined) => number; + writeUint32BE: (value: number, offset?: number | undefined) => number; + writeInt8: (value: number, offset?: number | undefined) => number; + writeInt16LE: (value: number, offset?: number | undefined) => number; + writeInt16BE: (value: number, offset?: number | undefined) => number; + writeInt32LE: (value: number, offset?: number | undefined) => number; + writeInt32BE: (value: number, offset?: number | undefined) => number; + writeFloatLE: (value: number, offset?: number | undefined) => number; + writeFloatBE: (value: number, offset?: number | undefined) => number; + writeDoubleLE: (value: number, offset?: number | undefined) => number; + writeDoubleBE: (value: number, offset?: number | undefined) => number; + fill: (value: string | number | Uint8Array, offset?: number | undefined, end?: number | undefined, encoding?: BufferEncoding | undefined) => Buffer; + indexOf: (value: string | number | Uint8Array, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => number; + lastIndexOf: (value: string | number | Uint8Array, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => number; + entries: () => IterableIterator<[number, number]>; + includes: (value: string | number | Buffer, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => boolean; + keys: () => IterableIterator; + values: () => IterableIterator; + readonly BYTES_PER_ELEMENT: number; + readonly buffer: { + readonly byteLength: number; + slice: (begin: number, end?: number | undefined) => ArrayBuffer; + readonly [Symbol.toStringTag]: string; + } | { + readonly byteLength: number; + slice: (begin: number, end?: number | undefined) => SharedArrayBuffer; + readonly [Symbol.species]: SharedArrayBuffer; + readonly [Symbol.toStringTag]: "SharedArrayBuffer"; + }; + readonly byteLength: number; + readonly byteOffset: number; + copyWithin: (target: number, start?: number | undefined, end?: number | undefined) => Buffer; + every: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => boolean; + filter: (predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any) => Uint8Array; + find: (predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any) => number | undefined; + findIndex: (predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any) => number; + forEach: (callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any) => void; + join: (separator?: string | undefined) => string; + readonly length: number; + map: (callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any) => Uint8Array; + reduce: { + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + }; + reduceRight: { + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + (callbackfn: (previousValue: U_1, currentValue: number, currentIndex: number, array: Uint8Array) => U_1, initialValue: U_1): U_1; + }; + set: (array: ArrayLike, offset?: number | undefined) => void; + some: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => boolean; + sort: (compareFn?: ((a: number, b: number) => number) | undefined) => Buffer; + toLocaleString: () => string; + valueOf: () => Uint8Array; + at: (index: number) => number | undefined; + findLast: { + (predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S | undefined; + (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number | undefined; + }; + findLastIndex: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => number; + [Symbol.iterator]: () => IterableIterator; + readonly [Symbol.toStringTag]: "Uint8Array"; + }; + generationTime: number; + toHexString: () => string; + toString: (format?: string | undefined) => string; + toJSON: () => string; + equals: (otherId: string | ObjectID | ObjectIdLike) => boolean; + getTimestamp: () => Date; + inspect: () => string; + }; + _partition: string; + name: string; + color: string; + count: number; + children: any[]; + initialize: (object: ICategorizerDraft) => Categorizer; + }[]; initialize: (object: ICategorizerDraft) => PaperTag; }[]; folders: { @@ -3205,8 +3345,162 @@ declare class UIStateService extends Eventable { }; _partition: string; name: string; + color: string; count: number; - color?: string | undefined; + children: { + _id: string | { + _bsontype: "ObjectID"; + id: { + [x: number]: number; + write: { + (string: string, encoding?: BufferEncoding | undefined): number; + (string: string, offset: number, encoding?: BufferEncoding | undefined): number; + (string: string, offset: number, length: number, encoding?: BufferEncoding | undefined): number; + }; + toString: (encoding?: BufferEncoding | undefined, start?: number | undefined, end?: number | undefined) => string; + toJSON: () => { + type: "Buffer"; + data: number[]; + }; + equals: (otherBuffer: Uint8Array) => boolean; + compare: (target: Uint8Array, targetStart?: number | undefined, targetEnd?: number | undefined, sourceStart?: number | undefined, sourceEnd?: number | undefined) => 0 | 1 | -1; + copy: (target: Uint8Array, targetStart?: number | undefined, sourceStart?: number | undefined, sourceEnd?: number | undefined) => number; + slice: (start?: number | undefined, end?: number | undefined) => Buffer; + subarray: (start?: number | undefined, end?: number | undefined) => Buffer; + writeBigInt64BE: (value: bigint, offset?: number | undefined) => number; + writeBigInt64LE: (value: bigint, offset?: number | undefined) => number; + writeBigUInt64BE: (value: bigint, offset?: number | undefined) => number; + writeBigUint64BE: (value: bigint, offset?: number | undefined) => number; + writeBigUInt64LE: (value: bigint, offset?: number | undefined) => number; + writeBigUint64LE: (value: bigint, offset?: number | undefined) => number; + writeUIntLE: (value: number, offset: number, byteLength: number) => number; + writeUintLE: (value: number, offset: number, byteLength: number) => number; + writeUIntBE: (value: number, offset: number, byteLength: number) => number; + writeUintBE: (value: number, offset: number, byteLength: number) => number; + writeIntLE: (value: number, offset: number, byteLength: number) => number; + writeIntBE: (value: number, offset: number, byteLength: number) => number; + readBigUInt64BE: (offset?: number | undefined) => bigint; + readBigUint64BE: (offset?: number | undefined) => bigint; + readBigUInt64LE: (offset?: number | undefined) => bigint; + readBigUint64LE: (offset?: number | undefined) => bigint; + readBigInt64BE: (offset?: number | undefined) => bigint; + readBigInt64LE: (offset?: number | undefined) => bigint; + readUIntLE: (offset: number, byteLength: number) => number; + readUintLE: (offset: number, byteLength: number) => number; + readUIntBE: (offset: number, byteLength: number) => number; + readUintBE: (offset: number, byteLength: number) => number; + readIntLE: (offset: number, byteLength: number) => number; + readIntBE: (offset: number, byteLength: number) => number; + readUInt8: (offset?: number | undefined) => number; + readUint8: (offset?: number | undefined) => number; + readUInt16LE: (offset?: number | undefined) => number; + readUint16LE: (offset?: number | undefined) => number; + readUInt16BE: (offset?: number | undefined) => number; + readUint16BE: (offset?: number | undefined) => number; + readUInt32LE: (offset?: number | undefined) => number; + readUint32LE: (offset?: number | undefined) => number; + readUInt32BE: (offset?: number | undefined) => number; + readUint32BE: (offset?: number | undefined) => number; + readInt8: (offset?: number | undefined) => number; + readInt16LE: (offset?: number | undefined) => number; + readInt16BE: (offset?: number | undefined) => number; + readInt32LE: (offset?: number | undefined) => number; + readInt32BE: (offset?: number | undefined) => number; + readFloatLE: (offset?: number | undefined) => number; + readFloatBE: (offset?: number | undefined) => number; + readDoubleLE: (offset?: number | undefined) => number; + readDoubleBE: (offset?: number | undefined) => number; + reverse: () => Buffer; + swap16: () => Buffer; + swap32: () => Buffer; + swap64: () => Buffer; + writeUInt8: (value: number, offset?: number | undefined) => number; + writeUint8: (value: number, offset?: number | undefined) => number; + writeUInt16LE: (value: number, offset?: number | undefined) => number; + writeUint16LE: (value: number, offset?: number | undefined) => number; + writeUInt16BE: (value: number, offset?: number | undefined) => number; + writeUint16BE: (value: number, offset?: number | undefined) => number; + writeUInt32LE: (value: number, offset?: number | undefined) => number; + writeUint32LE: (value: number, offset?: number | undefined) => number; + writeUInt32BE: (value: number, offset?: number | undefined) => number; + writeUint32BE: (value: number, offset?: number | undefined) => number; + writeInt8: (value: number, offset?: number | undefined) => number; + writeInt16LE: (value: number, offset?: number | undefined) => number; + writeInt16BE: (value: number, offset?: number | undefined) => number; + writeInt32LE: (value: number, offset?: number | undefined) => number; + writeInt32BE: (value: number, offset?: number | undefined) => number; + writeFloatLE: (value: number, offset?: number | undefined) => number; + writeFloatBE: (value: number, offset?: number | undefined) => number; + writeDoubleLE: (value: number, offset?: number | undefined) => number; + writeDoubleBE: (value: number, offset?: number | undefined) => number; + fill: (value: string | number | Uint8Array, offset?: number | undefined, end?: number | undefined, encoding?: BufferEncoding | undefined) => Buffer; + indexOf: (value: string | number | Uint8Array, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => number; + lastIndexOf: (value: string | number | Uint8Array, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => number; + entries: () => IterableIterator<[number, number]>; + includes: (value: string | number | Buffer, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => boolean; + keys: () => IterableIterator; + values: () => IterableIterator; + readonly BYTES_PER_ELEMENT: number; + readonly buffer: { + readonly byteLength: number; + slice: (begin: number, end?: number | undefined) => ArrayBuffer; + readonly [Symbol.toStringTag]: string; + } | { + readonly byteLength: number; + slice: (begin: number, end?: number | undefined) => SharedArrayBuffer; + readonly [Symbol.species]: SharedArrayBuffer; + readonly [Symbol.toStringTag]: "SharedArrayBuffer"; + }; + readonly byteLength: number; + readonly byteOffset: number; + copyWithin: (target: number, start?: number | undefined, end?: number | undefined) => Buffer; + every: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => boolean; + filter: (predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any) => Uint8Array; + find: (predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any) => number | undefined; + findIndex: (predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any) => number; + forEach: (callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any) => void; + join: (separator?: string | undefined) => string; + readonly length: number; + map: (callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any) => Uint8Array; + reduce: { + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + }; + reduceRight: { + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + (callbackfn: (previousValue: U_1, currentValue: number, currentIndex: number, array: Uint8Array) => U_1, initialValue: U_1): U_1; + }; + set: (array: ArrayLike, offset?: number | undefined) => void; + some: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => boolean; + sort: (compareFn?: ((a: number, b: number) => number) | undefined) => Buffer; + toLocaleString: () => string; + valueOf: () => Uint8Array; + at: (index: number) => number | undefined; + findLast: { + (predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S | undefined; + (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number | undefined; + }; + findLastIndex: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => number; + [Symbol.iterator]: () => IterableIterator; + readonly [Symbol.toStringTag]: "Uint8Array"; + }; + generationTime: number; + toHexString: () => string; + toString: (format?: string | undefined) => string; + toJSON: () => string; + equals: (otherId: string | ObjectID | ObjectIdLike) => boolean; + getTimestamp: () => Date; + inspect: () => string; + }; + _partition: string; + name: string; + color: string; + count: number; + children: any[]; + initialize: (object: ICategorizerDraft) => Categorizer; + }[]; initialize: (object: ICategorizerDraft) => PaperFolder; }[]; flag: boolean; @@ -3957,7 +4251,160 @@ declare class UIStateService extends Eventable { read: boolean; initialize: (object: IFeedEntityDraft) => FeedEntity; fromPaper: (paperEntity: PaperEntity) => void; - }[]; + }[] | { + _id: string | { + _bsontype: "ObjectID"; + id: { + [x: number]: number; + write: { + (string: string, encoding?: BufferEncoding | undefined): number; + (string: string, offset: number, encoding?: BufferEncoding | undefined): number; + (string: string, offset: number, length: number, encoding?: BufferEncoding | undefined): number; + }; + toString: (encoding?: BufferEncoding | undefined, start?: number | undefined, end?: number | undefined) => string; + toJSON: () => { + type: "Buffer"; + data: number[]; + }; + equals: (otherBuffer: Uint8Array) => boolean; + compare: (target: Uint8Array, targetStart?: number | undefined, targetEnd?: number | undefined, sourceStart?: number | undefined, sourceEnd?: number | undefined) => 0 | 1 | -1; + copy: (target: Uint8Array, targetStart?: number | undefined, sourceStart?: number | undefined, sourceEnd?: number | undefined) => number; + slice: (start?: number | undefined, end?: number | undefined) => Buffer; + subarray: (start?: number | undefined, end?: number | undefined) => Buffer; + writeBigInt64BE: (value: bigint, offset?: number | undefined) => number; + writeBigInt64LE: (value: bigint, offset?: number | undefined) => number; + writeBigUInt64BE: (value: bigint, offset?: number | undefined) => number; + writeBigUint64BE: (value: bigint, offset?: number | undefined) => number; + writeBigUInt64LE: (value: bigint, offset?: number | undefined) => number; + writeBigUint64LE: (value: bigint, offset?: number | undefined) => number; + writeUIntLE: (value: number, offset: number, byteLength: number) => number; + writeUintLE: (value: number, offset: number, byteLength: number) => number; + writeUIntBE: (value: number, offset: number, byteLength: number) => number; + writeUintBE: (value: number, offset: number, byteLength: number) => number; + writeIntLE: (value: number, offset: number, byteLength: number) => number; + writeIntBE: (value: number, offset: number, byteLength: number) => number; + readBigUInt64BE: (offset?: number | undefined) => bigint; + readBigUint64BE: (offset?: number | undefined) => bigint; + readBigUInt64LE: (offset?: number | undefined) => bigint; + readBigUint64LE: (offset?: number | undefined) => bigint; + readBigInt64BE: (offset?: number | undefined) => bigint; + readBigInt64LE: (offset?: number | undefined) => bigint; + readUIntLE: (offset: number, byteLength: number) => number; + readUintLE: (offset: number, byteLength: number) => number; + readUIntBE: (offset: number, byteLength: number) => number; + readUintBE: (offset: number, byteLength: number) => number; + readIntLE: (offset: number, byteLength: number) => number; + readIntBE: (offset: number, byteLength: number) => number; + readUInt8: (offset?: number | undefined) => number; + readUint8: (offset?: number | undefined) => number; + readUInt16LE: (offset?: number | undefined) => number; + readUint16LE: (offset?: number | undefined) => number; + readUInt16BE: (offset?: number | undefined) => number; + readUint16BE: (offset?: number | undefined) => number; + readUInt32LE: (offset?: number | undefined) => number; + readUint32LE: (offset?: number | undefined) => number; + readUInt32BE: (offset?: number | undefined) => number; + readUint32BE: (offset?: number | undefined) => number; + readInt8: (offset?: number | undefined) => number; + readInt16LE: (offset?: number | undefined) => number; + readInt16BE: (offset?: number | undefined) => number; + readInt32LE: (offset?: number | undefined) => number; + readInt32BE: (offset?: number | undefined) => number; + readFloatLE: (offset?: number | undefined) => number; + readFloatBE: (offset?: number | undefined) => number; + readDoubleLE: (offset?: number | undefined) => number; + readDoubleBE: (offset?: number | undefined) => number; + reverse: () => Buffer; + swap16: () => Buffer; + swap32: () => Buffer; + swap64: () => Buffer; + writeUInt8: (value: number, offset?: number | undefined) => number; + writeUint8: (value: number, offset?: number | undefined) => number; + writeUInt16LE: (value: number, offset?: number | undefined) => number; + writeUint16LE: (value: number, offset?: number | undefined) => number; + writeUInt16BE: (value: number, offset?: number | undefined) => number; + writeUint16BE: (value: number, offset?: number | undefined) => number; + writeUInt32LE: (value: number, offset?: number | undefined) => number; + writeUint32LE: (value: number, offset?: number | undefined) => number; + writeUInt32BE: (value: number, offset?: number | undefined) => number; + writeUint32BE: (value: number, offset?: number | undefined) => number; + writeInt8: (value: number, offset?: number | undefined) => number; + writeInt16LE: (value: number, offset?: number | undefined) => number; + writeInt16BE: (value: number, offset?: number | undefined) => number; + writeInt32LE: (value: number, offset?: number | undefined) => number; + writeInt32BE: (value: number, offset?: number | undefined) => number; + writeFloatLE: (value: number, offset?: number | undefined) => number; + writeFloatBE: (value: number, offset?: number | undefined) => number; + writeDoubleLE: (value: number, offset?: number | undefined) => number; + writeDoubleBE: (value: number, offset?: number | undefined) => number; + fill: (value: string | number | Uint8Array, offset?: number | undefined, end?: number | undefined, encoding?: BufferEncoding | undefined) => Buffer; + indexOf: (value: string | number | Uint8Array, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => number; + lastIndexOf: (value: string | number | Uint8Array, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => number; + entries: () => IterableIterator<[number, number]>; + includes: (value: string | number | Buffer, byteOffset?: number | undefined, encoding?: BufferEncoding | undefined) => boolean; + keys: () => IterableIterator; + values: () => IterableIterator; + readonly BYTES_PER_ELEMENT: number; + readonly buffer: { + readonly byteLength: number; + slice: (begin: number, end?: number | undefined) => ArrayBuffer; + readonly [Symbol.toStringTag]: string; + } | { + readonly byteLength: number; + slice: (begin: number, end?: number | undefined) => SharedArrayBuffer; + readonly [Symbol.species]: SharedArrayBuffer; + readonly [Symbol.toStringTag]: "SharedArrayBuffer"; + }; + readonly byteLength: number; + readonly byteOffset: number; + copyWithin: (target: number, start?: number | undefined, end?: number | undefined) => Buffer; + every: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => boolean; + filter: (predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any) => Uint8Array; + find: (predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any) => number | undefined; + findIndex: (predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any) => number; + forEach: (callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any) => void; + join: (separator?: string | undefined) => string; + readonly length: number; + map: (callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any) => Uint8Array; + reduce: { + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + }; + reduceRight: { + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + (callbackfn: (previousValue: U_1, currentValue: number, currentIndex: number, array: Uint8Array) => U_1, initialValue: U_1): U_1; + }; + set: (array: ArrayLike, offset?: number | undefined) => void; + some: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => boolean; + sort: (compareFn?: ((a: number, b: number) => number) | undefined) => Buffer; + toLocaleString: () => string; + valueOf: () => Uint8Array; + at: (index: number) => number | undefined; + findLast: { + (predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S | undefined; + (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number | undefined; + }; + findLastIndex: (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => number; + [Symbol.iterator]: () => IterableIterator; + readonly [Symbol.toStringTag]: "Uint8Array"; + }; + generationTime: number; + toHexString: () => string; + toString: (format?: string | undefined) => string; + toJSON: () => string; + equals: (otherId: string | ObjectID | ObjectIdLike) => boolean; + getTimestamp: () => Date; + inspect: () => string; + }; + _partition: string; + name: string; + filter: string; + color: string; + children: any[]; + initialize: (object: IPaperSmartFilterDraft) => PaperSmartFilter; + }; /** * Get all UI states. * @returns The state diff --git a/paperlib-api/dist/model.d.ts b/paperlib-api/dist/model.d.ts index d0e87926..112660f5 100644 --- a/paperlib-api/dist/model.d.ts +++ b/paperlib-api/dist/model.d.ts @@ -5,9 +5,10 @@ declare class Categorizer { _id: OID; _partition: string; name: string; + color: string; count: number; - color?: string; - constructor(object: ICategorizerDraft, initObjectId?: boolean); + children: Categorizer[]; + constructor(object?: ICategorizerDraft, initObjectId?: boolean); initialize(object: ICategorizerDraft): this; } @@ -92,8 +93,8 @@ declare interface ICategorizerDraft { _id?: OID; _partition?: string; name?: string; - count?: number; color?: string; + children?: ICategorizerDraft[]; } declare interface IFeedDraft { @@ -161,6 +162,7 @@ declare interface IPaperSmartFilterDraft { name?: string; filter?: string; color?: string; + children?: IPaperSmartFilterDraft[]; } declare type OID = ObjectId | string; @@ -244,8 +246,9 @@ export declare class PaperFolder extends Categorizer { _id: string; _partition: string; name: string; - count: string; color: string; + count: string; + children: string; }; }; constructor(object: ICategorizerDraft, initObjectId?: boolean); @@ -261,13 +264,15 @@ export declare class PaperSmartFilter { name: string; filter: string; color: string; + children: string; }; }; _id: OID; _partition: string; name: string; filter: string; - color?: string; + color: string; + children: PaperSmartFilter[]; constructor(object?: IPaperSmartFilterDraft, initObjectId?: boolean); initialize(object: IPaperSmartFilterDraft): this; } @@ -280,8 +285,9 @@ export declare class PaperTag extends Categorizer { _id: string; _partition: string; name: string; - count: string; color: string; + count: string; + children: string; }; }; constructor(object: ICategorizerDraft, initObjectId?: boolean); diff --git a/paperlib-api/dist/model.mjs b/paperlib-api/dist/model.mjs index 1fb8a665..22b828b6 100644 --- a/paperlib-api/dist/model.mjs +++ b/paperlib-api/dist/model.mjs @@ -5493,14 +5493,15 @@ class Categorizer { _id; _partition; name; - count; color; + count = 0; + children; constructor(object, initObjectId = false) { - this._id = object._id ? new ObjectId(object._id) : ""; - this._partition = object._partition || ""; - this.name = object.name || ""; - this.count = object.count || 0; - this.color = object.color; + this._id = object?._id ? new ObjectId(object._id) : ""; + this._partition = object?._partition || ""; + this.name = object?.name || ""; + this.color = object?.color || "blue"; + this.children = object?.children?.map((child) => new Categorizer(child)) || []; if (initObjectId) { this._id = new ObjectId(); } @@ -5519,8 +5520,8 @@ class Categorizer { this._id = object._id ? new ObjectId(object._id) : ""; this._partition = object._partition || ""; this.name = object.name || ""; - this.count = object.count || 0; - this.color = object.color; + this.color = object.color || "blue"; + this.children = object.children?.map((child) => new Categorizer().initialize(child)) || []; return this; } } @@ -5532,8 +5533,9 @@ class PaperTag extends Categorizer { _id: "objectId", _partition: "string?", name: "string", + color: "string?", count: "int", - color: "string?" + children: "PaperTag[]" } }; constructor(object, initObjectId = false) { @@ -5548,8 +5550,9 @@ class PaperFolder extends Categorizer { _id: "objectId", _partition: "string?", name: "string", + color: "string?", count: "int", - color: "string?" + children: "PaperFolder[]" } }; constructor(object, initObjectId = false) { @@ -12175,14 +12178,15 @@ class PaperEntity { class PaperSmartFilter { static schema = { - name: "PaperPaperSmartFilter", + name: "PaperSmartFilter", primaryKey: "_id", properties: { _id: "objectId", _partition: "string?", name: "string", filter: "string", - color: "string?" + color: "string?", + children: "PaperSmartFilter[]" } }; _id = ""; @@ -12190,12 +12194,14 @@ class PaperSmartFilter { name = ""; filter = ""; color; + children = []; constructor(object, initObjectId = false) { this._id = object?._id ? new ObjectId(object._id) : ""; this._partition = object?._partition || ""; this.name = object?.name || ""; this.filter = object?.filter || ""; - this.color = object?.color; + this.color = object?.color || "blue"; + this.children = object?.children?.map((child) => new PaperSmartFilter(child)) || []; if (initObjectId) { this._id = new ObjectId(); } @@ -12215,7 +12221,10 @@ class PaperSmartFilter { this._partition = object._partition || ""; this.name = object.name || ""; this.filter = object.filter || ""; - this.color = object.color; + this.color = object.color || "blue"; + this.children = object.children?.map( + (child) => new PaperSmartFilter().initialize(child) + ) || []; return this; } } diff --git a/paperlib-api/dist/utils.d.ts b/paperlib-api/dist/utils.d.ts index 6fc03b23..59a8d50f 100644 --- a/paperlib-api/dist/utils.d.ts +++ b/paperlib-api/dist/utils.d.ts @@ -5,9 +5,10 @@ declare class Categorizer { _id: OID; _partition: string; name: string; + color: string; count: number; - color?: string; - constructor(object: ICategorizerDraft, initObjectId?: boolean); + children: Categorizer[]; + constructor(object?: ICategorizerDraft, initObjectId?: boolean); initialize(object: ICategorizerDraft): this; } @@ -139,8 +140,8 @@ declare interface ICategorizerDraft { _id?: OID; _partition?: string; name?: string; - count?: number; color?: string; + children?: ICategorizerDraft[]; } declare interface IFeedDraft { @@ -306,8 +307,9 @@ declare class PaperFolder extends Categorizer { _id: string; _partition: string; name: string; - count: string; color: string; + count: string; + children: string; }; }; constructor(object: ICategorizerDraft, initObjectId?: boolean); @@ -321,8 +323,9 @@ declare class PaperTag extends Categorizer { _id: string; _partition: string; name: string; - count: string; color: string; + count: string; + children: string; }; }; constructor(object: ICategorizerDraft, initObjectId?: boolean); diff --git a/paperlib-api/package.json b/paperlib-api/package.json index 0312e859..5392b69e 100644 --- a/paperlib-api/package.json +++ b/paperlib-api/package.json @@ -1,6 +1,6 @@ { "name": "paperlib-api", - "version": "0.0.16", + "version": "0.1.0", "author": "Paperlib", "description": "The API for paperlib extension development.", "exports": { diff --git a/release-notes.md b/release-notes.md index 4e0970f2..4a7e1c0b 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,3 +1,4 @@ -1. Doesn't support Windows 7 anymore. -2. Fixed some bugs. -3. Extension Recommendation: paperlib-ai-summary-extension +1. Important New Feature: Hierarchy Folders and SmartFilters! +2. New Feature: Table view column order and more columns. +3. New Feature: SmartFilter can be edited after creation. Add more human-friendly labels for SmartFilter creation. +4. Fixed some bugs.