diff --git a/components/amazon_selling_partner/amazon_selling_partner.app.mjs b/components/amazon_selling_partner/amazon_selling_partner.app.mjs index 6330c384a834d..d0cea946e286b 100644 --- a/components/amazon_selling_partner/amazon_selling_partner.app.mjs +++ b/components/amazon_selling_partner/amazon_selling_partner.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/bigdatacorp/bigdatacorp.app.mjs b/components/bigdatacorp/bigdatacorp.app.mjs index 7218a30476517..16b8bf9fbcc5f 100644 --- a/components/bigdatacorp/bigdatacorp.app.mjs +++ b/components/bigdatacorp/bigdatacorp.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/checkout_com/checkout_com.app.mjs b/components/checkout_com/checkout_com.app.mjs index ddf9c2b41b5f8..8816d80d56296 100644 --- a/components/checkout_com/checkout_com.app.mjs +++ b/components/checkout_com/checkout_com.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/grain/actions/get-recording/get-recording.mjs b/components/grain/actions/get-recording/get-recording.mjs new file mode 100644 index 0000000000000..7d3dc27775aff --- /dev/null +++ b/components/grain/actions/get-recording/get-recording.mjs @@ -0,0 +1,57 @@ +import { + INTELLIGENCE_NOTES_FORMAT_OPTIONS, + TRANSCRIPT_FORMAT_OPTIONS, +} from "../../common/constants.mjs"; +import { parseObject } from "../../common/utils.mjs"; +import grain from "../../grain.app.mjs"; + +export default { + key: "grain-get-recording", + name: "Get Recording", + 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)", + version: "0.0.1", + type: "action", + props: { + grain, + recordId: { + propDefinition: [ + grain, + "recordId", + ], + }, + transcriptFormat: { + type: "string", + label: "Transcript Format", + description: "Format for the transcript", + options: TRANSCRIPT_FORMAT_OPTIONS, + optional: true, + }, + intelligenceNotesFormat: { + type: "string", + label: "Intelligence Notes Format", + description: "Format for the intelligence notes", + options: INTELLIGENCE_NOTES_FORMAT_OPTIONS, + optional: true, + }, + allowedIntelligenceNotes: { + type: "string[]", + label: "Allowed Intelligence Notes", + description: "Whitelist of intelligence notes section titles", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.grain.fetchRecording({ + $, + recordId: this.recordId, + params: { + transcript_format: this.transcriptFormat, + intelligence_notes_format: this.intelligenceNotesFormat, + allowed_intelligence_notes: parseObject(this.allowedIntelligenceNotes), + }, + }); + + $.export("$summary", `Successfully fetched recording with ID ${this.recordId}`); + return response; + }, +}; diff --git a/components/grain/common/constants.mjs b/components/grain/common/constants.mjs new file mode 100644 index 0000000000000..d7deeadb1afb4 --- /dev/null +++ b/components/grain/common/constants.mjs @@ -0,0 +1,25 @@ +export const TRANSCRIPT_FORMAT_OPTIONS = [ + { + label: "JSON", + value: "json", + }, + { + label: "VTT", + value: "vtt", + }, +]; + +export const INTELLIGENCE_NOTES_FORMAT_OPTIONS = [ + { + label: "JSON", + value: "json", + }, + { + label: "Markdown", + value: "md", + }, + { + label: "Text", + value: "text", + }, +]; diff --git a/components/grain/common/utils.mjs b/components/grain/common/utils.mjs new file mode 100644 index 0000000000000..dcc9cc61f6f41 --- /dev/null +++ b/components/grain/common/utils.mjs @@ -0,0 +1,24 @@ +export const parseObject = (obj) => { + if (!obj) return undefined; + + if (Array.isArray(obj)) { + return obj.map((item) => { + if (typeof item === "string") { + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } + return item; + }); + } + if (typeof obj === "string") { + try { + return JSON.parse(obj); + } catch (e) { + return obj; + } + } + return obj; +}; diff --git a/components/grain/grain.app.mjs b/components/grain/grain.app.mjs index 88edaa6e3e8ee..3f2e01a992f9e 100644 --- a/components/grain/grain.app.mjs +++ b/components/grain/grain.app.mjs @@ -1,11 +1,113 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "grain", - propDefinitions: {}, + propDefinitions: { + recordId: { + type: "string", + label: "Record ID", + description: "The ID of the recording to fetch", + async options({ prevContext: { nextPage } }) { + const { + recordings, cursor, + } = await this.listRecordings({ + params: { + cursor: nextPage, + }, + }); + return { + options: recordings.map(({ + id: value, title: label, + }) => ({ + value, + label, + })), + context: { + nextPage: cursor, + }, + }; + }, + }, + viewId: { + type: "string", + label: "View ID", + description: "The ID of the view to fetch", + async options({ + type, prevContext: { nextPage }, + }) { + const { + views, cursor, + } = await this.listViews({ + params: { + type_filter: type, + cursor: nextPage, + }, + }); + return { + options: views.map(({ + id: value, name: label, + }) => ({ + value, + label, + })), + context: { + nextPage: cursor, + }, + }; + }, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://grain.com/_/public-api"; + }, + _headers() { + return { + Authorization: `Bearer ${this.$auth.oauth_access_token}`, + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: this._baseUrl() + path, + headers: this._headers(), + ...opts, + }); + }, + listRecordings(opts = {}) { + return this._makeRequest({ + path: "/recordings", + ...opts, + }); + }, + listViews(opts = {}) { + return this._makeRequest({ + path: "/views", + ...opts, + }); + }, + fetchRecording({ + recordId, ...opts + }) { + return this._makeRequest({ + path: `/recordings/${recordId}`, + ...opts, + }); + }, + createWebhook(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/hooks", + ...opts, + }); + }, + deleteWebhook(hookId) { + return this._makeRequest({ + method: "DELETE", + path: `/hooks/${hookId}`, + }); }, }, }; diff --git a/components/grain/package.json b/components/grain/package.json index 936f84d19544e..830218d3126c8 100644 --- a/components/grain/package.json +++ b/components/grain/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/grain", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Grain Components", "main": "grain.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } -} \ No newline at end of file +} diff --git a/components/grain/sources/common/base.mjs b/components/grain/sources/common/base.mjs new file mode 100644 index 0000000000000..ae3f5a16dc562 --- /dev/null +++ b/components/grain/sources/common/base.mjs @@ -0,0 +1,44 @@ +import grain from "../../grain.app.mjs"; + +export default { + props: { + grain, + http: "$.interface.http", + db: "$.service.db", + }, + methods: { + _getHookId() { + return this.db.get("hookId"); + }, + _setHookId(hookId) { + this.db.set("hookId", hookId); + }, + }, + hooks: { + async activate() { + const response = await this.grain.createWebhook({ + data: { + version: 2, + hook_url: this.http.endpoint, + view_id: this.viewId, + actions: this.getAction(), + }, + }); + this._setHookId(response.id); + }, + async deactivate() { + const webhookId = this._getHookId(); + await this.grain.deleteWebhook(webhookId); + }, + }, + async run({ body }) { + if (!body.data) return; + + const ts = Date.parse(new Date()); + this.$emit(body, { + id: `${body.data.id}-${ts}`, + summary: this.getSummary(body), + ts, + }); + }, +}; diff --git a/components/grain/sources/new-highlight-instant/new-highlight-instant.mjs b/components/grain/sources/new-highlight-instant/new-highlight-instant.mjs new file mode 100644 index 0000000000000..9f6eb8ca6d585 --- /dev/null +++ b/components/grain/sources/new-highlight-instant/new-highlight-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-new-highlight-instant", + name: "New Highlight (Instant)", + description: "Emit new event when a highlight that matches the filter is added.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "highlights", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "added", + ]; + }, + getSummary({ data }) { + return `New highlight added: ${data.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/grain/sources/new-highlight-instant/test-event.mjs b/components/grain/sources/new-highlight-instant/test-event.mjs new file mode 100644 index 0000000000000..2fec46429c6b9 --- /dev/null +++ b/components/grain/sources/new-highlight-instant/test-event.mjs @@ -0,0 +1,17 @@ +export default { + "type": "highlight_added", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP", + "recording_id": "b5185ccb-9a08-458c-9be1-db17a03fb14c", + "text": "testing 123 #test", + "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", + "speakers": ["Andy Arbol"], + "timestamp": 3080, + "duration": 15000, + "created_datetime": "2021-07-29T23:16:34Z", + "url": "https://grain.com/highlight/vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP", + "thumbnail_url": "https://media.grain.com/clips/v1/a14e5af9-d28e-43e9-902b-bc07419082eb/57zB8z52l7BKPoOvkS9KNyUi7LDSsNEh.jpeg", + "tags": ["test"] + } +} \ No newline at end of file diff --git a/components/grain/sources/new-recording-instant/new-recording-instant.mjs b/components/grain/sources/new-recording-instant/new-recording-instant.mjs new file mode 100644 index 0000000000000..9584835dceaeb --- /dev/null +++ b/components/grain/sources/new-recording-instant/new-recording-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-new-recording-instant", + name: "New Recording (Instant)", + description: "Emit new event when a recording that matches the filter is added.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "recordings", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "added", + ]; + }, + getSummary({ data }) { + return `New recording added: ${data.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/grain/sources/new-recording-instant/test-event.mjs b/components/grain/sources/new-recording-instant/test-event.mjs new file mode 100644 index 0000000000000..bfac368e987bb --- /dev/null +++ b/components/grain/sources/new-recording-instant/test-event.mjs @@ -0,0 +1,12 @@ +export default { + "type": "recording_added", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "b5185ccb-9a08-458c-9be1-db17a03fb14c", + "title": "Sample Recording", + "url": "https://grain.com/recordings/b5185ccb-9a08-458c-9be1-db17a03fb14c/Kz5t1kAyPtt78hcxbSOJHJzFiPpZmUIeDVFXWzP0", + "start_datetime": "2021-07-29T23:13:17Z", + "end_datetime": "2021-07-29T23:16:18Z", + "public_thumbnail_url": null // Only non-null if recording share state is public + } +} \ No newline at end of file diff --git a/components/grain/sources/new-story-instant/new-story-instant.mjs b/components/grain/sources/new-story-instant/new-story-instant.mjs new file mode 100644 index 0000000000000..68fe04f1b1bba --- /dev/null +++ b/components/grain/sources/new-story-instant/new-story-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-new-story-instant", + name: "New Story (Instant)", + description: "Emit new event when a story that matches the filter is added.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "stories", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "added", + ]; + }, + getSummary({ data }) { + return `New story added: ${data.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/grain/sources/new-story-instant/test-event.mjs b/components/grain/sources/new-story-instant/test-event.mjs new file mode 100644 index 0000000000000..e163749cbc950 --- /dev/null +++ b/components/grain/sources/new-story-instant/test-event.mjs @@ -0,0 +1,15 @@ +export default { + "type": "story_added", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "1aff0fe4-6575-4d5f-a462-aaf09f5f17a6", + "title": "My customer story", + "description": "A customer journey with ACME Corp", + "url": "https://grain.com/app/stories/89bd4a02-25f5-42c0-bd40-aa4c94be13ce", + "public_url": "https://grain.com/share/story/89bd4a02-25f5-42c0-bd40-aa4c94be13ce/2hAEpxLsIN8hDQ48aQ1Yi1MIirv1qCPSJNhxXEoj", + "banner_image_url": "https://media.grain.com/public/story_thumbnails/07.png", + "created_datetime": "2021-07-29T23:16:34Z", + "last_edited_datetime": "2021-08-29T23:16:34Z", + "tags": ["customer"] + } +} \ No newline at end of file diff --git a/components/grain/sources/removed-highlight-instant/removed-highlight-instant.mjs b/components/grain/sources/removed-highlight-instant/removed-highlight-instant.mjs new file mode 100644 index 0000000000000..e284d0f258548 --- /dev/null +++ b/components/grain/sources/removed-highlight-instant/removed-highlight-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-removed-highlight-instant", + name: "New Highlight Removed (Instant)", + description: "Emit new event when a highlight is removed.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "highlights", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "removed", + ]; + }, + getSummary({ data }) { + return `Highlight removed from recording ${data.recording_id}`; + }, + }, + sampleEmit, +}; diff --git a/components/grain/sources/removed-highlight-instant/test-event.mjs b/components/grain/sources/removed-highlight-instant/test-event.mjs new file mode 100644 index 0000000000000..20fe6132f063a --- /dev/null +++ b/components/grain/sources/removed-highlight-instant/test-event.mjs @@ -0,0 +1,8 @@ +export default { + "type": "highlight_removed", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP", + "recording_id": "b5185ccb-9a08-458c-9be1-db17a03fb14c" + } +} \ No newline at end of file diff --git a/components/grain/sources/removed-recording-instant/removed-recording-instant.mjs b/components/grain/sources/removed-recording-instant/removed-recording-instant.mjs new file mode 100644 index 0000000000000..f62a24fab8513 --- /dev/null +++ b/components/grain/sources/removed-recording-instant/removed-recording-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-removed-recording-instant", + name: "New Recording Removed (Instant)", + description: "Emit new event when a recording is removed.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "recordings", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "removed", + ]; + }, + getSummary({ data }) { + return `Recording removed: ${data.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/grain/sources/removed-recording-instant/test-event.mjs b/components/grain/sources/removed-recording-instant/test-event.mjs new file mode 100644 index 0000000000000..e1f711fd981e2 --- /dev/null +++ b/components/grain/sources/removed-recording-instant/test-event.mjs @@ -0,0 +1,7 @@ +export default { + "type": "recording_removed", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "b5185ccb-9a08-458c-9be1-db17a03fb14c" + } +} \ No newline at end of file diff --git a/components/grain/sources/removed-story-instant/removed-story-instant.mjs b/components/grain/sources/removed-story-instant/removed-story-instant.mjs new file mode 100644 index 0000000000000..15f37cbfaa605 --- /dev/null +++ b/components/grain/sources/removed-story-instant/removed-story-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-removed-story-instant", + name: "New Story Removed (Instant)", + description: "Emit new event when a story is removed.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "stories", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "removed", + ]; + }, + getSummary({ data }) { + return `New story removed: ${data.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/grain/sources/removed-story-instant/test-event.mjs b/components/grain/sources/removed-story-instant/test-event.mjs new file mode 100644 index 0000000000000..79c9215c51ba7 --- /dev/null +++ b/components/grain/sources/removed-story-instant/test-event.mjs @@ -0,0 +1,7 @@ +export default { + "type": "story_removed", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "1aff0fe4-6575-4d5f-a462-aaf09f5f17a6" + } +} \ No newline at end of file diff --git a/components/grain/sources/updated-highlight-instant/test-event.mjs b/components/grain/sources/updated-highlight-instant/test-event.mjs new file mode 100644 index 0000000000000..b892cad27d725 --- /dev/null +++ b/components/grain/sources/updated-highlight-instant/test-event.mjs @@ -0,0 +1,17 @@ +export default { + "type": "highlight_updated", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP", + "recording_id": "b5185ccb-9a08-458c-9be1-db17a03fb14c", + "text": "testing 123 #test", + "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", + "speakers": ["Andy Arbol"], + "timestamp": 3080, + "duration": 15000, + "created_datetime": "2021-07-29T23:16:34Z", + "url": "https://grain.com/highlight/vjQRUKsWw0aFpCT3531eGbr8V0HJrMjKMEIcAUmP", + "thumbnail_url": "https://media.grain.com/clips/v1/a14e5af9-d28e-43e9-902b-bc07419082eb/57zB8z52l7BKPoOvkS9KNyUi7LDSsNEh.jpeg", + "tags": ["test"] + } +} \ No newline at end of file diff --git a/components/grain/sources/updated-highlight-instant/updated-highlight-instant.mjs b/components/grain/sources/updated-highlight-instant/updated-highlight-instant.mjs new file mode 100644 index 0000000000000..f5147e298b111 --- /dev/null +++ b/components/grain/sources/updated-highlight-instant/updated-highlight-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-updated-highlight-instant", + name: "New Highlight Updated (Instant)", + description: "Emit new event when a highlight is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "highlights", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "updated", + ]; + }, + getSummary({ data }) { + return `New highlight updated: ${data.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/grain/sources/updated-recording-instant/test-event.mjs b/components/grain/sources/updated-recording-instant/test-event.mjs new file mode 100644 index 0000000000000..5a440d2062bd2 --- /dev/null +++ b/components/grain/sources/updated-recording-instant/test-event.mjs @@ -0,0 +1,12 @@ +export default { + "type": "recording_updated", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "b5185ccb-9a08-458c-9be1-db17a03fb14c", + "title": "Sample Recording", + "url": "https://grain.com/recordings/b5185ccb-9a08-458c-9be1-db17a03fb14c/Kz5t1kAyPtt78hcxbSOJHJzFiPpZmUIeDVFXWzP0", + "start_datetime": "2021-07-29T23:13:17Z", + "end_datetime": "2021-07-29T23:16:18Z", + "public_thumbnail_url": null // Only non-null if recording share state is public + } +} \ No newline at end of file diff --git a/components/grain/sources/updated-recording-instant/updated-recording-instant.mjs b/components/grain/sources/updated-recording-instant/updated-recording-instant.mjs new file mode 100644 index 0000000000000..5615b8e41430b --- /dev/null +++ b/components/grain/sources/updated-recording-instant/updated-recording-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-updated-recording-instant", + name: "New Recording Updated (Instant)", + description: "Emit new event when a recording is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "recordings", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "updated", + ]; + }, + getSummary({ data }) { + return `New recording updated: ${data.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/grain/sources/updated-story-instant/test-event.mjs b/components/grain/sources/updated-story-instant/test-event.mjs new file mode 100644 index 0000000000000..00ce668c0c07c --- /dev/null +++ b/components/grain/sources/updated-story-instant/test-event.mjs @@ -0,0 +1,15 @@ +export default { + "type": "story_updated", + "user_id": "aea95745-99e9-4609-8623-c9efa2926b82", + "data": { + "id": "1aff0fe4-6575-4d5f-a462-aaf09f5f17a6", + "title": "My customer story", + "description": "A customer journey with ACME Corp", + "url": "https://grain.com/app/stories/89bd4a02-25f5-42c0-bd40-aa4c94be13ce", + "public_url": "https://grain.com/share/story/89bd4a02-25f5-42c0-bd40-aa4c94be13ce/2hAEpxLsIN8hDQ48aQ1Yi1MIirv1qCPSJNhxXEoj", + "banner_image_url": "https://media.grain.com/public/story_thumbnails/07.png", + "created_datetime": "2021-07-29T23:16:34Z", + "last_edited_datetime": "2021-08-29T23:16:34Z", + "tags": ["customer"] + } +} \ No newline at end of file diff --git a/components/grain/sources/updated-story-instant/updated-story-instant.mjs b/components/grain/sources/updated-story-instant/updated-story-instant.mjs new file mode 100644 index 0000000000000..20c794c9eeca0 --- /dev/null +++ b/components/grain/sources/updated-story-instant/updated-story-instant.mjs @@ -0,0 +1,36 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "grain-updated-story-instant", + name: "New Story Updated (Instant)", + description: "Emit new event when a story is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + viewId: { + propDefinition: [ + common.props.grain, + "viewId", + () => ({ + type: "stories", + }), + ], + }, + }, + methods: { + ...common.methods, + getAction() { + return [ + "updated", + ]; + }, + getSummary({ data }) { + return `New story updated: ${data.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/mailgenius/mailgenius.app.mjs b/components/mailgenius/mailgenius.app.mjs index 7ec13d4821276..441b1c947f246 100644 --- a/components/mailgenius/mailgenius.app.mjs +++ b/components/mailgenius/mailgenius.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/microsoft_teams_bot/microsoft_teams_bot.app.mjs b/components/microsoft_teams_bot/microsoft_teams_bot.app.mjs index b3e0848d82a7e..960d05d94d580 100644 --- a/components/microsoft_teams_bot/microsoft_teams_bot.app.mjs +++ b/components/microsoft_teams_bot/microsoft_teams_bot.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c7cd972140dcf..3e072e63503e9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4440,7 +4440,11 @@ importers: components/grafbase: {} - components/grain: {} + components/grain: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/graphhopper: {}