mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 18:27:19 +00:00
feat: add get apps
This commit is contained in:
+224
-214
@@ -25,6 +25,8 @@ import {
|
|||||||
INTEGRATION_GITHUB,
|
INTEGRATION_GITHUB,
|
||||||
INTEGRATION_GITLAB,
|
INTEGRATION_GITLAB,
|
||||||
INTEGRATION_GITLAB_API_URL,
|
INTEGRATION_GITLAB_API_URL,
|
||||||
|
INTEGRATION_HASURA_CLOUD,
|
||||||
|
INTEGRATION_HASURA_CLOUD_API_URL,
|
||||||
INTEGRATION_HEROKU,
|
INTEGRATION_HEROKU,
|
||||||
INTEGRATION_HEROKU_API_URL,
|
INTEGRATION_HEROKU_API_URL,
|
||||||
INTEGRATION_LARAVELFORGE,
|
INTEGRATION_LARAVELFORGE,
|
||||||
@@ -47,7 +49,7 @@ import {
|
|||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
INTEGRATION_VERCEL_API_URL,
|
INTEGRATION_VERCEL_API_URL,
|
||||||
INTEGRATION_WINDMILL,
|
INTEGRATION_WINDMILL,
|
||||||
INTEGRATION_WINDMILL_API_URL,
|
INTEGRATION_WINDMILL_API_URL
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
import { IIntegrationAuth } from "../models";
|
import { IIntegrationAuth } from "../models";
|
||||||
import { Octokit } from "@octokit/rest";
|
import { Octokit } from "@octokit/rest";
|
||||||
@@ -73,7 +75,7 @@ const getApps = async ({
|
|||||||
accessToken,
|
accessToken,
|
||||||
accessId,
|
accessId,
|
||||||
teamId,
|
teamId,
|
||||||
workspaceSlug,
|
workspaceSlug
|
||||||
}: {
|
}: {
|
||||||
integrationAuth: IIntegrationAuth;
|
integrationAuth: IIntegrationAuth;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
@@ -85,7 +87,7 @@ const getApps = async ({
|
|||||||
switch (integrationAuth.integration) {
|
switch (integrationAuth.integration) {
|
||||||
case INTEGRATION_GCP_SECRET_MANAGER:
|
case INTEGRATION_GCP_SECRET_MANAGER:
|
||||||
apps = await getAppsGCPSecretManager({
|
apps = await getAppsGCPSecretManager({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_AZURE_KEY_VAULT:
|
case INTEGRATION_AZURE_KEY_VAULT:
|
||||||
@@ -99,50 +101,50 @@ const getApps = async ({
|
|||||||
break;
|
break;
|
||||||
case INTEGRATION_HEROKU:
|
case INTEGRATION_HEROKU:
|
||||||
apps = await getAppsHeroku({
|
apps = await getAppsHeroku({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_VERCEL:
|
case INTEGRATION_VERCEL:
|
||||||
apps = await getAppsVercel({
|
apps = await getAppsVercel({
|
||||||
integrationAuth,
|
integrationAuth,
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_NETLIFY:
|
case INTEGRATION_NETLIFY:
|
||||||
apps = await getAppsNetlify({
|
apps = await getAppsNetlify({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_GITHUB:
|
case INTEGRATION_GITHUB:
|
||||||
apps = await getAppsGithub({
|
apps = await getAppsGithub({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_GITLAB:
|
case INTEGRATION_GITLAB:
|
||||||
apps = await getAppsGitlab({
|
apps = await getAppsGitlab({
|
||||||
integrationAuth,
|
integrationAuth,
|
||||||
accessToken,
|
accessToken,
|
||||||
teamId,
|
teamId
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_RENDER:
|
case INTEGRATION_RENDER:
|
||||||
apps = await getAppsRender({
|
apps = await getAppsRender({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_RAILWAY:
|
case INTEGRATION_RAILWAY:
|
||||||
apps = await getAppsRailway({
|
apps = await getAppsRailway({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_FLYIO:
|
case INTEGRATION_FLYIO:
|
||||||
apps = await getAppsFlyio({
|
apps = await getAppsFlyio({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_CIRCLECI:
|
case INTEGRATION_CIRCLECI:
|
||||||
apps = await getAppsCircleCI({
|
apps = await getAppsCircleCI({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_LARAVELFORGE:
|
case INTEGRATION_LARAVELFORGE:
|
||||||
@@ -154,28 +156,28 @@ const getApps = async ({
|
|||||||
case INTEGRATION_TERRAFORM_CLOUD:
|
case INTEGRATION_TERRAFORM_CLOUD:
|
||||||
apps = await getAppsTerraformCloud({
|
apps = await getAppsTerraformCloud({
|
||||||
accessToken,
|
accessToken,
|
||||||
workspacesId: accessId,
|
workspacesId: accessId
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_TRAVISCI:
|
case INTEGRATION_TRAVISCI:
|
||||||
apps = await getAppsTravisCI({
|
apps = await getAppsTravisCI({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_TEAMCITY:
|
case INTEGRATION_TEAMCITY:
|
||||||
apps = await getAppsTeamCity({
|
apps = await getAppsTeamCity({
|
||||||
integrationAuth,
|
integrationAuth,
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_SUPABASE:
|
case INTEGRATION_SUPABASE:
|
||||||
apps = await getAppsSupabase({
|
apps = await getAppsSupabase({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_CHECKLY:
|
case INTEGRATION_CHECKLY:
|
||||||
apps = await getAppsCheckly({
|
apps = await getAppsCheckly({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_CLOUDFLARE_PAGES:
|
case INTEGRATION_CLOUDFLARE_PAGES:
|
||||||
@@ -186,7 +188,7 @@ const getApps = async ({
|
|||||||
break;
|
break;
|
||||||
case INTEGRATION_NORTHFLANK:
|
case INTEGRATION_NORTHFLANK:
|
||||||
apps = await getAppsNorthflank({
|
apps = await getAppsNorthflank({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_BITBUCKET:
|
case INTEGRATION_BITBUCKET:
|
||||||
@@ -197,7 +199,7 @@ const getApps = async ({
|
|||||||
break;
|
break;
|
||||||
case INTEGRATION_CODEFRESH:
|
case INTEGRATION_CODEFRESH:
|
||||||
apps = await getAppsCodefresh({
|
apps = await getAppsCodefresh({
|
||||||
accessToken,
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_WINDMILL:
|
case INTEGRATION_WINDMILL:
|
||||||
@@ -212,7 +214,13 @@ const getApps = async ({
|
|||||||
break;
|
break;
|
||||||
case INTEGRATION_CLOUD_66:
|
case INTEGRATION_CLOUD_66:
|
||||||
apps = await getAppsCloud66({
|
apps = await getAppsCloud66({
|
||||||
accessToken,
|
accessToken
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INTEGRATION_HASURA_CLOUD:
|
||||||
|
apps = await getAppsHasuraCloud({
|
||||||
|
accessToken
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -229,17 +237,20 @@ const getApps = async ({
|
|||||||
* @returns {String} apps.appId - id of GCP project
|
* @returns {String} apps.appId - id of GCP project
|
||||||
*/
|
*/
|
||||||
const getAppsGCPSecretManager = async ({ accessToken }: { accessToken: string }) => {
|
const getAppsGCPSecretManager = async ({ accessToken }: { accessToken: string }) => {
|
||||||
|
|
||||||
interface GCPApp {
|
interface GCPApp {
|
||||||
projectNumber: string;
|
projectNumber: string;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
lifecycleState: "ACTIVE" | "LIFECYCLE_STATE_UNSPECIFIED" | "DELETE_REQUESTED" | "DELETE_IN_PROGRESS";
|
lifecycleState:
|
||||||
|
| "ACTIVE"
|
||||||
|
| "LIFECYCLE_STATE_UNSPECIFIED"
|
||||||
|
| "DELETE_REQUESTED"
|
||||||
|
| "DELETE_IN_PROGRESS";
|
||||||
name: string;
|
name: string;
|
||||||
createTime: string;
|
createTime: string;
|
||||||
parent: {
|
parent: {
|
||||||
type: "organization" | "folder" | "project";
|
type: "organization" | "folder" | "project";
|
||||||
id: string;
|
id: string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GCPGetProjectsRes {
|
interface GCPGetProjectsRes {
|
||||||
@@ -250,7 +261,7 @@ const getAppsGCPSecretManager = async ({ accessToken }: { accessToken: string })
|
|||||||
interface GCPGetServiceRes {
|
interface GCPGetServiceRes {
|
||||||
name: string;
|
name: string;
|
||||||
parent: string;
|
parent: string;
|
||||||
state: "ENABLED" | "DISABLED" | "STATE_UNSPECIFIED"
|
state: "ENABLED" | "DISABLED" | "STATE_UNSPECIFIED";
|
||||||
}
|
}
|
||||||
|
|
||||||
let gcpApps: GCPApp[] = [];
|
let gcpApps: GCPApp[] = [];
|
||||||
@@ -266,15 +277,15 @@ const getAppsGCPSecretManager = async ({ accessToken }: { accessToken: string })
|
|||||||
...(pageToken ? { pageToken } : {})
|
...(pageToken ? { pageToken } : {})
|
||||||
});
|
});
|
||||||
|
|
||||||
const res: GCPGetProjectsRes = (await standardRequest.get(`${INTEGRATION_GCP_API_URL}/v1/projects`, {
|
const res: GCPGetProjectsRes = (
|
||||||
|
await standardRequest.get(`${INTEGRATION_GCP_API_URL}/v1/projects`, {
|
||||||
params,
|
params,
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json"
|
"Accept-Encoding": "application/json"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
).data;
|
||||||
.data;
|
|
||||||
|
|
||||||
gcpApps = gcpApps.concat(res.projects);
|
gcpApps = gcpApps.concat(res.projects);
|
||||||
|
|
||||||
@@ -287,14 +298,17 @@ const getAppsGCPSecretManager = async ({ accessToken }: { accessToken: string })
|
|||||||
|
|
||||||
for await (const gcpApp of gcpApps) {
|
for await (const gcpApp of gcpApps) {
|
||||||
try {
|
try {
|
||||||
const res: GCPGetServiceRes = (await standardRequest.get(
|
const res: GCPGetServiceRes = (
|
||||||
`${INTEGRATION_GCP_SERVICE_USAGE_URL}/v1/projects/${gcpApp.projectId}/services/${INTEGRATION_GCP_SECRET_MANAGER_SERVICE_NAME}`, {
|
await standardRequest.get(
|
||||||
headers: {
|
`${INTEGRATION_GCP_SERVICE_USAGE_URL}/v1/projects/${gcpApp.projectId}/services/${INTEGRATION_GCP_SECRET_MANAGER_SERVICE_NAME}`,
|
||||||
"Authorization": `Bearer ${accessToken}`,
|
{
|
||||||
"Accept-Encoding": "application/json"
|
headers: {
|
||||||
|
Authorization: `Bearer ${accessToken}`,
|
||||||
|
"Accept-Encoding": "application/json"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
)).data;
|
).data;
|
||||||
|
|
||||||
if (res.state === "ENABLED") {
|
if (res.state === "ENABLED") {
|
||||||
apps.push({
|
apps.push({
|
||||||
@@ -322,13 +336,13 @@ const getAppsHeroku = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
await standardRequest.get(`${INTEGRATION_HEROKU_API_URL}/apps`, {
|
await standardRequest.get(`${INTEGRATION_HEROKU_API_URL}/apps`, {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/vnd.heroku+json; version=3",
|
Accept: "application/vnd.heroku+json; version=3",
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
const apps = res.map((a: any) => ({
|
const apps = res.map((a: any) => ({
|
||||||
name: a.name,
|
name: a.name
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
@@ -343,7 +357,7 @@ const getAppsHeroku = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
*/
|
*/
|
||||||
const getAppsVercel = async ({
|
const getAppsVercel = async ({
|
||||||
integrationAuth,
|
integrationAuth,
|
||||||
accessToken,
|
accessToken
|
||||||
}: {
|
}: {
|
||||||
integrationAuth: IIntegrationAuth;
|
integrationAuth: IIntegrationAuth;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
@@ -352,21 +366,21 @@ const getAppsVercel = async ({
|
|||||||
await standardRequest.get(`${INTEGRATION_VERCEL_API_URL}/v9/projects`, {
|
await standardRequest.get(`${INTEGRATION_VERCEL_API_URL}/v9/projects`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
},
|
||||||
...(integrationAuth?.teamId
|
...(integrationAuth?.teamId
|
||||||
? {
|
? {
|
||||||
params: {
|
params: {
|
||||||
teamId: integrationAuth.teamId,
|
teamId: integrationAuth.teamId
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
: {}),
|
: {})
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
const apps = res.projects.map((a: any) => ({
|
const apps = res.projects.map((a: any) => ({
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
@@ -390,24 +404,21 @@ const getAppsNetlify = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
page: String(page),
|
page: String(page),
|
||||||
per_page: String(perPage),
|
per_page: String(perPage),
|
||||||
filter: "all",
|
filter: "all"
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data } = await standardRequest.get(
|
const { data } = await standardRequest.get(`${INTEGRATION_NETLIFY_API_URL}/api/v1/sites`, {
|
||||||
`${INTEGRATION_NETLIFY_API_URL}/api/v1/sites`,
|
params,
|
||||||
{
|
headers: {
|
||||||
params,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
"Accept-Encoding": "application/json"
|
||||||
Authorization: `Bearer ${accessToken}`,
|
|
||||||
"Accept-Encoding": "application/json",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
data.map((a: any) => {
|
data.map((a: any) => {
|
||||||
apps.push({
|
apps.push({
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.site_id,
|
appId: a.site_id
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -441,7 +452,7 @@ const getAppsGithub = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
auth: accessToken,
|
auth: accessToken
|
||||||
});
|
});
|
||||||
|
|
||||||
const getAllRepos = async () => {
|
const getAllRepos = async () => {
|
||||||
@@ -455,7 +466,7 @@ const getAppsGithub = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
"GET /user/repos{?visibility,affiliation,type,sort,direction,per_page,page,since,before}",
|
"GET /user/repos{?visibility,affiliation,type,sort,direction,per_page,page,since,before}",
|
||||||
{
|
{
|
||||||
per_page,
|
per_page,
|
||||||
page,
|
page
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -478,7 +489,7 @@ const getAppsGithub = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
return {
|
return {
|
||||||
appId: a.id,
|
appId: a.id,
|
||||||
name: a.name,
|
name: a.name,
|
||||||
owner: a.owner.login,
|
owner: a.owner.login
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -499,14 +510,14 @@ const getAppsRender = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
const apps = res.map((a: any) => ({
|
const apps = res.map((a: any) => ({
|
||||||
name: a.service.name,
|
name: a.service.name,
|
||||||
appId: a.service.id,
|
appId: a.service.id
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
@@ -540,27 +551,27 @@ const getAppsRailway = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
const {
|
const {
|
||||||
data: {
|
data: {
|
||||||
data: {
|
data: {
|
||||||
projects: { edges },
|
projects: { edges }
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
} = await standardRequest.post(
|
} = await standardRequest.post(
|
||||||
INTEGRATION_RAILWAY_API_URL,
|
INTEGRATION_RAILWAY_API_URL,
|
||||||
{
|
{
|
||||||
query,
|
query,
|
||||||
variables,
|
variables
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const apps = edges.map((e: any) => ({
|
const apps = edges.map((e: any) => ({
|
||||||
name: e.node.name,
|
name: e.node.name,
|
||||||
appId: e.node.id,
|
appId: e.node.id
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
@@ -583,18 +594,21 @@ const getAppsLaravelForge = async ({
|
|||||||
serverId?: string;
|
serverId?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const res = (
|
const res = (
|
||||||
await standardRequest.get(`${INTEGRATION_LARAVELFORGE_API_URL}/api/v1/servers/${serverId}/sites`, {
|
await standardRequest.get(
|
||||||
headers: {
|
`${INTEGRATION_LARAVELFORGE_API_URL}/api/v1/servers/${serverId}/sites`,
|
||||||
Authorization: `Bearer ${accessToken}`,
|
{
|
||||||
Accept: "application/json",
|
headers: {
|
||||||
"Content-Type": "application/json",
|
Authorization: `Bearer ${accessToken}`,
|
||||||
},
|
Accept: "application/json",
|
||||||
})
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
).data.sites;
|
).data.sites;
|
||||||
|
|
||||||
const apps = res.map((a: any) => ({
|
const apps = res.map((a: any) => ({
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
@@ -632,15 +646,15 @@ const getAppsFlyio = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
{
|
{
|
||||||
query,
|
query,
|
||||||
variables: {
|
variables: {
|
||||||
role: null,
|
role: null
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer " + accessToken,
|
Authorization: "Bearer " + accessToken,
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
).data.data.apps.nodes;
|
).data.data.apps.nodes;
|
||||||
@@ -665,14 +679,14 @@ const getAppsCircleCI = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
await standardRequest.get(`${INTEGRATION_CIRCLECI_API_URL}/v1.1/projects`, {
|
await standardRequest.get(`${INTEGRATION_CIRCLECI_API_URL}/v1.1/projects`, {
|
||||||
headers: {
|
headers: {
|
||||||
"Circle-Token": accessToken,
|
"Circle-Token": accessToken,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
const apps = res?.map((a: any) => {
|
const apps = res?.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
name: a?.reponame,
|
name: a?.reponame
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -684,15 +698,15 @@ const getAppsTravisCI = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
await standardRequest.get(`${INTEGRATION_TRAVISCI_API_URL}/repos`, {
|
await standardRequest.get(`${INTEGRATION_TRAVISCI_API_URL}/repos`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `token ${accessToken}`,
|
Authorization: `token ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
const apps = res?.map((a: any) => {
|
const apps = res?.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
name: a?.slug?.split("/")[1],
|
name: a?.slug?.split("/")[1],
|
||||||
appId: a?.id,
|
appId: a?.id
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -715,27 +729,29 @@ const getAppsTerraformCloud = async ({
|
|||||||
workspacesId?: string;
|
workspacesId?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const res = (
|
const res = (
|
||||||
await standardRequest.get(`${INTEGRATION_TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${workspacesId}`, {
|
await standardRequest.get(
|
||||||
headers: {
|
`${INTEGRATION_TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${workspacesId}`,
|
||||||
Authorization: `Bearer ${accessToken}`,
|
{
|
||||||
Accept: "application/json",
|
headers: {
|
||||||
},
|
Authorization: `Bearer ${accessToken}`,
|
||||||
})
|
Accept: "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
).data.data;
|
).data.data;
|
||||||
|
|
||||||
const apps = []
|
const apps = [];
|
||||||
|
|
||||||
const appsObj = {
|
const appsObj = {
|
||||||
name: res?.attributes.name,
|
name: res?.attributes.name,
|
||||||
appId: res?.id,
|
appId: res?.id
|
||||||
};
|
};
|
||||||
|
|
||||||
apps.push(appsObj)
|
apps.push(appsObj);
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of repositories for GitLab integration
|
* Return list of repositories for GitLab integration
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
@@ -746,13 +762,15 @@ const getAppsTerraformCloud = async ({
|
|||||||
const getAppsGitlab = async ({
|
const getAppsGitlab = async ({
|
||||||
integrationAuth,
|
integrationAuth,
|
||||||
accessToken,
|
accessToken,
|
||||||
teamId,
|
teamId
|
||||||
}: {
|
}: {
|
||||||
integrationAuth: IIntegrationAuth;
|
integrationAuth: IIntegrationAuth;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
teamId?: string;
|
teamId?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const gitLabApiUrl = integrationAuth.url ? `${integrationAuth.url}/api` : INTEGRATION_GITLAB_API_URL;
|
const gitLabApiUrl = integrationAuth.url
|
||||||
|
? `${integrationAuth.url}/api`
|
||||||
|
: INTEGRATION_GITLAB_API_URL;
|
||||||
|
|
||||||
const apps: App[] = [];
|
const apps: App[] = [];
|
||||||
|
|
||||||
@@ -766,24 +784,21 @@ const getAppsGitlab = async ({
|
|||||||
while (hasMorePages) {
|
while (hasMorePages) {
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
page: String(page),
|
page: String(page),
|
||||||
per_page: String(perPage),
|
per_page: String(perPage)
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data } = await standardRequest.get(
|
const { data } = await standardRequest.get(`${gitLabApiUrl}/v4/groups/${teamId}/projects`, {
|
||||||
`${gitLabApiUrl}/v4/groups/${teamId}/projects`,
|
params,
|
||||||
{
|
headers: {
|
||||||
params,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
"Accept-Encoding": "application/json"
|
||||||
Authorization: `Bearer ${accessToken}`,
|
|
||||||
"Accept-Encoding": "application/json",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
data.map((a: any) => {
|
data.map((a: any) => {
|
||||||
apps.push({
|
apps.push({
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -800,32 +815,29 @@ const getAppsGitlab = async ({
|
|||||||
await standardRequest.get(`${gitLabApiUrl}/v4/user`, {
|
await standardRequest.get(`${gitLabApiUrl}/v4/user`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
while (hasMorePages) {
|
while (hasMorePages) {
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
page: String(page),
|
page: String(page),
|
||||||
per_page: String(perPage),
|
per_page: String(perPage)
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data } = await standardRequest.get(
|
const { data } = await standardRequest.get(`${gitLabApiUrl}/v4/users/${id}/projects`, {
|
||||||
`${gitLabApiUrl}/v4/users/${id}/projects`,
|
params,
|
||||||
{
|
headers: {
|
||||||
params,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
"Accept-Encoding": "application/json"
|
||||||
Authorization: `Bearer ${accessToken}`,
|
|
||||||
"Accept-Encoding": "application/json",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
data.map((a: any) => {
|
data.map((a: any) => {
|
||||||
apps.push({
|
apps.push({
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -849,7 +861,7 @@ const getAppsGitlab = async ({
|
|||||||
*/
|
*/
|
||||||
const getAppsTeamCity = async ({
|
const getAppsTeamCity = async ({
|
||||||
integrationAuth,
|
integrationAuth,
|
||||||
accessToken,
|
accessToken
|
||||||
}: {
|
}: {
|
||||||
integrationAuth: IIntegrationAuth;
|
integrationAuth: IIntegrationAuth;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
@@ -858,15 +870,15 @@ const getAppsTeamCity = async ({
|
|||||||
await standardRequest.get(`${integrationAuth.url}/app/rest/projects`, {
|
await standardRequest.get(`${integrationAuth.url}/app/rest/projects`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
Accept: "application/json",
|
Accept: "application/json"
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
).data.project.slice(1);
|
).data.project.slice(1);
|
||||||
|
|
||||||
const apps = res.map((a: any) => {
|
const apps = res.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -881,20 +893,17 @@ const getAppsTeamCity = async ({
|
|||||||
* @returns {String} apps.name - name of Supabase app
|
* @returns {String} apps.name - name of Supabase app
|
||||||
*/
|
*/
|
||||||
const getAppsSupabase = async ({ accessToken }: { accessToken: string }) => {
|
const getAppsSupabase = async ({ accessToken }: { accessToken: string }) => {
|
||||||
const { data } = await standardRequest.get(
|
const { data } = await standardRequest.get(`${INTEGRATION_SUPABASE_API_URL}/v1/projects`, {
|
||||||
`${INTEGRATION_SUPABASE_API_URL}/v1/projects`,
|
headers: {
|
||||||
{
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
"Accept-Encoding": "application/json"
|
||||||
Authorization: `Bearer ${accessToken}`,
|
|
||||||
"Accept-Encoding": "application/json",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
const apps = data.map((a: any) => {
|
const apps = data.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -909,20 +918,17 @@ const getAppsSupabase = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
* @returns {String} apps.name - name of Checkly account
|
* @returns {String} apps.name - name of Checkly account
|
||||||
*/
|
*/
|
||||||
const getAppsCheckly = async ({ accessToken }: { accessToken: string }) => {
|
const getAppsCheckly = async ({ accessToken }: { accessToken: string }) => {
|
||||||
const { data } = await standardRequest.get(
|
const { data } = await standardRequest.get(`${INTEGRATION_CHECKLY_API_URL}/v1/accounts`, {
|
||||||
`${INTEGRATION_CHECKLY_API_URL}/v1/accounts`,
|
headers: {
|
||||||
{
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
Accept: "application/json"
|
||||||
Authorization: `Bearer ${accessToken}`,
|
|
||||||
"Accept": "application/json",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
const apps = data.map((a: any) => {
|
const apps = data.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -948,19 +954,19 @@ const getAppsCloudflarePages = async ({
|
|||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept": "application/json",
|
Accept: "application/json"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const apps = data.result.map((a: any) => {
|
const apps = data.result.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return apps;
|
return apps;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of repositories for the BitBucket integration based on provided BitBucket workspace
|
* Return list of repositories for the BitBucket integration based on provided BitBucket workspace
|
||||||
@@ -972,7 +978,7 @@ const getAppsCloudflarePages = async ({
|
|||||||
*/
|
*/
|
||||||
const getAppsBitBucket = async ({
|
const getAppsBitBucket = async ({
|
||||||
accessToken,
|
accessToken,
|
||||||
workspaceSlug,
|
workspaceSlug
|
||||||
}: {
|
}: {
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
workspaceSlug?: string;
|
workspaceSlug?: string;
|
||||||
@@ -996,45 +1002,42 @@ const getAppsBitBucket = async ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!workspaceSlug) {
|
if (!workspaceSlug) {
|
||||||
return []
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const repositories: Repository[] = [];
|
const repositories: Repository[] = [];
|
||||||
let hasNextPage = true;
|
let hasNextPage = true;
|
||||||
let repositoriesUrl = `${INTEGRATION_BITBUCKET_API_URL}/2.0/repositories/${workspaceSlug}`
|
let repositoriesUrl = `${INTEGRATION_BITBUCKET_API_URL}/2.0/repositories/${workspaceSlug}`;
|
||||||
|
|
||||||
while (hasNextPage) {
|
while (hasNextPage) {
|
||||||
const { data }: { data: RepositoriesResponse } = await standardRequest.get(
|
const { data }: { data: RepositoriesResponse } = await standardRequest.get(repositoriesUrl, {
|
||||||
repositoriesUrl,
|
headers: {
|
||||||
{
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
Accept: "application/json"
|
||||||
Authorization: `Bearer ${accessToken}`,
|
}
|
||||||
"Accept": "application/json",
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (data?.values.length > 0) {
|
if (data?.values.length > 0) {
|
||||||
data.values.forEach((repository) => {
|
data.values.forEach((repository) => {
|
||||||
repositories.push(repository)
|
repositories.push(repository);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.next) {
|
if (data.next) {
|
||||||
repositoriesUrl = data.next
|
repositoriesUrl = data.next;
|
||||||
} else {
|
} else {
|
||||||
hasNextPage = false
|
hasNextPage = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const apps = repositories.map((repository) => {
|
const apps = repositories.map((repository) => {
|
||||||
return {
|
return {
|
||||||
name: repository.name,
|
name: repository.name,
|
||||||
appId: repository.uuid,
|
appId: repository.uuid
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return apps;
|
return apps;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** Return list of projects for Northflank integration
|
/** Return list of projects for Northflank integration
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
@@ -1045,19 +1048,14 @@ const getAppsBitBucket = async ({
|
|||||||
const getAppsNorthflank = async ({ accessToken }: { accessToken: string }) => {
|
const getAppsNorthflank = async ({ accessToken }: { accessToken: string }) => {
|
||||||
const {
|
const {
|
||||||
data: {
|
data: {
|
||||||
data: {
|
data: { projects }
|
||||||
projects
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} = await standardRequest.get(
|
} = await standardRequest.get(`${INTEGRATION_NORTHFLANK_API_URL}/v1/projects`, {
|
||||||
`${INTEGRATION_NORTHFLANK_API_URL}/v1/projects`,
|
headers: {
|
||||||
{
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
"Accept-Encoding": "application/json"
|
||||||
Authorization: `Bearer ${accessToken}`,
|
|
||||||
"Accept-Encoding": "application/json",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
const apps = projects.map((a: any) => {
|
const apps = projects.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
@@ -1076,27 +1074,22 @@ const getAppsNorthflank = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
* @returns {Object[]} apps - names of Supabase apps
|
* @returns {Object[]} apps - names of Supabase apps
|
||||||
* @returns {String} apps.name - name of Supabase app
|
* @returns {String} apps.name - name of Supabase app
|
||||||
*/
|
*/
|
||||||
const getAppsCodefresh = async ({
|
const getAppsCodefresh = async ({ accessToken }: { accessToken: string }) => {
|
||||||
accessToken,
|
|
||||||
}: {
|
|
||||||
accessToken: string;
|
|
||||||
}) => {
|
|
||||||
const res = (
|
const res = (
|
||||||
await standardRequest.get(`${INTEGRATION_CODEFRESH_API_URL}/projects`, {
|
await standardRequest.get(`${INTEGRATION_CODEFRESH_API_URL}/projects`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
const apps = res.projects.map((a: any) => ({
|
const apps = res.projects.map((a: any) => ({
|
||||||
name: a.projectName,
|
name: a.projectName,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1107,15 +1100,12 @@ const getAppsCodefresh = async ({
|
|||||||
* @returns {String} apps.name - name of Windmill workspace
|
* @returns {String} apps.name - name of Windmill workspace
|
||||||
*/
|
*/
|
||||||
const getAppsWindmill = async ({ accessToken }: { accessToken: string }) => {
|
const getAppsWindmill = async ({ accessToken }: { accessToken: string }) => {
|
||||||
const { data } = await standardRequest.get(
|
const { data } = await standardRequest.get(`${INTEGRATION_WINDMILL_API_URL}/workspaces/list`, {
|
||||||
`${INTEGRATION_WINDMILL_API_URL}/workspaces/list`,
|
headers: {
|
||||||
{
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
"Accept-Encoding": "application/json"
|
||||||
Authorization: `Bearer ${accessToken}`,
|
|
||||||
"Accept-Encoding": "application/json",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
// check for write access of secrets in windmill workspaces
|
// check for write access of secrets in windmill workspaces
|
||||||
const writeAccessCheck = data.map(async (app: any) => {
|
const writeAccessCheck = data.map(async (app: any) => {
|
||||||
@@ -1134,8 +1124,8 @@ const getAppsWindmill = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1150,30 +1140,30 @@ const getAppsWindmill = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// is write access is allowed then delete the created secrets from workspace
|
// is write access is allowed then delete the created secrets from workspace
|
||||||
if (writeUser && writeFolder) {
|
if (writeUser && writeFolder) {
|
||||||
await standardRequest.delete(
|
await standardRequest.delete(
|
||||||
`${INTEGRATION_WINDMILL_API_URL}/w/${app.id}/variables/delete/${userPath}`,
|
`${INTEGRATION_WINDMILL_API_URL}/w/${app.id}/variables/delete/${userPath}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
await standardRequest.delete(
|
await standardRequest.delete(
|
||||||
`${INTEGRATION_WINDMILL_API_URL}/w/${app.id}/variables/delete/${folderPath}`,
|
`${INTEGRATION_WINDMILL_API_URL}/w/${app.id}/variables/delete/${folderPath}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1192,12 +1182,12 @@ const getAppsWindmill = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
const apps = appsWithWriteAccess.map((a: any) => {
|
const apps = appsWithWriteAccess.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
name: a.name,
|
name: a.name,
|
||||||
appId: a.id,
|
appId: a.id
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of applications for DigitalOcean App Platform integration
|
* Return list of applications for DigitalOcean App Platform integration
|
||||||
@@ -1239,7 +1229,27 @@ const getAppsDigitalOceanAppPlatform = async ({ accessToken }: { accessToken: st
|
|||||||
name: a.spec.name,
|
name: a.spec.name,
|
||||||
appId: a.id
|
appId: a.id
|
||||||
}));
|
}));
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const getAppsHasuraCloud = async ({ accessToken }: { accessToken: string }) => {
|
||||||
|
const res = await standardRequest.post(
|
||||||
|
INTEGRATION_HASURA_CLOUD_API_URL,
|
||||||
|
{
|
||||||
|
query: "query MyQuery { projects { name tenant { id } } }"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `pat ${accessToken}`,
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const data = (res?.data?.data?.projects ?? []).map(
|
||||||
|
({ name, tenant: { id: appId } }: { name: string; tenant: { id: string } }) => ({ name, appId })
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of applications for Cloud66 integration
|
* Return list of applications for Cloud66 integration
|
||||||
@@ -1290,7 +1300,7 @@ const getAppsCloud66 = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
"Accept-Encoding": "application/json"
|
"Accept-Encoding": "application/json"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
).data.response as Cloud66Apps[]
|
).data.response as Cloud66Apps[];
|
||||||
|
|
||||||
const apps = stacks.map((app) => ({
|
const apps = stacks.map((app) => ({
|
||||||
name: app.name,
|
name: app.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user