From 07de1657f489b808ac3ef3106530cfb5b149735b Mon Sep 17 00:00:00 2001 From: Branden Rodgers Date: Fri, 28 Oct 2022 11:15:17 -0400 Subject: [PATCH] Quick poc for new project config --- hsproject.json | 3 +-- .../README.md | 0 .../example-card.card.js} | 21 ++++++++++++++++++- .../package.json | 0 src/app/app.functions/serverless.json | 10 --------- src/app/example-card.json | 16 -------------- src/app/{app.json => hsapp.json} | 11 +--------- 7 files changed, 22 insertions(+), 39 deletions(-) rename src/app/{app.functions => app.extensions}/README.md (100%) rename src/app/{app.functions/example-card.js => app.extensions/example-card.card.js} (87%) rename src/app/{app.functions => app.extensions}/package.json (100%) delete mode 100644 src/app/app.functions/serverless.json delete mode 100644 src/app/example-card.json rename src/app/{app.json => hsapp.json} (55%) diff --git a/hsproject.json b/hsproject.json index a18c016..80c43c5 100644 --- a/hsproject.json +++ b/hsproject.json @@ -1,4 +1,3 @@ { - "name": "project_name", - "srcDir": "src" + "name": "project_name" } diff --git a/src/app/app.functions/README.md b/src/app/app.extensions/README.md similarity index 100% rename from src/app/app.functions/README.md rename to src/app/app.extensions/README.md diff --git a/src/app/app.functions/example-card.js b/src/app/app.extensions/example-card.card.js similarity index 87% rename from src/app/app.functions/example-card.js rename to src/app/app.extensions/example-card.card.js index a38bbe0..86b6a9d 100644 --- a/src/app/app.functions/example-card.js +++ b/src/app/app.extensions/example-card.card.js @@ -1,7 +1,21 @@ // For external API calls const axios = require("axios"); -exports.main = async (context = {}, sendResponse) => { +const appConfig = { + title: "Example CRM Card", + location: "crm.record.tab", + fetch: { + objectTypes: [ + { + "name": "contacts", + "propertiesToSend": ["firstname"] + } + ] + }, + secrets: [] +}; + +const appFunction = async (context = {}, sendResponse) => { // Store contact firstname, configured as propertiesToSend in crm-card.json const { firstname } = context.propertiesToSend; @@ -80,3 +94,8 @@ exports.main = async (context = {}, sendResponse) => { }); } }; + +exports.main = { + appConfig, + appFunction +} diff --git a/src/app/app.functions/package.json b/src/app/app.extensions/package.json similarity index 100% rename from src/app/app.functions/package.json rename to src/app/app.extensions/package.json diff --git a/src/app/app.functions/serverless.json b/src/app/app.functions/serverless.json deleted file mode 100644 index 3a9a430..0000000 --- a/src/app/app.functions/serverless.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "runtime": "nodejs12.x", - "version": "1.0", - "appFunctions": { - "crm-card": { - "file": "example-card.js", - "secrets": [] - } - } -} diff --git a/src/app/example-card.json b/src/app/example-card.json deleted file mode 100644 index b48f2a2..0000000 --- a/src/app/example-card.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "crm-card", - "data": { - "title": "Example CRM Card", - "location": "crm.record.tab", - "fetch": { - "targetFunction": "crm-card", - "objectTypes": [ - { - "name": "contacts", - "propertiesToSend": ["firstname"] - } - ] - } - } -} diff --git a/src/app/app.json b/src/app/hsapp.json similarity index 55% rename from src/app/app.json rename to src/app/hsapp.json index 59cbfb5..d916fb1 100644 --- a/src/app/app.json +++ b/src/app/hsapp.json @@ -2,14 +2,5 @@ "name": "Example App", "description": "An example private app that contains a single card extension.", "scopes": ["crm.objects.contacts.read", "crm.objects.contacts.write"], - "public": false, - "extensions": { - "crm": { - "cards": [ - { - "file": "./example-card.json" - } - ] - } - } + "public": false }