Skip to content

Commit d78ad59

Browse files
jcortesmichelle0927
authored andcommitted
[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]>
1 parent 29277ea commit d78ad59

File tree

15 files changed

+563
-20
lines changed

15 files changed

+563
-20
lines changed

components/roamresearch/actions/add-content-to-daily-note-page/add-content-to-daily-note-page.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "roamresearch-add-content-to-daily-note-page",
55
name: "Add Content To Daily Note Page",
66
description: "Adds content as a child block to a daily note page in Roam Research (access to encrypted and non encrypted graphs). [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/eb8OVhaFC).",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
app,
@@ -57,7 +57,7 @@ export default {
5757
},
5858
});
5959

60-
$.export("$summary", "Succesfully added content to daily note page.");
60+
$.export("$summary", "Successfully added content to daily note page.");
6161
return response;
6262
},
6363
};

components/roamresearch/actions/add-content-to-page/add-content-to-page.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "roamresearch-add-content-to-page",
55
name: "Add Content To Page",
66
description: "Add content as a child block to an existing or new page in Roam Research (access to encrypted and non encrypted graphs). [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/eb8OVhaFC).",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
app,
@@ -55,7 +55,7 @@ export default {
5555
},
5656
});
5757

58-
$.export("$summary", "Succesfully added content to page.");
58+
$.export("$summary", "Successfully added content to page.");
5959
return response;
6060
},
6161
};

components/roamresearch/actions/add-content-underneath-block/add-content-underneath-block.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "roamresearch-add-content-underneath-block",
55
name: "Add Content Underneath Block",
66
description: "Add content underneath an existing block in your Roam Research graph (access to encrypted and non encrypted graphs). [See the documentation](https://roamresearch.com/)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
app,
@@ -54,7 +54,7 @@ export default {
5454
},
5555
});
5656

57-
$.export("$summary", "Succesfully added content underneath block.");
57+
$.export("$summary", "Successfully added content underneath block.");
5858
return response;
5959
},
6060
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import utils from "../../common/utils.mjs";
2+
import app from "../../roamresearch.app.mjs";
3+
4+
export default {
5+
key: "roamresearch-append-blocks",
6+
name: "Append Blocks",
7+
description: "Generic append blocks for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
location: {
13+
type: "object",
14+
label: "Location",
15+
description: "The location to append the block to. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).",
16+
},
17+
appendData: {
18+
type: "string[]",
19+
label: "Append Data",
20+
description: "The data to append to the block. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).",
21+
},
22+
},
23+
async run({ $ }) {
24+
const {
25+
app,
26+
location,
27+
appendData,
28+
} = this;
29+
30+
const response = await app.appendBlocks({
31+
$,
32+
data: {
33+
location,
34+
["append-data"]: utils.parseArray(appendData),
35+
},
36+
});
37+
38+
$.export("$summary", "Successfully ran append blocks.");
39+
return response;
40+
},
41+
};

components/roamresearch/actions/get-page-or-block-data/get-page-or-block-data.mjs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,21 @@ export default {
44
key: "roamresearch-get-page-or-block-data",
55
name: "Get Page Or Block Data",
66
description: "Get the data for a page or block in Roam Research (access only to non ecrypted graphs). [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/eb8OVhaFC).",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
app,
1111
resourceType: {
12-
type: "string",
13-
label: "Resource Type",
14-
description: "The type of resource to get data for.",
15-
options: [
16-
"page",
17-
"block",
12+
propDefinition: [
13+
app,
14+
"resourceType",
1815
],
1916
},
2017
pageOrBlock: {
21-
type: "string",
22-
label: "Page Title Or Block UID",
23-
description: "The page title of the block uid to get data for. Page title example: `My Page` and Block UID example: `ideWWvTgI`.",
18+
propDefinition: [
19+
app,
20+
"pageOrBlock",
21+
],
2422
},
2523
},
2624
async run({ $ }) {
@@ -47,7 +45,7 @@ export default {
4745
return response;
4846
}
4947

50-
$.export("$summary", `Succesfully got data for ${resourceType}: \`${pageOrBlock}\`.`);
48+
$.export("$summary", `Successfully got data for ${resourceType}: \`${pageOrBlock}\`.`);
5149
return response;
5250
},
5351
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import app from "../../roamresearch.app.mjs";
2+
3+
export default {
4+
key: "roamresearch-pull-many",
5+
name: "Pull Many",
6+
description: "Generic pull many for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
eids: {
12+
type: "string",
13+
label: "Entity IDs",
14+
description: "The entity IDs to pull. Eg. `[[:block/uid \"08-30-2022\"] [:block/uid \"08-31-2022\"]]`.",
15+
},
16+
selector: {
17+
type: "string",
18+
label: "Selector",
19+
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]}]`.",
20+
},
21+
},
22+
async run({ $ }) {
23+
const {
24+
app,
25+
eids,
26+
selector,
27+
} = this;
28+
29+
const response = await app.pullMany({
30+
$,
31+
data: {
32+
eids,
33+
selector,
34+
},
35+
});
36+
37+
if (!response.result) {
38+
$.export("$summary", `Failed to pull many data for entity IDs: \`${eids}\`.`);
39+
return response;
40+
}
41+
42+
$.export("$summary", "Successfully ran pull many.");
43+
return response;
44+
},
45+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import app from "../../roamresearch.app.mjs";
2+
3+
export default {
4+
key: "roamresearch-pull",
5+
name: "Pull",
6+
description: "Generic pull for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
eid: {
12+
type: "string",
13+
label: "Entity ID",
14+
description: "The entity ID to pull. Eg. `[:block/uid \"08-30-2022\"]`.",
15+
},
16+
selector: {
17+
type: "string",
18+
label: "Selector",
19+
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]}]`.",
20+
},
21+
},
22+
async run({ $ }) {
23+
const {
24+
app,
25+
eid,
26+
selector,
27+
} = this;
28+
29+
const response = await app.pull({
30+
$,
31+
data: {
32+
eid,
33+
selector,
34+
},
35+
});
36+
37+
if (!response.result) {
38+
$.export("$summary", `Failed to pull data for entity ID: \`${eid}\`.`);
39+
return response;
40+
}
41+
42+
$.export("$summary", "Successfully ran pull.");
43+
return response;
44+
},
45+
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import app from "../../roamresearch.app.mjs";
2+
3+
export default {
4+
key: "roamresearch-query",
5+
name: "Query",
6+
description: "Generic query for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
query: {
12+
type: "string",
13+
label: "Query",
14+
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)]]`.",
15+
},
16+
args: {
17+
type: "string[]",
18+
label: "Arguments",
19+
description: "The arguments to pass to the query. Eg. `apple` as the firs argument.",
20+
},
21+
},
22+
async run({ $ }) {
23+
const {
24+
app,
25+
query,
26+
args,
27+
} = this;
28+
29+
const response = await app.query({
30+
$,
31+
data: {
32+
query,
33+
args,
34+
},
35+
});
36+
37+
$.export("$summary", "Successfully ran query.");
38+
return response;
39+
},
40+
};

components/roamresearch/actions/search-title/search-title.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "roamresearch-search-title",
55
name: "Search Title",
66
description: "Search for a title in Roam Research pages (access only to non ecrypted graphs). [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/eb8OVhaFC).",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
app,
@@ -35,7 +35,7 @@ export default {
3535
},
3636
});
3737

38-
$.export("$summary", `Succesfully searched for title: \`${title}\`.`);
38+
$.export("$summary", `Successfully searched for title: \`${title}\`.`);
3939
return response;
4040
},
4141
};

0 commit comments

Comments
 (0)