Skip to content

Commit 58f8097

Browse files
committed
[Components] roamresearch - Added new components
1 parent 0ded330 commit 58f8097

File tree

15 files changed

+599
-15
lines changed

15 files changed

+599
-15
lines changed

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

Lines changed: 1 addition & 1 deletion
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,

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

Lines changed: 1 addition & 1 deletion
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,

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

Lines changed: 1 addition & 1 deletion
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,
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import utils from "../../common/utils.mjs";
2+
import app from "../../roamresearch.app.mjs";
3+
4+
export default {
5+
key: "roamresearch-append-block",
6+
name: "Append Block",
7+
description: "Generic append block for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/jzuu4ODbF).",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
string: {
13+
type: "string",
14+
label: "Content",
15+
description: "The string to append.",
16+
},
17+
children: {
18+
type: "string[]",
19+
label: "Children",
20+
description: "The children to append. This is an array of possibly further nested child blocks.",
21+
optional: true,
22+
},
23+
heading: {
24+
type: "string",
25+
label: "Heading",
26+
description: "The heading to append.",
27+
optional: true,
28+
},
29+
open: {
30+
type: "boolean",
31+
label: "Open",
32+
description: "Whether the block should be collapsed or expanded. Defaults to `true`.",
33+
optional: true,
34+
},
35+
childrenViewType: {
36+
type: "string",
37+
label: "Children View Type",
38+
description: "Block view type of children blocks.",
39+
optional: true,
40+
options: [
41+
"bullet",
42+
"document",
43+
"numbered",
44+
],
45+
},
46+
uid: {
47+
type: "string",
48+
label: "UID",
49+
description: "The UID of the block to append.",
50+
optional: true,
51+
},
52+
},
53+
async run({ $ }) {
54+
const {
55+
app,
56+
string,
57+
children,
58+
heading,
59+
open,
60+
childrenViewType,
61+
uid,
62+
} = this;
63+
64+
const response = await app.appendBlocks({
65+
$,
66+
data: {
67+
"append-data": {
68+
string,
69+
children: utils.parseArray(children),
70+
heading,
71+
open,
72+
["children-view-type"]: childrenViewType,
73+
uid,
74+
},
75+
},
76+
});
77+
78+
$.export("$summary", "Succesfully ran append block.");
79+
return response;
80+
},
81+
};

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

Lines changed: 8 additions & 10 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({ $ }) {
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 ID 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", "Succesfully 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", "Succesfully 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", "Succesfully ran query.");
38+
return response;
39+
},
40+
};

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

Lines changed: 1 addition & 1 deletion
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,

0 commit comments

Comments
 (0)