Compare commits

...

9 Commits

Author SHA1 Message Date
Deepak Prabhakara 5e24d3a163
Merge 5e13e4bae3 into 7022aa68e1 2024-05-02 09:44:21 +01:00
dependabot[bot] 7022aa68e1
Bump @types/node from 20.12.7 to 20.12.8 in /npm (#2648)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.12.7 to 20.12.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-02 09:16:19 +01:00
dependabot[bot] 49c611a09a
Bump @aws-sdk/client-dynamodb from 3.565.0 to 3.567.0 in /npm (#2649)
Bumps [@aws-sdk/client-dynamodb](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-dynamodb) from 3.565.0 to 3.567.0.
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-dynamodb/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.567.0/clients/client-dynamodb)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-dynamodb"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-02 09:16:14 +01:00
dependabot[bot] a8c14dec7a
Bump @aws-sdk/credential-providers from 3.565.0 to 3.567.0 in /npm (#2650)
Bumps [@aws-sdk/credential-providers](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/credential-providers) from 3.565.0 to 3.567.0.
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/credential-providers/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.567.0/packages/credential-providers)

---
updated-dependencies:
- dependency-name: "@aws-sdk/credential-providers"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-02 09:04:00 +01:00
dependabot[bot] 3ee670f057
Bump @types/node from 20.12.7 to 20.12.8 in /internal-ui (#2651)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.12.7 to 20.12.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-02 09:03:55 +01:00
dependabot[bot] 044f452945
Bump daisyui from 4.10.2 to 4.10.3 (#2652)
Bumps [daisyui](https://github.com/saadeghi/daisyui) from 4.10.2 to 4.10.3.
- [Release notes](https://github.com/saadeghi/daisyui/releases)
- [Changelog](https://github.com/saadeghi/daisyui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/saadeghi/daisyui/compare/v4.10.2...v4.10.3)

---
updated-dependencies:
- dependency-name: daisyui
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-02 09:03:51 +01:00
Deepak Prabhakara 5e13e4bae3 Merge commit '886b8550981a2fc6fc399c1d0d6db22cee875805' into chore/apis 2024-04-30 15:06:23 +01:00
Deepak Prabhakara c2cfb2cc68 cleanup 2024-04-30 15:06:09 +01:00
Deepak Prabhakara 03e28973c0 use lib/api defaultHandler 2024-04-29 22:29:49 +01:00
28 changed files with 466 additions and 548 deletions

View File

@ -3,19 +3,14 @@ import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import stream from 'stream';
import { promisify } from 'util';
import { defaultHandler } from '@lib/api';
const pipeline = promisify(stream.pipeline);
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Display the metadata for the SAML federation

View File

@ -2,21 +2,12 @@ import { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${req.method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get SAML federated apps filtered by the product

View File

@ -8,12 +8,11 @@
"name": "@boxyhq/internal-ui",
"version": "0.0.0",
"dependencies": {
"@rollup/rollup-linux-x64-gnu": "4.17.2",
"vite-tsconfig-paths": "4.3.2"
},
"devDependencies": {
"@rollup/plugin-typescript": "11.1.6",
"@types/node": "20.12.7",
"@types/node": "20.12.8",
"@types/react": "18.3.1",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
@ -1611,9 +1610,10 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.12.7",
"version": "20.12.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz",
"integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~5.26.4"
}

View File

@ -26,7 +26,7 @@
},
"devDependencies": {
"@rollup/plugin-typescript": "11.1.6",
"@types/node": "20.12.7",
"@types/node": "20.12.8",
"@types/react": "18.3.1",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",

576
npm/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,8 @@
"coverage-map": "map.js"
},
"dependencies": {
"@aws-sdk/client-dynamodb": "3.565.0",
"@aws-sdk/credential-providers": "3.565.0",
"@aws-sdk/client-dynamodb": "3.567.0",
"@aws-sdk/credential-providers": "3.567.0",
"@aws-sdk/util-dynamodb": "3.565.0",
"@boxyhq/error-code-mnemonic": "0.1.1",
"@boxyhq/metrics": "0.2.6",
@ -65,7 +65,7 @@
"devDependencies": {
"@faker-js/faker": "8.4.1",
"@types/lodash": "4.17.0",
"@types/node": "20.12.7",
"@types/node": "20.12.8",
"@types/sinon": "17.0.3",
"@types/tap": "15.0.11",
"cross-env": "7.0.3",

16
package-lock.json generated
View File

@ -24,7 +24,7 @@
"classnames": "2.5.1",
"cors": "2.8.5",
"cross-env": "7.0.3",
"daisyui": "4.10.2",
"daisyui": "4.10.3",
"formik": "2.4.6",
"i18next": "23.11.3",
"medium-zoom": "1.1.0",
@ -97,7 +97,7 @@
"vite": "5.2.10"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "4.17.1"
"@rollup/rollup-linux-x64-gnu": "4.17.2"
},
"peerDependencies": {
"@boxyhq/react-ui": ">=3.3.42",
@ -4311,9 +4311,9 @@
]
},
"node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.1.tgz",
"integrity": "sha512-AsdnINQoDWfKpBzCPqQWxSPdAWzSgnYbrJYtn6W0H2E9It5bZss99PiLA8CgmDRfvKygt20UpZ3xkhFlIfX9zQ==",
"version": "4.17.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.2.tgz",
"integrity": "sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==",
"cpu": [
"x64"
],
@ -8108,9 +8108,9 @@
}
},
"node_modules/daisyui": {
"version": "4.10.2",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.10.2.tgz",
"integrity": "sha512-eCWS1W/JPyxW9IvlgW5m0R6rp9ZhRsBTW37rvEUthckkjsV04u8XipV519OoccSA46ixhSJa3q7XLI1WUFtRCA==",
"version": "4.10.3",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.10.3.tgz",
"integrity": "sha512-LuxUmktsfO8nk0MKbg8NAth0K199pL2FzPMqhy7PGKFQ9LWIDdYVnc4f60Ior1bvbyZcXoH6/hhU068UuHksjA==",
"dependencies": {
"css-selector-tokenizer": "^0.8",
"culori": "^3",

View File

@ -75,7 +75,7 @@
"classnames": "2.5.1",
"cors": "2.8.5",
"cross-env": "7.0.3",
"daisyui": "4.10.2",
"daisyui": "4.10.3",
"formik": "2.4.6",
"i18next": "23.11.3",
"medium-zoom": "1.1.0",

View File

@ -1,20 +1,13 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
switch (method) {
case 'GET':
return await handleGET(req, res);
case 'DELETE':
return await handleDELETE(req, res);
case 'PATCH':
return await handlePATCH(req, res);
default:
res.setHeader('Allow', 'GET, DELETE, PATCH');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
await defaultHandler(req, res, {
GET: handleGET,
PATCH: handlePATCH,
DELETE: handleDELETE,
});
}
// Get directory by id

View File

@ -1,20 +1,11 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${req.method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
return res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get webhook events

View File

@ -1,24 +1,13 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
case 'DELETE':
await handleDELETE(req, res);
break;
default:
res.setHeader('Allow', 'GET, DELETE');
res.status(405).json({ error: { message: `Method ${req.method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
return res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
DELETE: handleDELETE,
});
}
// Get webhook events

View File

@ -1,16 +1,11 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get a group by id

View File

@ -1,17 +1,12 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the list of members (user_id only) in a group

View File

@ -1,17 +1,12 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the groups

View File

@ -1,23 +1,12 @@
import { defaultHandler } from '@lib/api';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
try {
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
return res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the connections filtered by the product

View File

@ -1,32 +1,16 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import type { SetupLinkService } from '@boxyhq/saml-jackson';
import jackson from '@lib/jackson';
import { defaultHandler } from '@lib/api';
const service: SetupLinkService = 'dsync';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
case 'POST':
await handlePOST(req, res);
break;
case 'DELETE':
await handleDELETE(req, res);
break;
default:
res.setHeader('Allow', 'GET, POST, DELETE');
res.status(405).json({
error: { message: `Method ${req.method} Not Allowed` },
});
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
POST: handlePOST,
DELETE: handleDELETE,
});
}
// Get the setup link by ID or (tenant + product + service) combination

View File

@ -2,26 +2,14 @@ import type { NextApiRequest, NextApiResponse } from 'next';
import type { SetupLinkService } from '@boxyhq/saml-jackson';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { defaultHandler } from '@lib/api';
const service: SetupLinkService = 'dsync';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
default:
res.setHeader('Allow', 'GET');
res.status(405).json({
error: { message: `Method ${req.method} Not Allowed` },
});
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the setup links filtered by the product

View File

@ -1,16 +1,11 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get a user by id

View File

@ -1,17 +1,12 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the users

View File

@ -1,20 +1,11 @@
import { defaultHandler } from '@lib/api';
import jackson from '@lib/jackson';
import { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${req.method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the saml trace by id

View File

@ -1,20 +1,11 @@
import { defaultHandler } from '@lib/api';
import jackson from '@lib/jackson';
import { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${req.method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the sso traces filtered by the product

View File

@ -1,24 +1,13 @@
import { defaultHandler } from '@lib/api';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
case 'DELETE':
await handleDelete(req, res);
break;
default:
res.setHeader('Allow', 'GET,DELETE');
res.status(405).json({ error: { message: `Method ${req.method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
DELETE: handleDELETE,
});
}
// Get the sso traces filtered by the product
@ -36,7 +25,7 @@ const handleGET = async (req: NextApiRequest, res: NextApiResponse) => {
res.json(traces);
};
const handleDelete = async (req: NextApiRequest, res: NextApiResponse) => {
const handleDELETE = async (req: NextApiRequest, res: NextApiResponse) => {
const { adminController } = await jackson();
const { product } = req.query as {

View File

@ -1,23 +1,12 @@
import jackson from '@lib/jackson';
import { NextApiRequest, NextApiResponse } from 'next';
import type { GetConnectionsQuery } from '@boxyhq/saml-jackson';
import { defaultHandler } from '@lib/api';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
try {
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
return res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Check if a connection exists

View File

@ -1,23 +1,12 @@
import { defaultHandler } from '@lib/api';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
try {
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
return res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the connections filtered by the product

View File

@ -1,32 +1,16 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import type { SetupLinkService } from '@boxyhq/saml-jackson';
import jackson from '@lib/jackson';
import { defaultHandler } from '@lib/api';
const service: SetupLinkService = 'sso';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
case 'POST':
await handlePOST(req, res);
break;
case 'DELETE':
await handleDELETE(req, res);
break;
default:
res.setHeader('Allow', 'GET, POST, DELETE');
res.status(405).json({
error: { message: `Method ${req.method} Not Allowed` },
});
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
POST: handlePOST,
DELETE: handleDELETE,
});
}
// Get the setup link by ID or (tenant + product + service) combination

View File

@ -2,26 +2,14 @@ import type { NextApiRequest, NextApiResponse } from 'next';
import type { SetupLinkService } from '@boxyhq/saml-jackson';
import jackson from '@lib/jackson';
import { parsePaginateApiParams } from '@lib/utils';
import { defaultHandler } from '@lib/api';
const service: SetupLinkService = 'sso';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'GET':
await handleGET(req, res);
break;
default:
res.setHeader('Allow', 'GET');
res.status(405).json({
error: { message: `Method ${req.method} Not Allowed` },
});
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
// Get the setup links filtered by the product

View File

@ -1,34 +1,25 @@
import { defaultHandler } from '@lib/api';
import jackson from '@lib/jackson';
import { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
try {
switch (method) {
case 'GET':
return await handleGET(req, res);
default:
res.setHeader('Allow', 'GET');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
return res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
GET: handleGET,
});
}
const handleGET = async (req: NextApiRequest, res: NextApiResponse) => {
const { connectionAPIController, directorySyncController } = await jackson();
const { connectionAPIController, directorySyncController, samlFederatedController } = await jackson();
const sso_connections_count = await connectionAPIController.getCount();
const dsync_connections_count = await directorySyncController.directories.getCount();
const idfed_apps_count = samlFederatedController.app.getCount();
return res.json({
data: {
sso_connections: sso_connections_count,
dsync_connections: dsync_connections_count,
idfed_apps: idfed_apps_count,
},
});
};

View File

@ -1,23 +1,12 @@
import { defaultHandler } from '@lib/api';
import jackson from '@lib/jackson';
import { NextApiRequest, NextApiResponse } from 'next';
import { IndexNames } from 'npm/src/controller/utils';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
try {
switch (method) {
case 'POST':
return await handlePOST(req, res);
default:
res.setHeader('Allow', 'POST');
res.status(405).json({ error: { message: `Method ${method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
return res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
POST: handlePOST,
});
}
const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => {