diff --git a/packages/needs-updating/slack/definition.js b/packages/needs-updating/slack/definition.js index d6ba8b6..151683f 100644 --- a/packages/needs-updating/slack/definition.js +++ b/packages/needs-updating/slack/definition.js @@ -40,7 +40,7 @@ const Definition = { api.authed_user.id : api.teamId; return { - identifiers: {externalId, user: userId}, + identifiers: {externalId, userId}, details: {name: api.team_name} } }, diff --git a/packages/v1-ready/42matters/definition.js b/packages/v1-ready/42matters/definition.js index f1e678c..1ce86af 100644 --- a/packages/v1-ready/42matters/definition.js +++ b/packages/v1-ready/42matters/definition.js @@ -15,7 +15,7 @@ const Definition = { }, getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { return { - identifiers: {externalId: md5(api.access_token), user: userId}, + identifiers: {externalId: md5(api.access_token), userId}, details: {}, } }, @@ -25,7 +25,7 @@ const Definition = { }, getCredentialDetails: async function (api, userId) { return { - identifiers: {externalId: md5(api.access_token), user: userId}, + identifiers: {externalId: md5(api.access_token), userId}, details: {} }; }, diff --git a/packages/v1-ready/asana/definition.js b/packages/v1-ready/asana/definition.js index b094b53..d23c4bd 100644 --- a/packages/v1-ready/asana/definition.js +++ b/packages/v1-ready/asana/definition.js @@ -18,7 +18,7 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const userDetails = await api.getUserDetails(); return { - identifiers: {externalId: userDetails.sub, user: userId}, + identifiers: {externalId: userDetails.sub, userId}, details: {name: userDetails.name, email: userDetails.email}, } }, @@ -31,7 +31,7 @@ const Definition = { getCredentialDetails: async function (api, userId) { const userDetails = await api.getUserDetails(); return { - identifiers: {externalId: userDetails.portalId, user: userId}, + identifiers: {externalId: userDetails.sub, userId}, details: {} }; }, diff --git a/packages/v1-ready/attio/definition.js b/packages/v1-ready/attio/definition.js index fbd90c9..eeb8c2a 100644 --- a/packages/v1-ready/attio/definition.js +++ b/packages/v1-ready/attio/definition.js @@ -24,7 +24,7 @@ const Definition = { } return { - identifiers: {externalId: tokenInfo.workspace_id, user: userId}, + identifiers: {externalId: tokenInfo.workspace_id, userId}, details: {name: tokenInfo.workspace_name || tokenInfo.workspace_slug}, } }, @@ -45,7 +45,7 @@ const Definition = { } return { - identifiers: {externalId: tokenInfo.workspace_id, user: userId}, + identifiers: {externalId: tokenInfo.workspace_id, userId}, details: {} }; }, diff --git a/packages/v1-ready/connectwise/definition.js b/packages/v1-ready/connectwise/definition.js index 346555b..1c6011b 100644 --- a/packages/v1-ready/connectwise/definition.js +++ b/packages/v1-ready/connectwise/definition.js @@ -27,7 +27,7 @@ const Definition = { }, getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { return { - identifiers: {externalId: api.company_id, user: userId}, + identifiers: {externalId: api.company_id, userId}, details: {}, } }, @@ -37,7 +37,7 @@ const Definition = { }, getCredentialDetails: async function (api, userId) { return { - identifiers: {externalId: api.company_id, user: userId}, + identifiers: {externalId: api.company_id, userId}, details: {} }; }, diff --git a/packages/v1-ready/contentful/definition.js b/packages/v1-ready/contentful/definition.js index 4c1a3f4..3d9e050 100644 --- a/packages/v1-ready/contentful/definition.js +++ b/packages/v1-ready/contentful/definition.js @@ -22,7 +22,7 @@ const Definition = { name: space.name })); return { - identifiers: {externalId: entityDetails.identifier, user: userId}, + identifiers: {externalId: entityDetails.identifier, userId}, details: { name: entityDetails.name, spaces, @@ -39,7 +39,7 @@ const Definition = { getCredentialDetails: async function (api, userId) { const userDetails = await api.getTokenIdentity(); return { - identifiers: {externalId: userDetails.identifier, user: userId}, + identifiers: {externalId: userDetails.identifier, userId}, details: {} }; }, diff --git a/packages/v1-ready/contentstack/definition.js b/packages/v1-ready/contentstack/definition.js index 6b25a1a..07bda04 100644 --- a/packages/v1-ready/contentstack/definition.js +++ b/packages/v1-ready/contentstack/definition.js @@ -29,13 +29,13 @@ const Definition = { const externalId = api.api_key; const name = roles[0].stack.name; return { - identifiers: {externalId, user: userId}, + identifiers: {externalId, userId}, details: {name} } }, getCredentialDetails: async function (api, userId) { return { - identifiers: {externalId: api.api_key, user: userId}, + identifiers: {externalId: api.api_key, userId}, details: {} }; }, diff --git a/packages/v1-ready/crossbeam/definition.js b/packages/v1-ready/crossbeam/definition.js index 5c0b046..1435075 100644 --- a/packages/v1-ready/crossbeam/definition.js +++ b/packages/v1-ready/crossbeam/definition.js @@ -23,7 +23,7 @@ const Definition = { ) { const userDetails = await api.getUserDetails(); return { - identifiers: { externalId: userDetails.portalId, user: userId }, + identifiers: { externalId: userDetails.portalId, userId }, details: { name: userDetails.hub_domain }, }; }, @@ -34,7 +34,7 @@ const Definition = { getCredentialDetails: async function (api, userId) { const userDetails = await api.getUserDetails(); return { - identifiers: { externalId: userDetails.portalId, user: userId }, + identifiers: { externalId: userDetails.portalId, userId }, details: {}, }; }, diff --git a/packages/v1-ready/deel/definition.js b/packages/v1-ready/deel/definition.js index e5c56da..cbddb61 100644 --- a/packages/v1-ready/deel/definition.js +++ b/packages/v1-ready/deel/definition.js @@ -18,7 +18,7 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const tokenDetails = await api.getTokenIdentity(); return { - identifiers: {externalId: tokenDetails.id, user: userId}, + identifiers: {externalId: tokenDetails.id, userId}, details: {name: tokenDetails.name}, } }, diff --git a/packages/v1-ready/frigg-scale-test/src/defintion.ts b/packages/v1-ready/frigg-scale-test/src/defintion.ts index ddf032b..8efd7f0 100644 --- a/packages/v1-ready/frigg-scale-test/src/defintion.ts +++ b/packages/v1-ready/frigg-scale-test/src/defintion.ts @@ -64,7 +64,7 @@ const definition: FriggModuleAuthDefinition = { return { identifiers: { externalId: "scale-test-account", - user: userId, + userId, }, details: { name: "Scale Test Account", @@ -80,7 +80,7 @@ const definition: FriggModuleAuthDefinition = { return { identifiers: { externalId: "scale-test-account", - user: userId, + userId, }, details: {}, }; diff --git a/packages/v1-ready/frontify/definition.js b/packages/v1-ready/frontify/definition.js index a74c407..9749e71 100644 --- a/packages/v1-ready/frontify/definition.js +++ b/packages/v1-ready/frontify/definition.js @@ -46,7 +46,7 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const {user: userDetails} = await api.getUser(); return { - identifiers: {externalId: userDetails.id, user: userId}, + identifiers: {externalId: userDetails.id, userId}, details: {name: userDetails.name }, } }, @@ -59,7 +59,7 @@ const Definition = { getCredentialDetails: async function (api, userId) { const {user: userDetails} = await api.getUser(); return { - identifiers: {externalId: userDetails.id, user: userId}, + identifiers: {externalId: userDetails.id, userId}, details: {} }; }, diff --git a/packages/v1-ready/google-calendar/definition.js b/packages/v1-ready/google-calendar/definition.js index 3451a6c..1f8fb81 100644 --- a/packages/v1-ready/google-calendar/definition.js +++ b/packages/v1-ready/google-calendar/definition.js @@ -17,7 +17,7 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const entityDetails = await api.getTokenIdentity(); return { - identifiers: {externalId: entityDetails.identifier, user: userId}, + identifiers: {externalId: entityDetails.identifier, userId}, details: {name: entityDetails.name}, } }, diff --git a/packages/v1-ready/helpscout/definition.js b/packages/v1-ready/helpscout/definition.js index 50f7dd1..3c38643 100644 --- a/packages/v1-ready/helpscout/definition.js +++ b/packages/v1-ready/helpscout/definition.js @@ -21,7 +21,7 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const entityDetails = await api.getTokenIdentity(); return { - identifiers: {externalId: entityDetails.identifier, user: userId}, + identifiers: {externalId: entityDetails.identifier, userId}, details: {name: entityDetails.name}, } }, diff --git a/packages/v1-ready/hubspot/definition.js b/packages/v1-ready/hubspot/definition.js index ebaa6e7..80a1ffd 100644 --- a/packages/v1-ready/hubspot/definition.js +++ b/packages/v1-ready/hubspot/definition.js @@ -18,7 +18,7 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const userDetails = await api.getUserDetails(); return { - identifiers: {externalId: userDetails.portalId, user: userId}, + identifiers: {externalId: userDetails.portalId, userId}, details: {name: userDetails.hub_domain}, } }, @@ -31,7 +31,7 @@ const Definition = { getCredentialDetails: async function (api, userId) { const userDetails = await api.getUserDetails(); return { - identifiers: {externalId: userDetails.portalId, user: userId}, + identifiers: {externalId: userDetails.portalId, userId}, details: {} }; }, diff --git a/packages/v1-ready/ironclad/definition.js b/packages/v1-ready/ironclad/definition.js index f57c2f6..de7e3aa 100644 --- a/packages/v1-ready/ironclad/definition.js +++ b/packages/v1-ready/ironclad/definition.js @@ -24,7 +24,7 @@ const Definition = { } const user = await api.getUserDetails(); return { - identifiers: { externalId: user.id, user: userId }, + identifiers: { externalId: user.id, userId }, details: { name: user.displayName, email: user.email }, }; }, @@ -42,7 +42,7 @@ const Definition = { } const userDetails = await api.getUserDetails(); return { - identifiers: { externalId: userDetails.portalId, user: userId }, + identifiers: { externalId: userDetails.portalId, userId }, details: {}, }; }, diff --git a/packages/v1-ready/linear/definition.js b/packages/v1-ready/linear/definition.js index 21e2c37..8929e9e 100644 --- a/packages/v1-ready/linear/definition.js +++ b/packages/v1-ready/linear/definition.js @@ -21,7 +21,7 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const entityDetails = await api.getTokenIdentity(); return { - identifiers: {externalId: entityDetails.identifier, user: userId}, + identifiers: {externalId: entityDetails.identifier, userId}, details: {name: entityDetails.name}, } }, diff --git a/packages/v1-ready/pipedrive/frigg-core.d.ts b/packages/v1-ready/pipedrive/frigg-core.d.ts index be0d7f0..013c9f9 100644 --- a/packages/v1-ready/pipedrive/frigg-core.d.ts +++ b/packages/v1-ready/pipedrive/frigg-core.d.ts @@ -12,14 +12,14 @@ declare module '@friggframework/core' { tokenResponse: any, userId: string ) => Promise<{ - identifiers: { externalId: string; user: string }; + identifiers: { externalId: string; userId: string }; details: Record; }>; getCredentialDetails?: ( api: any, userId: string ) => Promise<{ - identifiers: { externalId: string; user: string }; + identifiers: { externalId: string; userId: string }; details: Record; }>; apiPropertiesToPersist?: { diff --git a/packages/v1-ready/pipedrive/src/definition.ts b/packages/v1-ready/pipedrive/src/definition.ts index 3d10a98..fd9eb1a 100644 --- a/packages/v1-ready/pipedrive/src/definition.ts +++ b/packages/v1-ready/pipedrive/src/definition.ts @@ -36,7 +36,7 @@ const Definition: FriggModuleAuthDefinition = { return { identifiers: { externalId: String(userProfile.data.company_id), - user: userId, + userId, }, details: { name: userProfile.data.company_name || "Unknown Company", @@ -68,7 +68,7 @@ const Definition: FriggModuleAuthDefinition = { return { identifiers: { externalId: String(userProfile.data.id), - user: userId, + userId, }, details: {}, }; diff --git a/packages/v1-ready/salesforce/definition.js b/packages/v1-ready/salesforce/definition.js index 1c936b3..a548129 100644 --- a/packages/v1-ready/salesforce/definition.js +++ b/packages/v1-ready/salesforce/definition.js @@ -36,7 +36,7 @@ const Definition = { const orgDetails = orgResponse[0]; const { Username: connectedUsername } = await api.getUserInfo(); return { - identifiers: { externalId: orgDetails.Id, user: userId }, + identifiers: { externalId: orgDetails.Id, userId }, details: { name: orgDetails.Name, connectedUsername }, }; }, @@ -48,7 +48,7 @@ const Definition = { }, getCredentialDetails: async function (api, userId) { return { - identifiers: { instanceUrl: api.instanceUrl, user: userId }, + identifiers: { instanceUrl: api.instanceUrl, userId }, details: {} }; }, diff --git a/packages/v1-ready/salesforce/manager.js b/packages/v1-ready/salesforce/manager.js index 4c2cf57..b07ef3c 100644 --- a/packages/v1-ready/salesforce/manager.js +++ b/packages/v1-ready/salesforce/manager.js @@ -113,7 +113,7 @@ class Manager extends ModuleManager { const createObj = { credential: this.credential.id, - user: this.userId, + userId: this.userId, name, externalId, isSandbox, @@ -121,7 +121,7 @@ class Manager extends ModuleManager { }; this.entity = await Entity.findOneAndUpdate( { - user: this.userId, + userId: this.userId, externalId, isSandbox, }, @@ -170,7 +170,7 @@ class Manager extends ModuleManager { }; this.credential = await Credential.findOneAndUpdate( { - user: this.userId, + userId: this.userId, instanceUrl: this.api.instanceUrl, }, updatedToken, diff --git a/packages/v1-ready/stripe/definition.js b/packages/v1-ready/stripe/definition.js index fcf335b..69b7cc0 100644 --- a/packages/v1-ready/stripe/definition.js +++ b/packages/v1-ready/stripe/definition.js @@ -20,7 +20,7 @@ const Definition = { const accountDetails = await api.getAccountDetails(); if (userId.userId) userId = userId.userId; return { - identifiers: { externalId: accountDetails.id, user: userId }, + identifiers: { externalId: accountDetails.id, userId }, details: { name: accountDetails.business_profile?.name, email: accountDetails.email, @@ -37,7 +37,7 @@ const Definition = { const accountDetails = await api.getAccountDetails(); if (userId.userId) userId = userId.userId; return { - identifiers: { externalId: accountDetails.id, user: userId }, + identifiers: { externalId: accountDetails.id, userId }, details: {}, }; }, diff --git a/packages/v1-ready/unbabel-projects/definition.js b/packages/v1-ready/unbabel-projects/definition.js index 8f2a791..9b97dbd 100644 --- a/packages/v1-ready/unbabel-projects/definition.js +++ b/packages/v1-ready/unbabel-projects/definition.js @@ -38,13 +38,13 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const externalId = api.customer_id; return { - identifiers: {externalId, user: userId}, + identifiers: {externalId, userId}, details: {name: api.username} } }, getCredentialDetails: async function (api, userId) { return { - identifiers: {externalId: api.customer_id, user: userId}, + identifiers: {externalId: api.customer_id, userId}, details: {} }; }, diff --git a/packages/v1-ready/unbabel-projects/manager.js b/packages/v1-ready/unbabel-projects/manager.js index e97cd2a..7741b82 100644 --- a/packages/v1-ready/unbabel-projects/manager.js +++ b/packages/v1-ready/unbabel-projects/manager.js @@ -78,7 +78,7 @@ class Manager extends ModuleManager { const name = get(params, 'name'); const search = await Entity.find({ - user: this.userId, + userId: this.userId, externalId: identifier, }); if (search.length === 0) { @@ -86,7 +86,7 @@ class Manager extends ModuleManager { // create entity const createObj = { credential: this.credential.id, - user: this.userId, + userId: this.userId, name, externalId: identifier, }; @@ -114,7 +114,7 @@ class Manager extends ModuleManager { async updateOrCreateCredential() { const userDetails = await this.api.getTokenIdentity(); const updatedToken = { - user: this.userId.toString(), + userId: this.userId.toString(), auth_is_valid: true, }; if (this.access_token) { @@ -133,7 +133,7 @@ class Manager extends ModuleManager { if (credentialSearch.length > 1) { debug(`Multiple credentials found with same identifier: ${userDetails.identifier}`); this.throwException(`Multiple credentials found with same identifier: ${userDetails.identifier}`); - } else if (credentialSearch === 1 && credentialSearch[0].user !== this.userId) { + } else if (credentialSearch === 1 && credentialSearch[0].userId !== this.userId) { debug(`A credential already exists with this identifier: ${userDetails.identifier}`); this.throwException(`A credential already exists with this identifier: ${userDetails.identifier}`); } else if (credentialSearch === 1) { diff --git a/packages/v1-ready/unbabel/definition.js b/packages/v1-ready/unbabel/definition.js index e5538e9..903def9 100644 --- a/packages/v1-ready/unbabel/definition.js +++ b/packages/v1-ready/unbabel/definition.js @@ -38,13 +38,13 @@ const Definition = { getEntityDetails: async function (api, callbackParams, tokenResponse, userId) { const externalId = api.customer_id; return { - identifiers: {externalId, user: userId}, + identifiers: {externalId, userId}, details: {name: api.username} } }, getCredentialDetails: async function (api, userId) { return { - identifiers: {externalId: api.customer_id, user: userId}, + identifiers: {externalId: api.customer_id, userId}, details: {} }; }, diff --git a/packages/v1-ready/zoho-crm/src/definition.ts b/packages/v1-ready/zoho-crm/src/definition.ts index 0bdcd03..25d1c11 100644 --- a/packages/v1-ready/zoho-crm/src/definition.ts +++ b/packages/v1-ready/zoho-crm/src/definition.ts @@ -34,7 +34,7 @@ export const Definition = { const response = await api.listUsers({type: 'CurrentUser'}); const currentUser = response.users[0]; return { - identifiers: {externalId: currentUser.id, user: userId}, + identifiers: {externalId: currentUser.id, userId}, details: {}, }; }, @@ -42,7 +42,7 @@ export const Definition = { const response = await api.listUsers({type: 'CurrentUser'}); const currentUser = response.users[0]; return { - identifiers: {externalId: currentUser.id, user: userId}, + identifiers: {externalId: currentUser.id, userId}, details: { name: currentUser.email, location: api.location, diff --git a/packages/v1-ready/zoom/definition.js b/packages/v1-ready/zoom/definition.js index d73e259..a04e592 100644 --- a/packages/v1-ready/zoom/definition.js +++ b/packages/v1-ready/zoom/definition.js @@ -23,7 +23,7 @@ const Definition = { ) { const userDetails = await api.getUserDetails(); return { - identifiers: { externalId: userDetails.id, user: userId }, + identifiers: { externalId: userDetails.id, userId }, details: { name: userDetails.display_name }, }; }, @@ -34,7 +34,7 @@ const Definition = { getCredentialDetails: async function (api, userId) { const userDetails = await api.getUserDetails(); return { - identifiers: { externalId: userDetails.id, user: userId }, + identifiers: { externalId: userDetails.id, userId }, details: {}, }; },