@pipedream/grain 0.0.1 → 0.1.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.
- package/actions/get-recording/get-recording.mjs +57 -0
- package/common/constants.mjs +25 -0
- package/common/utils.mjs +24 -0
- package/grain.app.mjs +107 -5
- package/package.json +4 -1
- package/sources/common/base.mjs +44 -0
- package/sources/new-highlight-instant/new-highlight-instant.mjs +36 -0
- package/sources/new-highlight-instant/test-event.mjs +17 -0
- package/sources/new-recording-instant/new-recording-instant.mjs +36 -0
- package/sources/new-recording-instant/test-event.mjs +12 -0
- package/sources/new-story-instant/new-story-instant.mjs +36 -0
- package/sources/new-story-instant/test-event.mjs +15 -0
- package/sources/removed-highlight-instant/removed-highlight-instant.mjs +36 -0
- package/sources/removed-highlight-instant/test-event.mjs +8 -0
- package/sources/removed-recording-instant/removed-recording-instant.mjs +36 -0
- package/sources/removed-recording-instant/test-event.mjs +7 -0
- package/sources/removed-story-instant/removed-story-instant.mjs +36 -0
- package/sources/removed-story-instant/test-event.mjs +7 -0
- package/sources/updated-highlight-instant/test-event.mjs +17 -0
- package/sources/updated-highlight-instant/updated-highlight-instant.mjs +36 -0
- package/sources/updated-recording-instant/test-event.mjs +12 -0
- package/sources/updated-recording-instant/updated-recording-instant.mjs +36 -0
- package/sources/updated-story-instant/test-event.mjs +15 -0
- package/sources/updated-story-instant/updated-story-instant.mjs +36 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INTELLIGENCE_NOTES_FORMAT_OPTIONS,
|
|
3
|
+
TRANSCRIPT_FORMAT_OPTIONS,
|
|
4
|
+
} from "../../common/constants.mjs";
|
|
5
|
+
import { parseObject } from "../../common/utils.mjs";
|
|
6
|
+
import grain from "../../grain.app.mjs";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
key: "grain-get-recording",
|
|
10
|
+
name: "Get Recording",
|
|
11
|
+
description: "Fetches a specific recording by its ID from Grain, optionally including the transcript and intelligence notes. [See the documentation](https://grainhq.notion.site/grain-public-api-877184aa82b54c77a875083c1b560de9)",
|
|
12
|
+
version: "0.0.1",
|
|
13
|
+
type: "action",
|
|
14
|
+
props: {
|
|
15
|
+
grain,
|
|
16
|
+
recordId: {
|
|
17
|
+
propDefinition: [
|
|
18
|
+
grain,
|
|
19
|
+
"recordId",
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
transcriptFormat: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "Transcript Format",
|
|
25
|
+
description: "Format for the transcript",
|
|
26
|
+
options: TRANSCRIPT_FORMAT_OPTIONS,
|
|
27
|
+
optional: true,
|
|
28
|
+
},
|
|
29
|
+
intelligenceNotesFormat: {
|
|
30
|
+
type: "string",
|
|
31
|
+
label: "Intelligence Notes Format",
|
|
32
|
+
description: "Format for the intelligence notes",
|
|
33
|
+
options: INTELLIGENCE_NOTES_FORMAT_OPTIONS,
|
|
34
|
+
optional: true,
|
|
35
|
+
},
|
|
36
|
+
allowedIntelligenceNotes: {
|
|
37
|
+
type: "string[]",
|
|
38
|
+
label: "Allowed Intelligence Notes",
|
|
39
|
+
description: "Whitelist of intelligence notes section titles",
|
|
40
|
+
optional: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
async run({ $ }) {
|
|
44
|
+
const response = await this.grain.fetchRecording({
|
|
45
|
+
$,
|
|
46
|
+
recordId: this.recordId,
|
|
47
|
+
params: {
|
|
48
|
+
transcript_format: this.transcriptFormat,
|
|
49
|
+
intelligence_notes_format: this.intelligenceNotesFormat,
|
|
50
|
+
allowed_intelligence_notes: parseObject(this.allowedIntelligenceNotes),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
$.export("$summary", `Successfully fetched recording with ID ${this.recordId}`);
|
|
55
|
+
return response;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const TRANSCRIPT_FORMAT_OPTIONS = [
|
|
2
|
+
{
|
|
3
|
+
label: "JSON",
|
|
4
|
+
value: "json",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: "VTT",
|
|
8
|
+
value: "vtt",
|
|
9
|
+
},
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export const INTELLIGENCE_NOTES_FORMAT_OPTIONS = [
|
|
13
|
+
{
|
|
14
|
+
label: "JSON",
|
|
15
|
+
value: "json",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: "Markdown",
|
|
19
|
+
value: "md",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: "Text",
|
|
23
|
+
value: "text",
|
|
24
|
+
},
|
|
25
|
+
];
|
package/common/utils.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const parseObject = (obj) => {
|
|
2
|
+
if (!obj) return undefined;
|
|
3
|
+
|
|
4
|
+
if (Array.isArray(obj)) {
|
|
5
|
+
return obj.map((item) => {
|
|
6
|
+
if (typeof item === "string") {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(item);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
return item;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return item;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (typeof obj === "string") {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(obj);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
};
|
package/grain.app.mjs
CHANGED
|
@@ -1,11 +1,113 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
|
|
1
3
|
export default {
|
|
2
4
|
type: "app",
|
|
3
5
|
app: "grain",
|
|
4
|
-
propDefinitions: {
|
|
6
|
+
propDefinitions: {
|
|
7
|
+
recordId: {
|
|
8
|
+
type: "string",
|
|
9
|
+
label: "Record ID",
|
|
10
|
+
description: "The ID of the recording to fetch",
|
|
11
|
+
async options({ prevContext: { nextPage } }) {
|
|
12
|
+
const {
|
|
13
|
+
recordings, cursor,
|
|
14
|
+
} = await this.listRecordings({
|
|
15
|
+
params: {
|
|
16
|
+
cursor: nextPage,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
options: recordings.map(({
|
|
21
|
+
id: value, title: label,
|
|
22
|
+
}) => ({
|
|
23
|
+
value,
|
|
24
|
+
label,
|
|
25
|
+
})),
|
|
26
|
+
context: {
|
|
27
|
+
nextPage: cursor,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
viewId: {
|
|
33
|
+
type: "string",
|
|
34
|
+
label: "View ID",
|
|
35
|
+
description: "The ID of the view to fetch",
|
|
36
|
+
async options({
|
|
37
|
+
type, prevContext: { nextPage },
|
|
38
|
+
}) {
|
|
39
|
+
const {
|
|
40
|
+
views, cursor,
|
|
41
|
+
} = await this.listViews({
|
|
42
|
+
params: {
|
|
43
|
+
type_filter: type,
|
|
44
|
+
cursor: nextPage,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
options: views.map(({
|
|
49
|
+
id: value, name: label,
|
|
50
|
+
}) => ({
|
|
51
|
+
value,
|
|
52
|
+
label,
|
|
53
|
+
})),
|
|
54
|
+
context: {
|
|
55
|
+
nextPage: cursor,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
5
61
|
methods: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
62
|
+
_baseUrl() {
|
|
63
|
+
return "https://grain.com/_/public-api";
|
|
64
|
+
},
|
|
65
|
+
_headers() {
|
|
66
|
+
return {
|
|
67
|
+
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
_makeRequest({
|
|
71
|
+
$ = this, path, ...opts
|
|
72
|
+
}) {
|
|
73
|
+
return axios($, {
|
|
74
|
+
url: this._baseUrl() + path,
|
|
75
|
+
headers: this._headers(),
|
|
76
|
+
...opts,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
listRecordings(opts = {}) {
|
|
80
|
+
return this._makeRequest({
|
|
81
|
+
path: "/recordings",
|
|
82
|
+
...opts,
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
listViews(opts = {}) {
|
|
86
|
+
return this._makeRequest({
|
|
87
|
+
path: "/views",
|
|
88
|
+
...opts,
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
fetchRecording({
|
|
92
|
+
recordId, ...opts
|
|
93
|
+
}) {
|
|
94
|
+
return this._makeRequest({
|
|
95
|
+
path: `/recordings/${recordId}`,
|
|
96
|
+
...opts,
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
createWebhook(opts = {}) {
|
|
100
|
+
return this._makeRequest({
|
|
101
|
+
method: "POST",
|
|
102
|
+
path: "/hooks",
|
|
103
|
+
...opts,
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
deleteWebhook(hookId) {
|
|
107
|
+
return this._makeRequest({
|
|
108
|
+
method: "DELETE",
|
|
109
|
+
path: `/hooks/${hookId}`,
|
|
110
|
+
});
|
|
9
111
|
},
|
|
10
112
|
},
|
|
11
|
-
};
|
|
113
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/grain",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Pipedream Grain Components",
|
|
5
5
|
"main": "grain.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^3.0.3"
|
|
14
17
|
}
|
|
15
18
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import grain from "../../grain.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
grain,
|
|
6
|
+
http: "$.interface.http",
|
|
7
|
+
db: "$.service.db",
|
|
8
|
+
},
|
|
9
|
+
methods: {
|
|
10
|
+
_getHookId() {
|
|
11
|
+
return this.db.get("hookId");
|
|
12
|
+
},
|
|
13
|
+
_setHookId(hookId) {
|
|
14
|
+
this.db.set("hookId", hookId);
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
hooks: {
|
|
18
|
+
async activate() {
|
|
19
|
+
const response = await this.grain.createWebhook({
|
|
20
|
+
data: {
|
|
21
|
+
version: 2,
|
|
22
|
+
hook_url: this.http.endpoint,
|
|
23
|
+
view_id: this.viewId,
|
|
24
|
+
actions: this.getAction(),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
this._setHookId(response.id);
|
|
28
|
+
},
|
|
29
|
+
async deactivate() {
|
|
30
|
+
const webhookId = this._getHookId();
|
|
31
|
+
await this.grain.deleteWebhook(webhookId);
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
async run({ body }) {
|
|
35
|
+
if (!body.data) return;
|
|
36
|
+
|
|
37
|
+
const ts = Date.parse(new Date());
|
|
38
|
+
this.$emit(body, {
|
|
39
|
+
id: `${body.data.id}-${ts}`,
|
|
40
|
+
summary: this.getSummary(body),
|
|
41
|
+
ts,
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-new-highlight-instant",
|
|
7
|
+
name: "New Highlight (Instant)",
|
|
8
|
+
description: "Emit new event when a highlight that matches the filter is added.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "highlights",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"added",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `New highlight added: ${data.id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"type": "highlight_added",
|
|
3
|
+
"user_id": "aea95745-99e9-4609-8623-c9efa2926b82",
|
|
4
|
+
"data": {
|
|
5
|
+
"id": "vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP",
|
|
6
|
+
"recording_id": "b5185ccb-9a08-458c-9be1-db17a03fb14c",
|
|
7
|
+
"text": "testing 123 #test",
|
|
8
|
+
"transcript": "expected, that there was a mews in a lane which runs down by one wall of the garden. I lent the ostlers a hand in rubbing down their horses, and received in exchange twopence, a glass of half-and-half, two fills of shag tobacco, and as much information as I could desire about Miss Adler, to say nothing of half a dozen other people in",
|
|
9
|
+
"speakers": ["Andy Arbol"],
|
|
10
|
+
"timestamp": 3080,
|
|
11
|
+
"duration": 15000,
|
|
12
|
+
"created_datetime": "2021-07-29T23:16:34Z",
|
|
13
|
+
"url": "https://grain.com/highlight/vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP",
|
|
14
|
+
"thumbnail_url": "https://media.grain.com/clips/v1/a14e5af9-d28e-43e9-902b-bc07419082eb/57zB8z52l7BKPoOvkS9KNyUi7LDSsNEh.jpeg",
|
|
15
|
+
"tags": ["test"]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-new-recording-instant",
|
|
7
|
+
name: "New Recording (Instant)",
|
|
8
|
+
description: "Emit new event when a recording that matches the filter is added.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "recordings",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"added",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `New recording added: ${data.id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"type": "recording_added",
|
|
3
|
+
"user_id": "aea95745-99e9-4609-8623-c9efa2926b82",
|
|
4
|
+
"data": {
|
|
5
|
+
"id": "b5185ccb-9a08-458c-9be1-db17a03fb14c",
|
|
6
|
+
"title": "Sample Recording",
|
|
7
|
+
"url": "https://grain.com/recordings/b5185ccb-9a08-458c-9be1-db17a03fb14c/Kz5t1kAyPtt78hcxbSOJHJzFiPpZmUIeDVFXWzP0",
|
|
8
|
+
"start_datetime": "2021-07-29T23:13:17Z",
|
|
9
|
+
"end_datetime": "2021-07-29T23:16:18Z",
|
|
10
|
+
"public_thumbnail_url": null // Only non-null if recording share state is public
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-new-story-instant",
|
|
7
|
+
name: "New Story (Instant)",
|
|
8
|
+
description: "Emit new event when a story that matches the filter is added.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "stories",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"added",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `New story added: ${data.id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"type": "story_added",
|
|
3
|
+
"user_id": "aea95745-99e9-4609-8623-c9efa2926b82",
|
|
4
|
+
"data": {
|
|
5
|
+
"id": "1aff0fe4-6575-4d5f-a462-aaf09f5f17a6",
|
|
6
|
+
"title": "My customer story",
|
|
7
|
+
"description": "A customer journey with ACME Corp",
|
|
8
|
+
"url": "https://grain.com/app/stories/89bd4a02-25f5-42c0-bd40-aa4c94be13ce",
|
|
9
|
+
"public_url": "https://grain.com/share/story/89bd4a02-25f5-42c0-bd40-aa4c94be13ce/2hAEpxLsIN8hDQ48aQ1Yi1MIirv1qCPSJNhxXEoj",
|
|
10
|
+
"banner_image_url": "https://media.grain.com/public/story_thumbnails/07.png",
|
|
11
|
+
"created_datetime": "2021-07-29T23:16:34Z",
|
|
12
|
+
"last_edited_datetime": "2021-08-29T23:16:34Z",
|
|
13
|
+
"tags": ["customer"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-removed-highlight-instant",
|
|
7
|
+
name: "New Highlight Removed (Instant)",
|
|
8
|
+
description: "Emit new event when a highlight is removed.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "highlights",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"removed",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `Highlight removed from recording ${data.recording_id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-removed-recording-instant",
|
|
7
|
+
name: "New Recording Removed (Instant)",
|
|
8
|
+
description: "Emit new event when a recording is removed.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "recordings",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"removed",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `Recording removed: ${data.id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-removed-story-instant",
|
|
7
|
+
name: "New Story Removed (Instant)",
|
|
8
|
+
description: "Emit new event when a story is removed.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "stories",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"removed",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `New story removed: ${data.id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"type": "highlight_updated",
|
|
3
|
+
"user_id": "aea95745-99e9-4609-8623-c9efa2926b82",
|
|
4
|
+
"data": {
|
|
5
|
+
"id": "vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP",
|
|
6
|
+
"recording_id": "b5185ccb-9a08-458c-9be1-db17a03fb14c",
|
|
7
|
+
"text": "testing 123 #test",
|
|
8
|
+
"transcript": "expected, that there was a mews in a lane which runs down by one wall of the garden. I lent the ostlers a hand in rubbing down their horses, and received in exchange twopence, a glass of half-and-half, two fills of shag tobacco, and as much information as I could desire about Miss Adler, to say nothing of half a dozen other people in",
|
|
9
|
+
"speakers": ["Andy Arbol"],
|
|
10
|
+
"timestamp": 3080,
|
|
11
|
+
"duration": 15000,
|
|
12
|
+
"created_datetime": "2021-07-29T23:16:34Z",
|
|
13
|
+
"url": "https://grain.com/highlight/vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP",
|
|
14
|
+
"thumbnail_url": "https://media.grain.com/clips/v1/a14e5af9-d28e-43e9-902b-bc07419082eb/57zB8z52l7BKPoOvkS9KNyUi7LDSsNEh.jpeg",
|
|
15
|
+
"tags": ["test"]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-updated-highlight-instant",
|
|
7
|
+
name: "New Highlight Updated (Instant)",
|
|
8
|
+
description: "Emit new event when a highlight is updated.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "highlights",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"updated",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `New highlight updated: ${data.id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"type": "recording_updated",
|
|
3
|
+
"user_id": "aea95745-99e9-4609-8623-c9efa2926b82",
|
|
4
|
+
"data": {
|
|
5
|
+
"id": "b5185ccb-9a08-458c-9be1-db17a03fb14c",
|
|
6
|
+
"title": "Sample Recording",
|
|
7
|
+
"url": "https://grain.com/recordings/b5185ccb-9a08-458c-9be1-db17a03fb14c/Kz5t1kAyPtt78hcxbSOJHJzFiPpZmUIeDVFXWzP0",
|
|
8
|
+
"start_datetime": "2021-07-29T23:13:17Z",
|
|
9
|
+
"end_datetime": "2021-07-29T23:16:18Z",
|
|
10
|
+
"public_thumbnail_url": null // Only non-null if recording share state is public
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-updated-recording-instant",
|
|
7
|
+
name: "New Recording Updated (Instant)",
|
|
8
|
+
description: "Emit new event when a recording is updated.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "recordings",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"updated",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `New recording updated: ${data.id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"type": "story_updated",
|
|
3
|
+
"user_id": "aea95745-99e9-4609-8623-c9efa2926b82",
|
|
4
|
+
"data": {
|
|
5
|
+
"id": "1aff0fe4-6575-4d5f-a462-aaf09f5f17a6",
|
|
6
|
+
"title": "My customer story",
|
|
7
|
+
"description": "A customer journey with ACME Corp",
|
|
8
|
+
"url": "https://grain.com/app/stories/89bd4a02-25f5-42c0-bd40-aa4c94be13ce",
|
|
9
|
+
"public_url": "https://grain.com/share/story/89bd4a02-25f5-42c0-bd40-aa4c94be13ce/2hAEpxLsIN8hDQ48aQ1Yi1MIirv1qCPSJNhxXEoj",
|
|
10
|
+
"banner_image_url": "https://media.grain.com/public/story_thumbnails/07.png",
|
|
11
|
+
"created_datetime": "2021-07-29T23:16:34Z",
|
|
12
|
+
"last_edited_datetime": "2021-08-29T23:16:34Z",
|
|
13
|
+
"tags": ["customer"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "grain-updated-story-instant",
|
|
7
|
+
name: "New Story Updated (Instant)",
|
|
8
|
+
description: "Emit new event when a story is updated.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
viewId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.grain,
|
|
17
|
+
"viewId",
|
|
18
|
+
() => ({
|
|
19
|
+
type: "stories",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
...common.methods,
|
|
26
|
+
getAction() {
|
|
27
|
+
return [
|
|
28
|
+
"updated",
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
getSummary({ data }) {
|
|
32
|
+
return `New story updated: ${data.id}`;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
sampleEmit,
|
|
36
|
+
};
|