-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Components] roamresearch - Added new components (#14482)
* [Components] roamresearch - Added new components * Update components/roamresearch/sources/new-modified-linked-reference/new-modified-linked-reference.mjs Co-authored-by: michelle0927 <[email protected]> --------- Co-authored-by: michelle0927 <[email protected]>
- Loading branch information
1 parent
129369a
commit 776eed2
Showing
15 changed files
with
563 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
components/roamresearch/actions/append-blocks/append-blocks.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import utils from "../../common/utils.mjs"; | ||
import app from "../../roamresearch.app.mjs"; | ||
|
||
export default { | ||
key: "roamresearch-append-blocks", | ||
name: "Append Blocks", | ||
description: "Generic append blocks for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
location: { | ||
type: "object", | ||
label: "Location", | ||
description: "The location to append the block to. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).", | ||
}, | ||
appendData: { | ||
type: "string[]", | ||
label: "Append Data", | ||
description: "The data to append to the block. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
app, | ||
location, | ||
appendData, | ||
} = this; | ||
|
||
const response = await app.appendBlocks({ | ||
$, | ||
data: { | ||
location, | ||
["append-data"]: utils.parseArray(appendData), | ||
}, | ||
}); | ||
|
||
$.export("$summary", "Successfully ran append blocks."); | ||
return response; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import app from "../../roamresearch.app.mjs"; | ||
|
||
export default { | ||
key: "roamresearch-pull-many", | ||
name: "Pull Many", | ||
description: "Generic pull many for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
eids: { | ||
type: "string", | ||
label: "Entity IDs", | ||
description: "The entity IDs to pull. Eg. `[[:block/uid \"08-30-2022\"] [:block/uid \"08-31-2022\"]]`.", | ||
}, | ||
selector: { | ||
type: "string", | ||
label: "Selector", | ||
description: "The selector to pull. Eg. `[:block/uid :node/title :block/string {:block/children [:block/uid :block/string]} {:block/refs [:node/title :block/string :block/uid]}]`.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
app, | ||
eids, | ||
selector, | ||
} = this; | ||
|
||
const response = await app.pullMany({ | ||
$, | ||
data: { | ||
eids, | ||
selector, | ||
}, | ||
}); | ||
|
||
if (!response.result) { | ||
$.export("$summary", `Failed to pull many data for entity IDs: \`${eids}\`.`); | ||
return response; | ||
} | ||
|
||
$.export("$summary", "Successfully ran pull many."); | ||
return response; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import app from "../../roamresearch.app.mjs"; | ||
|
||
export default { | ||
key: "roamresearch-pull", | ||
name: "Pull", | ||
description: "Generic pull for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
eid: { | ||
type: "string", | ||
label: "Entity ID", | ||
description: "The entity ID to pull. Eg. `[:block/uid \"08-30-2022\"]`.", | ||
}, | ||
selector: { | ||
type: "string", | ||
label: "Selector", | ||
description: "The selector to pull. Eg. `[:block/uid :node/title :block/string {:block/children [:block/uid :block/string]} {:block/refs [:node/title :block/string :block/uid]}]`.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
app, | ||
eid, | ||
selector, | ||
} = this; | ||
|
||
const response = await app.pull({ | ||
$, | ||
data: { | ||
eid, | ||
selector, | ||
}, | ||
}); | ||
|
||
if (!response.result) { | ||
$.export("$summary", `Failed to pull data for entity ID: \`${eid}\`.`); | ||
return response; | ||
} | ||
|
||
$.export("$summary", "Successfully ran pull."); | ||
return response; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import app from "../../roamresearch.app.mjs"; | ||
|
||
export default { | ||
key: "roamresearch-query", | ||
name: "Query", | ||
description: "Generic query for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
query: { | ||
type: "string", | ||
label: "Query", | ||
description: "The query to run in Datalog language. Eg. `[:find ?block-uid ?block-str :in $ ?search-string :where [?b :block/uid ?block-uid] [?b :block/string ?block-str] [(clojure.string/includes? ?block-str ?search-string)]]`.", | ||
}, | ||
args: { | ||
type: "string[]", | ||
label: "Arguments", | ||
description: "The arguments to pass to the query. Eg. `apple` as the firs argument.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
app, | ||
query, | ||
args, | ||
} = this; | ||
|
||
const response = await app.query({ | ||
$, | ||
data: { | ||
query, | ||
args, | ||
}, | ||
}); | ||
|
||
$.export("$summary", "Successfully ran query."); | ||
return response; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.