mirror of https://github.com/boxyhq/jackson.git
Compare commits
9 Commits
66f74158a3
...
5e24d3a163
Author | SHA1 | Date |
---|---|---|
Deepak Prabhakara | 5e24d3a163 | |
dependabot[bot] | 7022aa68e1 | |
dependabot[bot] | 49c611a09a | |
dependabot[bot] | a8c14dec7a | |
dependabot[bot] | 3ee670f057 | |
dependabot[bot] | 044f452945 | |
Deepak Prabhakara | 5e13e4bae3 | |
Deepak Prabhakara | c2cfb2cc68 | |
Deepak Prabhakara | 03e28973c0 |
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue