@monkeyplus/flow 6.0.26 → 6.0.27
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.
package/package.json
CHANGED
|
@@ -11,5 +11,9 @@ export interface QueryContentBuilder {
|
|
|
11
11
|
first: () => Promise<ContentEntry | null>;
|
|
12
12
|
surround: (targetPath: string) => Promise<[ContentEntry | null, ContentEntry | null]>;
|
|
13
13
|
tree: () => Promise<ContentTreeNode[]>;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `find()` for array results or `findOne()` for single items.
|
|
16
|
+
*/
|
|
17
|
+
fetch: () => Promise<ContentEntry | ContentEntry[]>;
|
|
14
18
|
}
|
|
15
19
|
export declare function queryContent(path?: string): QueryContentBuilder;
|
|
@@ -197,6 +197,17 @@ export function queryContent(path = "") {
|
|
|
197
197
|
async tree() {
|
|
198
198
|
const q = { path: queryObj.path };
|
|
199
199
|
return await fetchContent("tree", q);
|
|
200
|
+
},
|
|
201
|
+
/**
|
|
202
|
+
* @deprecated Use `find()` for array results or `findOne()` for single items.
|
|
203
|
+
*/
|
|
204
|
+
async fetch() {
|
|
205
|
+
const result = await this.find();
|
|
206
|
+
const exactMatch = result.find((item) => item.path === queryObj.path);
|
|
207
|
+
if (exactMatch) {
|
|
208
|
+
return exactMatch;
|
|
209
|
+
}
|
|
210
|
+
return result;
|
|
200
211
|
}
|
|
201
212
|
};
|
|
202
213
|
return builder;
|