@mnaoumov/obsidian-lib 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/lib/cjs/dataview.cjs +1 -1
  2. package/dist/lib/cjs/dataview.d.cts +9 -3
  3. package/dist/lib/cjs/generated-during-build.cjs +1 -1
  4. package/dist/lib/esm/dataview.d.mts +9 -3
  5. package/dist/lib/esm/dataview.mjs +1 -1
  6. package/dist/lib/esm/generated-during-build.mjs +1 -1
  7. package/package.json +4 -135
  8. package/@types/dataview/api/data-array/package.json +0 -4
  9. package/@types/dataview/api/extensions/package.json +0 -4
  10. package/@types/dataview/api/inline-api/package.json +0 -4
  11. package/@types/dataview/api/plugin-api/package.json +0 -4
  12. package/@types/dataview/api/result/package.json +0 -4
  13. package/@types/dataview/data-import/common/package.json +0 -4
  14. package/@types/dataview/data-import/csv/package.json +0 -4
  15. package/@types/dataview/data-import/inline-field/package.json +0 -4
  16. package/@types/dataview/data-import/markdown-file/package.json +0 -4
  17. package/@types/dataview/data-import/persister/package.json +0 -4
  18. package/@types/dataview/data-import/web-worker/import-entry/package.json +0 -4
  19. package/@types/dataview/data-import/web-worker/import-impl/package.json +0 -4
  20. package/@types/dataview/data-import/web-worker/import-manager/package.json +0 -4
  21. package/@types/dataview/data-index/index/package.json +0 -4
  22. package/@types/dataview/data-index/package.json +0 -4
  23. package/@types/dataview/data-index/resolver/package.json +0 -4
  24. package/@types/dataview/data-index/source/package.json +0 -4
  25. package/@types/dataview/data-model/markdown/package.json +0 -4
  26. package/@types/dataview/data-model/serialized/markdown/package.json +0 -4
  27. package/@types/dataview/data-model/transferable/package.json +0 -4
  28. package/@types/dataview/data-model/value/package.json +0 -4
  29. package/@types/dataview/expression/binaryop/package.json +0 -4
  30. package/@types/dataview/expression/context/package.json +0 -4
  31. package/@types/dataview/expression/field/package.json +0 -4
  32. package/@types/dataview/expression/functions/package.json +0 -4
  33. package/@types/dataview/expression/parse/package.json +0 -4
  34. package/@types/dataview/index/package.json +0 -4
  35. package/@types/dataview/main/package.json +0 -4
  36. package/@types/dataview/package.json +0 -4
  37. package/@types/dataview/query/engine/package.json +0 -4
  38. package/@types/dataview/query/parse/package.json +0 -4
  39. package/@types/dataview/query/query/package.json +0 -4
  40. package/@types/dataview/settings/package.json +0 -4
  41. package/@types/dataview/typings/obsidian-ex/package.json +0 -4
  42. package/@types/dataview/typings/workers/package.json +0 -4
  43. package/@types/dataview/ui/export/markdown/package.json +0 -4
  44. package/@types/dataview/ui/lp-render/package.json +0 -4
  45. package/@types/dataview/ui/markdown/package.json +0 -4
  46. package/@types/dataview/ui/refreshable-view/package.json +0 -4
  47. package/@types/dataview/ui/render/package.json +0 -4
  48. package/@types/dataview/ui/views/calendar-view/package.json +0 -4
  49. package/@types/dataview/ui/views/inline-field-live-preview/package.json +0 -4
  50. package/@types/dataview/ui/views/inline-view/package.json +0 -4
  51. package/@types/dataview/ui/views/js-view/package.json +0 -4
  52. package/@types/dataview/ui/views/list-view/package.json +0 -4
  53. package/@types/dataview/ui/views/table-view/package.json +0 -4
  54. package/@types/dataview/ui/views/task-view/package.json +0 -4
  55. package/@types/dataview/util/hash/package.json +0 -4
  56. package/@types/dataview/util/locale/package.json +0 -4
  57. package/@types/dataview/util/media/package.json +0 -4
  58. package/@types/dataview/util/normalize/package.json +0 -4
  59. package/dist/lib/cjs/@types/dataview/api/data-array.d.cts +0 -137
  60. package/dist/lib/cjs/@types/dataview/api/extensions.d.cts +0 -16
  61. package/dist/lib/cjs/@types/dataview/api/inline-api.d.cts +0 -187
  62. package/dist/lib/cjs/@types/dataview/api/plugin-api.d.cts +0 -210
  63. package/dist/lib/cjs/@types/dataview/api/result.d.cts +0 -39
  64. package/dist/lib/cjs/@types/dataview/data-import/common.d.cts +0 -4
  65. package/dist/lib/cjs/@types/dataview/data-import/csv.d.cts +0 -4
  66. package/dist/lib/cjs/@types/dataview/data-import/inline-field.d.cts +0 -43
  67. package/dist/lib/cjs/@types/dataview/data-import/markdown-file.d.cts +0 -53
  68. package/dist/lib/cjs/@types/dataview/data-import/persister.d.cts +0 -33
  69. package/dist/lib/cjs/@types/dataview/data-import/web-worker/import-entry.d.cts +0 -2
  70. package/dist/lib/cjs/@types/dataview/data-import/web-worker/import-impl.d.cts +0 -7
  71. package/dist/lib/cjs/@types/dataview/data-import/web-worker/import-manager.d.cts +0 -38
  72. package/dist/lib/cjs/@types/dataview/data-index/index.d.cts +0 -187
  73. package/dist/lib/cjs/@types/dataview/data-index/resolver.d.cts +0 -24
  74. package/dist/lib/cjs/@types/dataview/data-index/source.d.cts +0 -72
  75. package/dist/lib/cjs/@types/dataview/data-model/markdown.d.cts +0 -116
  76. package/dist/lib/cjs/@types/dataview/data-model/serialized/markdown.d.cts +0 -107
  77. package/dist/lib/cjs/@types/dataview/data-model/transferable.d.cts +0 -8
  78. package/dist/lib/cjs/@types/dataview/data-model/value.d.cts +0 -176
  79. package/dist/lib/cjs/@types/dataview/expression/binaryop.d.cts +0 -44
  80. package/dist/lib/cjs/@types/dataview/expression/context.d.cts +0 -50
  81. package/dist/lib/cjs/@types/dataview/expression/field.d.cts +0 -83
  82. package/dist/lib/cjs/@types/dataview/expression/functions.d.cts +0 -150
  83. package/dist/lib/cjs/@types/dataview/expression/parse.d.cts +0 -164
  84. package/dist/lib/cjs/@types/dataview/index.d.cts +0 -56
  85. package/dist/lib/cjs/@types/dataview/main.d.cts +0 -53
  86. package/dist/lib/cjs/@types/dataview/query/engine.d.cts +0 -104
  87. package/dist/lib/cjs/@types/dataview/query/parse.d.cts +0 -45
  88. package/dist/lib/cjs/@types/dataview/query/query.d.cts +0 -96
  89. package/dist/lib/cjs/@types/dataview/settings.d.cts +0 -61
  90. package/dist/lib/cjs/@types/dataview/typings/obsidian-ex.d.cts +0 -29
  91. package/dist/lib/cjs/@types/dataview/typings/workers.d.cts +0 -5
  92. package/dist/lib/cjs/@types/dataview/ui/export/markdown.d.cts +0 -16
  93. package/dist/lib/cjs/@types/dataview/ui/lp-render.d.cts +0 -38
  94. package/dist/lib/cjs/@types/dataview/ui/markdown.d.cts +0 -87
  95. package/dist/lib/cjs/@types/dataview/ui/refreshable-view.d.cts +0 -19
  96. package/dist/lib/cjs/@types/dataview/ui/render.d.cts +0 -34
  97. package/dist/lib/cjs/@types/dataview/ui/views/calendar-view.d.cts +0 -18
  98. package/dist/lib/cjs/@types/dataview/ui/views/inline-field-live-preview.d.cts +0 -43
  99. package/dist/lib/cjs/@types/dataview/ui/views/inline-view.d.cts +0 -29
  100. package/dist/lib/cjs/@types/dataview/ui/views/js-view.d.cts +0 -24
  101. package/dist/lib/cjs/@types/dataview/ui/views/list-view.d.cts +0 -26
  102. package/dist/lib/cjs/@types/dataview/ui/views/table-view.d.cts +0 -29
  103. package/dist/lib/cjs/@types/dataview/ui/views/task-view.d.cts +0 -52
  104. package/dist/lib/cjs/@types/dataview/util/hash.d.cts +0 -2
  105. package/dist/lib/cjs/@types/dataview/util/locale.d.cts +0 -3
  106. package/dist/lib/cjs/@types/dataview/util/media.d.cts +0 -7
  107. package/dist/lib/cjs/@types/dataview/util/normalize.d.cts +0 -45
  108. package/dist/lib/esm/@types/dataview/api/data-array.d.mts +0 -137
  109. package/dist/lib/esm/@types/dataview/api/extensions.d.mts +0 -16
  110. package/dist/lib/esm/@types/dataview/api/inline-api.d.mts +0 -187
  111. package/dist/lib/esm/@types/dataview/api/plugin-api.d.mts +0 -210
  112. package/dist/lib/esm/@types/dataview/api/result.d.mts +0 -39
  113. package/dist/lib/esm/@types/dataview/data-import/common.d.mts +0 -4
  114. package/dist/lib/esm/@types/dataview/data-import/csv.d.mts +0 -4
  115. package/dist/lib/esm/@types/dataview/data-import/inline-field.d.mts +0 -43
  116. package/dist/lib/esm/@types/dataview/data-import/markdown-file.d.mts +0 -53
  117. package/dist/lib/esm/@types/dataview/data-import/persister.d.mts +0 -33
  118. package/dist/lib/esm/@types/dataview/data-import/web-worker/import-entry.d.mts +0 -2
  119. package/dist/lib/esm/@types/dataview/data-import/web-worker/import-impl.d.mts +0 -7
  120. package/dist/lib/esm/@types/dataview/data-import/web-worker/import-manager.d.mts +0 -38
  121. package/dist/lib/esm/@types/dataview/data-index/index.d.mts +0 -187
  122. package/dist/lib/esm/@types/dataview/data-index/resolver.d.mts +0 -24
  123. package/dist/lib/esm/@types/dataview/data-index/source.d.mts +0 -72
  124. package/dist/lib/esm/@types/dataview/data-model/markdown.d.mts +0 -116
  125. package/dist/lib/esm/@types/dataview/data-model/serialized/markdown.d.mts +0 -107
  126. package/dist/lib/esm/@types/dataview/data-model/transferable.d.mts +0 -8
  127. package/dist/lib/esm/@types/dataview/data-model/value.d.mts +0 -176
  128. package/dist/lib/esm/@types/dataview/expression/binaryop.d.mts +0 -44
  129. package/dist/lib/esm/@types/dataview/expression/context.d.mts +0 -50
  130. package/dist/lib/esm/@types/dataview/expression/field.d.mts +0 -83
  131. package/dist/lib/esm/@types/dataview/expression/functions.d.mts +0 -150
  132. package/dist/lib/esm/@types/dataview/expression/parse.d.mts +0 -164
  133. package/dist/lib/esm/@types/dataview/index.d.mts +0 -56
  134. package/dist/lib/esm/@types/dataview/main.d.mts +0 -53
  135. package/dist/lib/esm/@types/dataview/query/engine.d.mts +0 -104
  136. package/dist/lib/esm/@types/dataview/query/parse.d.mts +0 -45
  137. package/dist/lib/esm/@types/dataview/query/query.d.mts +0 -96
  138. package/dist/lib/esm/@types/dataview/settings.d.mts +0 -61
  139. package/dist/lib/esm/@types/dataview/typings/obsidian-ex.d.mts +0 -29
  140. package/dist/lib/esm/@types/dataview/typings/workers.d.mts +0 -5
  141. package/dist/lib/esm/@types/dataview/ui/export/markdown.d.mts +0 -16
  142. package/dist/lib/esm/@types/dataview/ui/lp-render.d.mts +0 -38
  143. package/dist/lib/esm/@types/dataview/ui/markdown.d.mts +0 -87
  144. package/dist/lib/esm/@types/dataview/ui/refreshable-view.d.mts +0 -19
  145. package/dist/lib/esm/@types/dataview/ui/render.d.mts +0 -34
  146. package/dist/lib/esm/@types/dataview/ui/views/calendar-view.d.mts +0 -18
  147. package/dist/lib/esm/@types/dataview/ui/views/inline-field-live-preview.d.mts +0 -43
  148. package/dist/lib/esm/@types/dataview/ui/views/inline-view.d.mts +0 -29
  149. package/dist/lib/esm/@types/dataview/ui/views/js-view.d.mts +0 -24
  150. package/dist/lib/esm/@types/dataview/ui/views/list-view.d.mts +0 -26
  151. package/dist/lib/esm/@types/dataview/ui/views/table-view.d.mts +0 -29
  152. package/dist/lib/esm/@types/dataview/ui/views/task-view.d.mts +0 -52
  153. package/dist/lib/esm/@types/dataview/util/hash.d.mts +0 -2
  154. package/dist/lib/esm/@types/dataview/util/locale.d.mts +0 -3
  155. package/dist/lib/esm/@types/dataview/util/media.d.mts +0 -7
  156. package/dist/lib/esm/@types/dataview/util/normalize.d.mts +0 -45
@@ -1,187 +0,0 @@
1
- /// <reference path="../../../library.d.cts" />
2
- /** Stores various indices on all files in the vault to make dataview generation fast. */
3
- import type { DateTime } from 'luxon' with { 'resolution-mode': 'import' };
4
- import type {
5
- App,
6
- Component,
7
- MetadataCache,
8
- TAbstractFile,
9
- TFile,
10
- Vault
11
- } from 'obsidian';
12
- import type { Result } from '../api/result.d.cjs';
13
- import type { LocalStorageCache } from '../data-import/persister.d.cjs';
14
- import type { FileImporter } from '../data-import/web-worker/import-manager.d.cjs';
15
- import type { PageMetadata } from '../data-model/markdown.d.cjs';
16
- import type { DataObject } from '../data-model/value.d.cjs';
17
- /** Aggregate index which has several sub-indices and will initialize all of them. */
18
- export declare class FullIndex extends Component {
19
- app: App;
20
- indexVersion: string;
21
- onChange: () => void;
22
- /** Generate a full index from the given vault. */
23
- static create(app: App, indexVersion: string, onChange: () => void): FullIndex;
24
- /** Whether all files in the vault have been indexed at least once. */
25
- initialized: boolean;
26
- /** I/O access to the Obsidian vault contents. */
27
- vault: Vault;
28
- /** Access to in-memory metadata, useful for parsing and metadata lookups. */
29
- metadataCache: MetadataCache;
30
- /** Persistent IndexedDB backing store, used for faster startup. */
31
- persister: LocalStorageCache;
32
- pages: Map<string, PageMetadata>;
33
- /** Map files -> tags in that file, and tags -> files. This version includes subtags. */
34
- tags: ValueCaseInsensitiveIndexMap;
35
- /** Map files -> exact tags in that file, and tags -> files. This version does not automatically add subtags. */
36
- etags: ValueCaseInsensitiveIndexMap;
37
- /** Map files -> linked files in that file, and linked file -> files that link to it. */
38
- links: IndexMap;
39
- /** Search files by path prefix. */
40
- prefix: PrefixIndex;
41
- /** Allows for efficient lookups of whether a file is starred or not. */
42
- starred: StarredCache;
43
- /** Caches data in CSV files. */
44
- csv: CsvCache;
45
- /**
46
- * The current "revision" of the index, which monotonically increases for every index change. Use this to determine
47
- * if you are up to date.
48
- */
49
- revision: number;
50
- /** Asynchronously parses files in the background using web workers. */
51
- importer: FileImporter;
52
- /** Construct a new index using the app data and a current data version. */
53
- private constructor();
54
- /** Trigger a metadata event on the metadata cache. */
55
- private trigger;
56
- /** "Touch" the index, incrementing the revision number and causing downstream views to reload. */
57
- touch(): void;
58
- /** Runs through the whole vault to set up initial file metadata. */
59
- initialize(): void;
60
- /** Drops the local storage cache and re-indexes all files; this should generally be used if you expect cache issues. */
61
- reinitialize(): Promise<void>;
62
- /** Internal asynchronous initializer. */
63
- private _initialize;
64
- rename(file: TAbstractFile, oldPath: string): void;
65
- /** Queue a file for reloading; this is done asynchronously in the background and may take a few seconds. */
66
- reload(file: TFile): Promise<{
67
- cached: boolean;
68
- skipped: boolean;
69
- }>;
70
- /** Import a file directly from disk, skipping the cache. */
71
- private import;
72
- /** Finish the reloading of file metadata by adding it to in memory indexes. */
73
- private finish;
74
- }
75
- /** Indexes files by their full prefix - essentially a simple prefix tree. */
76
- export declare class PrefixIndex extends Component {
77
- vault: Vault;
78
- updateRevision: () => void;
79
- static create(vault: Vault, updateRevision: () => void): PrefixIndex;
80
- constructor(vault: Vault, updateRevision: () => void);
81
- private walk;
82
- /** Get the list of all files under the given path. */
83
- get(prefix: string, filter?: (path: string) => boolean): Set<string>;
84
- /** Determines if the given path exists in the prefix index. */
85
- pathExists(path: string): boolean;
86
- /** Determines if the given prefix exists in the prefix index. */
87
- nodeExists(prefix: string): boolean;
88
- /**
89
- * Use the in-memory prefix index to convert a relative path to an absolute one.
90
- */
91
- resolveRelative(path: string, origin?: string): string;
92
- }
93
- /** Simple path filters which filter file types. */
94
- export declare namespace PathFilters {
95
- function csv(path: string): boolean;
96
- function markdown(path: string): boolean;
97
- }
98
- /**
99
- * Caches in-use CSVs to make high-frequency reloads (such as actively looking at a document
100
- * that uses CSV) fast.
101
- */
102
- export declare class CsvCache extends Component {
103
- vault: Vault;
104
- static CACHE_EXPIRY_SECONDS: number;
105
- cache: Map<string, {
106
- data: DataObject[];
107
- loadTime: DateTime;
108
- }>;
109
- cacheClearInterval: number;
110
- constructor(vault: Vault);
111
- /** Load a CSV file from the cache, doing a fresh load if it has not been loaded. */
112
- get(path: string): Promise<Result<DataObject[], string>>;
113
- /** Do the actual raw loading of a CSV path (which is either local or an HTTP request). */
114
- private loadInternal;
115
- /** Clear old entries in the cache (as measured by insertion time). */
116
- private clearOldEntries;
117
- }
118
- export type StarredEntry = {
119
- type: 'group';
120
- items: StarredEntry[];
121
- title: string;
122
- } | {
123
- type: 'file';
124
- path: string;
125
- title: string;
126
- } | {
127
- type: 'folder';
128
- } | {
129
- type: 'query';
130
- };
131
- /** Optional connector to the Obsidian 'Starred' plugin which allows for efficiently querying if a file is starred or not. */
132
- export declare class StarredCache extends Component {
133
- app: App;
134
- onUpdate: () => void;
135
- /** Initial delay before checking the cache; we need to wait for it to asynchronously load the initial stars. */
136
- static INITIAL_DELAY: number;
137
- /** How frequently to check for star updates. */
138
- static REFRESH_INTERVAL: number;
139
- /** Set of all starred file paths. */
140
- private stars;
141
- constructor(app: App, onUpdate: () => void);
142
- /** Determines if the given path is starred. */
143
- starred(path: string): boolean;
144
- private reload;
145
- /** Fetch all starred files from the stars plugin, if present. */
146
- private static fetch;
147
- }
148
- /** A generic index which indexes variables of the form key -> value[], allowing both forward and reverse lookups. */
149
- export declare class IndexMap {
150
- /** Maps key -> values for that key. */
151
- map: Map<string, Set<string>>;
152
- /** Cached inverse map; maps value -> keys that reference that value. */
153
- invMap: Map<string, Set<string>>;
154
- /** Create a new, empty index map. */
155
- constructor();
156
- /** Returns all values for the given key. */
157
- get(key: string): Set<string>;
158
- /** Returns all keys that reference the given key. Mutating the returned set is not allowed. */
159
- getInverse(value: string): Readonly<Set<string>>;
160
- /** Sets the key to the given values; this will delete the old mapping for the key if one was present. */
161
- set(key: string, values: Set<string>): this;
162
- /** Clears all values for the given key so they can be re-added. */
163
- delete(key: string): boolean;
164
- /** Rename all references to the given key to a new value. */
165
- rename(oldKey: string, newKey: string): boolean;
166
- /** Clear the entire index. */
167
- clear(): void;
168
- static EMPTY_SET: Readonly<Set<string>>;
169
- }
170
- /** Index map wrapper which is case-insensitive in the key. */
171
- export declare class ValueCaseInsensitiveIndexMap {
172
- delegate: IndexMap;
173
- /** Create a new, empty case insensitive index map. */
174
- constructor(delegate?: IndexMap);
175
- /** Returns all values for the given key. */
176
- get(key: string): Set<string>;
177
- /** Returns all keys that reference the given value. Mutating the returned set is not allowed. */
178
- getInverse(value: string): Readonly<Set<string>>;
179
- /** Sets the key to the given values; this will delete the old mapping for the key if one was present. */
180
- set(key: string, values: Set<string>): this;
181
- /** Clears all values for the given key so they can be re-added. */
182
- delete(key: string): boolean;
183
- /** Rename all references to the given key to a new value. */
184
- rename(oldKey: string, newKey: string): boolean;
185
- /** Clear the entire index. */
186
- clear(): void;
187
- }
@@ -1,24 +0,0 @@
1
- /// <reference path="../../../library.d.cts" />
2
- /** Collect data matching a source query. */
3
- import type { Result } from '../api/result.d.cjs';
4
- import type {
5
- DataObject,
6
- Literal
7
- } from '../data-model/value.d.cjs';
8
- import type { FullIndex } from './index.d.cjs';
9
- import type { Source } from './source.d.cjs';
10
- /** A data row which has an ID and associated data (like page link / page data). */
11
- export type Datarow<T> = {
12
- id: Literal;
13
- data: T;
14
- };
15
- /** Find source paths which match the given source. */
16
- export declare function matchingSourcePaths(source: Source, index: FullIndex, originFile?: string): Result<Set<string>, string>;
17
- /** Convert a path to the data for that path; usually markdown pages, but could also be other file types (like CSV). */
18
- export declare function resolvePathData(path: string, index: FullIndex): Promise<Result<Datarow<DataObject>[], string>>;
19
- /** Convert a CSV path to the data in the CSV (in dataview format). */
20
- export declare function resolveCsvData(path: string, index: FullIndex): Promise<Result<Datarow<DataObject>[], string>>;
21
- /** Convert a path pointing to a markdown page, into the associated metadata. */
22
- export declare function resolveMarkdownData(path: string, index: FullIndex): Result<Datarow<DataObject>[], string>;
23
- /** Resolve a source to the collection of data rows that it matches. */
24
- export declare function resolveSource(source: Source, index: FullIndex, originFile?: string): Promise<Result<Datarow<DataObject>[], string>>;
@@ -1,72 +0,0 @@
1
- /// <reference path="../../../library.d.cts" />
2
- /** AST implementation for queries over data sources. */
3
- /** The source of files for a query. */
4
- export type Source = TagSource | CsvSource | FolderSource | LinkSource | EmptySource | NegatedSource | BinaryOpSource;
5
- /** Valid operations for combining sources. */
6
- export type SourceOp = '&' | '|';
7
- /** A tag as a source of data. */
8
- export interface TagSource {
9
- type: 'tag';
10
- /** The tag to source from. */
11
- tag: string;
12
- }
13
- /** A csv as a source of data. */
14
- export interface CsvSource {
15
- type: 'csv';
16
- /** The path to the CSV file. */
17
- path: string;
18
- }
19
- /** A folder prefix as a source of data. */
20
- export interface FolderSource {
21
- type: 'folder';
22
- /** The folder prefix to source from. */
23
- folder: string;
24
- }
25
- /** Either incoming or outgoing links to a given file. */
26
- export interface LinkSource {
27
- type: 'link';
28
- /** The file to look for links to/from. */
29
- file: string;
30
- /**
31
- * The direction to look - if incoming, then all files linking to the target file. If outgoing, then all files
32
- * which the file links to.
33
- */
34
- direction: 'incoming' | 'outgoing';
35
- }
36
- /** A source which is everything EXCEPT the files returned by the given source. */
37
- export interface NegatedSource {
38
- type: 'negate';
39
- /** The source to negate. */
40
- child: Source;
41
- }
42
- /** A source which yields nothing. */
43
- export interface EmptySource {
44
- type: 'empty';
45
- }
46
- /** A source made by combining subsources with a logical operators. */
47
- export interface BinaryOpSource {
48
- type: 'binaryop';
49
- op: SourceOp;
50
- left: Source;
51
- right: Source;
52
- }
53
- /** Utility functions for creating and manipulating sources. */
54
- export declare namespace Sources {
55
- /** Create a source which searches from a tag. */
56
- function tag(tag: string): TagSource;
57
- /** Create a source which fetches from a CSV file. */
58
- function csv(path: string): CsvSource;
59
- /** Create a source which searches for files under a folder prefix. */
60
- function folder(prefix: string): FolderSource;
61
- /** Create a source which searches for files which link to/from a given file. */
62
- function link(file: string, incoming: boolean): LinkSource;
63
- /** Create a source which joins two sources by a logical operator (and/or). */
64
- function binaryOp(left: Source, op: SourceOp, right: Source): Source;
65
- /** Create a source which takes the intersection of two sources. */
66
- function and(left: Source, right: Source): Source;
67
- /** Create a source which takes the union of two sources. */
68
- function or(left: Source, right: Source): Source;
69
- /** Create a source which negates the underlying source. */
70
- function negate(child: Source): NegatedSource;
71
- function empty(): EmptySource;
72
- }
@@ -1,116 +0,0 @@
1
- /// <reference path="../../../library.d.cts" />
2
- import type { DateTime } from 'luxon' with { 'resolution-mode': 'import' };
3
- import type { Pos } from 'obsidian' with { 'resolution-mode': 'import' };
4
- import type { FullIndex } from '../data-index/index.d.cjs';
5
- import type { DataObject } from '../index.d.cjs';
6
- import type {
7
- SListItem,
8
- SMarkdownPage
9
- } from './serialized/markdown.d.cjs';
10
- import type {
11
- Link,
12
- Literal
13
- } from './value.d.cjs';
14
- /** All extracted markdown file metadata obtained from a file. */
15
- export declare class PageMetadata {
16
- /** The path this file exists at. */
17
- path: string;
18
- /** Obsidian-provided date this page was created. */
19
- ctime: DateTime;
20
- /** Obsidian-provided date this page was modified. */
21
- mtime: DateTime;
22
- /** Obsidian-provided size of this page in bytes. */
23
- size: number;
24
- /** The day associated with this page, if relevant. */
25
- day?: DateTime;
26
- /** The first H1/H2 header in the file. May not exist. */
27
- title?: string;
28
- /** All of the fields contained in this markdown file - both frontmatter AND in-file links. */
29
- fields: Map<string, Literal>;
30
- /** All of the exact tags (prefixed with '#') in this file overall. */
31
- tags: Set<string>;
32
- /** All of the aliases defined for this file. */
33
- aliases: Set<string>;
34
- /** All OUTGOING links (including embeds, header + block links) in this file. */
35
- links: Link[];
36
- /** All list items contained within this page. Filter for tasks to get just tasks. */
37
- lists: ListItem[];
38
- /** The raw frontmatter for this document. */
39
- frontmatter: Record<string, Literal>;
40
- constructor(path: string, init?: Partial<PageMetadata>);
41
- /** Canonicalize raw links and other data in partial data with normalizers, returning a completed object. */
42
- static canonicalize(data: Partial<PageMetadata>, linkNormalizer: (link: Link) => Link): PageMetadata;
43
- /** The name (based on path) of this file. */
44
- name(): string;
45
- /** The containing folder (based on path) of this file. */
46
- folder(): string;
47
- /** The extension of this file (likely 'md'). */
48
- extension(): string;
49
- /** Return a set of tags AND all of their parent tags (so #hello/yes would become #hello, #hello/yes). */
50
- fullTags(): Set<string>;
51
- /** Convert all links in this file to file links. */
52
- fileLinks(): Link[];
53
- /** Map this metadata to a full object; uses the index for additional data lookups. */
54
- serialize(index: FullIndex, cache?: ListSerializationCache): SMarkdownPage;
55
- }
56
- /** A list item inside of a list. */
57
- export declare class ListItem {
58
- /** The symbol ('*', '-', '1.') used to define this list item. */
59
- symbol: string;
60
- /** A link which points to this task, or to the closest block that this task is contained in. */
61
- link: Link;
62
- /** A link to the section that contains this list element; could be a file if this is not in a section. */
63
- section: Link;
64
- /** The text of this list item. This may be multiple lines of markdown. */
65
- text: string;
66
- /** The line that this list item starts on in the file. */
67
- line: number;
68
- /** The number of lines that define this list item. */
69
- lineCount: number;
70
- /** The line number for the first list item in the list this item belongs to. */
71
- list: number;
72
- /** Any links contained within this list item. */
73
- links: Link[];
74
- /** The tags contained within this list item. */
75
- tags: Set<string>;
76
- /** The raw Obsidian-provided position for where this task is. */
77
- position: Pos;
78
- /** The line number of the parent list item, if present; if this is undefined, this is a root item. */
79
- parent?: number;
80
- /** The line numbers of children of this list item. */
81
- children: number[];
82
- /** The block ID for this item, if one is present. */
83
- blockId?: string;
84
- /** Any fields defined in this list item. For tasks, this includes fields underneath the task. */
85
- fields: Map<string, Literal[]>;
86
- task?: {
87
- /** The text in between the brackets of the '[ ]' task indicator ('[X]' would yield 'X', for example.) */
88
- status: string;
89
- /** Whether or not this task has been checked in any way (it's status is not empty/space). */
90
- checked: boolean;
91
- /** Whether or not this task was completed; derived from 'status' by checking if the field 'X' or 'x'. */
92
- completed: boolean;
93
- /** Whether or not this task and all of it's subtasks are completed. */
94
- fullyCompleted: boolean;
95
- };
96
- constructor(init?: Partial<ListItem>);
97
- id(): string;
98
- file(): Link;
99
- markdown(): string;
100
- created(): Literal | undefined;
101
- due(): Literal | undefined;
102
- completed(): Literal | undefined;
103
- start(): Literal | undefined;
104
- scheduled(): Literal | undefined;
105
- /** Create an API-friendly copy of this list item. De-duplication is done via the provided cache. */
106
- serialize(cache: ListSerializationCache): SListItem;
107
- }
108
- /** De-duplicates list items across section metadata and page metadata. */
109
- export declare class ListSerializationCache {
110
- listItems: Record<number, ListItem>;
111
- cache: Record<number, SListItem>;
112
- seen: Set<number>;
113
- constructor(listItems: ListItem[]);
114
- get(lineno: number): SListItem | undefined;
115
- }
116
- export declare function addFields(fields: Map<string, Literal[]>, target: DataObject): DataObject;
@@ -1,107 +0,0 @@
1
- /// <reference path="../../../../library.d.cts" />
2
- /** Serialized / API facing data types for Dataview objects. */
3
- import type { DateTime } from 'luxon' with { 'resolution-mode': 'import' };
4
- import type { Pos } from 'obsidian' with { 'resolution-mode': 'import' };
5
- import type {
6
- Link,
7
- Literal
8
- } from '../value.d.cjs';
9
- export interface SMarkdownPage {
10
- file: {
11
- path: string;
12
- folder: string;
13
- name: string;
14
- link: Link;
15
- outlinks: Link[];
16
- inlinks: Link[];
17
- etags: string[];
18
- tags: string[];
19
- aliases: string[];
20
- lists: SListItem[];
21
- tasks: STask[];
22
- ctime: DateTime;
23
- cday: DateTime;
24
- mtime: DateTime;
25
- mday: DateTime;
26
- size: number;
27
- ext: string;
28
- starred: boolean;
29
- day?: DateTime;
30
- };
31
- /** Additional fields added by field data. */
32
- [key: string]: any;
33
- }
34
- /** A serialized list item. */
35
- export type SListItem = SListEntry | STask;
36
- /** Shared data between list items. */
37
- export interface SListItemBase {
38
- /** The symbol used to start this list item, like '1.' or '1)' or '*'. */
39
- symbol: string;
40
- /** A link to the closest thing to this list item (a block, a section, or a file). */
41
- link: Link;
42
- /** The section that contains this list item. */
43
- section: Link;
44
- /** The path of the file that contains this item. */
45
- path: string;
46
- /** The line this item starts on. */
47
- line: number;
48
- /** The number of lines this item spans. */
49
- lineCount: number;
50
- /** The internal Obsidian tracker of the exact position of this line. */
51
- position: Pos;
52
- /** The line number of the list that this item is part of. */
53
- list: number;
54
- /** If present, the block ID for this item. */
55
- blockId?: string;
56
- /** The line number of the parent item to this list, if relevant. */
57
- parent?: number;
58
- /** The children elements of this list item. */
59
- children: SListItem[];
60
- /** Links contained inside this list item. */
61
- outlinks: Link[];
62
- /** The raw text of this item. */
63
- text: string;
64
- /**
65
- * If present, overrides 'text' when rendered in task views. You should not mutate 'text' since it is used to
66
- * validate a list item when editing it.
67
- */
68
- visual?: string;
69
- /** Whether this item has any metadata annotations on it. */
70
- annotated?: boolean;
71
- /** Any tags present in this task. */
72
- tags: string[];
73
- /** @deprecated use 'children' instead. */
74
- subtasks: SListItem[];
75
- /** @deprecated use 'task' instead. */
76
- real: boolean;
77
- /** @deprecated use 'section' instead. */
78
- header: Link;
79
- /** Additional fields added by annotations. */
80
- [key: string]: any;
81
- }
82
- /** A serialized list item as seen by users; this is not a task. */
83
- export interface SListEntry extends SListItemBase {
84
- task: false;
85
- }
86
- /** A serialized task. */
87
- export interface STask extends SListItemBase {
88
- task: true;
89
- /** The status of this task, the text between the brackets ('[ ]'). Will be a space if the task is currently unchecked. */
90
- status: string;
91
- /** Indicates whether the task has any value other than empty space. */
92
- checked: boolean;
93
- /** Indicates whether the task explicitly has been marked "completed" ('x' or 'X'). */
94
- completed: boolean;
95
- /** Indicates whether the task and ALL subtasks have been completed. */
96
- fullyCompleted: boolean;
97
- /** If present, then the time that this task was created. */
98
- created?: Literal;
99
- /** If present, then the time that this task was due. */
100
- due?: Literal;
101
- /** If present, then the time that this task was completed. */
102
- completion?: Literal;
103
- /** If present, then the day that this task can be started. */
104
- start?: Literal;
105
- /** If present, then the day that work on this task is scheduled. */
106
- scheduled?: Literal;
107
- }
@@ -1,8 +0,0 @@
1
- /// <reference path="../../../library.d.cts" />
2
- /** Simplifies passing dataview values across the JS web worker barrier. */
3
- export declare namespace Transferable {
4
- /** Convert a literal value to a serializer-friendly transferable value. */
5
- function transferable(value: any): any;
6
- /** Convert a transferable value back to a literal value we can work with. */
7
- function value(transferable: any): any;
8
- }